input
stringlengths
51
42.3k
output
stringlengths
18
55k
async await advantages when we have enough threads <p>I understood that .net <a href="http://stackoverflow.com/a/657748/3202422">know to use multiple threads</a> for multiple requests.</p> <p>So, if probably our service wont get more request than the number of threads our server can produce (it look like huge number),...
<blockquote> <p>Am I right?</p> </blockquote> <p><strong>No</strong>, doing multiple independent blocking operations, is the job of Concurrent APIs anyway (though sometimes they need Synchronization (like <strong>lock, mutex</strong>) to maintain the object state and avoid Race condition), but the usage of <strong>A...
Azure Table Storage PHP Error <p>This is my PHP code</p> <pre><code>&lt;?php // Load Azure Drivers require_once '../vendor/autoload.php'; use WindowsAzure\Common\ServicesBuilder; use MicrosoftAzure\Storage\Common\ServiceException; use MicrosoftAzure\Storage\Table\Models\QueryEntitiesOptions; // Connection String $c...
<p>Generally speaking, you are trying to <code>echo</code> an object which raised this issue. As the <code>$entity</code> in your looping statement is an object, you cannot directly <code>echo</code> it.</p> <p>The <a href="https://github.com/Azure/azure-storage-php/blob/master/src/Table/TableRestProxy.php#L985" rel="...
Is it possible to add a SKSpriteNode to a scene from another class? <p>Is it possible to add a SKSpriteNode to a scene from another class?</p> <p>*These are examples</p> <p>So I have a SKScene with a custom class ..</p> <pre><code>class MainMenu: SKScene { code... } </code></pre> <p>And another SKScene with a ...
<p>Look into <code>SKReferenceNodes</code>, you can create your popup menu via the SpriteKit Scene Builder, then save this as an sks file. When it comes time to use it, you just pull up the file of the popup menu, and add it to the scene.</p> <p>Source: <a href="https://developer.apple.com/reference/spritekit/skref...
Kernel Panic with ramfs on embedded device: No filesystem could mount root <p>I'm working on an embedded ARM device running Linux (kernel 3.10), with NAND memory for storage. I'm trying to build a minimal linux which will reside on its own partition and carry out updates of the main firmware. </p> <p>The kernel uses a...
<p><strong>SOLVED!</strong> It turned out that a file name used by the (custom) build system had changed as part of an update, and so it was not putting the correct kernel image into the firmware package. I was actually trying to boot the wrong kernel with the "rootfs=ramfs" parameter, one which didn't have a ramfs. </...
Getting an error in Java when trying to system.out.println("") 'class' or 'interface' expected in Intellij <pre><code>public class Hello { public static void main(String[] args) { System.out.println("wiggle house"); } } </code></pre> <p>I can run the code and I get the string printed, the only problem...
<p>If you are using your code </p> <pre><code>public class Hello { public static void main(String[] args) { System.out.println("wiggle house"); } } </code></pre> <p>the your file name should be Hello.java or else you are not making it public as the code below also run without error even if the file name is di...
forwarding all requests from one port to another nginix <p>can i please know how to forward all the requests coming from port 80 to 443? my code:</p> <pre><code>server { listen 80; root /var/www/html/; index index.html index.htm index.php; server_name myexample.com; location / {...
<p>Redirect HTTP to HTTPS</p> <pre><code>server { listen 80; server_name myexample.com; return 301 https://$host$request_uri; } server { listen 443; root /var/www/html/; index index.html index.html index.php; server_name myexample.com; } </code></pre>
Perl LWP returns JSON output as string <p>I am using Perl LWP::UserAgent to get response from an API. Everything works good except one issue. </p> <p>The API that i am using it returns response in JSON format. But I am getting it as string when i get the response through LWP module, Something like below.</p> <pre><co...
<p>You need to decode the JSON string into a Perl data structure. If your version of perl is 5.14+, <code>JSON::PP</code> is included in core, so nothing to install.</p> <pre><code>use warnings; use strict; use Data::Dumper; use JSON::PP qw(decode_json); my $json = '{"status":"success","data":[{"empid":"345232","cus...
Rule of three for inner class, outer class <p>Suppose I have class that is defined like</p> <p><em>A.h</em></p> <pre><code>#ifndef A_H #define A_H #include &lt;vector&gt; class A { int n; std::vector&lt;A::B&gt; elements; public: A(); A(int); class B { int m; ...
<blockquote> <p>How should I define copy constructors, overloaded assignment operators, and destructors such that I avoid infinite recursion on deletion, and that I avoid, if possible, having to use new</p> </blockquote> <p>Ownership of <code>A::elements</code> is determined by your declaration. <code>~A</code> is g...
Initializing many objects in an elegant way <p>I'm looking for a elegant way to initialize many objects.</p> <p>Let's say that I have a <code>Utils</code> module, which has an interface to SVN, Git, Make and other stuff.</p> <p>Currently, I'm doing it like this:</p> <pre><code>from Utils.Config import Config, Proper...
<p>I wouldn't create a class and place it as a base, <em>that seems like overkill, too bulky of an approach</em>.</p> <p>Instead, you could create an auxiliary, helper, function that takes <code>self</code> and <code>setattr</code> on it. An example of this with a couple of objects from <a href="https://docs.python.or...
How to scan values in from keyboard- JAVA <p>I'm trying to make a code where the user enters to numbers, and the if statement compares the values to give an output. I feel the error is in how I am scanning the numbers. Any suggestions? (also sorry for the noob question, just starting to learn java)</p> <pre><code>publ...
<p>Error: Two scan variables and variables firstNumber and secondNumber doesnt have types.</p> <pre><code>public class MarvinsRoom { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter Integer Value"); int firstNumber = scan.nextInt(); ...
Django form with ModelChoiceField is always invalid <p>Below is the relevant part of my template. I'm trying to send the selected field from a dropdown to my form.</p> <pre><code>&lt;form action="character_chat" method="post"&gt; &lt;select id="character_name"&gt; {% for character in characters %} ...
<p>You should just use <code>{{ form.character_name }}</code> in your template. There's not need to create an html select element because Django gives you this for free. Furthermore, Django actually uses the <code>name</code> HTML attribute, not <code>id</code>. Also, if you wanted to do it like this without using <cod...
postgres - bigint out of range error, which datatype to use for very large numbers <p>I am trying to store some hashes (originally in hexadecimal) but I cast them to int to save in pgsql but get </p> <pre><code>select 12347933502038296527::bigint ERROR: bigint out of range ********** Error ********** ERROR: bigint o...
<p>Bigint's are pretty big. It is unusual to need anything larger than that. In most databases, that is as far as you can go with a native binary representation. <code>Decimal</code>/<code>numeric</code> often allows a slightly larger precision.</p> <p>Postgres, by contrast, supports <code>numeric</code>/<code>deci...
Generate form with simple_form view erb <p>I'm trying to generate a for with simple_form. I have the gem in Gemfile, ran <code>bundle install</code> and <code>generate simple_form:install</code></p> <p>This is new.html.erb : </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&g...
<p>I guess that you missed <code>=</code> in this code: <code>&lt;% simple_form_for @post do |f| %&gt;</code>. You can do this as follows:</p> <pre><code>&lt;body&gt; &lt;%= simple_form_for @post do |f| %&gt; &lt;%= f.input :image %&gt; &lt;%= f.input :caption %&gt; &lt;%= f.button :submit %&gt; &lt;% end %&...
Code Sign Error on Xcode 8 and iOS 10 Cordova Project <p>I have a cordova project which I build and run locally deploying it on my iPhone and android device.</p> <p>However after i have upgraded to <code>Xcode 8</code> and my iPhone <code>iOS</code> to <code>iOS 10</code>, I cant build ipas locally. It fails with the ...
<p>As dpogue pointed out, cordova fixed this issue with the commit </p> <blockquote> <p>92a62997adb3c8512328d5a0ae42fe5d156291f1</p> </blockquote> <p>which is in the master branch of their iOS platform repository.</p> <p>To benefit from this fix, you'll have to install the latest dev version like this</p> <pre><c...
Jmeter: how do I click confirmation email link? <p>my performance test includes </p> <ol> <li>A regex to extract confirmation email from gmail client, and then </li> <li>I have an http request that renders the confirmation url So mail Reader Sampler includes REgex extractor as child Then http request page to use the v...
<p><strong>Short answer:</strong> we can't click using Jmeter, instead we capture and send the url (i.e., to be clicked/submitted) using http sampler. i.e., simulate the HTTP request, that is triggered when you click Confirmation email link.</p> <p><strong>Long answer:</strong> </p> <ol> <li>Capture the url (confirma...
Node.js loads locally but not on heroku <p>I'm pretty new to Heroku and am having some trouble getting my simple node app up and accessible. </p> <p>I can run the app locally fine but once it's pushed to Heroku, I get Application Error. </p> <p>I've added a Procfile as well as a 'start' value in my package.json but r...
<p>Adjusting the app.listen() call to accept any ip has resolved the issue in case anyone comes across a similar problem. </p> <p><code>app.listen(process.env.PORT, '0.0.0.0', function(err) { console.log("Started listening on %s", app.url);</code></p>
Is there any linker flag that tells to defer the loading of dynamic library after dlopen <p>I have following code</p> <ol> <li><p>File <em>hello.cc</em></p> <pre><code>static A dummyl; A:: A() { fun(); } void A::fun() { int y = 10; int z = 20; int x = y + z; } </code></pre></li> <li><p>File <em>...
<blockquote> <p>Is there any flag for linker g++ that tells compiler to load the shared library only after _dlopen _?</p> </blockquote> <p>Yes. On Windows. It's known as delay loading. It doesn't exist on Linux/OS X. It's possible to implement it, but it'd require modifications to binutils and <code>ld.so</code>. Se...
Notice: Undefined offset: 0 - PHP - Foreach <p>I am creating a calendar for one of my sites, I have an array as follows.</p> <pre><code>array(2) { [2017]=&gt; array(1) { ["01"]=&gt; array(1) { [0]=&gt; object(stdClass)#5374 (4) { ["ID"]=&gt; string(3) "409" ["data"]=&gt; string(10) ...
<p>I'm goign to take a stab in the dark with the lack of proper code in your question and assume this error is being caused when you try and do <code>array[09]</code> to access your <code>array("09" =&gt; array())</code>. these wont work because 09, and 08 = 0.</p> <p>why? this is because when you prefix an integer wi...
Detecting multiple array coordinates in canvas <p>Hello fellow programmers,</p> <p>Today I have a question that's related to one of my projects I'm making kinda like Tower Defense using canvas. However, I stuck on trying to detect multiple circles in one coordinate. Here's my example:</p> <pre><code>for (var a = 0; a...
<p>You can use an integer to store the value of how many defenses are in range and increment it whenever a defense has been found in range.</p> <p>Also, you must use 2 different variables when nesting loops.</p> <pre><code>this.defensesInRange = 0; for (var x = 0; x &lt; buildArcherX.length; x++) { for (var y = 0...
Weird behavior when dividing hex numbers <p>I'm struggling with a really weird situation that I can't explain.<br> Basically I don't understand why results of modulus or division between two hex numbers are wrong (I'm using <code>C</code>). </p> <p>I have a variable <code>time</code> which is a <code>32bit unsigned i...
<p>Using the following program I get good output:</p> <pre><code>#include &lt;stdio.h&gt; unsigned int res = 0, div = 0, time = 0x1300; // global variables unsigned int valueChecker() { if (time &gt; 0x1388) { div = time / 0x1388; printf( "Div: %u\n", div ); res = time - (0x1388 * div); ...
Update realm table <p>I was just wondering if what I'm doing to update a entire table in realm is the correct safe approach. I receive a list of conversations from the server and update my db like this:</p> <pre><code>@Override public void saveConversations(final List&lt;Conversation&gt; conversations) { realm.exe...
<p>Don't forget that you're executing a transaction, so if <code>copyToRealmOrUpdate()</code> fails, then the transaction is <strong>cancelled</strong>, which means you wouldn't lose all your data.</p> <p>Personally, I used to go with the "delete all" approach, and if you can clear out all tables then it won't cause i...
Aurelia array observation doesn't react on array[index] = newItem <p>I use surprised why my repeat.for binding doesn't react on array change. Then I found out Aurelia array observation doesn't react on array[index] = newItem.</p> <p>This is confirmed when I read the spec <a href="https://github.com/aurelia/binding/blo...
<p>This is offcially unsupported in Aurelia.</p> <p><a href="https://github.com/aurelia/binding/issues/509" rel="nofollow">https://github.com/aurelia/binding/issues/509</a></p>
PHP Header('Location: XYZ'); to locate to a div <p>going to keep this short! So I've got a login/registration page and when a user registers to the site I want them to be shown the login page. Please note it's ONE page with the login and registration side by side, and when one is clicked it's shown whilst the other one...
<p>You're almost there Lewis. The only thing to note with <code>header("Location: [...]");</code> and using an anchor like <code>#login</code>, is that it's going to try and find <code>&lt;.... id="login"&gt;</code> and scroll to that. It doesn't do what you want without slight modification within jQuery.</p> <pre><co...
How rewrite all JS, CSS, IMG to static subdomain? <p>I have:</p> <pre><code>sub.domain.com/js/test.js sub.domain.com/image1.jpg sub.domain.com/test.css </code></pre> <p>How rewrite all the file types to:</p> <pre><code>static-sub.domain.com/.... </code></pre> <p>?</p> <p>Thanks a lot.</p>
<p>Something akin to what's below should work.</p> <pre><code>RewriteEngine on RewriteRule ^sub\.domain\.com/(js/*\.js)$ static-sub.domain.com/$1 [NC,R,L] RewriteRule ^sub\.domain\.com/(*\.jpg)$ static-sub.domain.com/$1 [NC,R,L] RewriteRule ^sub\.domain\.com/(*\.css)$ static-sub.domain.com/$1 [NC,R,L] </code></pre> <...
Java debugging on Eclipse: Weird Error: StringIndexOutOfBoundsException <p>I encountered a weird occurrence while debugging in Eclipse. I am debugging the following method. </p> <pre><code>private String parseMessage(String msg, String uptoWord) { String adjusted = msg.replaceAll("(\r?\n|\r)", " ").trim(); adj...
<p>As per <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#substring-int-int-" rel="nofollow">Java docs for subString</a> , because of bad values of beginIndex and endIndex you are getting that error.</p> <blockquote> <p>IndexOutOfBoundsException - if the beginIndex is negative, or endIndex...
How to call a method from a class with inheritence on an object of the base class? <p>I have two classes. One inherits the other:</p> <pre><code>class A(object): def __init__(self): self.attribute = 1 class B(A): def get_attribute(self): return self.attribute </code></pre> <p>I would like to ...
<p>While it is discouraged to do you can use any method like a function. In your case it would be</p> <pre><code>B.get_attribute(a) </code></pre> <p>Of cause the method has to be compatible with the type of <code>a</code>.</p>
i3 WM (tiling manager) create popup window <p>When I make a pygame window (I believe it uses SDL), it launches as a popup window, as I want, since then it doesn't affect the layout or visibility of elements. But if I launch a simple program using GTK and Cairo, it doesn't launch as a popup. Is there some specific env f...
<p>To do this in GTK, you need to call</p> <pre><code>gtk_window_set_type_hint((GtkWindow*)windowname, GDK_WINDOW_TYPE_HINT_DIALOG); </code></pre> <p><a href="https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-set-type-hint" rel="nofollow">https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-wind...
How do I place an object on a layout screen in android? <p>I am trying to earn how to control where I place an object when developing android layouts. It seems like a natural way to do this would be to pick a layout like "GridLayout" and then place the object where I want it. </p> <p>However, every time I choose grid ...
<p>You can use Relative layout to place your object anywhere you want.</p> <p>Or you can use latest Constraint layout.</p>
Can't get Node.js Express code to say 'Hello World' in Cloud 9 <p>Been experimenting with Cloud 9 and have been trying to use the example code from the <a href="http://expressjs.com/en/starter/hello-world.html" rel="nofollow">Express website</a> in order to get 'Hello World!'. I tried listening to several different po...
<p>You should run the app.js from the c9 command, which is just below, in the editor. Cloud9 has it's own default path to run. Default like something : </p> <p><strong><a href="https://helloexpress-abcd.c9.io/" rel="nofollow">https://helloexpress-abcd.c9.io/</a></strong> <strong>helloexpress ' is the project name u de...
'int' object has no attribute '__getitem__' on a non-integer object <p>In looking at other answers to this issue I found that the object was usually an integer so i constructed a simple example showing it is not and integer (or so I think), <strong>this code:</strong></p> <pre><code>import numpy as np a=np.arange(2,10...
<p>If you want the size of <code>a[3:]</code> then try:</p> <pre><code>&gt;&gt;&gt; a[3:].size 5 </code></pre> <p>By writing <code>a.size[3:]</code> what you are trying to do is <code>index</code> over an <code>integer</code> as <code>a.size</code> is an <code>integer</code>.</p>
Sum of digits in an integer using SML <p>I'm trying to create a function that will sum the digits of an integer in SML but I'm getting the following error.</p> <pre><code>Error: operator and operand don't agree [overload conflict] operator domain: real * real operand: [* ty] * [* ty] in expression: n...
<p>Looks like you have a few things wrong. To start, you'll want to use "div" rather than "/" when dividing integers. / is for reals. Also, trunc is a function for reals. 3rd, you'll want your recursive logic to just be sumDigits(n div 10), not sumDigits(n div (d*10)). You can also clean up the code by removing the d v...
Access PDF files in my app IOS <p><strong>Ultimate Goal: upload pdf to AWS S3 server</strong></p> <p><em>Where i am now:</em></p> <p>I've been developing on IOS for over a month now and one thing it lacks is access to a simple file management system. Coming off of Android I could simply open a view which would let me...
<p>you can use document picker to pick documents from icloud and outside app's sandbox.</p> <p>you can get reference of document picker here <a href="https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/DocumentPickerProgrammingGuide/Introduction/Introduction.html" rel="nofollow">Documen...
nodejs and jquery - passing and saving a binary file <p><strong>What I'm trying to do</strong> </p> <p>Upload a binary file (a .docx in this case) from the browser and save it on the server. Using NodeJs/ExpressJS on the server.</p> <p><strong>Issue</strong> </p> <p>I can successfully pass text files (.json/.txt/.cs...
<p>Don't read it as arrayBuffer with the FileReader, just send the blob as is</p> <pre><code>var file = new Blob(["321"]) $.ajax({ type: 'POST', url: '/upload.php', data: file, processData: false, contentType: false }) </code></pre>
How to profile "external" DLL code in Visual Studio 2015 <p>I have a DLL that I've built using a separate solution/project that I've embedded into my project. When profiling CPU speed, I find that the DLL marked as "external code" is a considerable contribution to the overall slowness of my program. Is there any way ...
<p>Solution was this:</p> <ul> <li>add the existing vcxproj from the external sln into my project</li> <li>profile</li> <li>click the filter box and then check "show external code"</li> <li>profit</li> </ul> <p>last one is optional</p>
Truncate string in Julia <p>Is there a convenience function for truncating strings to a certain length?</p> <p>It would equivalent to something like this</p> <pre><code>test_str = "test" if length(test_str) &gt; 8 out_str = test_str[1:8] else out_str = test_str end </code></pre>
<p>In the naive ASCII world:</p> <pre><code>truncate_ascii(s,n) = s[1:min(sizeof(s),n)] </code></pre> <p>would do. If it's preferable to share memory with original string and avoid copying SubString can be used:</p> <pre><code>truncate_ascii(s,n) = SubString(s,1,min(sizeof(s),n)) </code></pre> <p>But in a Unicode w...
Jenkins Plugin - private git - automatic mode webhook <p>I am actually coming from to this question <a href="http://stackoverflow.com/questions/36500729/jenkins-github-plugin-cant-choose-my-credentials/36501288#36501288">Jenkins Github Plugin can&#39;t choose my credentials</a>. I followed the steps of integrating gith...
<p>The <a href="https://wiki.jenkins-ci.org/display/JENKINS/Github+Plugin#GitHubPlugin-AutomaticMode(Jenkinsmanageshooksforjobsbyitself)" rel="nofollow">Step 2.2</a> mentions:</p> <blockquote> <p><strong>Note that credentials are filtered by entered GH url with help of domain requirements</strong>.<br> So you can ...
How to automatically input using python Popen and return control to command line <p>I have a question regarding subprocess.Popen .I'm calling a shell script and provide fewinputs. After few inputs ,I want user running the python script to input.</p> <p>Is it possible to transfer control from Popen process to command l...
<p>As soon as your last <code>write</code> is executed in your python script, it will exit, and the child shell script will be terminated with it. You request seems to indicate that you would want your child shell script to keep running and keep getting input from the user. If that's the case, then <code>subprocess</co...
How to show Interstitial ad on a webview app? <p>I want to show Interstitial ad on a webview app and make the ad opens immediately after openning a page (article) as admob policies said to me to make the ad appear in normal transition points.</p> <p>Can you show me how to do that?</p> <p>And I want also to know how t...
<p>If you are using a framework like Cordova/Phonegap/Ionic your best chance is to use a plugin: <a href="https://github.com/appfeel/admob-google-cordova/" rel="nofollow">https://github.com/appfeel/admob-google-cordova/</a></p> <p>Otherwise you can try to get the plugin and remove cordova dependencies, and refactor it...
belongsTo Relation with where condition? <p>I need to do a where condition in my query using belongsTo relation </p> <p>My relation is:</p> <pre><code> public function user() { return $this-&gt;belongsTo('App\User', 'user_id'); } </code></pre> <p>My query is:</p> <pre><code>Post::with('user')-&gt;where('user....
<p>This can be done with <a href="https://laravel.com/docs/5.3/eloquent-relationships#constraining-eager-loads" rel="nofollow">Constraining eager loads.</a> Something you've already used in your codes.</p> <pre><code>Post::with(['user'=&gt;function($query) { $query-&gt;where('blocked', '&lt;&gt;', 1) }])-&gt...
Appium support with Xcode 8 <p>I have been facing issues with launching instrumentation using Appium and Xcode 8. I recently got to know that apple has removed automation from instrumentations because of which Appium(1.5.3) is not able to not working correctly. Does anyone have a solution to it? Is it going to be fixed...
<p>Yes, Instruments/UI Automation aren't supported by Xcode 8 anymore, so the Appium won't work with it. Now it has to support XCUITest, which replaces UI Automation.</p> <p>Appium community is working on the new iOS Driver - now it is <strong>XCUITest Driver</strong>.</p> <blockquote> <p>Advantages of the new XCUI...
Paper-fab partially hides behind app-toolbar <p>I want to import an element that contains a <code>paper-fab</code> and have the <code>paper-fab</code> overlap the seam between the <code>app-header</code> element and the imported element. (In this case, I'm calling the imported element a <code>fab-element</code>). In ot...
<p>Per @robodna on <a href="http://polymer.slack.com" rel="nofollow">Polymer Slack Site</a> provides the following answer:</p> <p>Set <code>z-index:2!important</code> on <code>#contentContainer</code>. <a href="http://jsbin.com/mitegigose/edit?html,output" rel="nofollow">See this jsBin</a>.</p> http://jsbin.com/miteg...
Get cookie from InternetExplorer object <p>I'm working a VBA project uses the following code to automate IE. How can I able to get cookies from current IE session?</p> <p>Sub IE()</p> <pre><code>Dim objIE As InternetExplorer Set objIE = CreateObject("InternetExplorer.Application") objIE.Visible = True objIE.Navigate...
<pre><code>getCookie = objIE.document.Cookie </code></pre>
Mapbox Studio edit of style updated via REST API <p>We created a dataset, tileset, and style via Mapbox Studio</p> <p>It was very simple with only one colored layer.</p> <p>Then we used the REST API to add many layers.</p> <p>For example, (reference see: <a href="https://www.mapbox.com/api-documentation/#update-a-st...
<p>it is possible that you are using the REST API to update the published version of the style, but you're viewing the draft version of the style when you attempt to edit the style in Mapbox Studio. Try using the 'revert draft to last published' action from the list or style view page:</p> <p><a href="http://i.stack.i...
saving unique session variables in loop <p>I'm trying to loop through files in a directory, display them on a webpage, and save a unique session variable for each file, which I can then access on a separate php file that is called when the file is clicked.</p> <pre><code>if (is_dir($myuploadfolder)) foreach (scandir($...
<p>In the for loop you could have form instead of href like so</p> <pre><code>echo"&lt;form action='openFile.php' method='post'&gt;"; //... //add a radio button for each file perhaps echo"&lt;input type='submit' value='submit' name='do something with $filename' /&gt;"; </code></pre> <p>This is just an outline of what...
Python Turtle - Is it possible to prevent the crash at the end <p>this is my code. I am using the turtle module to just write some text on the screen for a project for school. But whenever I do this, the program crashes/stops responding and I was wondering if it is possible to prevent this from happening.</p> <pre><co...
<p>Your code hasn't crashed, it just ran out of code to process. The code that is there is working fine and as expected.</p> <p>To see what I mean add:</p> <pre><code>print("END") #Python 3 print "END" #Python 2 </code></pre> <p>to the end of your code. You will see the console prints the word "END" after your text...
How can one update GTK+ UI in Vala from a long operation without blocking the UI <p>When I use any of the codes in this page without modifying anything: <a href="https://wiki.gnome.org/Projects/Vala/AsyncSamples" rel="nofollow">https://wiki.gnome.org/Projects/Vala/AsyncSamples</a></p> <p>I always get: <code>warning: â...
<p>It's perfectly fine to use async and there's <a href="https://bugzilla.gnome.org/show_bug.cgi?id=763345" rel="nofollow">some work already</a> for porting the current code to use GTask.</p> <p>Your counting code is blocking, so even if its execution is cushioned with GTask, it will still block the UI.</p> <p>The co...
How to add an SVG file into HTML canvas element with dynamic dimensions? <p>I'm having trouble with my web-based game. I try to draw an SVG that I've encoded into a data URL into a canvas that's supposed to have the same dimensions as the document window, even while rescaling the actual window.</p> <p><div class="snip...
<p>Firstly, <a href="https://css-tricks.com/probably-dont-base64-svg/" rel="nofollow">SVG's can be data url encoded</a>.</p> <p>Secondly, <a href="http://stackoverflow.com/questions/988363/how-can-i-debug-my-javascript-code">Learn how to debug JavaScript</a></p> <p>Thirdly, I refactored/fixed your JavaScript:</p> <p...
understanding dc.js charts interactivity better with fiddle example <p>here is my sample <a href="https://jsfiddle.net/HattrickNZ/hcfhds0a/1/" rel="nofollow">fiddle</a> </p> <p>It is a 2 basic chart dc.js charts. What I am trying to understand is how the charts interact with each other. For instance: </p> <p>If i sel...
<p>I'll answer only edit1, since your original question seems pretty broad.</p> <p>There are two important facts here:</p> <ol> <li>Data comes from groups, and filters are applied through dimensions. You might think of the group as the view, the dimension as the controller, and the crossfilter as the model. Crossfilt...
SQL Script run on this server but don't on other server <p>I have an weird issue with SQL Server. I have a small trigger that makes a request to a web service on update.</p> <p>I have tested that code, it worked fine.</p> <p>But when I move that code to another SQL Server machine, it does not run. No error are raised...
<p>I found the problem A known bug with "msxml3.dll": <a href="https://support.microsoft.com/en-us/kb/2968741" rel="nofollow">https://support.microsoft.com/en-us/kb/2968741</a> And this link helps me alot: <a href="http://www.sqlservercentral.com/scripts/Miscellaneous/30867/" rel="nofollow">http://www.sqlservercentral....
Why would assembly POPCNTQ benchmark slower than native Go functions using integer tricks? <h3>ASM version</h3> <pre><code>TEXT ·CountBitsUint64PopCnt(SB),NOSPLIT,$0 POPCNTQ x+0(FP), AX MOVQ AX, ret+8(FP) RET </code></pre> <h3>Go Version</h3> <pre><code>const ( m1q uint64 = 0x5555555555...
<h2>Solution</h2> <pre class="lang-none prettyprint-override"><code> // popcount_test.go:226 func BenchmarkCountBitsUint64(b *testing.B) { + stopDeadCodeElimination := 0 for i := 0; i &lt; b.N; i++ { - CountBitsUint64(uint64(i)) + stopDeadCodeElimination |= CountBitsUint64(ui...
Issues with diff(f,x,n) in MacLaurin series <p>We had an assignment asking us to estimate <code>exp(2)</code> using <em>MacLaurin series</em> and I've taken it a bit further trying to develop and function where you can input an equation, the value of <code>x</code> you wish to estimate and to how many significant figu...
<p>There are a couple of things wrong with the code (other than the syntactic error at the end of the while loop which I've edited). The first is the line where f(x) = beenDiff. beenDiff is supposed to be the n'th derivative, so if you make this assignment, diff actually becomes the (n!)th derivative. Removing the l...
XPath : Attribute Compare <p>I am looking for a solution to frame xpath logic to compare attributes.</p> <pre><code>&lt;menucontainer id="menu1" op="o3" indicator="highlight"&gt; &lt;menubox&gt; &lt;menutitle&gt;TITLE&lt;/menutitle&gt; &lt;menuoptionlist&gt; &lt;menuoption id="o1"&gt;Select a path from below :&lt;/men...
<p>To return the node <code>menuoption</code> where the value is IMAGE2, based on the menuoption attribute <code>id</code> being equal to the menucontainer attribute <code>op</code> you can use the following XPath Selector <code>//menucontainer/menubox/menuoptionlist/menuoption[@id=../../../@op]</code></p> <p>The <cod...
Alloy : pre-order traversal of binary tree in required ordering <p>I want a "pre-order" traversal of the nodes in BinaryTree visits them in this order [N0,N1,N2,N3] What should I do with the following structure?</p> <pre><code>one sig Ordering { // model a linear order on nodes first: Node, // the first node in th...
<p>Your question has 2 part. First, define ordering for N0, N1....... Second, define symmetry break using Linear ordering.</p> <p>First, you can define ordering by list all the valid relationship, like</p> <pre><code>`N0.(Ordering.order) = N1` </code></pre> <p>Second, define the predicate that pre-order of tree fo...
PHP: Generate QR Code with some descriptive text beside or below it <p>Well, I was able to generate a QR code (dynamically) using <a href="http://phpqrcode.sourceforge.net/" rel="nofollow">http://phpqrcode.sourceforge.net/</a> API.Now, I am stuck with another requirement where I need to add some text beside or below th...
<p>If you are displaying the QR codes on a web page, just add another div with the logo and or text. If your goal is to produce a single image you can download and you want to produce it from your script you can use <a href="http://image.intervention.io/" rel="nofollow">http://image.intervention.io/</a></p> <p>It is ...
Sync failed - Could not find com.google.android.gms:play-services:9.4.0 <p>I tried to run a project which was generated on someone else's PC, but sync fails and I get this error when cleaning the project:</p> <pre><code> Error:A problem occurred configuring project ':app'. &gt; Could not resolve all dependencies for ...
<blockquote> <p>was generated on someone other's PC on mine</p> </blockquote> <p>They probably have the SDK repositories installed and you do not. </p> <p>Seems like you are missing the Google Play Services Repository. </p> <p><a href="http://i.stack.imgur.com/ifzca.png" rel="nofollow"><img src="http://i.stack.img...
Voice to Text on iOS10? <p>I'm Deaf and curious if there is the possibility to point the iPhone toward a speaker and see its text on the screen?</p> <p>Not sure if iOS10 comes with that Voice to Text functionality or if an external app is required for this?</p> <p>Thanks for any suggestions!</p>
<p>As developer's point of view in ios 10 there is <strong>speech.framework</strong> which can use to convert voice to text</p> <p>for reference you can refer <a href="https://developer.apple.com/reference/speech" rel="nofollow">speech.framework</a></p>
Solr: indexing fb2 files <p>I want to use Solr for indexing some library, that represent books in fb2 format. In fact fb2 is just xml with similar <a href="http://www.fictionbook.org/index.php/Eng%3AXML_Schema_Fictionbook_2.1" rel="nofollow">xsd format</a>. But, post.jar ignores *.fb2 files, and I dont understand how t...
<p>You should look at the Solr Data Import Handler (DIH).</p> <p><a href="https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler" rel="nofollow">https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler...
Unable to rotate an image in clockwise direction in unity c# <p>I have an image to be rotated in a pivot point(top) through animation. I am able to rotate it in <strong>anti-clockwise direction</strong> by simply changing the <strong>z-rotation value.</strong> <strong>But I want to rotate an image in clockwise directio...
<p>You could lerp the angle (single float) instaed of the entire rotation. Lerp from your min angle to max angle and just directly set ,rotation = Quaternion.Euler(0,angle,0).</p> <p>There shouldn't be any issue with wrapping from 0 to 360; those are the same rotation (and so are 720 and -360, etc).</p> <p>(you can't...
Android use Intent to send a list of Parcelable objects which contain a list of another Parcelable objects <p>In my Android app, I want to use <code>Intent</code> to pass a list of <code>SingleGroup</code> to another <code>Activity</code> where each <code>SingleGroup</code> object contains a list of <code>SingleImage</...
<p>You must be pass SingleImage.CREATOR into method readTypedList instead of "null" value</p> <pre><code>private SingleGroup(Parcel in) { myTitle = in.readString(); groupDesc = in.readString(); //problem maybe here in.readTypedList(images, SingleImage.CREATOR); } </code></pre>
why does the attr() work and text() doesn't under the same situation? jQuery <ol> <li><p>Sorry for the poor title.</p></li> <li><p>I have assigned selectors to my variable and chain it with <code>attr()</code> and then a different place and chain it with <code>text()</code> but the <code>text()</code> part doesn't work...
<p>In your case the <code>$(this).closest('label')</code> inside the <code>each</code> is not the same as <code>var $closestLabel = $(this).closest('label');</code></p> <p><code>this</code> inside the <code>.each</code> is one of the elements matched by the selector <code>".credit-error-msg"</code></p> <p>While <code...
Numpy: Single loop vectorized code slow compared to two loop iteration <p>The following codes iterates over each element of two array to compute pairwise euclidean distance. </p> <pre><code>def compute_distances_two_loops(X, Y): num_test = X.shape[0] num_train = Y.shape[0] dists = np.zeros((num_test, num_t...
<p>The reason is size of arrays within the loop body. In the two loop variant works on two arrays of 3000 elements. This easily fits into at least the level 2 cache of a cpu which is much faster than the main memory but it is also large enough that computing the distance is much slower than the python loop iteration ov...
perl subroutine returning array and str but they are getting merged <pre><code>sub process_feed { my ($line) = @_; my @lines; my $last_received = ""; while (1) { if ($line =~/^{(.*?)}(.*)/) { push @lines, $1; $line = $2; } else { $last_received =...
<p>A function returns a flat list. If an array is first in the list of variables being assigned to, the whole list goes into that array. So in</p> <pre><code>my (@lines, $leftover) = process_feed("{hi1}{hi2}{hi3"); </code></pre> <p>the <code>@lines</code> gets everything the sub returned.</p> <p>Solutions</p> <ul>...
jedis MasterListener initPool many times <p>jedis src code MasterListener method run:</p> <pre><code> j.subscribe(new JedisPubSub() { @Override public void onMessage(String channel, String message) { log.fine("Sentinel " + host + ":" + port + " published: " + message + "."); St...
<p>I think synchronization is needed at this line "if (!master.equals(currentHostMaster)) {" to prevent create connection pool multiple times.</p> <pre><code> public class JedisSentinelPool extends JedisPoolAbstract { private volatile HostAndPort currentHostMaster; private void initPool(HostAndPort master) ...
HAXM requires a genuine Intel Processor <p>I installed Android Studio and I get this warning message when I want to run a virtual Android device.</p> <p>I am using an Intel i5 processor and I have enabled hardware virtualisation and installed kvm.</p> <p><a href="http://i.stack.imgur.com/uQyEH.png" rel="nofollow"><im...
<p>This is just Android studio messing up, What you can do is install (even though you already might have) the HAXM, download link is here:</p> <p><a href="https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager" rel="nofollow">https://software.intel.com/en-us/android/articles/in...
JsonSerializationException from TFS REST API response <p>I am trying to use the new TFS/VSTS REST APIs with our on-prem TFS 2015 server, and cannot retrieve test runs as the response fails internal validation.</p> <p>Using client code like the following:</p> <pre><code>var connection = new VssConnection(serverUri), c...
<p>I can reproduce that issue if includeRunDetails parameter is true. I reported a bug <a href="https://connect.microsoft.com/VisualStudio/feedback/details/3102967" rel="nofollow">here</a> that you can vote it.</p> <p>The workaround is that you could set includeRunDetails to false to get test runs without details incl...
Is this proper usage of a unique_ptr? <p>from what I've discerned by reading through most of the questions on here that pop up when looking up unique pointers, this seems to me like it should provide the behavior described by the Builder pattern.</p> <p>I want any instance of Builder (or its sub-classes, since it does...
<p>std::unique_ptr cannot be copied. Instead, you will have to move uptr in order to properly transfer ownership of the underlying pointer.</p> <pre><code>template&lt;class type&gt; unique_ptr&lt;type&gt; Builder&lt;type&gt;::Close() { return std::move(uptr); } </code></pre>
Printing Two Different Strings in two Threads in Order <p>I am trying to Write a Program where two threads are running simultaneously. One is printings Jack and other is Jones. The expected output is : <strong>Jack Jones Jack Jones</strong> and so on. But I am facing issue while doing calling <strong>notifyAll()</stron...
<p>The definition of <code>wait</code> is that if you say</p> <pre><code>someObject.wait(); </code></pre> <p>the thread will wait until somebody notifies <code>someObject</code>'s monitor. Another thread can do that by calling</p> <pre><code>someObject.notify(); // or notifyAll </code></pre> <p>The thing is, thou...
Why illegal forward reference not variable not found? <p>Following code:</p> <pre><code>class Test { static { System.out.println(x); } static int x = 6; static double z; } </code></pre> <p>Will produce error: <code>Illegal forward reference.</code></p> <p>And,</p> <pre><code>class Test { ...
<p>It's sometimes legal to make a forward reference to an instance variable. E.g.:</p> <pre><code>class Test { private void setXToTen() { // legal x = 10; } static int x; .... </code></pre> <p>That means that in the case of a forward reference to an <em>instance variable</em>, the compiler ...
Child div of absolutely positioned parent not taking the full height of page <p>I am having issues with a bug in a project I am working on.</p> <p>The mobile menu which I want to take the full height of the viewport when it is less than 768px doesn't have a height even though I set it to 100%.</p> <p>It will only be ...
<p>To troubleshoot your <code>height: 100%</code> problem, have a look at this post:</p> <ul> <li><a href="http://stackoverflow.com/a/31728799/3597276">Working with the CSS <code>height</code> property and percentage values</a></li> </ul> <p>As an alternative, use <code>height: 100vh</code>.</p> <p><em>From the spec...
ember - How to correctly add bootstrap rows/cols based on number of records in model? <p>I have a route <code>groups.index</code> that showcases all the groups in my app. In the route I use the <code>this.store.findAll('group');</code> to fetch all the groups and in the groups.index template I use the each to go throug...
<p>Create computed property depends on the <code>model</code> property. and chunk model by 4 and iterate it in hbs.</p> <p>For preparing the model,</p> <pre><code>import Ember from 'ember'; import _array from 'lodash/array'; export default Ember.Controller.extend({ chunkSpan: 4, resultModel: Ember.computed('m...
Reoccurring XML error in Magento system.log <p>On our Magento store (ver 1.9.01) I recently discovered that our system.log file was 21GB! There seems to be an error regarding a particular line of code which is reoccurring over and over again, here's an example of the errors:</p> <pre><code>2015-09-26T06:06:29+00:00 ER...
<p>Try adding the following just after the simplexml_load_string(..) call:</p> <p>Mage::log(print_r($file, true));</p> <p>This will make the log give you a list of all the files loaded at the time the string failed to parse. People have said that the last file on the list is most likely the culprit, but I haven't had...
depreciation warning when I use sklearn imputer <p>My code is quite simple, but it always pops out the warning like this:</p> <pre><code>DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single featu...
<p>Besides the warning, your snippet did not interpret by me due to missing <code>import</code>s, and an error (<code>ufunc: isnan not supported</code>) once I got some imports into place. </p> <p>This code runs without warnings or errors, though:</p> <pre><code>In [39]: import pandas as pd In [40]: import numpy as ...
git source control checkout ignored <p>I'm developing an app in XCode and I'm using git repositories via terminal. All changes are committed and now I want to revert to my last commit, but, however, when I try to 'git checkout 10f3592' it says 'HEAD is now at 10f3592...' but in the XCode my source files are not changed...
<p>The command <code>git checkout 10f3592</code> just checks out the branch in a detached head state at commit <code>10f3592</code>. It does not actually change the state of your branch.</p> <p>If you want to literally <code>git revert</code> commit <code>10f3592</code>, then use <code>git revert</code>:</p> <pre><c...
How to remove odd lines except for first line using SED or AWK <p>I have the following file</p> <pre><code># header1 header2 zzzz yyyy 1 kkkkk wwww 2 </code></pre> <p>What I want to do is to remove odd lines except the header yielding:</p> <pre><code># header1 header2 zzzz yyyy kkkkk wwww </code></pre> <p>I tried t...
<pre><code>awk 'NR==1 || NR%2==0' </code></pre> <p>If the record number is 1 or is even, print it.</p> <pre><code>awk 'NR % 2 == 0 || NR == 1' </code></pre> <p>Reversing the comparisons might be marginally faster. The difference probably isn't measurable. (And the choice of spacing is essentially immaterial too.)<...
Xamarin Form: IOS how to detect the orientation completed <p>I have a renderer which based on the UIView. I can see the animation change when doing a rotation of the device leading the layoutSubviews call several times. Is there a way to detect the animation of the view when rotate the device is finished. </p> <p>This...
<p>If you have a view controller, you could override <code>viewDidLayoutSubviews</code> on your view controller. It'll be called when layout has finished.</p> <p>Alternatively, maybe notifications for orientation change would suffice. You can call <code>beginGeneratingDeviceOrientationNotifications()</code> on <code>U...
Why is jQuery scroll event not firing? <p>The <code>scroll</code> event doesn't fire when I scroll down. Not sure what I am doing wrong here.</p> <p>Below is my code:</p> <pre><code>&lt;style&gt; #scroll { max-height: 100px; overflow-y: auto; width: 647px; margin: auto; } &lt;/style&gt; &lt;body&g...
<p>Scroll events do not bubble for elements: <a href="https://developer.mozilla.org/en/docs/Web/Events/scroll" rel="nofollow">MDN: Events scroll</a></p> <blockquote> <p><strong>Bubbles</strong> Not on elements, but bubbles to the default view when fired on the document</p> </blockquote> <p>Because of that you can...
Global Exception Handling in Xamarin Cross platform <p>Can you please let me know how to handle the global exception(without App crash) in Xamarin Cross platform project.</p>
<p>There isn't a 'Xamarin.Forms' way of doing it that I know of. You need to hook into Android and iOS, what you could do is create one method that handles them both in the same way.</p> <p>A nice <a href="https://peterno.wordpress.com/2015/04/15/unhandled-exception-handling-in-ios-and-android-with-xamarin/" rel="nofo...
Edit list of entries using Python <p>My script so far:</p> <pre><code>#DogReg v1.0 import time Students = ['Mary', 'Matthew', 'Mark', 'Lianne' 'Spencer' 'John', 'Logan', 'Sam', 'Judy', 'Jc', 'Aj' ] print("1. Add Student") print("2. Delete Student") print("3. Edit Student") pr...
<p>Suppose the user wants to change <code>'Mary'</code> to <code>'Maria'</code>:</p> <pre><code>student_old = 'Mary' student_new = 'Maria' change_index = Students.index(student_old) Students[change_index] = student_new </code></pre> <p>Note that you will have to add proper error handling - for example, if the user as...
apache.hadoop.security.AccessControlException: Permission denied <p>I am trying to do bulk upload in Hbase.I am reading text file and creating Hfile out of that and then loading that Hfile to Hbase.All this is done using my map-reduce job. I am able to create Hfile and i can see my output directory with /_SUCCESS also ...
<p>To enable secure bulk load, I have just added the following properties to hbase-site.xml.</p> <pre><code>&lt;property&gt; &lt;name&gt;hbase.bulkload.staging.dir&lt;/name&gt; &lt;value&gt;/tmp/hbase-staging&lt;/value&gt; &lt;/property&gt; &lt;property&gt; &lt;name&gt;hbase.coprocessor.region.classes&lt;/name&g...
Running php function continuously without cron job <p>i having a little issue firstly, please ignore my depreciated functions i am trying to run PHP function continuously i have a button when clicked triggers an Ajax script which runs properly the Ajax page inserts the like into the db however i need to show the user ...
<p>Your like.php echo's out the like count but you are not doing anything with that value. Add a success callback to your ajax call and update your element that holds the like count</p> <pre><code>$.ajax({ type: "POST", url: "like.php", data: { postid: postid, userid: userid }, cache: false }).then(...
Import Data to Solr using java <p>I was trying out to upload data to solr server using java.<br> Is it possible to do so or to create collection and upload data directly from java, or is there any way to do so. </p> <p>I found two options using DIH and Tika. </p> <p>Any advise will be helpful.</p>
<p>You can give a try to solrj api: <a href="https://wiki.apache.org/solr/Solrj" rel="nofollow">https://wiki.apache.org/solr/Solrj</a>. It can be used to upload/search against solr instance. </p>
Is there an easy way to refactor one file(more than 1000 line) regarding a special pattern? <p>is there an easy way to refactor one file(more than 1000 line) regarding a special pattern ?</p> <p>For Example I have a lot of code, the problem is all the property names are with small capital letters ,but in c# we need bi...
<p>Refactoring in general is not an easy task and involves a whole bunch of techniques. But if it comes down to renaming properties and fixing naming issues then <a href="https://www.jetbrains.com/resharper/" rel="nofollow">Resharper</a> from JetBrains has been a great help.</p> <p>Resharper lets you fix naming issues...
index: true vs foreign_key: true (Rails) <p>Following a guide, I ran the following command:</p> <pre><code>rails g migration CreateSnippetsUsers snippet:belongs_to user:belongs_to </code></pre> <p>This created the following migration:</p> <pre><code>class CreateSnippetsUsers &lt; ActiveRecord::Migration[5.0] def c...
<p>For good performance you can add <code>index: true</code> and <code>foreign_key: true</code> but it's not required.</p> <p>Index provide better options for search in database, so it is faster.</p> <p>Foreign key enforce referential integrity. You can read more about foreign keys <a href="http://www.informit.com/a...
Undefined reference error when using class objects with C++ <p>I had gone through multiple stack overflow posts and tried to implement following example that uses dlopen with c++ objects class I have following code.</p> <p>1) File hello.cc</p> <pre><code>#include &lt;stdio.h&gt; #include "hello.h" A::A() { init1...
<p>Just put in the command line:</p> <pre><code>g++ -g -o myprog main.cpp -l hello -l dl -L ./ </code></pre> <p>and of course - when you want to run it locally, need to compile with -rpath</p> <pre><code>.. -Wl,-rpath ./ </code></pre>
How does SVN choose the BASE revision for a merge? <p>According to the <a href="http://svnbook.red-bean.com/en/1.8/svn.branchmerge.basicmerging.html" rel="nofollow">redbook</a>, the merges from trunk to a branch are termed "<strong>sync merges</strong>".</p> <p>How does Subversion determine the BASE revision for the <...
<p>Well, in the face of no documentation, only experimentation remains.</p> <p>I should caution anyone reading this to remember this behaviour might change in future.</p> <p>I re-created the case above, and several other cases.</p> <p>In all cases, the BASE was predicted by the command "svn mergeinfo". For example, ...
Django aggregate by split string <p>I would like to aggregate by a substring of one of my fields.</p> <p>models.py</p> <pre><code>class SomeModel(models.Model): symbol = models.CharField(db_column='SYMBOL', max_length=16) number = models.IntegerField(db_column='NUMBER') </code></pre> <p>Where symbol will be...
<p>Have you tried</p> <pre><code>SomeModel.objects.extra(select={'symbol': 'SUBSTRING_INDEX(symbol, ".")'})? </code></pre>
how i set angulrajs checkbox ng-model to multiple select in laravel foreach and pass values to angularjs controller <p>I need sample code please..</p> <p>i tried to set ng-model like </p> <pre><code>data-ng-model="barcodeData.items.&lt;?php echo $items-&gt;item_code; ?&gt;" </code></pre> <p>and also tried </p> <pre...
<p>ng-modal use like this :</p> <pre><code>ng-model="barcodeData.items.{{$item-&gt;item_code}}" </code></pre>
Hiding error message <p>I have the following two modules in my workbook:</p> <pre><code>Private Sub Worksheet_Change(ByVal Target As Range) ' check if target is in Column B or Column G If Target.Column = 2 Or Target.Column = 7 Then Select Case Target.Row Case 12 To 18, 26 To 32 'check if target row is 12 to 18 (i...
<p>When multiple cells are changed at the same time (such as when you run your <code>Clear</code> sub), the <code>Target</code> argument to <code>Worksheet_Change</code> is a range consisting of all of the changed cells - the <code>.Value</code> of that range is a 2-D array of values, not a single value, so you cannot...
CI database error find on next 4th column <p>I have this error :</p> <blockquote> <p>Error Number: 1064</p> <p>You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'condition LIKE '%Chisel Round size: 120x3/440%')' at line 3<...
<p>Has nothing to do with the number of columns, has to do with MySQL/MariaDB reserved keywords (condition): <a href="https://dev.mysql.com/doc/refman/5.5/en/keywords.html" rel="nofollow">https://dev.mysql.com/doc/refman/5.5/en/keywords.html</a></p> <p>Wrap your column names and table names in backticks to avoid confl...
Custom function not returning a string value in php <p>I am trying to check file extension. For this I have created a function but it is not returning any value. I really can't figure out where I am wrong. Below is the code : </p> <pre><code>function checkType($name){ $farray = explode('.',$name); $fn...
<p>You are trying to access a variable that is within the scope of the function.</p> <p>You are returning a value from the function not the variable itself so the function is the value.</p> <p>This is what you are supposed to be doing.</p> <pre><code>$filename = "IMG_3552.JPG"; echo $filename; $fext = checkType($fil...
How to register spring MVC application to spring boot admin <p>I have spring MVC web application. I have used spring boot actuator in it by adding dependancies as below.</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-actuator&lt;/artifact...
<p>If you don't want to use Spring Boots autoconfiguration (<code>@EnableAutoConfiguration</code>), have a look at the <code>SpringBootAdminClientAutoConfiguration</code> form the spring-boot-admin-starter-client library there are all components configured used for registering at the admin server.</p> <p>Primarily the...
Adding text to a printed array? <p>I'm a student just starting out in Java; I get hung up on seemingly easy concepts and have had trouble finding the answer to this despite a lot of googling. The assignment asks to: </p> <ul> <li>Prompt the user to enter the number of people</li> <li>Create a String array of the given...
<p>Read about <a href="http://alvinalexander.com/blog/post/java/combine-two-strings" rel="nofollow">string concatenation</a>.</p> <pre><code> int j = 1; for(String peoples : myPeople) { System.out.println("Person " + j + " is named " + peoples + " and their name is " + peoples.length() + " ch...
Get total lines of file in multiple subdirectories within a directory (excluding black lines) <p>I would like to have a script that goes through every single file in a directory (that includes sub directories) and return me the <strong>total number of lines</strong> in all files <strong>excluding blank lines</strong> a...
<p>Try finding all the files in the directory recursively ( <code>-type f</code> flag to find). Beware that this will print out binary files too, as does your current code.</p> <pre><code>find /home/user/files/ -type f -exec cat {} \; | wc -l </code></pre> <p>Edit: the <code>--files-from</code> solution given in <a h...
swift framework not generating <p>I created framework by using swift on Xcode 8 and got following error. I'm using sqlite3, for that I created <code>module/module.map</code> file in project and updated swift compiler search paths.</p> <p><strong>Error</strong></p> <pre><code>CompileSwift normal x86_64 /Users/xxxxx/Do...
<p>On Xcode 8 not required module.map file, need to copy sqlite3.h file in project directory and make them as public under target membership.And include sqlite3.h file in umbrella header like below </p> <pre><code>#include "sqlite3.h" </code></pre>
LInux error: Unmet Dependencies <p>Error while installing ipython :</p> <pre><code>Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: libnss3 : Breaks: libnss3:i386...
<p>You have missing dependencies. You need to execute</p> <pre><code>apt-get -f install </code></pre> <p>as the output tells you to do.</p>
Escaping Closures in Swift <p>I'm new to Swift and I was reading the manual when I came across escaping closures. I didn't get the manual's description at all. Could someone please explain to me what escaping closures are in Swift in simple terms. Thank you so much.</p>
<p>Consider this class:</p> <pre><code>class A { var closure: (() -&gt; Void)? func someMethod(closure: () -&gt; Void) { self.closure = closure } } </code></pre> <p><code>someMethod</code> assigns the closure passed in, to a property in the class.</p> <p>Now here comes another class:</p> <pre><c...
AudioTrack not working, there is no sound <p>can you check why is my Audiotrack not working, i do have a buffer in and out to the audiotrack, it should be able to work. </p> <pre><code>public class MainActivity extends AppCompatActivity { private MediaExtractor extractor; private MediaCodec decoder; private Surface s...
<p>You can try with this, easily:</p> <pre><code> MediaPlayer mPlayer = MediaPlayer.create(ThisActivity.this, R.raw.mysoundfile); mPlayer.start(); </code></pre> <p>not forgetting to stop it when activity is destroyed:</p> <pre><code>public void onDestroy() { mPlayer.stop(); super.onDestroy(); } </c...
AppStore rejected: use of private calls refers to my own methods <p>I received the following rejection message:</p> <blockquote> <p>Your app uses or references the following non-public APIs:</p> <ul> <li>removeItems:, </li> <li>setSelectedSection:</li> <li>setIsNew:</li> <li>selectedSection</li> </ul>...
<p>The reason for rejection is actually really that I am using selectors that Apple decided to make introduce as private selectors.</p> <p>This can happen at any time, with any version and there is no testing facility but the app review (at the time of this writing). </p> <p>It seems that Apple changed policy here, e...
Android ArrayList of int <p>I'm new with android and java, so I apologize if what I say is not entirely correct. In my application I'd like to convert an ArrayList to integer to increase each value with a +1. Please note the commented out part to understand where is my problem. I can't find the right way.. This is wha...
<p>Your code is correct just change the for loop initial value to start from 0 rather than 1 like this:</p> <pre><code> int tempValue = 0; for (int i = 0; i &lt; mArray.length; i++) { { // increasing your mArray value tempValue = (Integer) mArray[i] + 1; mArray[i] = tempValue; //Rest of ...
5 items per row, auto-resize items in flexbox <p>I have this at the moment:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.container { background: gray; width: 600...
<p>try below css for five items in each row.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.container { background: gray none repeat scroll 0 0; display: flex; ...