_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d6301
train
Can you check you are building your projects workspace? You'll need to build the workspace in orde to get Cocoapods to work, not the Xcode project.
unknown
d6302
train
Alternatively you can "hack" the code of Disqus. I'll try to explain what I did step-by-step: * *Get the newest file of the main disqus function. It should be something similar to this: http://disqus.com/forums/(your-site-id)/count.js *Copy that script somewhere, you can "beautify it" to make it more readable. Than find and change the displayCount function to whatever you want to like this: c.displayCount = function (a) { for (var b, c, e, g, f = 0; f < a.counts.length; f++) if (b = a.counts[f], c = h[b.uid]) e = b.comments === 0 ? "0 drivels" : b.comments == 1 ? "1 drivel" : "{num} drivels", g = e.replace("{num}", b.comments), a.showReactions && (e = b.reactions === 0 ? a.text.reactions.zero : b.reactions == 1 ? a.text.reactions.one : a.text.reactions.multiple, e !== "" && (g += " " + a.text.and + " " + e.replace("{num}", b.reactions))), c.element.innerHTML = g }; (note the drivels ;) *Save (upload) the whole file somewhere on your server and remember the path *Use Wordpress administration to edit the Disqus plugin - file disqus-comment-system/disqus.php and find line that contains concatenated url withthe word count.js. It is in about 3/4 of the file. As of now the line looks like this but it might change in the future: s.src = '//' + '<?php echo DISQUS_DOMAIN; ?>/forums/' + disqus_shortname + '/count.js'; *Make this link point to your newly-uploaded file like this (I used relative URL): s.src = '/wp-include/custom/disqus-count.js'; *Save it and profit! It took me more than an hour to figure this out so I hope this actually helps someone (I needed to translate these messages into my native language). A great benefit of this approach is the fact that if your language uses different word forms for different numbers (other than 0, 1 and more), you can script it in. A: You should be able to hide it via JavaScript. Something along these lines: node = document.getElementsByClassName("dsq-comment-count")[0].childNodes[0] node.nodeValue = node.nodeValue.replace("Comments", "") A: The official answer is here: http://help.disqus.com/customer/portal/articles/565624#customizing-link-text * *Go to http://YOUR-SITE.disqus.com/admin/settings/?p=general *Edit Comment Count Link section as you need. *That's all!
unknown
d6303
train
typedef enum { .... FLAGS_RESET_A = (FLAGS_B | FLAGS_C | FLAGS_D) } flags_t flag_t flags &= (FLAGS_RESET_A); // Reset A This workaround is cumbersome. Any time I modify the flags type, such as adding a flag, I also have to remember to modify all the reset masks. I'm hoping there is a method that preserves the enum as a "single source of truth" for the flag definitions. Another workaround is type casting to an unsigned integer, but that defeats the safety of using an enumerated type.
unknown
d6304
train
Solution: Use p:ajax instead f:ajax <p:ajax event="dateSelect" listener="{pacienteControlador.citasDisponibles()}" update="hora" />
unknown
d6305
train
There seem to be few solutions to handle key shortcuts. One of them could be installing keyboard hooks as suggested here. You can also try to handle this by adding custom message filter, as suggested here, however, I haven't verified the code posted there. The solution with hooks seems to be a little tricky, so You may want to try custom message filter first. A: As per my comments to Lukasz M above, I needed to maintain the current menu structure for legacy reasons, namely that all of the engineers are accustomed to changing the Menu, and they want the menu shortcuts to automatically work. I could probably modify the central hotkey location using that custom message filter to generate Shortcut text for the Menu items, but that would add additional complexity that's likely to be undone the next time someone steps in to add a quick menu item. Thus, I went with the solution I alluded to in the comments with an invisible menu for the child windows. Much to my surprise, if a menu has its Visible property set to false, the hotkeys work just fine. And the events associated with menu items in the main form work perfectly fine if invoked from a child form, as they're executed relative to the window where they are defined rather than by the window where they're invoked. Thus, my first solution was to fetch the MenuStrip from the main form and add it to the child form. That didn't work, as turning it invisible in the child form made it invisible in the main form as well. My next attempt involved creating a new hidden MenuStrip and adding the ToolStripMenuItem items from the main form's MenuStrip onto it. That broke the hotkey capability, possibly since the menu items now existed in more than one place. Finally, I created shallow copies of the menu items that contained only the shortcut key, the Tag property (necessary for a few menu items that made use of it), and the Event Handler (the last being done through the method described in How to clone Control event handlers at run time?). After a bit of fiddling, I came to realize that I didn't need to maintain the structure of the menus and I only needed the items with shortcuts. This is what I wound up with: Main Form: /// <summary> /// Returns copies of all menu shortcut items in the main form. /// </summary> /// <returns>A list containing copies of all of the menu items with a keyboard shortcut.</returns> public static List<ToolStripMenuItem> GetMenuShortcutClones() { List<ToolStripMenuItem> shortcutItems = new List<ToolStripMenuItem>(); Stack<ToolStripMenuItem> itemsToBeParsed = new Stack<ToolStripMenuItem>(); foreach (ToolStripItem menuItem in mainForm.menuStrip.Items) { if (menuItem is ToolStripMenuItem) { itemsToBeParsed.Push((ToolStripMenuItem)menuItem); } } while (itemsToBeParsed.Count > 0) { ToolStripMenuItem menuItem = itemsToBeParsed.Pop(); foreach (ToolStripItem childItem in menuItem.DropDownItems) { if (childItem is ToolStripMenuItem) { itemsToBeParsed.Push((ToolStripMenuItem)childItem); } } if (menuItem.ShortcutKeys != Keys.None) { shortcutItems.Add(CloneMenuItem(menuItem)); } } return shortcutItems; } /// <summary> /// Returns an effective shortcut clone of a ToolStripMenuItem. It does not copy the name /// or text, but it does copy the shortcut and the events associated with the menu item. /// </summary> /// <param name="menuItem">The MenuItem to be cloned</param> /// <returns>The newly generated clone.</returns> private static ToolStripMenuItem CloneMenuItem(ToolStripMenuItem menuItem) { ToolStripMenuItem copy = new ToolStripMenuItem(); copy.ShortcutKeys = menuItem.ShortcutKeys; copy.Tag = menuItem.Tag; var eventsField = typeof(Component).GetField("events", BindingFlags.NonPublic | BindingFlags.Instance); var eventHandlerList = eventsField.GetValue(menuItem); eventsField.SetValue(copy, eventHandlerList); return copy; } Child Form: private void OnRefresh(object sender, EventArgs e) { // Refresh the hiddenShortcutMenu. List<ToolStripMenuItem> shortcutList = MainForm.GetMenuShortcutClones(); hiddenShortcutMenu.Items.Clear(); hiddenShortcutMenu.Items.AddRange(shortcutList.ToArray()); } Inside the child form's constructor, I instantiated the hiddenShortcutMenu, set Visible to false, assigned it to my child form's control, and set the event. The last was a bit fiddly in that I had to have it periodically refresh since the menus sometimes changed according to context. Currently, I have it set to the Paint event for maximum paranoia, but I think I'm going to try to find a way for the main form to signal that it's changed the menu structure.
unknown
d6306
train
Changes aren't reflected immediately. In most cases, changes should be reflected within a day or two of the PWA being launched, after the manifest has been updated. When the PWA is launched, Chrome determines the last time the local manifest was checked for changes. If the manifest hasn't been checked in the last 24 hours, Chrome will schedule a network request for the manifest, then compare it against the local copy. If select properties in the manifest have changed, Chrome queues the new manifest, and after all windows of the PWA have been closed, the device is plugged in, and connected to WiFi, Chrome requests an updated WebAPK from the server. Once updated, all fields from the new manifest are used. Full details are at https://web.dev/manifest-updates/
unknown
d6307
train
It has no constructor because it's just a wrapper class around an unmanaged object. Reference: http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.aspx HtmlDocument provides a managed wrapper around Internet Explorer's document object, also known as the HTML Document Object Model (DOM). You obtain an instance of HtmlDocument through the Document property of the WebBrowser control. Depending on what you want it for, you may want to look at SGMLReader or the up-to-date community version. A: Robust Programming? When using the DOM through the WebBrowser control, you should always wait until the DocumentCompleted event occurs before attempting to access the Document property of the WebBrowser control. The DocumentCompleted event is raised after the entire document has loaded; if you use the DOM before then, you risk causing a run-time exception in your application. http://msdn.microsoft.com/en-us/library/ms171712.aspx
unknown
d6308
train
Don't get too bogged down by the "rules" in the Ruby community. The idea is that you shouldn't go overboard when nesting URLs, but when they're appropriate they're built into the Rails framework for a reason: use them. If a resource always falls within another resource, nest it. Nothing wrong with that. Going deeper than one can sometimes be a bit of a pain because your route paths will be very long and can get a bit confusing. Also, don't confuse nesting with namespacing. Just because you see example.com/admin/products/1234/edit does not mean that there's any nesting happening. Routing can make things look nested when they're actually not at the code level. I'm personally a big fan of nesting and use it often (just one level -- occasionally two) in my applications. Also, adding permalink style URLs that use words rather than just IDs are more visually appealing and they can help with SEO, whether or not they're nested. A: I believe the argument for or against REST and/or nesting in your routes has much to do with how you want to expose your API. If you do not care to ever expose an API for your app publicly, there is an argument to be made that strict adherence to RESTful design is a waste of time, particularly if you disagree with the reasoning behind REST. Your choice. I find that thinking about how a client (other than a browser) might access information from you app helps in the design process. One of the greatest advantages of thinking about your app's design from an API perspective is that you tend to eliminate unnecessary complexity. To me this is the root of the cautions you hear in the Rails community surrounding nested routes. I would take it as an indication that things are getting a bit complicated and it might be time to step back and rethink the approach. Systems "larger than a blog" do not have to be inherently complex. Some parts might be but you also may be surprised when you approach the design from a different perspective. In short, consider some of the dogma you might hear from certain parts of the community as guides and signals that you may want to think more deeply about your design. Strict REST is simply another way to think about how you are structuring your application.
unknown
d6309
train
Change name to id in ajax, $('#seldrp').onchange(function(){ ^ ^ // ajax here }); And you have syntax errors in ajax. var themonth = $('#seldrp').val(); var topdevotee = $('#topdevotees').val();//topdevotess should be the id of 2nd select box. $.ajax({ type: 'post', data: { topdevotees: topdevotees, themonth: themonth }, async:false,// this line for waiting for the ajax response. url: "topuser_load.php?topdevotees=" + topdevotees + "&themonth=" + themonth, success: function (response) { $('themonth').append(response); $('#frmtopdevotees').submit(); } }); A: From your code what I can understand is you want to trigger a server call without refreshing the page (AJAX) whenever your any one the select option changes. There are errors in the code posted. Following is my observation - * *There can be only one ID in entire page. You have used 'seldrp' in couple of places. *If you want the AJAX functionality, you should avoid calling submit() function of the form. *The AJAX syntax is wrong which should be as follows - $.ajax({ url : "topuser_load.php?topdevotees=" + topdevotees + "&themonth=" + themonth, method: "post", data: { topdevotees: topdevotees, themonth: themonth }, // can even put this in variable and JSON stringify it success: function (response) { $('themonth').append(response); } }); Now coming to the solution part of it: I would do this as follows - 1. Will just listen on the select change in JQUERY 2. Once a select change is triggered, AJAX call is made and which returns the response. The modified code is - <script> $('select').on('change', function (e) { var month = $('#seldrp1').val(); var topdevotee = $('#seldrp2').val(); // call ajax here - $.ajax({ url: "topuser_load.php?topdevotees=" + topdevotee + "&themonth=" + month, method: "post", data : JSON.stringify({ topdevotees: topdevotee, themonth: month }), success : function(response){ $('themonth').append(response); }, error : function(err){ // handle error here } }); }); </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> echo "<form name='frmtopdevotees'> <h4>select month <select id='seldrp1' name='themonth'> $optionsmonths </select> <select name='topdevotees' id='seldrp2'> <option value=10 $M10>Top 10</option> <option value=20 $M20>Top 20</option> <option value=50 $M50>Top 50</option> <option value=100 $M100>Top 100</option> </select> </h4> </form>"; ?>
unknown
d6310
train
There is no "Telegram IV bot" available in API or something like that. Instead you should got InstantView documentation and create a template yourself. Unfortunately, there is currently no way to add "native" support for IV on your site, after you make a template, you can extract an rhash parameter while using "Check in Telegram" feature in IV editor. After you finish your template, using links "https://t.me/iv?url=YOUR_URL&rhash=YOUR_RHASH" will show people an Instant View article from YOUR_URL.
unknown
d6311
train
As per the Mailboxer readme, I saw this as the recommended way: current_user.mailbox.inbox({:read => false}).count I think that should update every time you refresh
unknown
d6312
train
You are trying to find a view before you set the content view when you do findViewById(R.layout.secondlayout). Also, secondlayout isn't the id of a view, it's the name and id of the layout file. Try doing LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.main, null); LinearLayout tv = (LinearLayout) inflater.inflate(R.layout.secondlayout, null); tv.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); ll.addView(tv); setContentView(ll);
unknown
d6313
train
If you look closely this is not the same path: tmp/trx//images/background/background_iphone5.png tmp/trx//images/background_iphone5.png --> tmp/trx//images/background/background_iphone5.png tmp/trx//images/background_iphone5.png This is the result output of find which finds 2 files with the same name in different subdirectories of /tmp. Just FYI, if you want to control how deep find can descend into subdirs, there's an option for that: -maxdepth levels Descend at most levels (a non-negative integer) levels of directories below the command line arguments. -maxdepth 0 means only apply the tests and actions to the command line arguments. Or if you want just a single result you can use -quit Exit immediately. No child processes will be left running, but no more paths specified on the command line will be processed. For example, find /tmp/foo /tmp/bar -print -quit will print only /tmp/foo.
unknown
d6314
train
It was happening because I wasn't running my terminal in root.. I changed to root user and run the command and everything worked
unknown
d6315
train
Inside each iteration of the setInterval()ed function, you assign a .load() event to an image place holder. Assigning an event to an object does not remove existing ones! So on second iteration, the image place holder will have two .load() event handlers, then three and so on; and every time the image is loaded, it will fire all event handlers attached to .load() event. You probably need to re-factor your code, perhaps by assigning the .load() event handler only once (and use semicolons). A: you shouldn't use setInterval, you should use a setTimeout inside a function, and execute it on the callback of the $.post, something like: var id_atual var temp_id var tempo_flash = 50 var $slide_atual = $('#slider .atual') var $slide_prox = $('#slider .ocultar') function tictac(){ setTimeout(function(){ id_atual = $slide_atual.attr('alt') $.post('get_banner.php', {atual: id_atual}, function(proximo){ temp_id = proximo.split(';;') $slide_prox.attr('src', temp_id[0]).load(function(){ $slide_atual.hide('fade', tempo_flash, function(){ $slide_atual.attr('alt', temp_id[1]).attr('src', temp_id[0]).load(function(){ $slide_atual.show('fade', tempo_flash) }) }) }) }) ticktac(); }, 4000); } this way, the 4 seconds only start counting if and when the response from the server is complete, you will not have your overflow problems
unknown
d6316
train
I think you need something like this to insert the data. We have insertRow(), which is pre-defined function which i used in this answer to insert new row and then inserted columns in it with insertCell function. <!DOCTYPE html> <html> <body> <div class="inputs"> <input type="text" id="input1" placeholder="Enter first col data" > <input type="text" id="input2" placeholder="Enter second col data" > </div> <br> <br> <br> <table id="myTable"> <thead style="background-color: beige;"> <tr> <td>default head row cell 1</td> <td>default head row cell 2</td> </tr> </thead> <tbody></tbody> </table> <br> <button type="button" onclick="myFunction()">add data to body row</button> <script> function myFunction() { var table = document.querySelector("#myTable tbody"); var row = table.insertRow(); var cell1 = row.insertCell(0); var cell2 = row.insertCell(1); const val1 = document.getElementById('input1').value; const val2 = document.getElementById('input2').value; cell1.innerHTML = val1; cell2.innerHTML = val2; } </script> </body> </html> A: I think that you need to refer to your button in the js file and write a function that will be executed on the "onclick" event In this function, you are accessing the table variable. By using the built in javaScript function «insertRow()» you are adding rows to your table. Then you should add cells to this row in which information that users entered will be stored. This you can also do by using build in function «insertCell()» Next, you access the fields in which the user has entered data Retrieve values ​​using the «value» built-in function Using the built-in «innerHTML» function, draw cells with the information that you received in the previous step You can look at the written code below for better assimilation of information <!DOCTYPE html> <html> <body> <div class="inputs" > <input type="text" id="firstColumn" placeholder="Enter data here" > <input type="text" id="SecondColumn" placeholder="Enter data here" > </div> <table id="Table"> <thead> <tr> <td style="background-color: pink;">Name of first column</td> <hr> <td style="background-color: purple;">Name of second column</td> </tr> </thead> <tbody></tbody> </table> <br> <button style="background-color: yellow;" type="button" id = "btn">Add</button> <script> const button = document.querySelector('#btn'); btn.onclick = function() { var table = document.querySelector("#Table tbody"); var row = table.insertRow(); var Fcell = row.insertCell(0); var Scell = row.insertCell(1); const Fdata = document.getElementById('firstColumn').value; const Sdata = document.getElementById('SecondColumn').value; Fcell.innerHTML = Fdata; Scell.innerHTML = Sdata; } </script> </body> </html>
unknown
d6317
train
I would suggest that your condition use the fact that ans.isdigit() is only True if ans consists solely of digits. def reading_ans(): while True: ans = input('Enter date: ') if len(ans) == 4 and ans.isdigit(): return ans print("Please give a four digit integer for date.")
unknown
d6318
train
There doesn't appear to be any Groovy specific information. Since Groovy uses the JVM and can call java librarys with out any problem take a look at the YOutube Java developers guide Everything in it should apply to Groovy/Grails. A: ... so I had a chance to look over the api in greater detail and I still don't see a way to make private videos publicly viewable without 'unprivating' them. Am I missing something? At this point I'm just trying to document that what I'm getting asked to do can't or at least should not be done.
unknown
d6319
train
Ok, so it seems that if we will check the code of after this line of code: set(fill_1,'FaceAlpha',0.5); a=get(gca,'SortMethod') We will get a=childorder, that means that the appearance of every object is by the child order of gca of the figure (And this is by the way is the default) After the line of code of ZData, that order is changed by Matlab, its changing to depth, so if you will re-use the function : a=get(gca,'SortMethod') a=depth now. So if you want to fix the problem just use this code: set(gca,'SortMethod','childorder') And - We have a winner! :)
unknown
d6320
train
Try this:- router.get('/signup',function(req,res){ res.send("Any data"); });
unknown
d6321
train
Ok it's due to the fact there is a gab between your picture at right... But the fixed height doesn't mention it... There are many ways to correct this... First : https://jsfiddle.net/y0x7kpza/ Add an overflow:hidden to the first .row Second: https://jsfiddle.net/d0a52xwk/ Reaffect the height of the two div on the right in taking care of the margin-top of these elements. .h-50-bis{ height:calc(50% - 0.125rem); }
unknown
d6322
train
If you can create a feature that contains all your custom content types, you will be able to change the XML that defines each content type and it's columns. This will give you the ability to change the content types for your site by removing the feature and installing it again with the changes (using a Solution is best). Note that any content using the older content types will still use them after updating the feature (content types are stored at the site level, list level and on the actual item).
unknown
d6323
train
You need to import user before you can use it. <% import somePackage.User %>
unknown
d6324
train
Like you can't really avoid a deletion operation in the database if you want to delete anything. If you're having performance issue I would just recommend to make sure you have an index built on the id field otherwise Mongo will use a COLLSCAN to satisfy the query which means it will over iterate the entire colLOne collection which is I guess where you feel the pain. Once you make sure an index is built there is no "more" efficient way than using deleteMany. db.collOne.deleteMany({id: {$in: [4, 8, 9, .... ]}) * *In case you don't have an index and wonder how to build one, you should use createIndex like so: (Prior to version 4.2 building an index lock the entire database, in large scale this could take up to several hours if not more, to avoid this use the background option) db.collOne.createIndex({id: 1}) ---- EDIT ---- In Mongo shell: Mongo shell is javascript based, so you just have to to execute the same logic with js syntax, here's how I would do it: let toDelete = db.collTwo.findOne({ ... }) db.collOne.deleteMany({id: {$in: toDelete.ids}})
unknown
d6325
train
12mb should save a bit faster that, if you are using the methods from the other SO question, try increasing the buffer size in copyFile like so, private void copyFile(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[8192]; // 1024 is kind small,..try 8192 or 4096!! int read; while((read = in.read(buffer)) != -1){ out.write(buffer, 0, read); } } A: I've had very good, consistent results with creating a zip file, putting it in raw or assets in my app, and unzipping it when the user first opens the app. I'd recommend you give it another shot, as I've been impressed that I've seen zero issues with hundreds of installs. The tutorials I based the helper methods to zip and unzip files are here: Unzipping Files w/ Android, and Zipping Files w/ Android It should be noted that I used the Java API to create the zip that I include with the install of my app. That might be why I had such consistent results unzipping them as well, using the Java API in Android. Hope this helps! Best of luck!
unknown
d6326
train
You can create an specific task to take care of creating and updating the symlink from anywhere in your application to anywhere in your system on each deploy. For example: namespace :terminal do task :link_external_dir, :except => { :no_release => true } do capifony_pretty_print '--> Generating soft link with external_example_dir' run "sharedWebDir=#{shared_path}/web; cd $sharedWebDir; if [ -d $sharedWebDir/internal_example_dir -o -f $sharedWebDir/internal_example_dir ]; then rm -rf $sharedWebDir/internal_example_dir; fi; if [ ! -L $sharedWebDir/internal_example_dir ]; then ln -s /srv/example/vhost/external_example_dir $sharedWebDir/internal_example_dir; fi;" capifony_puts_ok end task :rm_shared_example_dir, :except => { :no_release => true } do capifony_pretty_print '--> Removing sharedDir/internal_example_dir symlink' run "sharedWebDir=#{shared_path}/internal_example_dir; if [ -L $sharedWebDir/internal_example_dir ]; then rm $sharedWebDir/internal_example_dir; fi;" capifony_puts_ok end end Now call each function on each deploy: before "deploy", "terminal:rm_shared_example_dir" after "deploy", "deploy:cleanup" after "deploy", "terminal:link_external_dir" What we are trying to accomplish is: 1.Before Deploy, remove the file from your main sharedDir that links to your external dir. REMOVE /var/www/website/shared/externalDir -> /srv/example/vhost/external_example_dir 2.Deploy your app. 3.Generate the custom symlink again. ln -s /srv/example/vhost/external_example_dir $sharedWebDir/internal_example_dir
unknown
d6327
train
I would go with a DBQuery. Set up a linked server connection between the two DBs (probably on the MSSQL side), and use a simple inner join query to produce the list of e-mails that occur in both tables: select a.emailAddress from MSDBServ.DB.dbo.Table1 a join MySqlServ.DB..Table2 b on a.EmailAddress = b.EmailAddress Finding the set difference, that's going to take more processor power (and it's going to produce at least 1.4b results in the best-case scenario of every MySql row matching an MSSQL row), but the query isn't actually that much different. You still want a join, but now you want that join to return all records from both tables whether they could be joined or not, and then you specifically want the results that aren't joined (in which case one side's field will be null): select a.EmailAddress, b.EmailAddress from MSDBServ.DB.dbo.Table1 a full join MySqlServ.DB..Table2 b on a.EmailAddress = b.EmailAddress where a.EmailAddress IS NULL OR b.EmailAddress IS NULL A: Table1 has the 70,000,000 email addresses, table2 has the 1,500,000,000. I use Oracle so the Upper function may or may not have an equivalent in MySQL. Select EmailAddress from table1 where Upper(emailaddress) in (select Upper(emailaddress) from table2) Quicker than comparing spreadsheets and this assumes both tables are in the same database. A: You could do a sql query to check how many identical email addresses are present in two databases: first number is how many duplicates, second value is the email address. SELECT COUNT(emailAddr),emailAddr FROM table1 A INNER JOIN table2 B ON A.emailAddr = B.emailAddr
unknown
d6328
train
It's not driver for Drupal, but for PHP. It's name should be "pdo_mysql", "php_pdo_mysql" or similar, depending on platform. Since you are on windows you should look for a way to install it there. I.e. check this SO post: PHP - How to install PDO driver? (Windows) BTW, will you site really run on windows server? If not, my advise is to develop on virtual machine, so you'll have the same development environment, as production will be (most likely linux, right?).
unknown
d6329
train
I am yet not sure if this classifies as an answer or not but, even though in my development machine it worked fine with the libraries inside ibm/sqllib/bin. The way I made it work on my deployment machine is by instead providing it with the libraries coming with the clidriver.
unknown
d6330
train
A web server typically uses the corresponding file's last updated attribute as the value for the HTTP Last-Modified header, so in general it can be trusted, but it's always possible that the date is wrong, for whatever reason. The Last-Modified header is usually used for caches, to populate the If-Modified-Since header in subsequent requests.
unknown
d6331
train
Solved the issue. Instead of changing the app's theme's windowBackground to my 9patch image, I added a new theme with the 9patch background and attached it to my first activity. So the basic rule is, don't put a 9patch image in the app's theme background. Place it in the first activity's theme instead. Source for this solution: https://developer.appcelerator.com/question/149184/9-patch-splash-screen-initial-window-does-not-fill-screen
unknown
d6332
train
jQuery.getJSON(loginUrl, { xhrFields: { withCredentials: true }, crossDomain: true }) The second parameter of $.getJSON is the data you want to send, not an options object. To use those, you will need to call $.ajax directly. A: getJSON isn't really a method, it's just a convenience function that is basically a shortcut for: $.ajax({ dataType: "json", }); So basically, $.getJSON() should behave the same as $.ajax() with the dataType set to "json" A: Due to continual issues with CORS, I finally gave up on this one as intractable and worked the problem from the other end. I used a session key coming back to track the length of the session and then re-attaching security based on this, which is how I'd designed security to work in the first place.
unknown
d6333
train
Take a look at the answers to the question SQL: Many-To-Many table AND query. It's the exact same problem. Cletus gave there 2 possible solutions, none of which very trivial (but then again, there simply is no trivial solution). A: SELECT DISTINCT products.product_id FROM products p INNER JOIN attribproducts ptype on p.product_id = ptype.product_id INNER JOIN attribproducts pbrand on p.product_id = pbrand.product_id WHERE ptype.attribute_id IN (9,10,11) AND pbrand.attribute_id IN (60,61) A: Try this: select * from products p, attribproducts a1, attribproducts a2 where p.product_id = a1.product_id and p.product_id = a2.product_id and a1.attribute_id in (9,10,11) and a2.attribute_id in (60,61); A: This will return no rows because you're only counting rows that have a number that's (either 9, 10, 11) AND (either 60, 61). Because those sets don't intersect, you'll get no rows. If you use OR instead, it'll give products with attributes that are in the set 9, 10, 11, 60, 61, which isn't what you want either, although you'll then get multiple rows for each product. You could use that select as an subquery in a GROUP BY statement, grouping by the quantity of products, and order that grouping by the number of shared attributes. That will give you the highest matches first. Alternatively (as another answer shows), you could join with a new copy of the table for each attribute set, giving you only those products that match all attribute sets. A: It sounds like you have a data schema that is GREAT for storage but terrible for selecting/reporting. When you have a data structure of OBJECT, ATTRIBUTE, OBJECT-ATTRIBUTE and OBJECT-ATTRIBUTE-VALUE you can store many objects with many different attributes per object. This is sometime referred to as "Vertical Storage". However, when you want to retrieve a list of objects with all of their attributes values, it is an variable number of joins you have to make. It is much easier to retrieve data when it is stored horizonatally (Defined columns of data) I have run into this scenario several times. Since you cannot change the existing data structure. My suggest would be to write a "layer" of tables on top. Dynamically create a table for each object/product you have. Then dynamically create static columns in those new tables for each attribute. Pretty much you need to "flatten" your vertically stored attribute/values into static columns. Convert from a vertical architecture into a horizontal ones. Use the "flattened" tables for reporting, and use the vertical tables for storage. If you need sample code or more details, just ask me. I hope this is clear. I have not had much coffee yet :) Thanks, - Mark A: You can use multiple inner joins -- I think this would work: select distinct product_id from products p inner join attribproducts a1 on a1.product_id=p.product_id inner join attribproducts a2 on a1.product_id=p.product_id where a1.attribute_id in (9,10,11) and a2.attribute_id in (60,61)
unknown
d6334
train
You need to read the next couple sentences in the documentation, which read something like this: Under Unix, the directory entry for the file is either not created at all or is removed immediately after the file is created. Other platforms do not support this; your code should not rely on a temporary file created using this function having or not having a visible name in the file system. A: I figured out the problem: To begin with, the value of the fWinIni parameter needs to be changed: SPIF_UPDATEINIFILE = 0x01 SPIF_SENDCHANGE = 0x02 ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, f.name, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE) This preserves the wallpaper after logging off. Second, the temp file needs to be closed in order for SystemParametersInfoW to work. Therefore, delete=False is necessary. Finally, delete the temp file manually using os.remove(f.name).
unknown
d6335
train
Here's an example set up with FreeTDS, unixODBC, and friends: freetds.conf: [server1] host = one.server.com port = 1433 tds version = 7.3 [server2] host = two.server.com port = 1433 tds version = 7.3 odbc.ini: [server1] Driver = FreeTDS Server = one.server.com Port = 1433 TDS_Version = 7.3 [server2] Driver = FreeTDS Server = two.server.com Port = 1433 TDS_Version = 7.3 odbcinst.ini: [FreeTDS] Description = FreeTDS with Protocol up to 7.3 Driver = /usr/lib64/libtdsodbc.so.0 The Driver = location may differ above, depending on your distro of FreeTDS. pyodbc connect, DSN free: DRIVER={FreeTDS};SERVER=one.server.com;PORT=1433;DATABASE=dbname;UID=dbuser;PWD=dbpassword;TDS_Version=7.3; A few notes: * *You'll have to update the TDS version to match the version of SQL Server you are running and the Free TDS version you are running. Version 0.95 supports TDS Version 7.3. *TDS Version 7.3 will work with MS SQL Server 2008 and above. *Use TDS Version 7.2 for MS SQL Server 2005. See here for more: https://msdn.microsoft.com/en-us/library/dd339982.aspx Good luck. A: if I'm trying to connect to multiple servers at the same time, how should I configure odbc.ini file in this case? If you want to connect to more than one server you will need to create a separate DSN entry for each one and use more than one pyodbc connection object. Either that, or set up a "Linked Server" on one of the SQL Server instances so you can access both through the same pyodbc connection. in my database connection string, should I enter the driver name as {SQL Server} or {FreeTDS}? If you are editing "odbc.ini" then you are creating DSN entries. You would use the DSN name in your connection string, and pyodbc would get the details (server name, database name) from the corresponding entry in "odbc.ini".
unknown
d6336
train
The first thing that you need to do is iterate through the outer array. Then, for each row in the outer array, you and to iterate through each entry in the category element. So this means that we have two foreach loops. Inside the inner foreach, we simply set the value for the current index to be the value of the same index on a 'sum' array (if it doesn't already exist), or increment the value of that index if it already exists in the 'sum' array. <?php $sumArray = array(); foreach($outerArray as $row) { foreach($row["categories"] as $index => $value) { $sumArray[$index] = (isset($sumArray[$index]) ? $sumArray[$index] + $value : $value); } } ?> Demo using your example array
unknown
d6337
train
Actually there is some overlapping of your div of <li> tag so you need to check the css and add updated code in @media query. Thanks
unknown
d6338
train
so after a lot more diging, it was not that the password was wrong, but for whatever reason PostgreSQL was not even running. Windows is such a PITA! in the end, running pg_ctl -D "C:\PostgreSQL\data\pg96" start from CMD got it going. Now we will see if it starts tomorrow.... I miss my Unix Environment. ----- UPDATE ----- While the above code works, it is moving in the wrong direction. goto Control Panel->Administrative Tools->Services and find 'PostgreSQL ...' in the list. Right click and open Properties. My Startup type: was set to 'Automatic' but it was not starting, I set it to 'Automatic (Delayed Start)' and now it is working, automagically!
unknown
d6339
train
For the ESLint issue with =>, try setting the ecmaVersion to 8 in your ESLint config. module.exports = { root: true, env: { es6: true, node: true, }, extends: [ "eslint:recommended", "google", ], parserOptions: { ecmaVersion: 8 } }; When I run the emulator suite locally, I get no errors, but the DB does not update. Are you using Firestore emulator? If yes, then data will be added there and not in production so you can see the data in emulator only.
unknown
d6340
train
Given that AV_SAMPLE_FMT_FLT is already normalised to the -1 .. 1 range, we can multiply each sample by your 'n' value to have it scaled between -n .. n
unknown
d6341
train
did you collect your static folder python manage.py collectstatic and in your main projects urls.py url(r'^media/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}), url(r'^static/(?P<path>.*)$', serve,{'document_root': settings.STATIC_ROOT}), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root = settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) A: To use WhiteNoise with django : * *Make sure staticfiles is configured correctly In the project settings.py file set STATIC_ROOT = BASE_DIR / 'staticfiles' This staticfiles folder will be the folder where collectstatic will pull out all your static files. *Enable WhiteNoise Always in settings.py: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', # ... ] NB : The WhiteNoise middleware should be placed directly after the Django SecurityMiddleware (if you are using it) and before all other middleware. That is all, but if you want more performance you should enable caching and compression support like this : STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' If you want to apply compression but don’t want the caching behaviour then you can use: STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage' Follow these steps and all will be ok. WhiteNoise Documentation
unknown
d6342
train
You are doing pure memory accessing. That is limited by the memory bandwidth of the machine. Multi-threading is not going to help you much. gcc -O2 already provide you SSE instruction optimization. So it may not help either to use intel instruction directly. You may try to check 4 int at once because SSE support 128 register (please see https://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/X86-Built_002din-Functions.html and google for some example) Also to reduce the amount of data helps, by using short instead of int if you can.
unknown
d6343
train
If you have indeks on "day" column, second solution will become faster by the data increase. Because built-in functions are always have more cost to evaluate.
unknown
d6344
train
I suppose you have to query for getDOMNode: const button = wrapper.find('button').getDOMNode(); // const button = wrapper.getDOMNode(); // <---if wrapper is button element It will give you the lying dom element in the component.
unknown
d6345
train
You have used the attribute pid: var del_id = element.attr("pid"); But the attribute specified in your HTML is id, not pid. Change this: <button class=\"btn btn-sm btn-danger delete_class\" id=\"".$row['pid']."\">Delete</button> To this: <button class=\"btn btn-sm btn-danger delete_class\" pid=\"".$row['pid']."\">Delete</button> And try debugging in your jQuery: var del_id = element.attr("pid"); console.log(del_id); // On chrome, go to the Inspect Element > console tab and check if the id retrieved is correct.
unknown
d6346
train
@Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); android.os.Process.killProcess(android.os.Process.myPid()); } You're wondering why it crashes onPause? You're crashing it.
unknown
d6347
train
Well jokes on me, the problem was that I was not appending '\n' to the messages that I was sending to the ftp server
unknown
d6348
train
* *First of all, you should use database access drivers to connect to your database. *Your query should not be passed to cycle. It is very rare situation, when such approach is needed. Better to use WHERE condition clause properly. *To get all rows from products table you may just ommit WHERE clause. Consider reading of manual at http://dev.mysql.com/doc. The statement selects all rows if there is no WHERE clause. Following example is for MySQLi driver. // connection to MySQL: // replace host, login, password, database with real values. $dbms = mysqli_connect('host', 'login', 'password', 'database'); // if not connected then exit: if($dbms->connect_errno)exit($dbms->connect_error); $sql = "SELECT * FROM products"; // executing query: $result = $dbms->query($sql); // if query failed then exit: if($dbms->errno)exit($dbms->error); // for each result row as $product: while($product = $row->fetch_assoc()){ // output: var_dump($product); // replace it with requied template } // free result memory: $result->free(); // close dbms connection: $dbms->close(); A: I would suggest that you use PDO. This method will secure all your SQLand will keep all your connections closed and intact. Here is an example EXAMPLE. This is your dbc class (dbc.php) <?php class dbc { public $dbserver = 'server'; public $dbusername = 'user'; public $dbpassword = 'pass'; public $dbname = 'db'; function openDb() { try { $db = new PDO('mysql:host=' . $this->dbserver . ';dbname=' . $this->dbname . ';charset=utf8', '' . $this->dbusername . '', '' . $this->dbpassword . ''); } catch (PDOException $e) { die("error, please try again"); } return $db; } function getproduct($id) { //prepared query to prevent SQL injections $query = "SELECT * FROM products where prod_id=?"; $stmt = $this->openDb()->prepare($query); $stmt->bindValue(1, $id, PDO::PARAM_INT); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); return $rows; } ?> your PHP page: <?php require "dbc.php"; for($i=1; $i+1<prod_id; $i++) { $getList = $db->getproduct($i); //for each loop will be useful Only if there are more than one records (FYI) foreach ($getList as $key=> $row) { echo $row['columnName'] .' key: '. $key; } } A: for($i=1;$i+1<prod_id;$i++) { $query = "SELECT * FROM products where prod_id=$i"; $result = mysqli_query($query, $con); $con is the Database connection details you can use wile loop to loop thru each rows while ($row = mysqli_fetch_array($result)) { ...... } } A: Hope this might work as per your need.. for($i=1; $i+1<prod_id; $i++) { $query = "SELECT * FROM products where prod_id = $i"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { print_r($row); } } A: I think you want all records from your table, if this is the requirement you can easily do it $query = mysql_query("SELECT * FROM products"); // where condition is optional while($row=mysql_fetch_array($query)){ print_r($row); echo '<br>'; } This will print an associative array for each row, you can access each field like echo $row['prod_id'];
unknown
d6349
train
I don't think this code worked on Airflow 1.10 you are missing template_ext that will allow you to read from .sql files. class SnowQueryOperator(BaseOperator): template_fields = ('sql') template_ext = ('.sql',) I'm not clear on why you implemented this operator on your own. Airflow has Snowflake provider which has SnowflakeOperator. You can install it with pip install apache-airflow-providers-snowflake and then import the operator as from airflow.providers.snowflake.operators.snowflake import SnowflakeOperator
unknown
d6350
train
I'm new to Stackoverflow and dont know how to tag a question as duplicate. But i think there is a really similar question with plenty of answers. Give a look here [Possible solution] You could insert if it not exists and then select it. INSERT INTO Test(Key_Value , Name , ...) VALUES(@Key_Value ,@Name,..) WHERE NOT EXISTS (SELECT 1 FROM Test WHERE KeyValue = @KeyValue); SELECT Name FROM Test WHERE Key_Value = @Key_Value
unknown
d6351
train
Because best practices when writing sample code are not necessarily best practices when writing large projects. In a C++ course, you write mainly small programs (up to a few hundred lines of code) that have to solve a relatively small problem. This means little to no focus on future maintenance (and avoiding sources of confusion for future maintainers). Because many teachers simply do not have coding experience in large projects, the problem doesn't even get acknowledged (let alone discussed) in most C++ courses. A: Because college computer science professors do not necessarily know how to write good code.
unknown
d6352
train
It worked Now. select split(regexp_replace('1234567890000','(\d{6,}?)(0+)$','$1|$2'), '|') as output; enter code here output ------------------- [123456789, 0000]
unknown
d6353
train
Hope you are using the Model name called "Suppliers". So in get method pass that into view. You needs to do come little changes accordingly to use Begin Form in your view, so that you can directly post your model data to controller. Use this item inside body. Don't forget to declare the model which you are using in the view page like below. @model MVC.Models.Suppliers @using (Html.BeginForm("SetOrdersPosition", "Packer", FormMethod.Post)) { <table> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.Id) </td> <td> @Html.DisplayFor(modelItem => item.Clients.BusinessName) </td> <td> @Html.DisplayFor(modelItem => item.Clients.BusinessAddress) </td> <td> @Html.DisplayFor(modelItem => item.CreateDate) </td> <td> @Html.DisplayFor(modelItem => item.PayDate) </td> <td> @Html.DisplayFor(modelItem => item.Discount) </td> <td> @Html.DisplayFor(modelItem => item.TotalPrice) </td> </tr> <tr> <td><input type="submit" value="Submit"/></td> </tr> } </table> } Controller Code [HttpPost] public ActionResult SetOrdersPosition(Suppliers _suppliers) { //does something... }
unknown
d6354
train
Not sure why you want to do this with an elaborate loop code. It sounds like you are trying to summarise your data. This can be done in different ways. Here is a solution using dplyr: DataSet1 %>% group_by(Year, SpeciesName, Site) %>% summarise(nrecords = n(), Count = mean(Count)) To get a better answer, it might be helpful to post a subset of the data and the intended result you are after.
unknown
d6355
train
Here is one approach Example Declare @YourTable table (id int,created date, ordernumber varchar(25)) Insert Into @YourTable values (56,'04/14/2017','1022108100000001') ,(56,'04/14/2017','1022108100000002') ,(56,'04/14/2017','1022108100000003') ,(57,'04/14/2017','1022109100000001') ,(57,'04/14/2017','1022109100000002') Select [@id] = id ,[@created] = convert(VARCHAR(10), created, 101) ,( Select ordernumber From @YourTable A1 Where A1.id = A.id For XML Path(''), type ) From (Select Distinct ID,Created From @YourTable ) A For XML Path('grouped'), Root('trans_groups') Returns <trans_groups> <grouped id="56" created="04/14/2017"> <ordernumber>1022108100000001</ordernumber> <ordernumber>1022108100000002</ordernumber> <ordernumber>1022108100000003</ordernumber> </grouped> <grouped id="57" created="04/14/2017"> <ordernumber>1022109100000001</ordernumber> <ordernumber>1022109100000002</ordernumber> </grouped> </trans_groups> A: This is working for me. select gr.id as [@id], gr.created as [@created], ( SELECT ordernumber as ordernumber from transactions where grouped_id = grouped_id and ordernumber in ('4003970100000383', '4003970100000376', '4003970100000369', '1022108100000018') FOR XML path(''), type ) FROM (SELECT distinct gr.id, created FROM trGrouped gr inner join transactions ts on ts.grouped_id = gr.id where ts.ordernumber in('4003970100000383', '4003970100000376', '4003970100000369', '1022108100000018')) gr FOR XML PATH('grouped'), ROOT('trans_groups')
unknown
d6356
train
To store the handle you could run something like: for i=1:4 h(i)=figure(i); plot(1:13); end A: AFAIK you are good to go with h = figure plot(1:13) I tested it in R2010a before posting. The figure('NextPlot','new') instructs MATLAB to create a new window (other than being opened) for next plot. That is why you get an empty window + the plot window. By defaut NextPlot has the value add, and it is for Use the current figure to display graphics (the default)
unknown
d6357
train
Does it help to be explicit with font-weight and font-style in each definition? That's what this answer does. It also adds css that makes strong/em associated to font-weight/font-style explicitly (which may be unneeded). A: Don't know why but this solved the problem @font-face { font-family: "Computer Modern"; src: url('http://localhost/sitename/wp-includes/fonts/latex/cmunrm.woff'); } @font-face { font-family: "Computer Modern"; src: url('http://localhost/sitename/wp-includes/fonts/latex/cmunti.woff'); font-style: italic; } @font-face { font-family: "Computer Modern"; src: url('http://localhost/sitename/wp-includes/fonts/latex/cmunbx.woff'); font-weight: bold; } @font-face { font-family: "Computer Modern"; src: url('http://localhost/sitename/wp-includes/fonts/latex/cmunbi.woff'); font-weight: bold; font-style: italic; }
unknown
d6358
train
About the jittering: I don't see any render loop in your code. How is the render method triggered? By a timer or by an event? Your messed up rotations when rotating about two axes are probably related to the fact that you need to rotate the axis of the second rotation along with the total rotation of the first axis. You cannot just apply the rotation about the X or Y axis of the global coordinate system. You must apply the rotation about the up and right axes of the camera. I suggest that you create a camera class that stores the up, right and view direction vectors of the camera and apply your rotations directly to those axes. If this is an FPS like camera, then you'll want to rotate the camera horizontally (looking left / right) about the absolute Y axis and not the up vector. This will also result in a new right axis of the camera. Then, you rotate the camera vertically (looking up / down) about the new right axis. However, you must be careful when the camera looks directly up or down, as in this case you can't use the cross product of the view direction and up vectors to obtain the right vector.
unknown
d6359
train
An empty sequence results in no iteration. for k in D.get('kids', ()): A: [x for x in dict_with.get('kids')], You can use this filter, map - a functional programming tools with the list comprehension. * *list comprehension are more concise to write. *run much faster than manual for loop statements. *To avoid key-error use dict_with.get('xyz',[]) returns a empty list. A: for x in d.get("kids", ()): print "kid:", x
unknown
d6360
train
jQuery aside - making an AJAX request for any page will merely load the HTML generated by the web server. The corresponding page could be generated by any type of script that's supported by the server: PHP, ASP, whatever.
unknown
d6361
train
Your Json and Class variables should have the same name. backdrop_path in Json and backdropPath in class would not work A: Incase this helps for someone like me who spent half a day in trying to figure out a similar issue with gson.fromJson() returning object with null values, but when using @JsonProperty with an underscore in name and using Lombok in the model class. My model class had a property like below and am using Lombok @Data for class @JsonProperty(value="dsv_id") private String dsvId; So in my Json file I was using "dsv_id"="123456" Which was causing null value. The way I resolved it was changing the Json to have below ie.without the underscore. That fixed the problem for me. "dsvId = "123456"
unknown
d6362
train
Using the import/export task in SSMS, the last step has 2 options. Run immediately or save as SSIS package. So - save it as a SSIS package. You can then run this package whenever you want. And yes - you will need to do this twice. Once for export, once for import. You can also do exactly the same thing using SSIS btw. So how do you execute a package from the command line? Like you do for any question, you should search first. Some suggestions/examples are here. And if needed, you can schedule this using the agent.
unknown
d6363
train
Biocontainers does not allow latest as tag for their containers, and therefore you will need to specify the tag to be used. From their doc: The BioContainers community had decided to remove the latest tag. Then, the following command docker pull biocontainers/crux will fail. Read more about this decision in Getting started with Docker When no tag is specified, it defaults to latest tag, which of course is not allowed here. See here for bowtie2's tags. Usage like this will work: singularity pull docker://biocontainers/bowtie2:v2.4.1_cv1 A: Using another container solves the issue; however, the fact I'm getting errors from biocontainers is troubling given that these are both very common and used as examples in the literature so I will award the top-answer to whomever can solve that specific issue. As it were, the use of stackleader/bgzip-utility solve the issue of actually running this rule in a container. container: "docker://stackleader/bgzip-utility" Once again, for those coming to this post, it's probably best to test any container first before running snakemake, e.g. singularity pull docker://stackleader/bgzip-utility.
unknown
d6364
train
SimpleXML doesn't have a getElementsByTagName() method (DOMDocument does). In SimpleXML, the object (e.g $xml) is treated as the root element. So you can loop through the product items like so: $xml = simplexml_load_string($xmlString); foreach($xml->products->item as $item) { echo (string)$item->product_id; echo (string)$item->model; } Example of building a devices associative array: $devices = array(); $xml = simplexml_load_string($xmlString); foreach($xml->products->item as $item) { $device = array(); foreach($item as $key => $value) { $device[(string)$key] = (string)$value; } $devices[] = $device; } print_r($devices); Outputs: Array ( [0] => Array ( [product_id] => 32417 [manufacturer] => Alcatel [model] => Sparq 2 [deeplink] => http://www.mysite.com/sc_offer?gid=32417 [thumbnail_URL] => http://www.mysite.com/images/devices/thumbs/Alcatel-Sparq-II.jpg [image_URL] => http://www.mysite.com/images/devices/Alcatel-Sparq-II.jpg [price_not_working] => 0.00 [price_poor] => 0.00 [price_fair] => 20.00 [price_good] => 25.00 [price_perfect] => 25.00 [price_new] => 25.00 [battery_new] => 1.00 [battery_perfect] => 1.00 [battery_good] => 1.00 [battery_fair] => 1.00 [battery_poor] => 0.00 [charger_new] => 1.00 [charger_perfect] => 1.00 [charger_good] => 1.00 [charger_fair] => 1.00 [charger_poor] => 0.00 [packaging_new] => 1.00 [packaging_perfect] => 1.00 [packaging_good] => 1.00 [packaging_fair] => 1.00 [packaging_poor] => 0.00 ) [1] => Array ( [product_id] => 31303 [manufacturer] => Apple [model] => iPhone 3G 8gb [deeplink] => http://www.mysite.com/sc_offer?gid=31303 [thumbnail_URL] => http://www.mysite.com/images/devices/thumbs/iPhone 8 3G.jpg [image_URL] => http://www.mysite.com/images/devices/iPhone 8 3G.jpg [price_not_working] => 0.00 [price_poor] => 0.00 [price_fair] => 7.00 [price_good] => 2.00 [price_perfect] => 2.00 [price_new] => 2.00 [battery_new] => 1.00 [battery_perfect] => 1.00 [battery_good] => 1.00 [battery_fair] => 1.00 [battery_poor] => 0.00 [charger_new] => 1.00 [charger_perfect] => 1.00 [charger_good] => 1.00 [charger_fair] => 1.00 [charger_poor] => 0.00 [packaging_new] => 1.00 [packaging_perfect] => 1.00 [packaging_good] => 1.00 [packaging_fair] => 1.00 [packaging_poor] => 0.00 ) ) A: I don't want to spoil the existing answer as it is answering correct an in a general fashion. For your concrete requirements as with your XML there aren't any attributes and you're just looking for the element-name => node-value pairs here, there is one function that comes to mind in conjunction with SimpleXMLElement here: get_object_vars. It is useful whenever you convert an object into an array and as SimpleXMLElement turns element names into object property names and the node-values as those property values it's pretty straight forward here: $xml = simplexml_load_string($buffer); $items = $xml->products->item; $devices = array_map('get_object_vars', iterator_to_array($items, FALSE)); print_r($devices); The output is as suggested in the existing answer. And the online demo is here: https://3v4l.org/iQKQP You will likely able to achieve similar results with casting to arrays (if not exactly the same with SimpleXML), however in this case as I wanted to map it, I needed a true function. There is also the json-en- and -de-code doubling for converting complete trees, which comes in handy here, too: $xml = simplexml_load_string($buffer); $items = $xml->products; $devices = json_decode(json_encode($items), TRUE)['item']; The output then again is exactly as the existing answer. And the online demo again is here: https://3v4l.org/ToWOs Hope this is helpful and widens the view a bit.
unknown
d6365
train
I tried below code hope it solves your problem.... You can also play with this code at DartPad NestedScrollView NestedScrollView( physics: ClampingScrollPhysics(), headerSliverBuilder: (context, value) { return [ SliverToBoxAdapter( /// _buildCarousel() in your case.... child: Container( height: 200, child: Center( child: Text("Your Carousel will be here"), ) ), ), SliverToBoxAdapter( child: TabBar( labelColor: Colors.blue, unselectedLabelColor: Colors.black, controller: tb, tabs: <Widget>[ Tab(child: Text("tab1"),), Tab(child: Text("tab2"),) ], ) ), ]; }, body: TabBarView( controller: tb, children: <Widget>[ GridView.count( physics: NeverScrollableScrollPhysics(), crossAxisCount: 3, children: List.generate(10, (index) => Icon(Icons.grid_off) ).toList() ), GridView.count( physics: NeverScrollableScrollPhysics(), crossAxisCount: 3, children: List.generate(5, (index) => Icon(Icons.grid_on) ).toList() ), ], ), ) A: See this DartPad for running ex. PinnedAppBar_SliverAppBar_NestedScrollView NestedScrollView( controller: ScrollController(), physics: ClampingScrollPhysics(), headerSliverBuilder: (context, value) { return [ SliverAppBar( pinned: true, backgroundColor: Colors.white, flexibleSpace: FlexibleSpaceBar( background: /// _buildCarousel() in your case.... Container( height: 200, child: Center( child: Text("Your Carousel will be here"), ) ), ), expandedHeight: 250.0, /// your Carousel + Tabbar height(50) floating: true, bottom: TabBar( labelColor: Colors.blue, unselectedLabelColor: Colors.black, controller: tb, tabs: <Widget>[ Tab(child: Text("tab1"),), Tab(child: Text("tab2"),) ], ), ), ]; }, body: TabBarView( controller: tb, children: <Widget>[ GridView.count( crossAxisCount: 3, children: List.generate(10, (index) => Icon(Icons.grid_off) ).toList() ), GridView.count( crossAxisCount: 3, children: List.generate(5, (index) => Icon(Icons.grid_on) ).toList() ), ], ), )
unknown
d6366
train
I would use decimal instead of double then: public static decimal? ConvertCmToM(decimal? cm) { if(cm == null) return null; return Decimal.Multiply(cm.Value, 0.01m); } static void Main() { Console.Write(ConvertCmToM(8.8m)); // 0.088 } decimal vs double! - Which one should I use and when?
unknown
d6367
train
UIImage *bubbleImage = [UIImage imageNamed:@"Commentbox_right.png"]; UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(textFrame.origin.x-2, textFrame.origin.y-2, textFrame.size.width+4 , textFrame.size.height+7)]; imgView.image= [bubbleImage stretchableImageWithLeftCapWidth:bubbleImage.size.width/2-5 topCapHeight:bubbleImage.size.height/2]; [cell addSubview:imgView]; [cell bringSubviewToFront:txtViewMessage]; UILabel *lblTimeStamp = [[UILabel alloc]initWithFrame:CGRectMake(textFrame.origin.x+2, imgView.frame.size.height+imgView.frame.origin.y, 90, 10)]; [lblTimeStamp setText:message.dateTime];//set time here [lblTimeStamp setFont:FONT_300_LIGHT(7)]; [lblTimeStamp setTextColor:GET_COLOR_WITH_RGB(129,129,129, 1)]; [lblTimeStamp setTextAlignment:NSTextAlignmentLeft]; [lblTimeStamp setBackgroundColor:[UIColor clearColor]]; [cell addSubview:lblTimeStamp]; A: Sorry i didn't get much time to look in to it .. but again you can add that image in same message bubble xib and add constraints according to your need. Try this xib A: How I add custom Label in JSQMessageviewcontroller is... I declare Label text before ViewDidLoad. // Add Text Label let myLabel: UILabel = { let lb = UILabel() lb.translatesAutoresizingMaskIntoConstraints = false lb.textAlignment = .center lb.numberOfLines = 1 lb.textColor = UIColor.white lb.font=UIFont.systemFont(ofSize: 22) lb.backgroundColor = UIColor(red: 0.0/255.0, green:70.0/255.0, blue:110.0/255.0, alpha:1) lb.text = NSLocalizedString("No Notification", comment: "") return lb }() And add this code in viewDidiLoad or call anywhere you like. self.view.addSubview(myLabel) setUpMyLabel() This is how I add custom label in my app. Hope this will help you. :)
unknown
d6368
train
it would be useful to use a better text editor to catch syntax errors before you even compile. here are the syntax errors your program has. the len should be assigned first like this for (int i = 0, len = strlen(plaintext); i < len; i++) { but that's in efficient since the strlen() is called at each iteration, do this instead. int len = strlen(plaintext); // it's in efficient to calculate length each iteration. for (int i = 0; i < len; i++) { condition for if statements should be surrounded by brackets. if (islower(c)) // if (cond) <-- brackets are importants your function definition has a semicolon which is also a syntax error bool check_valid_key(string s) // ; <-- remove this semicolon { }
unknown
d6369
train
First you must identify what image should be stored, you can see a custom attribute for image called data-name and other for button called data-image, both have the same content: <!-- Page One --> <img data-name="catImage" src="https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg" style="width: 100px;"/> <br /> <button class="btn-add-image" data-image="catImage">Click Here to Favorite Cat Image!</button> Now, when a user click on a image button, first you must get your image: var myImageName = $(this).attr("data-image"); var myImage = $('img[data-name="' + myImageName + '"]'); After you should get the image base64 string //Create a Canvas var myCanvas = document.createElement("canvas"); //Set width and height myCanvas.width = myImage.width(); myCanvas.height = myImage.height(); //Draw imagem var myContext = myCanvas.getContext("2d"); myContext.drawImage(myImage, 0, 0); //And finally get canvas64 string var base64 = myCanvas.toDataURL("image/jpeg"); // if it's a png uses image/png And now save it on localStorage: localStorage.setItem("image", base64); And now restore on page two - page two HTML: <!--Page Two --> <div data-role="page" id="two"> <h1>Page 2: Stored and Retrieved Images Display On This Page Once Clicked</h1> </div> <div data-role="main" id="restoredImage"> </div> Page two JavaScript: $(document).ready(function() { var img = document.createElement("img"); img.src = localStorage.getItem("image"); $("#restoredImage").html(img); }); A: Other idea is use only vanilla JS Page one - to save on localStorage: var img = new Image, canvas = document.createElement("canvas"), ctx = canvas.getContext("2d"), src = "http://example.com/image"; // insert image url here img.crossOrigin = "Anonymous"; canvas.width = img.width; canvas.height = img.height; ctx.drawImage( img, 0, 0 ); localStorage.setItem( "savedImageData", canvas.toDataURL("image/png") ); Page two - to recovery from localStorage: localStorage.getItem("savedImageData") JSBin example: https://jsbin.com/hewapewoxe/edit?html,js,console
unknown
d6370
train
If what you are using being your actual code that you posted in a comment, you're missing a closing brace } and one too many after mysqlerror()); <= Consult "footnotes" about this. Your code from a comment: $db_selected = mysql_select_db('qrcodes'); if(!$db_selected) { die ('cant\'t connect :' . mysqlerror()); } } else { this is line 217 $username = $_REQUEST['username']; $password = $_REQUEST['pass']; Sidenote: You have mysqlerror which should read as mysql_error as per the manual New code: $db_selected = mysql_select_db('qrcodes'); if(!$db_selected) { die ('cant\'t connect :' . mysql_error()); } else { $username = $_REQUEST['username']; $password = $_REQUEST['pass']; } Footnotes: I agree with Andy Lester's comment in regards to actual errors coming from a line or lines further above. Error messages pointing to a certain line number, doesn't necessarily mean it's on "that" line. Showing full code will take the guesswork out of things, however from what you did post in your comment, it's a bracing mismatch issue, and using mysqlerror instead of mysql_error (you forgot the underscore between mysql and error) would have provided more information which failed in doing so because of it. mysql_* functions deprecation notice: http://www.php.net/manual/en/intro.mysql.php This extension is deprecated as of PHP 5.5.0, and is not recommended for writing new code as it will be removed in the future. Instead, either the mysqli or PDO_MySQL extension should be used. See also the MySQL API Overview for further help while choosing a MySQL API. These functions allow you to access MySQL database servers. More information about MySQL can be found at » http://www.mysql.com/. Documentation for MySQL can be found at » http://dev.mysql.com/doc/.
unknown
d6371
train
From what I have seen using the debugger, you have a little bit of confusion between the curly braces as text and the curly braces to handle MATLAB cell arrays. Here is a re-write of your for-loop to produce the cell array of strings you have given in your code example. Also, to produce the exact output you specified, subject and condition have to be given in a different order: for curCond=1:length(conditions) gavRow = []; for curSubject=1:length(subjects) if (curSubject ~= 1) gavRow = [gavRow ' ']; end gavRow = [gavRow '{' [conditions{curCond} '-' subjects{curSubject} '-' GFPorBMR '.avg'] '}']; end CondRowDone{curCond}=['GROUPAVG ' '{' gavRow '} ' 'G Y 1 N N {' conditions{curCond} '.avg}']; end As for the task of writing the strings to disk, MATLAB is telling you that it cannot handle your cell array as a matrix. When it comes to write cell arrays to disk, I think you have to write it yourself using low-level functions, like this: outputfile = [studyname '_GAV_' curSubject '.txt']; fid = fopen(outputfile, 'w'); for i=1:length(CondRowDone) fprintf(fid, '%s\n', CondRowDone{i}); end fclose(fid); A: dlmwrite only handles numeric data. One way around this, if you have Excel, would be to use xlswrite - it can take in (some kinds of) cell arrays directly. xlswrite(outputfile, CondRowDone); Then, do some batch xls to csv conversion (for example, see this question and answers). To get a text file directly you'll need to use lower level commands (as in blackbird's answer).
unknown
d6372
train
It's 2019 and more updated docs have come out. In short: AIRFLOW__CORE__PARALLELISM is the max number of task instances that can run concurrently across ALL of Airflow (all tasks across all dags) AIRFLOW__CORE__DAG_CONCURRENCY is the max number of task instances allowed to run concurrently FOR A SINGLE SPECIFIC DAG These docs describe it in more detail: According to https://www.astronomer.io/guides/airflow-scaling-workers/: parallelism is the max number of task instances that can run concurrently on airflow. This means that across all running DAGs, no more than 32 tasks will run at one time. And dag_concurrency is the number of task instances allowed to run concurrently within a specific dag. In other words, you could have 2 DAGs running 16 tasks each in parallel, but a single DAG with 50 tasks would also only run 16 tasks - not 32 And, according to https://airflow.apache.org/faq.html#how-to-reduce-airflow-dag-scheduling-latency-in-production: max_threads: Scheduler will spawn multiple threads in parallel to schedule dags. This is controlled by max_threads with default value of 2. User should increase this value to a larger value(e.g numbers of cpus where scheduler runs - 1) in production. But it seems like this last piece shouldn't take up too much time, because it's just the "scheduling" portion. Not the actual running portion. Therefore we didn't see the need to tweak max_threads much, but AIRFLOW__CORE__PARALLELISM and AIRFLOW__CORE__DAG_CONCURRENCY did affect us. A: The scheduler's max_threads is the number of processes to parallelize the scheduler over. The max_threads cannot exceed the cpu count. The LocalExecutor's parallelism is the number of concurrent tasks the LocalExecutor should run. Both the scheduler and the LocalExecutor use python's multiprocessing library for parallelism. A: parallelism: not a very descriptive name. The description says it sets the maximum task instances for the airflow installation, which is a bit ambiguous — if I have two hosts running airflow workers, I'd have airflow installed on two hosts, so that should be two installations, but based on context 'per installation' here means 'per Airflow state database'. I'd name this max_active_tasks. dag_concurrency: Despite the name based on the comment this is actually the task concurrency, and it's per worker. I'd name this max_active_tasks_for_worker (per_worker would suggest that it's a global setting for workers, but I think you can have workers with different values set for this). max_active_runs_per_dag: This one's kinda alright, but since it seems to be just a default value for the matching DAG kwarg, it might be nice to reflect that in the name, something like default_max_active_runs_for_dags So let's move on to the DAG kwargs: concurrency: Again, having a general name like this, coupled with the fact that concurrency is used for something different elsewhere makes this pretty confusing. I'd call this max_active_tasks. max_active_runs: This one sounds alright to me. source: https://issues.apache.org/jira/browse/AIRFLOW-57 max_threads gives the user some control over cpu usage. It specifies scheduler parallelism.
unknown
d6373
train
Use: using System.Diagnostics; ... var sw = Stopwatch.StartNew(); DoYaThing(); Console.WriteLine("{0} Elapsed", sw.Elapsed); A: You could use the System.Diagnostics.Stopwatch class. Stopwatch sw = new Stopwatch(); sw.Start(); // Your method call here... sw.Stop(); // Get the elapsed time TimeSpan elapsed = sw.Elapsed; From here, you can use the TimeSpan.Ticks or the TimeSpan.TotalSeconds properties to determine the elapsed ticks or elapsed seconds, respectively. If you wanted to, you could use a method along the following lines to "wrap" that functionality around a function, as you mentioned (just an idea, you'd probably want to tweak this code to suit your specific purposes -- passing in arguments, etc.): public static T ExecuteWithElapsedTime<T>(Func<T> function, out TimeSpan elapsedTime) { T rval; Stopwatch sw = new Stopwatch(); sw.Start(); rval = function(); sw.Stop(); elapsedTime = sw.Elapsed; return rval; } And you could call it like this (where myFunc is a function that returns an int): TimeSpan elapsed; int result = ExecuteWithElapsedTime(myFunc, out elapsed); Might be simpler though to not even bother with a method like this, and just put the Stopwatch code inline with your method call. A: There's the high resolution timer ... Also, iirc a TimeSpan can give you a measurement in ticks back. A: You can check out the [System.TimeSpan] class and wrap that around your method.
unknown
d6374
train
<script src="some/directory/example.js" type="text/javascript"> the code above will get some/directory/example.js from server you just make folders and file structure follow the pattern above A: The easiest way is to right click on that page in your browser, choose page script, click on that .js link, and it will be there. A: If you want to load at run time, like some part of your javascript is dependent on other javascript, then for loading javascript at run time, you can use require.js .
unknown
d6375
train
There are a couple of ways to approach sticking a JAXB object into a CLOB (or BLOB) column in a database. I think that you will have to do some custom insert and select logic to put the JAXB object into a column - the normal ORM model would be a row per object, with a column per field of the object (e.g., if you were using hibernate). Option 1: Configure xjc to generate Serializable JAXB classes (How to generate a Java class which implements Serializable interface from xsd using JAXB?). Then use the Serializable interface to read/write the object from the clob/blob's input/output streams. This stores the Java object representation in the database. Option 2: Use the JAXB-supplied XML marshal/unmarshal path to read/write the state of the object as XML text. This stores the XML representation of the object in the database. I personally would go with Option 2 - the XML representation. I think it is easier to manage changes in the XSD and make sure you can read old objects, rather than having to deal with Java's serial version ID. In addition, you might want to consider compressing the XML before putting it in the CLOB (see Compressing and decompressing streams).
unknown
d6376
train
Based on your codepen, it doesn't seem like the 3rd and 6th modals are the problem with the styles displaying. The real problem is that all the content in your modals are absolutely positioned which takes them out of the ordinary context of the document, which causes the project-borders containers to have a height that only consists of the borders. You'll need to define a fixed height for that container for things to display correctly like so... .project-borders { position: relative; border: 2px solid #000; height: 209px; }
unknown
d6377
train
For historical reasons, this is a pointer. Use -> instead of .. bool linked_list::insert(int i) { bool inserted = false; if(this->is_present(i)) { inserted = true; // fixed syntax error while I was at it. } else { this->put(0, i); // fixed inconsistent naming while I was at it. inserted = true; } return inserted; } Usually it is not needed to use this-> at all; you can just do if(is_present(i)). A: this works in c++ the same as it does in Java. The only difference is that you need to use this-> instead of this. this is a pointer than therefor you cannot use the dot operator to access it's members. A: why don't you just call the other functions in linked_list::insert(int)? And no, it is not valid, you should put this -> something instead of this.something
unknown
d6378
train
Add display:block to your img tag and border:0 to your hr tag. .margin_padding { margin: 0; padding: 0; border: 0; display: block; } A: What you see is the default margin of the <body> tag. The actual value depends on the browser. A common practice to avoid most browser's different default values is explicitly setting margin and padding to 0: html, body { margin: 0; padding: 0; }
unknown
d6379
train
You have to loop over the visitors and then check if the visitor is a member. If you reach the end of the loop you haven't found any member and return "No members". members = ['Danny', 'Alex', 'Kieran', 'Zoe', 'Caroline'] visitors = ['Scott', 'Helen', 'Raj', 'Danny'] def check_group(members, visitors): for visitor in visitors: if visitor in members:: return f'Member present: {visitor}.' return 'No members.' check_group(members, visitors)
unknown
d6380
train
Obviously nobody else out there is building Flex apps on top of salesforce.com.. yippee, I'm first. Anyhow, I just found out that this is a bug at salesforce.com as at 6th December 2008. The issue is that the scripts which handle login do not cope adequately with the redirect necessary because of load balancing on the salesforce.com servers. It should be possible to go through the www front door of salesforce.com's api with a URL such as... "https://www.salesforce.com/services/Soap/u/13.0"; where the 13 represents the version of their API you are targetting. However, all users are actually assigned to a specific server, so the front door should redirect the login request to the approriate place, and it doesn't if you are coming from Flex. A workround is to specify your server in the URL, such as... "https://na5.salesforce.com/services/Soap/u/13.0"; ...which is what I was doing. That's fine if you are a single user accessing the same resources continually and your account remains attached to that server. However if... * *You are distributing your app so anyone who has a salesforce.com enterprise account can log in OR *Your account gets moved because of some internal load balancing (which is what happened to me) then the approach of providing a fixed server won't work. The bug (as far as I understand it) is that the www route doesn't adequately redirect to your host server. Last intelligence was that it will be fixed "soon". I wish I could mark this as the answer...
unknown
d6381
train
I suppose you must seek back to the beginning after saving the image to the stream using mystream.Seek(0, SeekOrigin.Begin), because the current position in the stream is just after the last written byte.
unknown
d6382
train
Given the fact that time has no importance in your case (00:00:00), it is much simpler to use MySQL DATE function in your filter. Can you try using : where b.status = 'SUBMITTED' and DATE(b.created_date) >= '2020-04-01' and where b.status = 'SUBMITTED' and DATE(b.created_date) >= '2020-04-15'
unknown
d6383
train
It looks like you want to learn how an etl program works to increase your knowledge of programming. Rhino ETL is an open source project, so you can get the source here: https://github.com/ayende/rhino-etl and see exactly how they do it. There are also other ETL packages that are Open Source so you can see the way that they do things differently. For example talend source can be found at: http://www.talend.com/resources/source-code.php Of course, if you are trying to write your own code for commercial use, you will not want to see the source code of others, so you will need to come up with your process on your own. Hope this helps you! A: Far from a complete answer I'm afraid. You can "page" the results of an arbitrary select query within .Net using one or more of the techniques outlined here. http://msdn.microsoft.com/en-us/library/ff650700.aspx This should allow you to chunk up the data and avoid RAM concerns. Alternatively - if your existing SSIS packages are simple / similar enough, then it could be worth while to have a look at generating the SSIS packages automatically based on a template. For example I'm maintaining 100+ packages that are automatically generated by a small c# application using the EzAPI API for SSIS.
unknown
d6384
train
On 51-android.rules: SUBSYSTEMS=="usb", ATTRS{idVendor}=="18b1", ATTRS{idProduct}=="0003", MODE="0666". And use chmod command to have permission 666 (the number of the beast, muahahhaha) on adb or will not work. Good luck. A: SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="XXXX", MODE="0660", OWNER="`<your user name>`" and try using upper case and lower case because in linux a lot of people are having problems to add permissions. A: Following from the Arch Linux Wiki page I would create /etc/udev/rules.d/51-android.rules SUBSYSTEM=="usb", ATTR{idVendor}=="18D1", MODE="0666" SUBSYSTEM=="usb",ATTR{idVendor}=="18D1",ATTR{idProduct}=="0003",SYMLINK+="android_adb" SUBSYSTEM=="usb",ATTR{idVendor}=="18D1",ATTR{idProduct}=="0003",SYMLINK+="android_fastboot" Then as root run udevadm control --reload-rules You may need to replace 18D1 with 18d1. That is what I have done and it works great. You don't necessarily need the username as long as you give permission (MODE="0666") to everyone. If you require more security look at adding the OWNER tag. Again these are rules that I have used on Arch, they should work on Mint. Good luck! A: * *Connect your device. *Run lsusb. *Disconnect your device and run it again. *Find your device hex by comparing both lsusb results:Bus 001 Device 013: ID xxxx:2765 and note the xxxx *Create a new rule:sudo nano /tmp/android.rules *Insert:SUBSYSTEM=="usb", ATTRS{idVendor}=="xxxx", MODE="0666" *Copy the rule:sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules *Change permissions:sudo chmod 644 /etc/udev/rules.d/51-android.rulessudo chown root. /etc/udev/rules.d/51-android.rules *Retstart ADB:sudo service udev restartsudo killall adb *Reconnect your device. *Test ADB: adb devicesList of devices attachedxyzxyzxyz device Source: pts.blog: How to fix the adb no permissions error on Ubuntu Lucid A: As suggested by Ethan, look at "lsusb" to locate the Mobii vendor ID. In the example below, 046d is the ID for Logitech. "0955" belongs to nVidia. Bus 001 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver Also, don't forget to restart udev after you've changed the 50-android.rules file.
unknown
d6385
train
I had a similar problem, which is fixed after installing latest release (3.3.2)
unknown
d6386
train
It would be a better option to create a custom view and do the drawing yourself. If u wanna stick with the viewgroup solution create a custom viewgroup and handle the measuring,layout pass yourself.
unknown
d6387
train
Yes, these distributed associative domains are new in 1.19 (which as of this writing will be released soon, but you can try them out using a master branch before then). The documentation for them here has an example: https://chapel-lang.org/docs/master/modules/dists/HashedDist.html
unknown
d6388
train
Well, i solved my problem... It was not a nuxt problem but a plesk/ IIS problem ( idle timeout iisnode exactly). If you have similar issue, have a look at this page : iisnode making the node process always working
unknown
d6389
train
It is due to the default interpolation which is set to 'bilinear'. I think 'none' would be a more intuitive default. You can change the default interpolation method (eg interpolation=None) with: mpl.rcParams['image.interpolation'] = 'none' More information about customising Matplotlib can be found on the website The code below will give you an overview of all interpolation methods: methods = [None, 'none', 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', \ 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos'] grid = np.random.rand(4,4) fig, ax = plt.subplots(3,6,figsize=(12,6), subplot_kw={'xticks': [], 'yticks': []}) fig.subplots_adjust(hspace=0.3, wspace=0.05) ax = ax.ravel() for n, interp in enumerate(methods): ax[n].imshow(grid, interpolation=interp) ax[n].set_title(interp)
unknown
d6390
train
The performance of a query on a single table that selects all rows is pretty much driven by the I/O cost. The I/O cost, in turn, is based on the number of data pages read by the query. In general, having an additional column will increase the size of rows. Fewer rows fit on fewer pages, so the query could be a bit faster. Now for caveats. Here are some: * *If C is a varchar that is always NULL, it occupies no extra space. *If C is varchar(max) (or really large) it might be stored on a separate data page. *If an index exists with (A, B) (in either order), then the query should use the index. Because the index covers the query, the number of data pages is irrelevant. *SQL Server does look aheads on I/O and can interleave I/O with other processing. So, you might not notice the additional CPU time spend reading the data pages. I wouldn't be inclined to simply remove columns to speed up such a query, unless the columns are not being used. The increase in speed -- if any -- is likely to be small. But there may exist cases where that would be a good idea from a performance perspective.
unknown
d6391
train
As it turns out, it was not a Code::Blocks issue - I had mistakenly un-installed the libstdc++6-4.4-dev_4.4.3 package. So, if any of you all get this same problem make sure the libstdc++ development files are installed! LOL
unknown
d6392
train
I had the same problem. In extension tab go to -Manage Extensions- -Installed- -Turn off Analysis services extension- Reopen Visual studio, turn Analysis services extension on. Reopen Visual studio. It worked for me :)
unknown
d6393
train
The <label> element should be used with form fields: most types of <input>, <select> and <textarea>. If has a for attribute that holds the id of the related element. So, if you click the label, the related element is focused. Example Usage at Jsbin <label for="textinput">Enter data here</label> <input id="textinput>" <input type="checkbox" id="checkbox"> <label for="checkbox">What this box does</label> <input type="radio" id="radio_opt1" name="radiogroup"> <label for="radio_opt1">Option description</label> <input type="radio" id="radio_opt2" name="radiogroup"> <label for="radio_opt2">Option description</label> <label for="select">Select an option</label> <select id="select"> <option>Some option</option> </select> <label for="textarea">Enter data into the textarea</label> <textarea id="textarea"></textarea> In <optgroup> elements, there is a label attribute, which is not the same as the label elements, although its function is similar: identifying a certain group of options: <select> <optgroup label="First group"> <option>Some option</option> </optgroup> <optgroup label="First group"> <option>Some option</option> </optgroup> </select> A: Label: This attribute explicitly associates the label being defined with another control. So the label attribute should use when you want to show some text or label for another controls like textbox, checkbox etc. And the important thing is When present, the value of this attribute must be the same as the value of the id attribute of some other control in the same document. When absent, the label being defined is associated with the element's contents. Look at here for the documentation A: No, it's not HTML5 exclusive:) Label could be used in connection with form element such as <input>, <select>, <textarea>. Clicking on label would automatically change focus to connected element. There are two ways connecting label with element: * *Put element inside label *Add for attribute for label, where for value is id of element need to be connected Example (taken from http://htmlbook.ru/html/label): <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>LABEL</title> </head> <body> <form action="handler.php"> <p><b>Lorem ipsum dolor sit amet...</b></p> <p><input type="checkbox" id="check1"><label for="check1">Lorem</label><Br> <input type="checkbox" id="check2"><label for="check2">Ipsum</label><Br> <input type="checkbox" id="check3"><label for="check3">Dolor</label><Br> <input type="checkbox" id="check4"><label for="check4">Sit amet</label></p> </form> </body> </html> A: It should be used in forms with other elements only. It can be before, after, or around existing form control. Here's an example by W3Schools. <form action="demo_form.asp"> <label for="male">Male</label> <input type="radio" name="sex" id="male" value="male"><br> <label for="female">Female</label> <input type="radio" name="sex" id="female" value="female"><br> <input type="submit" value="Submit"> </form>
unknown
d6394
train
Read the Cocoa Memory Management guide. You own an object only if the methods used to obtain it contains one of: * *new *alloc *retain *copy ... and you only need to release (i.e. relinquish ownership) if you own it. If you obtain an instance through a method not containing any of these, you don't own it and have to take ownership explicitly (using retain) if you need it. So, you need to alloc if you: * *want ownership or *if there is no convenience constructor available (and you thus have to use alloc/init) The initializer methods don't return autoreleased instances, they only initialize an allocd instance. A: initWithXXX: methods do not return autoreleased objects! somethingWithXXX: class methods, however, do. This is a convention (in that it's not compiler-enforced), but it's followed so closely that you can treat it as a hard rule. The Clang static analyzer will also complain if you don't follow it. requestWithURL: doesn't have "init" in the name. Also, requestWithURL: is called on the NSURLRequest class, whereas initWithRequest:delegate: is called on the NSURLConenction object returned by calling alloc on the NSURLConnection class. (I hope that all makes sense.) A: Please read the Memory Management Programming Guide. All of these are explained there. Also check out Learn Objective-C. Why do they need to call alloc on the connection but not on the request? Whenever you need to own an object to make it live longer than the function's scope, the object needs to be -retained. Of course you could use NSURLConnection* theConnection = [NSURLConnection connectionWithRequest:theRequest delegate:self]; but the connection will be -autoreleased. But because there's time for a connection to finish, this variable should be -retained to prevent the connection becoming invalid. Of course, then, you could do NSURLConnection* theConnection = [[NSURLConnection connectionWithRequest:theRequest delegate:self] retain]; But this is equivalent to +alloc → -init → -autorelease → -retain, the last two steps are redundant. Probably that's why Apple chooses to use +alloc/-init here. (BTW, this style would cause the static analyzer to complain. It's better to store theConnection as an ivar somewhere, e.g. in the delegate object.) On the other hand, the NSURLRequest is just a temporary object, so it needs to be -released when the function ends. Again, you could use NSURLRequest* theRequest = [[NSURLRequest alloc] initWithURL:...]; ... [theRequest release]; this is even more efficient, as the autorelease pool won't be filled up, but using this method one may forget to -release and cause a leak. But all "initWithXXX" functions return autoreleased objects instead. No, -init… should never return an -autoreleased object.
unknown
d6395
train
I used to do code coverage testing on assembly code and Java code. It is definitely worth it. You will find as you get the coverage close to 100% that it gets more and more difficult to construct tests for the remaining code. You may even find code that you can prove can never be executed. You will find code on the fringes that has never been tested and you will be forced to run multi user tests to force race conditions to occur, assuming that the code had taken these into account. On the assembly code, I had a 3000 line assembly program that took several months to test, but ran for 9 years without any bugs. Coverage testing proved its worth in that case as this code was deep inside a language interpreter. As far as Java goes I used Clover: http://www.atlassian.com/software/clover/overview This post: Open source code coverage libraries for JDK7? recommends Jacoco, but I've never tried it. A: Thanks for the pointers @Peter Wooster. I did a lot of digging into the clover documentation but unfortunately there is not even a good indication that functional / integration is supported by clover, leave alone a good documentation. Lucky I got to a link within the clover documentation itself which talks about this and looks promising (Thanks to Google search). I was using the ant so didn't even search in this Maven2 area. This talks about ant as well though :) https://confluence.atlassian.com/display/CLOVER/Using+Clover+in+various+environment+configurations I will be trying this , will update more on this soon !
unknown
d6396
train
The problem occurs because the function triggers every time an answer is clicked. When you select "No" on question 3, the variable x equals 0, so the function does it's job and hides link 1 and shows link 2. If you would like to use a button to submit the answer, your code would look like this: window.onload = function() { document.getElementById('link1').style.display = 'none'; document.getElementById('link2').style.display = 'none'; }; var x, y, z; function a1(answer1){ x = answer1; console.log(x); }; function a2(answer2){ y = answer2; console.log(y); }; function a3(answer3){ z = answer3; console.log(z); }; function showdiv() { if (x==1 | y==1 | z==1){ console.log("One of the questions is 1"); document.getElementById('link1').style.display='block'; document.getElementById('link2').style.display='none'; } else { console.log("None of the questions is 1"); document.getElementById('link1').style.display='none'; document.getElementById('link2').style.display='block'; } return; } <body> <label>Do you need equipment?</label> <input type="radio" onclick="a1(1)" name="q1">Yes <input type="radio" onclick="a1(0)" name="q1">No </br> <label>Do you need food?</label> <input type="radio" onclick="a2(1)" name="q2">Yes <input type="radio" onclick="a2(0)" name="q2">No </br> <label>Do you need help?</label> <input type="radio" onclick="a3(1)" name="q3">Yes <input type="radio" onclick="a3(0)" name="q3">No </br> <button onclick="showdiv()">Submit</button> <div id="link1"> Show Link 1 </div> <div id="link2"> Show Link 2 </div> </body> Hope this is useful.
unknown
d6397
train
You'll almost certainly find your C program is crashing but that Python is hiding that from you. Try instead with: print call(["./writenotes", "lolololol..."]) and see what you get as a return value. For example, this program tries to modify a string literal and, when run normally dumps core: int main (void) { *"xyzzy" = 'X'; return 0; } However, when run from the following script: from subprocess import call print call(["./testprog"]) I get the output -11, indicating that signal 11 (usually SIGSEGV) was raised, as per the documentation discussing Popen.returncode which subprocess.call() uses under the covers: A negative value -N indicates that the child was terminated by signal N (Unix only). An alternative to checking the return code is to import check_call and CalledProcessError instead of call and then use that function. It will raise an exception if the return code is non-zero. That's probably not so important if you're only calling one executable (just get the return value in that case) but, if you're doing a lot in sequence, catching an exception from the entire group may be more readable. Changing the C program to only crash when the first argument is 3: #include <stdio.h> #include <string.h> int main (int argc, char *argv[]) { if (argc > 1) { printf ("hello there %s\n", argv[1]); if (strcmp (argv[1], "3") == 0) *"xyzzy" = 'X'; } return 0; } and the script to call it with several different arguments: from subprocess import check_call, CalledProcessError try: check_call(["./testprog", "0"]) check_call(["./testprog", "1"]) check_call(["./testprog", "2"]) check_call(["./testprog", "3"]) check_call(["./testprog", "4"]) check_call(["./testprog", "5"]) check_call(["./testprog", "6"]) check_call(["./testprog", "7"]) check_call(["./testprog", "8"]) check_call(["./testprog", "9"]) except CalledProcessError as e: print e.cmd, "failed with", e.returncode else: print "Everything went well" shows that in action: hello there 0 hello there 1 hello there 2 hello there 3 ['./testprog', '3'] failed with -11
unknown
d6398
train
well, I look your situation, I did a example about it, It work for me! I have created a Bean similar to your bean. @ViewScoped @ManagedBean(name="clockBean") public class clockBean implements Serializable{ private int number; public void increment(){ number++; } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } } Besides I created a simple web page <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:pe="http://primefaces.org/ui/extensions"> <ui:composition template="/layout/template.xhtml"> <ui:define name="body"> <h:form id="form"> <p:poll interval="1" listener="#{clockBean.increment}" update=":form" /> <p:outputLabel value="#{clockBean.number}" /> </h:form> </ui:define> </ui:composition> </html> It has worked for me, I hope it can help you!. I think that your problem is that you need use id for the different components in your web page for exaMple the component form, it should has a id. A: Adding <h:outputScript library="primefaces" name="primefaces.js" /> inside h:body solved for me. I'm using PrimeFaces 5.1.20 A: For me, adding this line to <h:body> helped: <h:outputScript library="primefaces/poll" name="poll.js" /> A: Have you debugged the actual navigationTo.increment method, and checked that the poll actually goes inside? It seems that you are missing attributes inside the poll, if you want to trigger the back end method, and start the actual poll as soon as you load the page, add this: process="@this" autoStart="true"
unknown
d6399
train
This happens because f will be null if the value is not found in the map. Try this, inside the for loop. Integer f = histogram.get(word); if (f == null) { histogram.put(word, 1); } else { histogram.put(word, f+1); }
unknown
d6400
train
Changing the json as below has solved the issue. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "cognito-identity.amazonaws.com", "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "cognito-identity.amazonaws.com:aud": us-east-1:*****-*****-*****" }, "ForAnyValue:StringLike": { "cognito-identity.amazonaws.com:amr": "unauthenticated" } } } ] }
unknown