query_id
stringlengths
4
64
query_authorID
stringlengths
6
40
query_text
stringlengths
66
72.1k
candidate_id
stringlengths
5
64
candidate_authorID
stringlengths
6
40
candidate_text
stringlengths
9
101k
826e38cfff175ae8539045b1ad037052524c028ef27308cb00d8d8f534b20bdb
['54793383d74d4dc5b04d031859eaeee7']
You need to provide a user name and a password if you want to connect to a Windows server through VPN using PPTP. Has the provided user name any function? Let's say you use the user name "<PERSON>" to connect to the network using PPTP VPN. <PERSON> doesn't have the rights to acces the folder "B" on the network. Does that mean I too can't access the folder if I use <PERSON>'s user name to connect (in the Windows own VPN connection dialog)? Or is the user name completely meaningless and just establishes a tunnel over VPN and has nothing to do with the ACLs in any way?
a80a7f43de35926ee3e497c25b00d117f65d61aa3abef74b8e1e66e2c5e82867
['54793383d74d4dc5b04d031859eaeee7']
The resolution of animations on my device look good in blender, but after rendering them the video quality drops greatly, even when increasing the sample rate. The first few frames, mostly of the still image also do not show any flaws, however, a few seconds in there's a great resolution drop. How can I fix this please?(https://i.stack.imgur.com/njRkp.png)
df5fda4c529bf051e7c7a77699be8e9d0564be2f20b42b8ce0a631ed4bdbb0be
['54b2934577d4447f81d2983f7a4ba273']
Activity A: pass data to activity B Intent i = new Intent(getApplicationContext,ActivityB.class); i.putExtra("DataA",dataA); i.startActivity(i); retrive data in ActvityB String a; Intent i = getIntent(); a= i.getStringExtra("DataA"); pass data in actvityc from ActivityB Intent i = new Intent(getApplicationContext,ActivityC.class); i.putExtra("DataA",a); i.putExtra("DataB",b); i.startActivity(i); retrive data in ActvityC String a,b; Intent i = getIntent(); a= i.getStringExtra("DataA"); b= i.getStringExtra("DataB");
ecce42912d7d8c4083889d5ec2a5a890f9eb4a35ef4a465d58cc8223a1d2be2d
['54b2934577d4447f81d2983f7a4ba273']
try this convert bitmap to string and pass this string to c# server if(fileUri1 != null) { bitmap1 = BitmapFactory.decodeFile(fileUri1.getPath(), options); ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); if(bitmap1 != null) { bitmap1.compress(Bitmap.CompressFormat.PNG, 50, baos1); byte[] b1 = baos1.toByteArray(); bitmapstring1 = Base64.encodeToString(b1, Base64.DEFAULT); } } webservice call: public class CallWebService extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { // Call Webservice for Get Menus WebServiceCall webServiceCall = new WebServiceCall(); // Custom class for call webservice BitmapFactory.Options options = new BitmapFactory.Options(); // downsizing image as it throws OutOfMemory Exception for larger // images options.inSampleSize = 8; parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair("Name",uname12)); parameters.add(new BasicNameValuePair("Address", uaddr12)); parameters.add(new BasicNameValuePair("Email", en)); parameters.add(new BasicNameValuePair("Qualification", uquali12)); parameters.add(new BasicNameValuePair("Phoneno", ucontactno12)); parameters.add(new BasicNameValuePair("Appliedfor", uappfor12)); parameters.add(new BasicNameValuePair("Image", bitmapstring)); parameters.add(new BasicNameValuePair("Resumeimage", bitmapstring1)); parameters.add(new BasicNameValuePair("Operation", "i")); Log.i("param<IP_ADDRESS>",parameters.toString()); response = webServiceCall.makeServiceCall(mUrlWebServiceLogin, parameters); Log.d("ResponseLogin:", response); return null; } @Override protected void onPostExecute(Void result) { if (progressDialog.isShowing()) progressDialog.dismiss(); if(response.contains("\"success\"")){ session.createLoginSession(uname12); Toast.makeText(getApplicationContext(),"Successfully inserted",Toast.LENGTH_SHORT).show(); Intent in = new Intent(getApplicationContext(),InterView.class); in.putExtra("Name",uname12); startActivity(in); finish(); }else{ Toast.makeText(getApplicationContext(),"data not inserted",Toast.LENGTH_SHORT).show(); } } @Override protected void onPreExecute() { progressDialog = new ProgressDialog(MainActivity.this); progressDialog.setMessage("Loading..."); progressDialog.show(); progressDialog.setCanceledOnTouchOutside(false); super.onPreExecute(); } }
ded6abccf68bf41dffc2308594638b35e3b3d4706a3d4a00ce2175d39c7dd6ab
['54b3ae2272594f119227bdfb61ac3311']
TL;DR: decide whether or not you need to conjoin/compress the files at all don't implement something like this yourself use .NET's ZipFile class When you re-open the file as a stream, you could use the stream's Seek method to go to the desired position (which you'd have to remember somewhere), and then read out the desired number of bytes (which you'd also have to either remember, or mark the end of the files with a marker bit). Modifying the files would also be immense fun. Don't do it! You'd be writing a bad tar equivalent, and plenty of other people have already done it, and better: sharpcompress sharpziplib .NET's own ZipFile Also note that .NET's binary serialisation is not guaranteed to be readable in later .NET versions. It's meant for transient things and not data archival. This may be important to you, and is another thing to consider. I don't know how what you're doing with the files; you might not want/need to do that - you might just be better off storing the things on disk as individual files. If compression/storage as a single file is in fact your thing, then I would recommend starting with .NET's ZipFile class, as you'd have no outside dependencies.
2161294714ae34b49e0d26c9f9006b6d20093bc3767aec22416e82fa3d8168a2
['54b3ae2272594f119227bdfb61ac3311']
Thank you for clarifying. If this is so, is it possible this entire passage says "Then commanded <PERSON> over the man, saying, Of every tree of the garden food *shall* you eat. Of the tree of knowledge of good and evil, you *should* not eat from, because in the day that you eat thereof, by death you shall perish"?
47bcf50d51a2e1437951fb6bae21e94c86b3b604cd225c1fb96a859fbf106060
['54bd0af52b204b959177b3405b87d2f1']
Im working in and Ember App that use a API build with Express js, for development i just run my express api and then run ember server --proxy http://localhost:8000 for example i could be whatever port, so now i have to deploy that to a production environment that im working on, i planing to use nginx, but what i do not know and can't fine is that once a build my ember app for PROD and make nginx serve this files, how do i do to make the ember app knows where to talk to the api.
1e813d670d9ae547d774befcd7c08ac74b1f61710668eb5638e97d0c7d0dba30
['54bd0af52b204b959177b3405b87d2f1']
im validating a form with form validation io, what happends if that im cloning de entire form before submiting via ajax, if i got a error in the back, a load a error msg with a button where if clicked load the form again, but the validator not loger working once is loaded. Here is a part of my code, if someone could help me: $.on("success.form.fv", function(e){ e.preventDefault(); var $form= $(e.target); var modal= $form.children(".modal-body"); var datos= $form.serialize(); var modalClonado= modal.children(".row").clone(); $.ajax({ success: function(data) { if ("user" in data) { modal.html(error+data.user+cerrarError); } } }); $form.on("click", "button", function(){ modal.html(modalClonado); $form.find("#submit") .removeClass("disabled") .prop("disabled", false); }); });
ee33479ea580a35beddb730c59bb749a63c70c9b69adfae85d64a54ab8fc8273
['54c2cffa31834da8842eb7a8686bc008']
I have a column in database of length 512. It is going to contain multiple email address separated by ";". How can I validate its respective variable in the entity so that all the email address are valid. List will not work as I need to persist it in the column. Here is the data: @Basic @Column(name = "CC_EMAIL_ADDRESS", nullable = true, length = 512) private String emailCC;
e59cadf945350bd97b7d74e5eaf604a237903695362988fac471b2e30a5997be
['54c2cffa31834da8842eb7a8686bc008']
I have two processes and one queue. First item is already picked from the queue by one process but it is not completed or in exception. Can we directly pick second item from the queue by another process? What is going to happen to the first item. Will it be in exception.
b3923c2acc83b793f58a31960a96056403cdc929a427332b43facb7c66d045a2
['54c707a9d0794da4ba234fc4af3295b9']
Ok, so it's not looking like there is a way to do this with just HTML. So instead, I decided to use JavaScript to handle the issue. I removed the <a> tag from around the W3 logo and added an onclick JavaScript function validatePage(). So here is basically a template for an XHTML Strict page that still allows you to include the validation icon. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>Title of document</title> <script type="text/javascript"> function validatePage() { var validatorUrl = "http://validator.w3.org/check?uri=http" + (document.URL).substring(5); window.open(validatorUrl); } </script> </head> <body> <h1>Test Template Page</h1> <p><img src="valid-xhtml1.png" alt="Valid XHTML 1.0 Strict" height="31" width="88" onclick="validatePage()" /></p> </body> </html> Notice how the validatorUrl variable trims off the "https" from the URL and instead uses "http". So I just circumvented using the HTTP referer header. Hope this helps someone else.
29e8dffe7f5370e4109e942c35c5e8cce6e612315cce22b0a72f4548e06502db
['54c707a9d0794da4ba234fc4af3295b9']
I agree with <PERSON>. I don't see any issue in having all of the information in the same table. The benefit to having it all in one table is that you won't have to do joins, etc when running database queries. Which means your application would run faster.
c9bdaaee9ddc56dd91c55456d9c207382a1794b5c9ee2818c293b470c8aaf9fd
['54c8991ecfa5450282adee7eecfe5c8d']
I building a react native app in typescript. I am using a drawerItems component from react navigation. <DrawerItems {...this.props} items={items} itemStyle={styles.drawerItem} labelStyle={material.body1} activeBackgroundColor="transparent" /> I have set my lint on very strict for learning purposes. And now i have the following error message: Prop spreading is forbiddeneslint(react/jsx-props-no-spreading) I have tried to pass the props seperated but it needs other props that i do not know where to get from. Can anyone show me how to rewrite this without prop spreading?
02e013aa32423b78719ee21144d71aa4eaa17633a3828875621fa9fa12ec8631
['54c8991ecfa5450282adee7eecfe5c8d']
I figured this out. I debugged the props and put all the childs in the seperately. The finished code looks like this: <DrawerNavigatorItems items={items} itemStyle={styles.drawerItem} labelStyle={material.body1Object} activeBackgroundColor="transparent" drawerPosition="left" renderIcon={renderIcon} getLabel={getLabel} onItemPress={onItemPress} /> Please note that i also updated my packages in the meantime so the original childs of ...props could have been different
2eefdbd4e28befafe459b50cbe186573fd8abce8ab3839e6460a98dfb07fdf08
['54ce4ef81d044a57b455dc8a6069f145']
The rateand total variables you defined are arrays of objets, not objects. So you cannot write: total[d.id] = d.total; I think what you want to do is: total.push({id: d.id, value: d.total}); One simple option might be to only the data structure, and to switch between between using total
8113487c5d2a4fbe3efbc678f52e84a7c21ca76bbf2ab386e8c0082f5f087413
['54ce4ef81d044a57b455dc8a6069f145']
What exactly are you trying to achieve? It doesn't really makes sense to add an attribute to store the isListedIn list on your nodes just to retrieve it later, as d3 already does that for you. If you want to get the data for a DOM element, you can use either d3.select('#el').data()[0]['isListedIn'] or d3.select('#el').each(function(d) { console.log(d.isListedIn); }); depending on what you want to do with it.
20118db862798bdccebe098c3942b39f8940a0ece50b3a7ec768ae5d79080661
['54d28de5348f47e3bbd8bfbc3e964341']
How does an x86 CPU knows which Interrupt Service Routine to run based on a hardware interrupt? I mean, is their some kind of mapping between a hardware interrupt number and a particular Interrupt Service Routine. If so, what is this mapping called and who or what loads it into memory?
2eab408dfbac214a861260cac0b47a586b4c81a146fb9411aba9755d6f5a5e87
['54d28de5348f47e3bbd8bfbc3e964341']
For example, a key on a keyboard is press causing a hardware interrupt to be generated to the CPU, the CPU sends an acknowledgement to the interrupt controller. At the stage of the interrupt process, how does the CPU knows which interrupt service routine to run based on a key press on the keyboard?
c1663e0cae1be2fd4ded0752d484d8c7eecc98b820370658511dfd493a5437d1
['54e434e117c24662803bf010fc682607']
i have a really simple question what is one of the ways to only fill a DB with data that is not already in the Table ? I am currently trying to implement a Project which gets data from a SharePoint List and stores it in a Table on my DataWarehouse, and i had to realise that if run more than once, it keeps filling the table with data it already has!
b79a4f3f654022dbf25d87e419253b459dbb387fbd29d891cb2d39b96eaa3a3a
['54e434e117c24662803bf010fc682607']
Hi there i currently have a text like the following being put out on a Report Table: Done:16 of 16 Processed; 7 Errors. Now i want every row that has anynumber of Errors higher than 0 to be Red (Coral) the simple idea would be something in the lines of: =iif(Fields!LastStatus.Value like "*1 Errors*","Coral","White") but as you can see, i would have to guess the amount which is to be displayed before the Word Errors. Is there a way for me to take the amount which Comes in before the word "Errors" turn that into a int ( CInt()) and then compare it: Number > 0, Coral, White. Is this possible, and if so how ?
a05cb5d4f6c77c0f51d1667a8b0512f78f8862329ed6ea13130d69904611e9b1
['54f95329e41d42adb3bd838579e686b2']
I'm developing NodeJS app using typescript and tslint and i'm using an external library for Google Places API that doesnt have any DefinitelyTyped so i wrote it myself but i ran into some situation that on a callback there is error and response properties and the error property sometimes return an object or string. i tried to do something like that: callback?: (err: IGooglePlacesError | string) but it didnt work and return that err.json is not found in string type.
d62d97d9dda092e14b5ce969cdfb302e905b8f3e6774a144d818e9fb73a6be8f
['54f95329e41d42adb3bd838579e686b2']
I'm trying to get a list of tasks that running on my ECS environment from AWS API, but I'm getting the same error all the time: User: arn:aws:iam<IP_ADDRESS>[my_id]:user/[username] is not authorized to perform: ecs:ListTasks on resource: * { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "ecs:RunTask", "ecs:ListTasks", "ecs:StartTask", "ecs:StopTask" ], "Resource": [ "arn:aws:ecs:us-east-1:[my_id]:task/*", "arn:aws:ecs:us-east-1:[my_id]:task-definition/*", "arn:aws:ecs:us-east-1:[my_id]:cluster/*", "arn:aws:ecs:us-east-1:[my_id]:task-set/*/*/*", "arn:aws:ecs:us-east-1:[my_id]:container-instance/*", "arn:aws:ecs:us-east-1:[my_id]:service/*" ] } ] } So as you can see I should access the action with all the available resources. What am I missing? Thank's.
b19f88b56bf3d107607a0e2102a3582fd73f0a7c9b58f97981f026daab705861
['5507f4a356594b139756403aecc05376']
El detalle es que no le das medidas en concreto a .bg-registro. Si se entiende que deseas que ocupe el 100% de alto (aunque así como lo configuras no va a darte el resultado que esperas), pero de que? mmm, no sé, pudiera ser de otro elemento anterior o de la ventana o el body, etc. No especificas. Tampoco le estás dando un ancho... y tienes inhabilitado background-size: cover;, lo suficiente para que no te funcione. Bueno, como no les estas dando medidas de ancho y alto al contenedor que tiene por fondo la imagen, este elemento sólo va a abarcar el mismo espacio que ocupen los elementos inherentes (como el formulario), y como el formulario tampoco tiene medidas definidas, simplemente todo se reduce al espacio que está ocupando el texto (...contiene un formulario...). Entonces, para cualquiera que sea el caso y/o medidas, lo ideal es que uses background-size: cover; y especificar el ancho y alto en que deseas que abarque en concreto (para el 100% de alto usa "viewport height", es decir height: 100vh;), así se ajustará la imagen al 100% del ancho o alto según se reajusten las dimensiones de la ventana o dispositivo, siendo siempre el lado más largo del contenedor el que queda al 100%, el otro quedará excedido, con el excedente oculto (esto procurará que siempre quede la imagen de fondo en toda el área del contenedor). No se debe ajustar al 100% de ancho y alto (con respecto a las medidas de la imagen) a la vez, porque si el dispositivo no tiene la misma proporción que la imagen, está se deformará quedando con un efecto "aplastado" o "alargado" que se ve muy, pero muy mal y poco (o nada) profesional. NOTA: Ten en cuenta que si la relación del alto o ancho del contenedor, ventana o dispositivo es muy amplio (por ejemplo 1000px de ancho por 400px de alto, o 500px de ancho por 1200px de alto) y tu imagen mide 1200px de ancho por 800px de alto (por mencionar un ejemplo), nunca va a poder apreciarse la imagen completa o exactamente en su proporción. También considera que si tienes una imagen de fondo en toda la ventana, tu formulario debería tener un fondo blanco, para que los textos sean claros y legibles, todo esto por uso y funcionalidad (es decir, para una buena UI/UX), ya que el diseño debe ser pensando en el usuario, y este te lo va a agradecer. Así que nunca pongas bloques de texto regular sobre imágenes de fondo. body { margin: 0; padding: 0; } .bg-registro { background-image: url("https://www.w3schools.com/css/paris.jpg"); height: 100vh; width: 100%; background-size: cover; display: block; } .farciment-formulari { width: 80%; margin: 50px 10%; height: 100px; display: inline-block; background-color: #fff; border-radius: 3px; padding: 15px; box-sizing: border-box; } <section class="bg-registro"> <div class="col-sm-offset-1 col-md-offset-1 col-lg-offset-1 col-xs-12 col-sm-10 col-md-10 col-lg-10 registrat"> <section> <form action='' method="POST"> <div class="farciment-formulari"> (....Contiene un formulario....) </div> </form> </section> </div> </section> <PERSON>. Saludos.
65627826b835b82a599cc36446809703f11b4d2b307d94b9b371706a39be12fe
['5507f4a356594b139756403aecc05376']
En efecto, el fastidio y el cansancio puede impedir ver las más sencillas de las soluciones, basta con tomar un descanso y volver al paso... El problema está al definir el directorio del archivo de conexión, al nivel del archivo donde se realiza la consulta ajax si es "inc/conexión.php", pero al nivel del archivo "img_menu.inc.php" hay que retroceder en la ruta... "../conexión.php" ya que "img_menu.inc.php" está en un subdirectorio dentro de "/inc". Vaya descuido.
9aaf56fb70d3815d491ce78270a367ae6b8b080f5e85727a97b4959d9c912f4d
['550c37379787451d85cff65075d7ceac']
Kendall tau rank distance is a metric only if you compare ranking of the elements. If you perform <PERSON> function comparing elements you will find cases where the triangular inequality does not work. Example: 0 0 0 10 10 10 and 5 5 5 0 0 0 scores 9 (using <PERSON> comparing elements) While 0 0 0 10 10 10 and 5 3 5 7 5 2 scores 3 and 5 3 5 7 5 2 and 5 5 5 0 0 0 scores 4 so 9 > 3 + 4. So triangular inequality is not working here. But if you operate with the sorting position of each element in it vector (aka ranking) triangular inequality is gauaranteed. This happens beacuase of repetitions of elements within vectors. We should call "Kendall tau ranking distance" to one of the algorithms and "Kendall tau distance" to the other Best <PERSON>
d0547556e434421c03113273e7b2243dc418f4f2599eb9a9fde8a61b38e12835
['550c37379787451d85cff65075d7ceac']
So I'm almost done an assignment involving Win32 programming and sockets, but I have to generate and analyze some statistics about the transfers. The only part I'm having trouble with is how to figure out the number of packets that were sent to the server from the client. The data sent can be variable-length, so I can't just divide the total bytes received by a #define'd value. We have to use asynchronous calls to do everything, so I've been trying to increment a counter with every FD_READ message I get for the server's socket. However, because I have to be able to accept a potentially large file size, I have to call recv/recvfrom with a buffer size around 64k. If I send a small packet (a-z), there are no problems. But if I send a string of 1024 characters 10x, the server reports 2 or 3 packets received, but 0% data loss in terms of bytes sent/received. Any idea how to get the number of packets? Thanks in advance :)
214ed9f754528f40a60af8bbc69dbbcdbd1a901e1ce8b31e2914647f82319ad0
['553ec8501b23469b9d8637329a767126']
I have a spider that works perfectly fine, but now I want to add another value to the item. The problem is the value stamp I need to pass is in parse. stamp value correlates to the link I pass to get_details, but stamp is on original page only. How can i modify code to add stamp value to every time I generate. Thank you def parse(self, response): stamp = response.xpath("//div[@class='byline']/time/@datetime") for url in response.xpath("//h2[@class='post-title']/a/@href").extract(): yield scrapy.Request(url, callback=self.get_details) def get_details(self, response): article = ArticleItem() article['title'] = response.xpath("//h1/text()").extract() article['url'] = response.url yield article
ea806c16e4f25bec8f32e972566fe36cfd778a60cebbcc461fc8f12528453539
['553ec8501b23469b9d8637329a767126']
At this moment I collect a timestamp directly from the website I parse but I noticed they don't differentiate am/pm. Is there a way to make DynamoDB or the script to put a timestamp with proper time (am/pm)? The only thing I could find was creation_time (boto3) but that's for the table. Any suggestions? Thank you. My pipeline: class DynamoDBStorePipeline(object): def process_item(self, item, spider): dynamodb = boto3.resource('dynamodb',region_name="us-west-2") table = dynamodb.Table('x') table.put_item( Item={ 'url': str(item['url']), 'title': item['title'].encode('utf-8'), 'stamp': item['stamp'].encode('utf-8'), } ) return item
5b93a8ba9c7bec5a61c23cf10fdcec3118690c5f20259671bfa17bc51ce793d6
['554f97395c4844e9a93fd44970898747']
You might wrap your Read and Check routine into another while-loop: bool validAreacode = false; while(!validAreacode) { // start of actual code // Write("Enter in the area code you want to call: "); areaCode = Convert.ToInt32(ReadLine()); x = 0; while (x < phoneAreacode.Length && areaCode != phoneAreacode[x]) ++x; if(x != phoneAreacode.Length) { validAreacode = true; cost = phoneCost[x]; } else { WriteLine("YOU MUST ENTER A VALID AREA CODE!"); } } This is the simplest solution for you (not so much changes in your code required). But your code still has the problems. Your program will be crashed if user tries to print any not digit character instead of area code.
35838abc79324912de87f206f6f49e831bbe54d91d8a1bd09c72d5157d2e4d9f
['554f97395c4844e9a93fd44970898747']
I see different solutions: Using JsonIgnoreAttribute on Id property like this: using System.Text.Json.Serialization; public class ProductResDto { [JsonIgnore] public int Id { get; set; } public string Product { get; set; } } Create Contract-layer for your application that will contain all the OutCountract models. So your Contract model will not contain Id property: public class ProductResOutContract { public string Product { get; set; } } And utilize it like: // GET api/<ProductController> [HttpPost] public async Task<IActionResult> Post(ProductReqDto model) { try { var product = await _context.Products .OrderBy(b => b.Name) .Where(w => w.Name == model.Name) .Select(c => new ProductResDto { Id = c.Id, Product = c.Name }).FirstAsync(); // Grades product.Grades = ''; // LOAD ADD. INFO (use product.Id like FK in DB) // Description product.Descriptions = ''; // LOAD ADD. INFO (use product.Id like FK in DB) // Files product.Files = ''; // LOAD ADD. INFO (use product.Id like FK in DB) // Parameters product.Parameters = ''; // LOAD ADD. INFO (use product.Id like FK in DB) var productOutContract = ConvertToOutCountract(product); return Ok(productOutContract); } catch (Exception e) { return NotFound(); } } private static ProductReqOutContract ConvertToOutCountract(ProductReqDto product) { var outCountract = new ProductOutContract { // Fill the properties; }; return outCountract; } Returning Id is also not bad. You should just handle the model on the frontend properly. I prefer the 2nd or the 3rd solution. It's more clear when the API-layer and data-layer are separate.
6d6d6b6ec694d83dbe7a5c6ddfa5233ee3cc693f024f53fa801a1b94d6d36d17
['5557730b33e54de6baa7beba7b140ced']
i'm trying to make a void with a Void as an argument in libgdx, how do i make it work? this is what i have: public class ReleaseDetector{ boolean Touched = false; // // --- Simple void for touch release detection, when looped. --- // --- and the argument void, or how i imagine it.. // public void ReleaseListener(void MyArgumentVoid)//<---The argument void { if (Gdx.input.isTouched()){ Touched = true; } if (!Gdx.input.isTouched() && Touched){ MyArgumentVoid();<----------// Call for a void from the Argument. Touched = false; } } } Usage in MyGdxGame class, or how i imagine it: public class MyGdxGame extends ApplicationAdapter { int Counter = 0; ReleaseDetector RD = new ReleaseDetector(); public void AddCounter(){// just a simple void. Counter++; } @Override public void render() { // Render Loop void. RD.ReleaseListener(AddCounter);// how i imagine it's usage. } } now, how am i making it real? i hope there is a simple way..
d3983f438d37adcb278a67c2c62dfccffd259096dac008ddc5da1ad6fffce0e7
['5557730b33e54de6baa7beba7b140ced']
Just a month ago all the code bellow worked fine for me. i could simply signup/login and use the real time database, until today.. i did everything as usually, created a new Unity Project, Switched the platform to android, imported relevant Firebase SDKs for unity, and copied the code bellow which i used before without problems. everything ended with a successful build on my old LG G2 mini. but with one little difference: any of Firebase functions are not being called, no crash, no freezes, no errors shown in Unity Editor, just NOT BEING CALLED and all code which comes after it. 2 weeks i'm trying to resolve this, tried to debug APK at real time, but i found nothing. private void Awake() { //Just an example to save typing in the login form UserNameInput.text = "<EMAIL_ADDRESS>"; // everything works until this line: auth = FirebaseAuth.DefaultInstance; // this function is not being called and everything goes after it doesnt work too. PasswordInput.text = "abcdefgh"; // Set up the Editor before calling into the realtime database. FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://testproject-69c2c.firebaseio.com/"); // Get the root reference location of the database. reference = FirebaseDatabase.DefaultInstance.RootReference; SignupButton.onClick.AddListener(() => Signup(UserNameInput.text, PasswordInput.text)); LoginButton.onClick.AddListener(() => Login(UserNameInput.text, PasswordInput.text)); }
791124837f97d74a21bafb8164c9a4602f8936ff7b5cb2e7c8a1ee472ccdf026
['555e44e123c944b7949ec97535673b53']
It's me again. So, I try to find another faster way and maybe the solution could be use multiprocessing. I try it today but I found some little problems that a I post it to somebody can help us. BTW. Meanwhile searching, I found another faster way, so if you are interested you can us this code from pmdarima.arima import auto_arima import pandas as pd import matplotlib.pyplot as plt import numpy as np %matplotlib inline series = pd.read_csv('dataset.csv', header=None, index_col=0, parse_dates=True, squeeze=True) train, test = series[1:900], series[900:] Arima_model=auto_arima(train, start_p=1, start_q=1, max_p=8, max_q=8, start_P=0, start_Q=0, max_P=8, max_Q=8, m=12, seasonal=True, trace=True, d=1, D=1, error_action='warn', suppress_warnings=True, random_state = 20, n_fits=30)
fab91eeb8914b2c1c5c5d08ee0b89ddf3e986a7ab46fb2709b8690460d8def5f
['555e44e123c944b7949ec97535673b53']
I have a service for alerts that comunicates work components whit an alert component that displays a pop-up. I work that whit EventEmitters like that: alert.service.ts export class AlertService { @Output() alert: EventEmitter<any> = new EventEmitter() sendAlertCont(data: any) { this.getAlert.emit(data) } } So, in any component I call the service function to activate the alert component any.component.ts export class AnyComponent { constructor(private _alert: AlertService){} clickedFunction(){ this._alert.sendAlertCont('You don't have permissions') } alert.component.ts export class AlertComponent implements OnInit { constructor(private _alert: AlertService){} ngOnInit(){ this._alert.alert.subscribe(data => { this.alerta = data $('app-alert').fadeToggle() }) } The question is: How can I do the service function called sendAlertCont() returns a response sendig options in the data and getting the response in the component that sent the alert: AnyComponent: send Data => AlertService: active Alert => AlertComponent: show alert & options and then AlertComponent: Send Response => AlertService: get & send response => AnyComponent: recives response but all in the same function. Is posible? I was thinking somethig like a Observable, Promise o Async Function like: this._alert.sendAlertCont('You don't have permissions').then(...) var res = await this._alert.sendAlertCont('You don't have permissions') this._alert.sendAlertCont('You don't have permissions').suscribe(...)
c59c19350306e3b340307cc9899520b392e6e172635fb079caf58875dce236ee
['5564b0342a95490ea01a9d521b63d486']
I build a CNN model based on this tutorial: https://www.tensorflow.org/tutorials/layers However, I suspect that my model is sensitive to initialization of weights, because sometimes the model can run, but sometimes it gives NAN error. Hence, I'd like to initialize weights of my choice. How can I initialize weights in this case?
eba79a6b38cfab5b1c496b948fc0542a1c9a2008ab8970cfa4dc602eb1f1dc14
['5564b0342a95490ea01a9d521b63d486']
I am training a Deep Neural Nets using Pearson Correlation as my loss function. To compute the pearson correlation (p) between predictions and labels (per batch), I have two methods: Compute p row by row and sum them up, and divide them by the batch size to get the avg p. Compute p in one step: flatten all predictions as x and labels as y, and compute p = pearson_loss(x,y). For example, for input: X = [[1,2],[3,4]] and Y = [[-1,-2],[-3,-4]]. Compute first row, which is p1 = pearson_loss([1,2],[-1,-2]), and then second row, p2 = pearson_loss([3,4],[-3,-4]), and get avg p = (p1+p2)/2. Compute p = pearson_loss([1,2,3,4], [-1,-2,-3,-4]) Does this two method have huge difference? PS: In Tensorflow, I defined pearson loss using Keras as followed (use Method 2): def pearson_loss(x, y): mx = K.mean(x) my = K.mean(y) xm, ym = x-mx, y-my r_num = K.sum(tf.multiply(xm,ym)) r_den = K.sqrt(tf.multiply(K.sum(K.square(xm)), K.sum(K.square(ym)))) r = r_num / r_den # ensure r is in range r = K.maximum(K.minimum(r, 1.0), -1.0) return -r
a9ebd84e92a4487918ebea6ed988d111547ace9ce097b9921850efddd6872a85
['5565a614b52c48c193295c0996939499']
[Installing Indy for Delphi XE] Yes, the install process is tedious, but it's worth it to get it done right. This is for all Indy components except SSL. (I haven't tried any of the SSL stuff yet.) A.) Seek and destroy all Indy files that come with Delphi. These are no good as the Indy project is updated every single day with new bug fixes. If Delphi picks up any of the old files instead of your new fresh Indy library, you will get crazy errors from the IDE at all different times that are very hard to trace. i. Go to Component-->Install Packages, then completely remove all packages that start with "Indy". ii. Close Delphi. iii. Erase all files that match "dclIndy*.bpl" and "Indy*.bpl" from Delphi's Bin folder. (C:\Program Files\Embarcadero\RAD Studio\8.0\bin) iv. Erase all files that match "Indy*.dcu" and "Id*.dcu"^^^ in Delphi's Lib sub folders. (C:\Program Files\Embarcadero\RAD Studio\8.0\lib\win32\debug) (C:\Program Files\Embarcadero\RAD Studio\8.0\lib\win32\release) ^^^ Warning: watch out for non-Indy DCUs that happen to begin with the letters "id" like "idispids.dcu" and "idoc.dcu" v. Delete the entire Indy10 source folder: (C:\Program Files\Embarcadero\RAD Studio\8.0\source\Indy10) B.) Download the latest Indy10_XXXX.zip from http://indy.fulgan.com/ZIP/ (If you get a compile error or runtime error using this zip file for any of the steps below -- don't be discouraged! Re-download the zip file on the following day and try again. This zip file gets updated every day and there is a chance that there may be some bugs/errors on any given day.) C.) Extract only the System, Core, and Protocols folders into your own Indy library folder. ex. (c:\MyDelphiComponents\Indy\Core) (c:\MyDelphiComponents\Indy\System) (c:\MyDelphiComponents\Indy\Protocols) D.) Launch Delphi. Ignore all failed package dialogs: These are the Embarcadero packages that rely on Indy! (Just click Ok on all errors, and indicate that any failed packages should not be loaded again.) E.) Go to Options-->Environment Options-->Delphi Options-->Browsing Path - Remove paths that start with $(BDS)\Lib\Indy10 F.) Go to Options-->Environment Options-->Delphi Options-->Library Path - Add your new System, Core, and Protocols folders from step C to Delphi's library path. G.) Perform the following 5 actions in order: (Just say OK to any dialogs about upgrading the project.) Important: After loading each dpk and before each build, go to: Project-->Options-->Description-->Build Control Set radio button to "Explicit Rebuild". (Actually, this is optional, but I always make packages Explicit Rebuild because they seem easier to handle that way, but I'd like to hear what other people think about this...) Build - System\IndySystem150.dpk Build - Core\IndyCore150.dpk Build first, then Install - Core\dclIndyCore150.dpk Build - Protocols\IndyProtocols150.dpk Build first, then Install - Protocols\dclIndyProtocols150.dpk ** Double check that you've set "Explicit Rebuild" on all packages! ** H.) Finally, go to Component-->Install Packages and find all of the packages that rely on Indy that were turned off during step D. Reactivate them, and restart Delphi. (If your new Indy hasn't changed too much from the one released with Delphi, those packages will use the new Indy!) ++ Note, you may not receive any errors right away when reactivating those Embarcadero packages, but they may pop up at random times later. For example, I just installed Indy10_4548.zip and all the reactivated packages seemed fine. Then a day later out of the blue, the IDE threw me a message that said it couldn't find GetRequestHeaders in TIdCustomHTTP and that the dclWindowsAzureManagement150.bpl was having trouble as a result. So I had to go back and disable that Windows Azure package in the IDE.
cd6dab4ff5a742656dfe1e145ca4240d922eda813c2a42d77f8a2853134618f6
['5565a614b52c48c193295c0996939499']
I am using Penalized spline to smooth noisy data. Those splines are non parametric regression models which only rely on a smoothing parameter $\lambda \geq 0$ (which has to be chosen). I would like to find the "best" parameter that would describe well data without overfiting it or underfiting. Let $(x_i,y_i)_{i\in[1,n]}$ be a set of points such that $x_1 < x_2 <\dots < x_n$ . Once $\lambda$ is chosen the corresponding penalized spline curve $f$ found minimizes $\displaystyle \sum_{i=1}^{n} (y_i - f(x_i))^2 + \lambda \int_{x_1}^{x_n} [f''(x)]^2 dx$ Basically $\lambda$ controls the trade-off between the goodness of fit and the smoothness of the fitted curve. if $\lambda= 0$, $f$ interpolate data hence it overfits if $\lambda\to +\infty$ the integral as too become smaller and smaller: $f$ obtained is a linear regression hence underfit data. I would like to find a way to find the optimal value of $\lambda$ but I cannot use a $\chi^2$ tests otherwise the solution found would be $\lambda = 0$. I found a criterion called cross-validated residual sum of squares (CVRSS) to minimize and the minimum corresponds to the best value $\lambda$ (Method described in Annex B of the following document http://curis.ku.dk/ws/files/<PHONE_NUMBER>/thesis_helene_rytgaard.pdf) But it gives me a corresponding $f$ curve which overfit too much data in my case. Many thanks in advance if you have a solution to propose to this problem
eb9775c1c8faa3a26dd0f5d4efbc0ee22aaa550f7760fd5375b8e08327b650ca
['5579c456c66441cb875361c1f356a28e']
The solution depends on circumstances. If you don't have much data then go with a Set Set<T> unique = new HashSet<>(yourList); (use LinkedHashSet if you care about the order. It creates a new collection, but usually it's not a problem. When you want to modify existing list and don't want to/can't create a new collection, you can remove duplicates like here: List<Integer> numbers = new ArrayList<>(asList(1, 1, 2, 1, 2, 3, 5)); System.out.println("Numbers: " + numbers); ListIterator<Integer> it = numbers.listIterator(); while (it.hasNext()) { int i = it.nextIndex(); Integer current = it.next(); for (int j = 0; j < i; ++j) { if (current.equals(numbers.get(j))) { it.remove(); break; } } } System.out.println("Unique: " + numbers); It works in O(n^2), but it works. Similar implementation, but simpler, is when the list is sorted - works in O(n) time. Both implementations are explained at Farenda: remove duplicates from list - various implementations.
695e267518dbc1b8f02cacd445f7e257a51366ae0674b44dab000bb27ab4f6f6
['5579c456c66441cb875361c1f356a28e']
In Java 8 atomic classes have been extended with two interesting functions: int getAndUpdate(IntUnaryOperator updateFunction) int updateAndGet(IntUnaryOperator updateFunction) Both are using the updateFunction to perform update of the atomic value. The difference is that the first one returns old value and the second one return the new value. The updateFunction may be implemented to do more complex "compare and set" operations than the standard one. For example it can check that atomic counter doesn't go below zero, normally it would require synchronization, and here the code is lock-free: public class Counter { private final AtomicInteger number; public Counter(int number) { this.number = new AtomicInteger(number); } /** @return true if still can decrease */ public boolean dec() { // updateAndGet(fn) executed atomically: return number.updateAndGet(n -> (n > 0) ? n - 1 : n) > 0; } } The code is taken from Java Atomic Example.
9876363337781b5be3aee82baac94525f0f490d7c9b9ec2af323143a5f895ef6
['5585b3a3334041f7a4b047b6527a3750']
I'm trying to put together some javascript that will output an answer in milliseconds. It's a script that calculates how long it will take to travel a certain distance. At the moment it takes the numbers to be divided from text boxes on my page. It seems to do the division but the result isn't correct. For example... var a = 3.7 (distance) and var b = 25 (speed) function journey_calc() { var a = +$("#txtDistance")[0].value; // example: 3.7 miles (distance) var b = +$("#txtSpeed")[0].value; // example: 25 mph (speed) var c = (a/b)/3600000; // returns the length of time it will take to travel the distance in hours, then divides by 3600000 to get the answer in milliseconds. $(".journey-finder-result").text(c); //posts answer to span on page } It "works" but "var c" is calculated incorrectly. Using the example above the answer should be 532800, but it returns 4.111111111111112e-8 The end goal is to convert the milliseconds into dd:hh:mm:ss form - am I approaching this incorrectly? Many thanks! Note: I am a newbie to javascript so I'm probably missing a very simple mistake!
378d675e268c0518e838bb11d70435e7ea2854ad152846626821ad758f7230e6
['5585b3a3334041f7a4b047b6527a3750']
I'm putting together a small site for a friend (I'm not really that much of an expert as you can probably tell!). We're experimenting with some design ideas and have come to a bit of a block. The page in question is: http://westleemusic.co.uk/concept/epdownload.php Basically when the window is resized so that the bottom of the viewport is high than the bottom of the content (in this case it's the "iPhone Users Click Here To Download"), the translucent background wrapper decides that it no longer wants to fill the page. I've been sat here for a few hours trying to figure it out and I'm stumped. As I said previously, I'm a n00b when it comes to this stuff so I'm hoping one of you masters can help! Let me know if you need more info! Many thanks
a83c589dc8658fb55ec08ef1fe454538ca4bb9b7734bb3a8faa982e2099c3654
['5588833286e84369a5651b7be428b29d']
For headless servers where there's no X and management is via ssh or whatever, a command-line solution is necessary. If resolv.conf is not overwritten, then that's the correct place to change nameservers. If resolv.conf does get overwritten then, on 14.04LTS at least, the files to edit are: /etc/resolvconf/resolv.conf.d/head /etc/resolvconf/resolv.conf.d/tail I strongly suggest putting comment strings into files like these, such that they appear in the generated file (/etc/resolve.conf) and you can find them in the future. I start and end each file with a one-line comment of the form: # ====== begin /etc/resolveconf/resolv.d/tail ====== # ====== end /etc/resolveconf/resolv.d/tail ====== and put the relevant directives between them.
6fa8d2480f2dc2046d5ad9bc0009b6ff01b739b6094511fd6d5f0c1bc500ae88
['5588833286e84369a5651b7be428b29d']
Firewire support has changed in the recent past. My system used to use ffado and now uses a derivative in alsa, of which I think firewire_ohci is a part. I've been trying to find out how to swap back to ffado to check or verify some odd behaviour on my external device. Sadly I'm still trying to find it.
9018e85d6139a88fff1fe8be0290906abbf2a336f2d17c1029225eea7d9ca35e
['558a74767d304c03b5387d040c6541d9']
I'm having trouble with the data.table package after installing a package from github using devtools. My custom function (which uses data.table functionality) works when I load the function locally, however when I create a custom package on github and install the package from github, the function no longer works. Load the required packages: require(PerformanceAnalytics) if(!require(PerformanceAnalytics)) install.packages("PerformanceAnalytics"); require(PerformanceAnalytics) require(data.table) if(!require(data.table)) install.packages("data.table"); require(data.table) require(devtools) if(!require(devtools)) install.packages("devtools"); require(devtools) Create a dummy dataset: data(edhec) EDHEC<-data.frame(date=index(edhec),coredata(edhec)) EDHEC<-melt(EDHEC,id.vars="date") EDHEC<-data.table(EDHEC,key=c("variable","date")) Install my package from github using devtools: install_github("r_jfreels","jfreels"); require(jfreels) Run my function: test_date(EDHEC) This gives an error: "Error in min(date) : invalid 'type' (closure) of argument" Now create the function locally: test_date<-function(DF) { DT<-data.table(date=DF$date,variable=DF$variable,value=DF$value,key=c('variable','value')) DT[,list(start_date=min(date),end_date=max(date)),by=variable] } Test the function again: test_date(EDHEC) This works. This is driving me nuts and I don't know what the problem is.
d309ee2bf0f93a880ccaabcf7df7e0560e2401b81f1e0008d1576cba1e395386
['558a74767d304c03b5387d040c6541d9']
require(dplyr) require(tidyr) x<-data.frame(dt=c('0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0', '0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0', '0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0', '0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0', '0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0', '0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0', '0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1')) x %>% separate(col=dt, into=toupper(letters[1:13])) # A B C D E F G H I J K L M #1 0 0 0 0 0 1 0 0 0 0 0 0 0 #2 0 0 0 0 0 1 0 0 0 0 0 0 0 #3 0 0 0 0 0 1 0 0 0 0 0 0 0 #4 0 0 1 0 0 1 0 0 0 0 0 0 0 #5 0 0 0 1 0 1 0 0 0 0 1 0 0 #6 0 0 0 0 0 1 0 0 0 0 1 0 0 #7 0 0 0 0 0 1 0 0 0 0 0 0 1
3e930e72e8100764729c99e990b4c4ff55819b1b00ef2194752130cefcbc180a
['55a32c693b03480786b2a4f84b745b0f']
Develop an algorithm for converting an HSV colour value into RGB colour and explain how and why it works correctly. Then consider the two HSV colours h1 = (156, 0.625, 0.8) and h2 = (300, 0.6, 0.5) and convert them into RGB (giving r1 and r2), CMY (c1, c2), and CMYK (k1, k2). Finally, compute the linearly interpolated colors h3 = 0.3h1 + 0.7h2 and r3 = 0.3r1 + 0.7r2 and compare them after having converted r3 into HSV. I have found the formula from the Wikipedia but I don't know what I have to do in order to get the correct result. I am confused with the CMY and CMYK and the linearly interpolated colors I have to compute too. So any help will be greatly appreciated.
7001be63d31b5ba5c08bec5b5766a7ffb508c642e41c4b6cf3482dde80154489
['55a32c693b03480786b2a4f84b745b0f']
I have a div with text and I want when I select (mouseover from letter to letter) a particular piece of the text to be highlighted simultaneously with background and underline. Also I want to draw random stuff in the div with the pointer like in paint. Any ideas on how to achieve this? At least for the first one.
fa996b1b3b49404f07e7e3a7e849d9ac0da0cffdcd8d168d0ef8ae91c1dead5b
['55b6f3f58e544cee878b136554af7f00']
I am compiling a library with Microsoft C++ compiler and build tools. My build environment sets the compile flag /GL, but for a specific library I need to turn that flag off. I can do so with /GL-, but I get a warning D9025, which simply tells me I am overriding the previous setting. I want to suppress this warning. But the command line option /wd only forks for Cxxx errors and warnings, not Dxxx warnings. How do I suppress the D9025 warning?
e2be683629cdb89607634a569b108e1131441b666abf9e9e903acacb443c0ec5
['55b6f3f58e544cee878b136554af7f00']
The following program fails in the zip step. x = sc.parallelize([1, 2, 3, 1, 2, 3]) y = sc.parallelize([1, 2, 3]) z = x.distinct() print x.zip(y).collect() The error that is produced depends on whether multiple partitions have been specified or not. I understand that the two RDDs [must] have the same number of partitions and the same number of elements in each partition. What is the best way to work around this restriction? I have been performing the operation with the following code, but I am hoping to find something more efficient. def safe_zip(left, right): ix_left = left.zipWithIndex().map(lambda row: (row[1], row[0])) ix_right = right.zipWithIndex().map(lambda row: (row[1], row[0])) return ix_left.join(ix_right).sortByKey().values()
1857568a5eb2229ac49dee5bebaf62393c061a5b7c8d995db346dfe7508d1a2f
['55c246fa85514908ba9bafb2fd63fbbc']
I want to implement for getting or loading 10 contacts at a time from address book.Any possibility to retrieve all contacts from address book but display them 10-10 contacts at a time.I am retrieving image,first name,last name of all iphone contacts.I want to implement this to email retrive email contacts also like 10-10 email contacts. Here is my sample code: SData *imageData = (NSData *)CFBridgingRelease(ABPersonCopyImageDataWithFormat(ref, kABPersonImageFormatThumbnail)) ; CFStringRef firstName1, lastName1; firstName1 = ABRecordCopyValue(ref, kABPersonFirstNameProperty); lastName1 = ABRecordCopyValue(ref, kABPersonLastNameProperty); NSString *name=[[NSString alloc]init]; if ([[NSString stringWithFormat:@"%@",firstName1] isEqualToString:@"(null)"] && [[NSString stringWithFormat:@"%@",lastName1] isEqualToString:@"(null)"]) { name = @"No Name"; } else if([[NSString stringWithFormat:@"%@",firstName1] isEqualToString:@"(null)"] && ![[NSString stringWithFormat:@"%@",lastName1] isEqualToString:@"(null)"]) { name = [NSString stringWithFormat:@"%@",lastName1]; } else { name = [NSString stringWithFormat:@"%@",firstName1]; } name= [ name capitalizedString]; EmailandCotactsModel *emailmodel=[[EmailandCotactsModel alloc]init]; emailmodel.emailemailstring=(__bridge NSString *)(contno); emailmodel.emailusernamestring=name; if(!imageData) { NSString *path = [[NSBundle mainBundle] pathForResource:@"NoImage" ofType:@"png"]; NSData *photoData = [NSData dataWithContentsOfFile:path]; emailmodel.emailimagesData=photoData; } else { emailmodel.emailimagesData=imageData; } [emailarray addObject:emailmodel]; callsmsDataBool=NO; NSLog(@"table email count %d and i %d",emailarray.count,tablecountint); if(emailarray.count==tablecountint) { NSLog(@"table email reload"); tablecountint=tablecountint+10; dispatch_async( dispatch_get_global_queue(0,0),^{ [self reloadtable]; }); NSLog(@"perform selection in bg"); } } } [self.tableview reloadData]; if(!emailarray.count && [socialstring isEqualToString:@"Email"]) { selectedlabel.text=@"Emails not found"; } else if(emailarray.count && [socialstring isEqualToString:@"Email"]) { // selectedlabel.text=@"Email"; selectedlabel.text=[NSString stringWithFormat:@"%ld",nPeople]; } else if(!emailarray.count && [socialstring isEqualToString:@"SMS"]) { selectedlabel.text=@"Phone no's not found"; } else if(emailarray.count && [socialstring isEqualToString:@"SMS"]) { selectedlabel.text=@"SMS"; } else { selectedlabel.text=@""; } [tableview reloadData]; Any valuable suggestions will be appreciated.... Thanks in advance.
86e50abe8aed7b519d97629e9e054807683f97d218f1710c21aef13af8c2d85b
['55c246fa85514908ba9bafb2fd63fbbc']
I have used the following code for your task.I used SDWebimage for assigning image.You can use without SDWebimage also.Its working try this if(indexPath.section==0) { if ([self.array count]>0) { if ([self.array count]>indexPath.row*3) { LooksObject *looksObjectRef1 = [self.array objectAtIndex:indexPath.row*3]; [cell.firstImage setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"no_image.png"]]; } if ([self.array count]>(indexPath.row*3)+1) { LooksObject *looksObjectRef2 = [self.array objectAtIndex:(indexPath.row*3)+1]; [cell.secondImage setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"image.png"]]; } if ([self.array count]>(indexPath.row*3)+2) { LooksObject *looksObjectRef3 = [self.array objectAtIndex:(indexPath.row*3)+2]; [cell.thirdImage setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"image.png"]]; } } }
c278d465c4b08d99d3318eeb6398dcc0a477fa0c0cc1246255f379a25b077a61
['55c447daa7c149fca2c85cf350df517d']
I am working with RecyclerView which support pagination with Firestore database.I want to showing into 10 items recylcerview an Ads,i try serveral times without succes,help me please to find the right code. Here is my code of pagination. //Initialize FirebasePagingOptions DatabasePagingOptions<Pubs> options = new DatabasePagingOptions.Builder<Pubs>() .setLifecycleOwner(this) .setQuery(mDatabase, config, Pubs.class) .build(); //Initialize Adapter mAdapter = new FirebaseRecyclerPagingAdapter<Pubs, PubsViewHolder>(options) { @Override public int getItemViewType(int position) { if (position % 5 == 0) return AD_TYPE; return CONTENT_TYPE; } @NonNull @Override public PubsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new PubsViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_pub, parent, false)); } @Override protected void onBindViewHolder(@NonNull PubsViewHolder holder, int position, @NonNull Pubs model) { holder.setItem(model); }
bb0eb4f1512981866a34563eaaa2e3defaadb721785ca5950e81cc10f767a431
['55c447daa7c149fca2c85cf350df517d']
Create Database in your application and make one class which save data in your database .when the user went to save data in firebase,checking connection if no save data in firebase and the first time that user open app with connection try to save it in firebase and delete data from data base look more information at this doc
2371beb687c038ae731991bd6cd5ecc03d3f47eb843365a06af1ca0ba5ab3a6d
['55c940e90a2646349db4d1db2af6d15b']
I think this is a bug. I came across the same issue. With the latest docker image I get the same issue when i run that command. If you raise a bug on https://github.com/ckan/ckan/issues that will have a look in to what is causing the issue /usr/local/bin/ckan-paster --plugin=ckan color "#0066aa" Traceback (most recent call last): File "/usr/local/bin/ckan-paster", line 8, in <module> sys.exit(run()) File "/usr/lib/ckan/venv/local/lib/python2.7/site-packages/paste/script/command.py", line 102, in run invoke(command, command_name, options, args[1:]) File "/usr/lib/ckan/venv/local/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke exit_code = runner.run(args) File "/usr/lib/ckan/venv/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run result = self.command() File "/usr/lib/ckan/venv/src/ckan/ckan/lib/cli.py", line 1616, in command path = os.path.join(path, '..', public, 'base', 'less', 'custom.less') File "/usr/lib/ckan/venv/lib/python2.7/posixpath.py", line 68, in join if b.startswith('/'): AttributeError: 'NoneType' object has no attribute 'startswith'
14b3ebc02aa592dae2172054a9d41951235a021366934b16f9445bdf93392801
['55c940e90a2646349db4d1db2af6d15b']
currently in the paho c++ in the git project it is not building correctly for new users. it creates an empty c++ library when you do a make so any code you link against that will fail with undefined method. you can check by running this command to see what is available in your library. nm -g lib/linmqttpp.so.0.1 You will see it is empty. Also if you copied and passed the example code from the website then it will not work. It needs other code beside what is on the website. It just gives you a code snippet. Example code is in this directory. src/samples paho c++ examples Currently the make file for the sample files will fail. I have submitted a patch just now to the project to fix the main build and the sample files build. Once that is applied the project will build correctly you can start hacking the sample files. With regards the C++ project not installing its because there is no target in the make file to do an install. if you want for now copy the files that are created in lib to the below with sudo permissions. /usr/local/lib/ Then you can access the shared libraries from any project.
243764a33cb129a62cb92cef51be6f4af6b63941fffebec6726af452a06f6a1c
['55cb1507f178445d8d395be591ea96b3']
IHello! I'm trying to code a lexer and parser for computer algebric system. When I'm compiling the code with my makefile, I have problems on the value of some functions. Here is the code of function.ml : (**************************************** * Type definitions ****************************************) type operator = Plus | Minus | Times | Div | Power;; type var = string;; (* e.g. "x", "y", etc. *) type power = var * float;; (* var, raised_to, e.g. ("x", 3.) -> x^3. *) type monomial = float * power list;; (* coefficient, list of power terms, e.g. (2., [("x", 1.); ("y", 3.)]) -> 2xy^3 *) type polynomial = monomial list;; (* sum of monomials, e.g. [(2., [("x", 2.); ("y", 3.)]); (-1., [])] -> 2x^2y^3 - 1 *) type frac = polynomial * polynomial;; (* numerator, denominator *) type exp = frac * frac;; (* base, exponent *) type term = Poly of polynomial | Frac of frac | Exp of exp;; type expr = Leaf of term | Node of operator * expr list;; type eqn = expr * expr;; (**************************************** * Lexer/Parser definitions ****************************************) type token = PLUS | MINUS | TIMES | DIV | POWER | LPAREN | RPAREN | EQUALS | FLOAT of float | VAR of var | EOF;; Here is the code of lexer.mll : { open Function } let numeric = ['0' - '9'] let letter = ['a' - 'z' 'A' - 'Z'] rule main = parse | [' ' '\t' '\n'] { main lexbuf } (* skip over whitespace *) | "+" { PLUS } | "-" { MINUS } | "*" { TIMES } | "/" { DIV } | "^" { POWER } | "(" { LPAREN } | ")" { RPAREN } | "=" { EQUALS } | ((numeric*) '.' (numeric+)) as n { FLOAT (float_of_string n) } | (numeric+) as n { FLOAT (float_of_string n) } | (letter numeric*) as n { VAR n } | eof { EOF } { let lexer_main = main;; let token_iterator_of_string s = let <PERSON> = Lexing.from_string s in fun () -> <PERSON>;; let token_list_of_string s = let <PERSON> = Lexing.from_string s and token_list_aux () = let token = lexer_main lbuf in if token = EOF then [] else token <IP_ADDRESS> token_list_aux () in token_list_aux ();; } Here is the code of parser.mly : %{ open Function %} %token PLUS MINUS TIMES DIV POWER LPAREN RPAREN EQUALS EOF %token <float> FLOAT %token <Function.var> VAR %start yacc_eqn %start yacc_expr %type <Function.eqn> yacc_eqn %type <Function.expr> yacc_expr %% yacc_eqn: exp EQUALS exp EOF { ($1, $3) } yacc_expr: exp EOF { $1 } exp: op1 { $1 } op1: op2 { $1 } | op1 PLUS op2 { Node(Plus, [$1; $3]) } | op1 MINUS op2 { Node(Minus, [$1; $3]) } op2: op3 { $1 } | op2 TIMES op3 { Node(Times, [$1; $3]) } | op2 DIV op3 { Node(Div, [$1; $3]) } op3: op4 { $1 } | op3 op4 { Node(Times, [$1; $2]) } op4: leaf { $1 } | op4 POWER leaf { Node(Power, [$1; $3]) } leaf: atom { $1 } | LPAREN exp RPAREN { $2 } atom: VAR { Leaf(Poly(poly_of_var $1)) } | FLOAT { Leaf(Poly(poly_of_float $1)) } %% let eqn_of_string s = yacc_eqn Lexer.lexer_main (Lexing.from_string s);; let expr_of_string s = yacc_expr Lexer.lexer_main (Lexing.from_string s);; let parse_eqn = eqn_of_string;; let parse_expr = expr_of_string;; The problem is that in the parser.mli which is create with the makefile, the value of yacc_eqn and yacc_expr are : val yacc_eqn : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Function.eqn val yacc_expr : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Function.expr And I have the following error : The implementation parser.ml does not match the interface parser.cmi: Values do not match: val yacc_eqn : (Lexing.lexbuf -> Function.token) -> Lexing.lexbuf -> Function.eqn is not included in val yacc_eqn : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Function.eqn I think the solution might be to something like a cast, but I have stricly no idea how to do that ... Anyone help ? Thanks in advance !
e1365229029f5e1c101494ec02f29f61b6abda3766ea2e02149e076baca7d6af
['55cb1507f178445d8d395be591ea96b3']
IHello! I'm currently trying to code in ocaml a programm to draw a function which was write by the user. To do that, I'm parsing the input, I'm tranforming the input into a data structure. I'm currently trying to create an ocaml function to simplify at maximum this input. For example, x*x - x*x will simplify in 0 Here is my parser : %{ open Function %} %token <float> FLOAT %token <string> VAR %token COS SIN SQRT EXP LN PUIS %token PLUS MINUS TIMES DIV %token LPAR RPAR %token EOL %left LPAR RPAR %left COS SIN SQRT EXP LN %left PLUS MINUS %left TIMES DIV %left PUIS %type <Function.formel> main %start main %% main: expr EOL { $1 } ; expr: | FLOAT { flt $1 } | VAR { var $1 } | FLOAT VAR { mul (flt $1) (var $2) } | LPAR expr RPAR { $2 } | expr TIMES expr { mul $1 $3 } | expr DIV expr { div $1 $3 } | expr PLUS expr { add $1 $3 } | expr MINUS expr { sub $1 $3 } | expr PUIS expr { puis $1 $3 } | COS LPAR expr RPAR { cos $3 } | PLUS expr { pos $2 } | MINUS expr { neg $2 } | FLOAT COS LPAR expr RPAR { mul (flt $1) (cos $4) } | SIN LPAR expr RPAR { sin $3 } | FLOAT SIN LPAR expr RPAR { mul (flt $1) (sin $4) } | SQRT LPAR expr RPAR { sqrt $3 } | LN LPAR expr RPAR { lnp $3 } | EXP LPAR expr RPAR { expo $3 } ; Here is my lexer : { open Parser exception Eof } rule token = parse | [' ' '\t'] { token lexbuf } | ['\n'] { EOL } | ['0'-'9']+ as lxm { FLOAT (float_of_string lxm) } | '+' { PLUS } | '-' { MINUS } | '*' { TIMES } | '/' { DIV } | '(' { LPAR } | ')' { RPAR } | '^' { PUIS } | "cos" { COS } | "sin" { SIN } | "sqrt" { SQRT } | "ln" { LN } | "exp" { EXP } | ['a'-'z']+ as lxm { VAR (lxm) } | eof { raise Eof } I think my parser and my lexer are good. Then, I'm using a tree to store the function : type formel = | Float of float | Var of string | Add of formel * formel | Sub of formel * formel | Mul of formel * formel | Div of formel * formel | Ln of formel | Cos of formel | Sin of formel | Puis of formel * formel | Sqrt of formel | Exp of formel let flt f = Float f let add e1 e2 = Add (e1, e2) let sub e1 e2 = Sub (e1, e2) let mul e1 e2 = Mul (e1, e2) let div e1 e2 = Div (e1, e2) let puis e1 e2 = Puis (e1, e2) let neg e = Mul (Float (-1.), e) let pos e = Mul (Float 1., e) let cos e = Cos e let sin e = Sin e let var v = Var v let sqrt e = Sqrt e let expo e = Exp e let lnp e = Ln e And here is the difficulty where I am : the creation of a function to simplify. let rec simplify f = let f_simplify = simp f in if f_simplify = f then f_simplify else simplify f_simplify and simp f = match f with | Float f -> Float f | Var x -> Var x (* 0 + x -> x *) | Add (Float 0., f) -> simp f (* x + 0 -> x *) | Add (f, Float 0.) -> simp f (* f1 + f2-> calcul (f1 + f2) *) | Add (Float f1, Float f2) -> Float (f1 +. f2) (* x + x -> 2 * x *) | Add (f, g) when f = g -> simp (Mul (Float 2., simp f)) (* f1 * x + x -> (f1 + 1) * x *) | Add (Mul (Float f1, f), g) when f = g -> simp (Mul (Float (f1 +. 1.), simp f)) (* x + f1 * x -> (f1 + 1) * x *) | Add (f, Mul (Float f1, g)) when f = g -> simp (Mul (Float (f1 +. 1.), simp f)) (* x * f1 + x -> (f1 + 1) * x *) | Add (Mul (f, Float f1), g) when f = g -> simp (Mul (Float (f1 +. 1.), simp f)) (* x + x * f1 -> (f1 + 1) * x *) | Add (f, Mul (g, Float f1)) when f = g -> simp (Mul (Float (f1 +. 1.), simp f)) (* f1 * x + f2 * x -> (f1 + f2) * x *) | Add (Mul (Float f1, f), Mul (Float f2, g)) when f = g -> simp (Mul (Float (f1 +. f2), simp f)) (* x * f1 + f2 * x -> (f1 + f2) * x *) | Add (Mul (f, Float f1), Mul (Float f2, g)) when f = g -> simp (Mul (Float (f1 +. f2), simp f)) (* f1 * x + x * f2 -> (f1 + f2) * x *) | Add (Mul (Float f1, f), Mul (g, Float f2)) when f = g -> simp (Mul (Float (f1 +. f2), simp f)) (* x * f1 + x * f2 -> (f1 + f2) * x *) | Add (Mul (f, Float f1), Mul (g, Float f2)) when f = g -> simp (Mul (Float (f1 +. f2), simp f)) | Add (f, g) -> Add (simp f, simp g) (* 0 - x -> - x *) | Sub (Float 0., f) -> simp (Mul (Float (-1.), simp f)) (* x - 0 -> x *) | Sub (f, Float 0.) -> simp f (* f1 - f2 -> calcul (f1 - f2) *) | Sub (Float f1, Float f2) -> Float (f1 -. f2) (* f1 * x + x -> (f1 + 1) * x *) | Sub (f, g) when f = g -> Float 0. | Sub (f, g) -> Sub (simp f, simp g) (* 0 / x -> 0 *) | Div (Float 0., f) -> Float 0. (* x / 1 -> x *) | Div (f, Float 1.) -> simp f (* f1 / f2 -> calcul (f1 / f2) *) | Div (Float f1, Float f2) -> Float (f1 /. f2) (* x / x -> 1 *) | Div (f, g) when f = g -> Float 1. | Div (f, g) -> Div (simp f, simp g) (* 1 * x -> x *) | Mul (Float 1., f) -> simp f (* x * 1 -> x *) | Mul (f, Float 1.) -> simp f (* 0 * x -> 0 *) | Mul (Float 0., f) -> Float 0. (* x * 0 -> 0 *) | Mul (f, Float 0.) -> Float 0. (* f1 * f2 -> calcul (f1 * f2) *) | Mul (Float f1, Float f2) -> Float (f1 *. f2) (* x * x -> x ^ 2 *) | Mul (f, g) when f = g -> simp (Puis (simp f, Float 2.)) (* x ^ a * x -> x ^ (a + 1) *) | Mul (Puis (f, g), h) when f = h -> Puis (simp f, simp (Add (simp g, Float 1.))) (* (f1 * x) * f2 -> (f1 * f2) * x *) | Mul (Mul (Float f1, f), Float f2) -> simp (Mul (Float (f1 *. f2), simp f)) (* f1 * (f2 * x) -> (f1 * f2) * x *) | Mul (Float f1, Mul (Float f2, f)) -> simp (Mul (Float (f1 *. f2), simp f)) (* (x * f1) * f2 -> (f1 * f2) * x *) | Mul (Mul (f, Float f1), Float f2) -> simp (Mul (Float (f1 *. f2), simp f)) (* f1 * (x * f2) -> (f1 * f2) * x *) | Mul (Float f1, Mul (f, Float f2)) -> simp (Mul (Float (f1 *. f2), simp f)) | <PERSON> (f, g) -> <PERSON> (simp f, simp g) (* x ^ 0 -> 1 *) | <PERSON> (f, Float 0.) -> Float 1. (* 0 ^ x -> 0 *) | Puis (Float 0., f) -> Float 0. (* x ^ 1 -> x *) | <PERSON> (f, Float 1.) -> simp f | <PERSON> (f, g) -> <PERSON> (simp f, simp g) | Ln f -> Ln (simp f) | Cos f -> Cos (simp f) | Sin f -> Sin (simp f) | Sqrt f -> Sqrt (simp f) | Exp f -> Exp (simp f) Here is my problem : For simple function as x*x + x*x, this function works. But if I enter the function : 2 + x*x - x*x, there is no simplification done. The result is : 2 + x^2 - x^2 I have no idea how I can fix this problem, I'm on it since 3 days. I hope everything is clear, and someone can give me some tips ! Have a great day !
69693384eea4be996e713348e5d24238175d4e15a9edad7ad37b481156334342
['55cc9ddb8d6f4790b760ac90ce6d8706']
So I solved the problem using the 'ComplexEigenSolver' from the Eigen library. //create a multichannel matrix Mat a_com = Mat<IP_ADDRESS>zeros(4,4,CV_32FC2); for(int i = 0; i<4; i++) { for(int j = 0; j<4; j++) { a_com.at<Vec2f>(i,j)[0] = a.at<double>(i,j); a_com.at<Vec2f>(i,j)[1] = 0; } } MatrixXcf eigenA; cv2eigen(a_com,eigenA); //convert OpenCV to Eigen ComplexEigenSolver<MatrixXcf> ces; ces.compute(eigenA); cout << "The eigenvalues of A are:\n" << ces.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:\n" << ces.eigenvectors() << endl; This gives me the following output (which is more or less what I was looking for): The eigenvalues of A are: (0.3951,-1.89571) (0.3951,1.89571) (0.3951,1.89571) (0.3951,-1.89571) The matrix of eigenvectors, V, is: <PHONE_NUMBER>,0) (-5.65862e-009,-<PHONE_NUMBER>) (-0.064798,-0.<PHONE_NUMBER>) (0.0167534,0.<PHONE_NUMBER>) (-2.22328e-008,<PHONE_NUMBER>) <PHONE_NUMBER>,-1.65536e-008) (0.<PHONE_NUMBER>,-0.00474562) (-0.0145628,-0.0148895) (-6.07644e-011,0.0019326) (0.00193259,-4.52426e-011) <PHONE_NUMBER>,6.83797e-005) (-0.000121153,<PHONE_NUMBER>) (-1.88954e-009,0.0600963) (0.<PHONE_NUMBER>,-1.40687e-009) (0.00200449,<PHONE_NUMBER>) (-0.70548,-0.00151068)
19b934b51d4b2a5320eadeaff166a045f2db79540bb884290b627f03ed8c46bb
['55cc9ddb8d6f4790b760ac90ce6d8706']
I decided to look at the project with fresh eyes. I got rid of most of the code and got it to work now. It is not pretty, but at least it runs for now. For example: I had to set my sample rate to 4000, otherwise it would play to fast and I still have performance issues. Anyway this is what I came up with: #define BUFFER_SIZE 1024 #define NUM_CHANNELS 2 #define kOutputBus 0 #define kInputBus 1 -(void) main { char buf[BUFFER_SIZE]; int size; runloop: while (self.running) { getAudioData(&buf, size); if(!self.configured) { if(![self activateAudioSession]) continue; self.configured = true; } TPCircularBufferProduceBytes(self.decodingBuffer, buf, size); } //stop audiounits AudioOutputUnitStop(self.audioUnit); AudioComponentInstanceDispose(self.audioUnit); if (self.decodingBuffer != NULL) { TPCircularBufferCleanup(self.decodingBuffer); } } static void audioSessionInterruptionCallback(void *inUserData, UInt32 interruptionState) { if (interruptionState == kAudioSessionEndInterruption) { AudioSessionSetActive(YES); AudioOutputUnitStart(self.audioUnit); } if (interruptionState == kAudioSessionBeginInterruption) { AudioOutputUnitStop(self.audioUnit); } } static OSStatus playbackCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { // Notes: ioData contains buffers (may be more than one!) // Fill them up as much as you can. Remember to set the size value in each buffer to match how much data is in the buffer. if (!self.running ) { return -1; } int bytesToCopy = ioData->mBuffers[0].mDataByteSize; SInt16 *targetBuffer = (SInt16*)ioData->mBuffers[0].mData; // Pull audio from playthrough buffer int32_t availableBytes; if(self.decodingBuffer == NULL || self.decodingBuffer->length < 1) { NSLog(@"buffer is empty"); return 0; } SInt16 *buffer = TPCircularBufferTail(self.decodingBuffer, &availableBytes); int sampleCount = MIN(bytesToCopy, availableBytes); memcpy(targetBuffer, buffer, sampleCount); TPCircularBufferConsume(self.decodingBuffer, sampleCount); return noErr; } - (BOOL) activateAudioSession { if (!self.activated_) { OSStatus result; result = AudioSessionInitialize(NULL, NULL, audioSessionInterruptionCallback, (__bridge void *)(self)); if (kAudioSessionAlreadyInitialized != result) [self checkError:result message:@"Couldn't initialize audio session"]; [self setupAudio] self.activated_ = YES; } return self.activated_; } - (void) setupAudio { OSStatus status; // Describe audio component AudioComponentDescription desc; desc.componentType = kAudioUnitType_Output; desc.componentSubType = kAudioUnitSubType_RemoteIO; desc.componentFlags = 0; desc.componentFlagsMask = 0; desc.componentManufacturer = kAudioUnitManufacturer_Apple; // Get component AudioComponent inputComponent = AudioComponentFindNext(NULL, &desc); // Get audio units AudioComponentInstanceNew(inputComponent, &_audioUnit); // // Enable IO for recording // UInt32 flag = 1; // status = AudioUnitSetProperty(audioUnit, // kAudioOutputUnitProperty_EnableIO, // kAudioUnitScope_Input, // kInputBus, // &flag, // sizeof(flag)); // Enable IO for playback UInt32 flag = 1; AudioUnitSetProperty(_audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, kOutputBus, &flag, sizeof(flag)); // Describe format AudioStreamBasicDescription format; format.mSampleRate = 4000; format.mFormatID = kAudioFormatULaw; //kAudioFormatULaw format.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;// format.mBitsPerChannel = 8 * sizeof(char); format.mChannelsPerFrame = NUM_CHANNELS; format.mBytesPerFrame = sizeof(char) * NUM_CHANNELS; format.mFramesPerPacket = 1; format.mBytesPerPacket = format.mBytesPerFrame * format.mFramesPerPacket; format.mReserved = 0; self.audioFormat = format; // Apply format AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &_audioFormat, sizeof(_audioFormat)); AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &_audioFormat, sizeof(_audioFormat)); // // Set input callback // AURenderCallbackStruct callbackStruct; // callbackStruct.inputProc = recordingCallback; // callbackStruct.inputProcRefCon = self; // status = AudioUnitSetProperty(audioUnit, // kAudioOutputUnitProperty_SetInputCallback, // kAudioUnitScope_Global, // kInputBus, // &callbackStruct, // sizeof(callbackStruct)); // checkStatus(status); // Set output callback AURenderCallbackStruct callbackStruct; callbackStruct.inputProc = playbackCallback; callbackStruct.inputProcRefCon = (__bridge void * _Nullable)(self); AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Global, kOutputBus, &callbackStruct, sizeof(callbackStruct)); // Disable buffer allocation for the recorder (optional - do this if we want to pass in our own) flag = 0; status = AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_ShouldAllocateBuffer, kAudioUnitScope_Output, kInputBus, &flag, sizeof(flag)); //initialize the circular buffer if(self.decodingBuffer == NULL) self.decodingBuffer = malloc(sizeof(TPCircularBuffer)); if(!TPCircularBufferInit(self.decodingBuffer, 512*1024)) return NO; // Initialise status = AudioUnitInitialize(self.audioUnit); AudioOutputUnitStart(self.audioUnit); } I found most of this by looking through github and from a tasty pixel
d961a36c499ecf04c5201da21b7d735f13484389a9cc51873ab6df4238581add
['55cdf55f7e2e41d9a5a5afffd0633db6']
Suppose I have some classifier which is reasonably good at discriminating classes. I have a new dataset which I know has a very unbalanced class distribution, but I don’t know anything about this distribution, so I use a uniform prior distribution for my classifier. Because my classifier is a good discriminator, the output posterior distribution is much closer to the actual distribution of the dataset than the uniform distribution that I originally assumed. My understanding is that in the next experiment with similar parameters, I can use this posterior distribution as the prior to improve the classification output. My question is: can I also use this posterior distribution with the original dataset to improve the output? I’ve actually done this using a neural network as a classifier with thresholding according to <PERSON>’ theorem (essentially, prediction thresholds are proportional to the given prior distribution). Running prediction with uniform priors to get a posterior probability distribution, and then re-running prediction with that new distribution as the priors yields much better results compared to using just the uniform distribution. In fact, doing this over and over again recursively until predictions converge yields the best results, and comes extremely close to predicting the actual class distribution of the dataset. I hope this question makes sense — I’m fairly new to probability theory so I’m mainly concerned with whether or not this approach is valid, or if my results are somehow spurious.
517888748a8908bf9a803d3ae58fa240cc939f650f73f1e302a9e6eb620f2376
['55cdf55f7e2e41d9a5a5afffd0633db6']
follow the instructions given on this page: https://support.apple.com/en-gb/HT201478 Find the section "Organise your library" then scroll through to the sub-category called "Create, view, and organize collections." The following is the part that will sort it out: "To automatically sync your Collections with your other devices, sign in to all of your devices with the same Apple ID. Then, on your iPhone, iPad, or iPod touch, go to Settings > iBooks and turn on Sync Collections." If in future you wanted to reverse this and sync all of your collections FROM your Mac to your iPad, this is what you'd do: "To sync from your Mac, choose iBooks > Preferences from the menu bar at the top of your computer screen. Click the General tab, then select "Sync bookmarks, highlights, and collections across devices." " NOTE - if you have the "Sync Collections" option turned on on your iPad AND on your Mac at the same time IT WILL NOT WORK. Choose one or the other. Hope this solves it for you!
fcb0c9eaa1741d27d67be0b4ab6ffba553b7c52d336e9f28c422648eeee8446e
['55d2292c718748459480a137fdf3b706']
I had the same dilemma and solved it just by using the proxy option in the webpack dev server config: module.exports = { devServer: { contentBase: './dist', /* output folder */ proxy: { '/api': { /* I had only to track calls to api, change path to one you need*/ target: 'http://localhost:15536/' /* specify your correct IIS port here */ } } }, /*other configurations here*/ } After code is in place, just run the VS project and start WebPack Dev server alongside. Now all the calls from the app will be redirected to your ASP.NET server. Let me know if any questions.
334595e9eb4aa4dd0998af07ab39d6befdd43f7192760eae4e897bf424fae104
['55d2292c718748459480a137fdf3b706']
It works for me just using setFrameOrigin e.g.: if let screen = NSScreen.screens()?[1] { window.setFrameOrigin(screen.visibleFrame.origin) } Ref: https://developer.apple.com/documentation/appkit/nsview/1483283-setframeorigin Regarding setting window in fullscreen mode. If you are doing it from view (as I think), you could try this: override func viewDidAppear() { super.viewDidAppear() self.view.window?.styleMask.insert(.fullScreen) self.view.window?.styleMask.insert(.fullSizeContentView) self.view.window?.level = Int(CGWindowLevelForKey(.maximumWindow)) }
02411b6b59688e58cc933653b981998d6b52bc37088d422dd4dc42c8165275a9
['55d2ad27ab204dba96c6dc8c20df4fb8']
I have an issue while sending an email using JMS when the content has accented characters. The message is pushed on to the queue and placed as an object message. The listener listens to the message and delivers it to the mail server. Everything works fine on my local server. However when I run the same on Solaris production server, the accent characters are getting messed up. Within the email content, it prints <PERSON>�n for De León. Basically, accent characters are not getting encoded and displays a question mark [�]. Any help on this issue is highly appreciated. Below is the code that I use to deliver the messages. private void sendEmailMessage(EmailBean emailBean) { System.out.println("SendReceivedEmailMessages<IP_ADDRESS>sendEmail()"); try { if (emailBean.getFromAddresses() != null && !emailBean.getFromAddresses().isEmpty()) { Properties existingProperties = session.getProperties(); existingProperties.put("mail.from", emailBean.getFromAddresses()); session = Session.getInstance(existingProperties); } String DELIMITER = ";"; String subject = emailBean.getSubject(); String msgText = emailBean.getBody(); MimeMessage message = new MimeMessage(session); message.setSubject(subject); message.setContent(message, "text/html"); InternetAddress[] toAddressList = parseRecipients(emailBean.getToAddresses(), DELIMITER); InternetAddress[] ccAddressList = parseRecipients(emailBean.getCcAddresses(), DELIMITER); InternetAddress[] bccAddressList = parseRecipients(emailBean.getBccAddresses(), DELIMITER); message.setRecipients(javax.mail.Message.RecipientType.TO, toAddressList); message.addRecipients(javax.mail.Message.RecipientType.CC, ccAddressList); message.addRecipients(javax.mail.Message.RecipientType.BCC, bccAddressList); Multipart multipart = new MimeMultipart(); if (emailBean.getFileByteArrRegular() != null) { addAttachmentFiles(multipart, emailBean.getFileByteArrRegular(), emailBean.getFilename() + "_Regular.docx", msgText); } if (emailBean.getFileByteOthers() != null) { addAttachmentFiles(multipart, emailBean.getFileByteOthers(), emailBean.getFilename() + ".docx", msgText); } else { addAttachmentFiles(multipart, null, null, msgText); } message.setContent(multipart); Transport.send(message); } catch (MessagingException ex) { Logger.getLogger(SendReceiveEmailMessages.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); Logger.getLogger(SendReceiveEmailMessages.class.getName()).log(Level.SEVERE, ex.getStackTrace()[0].toString(), ex); } catch (Exception ex) { Logger.getLogger(SendReceiveEmailMessages.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); Logger.getLogger(SendReceiveEmailMessages.class.getName()).log(Level.SEVERE, ex.getStackTrace()[0].toString(), ex); } }
185006ca532eb13b48180ac8914b50a8b71b39ff4e876fb02b6f7fa7b60c4aa6
['55d2ad27ab204dba96c6dc8c20df4fb8']
Is there a way to modify the row selection color for a specific table? Right now I have a standard row selection style defined in the style-sheet and applies to all the tables throughout the application. .table-row-cell:selected { -fx-background-color: #777777; } However, I have a requirement for one of the tables to display a different highlight color on row select. I had been trying the below but obviously it isn’t working. In my style-sheet: #lightHighlightTable .table-view .table-row-cell:selected { -fx-background-color: #CCCCCC; } In my code: recordsTable.setId("lightHighlightTable"); Is there something that I am doing wrong in the above? Any hint on how to achieve this is highly appreciated. I am using JDK 1.8 b20. Thanks.
1abbd376460467168d78ca0875ac72ffaa22e670672d8607945fd1cff90ba9ef
['55d2da2d62954771834b0a4ad125431c']
I'm writing a program which needs a user input for an polynomial function of x. I'm using Tkinter and python 2.5. I have a parser method which so far takes the inputted equation and splits it into terms without dropping the signs. I want to take each term and parse it to get a tuple of the (coefficient, degree). For example, -2x^3 returns (-2,3). I can then add these to an array and manipulate them accordingly in the program. Is there a way or standard module that can do this? Here is the beginning of the parse method. def parse(a): termnum=[] terms=[] hi=[] num1=0 num=0 f=list(a) count=0 negative=False coef=0.0 deg=0.0 codeg=[] for item in f: if (item=='-' or item=='+') and count!=0: termnum.append(count) count+=1 for item in termnum: num1=num num=item current='' while num1<num: current=current+f[num1] num1+=1 terms.append(current) num1=num num=len(f) current='' while num1<num: current=current+f[num1] num1+=1 terms.append(current) print terms parse('-x^2+3x+2x^3-x') Thanks! P.S I don't want to use external packages.
1b109e22b2d4b860a048accb09c1e0be992e912539de68791231734e287da219
['55d2da2d62954771834b0a4ad125431c']
I have a dataframe with the following format Position data 48575185 1 48575150 3 48604751 5 48604673 c(3,5) 48591918 2 48591919 8 Some data in the data column is a numerical and some are vectors of numbers. I want to create a new dataframe that makes a new copy of the row with each value in the vector for rows with a vector item, essentially expand the table to: Position data 48575185 1 48575150 3 48604751 5 48604673 3 48604673 5 48591918 2 48591919 8 How do I do this in r? I am very new to R. I found a function called expand(), but am unsure if that is what I need in this situation.
ee7dc4ed331e9378a8572cb68eacf337c908e81f8e2343130c07e34b8f40edff
['55ea8ea54c054576a230f07cb00ffecc']
HI I am going through SQL null values and there is a query select sysdate, 1+5, 'ABC', 'ABC'||null from dual which returns value SYSDATE 1+5 'AB 'AB --------- ---- --- --- 10-OCT-15 6 ABC ABC Please let me know why the heading column is getting trimmed to just 'AB and why null column has a value of ABC. Thanks.
e9f95c2746d15c44589b5bb6799d59b2aaa902fe36f17e3ec2508418838bf310
['55ea8ea54c054576a230f07cb00ffecc']
I am trying to print the contents of an array. For example I have defined an int array of size 10. But the user entered only 8 numbers. So the last two positions in an array have an value of zero. When I am printing the array I get all ten positions. Is it possible to print only up till the user entered.Also the user decides how many to enter so I cannot hard code the position for printing the array. Thanks.
834fbda3851524cffe476597333d9c48e8fb08b489fe4052457bfb14e8a35708
['55eeb2fded6f454689ca773dde1bef82']
If the signals applied at J and K(to change the state of the flip flop) in above diagram are longer than propagation delay of latch-1, then output of latch-2 will become indeterminate in case J=K=1. Otherwise it will be determinate and the outputs will toggle in case J=K=1.
8281431cbe848e8f2c4491a921a7051f07dbad6eac623c5e0cc9aa40c3ae1672
['55eeb2fded6f454689ca773dde1bef82']
I installed MacTex (the full 4.4gb package) as well as dvipng and received the following error when I opened one of the flash cards downloaded from a GitHub. I also followed that GitHub instructions which are listed here: Machine Learning Flash Cards Error executing latex. Generated file: /var/folders/lg/_7xvtj1946bdvf38125067h40000gn/T/anki_temp/tmp.tex This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./tmp.tex LaTeX2e <2020-02-02> patch level 5 L3 programming layer <2020-03-06> (/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls Document Class: article 2019/12/20 v1.4l Standard LaTeX document class (/usr/local/texlive/2020/texmf-dist/tex/latex/base/size12.clo)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/jknapltx/mathrsfs.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/dvips.def))) (/usr/local/texlive/2020/texmf-dist/tex/latex/geometry/geometry.sty (/usr/local/texlive/2020/texmf-dist/tex/generic/iftex/ifvtex.sty (/usr/local/texlive/2020/texmf-dist/tex/generic/iftex/iftex.sty))) (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-dvips.def) (./tmp.aux) *geometry* driver: auto-detecting *geometry* detected driver: dvips ! LaTeX Error: Command \CI already defined. Or name \end... illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.10 ...scalebox{1.07}{$\perp\mkern-10mu\perp$}}}} ! LaTeX Error: Command \nCI already defined. Or name \end... illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.12 \newcommand{\nCI}{\centernot{\CI}} [1] (./tmp.aux) ) (see the transcript file for additional information) Output written on tmp.dvi (1 page, 332 bytes). Transcript written on tmp.log.
c39fb94d2c72dbf529ca9e39a26047d0efebb51f53eb959b7185e8699ac3cab4
['55f8ed25b5134acbbc69f8d86430336a']
Thanks for your insight. SISOtool and MATLAB responses are matching (same solver?),but the Simulink output is the one which is different. I dont get the chattering when changing the gain to 1.03 but do get a similar resposne when I move the complex pole from `-200 +/- 1i` to `-10 +/- 1i`.
812a8e88b40867f2b0e81c5cf9c70d7ec70908cf0971386fcc8b326b775e17cd
['55f8ed25b5134acbbc69f8d86430336a']
2.5V going to R55 is not coming from R1 and R2 voltage divider biasing the cmoparator, but from a separate divider. I'm not sure what you mean by "Use a better source Z(f) with 0.1 Ohm impedance @100kHz and < x ohms otherwise.". How can I implement this in my design?
6dcbca93c9202a2e7f7f9c7e24d19ae94220b914ea35e015e8bcbd8cdfc90b4a
['56065a41414d4097bc34add3145b6b76']
I've done quite a bit of reading on this topic and it seems like the simple answer is, it is a problem. ARIN assigns IP addresses and AS numbers to organizations, but doesn't assign assign IP addresses to AS numbers. It seems as though the organization is free to do whatever they want, even allow another organization use the IP address in their AS, or use it in any AS number assigned to the organization that the IP address belongs to. How to verify authenticity of permission of an IP to be used by an AS, and the AS itself is the problem. RPKI is one attempt to improve the situation, but its adoption is still very low. I'm guessing ARIN and the other RIR don't want to get involved in publishing IP to ASN number mappings because it's a lot of data and they don't want to be in the business of serving and managing all that data. I think RPKI allows some of the data to be distributed, in a hierarchical manner similar to DNS, therefor making the system more scalable.
1c0a8ddf762e1403c1f4e73d52a2ddaf81d1fe1c6c05083007fd264874d16ca9
['56065a41414d4097bc34add3145b6b76']
I think the reality is, even if the "internet core" routers would accept a route from me, it probably wouldn't ever work because the first hop, and any following hops in that route (all the way up to my router) that are not part of the "internet core" would not know about/understand the route, and would immediately just fail to route to me. I think the bottom line is that you need to have all routers in your route knowing about the route, otherwise it doesn't work. You can do BGP peering only with your directly connected peers. Is this correct?
8715ad1b054656e3c5faccc25bb5fb69b8811fcebde373226e48abc4207ca8c7
['561cca08f68d40e0b0fef17e28d4842e']
Solved. Turns out the config.xml settings were incorrect. Config.xml > Common > Package name needs to be in reverse domain name notation for android to deploy to the device. I hadn't noticed this however because I had only been using the Cordova Tools project to compile for Windows 8.1 / 10 devices and in these build configurations the package naming convention is not enforced This caused the problem: Package name: mycompany.myappname This fixed the problem: Package name: com.mycompany.myappname
7a7e75bc7c7397c0b1f1e04dd17da14686df952e9668f4eecdfa3955190b7299
['561cca08f68d40e0b0fef17e28d4842e']
I'm trying to build / deploy and debug by pressing F5 on my Cordova Tools javascript project with a variety of android targets but the apk does not want to deploy. It appears that the build completes and deploys successfully and the ADB console windows appears but remains blank. No app is deployed to a device or emulator. Have tried Nexus 5, Samsung Galaxy Tab 2 and various emulators. All devices have been used as debug targets before The thing that has changed is that I recently formatted my laptop and moved to Windows 10 Enterprise I'm using a fresh installation of Visual Studio 2015 Enterprise I can debug OK on Windows Phone 8.1, Windows 10 If I try and deploy the APK created from the console with ADB: adb install android-debug.apk I get 3715 KB/s (1141677 bytes in 0.300s) pkg: /data/local/tmp/android-debug-unaligned.apk Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED] I haven't tinkered with the APK it is as it was built from VS I have tried clearing the cache, checking the dependencies (both in Options) and checked for updates. Any suggestions on how to move forward? Thanks
fa0de4b124ea3065575b5cba8a7f1ca3c1d0a50cd9f33a851f2c4cda5c5901eb
['561d763285c347d48dbc9841cf994345']
I'm looking to create a global gradient mixin. My question is pretty much in the title, or example below. I couldn't find anything on it in the docs or through google. @mixin gradient($fallback, $color-stops..., $dir: "") { @if $dir != "" { background-color: $fallback; //fallback for older browsers background: -webkit-linear-gradient($dir, $color-stops); background: -moz-linear-gradient($dir, $color-stops); background: -o-linear-gradient($dir, $color-stops); background: linear-gradient($dir, $color-stops); }//end if @else { background-color: $fallback; //fallback for older browsers background: -webkit-linear-gradient($color-stops); background: -moz-linear-gradient($color-stops); background: -o-linear-gradient($color-stops); background: linear-gradient($color-stops); } //end else } thank you
2d26316cbcaf0a7ae61930b241687f8654b1101ac2df629fb3c2b51ab791775b
['561d763285c347d48dbc9841cf994345']
I have a mysql database with a user generated date from the html5 form element "date"(or 2013-01-06 if their browser doesn't support html5). I'm looking to select and output dates only after 3 days have passed. I've looked around stack overflow and found a few threads that looked promising and came up with(table = files1, date column = datec): $query = "SELECT * FROM files1 WHERE DATEDIFF(day, now(), datec) >3"; $result = mysql_query($query,$con); echo $result; while($row = mysql_fetch_assoc($result)){ foreach($row as $name => $value){ echo "$name: $value\t"; }//end foreach }//end while However this produces: "Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given" which I've found to come from the query not executing.
add8d2ce33b5ad0181439ac1b7e787325f671be386b301fb69fd59ddd91c91ca
['561eca8b50c14087b7b1db6e07c4c7d2']
To update database on another Db server you could make this way: Configure connection string to use new server Run Update-database command from package manager console, in some cases you will need to use -force flag. But be careful this could delete some your data. Also this command has - ConnectionStringName parameter this could help you to make updates. This is a very bad approach and I don't recommend update database this way. I would recommend you set up Initialzier for your context. I usually use MigrateDatabaseToLatestVersion and after changing your model you will need to add new migration, using Add-migration command. To set up it use this command in application start method: Database.SetInitializer<ApplicationDbContext>(new MigrateDatabaseToLatestVersion<ApplicationDbContext>());
6a83ebbb4140bcd203c0292f0df236d4d9926c75198d5796e1b879affd2a13fe
['561eca8b50c14087b7b1db6e07c4c7d2']
You could create a contract for your settings: public IApplicationSettings { string ConnectionString { get; } // any other setting variable } And than use this abstraction in your code public class MyRepository { private string conncetionString; public MyRepository(IApplicationSettings settings) { this.conncetionString = settings.ConnectionString; } } In this way you will hide any dependency to stuff like ConfigurationManager and the way how you storing settings in app. If your are using IoC, you will have control on instance life time.
cf59f0a1764c6a84324451ce0688f9283391ce2d15b781fd84c3b7920bca586d
['5620790c811f40c58babfb8417919404']
I am trying to create an archive display of database information. I would like the end result to look something like this.. 2018 January item1 item2 April item 1 The problem I am having is that my month and item values are not clearing and end up nesting themselves back into the previous month as well. I believe I have pinpointed where the flaw in logic lies but I can't seem to fix it. Any help woould be appreciated. My function looks like so... function buildBooklistArchive( $, response ) { var years = []; response.forEach( function(el) { var yearContainer = $("<ul>"); var year = $("<li>").addClass("year-" + el.YEAR); var monthContainer = $("<ul>"); var month = $("<li>").addClass("month-" + monthConverter(el.MONTH) ); var titleContainer = $("<ul>"); var currentMonth = ""; if ( $.inArray(el.YEAR, years) === -1 ) { years.push(el.YEAR); currentMonth = monthConverter(el.MONTH); year.append("<h1>" + el.YEAR + "</h1>"); month.append("<h4>" + currentMonth + "</h4>"); var titles = el.booklists.split(","); titles.forEach( function (e) { titleContainer.append(e); }); month.append(titleContainer); monthContainer.append(month); year.append(monthContainer); $(".archive-list").append(year); } else { currentMonth = monthConverter(el.MONTH); month.append("<h4>" + currentMonth + "</h4>"); var titles = el.booklists.split(","); titles.forEach( function (e) { titleContainer.append(e); }); month.append(titleContainer); $( '.year-' + el.YEAR + ' ul' ).append( month.hasClass("month-" + currentMonth) ); } }); } So whats happening is that when I get into the else statement month is still holding the value of the previous month and attaches iteself into the bottom of the previous list items. My thinking would this variable would get reset upon each iteration of the loop but maybe its different for DOM elements? The output I am getting looks something like this.. 2018 January item1 item2 April item 1 April item 1
3bcdf287e5951460f07a58bea37e9f39e9b3b80cfaf6fdbe9ca7f1c00de01c11
['5620790c811f40c58babfb8417919404']
instead of: document.addEventListener("click", function(evt) { if (evt.currentTarget !== myImg) { alert("click on image"); } else { alert("click outside of image"); } }); Try: myImg.addEventListener("click", function(evt) { alert("click on image"); }); EDIT: This assumes that you only need to detect the image click. If you have to detect a non image click as well then this solution won't work.
9459bf64afbb9a099e3fde82c87226356de6606f045537bbf08b8e7b695e62bf
['5624113702174bb58385c3b0416c7e23']
When $\Delta$ is finite $\prod_{i \in \Delta}F$ is a finite dimensional vector space over $F$, its dimension is $|\Delta|$, and a finite dimensional vector space is always isomorphic to its dual space, in this case $Hom(\prod_{i \in \Delta} F,F)$, thus both sets have the same cardinality.
0513542a3ebd8b273a0a1dc383913846e23f1212e3bc48431a361e9d83890340
['5624113702174bb58385c3b0416c7e23']
The arrow $0 \rightarrow X$ is a homomorphism from the group with one element $0$ (the set $\{0\}$ with the obvios product) to the group $X$ (not necessarily an abelian group, although "Zero group" or $0$ is additive notation, mostly used for abelian groups and $1,e,\{e\}$ for multiplicative notation and groups in general). Since the arrow is a homomorphism, it takes the neutral element from $0$ to the neutral element in $X$, but beacuase $0$ has only one element, such homomorphism is unique, but it doesn't mean $|X|=1$.
80974afd1dec9e98174c4421c36141c3ef3c007999a290f46e50b61afbb674f0
['562c841ab7fc4505890c66a6b93aba24']
Add the following line to your my.cnf or my.ini and restart the mysql server: skip-grant-tables Then change the password in mysql.user table update user set password = password('newpassword') where user = 'root' Remove the skip line and restart the server. You will be able to login with the new password.
8fc323410ceb2315dffbf17f382fdb87c85f938f046ece4281f6fb44389f5de0
['562c841ab7fc4505890c66a6b93aba24']
You need to dump the old repo into a file and then import the file into the new repo: svnadmin dump /home/username/Desktop/SVN > svn.dump svnadmin load /home/username/Desktop/SVN/prj < svn.dump You can also keep your dump file as a backup is something goes wrong. You can also just copy the directory if you will use the same version of SVN in both servers. SVN Dump is version independent.
a86e02a72e0fde6130f8a3b976ed245295bcdfa59872f3b023721fc3dee24405
['56393f582e324182837267df76235876']
I have a table (price_history) that shows the price history for a given product. I'd like to make a query that shows the current price (for the most recent date) and the price right before (for the date right before the most recent) so essentially, the old and new price. Here's an example table: | historyid | productcode | optionid | price | date | +-----------+-------------+----------+-------+------------+ | 9635 | 254256 | 1 | 42.95 | <PHONE_NUMBER> | | 9690 | 254256 | 1 | 35.00 | <PHONE_NUMBER> | | 9727 | 254256 | 1 | 47.95 | <PHONE_NUMBER> | | 9728 | 254256 | 1 | 40.00 | 1288902624 | Here's what I'd like to get: | productcode | optionid | Old price | New Price | Date | +-------------+----------+-----------+------------+------------+ | 254256 | 1| 47.95 | 40.00 | 1288902624 | I can't seem to figure out how to get the result I need. Any help would be greatly appreciated. Thanks
3160bdab088a8baa574af0ae291f6786639397dac0026b6ef7aaa59d8357a5bd
['56393f582e324182837267df76235876']
I have a spreadsheet I use to track supplies inventory and estimate usages for ordering purposes. I’ll check all the inventory levels some days and maybe just one item on a certain day so I end up with a table that has a lot of blank cells. I’d like a formula that looks at the last 2 entries in a column and figures our the usage by subtracting the last 2 values and then dividing that number by the difference between the days when that item was counted. Here’s an example table: Example Table Here The end results I want are as follows: Usage for Box 1 - (120-99)/(Feb 10 - Jan 12) = .724 per day Usage for Box 2 - (70-50)/(Feb 10 - Jan 17) = .833 per day Usage for Tape - (156-100)/(Feb 2 - Jan 1) = 1.750 per day Whenever I do an inventory for an item, I want the formula to always look at each column's latest two values and compute the daily usage. Thanks
ed353317fda656eb20a4d0f967bcb553dadeb27a1fabf15b34fa3407bf6ab7b2
['563ae79d44e1479d9286148564e4af86']
I'm using VirtualBox on a Mac. I have a virtual machine running Linux on which I'm developing a website. Its hosts file has: <IP_ADDRESS> localhost <IP_ADDRESS> my-test-site.gyford.com I can then access http//my-test-site.gyford.com on my Mac's browser. But I also have some Windows virtual machines from https://modern.ie/ for browser testing and would like to access the same website from IE in those machines. I've tried adding <IP_ADDRESS> my-test-site.gyford.com to the Windows machines' host files, but as I expected, it can't find the site. Is there a way to access the website running on the Linux virtual machine from the Windows virtual machine?
53b029def2e52af409d71ebb86f4e50c9f8688adeaf319017392954357432450
['563ae79d44e1479d9286148564e4af86']
Hi. I've edited the question. It's known that my DVI to HDMI cable can't produce audio. I'm using 3.5 mm stereo cable for audio. The audio is working by default in Windows 8.1. But it's not working in Ubuntu., Maybe in Ubuntu the default audio is set to HDMI? Can we force the operating system to use 3.55 cable for audio instead of HDMI? Thanks!
83ff27b7a2ae974937945ee14fbf4ce4762f2da7992d6f6b2e2f84c5302284ef
['564bbf64f9084866ac789840225af671']
Use a memory stream to return the image as a base64 string private string GenerateBannerTitle() { var bitmap = new Bitmap(PhysicalBannerPath); RectangleF rectf = new RectangleF(430, 50, 650, 50); using (var g = Graphics.FromImage(bitmap)) { using (var arialFont = new Font("Arial", 10)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; g.DrawString("hfsdfdsfds", new Font("courier sans", 100, FontStyle.Bold), Brushes.White, rectf); } } var ms = new MemoryStream(); bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); var arr = new byte[ms.Length]; ms.Position = 0; ms.Read(arr, 0, (int)ms.Length); ms.Close(); var strBase64 = Convert.ToBase64String(arr); return strBase64; } And the show it in html like: <img src="data:image/jpg;base64,the returned data"/>
0726e1e6104bcf7dca0825548e681776fda51cf558ecbbb4bf959feeeb9793b0
['564bbf64f9084866ac789840225af671']
You can extend the datetime Date.prototype.Format = function() { var weekday = new Array(7); weekday[0]= "Sunday "; weekday[1] = "Monday "; weekday[2] = "Tuesday "; weekday[3] = "Wednesday "; weekday[4] = "Thursday "; weekday[5] = "Friday "; weekday[6] = "Saturday "; var weekday = weekday[this.getDay()]; var day = this.getDay(); if(day === 1) day += day + "st" else day+= "th" var months = new Array(12); months[0]= " January "; months[1] = " February "; months[2] = " Mars "; months[3] = " April"; months[4] = " May "; months[5] = " June "; months[6] = " July "; months[7] = " August "; months[8] = " September "; months[9] = " October "; months[10] = " November "; months[11] = " December "; var month = months[this.getMonth()] return weekday + day + month + this.getFullYear(); }; var d = new Date(); console.log(d.Format());
bdae112a00aaf24da211d6f0fdbfd45f7ec258877feddd3021353693021cfb59
['564f52209e3a4b8c97dd15d962ffdda2']
I've got a wee bit of experience with Pascal, as I've used it to create mods via TES5Edit for Skyrim, and I've hit a wee snag with modding Dark Souls, and I figured flexin' me Pascalerrific muscles would be a good exercise. But, uh, it's all buggered right from the get go. Lazarus supposedly has this "Form Window" feature, where ya can just click one of the icons and then click on the IDE, and bam. Automated GUI creation. I ain't got that. The window isn't up, and the option to open it is grey'd out. 'Eres an image to demonstrate: 'Ere 'tis, lads. Bit sad that, right from the get go, I'm flummoxed. LEND ME YO' EARS, MA HOMIES! A BROTHA NEEDS AID! <PERSON> So, uh, what do I do to enable it? Google gives absolutely nothing in regards to using <PERSON> in pretty much any way, so that bridge wasn't even built 'afore it was burnt.
b5a9d247b7de6090a268e77d11db1233d74b3ae74590d1a676e95c5d9fa20bcc
['564f52209e3a4b8c97dd15d962ffdda2']
I've been working on getting TrinityCore up and running, battling with the horror that is Ubuntu in order to get things working. Finally got the workflow down, finished two related projects, and I was going to start tinkering with the code. But I found AzerothCore, and I'm very intrigued. Got a few questions about the differences between it and TrinityCore. First off, AC is advertised as having a modular design, which is brilliant. TC has a single instance of modularity with it's script system, which is also very good; edit the C++ source script, save it, and the server will reload it at runtime without having to recompile the whole server. Is that functionality also present in AC? And how robust is the module system? My reason for asking is that I want to add more dynamic features rather than focusing on instances, phases, and quests that are repeatable by every single character. The first step for that, would be to change the AI scripting system. So rather than having one monolithic script attached to an NPC, an array of scripts arranged in a hierarchy with conditions that are processed periodically would be a great first foray into the actual code base. Would it be possible to contain that functionality in a replacement module? Another question I have, is regarding the prevalence of bugs. TC's development does seem a touch slow, and it's community not all that active. How is AC's development in regards to the robustness of the low level systems? With TC, for instance, every so often there would be floating NPCs making their way around Goldshire, which is a rather immersion-breaking bug. Does AC have similarly obvious bugs?
2430371f7b62558137749bda2e5c2422c0704b2e76a57f018bb26604ceaa820a
['565607282af243b69c42c583750caf49']
I'm pretty new to threads and just trying to get a grip on the basics.So, I tried the following code to print odd and even numbers one after the other. But I'm getting a null pointer. public class P { public static void main(String[] args) throws InterruptedException { Print print = new Print(false); Even e =new Even(); Odd o = new Odd(); e.start(); o.start(); } } class Even extends Thread { Print print; public void run() { try { print.printeven(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class Odd extends Thread { Print print; public void run() { try { print.printodd(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class Print { public boolean flag=false; Print(boolean flag){ this.flag=flag; } synchronized void printodd() throws InterruptedException { for(int i=1;i<10;i=i+2) if(!flag) { System.out.println(i); notifyAll(); flag=true; } else { wait(); } } synchronized void printeven() throws InterruptedException { for(int i=2;i<=10;i=i+2) if(flag) { System.out.println(i); notifyAll(); flag=false; } else { wait(); } } } If someone could explain in detail what I'm doing wrong here and give a basic idea how to go about debugging this.
9db612fd260c816bd390dfb467cb5b338b0a8f5a92026af82840fd2f2fe3a5e4
['565607282af243b69c42c583750caf49']
I was reading about ConcurrentModificationException. I found this piece of code for the iterator.Can anybody explain what actually leads to this exception.I just want some justification for the logic written below. public boolean hasNext() { return cursor != size; } @SuppressWarnings("unchecked") public E next() { checkForComodification(); int i = cursor; if (i >= size) throw new NoSuchElementException(); Object[] elementData = ArrayList.this.elementData; if (i >= elementData.length) throw new ConcurrentModificationException(); cursor = i + 1; return (E) elementData[lastRet = i]; } public void remove() { if (lastRet < 0) throw new IllegalStateException(); checkForComodification(); try { ArrayList.this.remove(lastRet); cursor = lastRet; lastRet = -1; expectedModCount = modCount; } catch (IndexOutOfBoundsException ex) { throw new ConcurrentModificationException(); } } final void checkForComodification() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); } }
ae8ef5e46fa71c5ae99570d79cedc8c9c1129d96b97cfefe2915a528bde01dcf
['565b114ac2c84180b80b8aae00ace68d']
Needed to add y as an argument to the function and pass it on. integrand_inner <- function(x,y, a, b) {(a * x^2 + b * y *x)*y} integrand_outer <- Vectorize( function(y, a, b){ integrate(integrand_inner, (bo - b)*y/(a-ao), 1, a=a, b=b, y=y)$value } ) revenue <- function(a){ b <- sqrt(1-a^2) return(integrate(integrand_outer, 0, 1, a = a, b=b)) }
a04c848b702b0c6fdb4c62a3f094e40918a215e45d192090fb081c2468113ab1
['565b114ac2c84180b80b8aae00ace68d']
I'm trying to put 3 divs that fill the width of the window, and their width changes according to the dimensions of the window. However javascript seems to be giving a window width larger than it actually is causing the objects to flow out of the window causing scroll. You can see my full code here: http://jsbin.com/vifagazefu/3/edit?html,css,js,output This is the javascript: $(window).resize( setDim()); function setDim() { var windowWidth = $(window).innerWidth()- 3; //the 3 is for the 1px margin between the divs var windowHeight = $(window).innerHeight() - 70; $(".one").innerWidth(windowWidth / 3); $(".two").innerWidth(windowWidth / 3); $(".three").innerWidth(windowWidth / 3); $(".one").innerHeight(windowHeight); $(".two").innerHeight(windowHeight); $(".three").innerHeight(windowHeight); } setDim();
3befbedb2c232d98c03d6d01d09a24835a6b17730df04d79b1719fa6c385e62d
['5661df143aab415e968a83218bb8103e']
If the perimeters of $E$ and $F$ are the same: $x + y + 20 = x + 13 + (21-y)$ Solving this, you get $y = 7$. Use <PERSON>'s formula to find the Area of the entire triangle: $S = \frac{A+B+C}{2}$, $A = \sqrt{S(S-A)(S-B)(S-C)}$: $S= \frac{20+13+21}{2}=27$, $A=\sqrt{27(27-20)(27-13)(27-21)}=126$ Now use $A=\frac12bh$. $h = 2\frac Ab = 2 \frac{126}{21}=12$ Finally, $Area\; of \;F$ $= \frac12bh=\frac12 7*12=42$
77165bd3a8f73b0b121c2ad00dd9976ce6241d7f65600a92398767620878931f
['5661df143aab415e968a83218bb8103e']
$\Delta OBC$ and $\Delta OBD$ are not similar triangles. $\Delta OBC$ is not a right triangle. Also, by "$\theta$", I assume you mean $x$? If so, $\tan\theta\neq\frac{CA}{OC}$, it is $\tan\theta=\frac{CA}{OA}$. Because $OC = 1$, the trig functions simplify to $$\sin \theta = CA $$ $$\cos \theta = OA$$ $$A_{OBC}= \frac{1}{2}(OB)(CA) = \frac{1}{2}(1)(\sin \theta) = \frac{1}{2}\sin \theta $$
507aacc9ec892d9ef99830c5330eb0f552ab6c1754030bf9e4d4e50ea3299842
['56673f9ee9ed44d2bf46ae07c67067fb']
PHP is automatically escaping my quotes before writing to a file using fwrite. I am trying to make a test code page. Here is the code I have: <?php if ($_GET['test'] == 'true') { $code = $_POST['code']; $file = fopen('testcode.inc.php', 'w+'); fwrite($file, $code); fclose($file); require_once('testcode.inc.php'); } else { echo " <form method='post' action='testcode.php?test=true'> <textarea name='code' id='code'></textarea><br><br> <button type='submit'>Test!</button><br> </form> "; } ?> When I enter the following into my form: <?php echo 'test'; ?> It gets saved in the file as: <?php echo \'test\'; ?> Why is php automatically escaping my quotes?
44fb809c7475d6bf2d39fbc354d67888a697f846d55af103838033a4bad7b006
['56673f9ee9ed44d2bf46ae07c67067fb']
I am getting the error Warning: openssl_get_publickey() [function.openssl-get-publickey]: Don't know how to get public key from this private key on line 5 When trying to get a public key from a private key. Here is my PHP code: <?php $privatekeyorig = openssl_pkey_new(); openssl_pkey_export($privatekeyorig,$privatekey); echo '<b>Private Key:</b> ' . $privatekey . '<br>'; $publickey = openssl_get_publickey($privatekeyorig); echo '<b>Public Key:</b> ' . $publickey . '<br>'; ?> According to the PHP manual I am doing this correctly. Anyone spot an error? Help would be greatly appreciated!
1e1a7e95d4cd020b89fd57e4b56c8a2522a42b7be5383d7939126a82fecef3cf
['568120aed7e446658d22bde635112daf']
I've seen a score of questions/answers on how to hide poi.business icons/labels from google maps, but what I need is for them to show up persistently across zoom levels. For example, even when I have featureType poi.business styler visibility set to "on", the icon shows up in ROADMAP type but not on the same HYBRID map counterpart. I need the icons/labels to show up on both map types at the same zoom level. I've tried this with both the google maps API v3 as well as the static map URL formulation and the same problem shows up. It appears the server determines that at certain zoom levels of the HYBRID map certain icons/labels should be hidden. I would like to override this decision. Is there a mechanism for this? (On the HYBRID map, if I haven't been clear.) Thanks!
14bf87beda58d3c2e269515c67358017d6c724ad1aebfde828219f13e3308b7d
['568120aed7e446658d22bde635112daf']
Looks like PILlow may have changed tostring() to tobytes(). When trying to extract RGBA pixels to get them into an OpenGL texture, the following worked for me (within the glTexImage2D call which I omit for brevity). from PIL import Image img = Image.open("mandrill.png").rotate(180).transpose(Image.FLIP_LEFT_RIGHT) # use img.convert("RGBA").tobytes() as texels
1f31971e95713dbaf4f5e11feb2f6f4642d53c36e39a01661a5b22193ebef3a8
['56b9b9c121514236bad94cc9b97831ca']
How do we confirm or disprove that? And is there a name for this kind of function? $$f(x)=c(x-a)+\frac{d}{x-a}+b$$ If we restrict that $x-a>0$ and $c,d>0$, an observation is that the minimum $2\sqrt{cd}+b$ is reached when $$x=\frac{d}{\sqrt{cd}}+a.$$ This can be confirmed by differentiation. However, noticing that's also exactly when $$c(x-a)=\frac{d}{x-a},$$ I'd like to ask if there's a simpler explanation why this function reaches its minimum when two of its components are equal?
7823c1f3896d3b7e8caa3a68a840d466d20ef0e4241789714c52d856f43856ca
['56b9b9c121514236bad94cc9b97831ca']
The way I make injera is simple. Make a batter teff and water. Once your batter or dough is done take half a liter of water and pour it over your batter or dough. Let it seat for 5 days. After 5 days, REMOVE the separated water and keep it aside. You will need it to cover the batter again once you done cooking. Mix well the batter without the excess water and cook. Add new teff flour to replace what you took to cook. THe batter ferments UNDER the excess water.
f25fae62b2662ab3c1a90ecd593a97898d0a327d81e57ef67cb8f9891a0dc4ff
['56b9d0342e7f4f258d16a42e971ddb21']
I want to replace 12 values at a time with the same number, but this doesn't seem to work. ReturnsC <- matrix(NA,N,1) x = 1 y = 12 for (i in 1:N/12){ ReturnsC[x:y,1] <- rnorm(1,.01,N*.1) x = x+12 y = y+12 } thank you
11c687cf34d81b354bd29e9cee37d7996cc4efa993fff2970846d0591b8d8c6d
['56b9d0342e7f4f258d16a42e971ddb21']
changed my view to: def submission(request): """View and maybe? edit application""" model = Application application = Application.objects.get(owner=request.user) if request.method != 'POST': form = ApplicationForm(instance=application) else: form = ApplicationForm(instance=application, data=request.POST) if form.is_valid(): form.save() return redirect('credit_apply:submitted') context = {'application': application, 'form': form} return render(request, 'credit_apply/submission.html', context) removed the application_id pattern and application.id tag in template since no longer needed
4c8215de8e00d082db9b951354bde89a7457e239003626baa1af58fecbf98291
['56c1bc427785476b964d62bf0acb3fb9']
ipmitool is really meant to be used outside of the BMC to control it. So in most use cases you install the ipmitool package on your computer (sudo apt install ipmitool), and then use it to talk to the server. i.e.: ipmitool -I lanplus -U root -H <server> -P <password> chassis power status If you're using QEMU, then I believe you need to hostfwd port 623 for this to work. I personally have not gotten ipmitool to talk to a QEMU session before though. If you really want ipmitool in your BMC image, then you could add it as a RDEPENDS to the packagegroup file similar to what facebook does in https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-fbtp/packagegroups/packagegroup-fb-apps.bb
9a4ca30438a327be4bd435eebfd1d87800e84b8e47e9e19ef8237239c02f92f5
['56c1bc427785476b964d62bf0acb3fb9']
The code commits have stalled out a bit but the code behind this tag has been shown to work with getting OpenBMC to work on Rasberry Pi https://gerrit.openbmc-project.xyz/q/topic:%22raspberrypi%22+(status:open%20OR%20status:merged) Multiple people have pulled it down and built an OpenBMC image that works on Rasberry.
44ec6bfdfac679da2aa8ef821f15657a041c8442f106655ebc09abea8cf967e4
['56c62f66b39745c9b8a33fa84a777dee']
I would try to extract some of the common functionality into reusable components as follows. The NumericButton and OperatorButton components could either receive selectNumber and selectOperator as props or the components could be connected components with the select* props coming from mapDispatchToProps. The connected component method eliminates the need to pass the prop in every component instance in ButtonContainer, but increases the number of connected components thus adding some complexity. const CalculatorButton = ({ children, className, onClick, value}) => { return <button value={value} onClick={e => onClick(e.target)} className={`buttonStyle ${className || ''}`} type="submit">{children || value}</button>; }; const NumericButton = ({ className, value }) => { return <CalculatorButton className={className} onClick={selectNumber} value={value} />; }; const OperatorButton = ({ className, value }) => { return <CalculatorButton className={className} onClick={selectOperator} value={value} /> }; const ButtonsContainer = () => ( <React.Fragment> <CalculatorButton className="ac" onClick={() => initialize()} value="AC" /> <CalculatorButton className="ce" onClick={() => clearEntry()} value="CE" /> <CalculatorButton className="posneg" onClick={changeSign} value="CHANGE">{'+/-'}</CalculatorButton> <OperatorButton className="divide" value="/" /> <NumericButton className="seven" value="7" /> <NumericButton className="eight" value="8" /> <NumericButton className="nine" value="9" /> {/* etc. */} </React.Fragment> );
0419034705d40afc1352375790158c7953396005a1d2e01c56b2e4856de04e12
['56c62f66b39745c9b8a33fa84a777dee']
I want to implement RAID in one system. I have 4 hard disks of 2TB capacity. I want to implement RAID1. My primary aim is to copy the content of one hard disk to another hard disk. here, 2 hard disks are main disks and 2 are mirrors to main hard disks. Is this possible by RAID1? If possible please suggest the mother board? Thanks, <PERSON>.
28cccb35f33c40c1aa95e0c89873f831f31d145d550c5c6f0fb9617c26a53d1b
['56c721b97e414dc88e1a8e6da878061d']
I think you're running into trouble with your str* function calls because you're assuming the buffer is null-terminated. You could receive BUFFER_SIZE - 1 bytes and then set buffer[bytes_recvd] = '\0' before doing your tests. Also, as others have pointed out, you need to look for "\r\n\r\n" instead of "\n\n" as the termination of your headers. Be careful to handle the condition where the CR LF CR LF sequence crosses two different recv() calls. One possible workaround to this possibility would be to copy the last three bytes of buffer to the start of buffer, and have your next read begin at &buffer[3].
e7925c4ab8608e5d60086e8ebc7c7a0d18c728182dc0c04e448de27e756f7f8e
['56c721b97e414dc88e1a8e6da878061d']
To clarify: I was referring to <PERSON>'s comments. Further breaking down what they said; unless the current of the DC signal surpasses the current of the AC signal, the ONLY difference in coil heating would be the time during each quarter of the AC cycle that the signal is not at full amplitude. However, all but the cheapest speakers are designed with a LOT of room for overcurrent situations, so unless you are running the thing hot enough that the AC current ALSO burns the coil, the DC signal should be particularly damaging. It is the extreme stress at the start of the dc pulse that harms it.
b6d49eda6e5edbb6f99fb605b127f43f992bfd468df0679f61fee288c434b59f
['56f16b9fa7694df2b4c4dc3d8f5a9a22']
It could be various things. Is the remote server Linux or windows host ? Is database running and listening to port 3306 on remove server ? What does telnet to port 3306 on remote server say ? Lot of times its firewalls that block access to that port. Check firewall (hardware and software). Also did you intentionally miss db port in your connection string ?
9ade61c199baf302efae5c42c9e5fcc0b848022c36f440fed62622a19afb835e
['56f16b9fa7694df2b4c4dc3d8f5a9a22']
mysqlcheck -q doesn't scan through rows. It only goes through indexes. If there are any incorrect links in rows it doesn't check them. I would avoid using -q unless you know there are no incorrect links in rows. mysqlcheck -r simply repairs the tables. Please check mysqlcheck utility man page for more details.
2df0b606e6808df9c4b87e0957f04ccaeb1a2783c95a044930f005bd54b8a89d
['56f3d24d222d4856b7e2934b7414784b']
Your making a mistake with your structure here. You should have the Users and there names and username in one variable so you can foreach this result. @foreach($users as $user) <tr> <td>{{ $user->name }}</td> <td>{{ $user->user }}</td> </tr> @endforeach If you want to add numbers to the list just add a counter with css or php if thats your way. <?php $i=1; ?> @foreach($users as $user) <tr> <td>{{ $i }} <td>{{ $user->name }}</td> <td>{{ $user->user }}</td> </tr> <?php $i++; ?> @endforeach
30e7f7218bf0b4ab62a9f4b4ee791ab7948307703c3eb49a9e05bc8dd2f950d6
['56f3d24d222d4856b7e2934b7414784b']
Currently we are using Mandrill to send our emails, when ever Mandrill detects a bounce we get the original headers along with the bounce or a subaccount where the email was send from. In Amazon SES we are getting the notifications through SNS thats no problem but besides the email from the user we get no original information back. So we have no idea what email campaign the user bounced on etc. Anybody that knows how to handle this?
00963db60e07a791624b574592b108f48396503cedb4042a242849a18e17c363
['56f4af7b193b4738baee5fe7d0538956']
There are several issues: Your examples are somewhat biased, since you've selected researchers who were not only brilliant but also prodigies. By contrast, <PERSON> finished his Ph.D. dissertation at the somewhat older age of 25, and <PERSON> didn't start his research career until he was 39 or so. Brilliant researchers are more likely to get an early start than average researchers are, but the correlation is far from perfect. Focusing on prodigies gives a misleading picture. There are plenty of prodigies today (<PERSON>, <PERSON>, <PERSON>, <PERSON>, etc.). If they occupy a smaller fraction of academia, it's probably because academia has grown enormously even relative to the population. The faculty in the top departments today are stronger on average than a hundred years ago, but there are many more departments nowadays, so the average professor is overall probably not as talented. The amount that's known is steadily increasing, so getting to the 19th century research frontier takes quite a bit less time than getting to the 21st century research frontier. This is not as relevant in very new fields, but finishing a Ph.D. in algebraic geometry in two years is a more impressive feat today than it was a hundred years ago. This increase in knowledge doesn't translate perfectly into an increase in time to degree: people also compensate by specializing more and then broadening later in their career. However, the obstacles to a quick Ph.D. are certainly increasing over time.
73cdc0a097af7fce59da8f3fe8c5566f34240ba2e68b537a60562b5f4bfc7164
['56f4af7b193b4738baee5fe7d0538956']
I agree with <PERSON> (although I'd describe formal publication as more than just "play the status game"). It's worth separating the issues of gamification and reputation systems from post-publication review. The latter is certainly possible, if you're open-minded about what counts as post-publication review, while the former is much more questionable.
a38c4ab8ce808cb4bf5b0c6b57ce90cd96dd7f4769d039a886d126d368be3005
['56fab70a27fc42d386b5af0008be2733']
<PERSON>, I've found this topic when I was searching Google for "Error in rsync protocol data stream". The reason was: after updating Debian from 9 to 10, rsync was gone in new system, so this exact answer really helped me. Missing rsync in target system may be a reason of similar errors — when rsync exits with code 12.
f5e98488d6e6cb7f9f89dbee2751d6d834991b724eba8c59e6698c406447f484
['56fab70a27fc42d386b5af0008be2733']
I have a MS Word merge document (not of my own making). To get the data for the merge, the file accesses a query in an Access database. How can I discover exactly what that query is? I know I can run a macro that will point to the database in which the query resides, but how do I drill down to the actual query(ies)? In other words, give a word merge file, how do I discover the complete data source without knowing what it was beforehand?
4fe3b38f41f44b051c85d47dedb43d7be593f1633cdd630431d47eef141e7c05
['56fb05826ade459f849f049f5475a4a8']
I'm just writing a very simple function in javascript to calculate a factorial. I understand that in javascript you can assign a function to a variable. So I have tried this on an online compiler (https://repl.it/languages/javascript) and this is what my code looks like var mynum = prompt("Enter a number", "<enter a number>"); var answer; if (isNaN(mynum)){ console.log(mynum +" is not a number"); } else{ console.log("You entered "+mynum); answer = function (mynum){ var i = mynum-1; var temp = mynum; while(i>0){ temp = temp*i; i--; } return temp; }; console.log("the factorial of "+mynum+" is "+answer); } But when I run this the output keeps including the whole function as "answer" You entered 23 the factorial of 23 is function (mynum) {var _loopStart = Date.now(),_loopIt = 0; var i = mynum - 1; var temp = mynum;setTimeout(function () {_loopStart = Infinity;}); while (i > 0) {if (++_loopIt > 5000 && Date.now() - _loopStart > 150) throw new RangeError("Potential infinite loop. You can disable this from settings."); temp = temp * i; i--; } return temp; } However i don't have this issue when i create the function and then call it separately (something like answer = function(mynum). Can anyone please let me know why this is happening? Thanks!
47d5eaa9fb803442b6b087b7353ae83b3cd399ccf6ea92181181c48da90cc2f6
['56fb05826ade459f849f049f5475a4a8']
I am trying to run a very simple test with pybot using the xpath but for some reason it keeps saying that my xpath is not a valid, even though I am following the documentation straight from http://robotframework.org/Selenium2Library/Selenium2Library.html This is all I have in my test: Temp test Set Selenium Timeout 60s Set Selenium Speed 1s Open Browser http://google.com chrome Click Link xpath=//a[@href=‘https://mail.google.com/mail/?tab=wm&authuser=0'] Sleep 3s Close All Browsers But for whatever reason it keeps complaining Message: invalid selector: Unable to locate an element with the xpath expression //a[@href=‘/‘] because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//a[@href=‘/‘]' is not a valid XPath expression. I have seen other people follow the same format with no issues. I have also never had issues with xpath expressions for selenium with java in the past.
e4fd8bc9723a72174f12e49d16c170d6f4f08cf4398d56face6371a8efa4c776
['56fd25d453d04ab8a0faa4f5c6152a8d']
I am working on a booking system for parking spots using rails. Here are the interesting tables and columns of my database schema for this problem.(I did not include the user table, as the only relevant column is the id column). `ActiveRecord<IP_ADDRESS>Schema.define(version: 20140430100754) do create_table "bookings", force: true do |t| t.integer "spot_id" t.integer "user_id" t.datetime "begins_at" t.datetime "ends_at" end create_table "parkings", force: true do |t| t.integer "owner_id" t.string "address" end create_table "spots", force: true do |t| t.integer "parking_id" t.string "number" end end` At the beginning the booking system was simple: A user would book a spot with a start time and an end time, and when querying for available spots, I would take the existing bookings into account. However, I now have to add availabilities on each spot: The owner of one parking spot must be able to set for each day of the week when his/her spot is available. I have done some research on how to store this in the database, but I did not find anything approaching. (Only simple booking systems like my previous system) Here are the main issues I have to address: The granularity of the booking system must be of 15 minutes at least I have to query very often the database to find all the parkings that still have at least one available spot for a given timeframe. My first question is about the way to store the initial availability infos. The only solution I could think of is storing it using booleans for each 15 minutes timeframe (with that for seven days, it is 672 columns, does not seem a groundbreaking idea to me). So do you have any advice on how to store this, and how to query this in an efficient way to check availability ? My second question is about the booking table: I want to clean the booking table in order not to let it grow, (I'm afraid it will slow down the queries to check availability on spots and parkings) BUT keep track of the previous booking by storing it in another table (which I won't query very often). Is it a good approach or not ? Notes I stated I'm using Ruby on rails, but I think the issue is language independent, and much more a database design issue.
64a8c40af595b97724f33d8d3fb01b182e014c0f454ef87f5ac39c5fce105d83
['56fd25d453d04ab8a0faa4f5c6152a8d']
I assume you have access to a sampleBuffer in a delegate method such as captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) I've already struggled with the CMSampleBuffer methods, and I agree it is not obvious how to make them compile. var sizeOut = UnsafeMutablePointer<Int>.alloc(1) var listOut = UnsafeMutablePointer<AudioBufferList>.alloc(1) let listSize: Int = 10 var blockBufferOut: Unmanaged<CMBlockBuffer>? CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, sizeOut , listOut, listSize, kCFAllocatorDefault, kCFAllocatorDefault, UInt32(2), &blockBufferOut) you will then need to call takeRetainedValueon the block buffer out, and handle your pointer to release them manually.
6040e8b27e0159996b4bab4cfa77bad7ad47580bdc362474eac0613c6f2c539d
['571815fd483347e88ab31ad83a9a5d21']
#1 in your list is the most important IMO, i'd add two more things to it: -Lots of big changes can be made in a short timeframe (for example 'lets switch the communication protocol!'), that wont break stuff in the short term, but many of these make the project very hard to manage in the long term. - The changes in the environment where the software runs can change drastically over a short time. While the basic premises for an airplane will stay the same (must fly in storms, must land on solid runways,..), a software can totally break, if the new verison of the OS comes out for example.
2727866a5c7e58470e64f2ac14a44136a72b350c81d32c7aa005429a41c38001
['571815fd483347e88ab31ad83a9a5d21']
I doubt he intends to use database split to create data marts or else he misunderstands them. Our entire database is fed into a 3rd party BI software using OLAP cubes. This BI software essentially does a select/ data read on all our fact/ dimensions tables once per night at midnight. Splitting the database would achieve nothing in terms of load balancing. Users query the BI cubes, not the database. The database tables are read "once" each per night. Ditto goes for end-user permissions, they are already managed via the BI/ OLAP cubes, as is the whole front-end. The split isn't entirely by dept.
7cee0579a3bf87d62efd03dc19eeb77fc10a2295793d6b295c517d4388a56081
['571c7bca6ebf4dbb8835238828183bc6']
I disabled it with `sudo systemctl set-default multi-user.target` Do you want me to enable it with `sudo systemctl set-default graphical.target` The laptop hasn't used a gui from the beginning. Its desktop install with gui autostart disabled. I have recently tweaked the blank and powerdown values with setterm and added that as a service. See here: https://askubuntu.com/questions/1228271/how-do-i-enable-a-timed-laptop-screen-power-off-from-the-console So it could be that, but it was working yesterday. Ha, the LCD is defective, this will be a headless test environment.
8cbe7f352b804aac3a50991903afb168a981763aacbc2011395a69a3021b25f7
['571c7bca6ebf4dbb8835238828183bc6']
I have logind.conf set with handlelidswitch=ignore etc..., this is working great. But the screen stays on permenantly as the system never sleeps. How do i switch off the built in laptop monitor after x minutes or when the lid closes (or both). cat /sys/module/kernel/parameters/consoleblank returns 0 as expected. I think i need to setterm --blank 30 --powerdown 2 where blank is in seconds and powerdown is in minutes. Where is best to add this for initialising, I thought /etc/rc.local, but this is systemd, and now i'm confused. Rather not screw this up, and i don't really know what i'm doing, thanks :)
5d3994099ec37e952d1c3a8a794ebd602fcb0a76de28826f6183b8ee8930afbc
['573178ceffb146bb9d57df4031b61fc9']
For example, I first increment from 1 to 2 by n=1, then from 2 to 4 by n=2, then from 4 to 7 by n=3, then from 7 to 11 by n=4, etc. How do I set up my code for an increment such as the one I just prescribed? I've tried i=1; i+=i, but that just increases by an increasing sequence of positive even integers
7801a1e4dbf00893ee7701092c5516f193130d99f7320a4ea3c4c3fc6d107196
['573178ceffb146bb9d57df4031b61fc9']
For example, I've already created a function that will create a nested dictionary. However, I'm trying to create a new function that will modify an existing dictionary by changing certain values within it. Here is my shot at it myclasses={} def addcourse(myclasses,department,course_number,term,grade,units): myclasses[department]={} if course_number in myclasses[department]: old=myclasses[department][course_number] old.append(term) old.append(grade) old.append(units) myclasses[department][course_number]=list(set(old)) else: myclasses[department][course_number]=[term,grade,units] def modifycourse(myclasses,department,course_number=newvalue,grade=newvalue,units=newvalue): try: if newvalue is course_number: grade=newvalue units=newvalue except: print "error" addcourse(myclasses,"Math","350","Spring 2016","A",3) addcourse(myclasses,"Math","350","Spring 2017","A",3) addcourse(myclasses,"Physics","401","Fall 2016","B",3) modifycourse(myclasses,"Physics","401","A",3) print myclasses I'm supposed to have the function and its keyword parameters named as listed in my code. So where am I going wrong? Here is my output error {'Physics': {'401': ['Fall 2016', 'B', 3]}, 'Math': {'350': ['Spring 2017', 'A', 3]}}
abd2b9cc37b541021819225d7fbe73134a51f13b2e8e07ad04a9a5f16227966d
['573337bd50d749fda93047dbffb901fe']
Why the volume of a $n$-dimensional parallelepiped with sides given by the row vectors of a matrix $A$ can be seen as the product of the singular values of this matrix $A$? I only know in 3-dimensinal vector space, the volume of a parallelepiped is equal to the determinant of the corresponding matrix.
97f35883b16f0708f8249ad64dcf78c17fddf14fba78ceaa032ee9c581bf457b
['573337bd50d749fda93047dbffb901fe']
If $X_1, X_2, ...$ are i.i.d.standard normal random variables and for real constants $a_1, a_2, ...$, given $\sum \limits_{i=1}^\infty a_i^{2} $ is finite, then $Y_n =\sum\limits_{i=1}^n a_iX_i$ converges (to $Y=\sum a_iX_i$) in $L^{2}(\Omega, P)$ and Y is also a normal random variable. I don't know how to show Y converges in $L^{2}(\Omega, P)$, but if anyone can prove this, then I can show Y is normal. I try to show that $E(Y_n-Y)^{2} \rightarrow 0$, but can't do it.
e79db4f6b48a3df86bc0860a131e84e00db52c657e2eb79966ae7dc7be4d051e
['57432ada79794e77b7ed6afb48264c55']
Writing clean() and clean_fieldname() methods covers two very different needs. The former lets you validate the value of a given field data, independently from others. The later allows you to validate your form by taking into account several fields value. So it's normal that the outcome of writing your "validation code" in either the first or second method is different. Have you tried to follow Django documentation about this subject? As you will see in this doc, calling super.clean() at the end of a field validation method does not make much sense as it will be called anyway during the whole validation process. This method (for example clean_new_password_2()) should be constructed as follows: def clean_new_password2(self): old_value = self.cleaned_data['new_password_2'] new_value = ... return new_value # this is the value you want for this field From what I understand from your use case, your code should be: def clean(self): cleaned_data = super().clean() ... # Do here the validation stuff you want to do with your field values # and if you changed the values of ones of the field in cleaned_data, do as follows: return cleaned_data # you can even return whatever you want # If you changed nothing, you don't need a return statement
4193290bee1dc204e2080834d31283f76217940dda734c3d18d0cb21178d9da0
['57432ada79794e77b7ed6afb48264c55']
I'm using Python 3.6 with Django 1.11.9 and rest_framework 3.6.2. I have a view (APIView) which can only be accessed by some users who successfully pass a given HasUnlimitedAccesPermission check. In case of failure to pass the latter, I raise a PermissionDenied with a detailed message of my choice about the error to pass on to front-end. So far so good, all of that is easily achievable by applying the HasUnlimitedAccessPermission to my view thanks to the "permission_classes" decorator (yeah, I'm using a function_based view, here). Now, what I would like to achieve is passing an additional attribute to my error response JSON (when the user fails to pass the permission test). This attribute would be an "error_id" attribute that would give the front-end developer the ability to adapt the error display depending on the "error_id" value. An example of the response JSON would be : { "error": "To enjoy this feature, go pick one of our pay offer!", "error_id": "no_unlimited_access" } Any idea on how to achieve this?
19a62635364070bb05618faf21dcd5678bf5f8d73aef10bf3acde8c6b82d65d2
['574a3714e4ed4f62ad2c6dc3b63c247f']
SAS provides a handy tool for handling panel models with a large number of groups by 'absorbing' those groups (PROC GLM; ABSORB). My understanding is that it factors the effect of the absorbed parameters out of the data before estimating the remaining parameters. It seems like this may invalidate the standard errors of the parameter estimates. The variance covariance matrix would not be calculated with the full set of parameters. Hence, we would be calculating the variance covariance matrix conditional on the absorbed parameters, where we would really want the unconditional variance. Am I misunderstanding what is going on here? I haven't found any good explanations in the help files.
7bfd8acfdc6a6be21eaf52f640e72056e95d2fb339531c695d360fe4423f17ad
['574a3714e4ed4f62ad2c6dc3b63c247f']
I talked to the student advocate attorney, who said technically I'm in the wrong even if I had no intent to cheat. Another attorney I talked to said this charge was a stretch. Even the case officer handling this said I had a compelling case, but later after consulting his boss, the case officer deferred to the professor not wanting information being shared online.
6ff243acb30bda1fe603a323701ec799f65becc1d217609f7752b6242bfe2abf
['57918cc2cb4e4a43a6b33275ef4a6880']
I need to convert an SVG to EPS and currently use inkscape to do this. To convert the SVG using the Inkscape GUI version, I simply open the svg, and "Save As" '1.eps', unselecting the "EPS+Latex: Omit text in EPS and create Latex File" and "Rasterize filter effects" option. How can I achieve this using inkscape command line. As I experienced that inkscape used EPS+Latex option as default even though user don't have mention --export-latext option in command line.
2af22a8be2ad7df801f8520c32201031033297b65c35539bb0edad9580d5c17e
['57918cc2cb4e4a43a6b33275ef4a6880']
I am trying to save imageData as pdf file on server directory. Html5Canvas imageData was sent to server and after conversion in bytes array, tried to save as PDF file. File generated successfully on specified path but the generated file doesn't open correctly in most of the PDF readers(i.e. Adobe Reader, Foxit reader etc) and show error that file is either damaged or corrupt but it open correctly in MS Edge browser. I want them to show in common PDF reader too. Can you please suggest the solution. Here is my server side code. public static string SaveImage(string imageData, string userEmail, int quantity) { string completePath = @"~\user-images\"; string imageName = "sample_file2.pdf"; string fileNameWitPath = completePath + imageName; byte[] bytes = Convert.FromBase64String(imageData); File.WriteAllBytes(HttpContext.Current.Server.MapPath(fileNameWitPath), bytes); } Same output generated for this code FileStream fs = new FileStream(HttpContext.Current.Server.MapPath(fileNameWitPath), FileMode.OpenOrCreate); fs.Write(bytes, 0, bytes.Length); fs.Close(); and for this too. using (FileStream fs = new FileStream(HttpContext.Current.Server.MapPath(fileNameWitPath), FileMode.Create)) { using (BinaryWriter bw = new BinaryWriter(fs)) { byte[] data = Convert.FromBase64String(imageData); bw.Write(data); bw.Close(); } }
804e2e8d53bcdfd1232f5bdc4aca94461feda542d7eeddbd4ff390a9108d138a
['57996b4d17814690bab25f3f4ef81faa']
I've received this strange error after implementing method that converts image to grayscale: public Bitmap toGrayscale(Bitmap bmpOriginal) { int width, height; height = bmpOriginal.getHeight(); width = bmpOriginal.getWidth(); Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); Canvas c = new Canvas(bmpGrayscale); Paint paint = new Paint(); ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm); paint.setColorFilter(f); c.drawBitmap(bmpOriginal, 0, 0, paint); bmpOriginal.recycle(); return bmpGrayscale; } The error: E/AndroidRuntime: FATAL EXCEPTION: main Process: mantas.spr_demo, PID: 20853 java.lang.IllegalArgumentException: Capacity: -<PHONE_NUMBER> at java.util.HashMap.<init>(HashMap.java:140) at java.util.HashMap.<init>(HashMap.java:174) at java.util.LinkedHashMap.<init>(LinkedHashMap.java:119) at java.util.LinkedHashMap.<init>(LinkedHashMap.java:97) at java.util.LinkedHashMap.<init>(LinkedHashMap.java:81) at com.jjoe64.graphview.GridLabelRenderer.adjustVertical(GridLabelRenderer.java:768) at com.jjoe64.graphview.GridLabelRenderer.adjustSteps(GridLabelRenderer.java:932) at com.jjoe64.graphview.GridLabelRenderer.draw(GridLabelRenderer.java:1067) at com.jjoe64.graphview.GraphView.drawGraphElements(GraphView.java:299) at com.jjoe64.graphview.GridLabelRenderer.draw(GridLabelRenderer.java:1062) at com.jjoe64.graphview.GraphView.drawGraphElements(GraphView.java:299) at com.jjoe64.graphview.GraphView.onDraw(GraphView.java:323) at android.view.View.draw(View.java:16302) at android.view.View.updateDisplayListIfDirty(View.java:15284) at android.view.View.draw(View.java:16072) at android.view.ViewGroup.drawChild(ViewGroup.java:3622) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3409) at android.view.View.draw(View.java:16305) at android.view.View.updateDisplayListIfDirty(View.java:15284) at android.view.View.draw(View.java:16072) at android.view.ViewGroup.drawChild(ViewGroup.java:3622) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3409) at android.view.View.updateDisplayListIfDirty(View.java:15279) at android.view.View.draw(View.java:16072) at android.view.ViewGroup.drawChild(ViewGroup.java:3622) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3409) at android.view.View.updateDisplayListIfDirty(View.java:15279) at android.view.View.draw(View.java:16072) at android.view.ViewGroup.drawChild(ViewGroup.java:3622) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3409) at android.view.View.draw(View.java:16305) at com.android.internal.policy.PhoneWindow$DecorView.draw(PhoneWindow.java:2760) at android.view.View.updateDisplayListIfDirty(View.java:15284) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:295) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:301) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:345) at android.view.ViewRootImpl.draw(ViewRootImpl.java:2686) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2495) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2120) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1138) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6227) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:884) at android.view.Choreographer.doCallbacks(Choreographer.java:696) at android.view.Choreographer.doFrame(Choreographer.java:631) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:870) at android.os.Handler.handleCallback(Handler.java:743) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:5546) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684) App works fine without toGrayscale method. But I really need it. Tried to add recycle(); methods everywhere in a code to prevent exceeding memory, but it did not work. I can't recycle bmpGrayscale as I need to return it. Any idea what can be wrong?
72ee9439c43a8c4cf1293417451da38cda428c89392e6fe15031fd4ea3c0c8da
['57996b4d17814690bab25f3f4ef81faa']
It might sound strange, but I need to have IF sentence inside bar plot line. My part of code: for col in columns[2:32:2]: plt.bar([p + width*n for p in pos], df[col], width, color=colors[n], hatch='x') I have DataFrame df. I need to plot every second value of its column in grouped bars (grouped according to row) and every other second of that contains a value 0 or 1. According to that 0 or 1 value I need to have bar hatched or not. I was trying to insert IF sentence inside plt.bar(), but I was not successful. Any ideas how to do it? If it is possible at all
8e547c6810402de9d89fbffa7dc6f223feb80291dc26fef0e25e3a5e56f810b7
['5799c422f3654f55b4cad29e4662f7ae']
if you want to display view header or footer in twig template, look at core views-view.html.twig and all the available variables. In your case : header: The optional header. footer: The optional footer. In your twig views-view--[view-name].html.twig, you can display your variable like this : <p>{{ header }}</p>
058703da407fe62ff4ea733f8d795bb2936fab99558815cedf3035d8f2bd740c
['5799c422f3654f55b4cad29e4662f7ae']
@4k4 In view mode "Related Content", we have the field "Related Articles" and not title, image, summary, etc. Since the "Related Articles" field is repeatable, i have `{{ content.field_suggestion_articles }}` in `node--article--related-content.html.twig`. In `field--node--field-suggestion-articles--article.html.twig`, i have `{% for item in items %}{{ item.content }}{% endfor %}`So I can’t access properly to custom fields. I can do something but with ugly code based on https://drupal.stackexchange.com/questions/208723/iterate-through-multiple-value-content-field-in-twig-template
f7c307e68de6a4772e9feed9b7e1f42ec7fb8272434400396575969cc1066bb1
['579ab094c6ac4711a3507e92ff6fded1']
use following php code: <?php $name = $_POST['name']; $subject = $_POST['subject']; $email = $_POST['email']; $message = $_POST['message']; $to = "<EMAIL_ADDRESS>"; $subject = "Hello World"; $message = "Name: $name \n Subject: $subject \n Email: $email \n Message: $message \n"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: '.$email. "\r\n"; if(mail($to, $subject, $message, $headers)) { echo "Mail Sent Successfully."; } else { echo "Error in Mail Sent."; } ?>
0564aee39a1cd6fbe67af726012ff8648c2b9603e9143b2880f4c3dd5190c2f4
['579ab094c6ac4711a3507e92ff6fded1']
Use following: char capSentStart(char paragraph[], char newParagraph[]) { for(int i = 0,j = 0; i < 301; ++i,++j) { if(paragraph[i] == '.' && paragraph[i + 1] == ' ') { newParagraph[j] = '.'; newParagraph[j + 1] = ' '; newParagraph[j + 2] = ' '; newParagraph[j + 3] = toupper(paragraph[i + 2]); j=j+3; i=i+2; } else { newParagraph[j] = paragraph[i]; } } }
fa63881f77a5e8bf980c504fcbbb1c67ad995cc212c55e032ba41116113d3759
['57b51b6cac9243f4b3b32ca8514fa28d']
You shouldn't use AnyEvent<IP_ADDRESS>Worker<IP_ADDRESS>Poll for this task. And I'll recommend you do not use loop specific features like EV<IP_ADDRESS>loop EV<IP_ADDRESS>unloop. This makes your code incompatible with other loops implementation. Your code may be rewrited like this use strict; use AnyEvent; use AnyEvent<IP_ADDRESS>HTTP; my $pool_size = 2; my $num_jobs = 7; my $cur_job = 0; my $cv = AnyEvent->condvar; $cv->begin(); for (1..($pool_size < $num_jobs ? $pool_size : $num_jobs)) { $cv->begin(); make_job($cur_job++); } $cv->end(); sub make_job { my $job = shift; $num_jobs--; http_get 'http://download.thinkbroadband.com/5MB.zip', sub { my ($data, $headers) = @_; if ($headers->{Status} =~ /^2/) { print "download [$job] succeeded.\n"; } else { print "download [$job] failed.\n"; } if ($num_jobs > 0) { make_job($cur_job++); } else { $cv->end(); } }; } $cv->recv();
85530062893037cae384433354cd8fde0de4dc6e91d4ad5f825d84aad78f5fc0
['57b51b6cac9243f4b3b32ca8514fa28d']
After fast look at source code of this module I can suggest to use it like in example below. Because any method may raise exception. On http error this will be HTTP<IP_ADDRESS>Response object eval { my $response = $py->plot($x0, $y0, $x1, $y1); }; if (my $err = $@) { if (!ref $err) { die "Plotly error: ", $err; } elsif ($err->isa('HTTP<IP_ADDRESS>Response')) { die "HTTP error: ", $err->status_line; } else { die "Unknown error: ", ref($err), " ($err)" } }
b10ca2e80b07823be359a7131fe5dedbbafd7b323337729a71320888d3ee6b00
['57bdbd8c3cbd4b57b4c9c8cc3230837a']
Your IP Address doesn't/can never give you the correct location of where you are it. The location can from the internet can only be used to get the country and MAYBE the state of the user. The location given is usually where the Sub-Station of your ISP is located.
1fce54497d168f06286211916ab9b22ccb01a41b722b92141695b4f2711d6834
['57bdbd8c3cbd4b57b4c9c8cc3230837a']
So I currently have a database with the user information and what defines the user is the user_id. Then I have table named token, that has a token_id and user_id as the primary key and the rest of the information, making this a one to many database. @Entity @Table(name = "user") public class User implements Serializable { @Id @Column(name = "user_id") private long userId; //Other variables and getters and setters @OneToMany(orphanRemoval = true, mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.ALL) @Access(AccessType.PROPERTY) //I need this as is since I have other things in the setter private List<Token> tokens = new ArrayList<>(); public List<Token> getTokens() { return tokens; } public void setTokens(List<Token> tokens) { this.tokens = tokens; } } After this snipped of code I have the token's class public class Token implements Serializable{ @Id private long tokenId; @Id @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") private User user; @Column(nullable = false) private String token; @Access(AccessType.PROPERTY) private Instant lastUsed; @Column(nullable = false) private Instant dateCreated; @Transient private boolean expired; //Getters and setters go here //Static methods and generating the token private static String generateToken(){ Random random = new Random(); byte[] randomString = new byte[256]; random.nextBytes(randomString); return Base64.encodeBase64String(randomString); } public static Token generateUserToken(User user){ Token token = new Token(); token.setTokenId(new Random().nextLong()); token.setUser(user); token.setDateCreated(Instant.now()); token.setToken(generateToken()); return token; } //Static methods and generating the token } Now for some reason whenever the User user is not marked as @Id it works (even if in the database it is a primary key). Any help; application.properties: spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL57InnoDBDialect spring.jpa.show-sql=true logging.level.org.hibernate.type=TRACE SQL Output: Hibernate: insert into tokens (date_created, last_used, token, user_id, token_id) values (?, ?, ?, ?, ?) binding parameter [1] as [TIMESTAMP] - [2018-05-14T08:29:00.719764Z] binding parameter [2] as [TIMESTAMP] - [null] //This is okay to be null this is last_used binding parameter [3] as [VARCHAR] - [<Token too long to write in question>] //Actual data type is LONGTEXT binding parameter [4] as [BIGINT] - [null] //this is a problem (user_id should not be - should be a long numebr such as: 5531405900210671089) binding parameter [5] as [BIGINT] - [0] //this is a problem (token_id should be a long number such as: -8824825685434914749) SQL Error: 1048, SQLState: 23000 Column 'user_id' cannot be null
31fe979f98ca5c91ffe1c5d396a76500d1a7ca3928cec0250b2fbef84a2e8ea5
['57c5d8f75e0e4fc3b233d656b1015120']
After insert elements into the array, when I reset, it does not go to the initialStateOfList that is to [1,2,3,4,5]. For example, If I insert 6 and 7, then press on clear and then reset button, it goes to [1,2,3,4,5,6,7] and not [1,2,3,4,5]. What should I do to make it go back to the original state? import React , {Component} from 'react'; import {render} from 'react-dom'; const initialStateOfList = [1,2,3,4,5]; class Form extends Component{ state = { tempo : '', list : initialStateOfList }; clearArray=()=>{ this.setState({list:[]}); } resetArray=()=>{ this.setState({list:initialStateOfList}); } tempAdd=(event)=>{ this.setState({tempo:event.target.value}); } addItem=(event)=>{ event.preventDefault(); this.state.list.push(this.state.tempo); this.setState({tempo:''}); } render(){ const listitem = this.state.list.map((number) => <li>{number}</li>); return( <div> <form ref="form" id="getInput" onSubmit={this.addItem}> {this.state.list.map((listItem)=><li>{listItem}</li>)} <input type="text" ref="formText" id="adder" onBlur={this.tempAdd} /> <input type="submit" ref="formSubmit" id="passer" /> <button id="clear" onClick={this.clearArray}>clear</button> <button id="reset" onClick={this.resetArray}>reset</button> </form> </div> ); }; } export default Form;
78cba6005ac74cc3aa0f898411ec73fb21704bf2910c39c4a491d19a76060b79
['57c5d8f75e0e4fc3b233d656b1015120']
I want to write a http POST/PUT request that would need to update two fields in two different tables. For example, I want to write a http request that would reset the marks obtained by a student in various exams like math, science, literature with each record being in different tables. Is it a good practise to write a single post/put request that would do updates in different tables, although it's theoretically possible? I'm writing the api in Flask.
4ee47147f831be22388426cde8b0f85e2c808a47ffb76fdc7e0e285e84e3d2a2
['57df9229d9c040e196db19d193e88f16']
Yes you can do it. If you want to save the image into device's gallery you might use saveToPhotoGallery method: https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-saveToPhotoGallery If you want to save the file inside the device, have a look at this code snippet: https://gist.github.com/timoa/3733505
13f1da86bb0cfefbb3e9b22f7606b07f8ae628ff20ec0db66af7abf5241c5894
['57df9229d9c040e196db19d193e88f16']
To animate something, you will indeed need to use the animate method. Here is an example for you: var view = Ti.UI.createView({ backgroundColor:'yellow', width:'76%', right:-Ti.Platform.displayCaps.getPlatformWidth(), onScreen:false }); win.tiview.add(view); win.tiview.addEventListener('click',function(e){ var viewShowAnimation = Ti.UI.createAnimation({ duration:250, right:0 }); var viewHideAnimation = Ti.UI.createAnimation({ duration:250, right:-Ti.Platform.displayCaps.getPlatformWidth() }); if(view.onScreen){ view.animate(viewShowAnimation); }else{ view.animate(viewHideAnimation); } view.onScreen = !view.onScreen; });
c1fecff24b7da328fea63d71f0afa068380db811f226c607adc3a06557866644
['57fe96390cad455bb5bbb4898c35d882']
I only added targetapi and it worked. Also, I used requestPermissions in this fragment. @TargetApi(Build.VERSION_CODES.M) @Override public boolean onOptionsItemSelected(MenuItem item) { if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.READ_CONTACTS)) { } else { //ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.CALL_PHONE}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); //MenuFragment.requestPermissions( new String[]{Manifest.permission.CALL_PHONE}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); requestPermissions( new String[]{Manifest.permission.CALL_PHONE}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } } return super.onOptionsItemSelected(item); }
f6f07abe40e21ea0804add6b368ab28ccc4552122a7b0962c89148bbb8211964
['57fe96390cad455bb5bbb4898c35d882']
I see Here3 and Here4 True True on logcat but commands(alertdialog, mediaPlayerStop and VibrateStop) doesn't work in run() method. Any suggestion? Thanks in advance. if(check == 1) { Log.i("XXX", "Here3"); runOnUiThread(new Runnable() { @Override public void run() { new Handler().postDelayed(new Runnable() { @Override public void run() { Log.i("XXX", "Here4 " + voiceSwitch.isChecked() + " " + vibrateSwitch.isChecked()); if(voiceSwitch.isChecked()) { mediaPlayerStop(); } if(vibrateSwitch.isChecked()) { vibrateStop(); } builder.show().dismiss(); } }, 5000); } }); }
89eb86e6be6868e0e32c26a398e84ee6faaea7209b8036dc2d0e766934f72ab9
['5801579494ee4f289e87758fe15aefcb']
Well, that require some python at least IMHO. Basically you can achieve this by setting a remote server that waits for N connections to be done (you can do a basic user/password login for this), then once all required users are connected you can create an account on some webmail server that has his own exposed API (i guess gmail has it's own) the main point is that if you 3 are sharing a key and you don't want other login without your permission, no one should own that host and no one should ever join in, because the owner could change the code and save some sensible data. but i think there is some nasty point after that: how could you set the phone number of that account on the convalidation? you could also activate account security if webmail server has it but that require that you have that account on your mobile phone and this doesn't prevent access without permission ----- EDIT: if you want just to remote type in the password, you could use TeamViewer too, i think it's keylogger proof and you can use Avast virtual keyboard to be much more safer
86af38e304b9f9da113ca3d7338d25d491a52049e9d269aacb59436c4ef48054
['5801579494ee4f289e87758fe15aefcb']
let me explain well.. I'm trying to write a program that "listen" the keys pressed by keyboard WHILE I'm into a full-screen game.. I've used DirectInput yet, but it seems don't look into it.. E.g i'm pressing spacebar into game and my char jumps, but my program won't listen to my keys.. it won't record ANYTHING. Just waiting for pressing ._. i'll be happy if someone can help me, maybe giving an hint like HowTo pressing "a" and result like "spacebar" (pressing "a" i want jump xD) Can some one help me? **
f6079e5d2309a347e18dff031ab4521889b1059285f3cdf50757820d1980a7c8
['581bcfcdc6164b90a46f8668d4275abb']
Thank you @brunch875! Your comment helped me out a lot in places that I had trouble with before. One issue that I am coming across, however, is the problem that although I am running the server on my computer, and localhost works, other computers on the same network are not able to see what I see. What I tried is: * ran the server on my machine. * copied the ip address of my machine (<IP_ADDRESS>). * pasted that into another machine on the same network. It turns out that that approach times out, which is different from what I expected would happen.
6405c3d65f159b8f8c6392072078702c3edb24d633df79a0b64226f5ab77ff85
['581bcfcdc6164b90a46f8668d4275abb']
I am an almost absolute beginner to the world of servers. I have no knowledge of setting up a server aside from running apachectl -k start and seeing "it works!" in localhost. I've tried dabbling in "port forwarding" and tried to get something to work in no-ip.com, but after a while I had no idea what I was doing. If it means anything, the process I tried through no ip was: port forwarding the http port on my laptop through my router (this is how it looks running apache running the noip client creating a host on noip (with settings DNS Host(A), and whatever IP address it detected) accessing the domain created by no-ip. What ended up happening was when I tried accessing the domain (which by the way is swarajd.no-ip.org), it times out. I recognize that I am doing something wrong but I do not know what to do in order to remedy the mistake. I want to be able to set up a simple web server on my laptop running openSUSE, through my verizon actiontec MI424WR router, on a simple domain name such as swarage.somewebsite.info or something. (note: this question is cross-posted from stack overflow, as a moderator from there recommended this question be asked here).
da270ff719774f2f322e6956471de777c8b27fbdc8d1f9782b4b6bc00bcbf4b4
['581e95ad002e4899b350b92fa1c2dda2']
So, wOxxOm answer helped me understand the issue, but since I'm not going to use Mozilla's WebExtension Polyfill, I worked around the problem by creating a separate async function to await for the Promise and return the data fetched. This was due to me having problems with having async functions inside the message listener, even with "return true", it was throwing message port closed before response received error. This is the final code in background script: const FETCH_METRICS = [ 'commits', // 0 'issues', // 1 'branches', // 2 'pullrequests' // 3 ] async function fetchData(type, aux) { let url_fetch = `${url_base}/${type}/${aux}` try { return (await fetch(url_fetch)).json() } catch (err) { console.log('Error: URL = ', url_fetch, ' err: ', err) } } async function execute(request, aux) { const data_ = await Promise.all(FETCH_METRICS.map(type => fetchData(type, aux))) return data_ } chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { chrome.storage.sync.get('oauth2_token', (res) => { if (res.oauth2_token != undefined) { chrome.tabs.query ({ 'active': true, 'lastFocusedWindow': true }, function (tabs) { let url = tabs[0].url.split("/") let owner = url[3] let repo = url[4].split("#")[0] let url_aux = `?owner=${owner}&repository=${repo}&token=${res.oauth2_token}` execute(request, url_aux).then(sendResponse) }) } }) return true }) and this is the contentscript (already plotting the charts, response is now defined and filled with the correct data): if (typeof chrome.app.isInstalled !== 'undefined') { console.log("gbdScreen sending requests") chrome.runtime.sendMessage({metric: "get-metrics"}, function(response) { if (response !== undefined) { let issuesCtx = document.getElementById('issuesDashboard').getContext('2d') createIssuesChart(response[1], issuesCtx) let commitCtx = document.getElementById('commitsDashboard').getContext('2d') createCommitsChart(response[0], commitCtx) let branchesCtx = document.getElementById('branchesDashboard').getContext('2d') createBranchesChart(response[2], branchesCtx) let prCtx = document.getElementById('prsDashboard').getContext('2d') createPRChart(response[3], prCtx) } else{ console.log("gbdScreen-else") document.getElementById('gbdButton').click() } }) }
b09cae813a46fb974a096e3fc6013df6b8abaf0c348ae17b50137144a2bd4518
['581e95ad002e4899b350b92fa1c2dda2']
I need to access data from my API from inside a contentscript, however since they are HTTP requests (and not HTTPS) they are blocked from inside a contentscript. Due to that, I am doing all the requests from inside a background script, and trying to communicate between the backgroundscript and contentscript using the message API. Whenever I'm ready to use the data inside the contentscript, I send a message to the background script, which will then fetch the data from the API and send it as a response to contentscript. From the background script, if I console.log the data right before I send it, it's all good (an array of 4 positions). However, the received data in the contentscript is an empty array, all the data stored in the array is lost. Here's the contentscript code snippet that sends the message: if (typeof chrome.app.isInstalled !== 'undefined') { console.log("gbdScreen sending requests") chrome.runtime.sendMessage({metric: "issues"}, function(response) { setTimeout(function(){ if (response !== undefined) { console.log(response) console.log(response.data) } else{ console.log("gbdScreen-else") document.getElementById('gbdButton').click() } }, 2000) }) } And here's the background script, in which it receives the message, proceeds to fetch the data, and sends it back: chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { let arr = [] chrome.storage.sync.get('oauth2_token', function(res) { if (res.oauth2_token != undefined) { chrome.tabs.query ({ 'active': true, 'lastFocusedWindow': true }, function (tabs) { let url = tabs[0].url.split("/") let owner = url[3] let repo = url[4].split("#")[0] let url_aux = `?owner=${owner}&repository=${repo}&token=${res.oauth2_token}` let url_fetch = url_base + '/commits' + url_aux // async function to make requests const asyncFetch = async () => await (await fetch(url_fetch)) // commits request asyncFetch().then((resp) => resp.json()).then(function(data) { arr[0] = data }).catch(function(err) { console.log("Error: URL = " + url_fetch + "err: " + err) }) // issues request url_fetch = url_base + '/issues' + url_aux asyncFetch().then((resp) => resp.json()).then(function(data) { arr[1] = data }).catch(function(err) { console.log("Error: URL = " + url_fetch + "err: " + err) }) // branches request url_fetch = url_base + '/branches' + url_aux asyncFetch().then((resp) => resp.json()).then(function(data) { arr[2] = data }).catch(function(err) { console.log("Error: URL = " + url_fetch + "err: " + err) }) // prs url_fetch = url_base + '/pullrequests' + url_aux asyncFetch().then((resp) => resp.json()).then(function(data) { arr[3] = data }).catch(function(err) { console.log("Error: URL = " + url_fetch + "err: " + err) }) console.log(arr) sendResponse({data: arr}) // sends back to screen.js the data fetched from API }) } }) return true }) I console.log inside both the backgroundscript and the contentscript, and it's all good in backgroundscript, but printing an empty array in contentscript. If anyone can shed some light, I know it's pretty messy code right now.
ad149e9c84f47bd6225f3da7c1b522ca2c4f1c85ebcf47a59b0ffac4d2e83fc1
['5834637069a748b8b4afe86bf62cf38c']
The top voted answers fail if no results were returned by a grep. <PERSON> <PERSON> <PERSON> <PERSON> <PERSON> <PERSON> <PERSON> <PERSON> This is the wrong way to do it: wiggums=$(grep -iF "Wiggum" characters.txt); num_wiggums=$(echo "$wiggums" | wc -l); echo "There are ${num_wiggums} here!"; There will tell us, there is 1 Wiggum in the list, even if there aren't any. Instead, you need to do one extra check to see if the variable is empty (-z, as in "is zero"). If grep didn't return anything, the variable will be empty. matches=$(grep -iF "<PERSON>" characters.txt); if [ -z "$matches" ]; then num_matches=0; else num_matches=$(echo "$matches" | wc -l); fi echo "There are ${num_matches} VanHoutens on the list";
4fa007867ba2835611425a3b2bc65a12272f5a953c39c9ccacfba86f331f9d5f
['5834637069a748b8b4afe86bf62cf38c']
For some reason, the following regular expression match doesn't seem to be working. string="#Hello world"; [[ "$string" =~ 'ello' ]] && echo "matches"; [[ "$string" =~ 'el.o' ]] && echo "matches"; The first command succeeds (as expected), but the second one does not. Shouldn't that period be treated by the regular expression as a single character?
8150d05b2fb3ee654a152246e57e1ab55f0b5149d4d23cf4a2b22c5b3da756e9
['5834a52e525841c19c3fa7e7744f9e3e']
I found that the built in region monitoring wasn't accurate enough for my needs. If you need higher accuracy, first set your accuracy appropriately, and then you can use something like this: (Uses the same method as @coolcool1994, but a little more in-depth and using Swift 2.1. Remember to set up CLLocationManager and its Delegate (where the functions below would reside), and start receiving location updates) var activeRegions = Set<String>() var monitoredRegions = [ CLCircularRegion(center: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0), radius: 300, identifier: "Region1"), CLCircularRegion(center: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0), radius: 300, identifier: "Region2") ] func manuallyUpdateActiveRegionsFromLocation(location: CLLocation){ // Optionally explicitly reject unwanted location updates // Setting the location manager delegate's desiredAccuracy should be enough let maxOldTime = 300 //5 minutes let minAccuracy = 300 //300 metres if abs(location.timestamp.timeIntervalSinceNow) > maxOldTime || location.horizontalAccuracy > minAccuracy { return } for monitoredRegion in monitoredRegions { if monitoredRegion.containsCoordinate(location.coordinate) { activeRegions.insert(monitoredRegion.identifier) } else { activeRegions.remove(monitoredRegion.identifier) } } } func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { if let location = locations.last { manuallyUpdateActiveRegionsFromLocation(location) } }
fd81173314abab9d0519bbeb9166ec28c3081d9c98df522120cd21188d676757
['5834a52e525841c19c3fa7e7744f9e3e']
I have a traditional REST API, that returns data like so: User list - GET /users.json users: [ {id: 0, name: "<PERSON>"}, ... ] Users by Id - GET /users/0.json user: { id: 0, name: "<PERSON>" } As you can see, if you first request the data from the list (/users.json), and then click on a user, even though the information was present in the first list, it is re-requested from the user by id request. In Falcor, this would be solved by having a list of references in the first call. My question is, if I am writing a Falcor router to act as a middleman, how do I optimise such a scenario? Currently, the router has to request the full user list, and then throw out the information and return a list of references based on the ids to the client. This still saves bandwidth on the client side but is suboptimal between the Falcor router and its datasource (REST API).
824dd8fdc23db0a5a731fd25b805c6e4cf37ee2f204431c5561949298cab9e6f
['584419cf4b8a4986a2eae99e1b02229a']
Let $W$ be a symmetric $\alpha$-stable process with its generator $-(-\Delta)^{\alpha/2}$ for some $\alpha \in (0, 2]$ under $\mathbb P$. Let $\mathbb P^x$ be the probability measure induced by a process $$X(t) = x + t + W(t)$$ starting from $x$, and we set $$\hat \zeta = \inf\{t>0: X(t) \notin (-1, 1)\}, \quad \zeta = \inf\{t>0: X(t) \notin [-1, 1]\}.$$ My question is that [Q.] Is $\mathbb P^x (\hat \zeta = \zeta) = 1$ valid for $\alpha \in (0, 1)$? [remark] The answer should be positive if $\alpha \ge 1$. In fact, one can use strong <PERSON> property and time-shift operator to obtain $$\mathbb P^x(\hat \zeta = \zeta) = \mathbb P^x (\zeta \circ \theta_{\hat \zeta} = 0) = \mathbb E^x [ \mathbb P^{X(\hat \zeta)} (\zeta = 0)] = 1.$$ The last equality is true, since $\zeta = 0$ $\mathbb P^{x}$-a.s for all $x\notin (-1, 1)$ when $\alpha\ge 1$. However, when $\alpha <1$, $x = -1$ is not regular to $[-1, 1]^c$, i.e. $\zeta>0$ holds almost surely in $\mathbb P^{-1}$. Therefore, the above argument does not work any more, unless $\mathbb P^x(X(\hat \zeta) = -1) = 0$, which is not clear to me. Thanks.
bdea4ce3f86ade18c788a70e88f4904fa0b82082278847f884e3d65e32b8e41f
['584419cf4b8a4986a2eae99e1b02229a']
Quote from the link "Technically, that last scenario in which funds are transferred from an employer plan to a Roth IRA is called a "qualified rollover contribution". It's often referred to as a conversion but a conversion is limited to a non Roth IRA to Roth IRA rollover or transfer, ie. involves IRAs only. The new "in plan" transfers from a pre tax 401k to the designated Roth option are called "IRRs" ie. inplan Roth rollovers."
f33780dd1c55b4b75d06be6fe0b0fb1363f0e93faac8fef1c9159c2634499cd4
['584aa6233cdc4cdfb4227d40ace0ed36']
The error tells you everything you need to know about what is going wrong, which is that you cannot call the get() function on a list. In Python, the get() function can only be used with dictionaries, which are different from lists. Instead of using the get() function, call a specific index of the list and your program should work. For example: for sample in list[10:11] which returns the 11th element of the list.
bf8babb1ad4e845f64c97ab7a89ca25df533d4810a0894ddbdf769fc8b49690f
['584aa6233cdc4cdfb4227d40ace0ed36']
I'm trying to train a Tensorflow Convolutional Neural Network on my RaspberryPi 3B. I get the following error: 2018-08-19 18:57:07.720022: F./tensorflow/core/util/bcast.h:111] Check failed: vec.size() == NDIMS (1 vs. 2) Aborted Not sure what's going wrong, but here's the code: import tensorflow as tf import numpy as np import csv import pandas as pd import os image_height = 60 image_width = 1 image1_height = 15 image2_height = 1 model_name = "TensorflowCNN" #Training Data Configuration train_data = np.asarray(pd.read_csv("/media/pi/DISK_IMG/TrainingInput.csv", usecols=[1])) <PERSON> = train_data.tolist() <PERSON> = lis[0:60] <PERSON> = [x[0].strip('[]\n,') for x in lis] <PERSON><PHONE_NUMBER>: F./tensorflow/core/util/bcast.h:111] Check failed: vec.size() == NDIMS (1 vs. 2) Aborted Not sure what's going wrong, but here's the code: import tensorflow as tf import numpy as np import csv import pandas as pd import os image_height = 60 image_width = 1 image1_height = 15 image2_height = 1 model_name = "TensorflowCNN" #Training Data Configuration train_data = np.asarray(pd.read_csv("/media/pi/DISK_IMG/TrainingInput.csv", usecols=[1])) lis = train_data.tolist() lis = lis[0:60] lis = [x[0].strip('[]\n,') for x in lis] nlis = [] for i in lis: nlis.append(i.split()) for i in range(len(nlis)): nlis[i] = [float(x) for x in nlis[i] if x != "...,"] nlis = [np.mean(x) for x in nlis] train_data = np.asarray(nlis) #Training Labels Configuration train_labels = np.asarray(pd.read_csv("/media/pi/DISK_IMG/TrainingInput.csv", usecols=[2])) mylist = train_labels.tolist() mylist = mylist[0:60] mylist = [x[0] for x in mylist] index = 0 while index < len(mylist): if mylist[index] == "GravelTraining": mylist[index] = 1 elif mylist[index] == "WaterTraining": mylist[index] = 2 else: mylist[index] = 3 index=index+1 train_labels = np.asarray(mylist) #Validation Data Configuration eval_data = np.asarray(pd.read_csv("/media/pi/DISK_IMG/TestingInput.csv", usecols=[1])) List = eval_data.tolist() List = List[0:15] eval_data = np.asarray(List) #Validation Labels Configuration eval_labels = np.asarray(pd.read_csv("/media/pi/DISK_IMG/TestingInput.csv", usecols=[2])) myList = eval_labels.tolist() myList = myList[0:15] index = 0 while index < len(myList): if myList[index] == "GravelTesting": myList[index] = 1 elif myList[index] == "WaterTesting": myList[index] = 2 else: myList[index] = 3 index=index+1 eval_labels = np.asarray(myList) category_names = list(map(str, range(3))) #Processing and reshaping data train_data = np.reshape(train_data, (-1, image_height, image_width, 1)) train_labels = np.reshape(train_labels, (-1, image_height, image_width, 1)) eval_data = np.reshape(eval_data, (-1, image1_height, image2_height, 1)) eval_labels = np.reshape(eval_labels, (-1, image1_height, image2_height, 1)) #CLASS FOR THE CONVOLUTIONAL NEURAL NETWORK class ConvNet: def __init__(self, image_height, Image_width, num_classes, chan): self.input_layer = tf.placeholder(dtype = tf.float32, shape = [1,image_height, Image_width, chan], name = "inputs") conv_layer_1 = tf.layers.conv2d(self.input_layer, filters = 32, kernel_size = [5,5], padding = "same", activation = tf.nn.relu) pooling_layer_1 = tf.layers.max_pooling2d(conv_layer_1, pool_size = [2,1], strides = 1) flattened_pooling = tf.layers.flatten(pooling_layer_1) dense_layer = tf.layers.dense(flattened_pooling, 60, activation = tf.nn.relu) dropout = tf.layers.dropout(dense_layer, rate = 0.4, training = True) output_dense_layer = tf.layers.dense(dropout, num_classes) self.choice = tf.argmax(output_dense_layer, axis=1) self.probabilities = tf.nn.softmax(output_dense_layer) self.labels = tf.placeholder(dtype=tf.float32, name="labels") self.accuracy, self.accuracy_op = tf.metrics.accuracy(self.labels, self.choice) one_hot_labels = tf.one_hot(indices=tf.cast(self.labels, dtype=tf.int32), depth=num_classes) self.loss = tf.losses.softmax_cross_entropy(onehot_labels = one_hot_labels, logits=output_dense_layer) optimizer = tf.train.GradientDescentOptimizer(learning_rate=1e-2) self.train_operation = optimizer.minimize(loss=self.loss, global_step=tf.train.get_global_step()) #Training process:variables training_steps = 20000 batch_size = 60 path = "./" + model_name + "-cnn/" load_checkpoint = False tf.reset_default_graph() dataset = tf.data.Dataset.from_tensor_slices((train_data, train_labels)) dataset = dataset.shuffle(buffer_size=train_labels.shape[0]) dataset = dataset.batch(batch_size) dataset = dataset.repeat() dataset_iterator = dataset.make_initializable_iterator() next_element = dataset_iterator.get_next() #Final initialization of Neural Network and Training Process cnn = ConvNet(image_height, image_width, 1, 1) print("milestone1") saver = tf.train.Saver(max_to_keep=2) print('milestone2') if not os.path.exists(path): os.makedirs(path) print('milestone3') #Training Loop For neural network with tf.Session() as sess: sess.run(tf.global_variables_initializer()) print('milestone4') sess.run(tf.local_variables_initializer()) sess.run(dataset_iterator.initializer) for step in range(training_steps): current_batch = sess.run(next_element) batch_inputs = current_batch[0] batch_labels = current_batch[1] print("milestone5") sess.run((cnn.train_operation, cnn.accuracy_op), feed_dict={cnn.input_layer:batch_inputs, cnn.labels:batch_labels}) if step % 1 == 0 and step > 0: current_acc = sess.run(cnn.accuracy) print("Accuracy at step " + str(step) + ":" + str(current_acc)) saver.save(sess, path + model_name, step) print("Saving final checkpoint for training session.") saver.save(sess, path + model_name, step) I know it's long, but I would appreciate it if someone could let me know what's wrong with my program. There is no traceback.I'm getting the notification from Stack Overflow that my post is mostly code, but there's really not much more to say about the problem. Also, I have looked at many questions talking about this and have not found an answer in any of them that I can use. Thanks in advance!
d2467359166686a3794f6da0d1da77add37665708104c698fb65513e7f1be11c
['585a7173a153480b80c6d03a11c59c74']
I am using OpenTok for video chat but default audio and video controls are not appearing, simple publisher and subscriber video appears with no options to turn off video or mute audio. Meanwhile, Audio and video controls are appearing in react web application. <View style={{ flex: 1, flexDirection: 'row' }}> <OTSession apiKey={this.apiKey} sessionId={this.sessionId} token={this.token}> <OTPublisher style={{ width: 100, height: 100 }} /> <OTSubscriber style={{ width: 100, height: 100 }} /> </OTSession> </View> Can anyone please guide if I need to made any configuration changes so audio and video control can appear.
604251ec4ce229b732145b76174b2eb9e68c56b352a5bf2aa2bed4eb36710a70
['585a7173a153480b80c6d03a11c59c74']
I have a file with 3 columns like this Col1 Col2 Col3 A B <- C D -> E F -> I want to swap the entries of the Col1 and Col2 whenever there is <- in the third column. I want my output file to be like Col1 Col2 Col3 B A -> C D -> E F ->
c9a810905055beafe4ebc09302bdd3eac0c5766309be6d3a9d5c95479f0041ae
['5888ae1c02574601bf7f235d835e2c92']
I know this as been answered but wanted to give my CSS example. Because when I was searching for a solution, how to style a input field so it looked like it was disabled, I always ended up with an input field looking like this. With the border- left & top having a darker color etc. So a solved it using this CSS code. input[readonly]{ border-color: darkgrey; border-style: solid; border-width: 1px; background-color: rgb(235, 235, 228); color: rgb(84, 84, 84); padding: 2px 0px; } Made an jsfiddle so you guys can take a closer look. It looks good on Chrome, on other browsers you need to modify the colors abit. Like in Firefox you need too change the color and Background-color to etc. background-color: rgb(240, 240, 240); color: rgb(109, 109, 109);
4c0deec2956c22e9ef64115419989218407b41274d9b5df6fac06acea31ae16f
['5888ae1c02574601bf7f235d835e2c92']
I know this as been answered but wanted to give my CSS example. Because when I was searching for a solution, how to style a input field so it looked like it was disabled, I always ended up with an input field looking like this. With the border- left & top having a darker color etc. So a solved it using this CSS code. input[readonly]{ border-color: darkgrey; border-style: solid; border-width: 1px; background-color: rgb(235, 235, 228); color: rgb(84, 84, 84); padding: 2px 0px; } Made an jsfiddle so you guys can take a closer look. It looks good on Chrome, on other browsers you need to modify the colors abit. Like in Firefox you need too change the color and Background-color to etc. background-color: rgb(240, 240, 240); color: rgb(109, 109, 109);
a467a397dbfcc3d09267f0edaff625183c17d2e851449f14f22746ae528c3851
['588a3924d2a24f22816b97060d824309']
Using Load_File() imports the xml data into a local variable, while ExtractValue() then queries the XML data using XPath. For instance, in the code below, it retrieves a count of students from the xml_content variable: declare xml_content text; declare v_row_count int unsigned; set xml_content = load_file(path); set v_row_count = extractValue(xml_content, concat('count(', node, ')')) path: 'C:\students1.xml', node: '/student_list/student'
b31ce0c065aa92e8c857c38d662e21e955b196164cc1f89cf70c5be3f20c79c2
['588a3924d2a24f22816b97060d824309']
At the command line, type the following command, replacing USERNAME with your username: mysql -u USERNAME -p At the Enter Password prompt, type your password. When you type the correct password, the mysql> prompt appears. To display a list of databases, type the following command at the mysql> prompt: show databases; To access a specific database, type the following command at the mysql> prompt, replacing DBNAME with the database that you want to access: use DBNAME;
0701028a482bb47caa80dee2d0c3722cbec06b9e1d764797f86e8274790b4a3d
['5897e62f5786494892854f4d8782921c']
I would be grateful if anyone could tell me how to create pivot table in R like python pandas with selected aggregation function and more then one level in column. I would like to receive in R something like this in python: Iris.pivot_table(index='Sepal.Length',columns=['Sepal.Width','Species'],values='Petal.Length',aggfunc=sum) I know there is pivotabler package, but default rendering to html method is to slow for a bit larger tables. I also have found ftable function from stats package but its only for contingency tables, in which I can`t specify my own aggregation function. Thank you.
27fc549c8d9ec38f14769700867a49cd22af011ecea40ba7422e178f451841a2
['5897e62f5786494892854f4d8782921c']
Could anyone please help me to find a way to exporting oracle dump file to NAS server, I know how to export to the same server where oracle is working but not how to deal with exporting to remote NAS linux server. Code for exporting schema from db. DECLARE handle NUMBER; status VARCHAR2(20); BEGIN handle := dbms_datapump.open ('EXPORT', 'SCHEMA'); dbms_datapump.add_file (handle, 'hr.dmp', 'BACK_UP'); dbms_datapump.metadata_filter (handle, 'SCHEMA_EXPR', 'IN (''HR'')'); dbms_datapump.set_parameter(handle, 'INCLUDE_METADATA', 1); dbms_datapump.set_parameter(handle, 'DATA_ACCESS_METHOD', 'AUTOMATIC'); dbms_datapump.set_parameter(handle, 'ESTIMATE', 'BLOCKS'); dbms_datapump.start_job (handle); dbms_datapump.wait_for_job (handle, status); END;
20be1d8d0ee889466ef77157c07d70470ef23c54a0e17c48abca0a9b0c1e4c65
['589e1e1d8e704c2b94d8d34d17a0e301']
Complementing the answer of <PERSON>, I personally would add the parameter as a Java8 Optional type to make it explicit in the signature of the method the semantics that is an optional filter. @Query("select foo from Foo foo where foo.bar = :bar and " + "(:goo is null or foo.goo = :goo)") public List<Foo> findByBarAndOptionalGoo( @Param("bar") Bar bar, @Param("goo") Optional<Goo> goo);
42e4d892a462913fffbdf735683ad80943be0dfb9a39b2a1d6af0b902e49438f
['589e1e1d8e704c2b94d8d34d17a0e301']
This is a common problem of conflicting gradle dependencies with different versions, a common way to solve is to exclude the conflicting version of a project and forcing your own version. compile(project(':react-native-device-info')) { exclude group: 'com.google.android.gms' // <-- exclude offending dependency } compile ("com.google.android.gms:play-services-gcm:11.8.0") { force = true // <-- force my desired version } more on this link
c59c492b3cc0f92acbe7ff7286a9f97c9d68d068e13b2ed25aa05400a6ea823d
['58a1f5863dc84a06a3c6a8f199365332']
This post is a bit older but I want to add the following: If you want to understand how the different content elements are wrapped, you may have a look into the css_styled_content extension. I assume that you have included the "Static Template (from extension)" in your main Typoscript template. You can find the setup.txt here: typo3/sysext/css_styled_content/static/setup.txt There you´ll find the line <PERSON> mentioned in line 860 (TYPO3 version 6.1), for example. And of course a lot of other definitions, too. But check to read the documentation and tutorials on typo3.org. HTH merzilla
557faa5286c072755a751a060df0b3450a9112fe33456abeec9edacd8b90d6be
['58a1f5863dc84a06a3c6a8f199365332']
As you can see in www/vendor/typo3/cms/typo3/sysext/css_styled_content/Configuration/TypoScript/setup.txt the file StylesContent.txt from folder "Helper" is not included automatically anymore. So I guess you must include <INCLUDE_TYPOSCRIPT: source="FILE:EXT:css_styled_content/Configuration/TypoScript/Helper/StylesContent.txt"> where getLeft, getRight and getBorder is definded. Alternatively you can just add this one line after ASSIDE < styles.content.getRight ASSIDE.select.where = {#colPos}=2 or as I know it from that templating time ASSIDE.select.where = colPos=2 Well, but as <PERSON> already recommended you should anyways switch to FLUIDTEMPLATE but getting the column not directly depends on that. I also just want to make you know that FLUID is the right thing.
160d39a186a271941d2958baace916492d06ea45bd8f649b75f9ae385b1a9d88
['58a870305ad64f18a7d48fc40b14c896']
After installing multiple tools such as Hardinfo and Usbview investigating to no avail, I resorted to opening up my chassis and check the motherboard. It seems the USB 3.0 ports are broken(since they won't even power up a USB fan) leaving only the eSATA USB active. A motherboard replacement seems to be most likely if I'm planning to keep this machine going.
75ccceb03a76da15662fff9d4dc5dd936b033f390083e7ee54673f0eda4165a7
['58a870305ad64f18a7d48fc40b14c896']
Recently the issue has occurred where launching Foxit Reader does not open an active window on the desktop. Launching it from its .desktop file shows the icon appearing on the Unity bar with an orange dot (I assume indicating the application is running), but clicking on it does not bring up it's window. The Foxit Reader tab also appears on the top panel. Right-clicking the icon in the Unity bar and selecting All Windows does indeed show what I should be seeing on the desktop, but even selecting that does not bring it up. I don't know if there is any way too fix this or perhaps install it's .run file as root? Tried uninstalling it and rebooting followed by a reinstall but nothing seems to work.
f4097e1f6d5021a4e234b53c394129097a3ab589ded036935e9e6c64d14d97c5
['58b04746a743418f99b8b3e30dd92237']
I just noticed two other questions closely related, so this one might be a duplicate. They are [How do I know a software does what the author claims ?](https://security.stackexchange.com/questions/30410/how-do-i-know-a-piece-of-software-only-does-what-the-author-claims) and [How to decide “I'll trust this software” for closed-source or precompiled software?](https://security.stackexchange.com/questions/87395/how-to-decide-ill-trust-this-software-for-closed-source-or-precompiled-softwa), however, neither provides specific resources that can be checked to ensure editor's legitimacy.
a4720fdb2df125b90ffafcf0247128e7af60656537d0c5379992548592998ee9
['58b04746a743418f99b8b3e30dd92237']
I wished to comment, but it is my first post, so I had to sumbit an answer. (not enogh reputation points) 1. Actually I checked in http://tools.glowingmines.eu/ and it seems capital letters DO matter in UUID generation. 2. We still do not know why adding to whitelist on offline servers changes letters case. It seems that is not changed randomly.
015166c4d4c049517eaeeac2fb86c9cba59cb53b013736ee711c5ca0cb074b21
['58b1b5049f32415ea0ecd9720317bcda']
You running builtin server right ? Then you can make a simple plugin : from bottle import request, response, route, install, run from datetime import datetime def logger(func): def wrapper(*args, **kwargs): log = open('log.txt', 'a') log.write('%s %s %s %s %s \n' % (request.remote_addr, datetime.now().strftime('%H:%M'), request.method, request.url, response.status)) log.close() req = func(*args, **kwargs) return req return wrapper install(logger) @route('/') def index(): return 'Hello, World' run(quiet=True) Or try this one
17975efca22c44295545fdecea6b8751b5496ee1b2019feaef618f32dff87fe2
['58b1b5049f32415ea0ecd9720317bcda']
You trying to serve your css file from /name/ directory. But there's nothing to serve. Solution : 1.Name your route wich serving css file @route('<filename:re:.*\.css>', name='static') 2.Render your template with get_url function %rebase('base.tpl',something=something, get_url=bottle.Bottle().get_url) 3.Call it in your template <link href="{{ get_url(routename='static', filename='bootstrap.min.css') }}" rel="stylesheet" type="text/css">
9a345c7277347e1dd8901c3be135187b1f2f4b9131af2f8c974473d79222e50f
['58c99add0d3a4fe1861a8ecca37ba5db']
i am using the Media class to record from device mic, is sucessful recorded but i can't find the audio file(myrecording.amr) on my android device. function recordAudio() { var src = "myrecording.amr"; var mediaRec = new Media(src, onSuccess, onError); // Record audio mediaRec.startRecord(); // Stop recording after 10 sec var recTime = 0; var recInterval = setInterval(function() { recTime = recTime + 1; setAudioPosition(recTime + " sec"); if (recTime >= 10) { clearInterval(recInterval); mediaRec.stopRecord(); } }, 1000); } function onDeviceReady() { app.enabled("btnRecord", true);//IDE widget } // onSuccess Callback // function onSuccess() { app.alert("recordAudio():Audio Success");//IDE widget //app.setValue("labelmobile1", mediaRec.); IDE widget } // onError Callback // function onError(error) { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } // Set audio position // function setAudioPosition(position) { app.setValue("label1", position);//IDE widget } Where i can find it?
e679444de0dec241263866a4fbc6a0ef8319b11a0b3e2a324706162d23515182
['58c99add0d3a4fe1861a8ecca37ba5db']
If you are using some module to implement bootbox, 'cos $bootbox must injected If not then, you can simple use without $: OrderService.get(function(response) { $scope.newOrder = response; }, function(error) { bootbox.alert(error.statusText); }); from bootboxjs page: Once you’ve got your dependencies sorted, usage is fairly straightforward and much like any other JavaScript library you’ve ever used. The library creates a single global instance of a bootbox object
c797a28f2aa2f8f3b775a94929de0829762b82b1c682baf7ec02350a27624c84
['58cc0c55db3643909d6916246691d7a4']
Thank you guys and sorry, i'm new to this. I just got about 450 rep... you have about 290k ._. so sorry for this "dumb" question. Now i'm a bit smarter and i'll reduce my answers to the absolutly essential! I love stackoverflow and the only thing i want is: Help other users and get help from users who have more experience! =)
b209dfa96ee8a3f5c880187e166c4adef3ea7924773f698adbe3c88c34fb939a
['58cc0c55db3643909d6916246691d7a4']
i solved this one by myself by editing the mobiscroll.js There are two classes: dww (which is the container high) dwwwol (which is the position of the lines which show what you selected) Just replace the two classes with variables and set the width you want at the top of your .js. Do not use % for dww, this will not work.
26e3e230edcd156b18a2318aa18b878d10fc6ec11eabef2506243250082656b9
['58d142272b0b4715a32c88bd672ae76a']
You didn't read the question or I failed at explaining, having to call UVList.ToArray() creates GC because when the list is applied to mesh.uv, it creates a copy of the array and the UVList.ToArray() then has no pointer and goes to GC. This happens because Unity when moving the list onto GPU creates copy rather than keeping a pointer.
436e031fbd14c97ffc8c8f32f90c65439df11a793d9cbd087e38ae2dd426a1f9
['58d142272b0b4715a32c88bd672ae76a']
Aside from vocabulary, an analysis of the quote evokes a number of literary conventions, which find their source in traditional Japanese culture. This seems to be a standard manga or dorama style declaration of the speaker's feelings for another person お慕い申しております (the sentiment) and 気持ちをお伝えしたくて (the confirmation of the speaker's desire to convey said sentiment) Request -- if the other person would agree もしよかったら -- for "the person's hand in marriage", since official documents are traditionally exchanged, as in a contract or, at least, here, a formal vow, an "eternal promise", i.e. 永遠の契り (which in a different context may connote a more spiritual, even religious commitment). This declaration/request/"confession" (depending on context) is followed by another standard leitmotif found in manga/dorama, whereby the declaration itself is considered (by the possibly embarrassed speaker -- and perhaps in light of social norms) as an impulsive, or even premature, unexpected revelation of the speaker's private sentiments, even a betrayal of the speaker's own sense of dignity. [Abrupt interruption of declaration/request] あぁー 私 (わたくし)ったら、もう何を言ってるんでしょうか?
2ad63291202f67d8d24dc4e79419fc3a2f15846b8ba986f14d25e6858c3b3889
['58d6a51e4155482ab0d1505d6dc5b8e0']
I have table with 3 columns: lat,lon,day (376 days). The process is: create the map -> save the map as HTML -> save the map as PNG -> import the pic -> plot it (with plot + ggimage) All this process, will be in a loop library(leaflet) library(animation) library(png) library(htmlwidgets) library(webshot) library(ggmap) saveGIF({ for (i in 1:376) { map = leaflet() %>% addTiles() %>% setView(lng = lon_lat[1,2], lat = lon_lat[1,1], zoom = 5)%>% addMarkers(lng = lon_lat[lon_lat$day == i,2],lat = lon_lat[lon_lat$day == i,1]) saveWidget(map, 'temp.html', selfcontained = FALSE) ## save the html webshot('temp.html', file=sprintf('Rplot%02d.png', 1),cliprect = 'viewport') ## save as png img = readPNG("Rplot01.png") ### read the png plot(ggimage(img)) ###reading png file } })
32e53fbb94f73af7503277c0303dcf8a6c9871f352f75b4433144e2c2537a861
['58d6a51e4155482ab0d1505d6dc5b8e0']
I have list of hundreds of email subject lines. For each of the subject line, I have the email open rate (opened email/delivered email) value. For example: list of subject lines I want to understand if there is influence for some words on the average open rate. For example, maybe if I’ll write in the email subject line the word “Thanks”, the email open rate will be higher. If I understand correctly the logical steps, I need to build list of all the words that are in the emails subject line, and for each word to do average between all the subject lines. For example: average per word Can someone help me to do it with R? I think there is text mining packages that can help. Thanks!!!
c04efa10eff0eec6cd9464c65a4981554b5f26930d4fac844307662bd05cfe44
['58dc0ee6cf7643c797f313fe7bc828c2']
import tkinter as tk import smtplib from word_length import find_word_length class Email_app(tk.Frame): def __init__(self, master = None): tk.Frame.__init__(self, master) self.create_widget() def create_widget(self): self.myLabel = tk.Label(root, text = "Email app", width = 50).grid() self.myUsername = tk.Label(root, text = "Username").place(x = 10, y = 30, width = 70, height = 20) self.myUserEntry = tk.Entry(root) self.myUserEntry.place(x = 90, y = 30, width = 200, height = 20) self.myPassword = tk.Label(root, text = "Password").place(x = 10, y = 60, width = 70, height = 20) self.myPasswordEntry = tk.Entry(root) self.myPasswordEntry.place(x = 90, y = 60, width = 200, height = 20) self.To = tk.Label(root, text = "Destination").place( x = 10, y = 90, width = 70, height = 20) self.To_entry = tk.Entry(root) self.To_entry.place(x = 90, y = 90, width = 200, height = 20) #from here is about the entry box self.myEntry = tk.Text(root) self.myEntry.bind('<Key>',lambda x: self.callback()) self.myEntry.place(x = 10, y = 120, width = 430, height = 460) self.strVal = tk.StringVar() self.strVal.set("Word: 0 word") self.Textlength = tk.Label(root, textvariable = self.strVal, width = 70) self.Textlength.place(x = 320, y = 50, width = 120, height = 30) self.myBtn = tk.Button(root,text = "Submit email", command = self.on_release) self.myBtn.place(x = 350, y = 600) def on_release(self): Username = self.myUserEntry.get() Password = self.myPasswordEntry.get() Destination = self.To_entry.get() text = self.myEntry.get('1.0',tk.END) self.myEntry.delete('1.0', tk.END) self.strVal.set("Word: 0 word") try: server = smtplib.SMTP('smtp.gmail.com', 587) server.ehlo() server.starttls() server.login(Username,Password) server.sendmail(Username,Destination,text) except: print('Something went wrong') def callback(self): length = find_word_length(self.myEntry.get('1.0',tk.END)) if length == 1 or length == 0: self.strVal.set(f"Word: {length} word") elif length > 1: self.strVal.set(f"Word: {length} words") root = tk.Tk() root.geometry("450x650") root.resizable(width=False, height=False) Email_app_main = Email_app(root) Email_app_main.mainloop() I am creating a simple email app where users can use smtplib module to log in and then send an email. I implemented a callback function that constantly check the user how many words the user has entered in the text entry box, then I update it in the self.Textlength label. Everything works fine but I notice the label doesn't update on the same callback event, I need to trigger the callback event again to update the label text. Is there a way to update the label instantly on the same callback event and not wait for another?
afe348f4e77e2de7c09769f4cef38a005edaafac6af370007c068a849a5e7291
['58dc0ee6cf7643c797f313fe7bc828c2']
I am just beginning to learn the sklearn module and faced my first roadblocks. First I created a number recognition logistic regression model and it seem to work fine. But then I decided to test a random image myself, so I used OpenCV module to opened a picture that I randomly select from online (Shown below). The shape of the image is (425,425,3). I turned them into grayScale and threshold it. Then I try to predict it using the model I just created. But I got a "ValueError: Found array with dim 3. Estimator expected <= 2." I tried to use resize, reshape function to my image to match the array size but never seem to work, anyone can help me to solve the problem? import cv2 import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn.linear_model import LogisticRegression test_case = cv2.imread('unnamed.jpg') test_case = cv2.cvtColor(test_case, cv2.COLOR_BGR2GRAY) ret, test_case = cv2.threshold(test_case, 200, 255, cv2.THRESH_BINARY) digits = load_digits() x_train, x_test, y_train, y_test = train_test_split(digits.data, digits.target, test_size = 0.23, random_state = 2) #test_case = test_case.reshape(test_case.shape[0], -1) train = LogisticRegression(dual = False, max_iter = 1000000) train.fit(x_train, y_train) nbr = train.predict(np.array([test_case], 'float64'))