input
stringlengths
51
42.3k
output
stringlengths
18
55k
Need to create animation on clicking any option in MCQ <p>i need to create a MCQ question with 4 options. On clicking any option i need proper correct mark with some color animation over it. how to do this animation part in appcelerator Titanium. Share link to achieve it. </p>
<p>Animations are handled by the view object in Appcelerator. So, for example, if you put your answers in a label object, inside a view, then you can apply a animation. See the documentation and examples here: <a href="http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Animation" rel="nofollow">http://docs...
Creating a jobject in C doesn't work <p>I want to transfer an <code>jobjectArray</code> from C to Java using JNI.<br> Currently, I get the following error:</p> <pre><code>SharedTable.c: In function ‘JAVA_model_JNIResultSet_getSpieler’: SharedTable.c:116:5: warning: passing argument 4 of ‘(*env)-&gt;SetObjectArra...
<p>As <strong>@talex</strong> correctly commented, you cannot fill a Java array with C structures. You should probably declare a Java class that is equivalent to the Spieler structure, and in your loop create each element of the array using a constructor of this Java class.</p> <p>Something like,</p> <pre><code>publi...
How to apply each item of the list as the corresponding argument for a function in Scheme <p>I have a list (1 2 3) that I need to apply to the function (f a b c). </p> <p>The first part of the problem was merging two lists to create the list above, now I need to plug in those numbers as arguments. I am not sure how to...
<p>You are looking for the procedure <code>apply</code>:</p> <pre class="lang-scm prettyprint-override"><code>(+ 1 2 3) ; ==&gt; 6 (let ((lst '(1 2 3))) (apply + lst)) ; ==&gt; 6 </code></pre> <p>Apply can also take additional arguments before the list.. eg. </p> <pre class="lang-scm prettyprint-override"><code...
How to select data with overdue dates? Mysql <p>I wanted to select data which has an overdue dates. For example, Deadline is 9-9-2016 and the date today is 10-10-2016. Clearly 9-9-2016 is already overdue. Thanks.</p>
<p>Have a look at the <a href="https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html" rel="nofollow">date and time functions</a> in MySql. Depending on the type of your column, you may want to use something like <code>CURRENT_DATE()</code> or <code>CURRENT_TIME()</code>:</p> <pre><code>select * from myt...
Form Method Spoofing in CodeIgniter <p>So I wanna use HTTP DELETE on my route when deleting the data.</p> <p>Is it possible to use method spoofing in CodeIgniter?</p> <p>Maybe like Laravel does by using hidden input "_method" ?</p> <pre><code>&lt;input type="hidden" name="_method" value="DELETE"&gt; </code></pre> <...
<p>You can try the <a href="https://github.com/chriskacerguis/codeigniter-restserver" rel="nofollow">codeigniter restserver</a>. It is full implementation and has DELETE method. Best would be send submit with ajax and remove element from the DOM after delete. Or try to plug angular to your app ;)</p>
What's the difference between void and cv void? <p>I have come across <strong>the type "cv void"</strong> in the latest draft of the C++ standard (<em>N4606</em>) :</p> <blockquote> <h3>8.3.3 [dcl.mptr], paragraph 3</h3> <p>A pointer to member shall not point to a static member of a class (9.2.3), a member with...
<p>"cv void" is not a real type. "cv" here is a shorthand for "possibly cv-qualified", which means "may have a <code>const</code> or a <code>volatile</code> on it".</p> <p>The passage means that a pointer-to-member may not point to an object of the following types: <code>void</code>, <code>const void</code>, <code>vol...
Borrow checker doesn't realize that `clear` drops reference to local variable <p>The following code reads space-delimited records from stdin, and writes comma-delimited records to stdout. Even with optimized builds it's rather slow (about twice as slow as using, say, awk).</p> <pre><code>use std::io::BufRead; fn mai...
<p>The only way to do this is to use <a href="https://doc.rust-lang.org/stable/std/mem/fn.transmute.html"><code>transmute</code></a> to change the <code>Vec&lt;&amp;'a str&gt;</code> into a <code>Vec&lt;&amp;'b str&gt;</code>. <code>transmute</code> is unsafe and Rust will not raise an error if you forget the call to <...
Ruby remove new line character between html tags. <p>I would like to remove all the new line characters between </p> <pre><code>&lt;div class="some class"&gt; arbitrary amount of text here with possible new line characters &lt;/div&gt; </code></pre> <p>Is this possible in ruby?</p>
<p>Yes, you can easily do this using the Nokogiri gem. For example:</p> <pre><code>require "rubygems" require "nokogiri" html = %q! &lt;div class="some class"&gt; arbitrary amount of text here with possible new line characters &lt;/div&gt; ! doc = Nokogiri::HTML::DocumentFragment.parse(html) div = doc....
Add Image dynamically in runtime - Unity 5 <p>In my unity based Android game I wish to add the image dynamically based on the number of questions in each level. The image is shown for reference. Each correct answer will be marked in green and the wrong one in red. I am new to unity and trying hard to find steps to achi...
<p>I once wrote a script for dynamically creating buttons based on each level. What I did was creating the first button on the scene and adding the other buttons based on the first one. Below is the shell of my code:</p> <pre><code>// tutorialButton and levelButtons are public variables which can be set from Inspector...
What is a simple way to secure api requests between uwp and asp core <p>I have a uwp application and an ASP Core server application. I want to perform Get and Post requests to the ASP server and I want to perform authorization on the server side.</p> <p>According to the team, they don't want you to use Basic authentic...
<blockquote> <p>what is the most easy and secure protocol to use to perform api requests from UWP to an ASP Core server?</p> </blockquote> <p>I'd like to say this is a open question and I will give some suggestions and hope it can help you. Basic authentication and digest authentication you mentioned are defined in ...
Is it possible to disable the focus ring animation in Cocoa for a single app? <p>On macOS, you can disable the focus ring animation system-wide with this command:</p> <p><code>defaults write -globalDomain NSUseAnimatedFocusRing -bool NO</code></p> <p>Is there a way to do it in Cocoa for just your own app? I don't wan...
<p>I ended up just using the <code>NSUseAnimatedFocusRing</code> constant in my own app instead of setting it globally.</p> <pre><code>func applicationDidFinishLaunching(_ aNotification: Notification) { // Disable focus ring animation. UserDefaults.standard.set(false, forKey: "NSUseAnimatedFocusRing") // ...
Removing punctuation/symbols from a list with Python except periods, commas <p>In Python, I need to remove almost all punctuation from a list but save periods and commas. Should I create a function to do this or a variable? Basically I want to delete all symbols except letters (I've already converted uppercase letters ...
<p>You can build a set of unwanted punctuation from <a href="https://docs.python.org/2/library/string.html#string.punctuation" rel="nofollow"><code>string.punctuation</code></a> - which provides a string containing punctuation, and then use a <em>list comprehension</em> to filter out the letters contained in the set:</...
My program will not print, closes immediately after entering a number (C) <pre><code>#include &lt;stdio.h&gt; int main() { int input, i, sum = 0; printf("Please enter a number between 1 and 5: "); scanf_s("%d", &amp;input); for (i = 0; i &lt; 5; i++) { sum += input + i; } print...
<p>Use ctrl+F5 to run the program.</p>
Falcon parsing json error <p>I'm trying out Falcon for a small api project. Unfortunate i'm stuck on the json parsing stuff and code from the documentation examples does not work.</p> <p>I have tried so many things i've found on Stack and Google but no changes. I've tried the following codes that results in the errors...
<p>your code should work if other pieces of code are in place . a quick test(filename app.py):</p> <pre><code>import falcon import json class JSON_Middleware(object): def process_request(self, req, resp): raw_json = json.loads(req.stream.read()) print raw_json class Test: def on_post(self,req,r...
How does placement new know which layout to create? <pre><code>#include &lt;iostream&gt; #include &lt;typeinfo&gt; struct A { int a; }; struct B : virtual A { int b; }; struct C : virtual A { int c; }; struct D : B,C { int d; }; int main() { D complete; B contiguous; B &amp; separate = complete; B * p[2] = {&a...
<blockquote> <p><em>Where is the guarantee that the layout created by new fits into a buffer of size sizeof(B) and with offset zero</em></p> </blockquote> <p>From the the type being named in <code>new</code> as its argument being <code>B</code>. A <code>B</code> is being made, not an <code>D</code>. The type <code>B...
How to create customize report in c#.net windows application and eliminate white space of hidden columns <p>I am developing C# windows application and I want to report From sqlserver database.so I added Dataset to my project And I added report.rdlc to my project.the point is that I want to select the field programmatic...
<p>You need to create boolean value parameter for each of the columns that user selects for display in RDLC report. Pass all these parameters to RDLC report. Set the Visibility > Hidden property of each columns with respective parameter.</p> <p>For example, 'Age' column is to be excluded and say @AgeVisible is the boo...
setState(...): Can only update a mounted or mounting component. where is the culprit? <p>I got this warning.</p> <p>Warning: setState(...): Can only update a mounted or mounting component.</p> <p>How do I know which setState is throwing it? I put a log in front of all setState and none is being print. There should be...
<p>Have you tried this?</p> <pre><code>console.log(this.state.WHATYOUNEED) </code></pre>
Format command invocation string with multiple options <p>I have a function <code>ping</code> that needs to pass a string of a format<br> <code>ping mpls ipv4 &lt;ip here&gt; &lt;param name&gt; &lt;valiue&gt; &lt;param name&gt; &lt;valiue&gt; ...</code><br> to a testbed device's method.</p> <pre><code>def ping(device,...
<p>Does this help?</p> <pre><code>valid_options = ('{} {}'.format(key, value) for key, value in kwargs.items() if key in options) cmd_options = ' '.join(valid_options) cmd = 'ping mpls ipv4 {} {}'.foramt(ip_address, cmd_options) </code></pre> <p>BTW I recommend you to learn about <a ...
Can we use addOptional and addParameter together? <p>inputParser provides addOptional and addParameter. The doc (<a href="https://www.mathworks.com/help/matlab/ref/inputparser-class.html" rel="nofollow">https://www.mathworks.com/help/matlab/ref/inputparser-class.html</a>) says</p> <blockquote> <p>You can define your...
<p>I do not recommended the use of <code>inputParser</code> with optional arguments that are allowed to be character arrays, because <code>parse()</code> cannot distinguish if the user passes a parameter name (which is always of type <code>char</code>) or the optional input argument. Thus, it is a logical consequence o...
Action bar only shows one item next to search view <p>I want to have a search view and two buttons in the Action Bar. So I created menu/options_menu.xml:</p> <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/action_search" android:title="Search" androi...
<p>Created one demo, check it :</p> <p><strong>menu.xml :</strong></p> <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"&gt; &lt;item android:id="@+id/action_search" android:title="Search" android:icon="@android:d...
display data from selected option from vue component <p>How can I display the data from selected option, like in the example from docs <a href="http://vuejs.org/guide/forms.html#Select" rel="nofollow">vuejs.org</a> but with component?</p> <pre><code>&lt;div id="app"&gt; &lt;selection&gt;&lt;/selection&gt; &lt;div ...
<p>You can make your <a href="http://vuejs.org/guide/components.html#Form-Input-Components-using-Custom-Events" rel="nofollow">component work with the v-model directive</a> by implementing two features:</p> <ul> <li>accept a <code>value</code> prop</li> <li>emit an <code>input</code>event with the new value</li> </ul>...
On Copying Garbage <p>A couple of days ago I had a small discussion here about the copying of, let's call it <em>garbage</em> because that's what is actually is, from one array to another and if that is acceptable in standard C (ISO/IEC 9899-2011) or not.</p> <p>Wrapped in some example-code for clarity:</p> <pre><cod...
<p>Yes, it means ARRAY_SIZE must be greater than zero. At this level you should probably leave the optimization to the compiler. But if the ARRAY_SIZE is a defined constant, you can optimize by an array which its elements are the same size as your CPU registers. your array size should be an integer multiple of the siz...
Why would I use getters and setters or properties while I can do all the logic inside the constructor? <p>Why would I use getters and setters or properties while I can do all the logic inside a constructor?</p> <pre><code>class Example{ private int ID; private string name; //constructor public Exampl...
<p>You cant get that variables since they are private. For the question, if you do not want to get/set values, you don't need them. But the advantages of properties are calculations for all the time.</p> <p>For example:</p> <pre><code>get { return myString == null ? string.Empty : myString } set { !string.IsNu...
Tool to create Hand Held Units and Mobiles (Android, iOS, Winphones and WinCE) and that should/ can support legacy unmanaged library (DLL) <p>We are exploring to create an application that should work on Desktop (Windows 7/8.1/10) as well as on Hand Held Units and Mobiles (Android, iOS, Winphones and WinCE).</p> <p>We...
<ol> <li>yes, but not Windows CE</li> <li>No</li> <li>Yes, but not Windows CE</li> <li>Xamarin provides C# bindings for the native platform APIs. If you can do it natively on the platform, you should be able to do it via Xamarin.</li> </ol>
Add margin on both sides of free space(background) in Html - css page <p>I am trying to add margin on both sides of free space in Html. and fill background in the middle remaining part only.</p> <p>But this id doesn't work when i put it in body tag.</p> <pre><code>#bodyid{ display: block; margin-left: 100px;...
<p>Just make body white and add a container <code>div</code>. Like here: <a href="https://jsfiddle.net/p1mz721k/" rel="nofollow">https://jsfiddle.net/p1mz721k/</a></p>
Traversing through a linked list in C, get caught in Loop <p>I keep getting caught in a loop but i dont know how to fix it. We have to traverse through the list. It prints but it doesn't move on to the next test function. I don't think the code is recognizing the end of the list and isn't exiting the while loop.</p>...
<p>I'm old but with link lists like your stack thing here I see you need to assign a NULL value to the tail of your linked list first and then every time a node is added then add a NULL to the new tail. You did not assign a NULL value to your end node so you have an endless loop.</p>
Override func Error! Method does not override any method from its superclass <pre><code>override func touchesBegan(touches: Set&lt;NSObject&gt;, withEvent event: UIEvent) { } override func supportedInterfaceOrientations() -&gt; Int { } </code></pre> <p>Here I have an error. It says </p> <blockquote> <p>Method does...
<p>The error is coming because your method signature is different than the actual ones. You should use the exact method signature for overriding (Either you should use auto-complete feature provided in Xcode or refer the documentation)</p> <p><a href="https://developer.apple.com/reference/uikit/uiresponder/1621142-tou...
looking for android pattern unlock <p>I forgot my android pattern, for which i don't want to do factory reset n loose my data, pics n other stuffs. </p> <p>Unfortunately, my mobile data or wifi is also not enabled, which could help me to login with my google account and i have reset it.</p> <p>My study shows me that,...
<p>you cant remove pattern files without root permission,just need root permission or install custom recovery. if USB debug enabled you can root. use this links for root <a href="http://forum.xda-developers.com/zenfone-5/general/root-asus-zenfone-5-kitkat-4-4-2-100-t2947092" rel="nofollow">(root-asus-zenfone-5-kitkat-4...
Angular 2 ng module imports <p>What is the significance of imports metadata of ngmodule decorator, when we are importing files at top. Difference between both the inputs.</p>
<p>These imports are entirely different concepts. </p> <p>The imports at the top of the file are TypeScript imports to make classes, interfaces and variables known to the current file and are not related to Angular2.</p> <p>The <code>@NgModule()</code> imports are to make <code>exports: []</code> of the imported <cod...
Apache permission error on WAMP <p>I may be missing the obvious posting, but everything I've seen seems to apply to an older version of Apache with a different httpd.conf file.</p> <p>I have the good old "You don't have permission to access / on this server" message.</p> <p>With an older version of Apache that I used...
<p>Okay, I found it...</p> <ol> <li><p>Change httpd.conf to have "require all granted"</p></li> <li><p>Change httpd-vhosts line "Require local" to "Require all granted"</p></li> </ol> <p>It was the second file that I needed to change. (and no others, at least for me)</p>
PHP isn't able to read file <p>I'm stuck trying to open a file with fopen in php.</p> <pre><code> $db_ausgaenge = "statuseing.php"; $dout = fopen($db_ausgaenge, "x+"); print $dout; print(shell_exec('whoami')); print(shell_exec('pwd')); print(shell_exec('id')); fwr...
<p>Look at the mode you are using.</p> <p>x+ means that if the file already exists an error will be thrown.</p> <p>To find the correct mode depending on your scenario check out <a href="http://php.net/manual/en/function.fopen.php" rel="nofollow">http://php.net/manual/en/function.fopen.php</a></p>
Python screenshot over internet by email <p>How to make this better ? <a href="https://github.com/Seiff/python-screenshot-over-internet" rel="nofollow">https://github.com/Seiff/python-screenshot-over-internet</a> how to make the poplib connection read emails on runtime instead of running every 5mins to check ?</p>
<p>Reading through the documentation, there doesnt seem to be a current fix for real time. What is possible is reducing the batch time in the .bat file (Currently at 300 s ).</p> <pre><code> :loop start directory\screenshotwithemail.py timeout /t 300 #Change this value goto loop </code></pre> <p>This mig...
Creating # pages like Twitter with Firebase <p>I have a question to the Firebase community.</p> <p>How to structure the data for # pages like Twitter? (e.g:#funnyVideos so that any one can see that link and add some stuff into it) in Firebase?</p>
<p>It sounds like you're trying to store hash tags. </p> <p>But that enough is not enough to determine your data model. </p> <p>In Firebase (as in most NoSQL databases) you model your data for the way you app consumes it. So you'll have to determine what screens there are in your app and what information they show.</...
How to generate 3 names without the same name repeated <pre><code>window.onload = start; function start () { var name = ["Hans","Ole","Nils","Olav","Per","Knut","Kari","Line","Pia"] var random = Math.floor(Math.random()*8) var random2 = Math.floor(Math.random()*8) var random3 = Math.floor(Math.random()*8) va...
<p>Replace the assignment for random2 and random 3 with:</p> <pre><code>var random = Math.floor(Math.random()*8); var random2, random3; do { random2 = Math.floor(Math.random()*8); } while (random2==random); do { random3 = Math.floor(Math.random()*8); } while (random3==random || random3==random2); </code></pr...
mod_rewrite pass variable and <p>What I would need to do is to pass 1 variable as variable, and the rest as a rest of URL intact, so I can get them by $_GET in php later. The below does not work:</p> <pre><code>RewriteRule ^store/([a-zA-Z0-9\_\-]+).html?(.*)/?$ store.php?var1=$1&amp;$2 [L] </code></pre> <p>Possi...
<p>The problem is your premise as to how a <code>RewriteRule</code> works. A <code>RewriteRule</code> <em>only</em> matches against the URI path (in apache terms the Request URI) and not against the query string. This means the <code>(.*)/?$</code> at the end of your regex only works because it can reduce to just '$' (...
How to break this loop? <p>I have this code to average 100 pictures and save them into 10 JPEG files</p> <pre><code>int main(int argc, char** argv) { VideoCapture cap("C:/Pics/test_%d.jpeg"); while (cap.isOpened()) { Mat img; cap.read(img); // process(img); if (img.empty())...
<p>I'm an idiot. Just remove the <code>while</code></p>
AutoValidateAntiForgeryToken vs. ValidateAntiForgeryToken <p>I was trying to secure a post method against side scripting just now through providing an anti forgery token but noticed, in .Net Core there is another attribute named as <code>AutoAntiForgeryToken</code>. The XML comments, and the online search did not provi...
<p>From <code>AutoValidateAntiforgeryTokenAttribute</code> documentation:</p> <blockquote> <p>An attribute that causes validation of antiforgery tokens for all unsafe HTTP methods. An antiforgery token is required for HTTP methods other than GET, HEAD, OPTIONS, and TRACE. It can be applied at as a global filte...
Strategies for abstracting db id from domain class <p>I am writing a simple CRUD application in Java and Spring4 with spring-data, and I want to see if I can keep the domain as pure/clean as possible, and I'm after some ideas/thoughts as to how I can go about achieving this.<br> I've structured the project with a paren...
<p>If you want you can use an interface, although you'll probably find that you only ever have one implementation of this interface, defeating the whole purpose of the interface. Annotations themselves are pretty much interfaces. So an annotated class will be much the same.</p> <p>I'm not sure why you think having an ...
React/Redux - Dispatch not updating view <p>First small react/redux project to learn both react and redux.</p> <p>The onClick event on the button element fires as I can see the value in the console (in the reducer file). However, the view is not updating.</p> <p>Yes, I have looked online, and I have been stuck on thi...
<p>I believe the reason you don't see any updates in your rendered view is because you're wrongly mapping your state with the props you pass to the component. You state->props mapping function should be:</p> <pre><code>const mapStateToProps = (state) =&gt; { return { follower: state.followerReducer.follower ...
Custom eCommerce Pop-Up? <p>I am developing a site for a client and I need the ability to add a pop up on the home page that allows the user to enter their email/payment info and then click a button to purchase a ticket for an event. I've looked into WooCommerce and WP-eCommerce but I can't find a way to do this.</p> ...
<p>The WooCommerce + <a href="https://wordpress.org/plugins/paypal-for-woocommerce/" rel="nofollow">PayPal for WooCommerce</a> combination is "something that works" but you would have to customize the part where it happens within a pop-up.</p> <p>This can be done with custom template files and hooks into WordPress / W...
How to find the difference between two dates c++ <p>I'm a student and I was wondering if anybody can help me debug one of my functions. For this program the user is suppose to input two dates in the format mm/dd/yy between the years of 1972-2071 and the program is suppose to output the difference between those two date...
<p>You can use <code>std::difftime</code> to help you in some percents.</p> <p>no extra features: </p> <p><a href="http://en.cppreference.com/w/cpp/chrono/c/difftime" rel="nofollow">http://en.cppreference.com/w/cpp/chrono/c/difftime</a></p> <pre><code>#include &lt;iostream&gt; #include &lt;ctime&gt; int main() { ...
Android ListView Item Add and Remove <p>When i Add Item to listview , listview doesn't show my added item. when i add the Item to adapter i want to seem it in listview... But it doesn't work. Where is my fail ? There is any example about Listview (Add/Remove/Edit) Example too ? </p> <p><strong>Adapter Code</strong></...
<p>It should update. While rebuilding the view is a giant waste and an error, it should work. The most suspect thing is the getItemId(int position) returning 0. If the view is treating the ids as static that will often result in no-update and no values on screen have changed. Typically the default is return position, o...
The class file for a new Thread and the class file for main are the same <p>I have a program called Main.java, shown as below. After compilation of this program, there will be two .class file: Main.class and Main$1.class. My problem is the two .class files are exactly the same. </p> <p>Anyone knows what is wrong? </p>...
<p>My money would be on you not comparing the two class files correctly. I'd bet that you're writing something like this in your bash-like prompt:</p> <pre><code>md5sum Main.class Main$1.class </code></pre> <p>(or some checksumming tool other than <code>md5sum</code>)</p> <p>This is actually substituting the variabl...
The coordinates or dimensions of the range are invalid in JSon <p>I am working on google scripts which can call REST API and get the data in google spreadsheets. But different Json objects work and which I am using now does not work...</p> <p>At first it was giving me an error as The coordinates or dimensions of the r...
<p>What you are doing at the moment is calling <code>Object.keys()</code> on <code>dataSet</code>.<br> This returns an array of strings, e.g. <code>["status", "data"]</code>. </p> <p>Then you retrieve each of these keys separately and assign them as a one element array to data, so data looks like <code>["status"]</co...
How can I ensure consistency between multiple model object instances <p><strong>BACKGROUND</strong></p> <p>This is a problem I keep coming back to as I'm developing an Android application. Let's say my app lets users "follow" TV shows. My <code>TVShow</code> model class is as follows:</p> <pre><code>public class TVSh...
<p>It sounds like the "following" property should be the property of a user rather than a TV show.</p> <p>Your database should record the association between users and which shows they are following. So, if a user decides to follow a show, you save a persistent association in the database between that user and that sh...
Determine cause of execute failure per row from BatchUpdateException <p>I have a java program that reads thousands of rows of data from a text file into a database. It uses statement batching to insert a couple thousand rows at a time.</p> <p>If rows any rows fail to update, I continue attempting the rest until the en...
<p>There may be two reasons;</p> <ol> <li>There may be a syntax mistake in the SQL Query.</li> <li>There may be duplicate entries for the primary key.</li> </ol> <p>As you are reading the data from a text file, I suggest you to use the <code>Load Data Local InFile</code> Query in SQL. This would resolve both of the a...
AJAX response cache <p>i'm developing a mobile app using cordova . The app consists on sending AJAX requests to a php script on a distant server and then the php extracts the required data from a database and responds with these data in JSON format so the app can parse these data and show them on the app . The problem ...
<p>You are not exactly describing the kind of data you want to save (is it only strings? is it an array? an object?) or showing any code, so I can only <a href="http://javascript.tutorialhorizon.com/2015/09/08/getting-started-with-localstorage-vs-sessionstorage-in-html5/" rel="nofollow">point</a> you to a direction. Ta...
Designing a for loop with specifically named items <p>I often run into this situation when writing code for a GUI and would like to know would be a best-practice way of solving this. The situation is this:</p> <p>I have a number of identical items on my GUI which have different variable names, i.e. I have 10 'identica...
<p>Whenever you have a set of similar objects don´t create a variable for every instance of those objects, instead put them into one single collection. Then you can easily loop this list and manipulate the objects within it:</p> <pre><code>var buttons = new List&lt;Button&gt;(); // put the buttons into the list usin...
Optimizan ORDER BY & LIMIT queries in MySQL <p>I trying to optimize query like this:</p> <pre><code>SELECT sql_no_cache t.topic_id FROM blog AS b, topic AS t WHERE t.topic_publish = 1 AND t.topic_type &lt;&gt; 'topic' AND t.topic_lang = 'en' AND t.blog_id = b.blog_id ORDER BY t.t...
<p>First, learn to use proper, explicit <code>JOIN</code> syntax:</p> <pre><code>SELECT sql_no_cache t.topic_id FROM blog b JOIN topic t ON t.blog_id = b.blog_id WHERE t.topic_publish = 1 t.topic_type &lt;&gt; 'topic' t.topic_lang = 'en' ORDER BY t.topic_date_add DESC LIMIT 50; </code></pre...
R code to generate unique ID with prefix? <p>I have a table called "pipel" that contains more than 10,000 rows. I would like to add an ID column to assign a unique ID for each row. The unique ID must be 30 digits long and starts with "AKM_CC_Test_". I used the code below as a starting point but not sure how to format i...
<p>You could use <code>sprintf()</code>. This creates a 30 character string beginning with <code>"AKM_CC_Test_"</code> and ending in a sequence of <code>1:nrow(pipel)</code> with leading zeros.</p> <pre><code>x &lt;- "AKM_CC_Test_" sprintf("%s%0*d", x, 30 - nchar(x), 1:nrow(pipel)) </code></pre> <ul> <li><code>%s</c...
TypeError remains: Str object is not callable <p>I'm trying to make a python program that converts a 24-hour notation to a 12-hour notation, but the linux shell keeps saying: 'Str' object is not callable. I'm looking for hours now but can't find the solution? Do you people see it?</p> <p>def time(time, hours, minutes)...
<p>In the main loop you are using same name for the Function and the String i.e "time". This is causing ambiguity. Give them a different name and it will work fine. Use Like this.</p> <pre><code>for timeString in sys.stdin: hours, minutes = timeString.split(':') y = time(timeString,hours, minutes) ...
cant configure dataSource and delegate <p>So i upgraded Xcode and the GitHub project code to swift 3.0 (my project is in Obj C and some of the pods i use from GitHub are in Swift). I got a bunch of errors and now i am stuck on these ones. For some reason my dataSource and delegate for the floatingActionButton (<a href=...
<p>I think the problem is that your Objective-C code does not know the „<code>open var</code>“s <code>dataSource</code> and <code>delegate</code> of the <code>LiquidFloatingButton</code> Swift code.<br> To make them known, a Obj-c header file is required that exposes these Swift infos to your Obj-C code. This is de...
Sub functions ml <p>So I'm trying to do an assignment for an ml course, the issue is that the function requires a set type: <code>int * int -&gt; int</code> for example, and the way that I see to solve the problem is to use another function (say for iteration) to solve the problem.</p> <p>I believe that lisp has some ...
<p>In ML, functions are first class citizens (i.e. values). You can bind them via <code>let</code> just like any other value. </p> <p>Therefore, your idea is correct. It is especially a good design for functions passed as "iterators" (i.e. to map/fold/iter). Your question is too vague however for any further advise.</...
Batch file find a string <p>How can i get a word from a file and set it to a variabile for ex:</p> <p>The text file contains bunch of text and i want to find only one word with the 4 or 5 random characters behind it</p> <p>Fatbardh: 79%</p> <p>Now i want to get that Fatbardh word but the 79% could be random number i...
<p>Since you know the string token in the line you're searching for, you can use <code>FOR /F</code> to process the output of the <code>FINDSTR</code> command.</p> <pre><code>@echo off for /f "tokens=2 delims=: " %%a in ('findstr /i "Fatbardh" "YourFile.txt"') do set percent=%%a echo %percent% </code></pre> <p>If you...
grouping mongo documents using elements of array field <p>I have below 3 documents. Each represents a contact for a user :</p> <pre><code>{ "_id" : ObjectId("57f9f9f3b91d070315273d0d"), "profileId" : "test", "displayName" : "duplicateTest", "email" : [ { "emailId" : "a@a.com" ...
<p>Well your question differs a bit from the result you are seeking. Your inital question pointed me to the following aggregation:</p> <pre><code>db.table.aggregate( [ { $unwind: "$email" }, { $group: { _id : "$email.emailId", duplicates : { $addToSet : "$_id"} } } ] )...
Is there a better way than `const` to store large blocks of text? <p>I am making a single page web app with React. One of my pages has a large block of text like so:</p> <pre><code>const ContentText = &lt;p&gt;......huge block of text.......&lt;/p&gt; </code></pre> <p>It looks very ugly in my editor and I was wonderi...
<p>I would create a module with your text and import it. That way you shouldn't care at all what it looks like in your editor because you're not really touching that file unless you're specifically trying to edit your huge block of text.</p> <pre><code>export default ` ....huge block of text.... ` </code></pre> <p>...
How to store temporary data in an Azure multi-instance (scale set) virtual machine? <p>We developed a server service that (in a few words) supports the communications between two devices. We want to make advantage of the scalability given by an Azure Scale Set (multi instance VM) but we are not sure how to share memory...
<p>You could use <a href="https://azure.microsoft.com/en-us/documentation/articles/service-fabric-overview/" rel="nofollow">Service Fabric</a> and take advantage of <strong><a href="https://azure.microsoft.com/en-us/documentation/articles/service-fabric-reliable-services-reliable-collections/" rel="nofollow">Reliable C...
R tcltk: error when trying to display a png file depending on the OS <p>This is an issue I am encountering for different pieces of codes I am writing in R. Basically, I would like to generate a window that displays a picture (a .png file). Following for instance guidances from <a href="http://www.sciviews.org/recipes/...
<p>Tk's native support for PNG was added in 8.6. Prior to that, you need to have the <a href="https://sourceforge.net/projects/tkimg/" rel="nofollow">tkimg extension</a> loaded <em>into Tk</em> to add the image format handler required. If your installation of Tcl/Tk that R is using is set up right, you can probably mak...
Lumen return information about deleted record, always gets ModelNotFoundException <p>I'm trying to use Pusher with Lumen to push events to clients to get data refresh. I've created very simple Event:</p> <pre><code>class CarEvent extends Event implements ShouldBroadcast{ use SerializesModels; public $car; ...
<p>The problem doesn't come up when serializing but rather when unserializing. You see, your Event uses the <code>SerializesModels</code> trait. This trait has the following method:</p> <pre><code>protected function getRestoredPropertyValue($value) { if (! $value instanceof ModelIdentifier) { return $value...
Number range animation with maxscript <p>i'm new to maxscript and i'm trying to animate (show) numbers from number 0 to number 220 with maxscript. My problem is that i want to make <strong>integer</strong> range but with this code, it's making float number. help me !</p> <pre><code>b=box name: "ControlBox" wirecolor:b...
<p>Change <code>TheBox.height</code> to <code>int(TheBox.height)</code> in your expression. There are also <code>ceil</code> and <code>floor</code> functions if you want to round to the next lower/higher number before truncating.</p>
Using HTTP in Angular 2: @angular/http/bundles/http.umd.js/src not found <p>I try to use HTTP module in angular 2. Here are the parts of code I added, hoping it'd be enough (not including usage of it):</p> <p><strong>systemjs.config.js</strong> (mapping)</p> <p>'<code>@angular/http': 'npm:@angular/http/bundles/http.u...
<p>You are using <strong><code>Http</code></strong> wrong way in Angular2, It should be,</p> <pre><code>import { HttpModule } from '@angular/http'; @NgModule({ imports: [BrowserModule,HttpModule], ... }) </code></pre> <p>Now in <strong>component</strong> <code>eg. AppComponent</code></p> <pre><code>impor...
Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables when trying to secure query <p>I wanted to secure my php code from sql injections using the bind_param functions and I came across this error. I checked the amount of ?'s and bind_params but they are ...
<p>You need to unquote your placeholders and concatenate the wildcards in the binding. Your error is because you have no placeholders in your query.</p> <p>Once you correct the placeholders you'll need to correct the binding call. The first parameter is what each variable being bound is so:</p> <pre><code>bind_param(...
python nested if statements not working <p>I'm trying to make a game using pygame, and I've set up a couple of functions that I've tested and they work fine. However, in the code below, when I add a print statement to show if my code works, it prints on the first one but not the second. Any help?</p> <pre><code>for s...
<p>I have just thought of something</p> <p>I am using <code>row.index(square)</code>, which is finding the <strong>first</strong> 'g' square and using the tile_x of <strong>that</strong> first square. This means it thinks the square I'm looking for is not in the correct range to show on the map, so the first if statem...
My WebJob is missing dependency <p>I've created a webjob with a simple C# Console application. I make use of the Azure blobs and a database connection - locally everything works like a charm.</p> <p>In Azure portal I've made a simple app where I added my exe and force it to run. From the logs i get:</p> <pre><code>[1...
<blockquote> <p>Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.</p> </blockquote> <p>According to the error you provided, I recommend that you could try to make s...
Where to find a dataset for Cross-Site Scripting (XSS)? <p>I'm working on a project related to XSS and currently I need a dataset that I can run through WEKA for example, to test some classification algorithms. I've been searching for it on Google but no luck.</p> <p>Please help me if you can, I would be very grateful...
<p>You can have a look at this: <a href="https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet" rel="nofollow">XSS Cheat Sheet</a></p>
Unenroll Moodle users in a category using SQL <p>I need to <strong>unenroll</strong> all the <strong>users</strong> at once <strong>from all the courses</strong> in a specific <strong>category</strong> (chosen by name or shortname) in my <strong>moodle</strong> site. I think that a SQL statement is the way to do this....
<p>I have not tested the following solution, but it should produce the desired effect:</p> <pre><code>require($CFG-&gt;libdir . '/coursecatlib.php'); require($CFG-&gt;libdir . '/enrollib.php'); $categoryid = 0; // Replace with the desired category ID. $category = coursecat::get($categoryid); foreach ($category-&gt...
MYSQL select category that contains at least two elements from another table <p>Ecommerce: say I have two tables, one Categories, another Items.</p> <pre><code>Categories ------- category_id category_name Items ----- item_id item_name category_id </code></pre> <p>I need to select &amp; list on my page all those Cate...
<p>What you are looking for is a simple aggregation where you group by category and count items.</p> <pre><code>select c.category_id, c.category_name, count(*) as items from categories c join items i on i.category_id = c.category_id group by c.category_id having count(*) &gt;= 2 order by c.category_id limit @sk...
Retrieve all the classes annotated with a specific annotation(s) <p>I have defined a simple annotation in scala like this</p> <pre><code>case class MyAnnotation(value: String) extends StaticAnnotation </code></pre> <p>and then some classes that use this annotation</p> <pre><code>@MyAnnotation("en_US") class TestAnno...
<p>Over <a href="http://stackoverflow.com/questions/28214579/scala-reflection-finding-and-instantiating-all-classes-with-a-given-annotation">here</a> most likely the same question was asked and it was recommended to use <a href="https://github.com/ronmamo/reflections" rel="nofollow">reflections library</a>. <a href="ht...
Invalid length for a Base-64 char array or string on PDF blob data from Dynamics CRM <p>I am working on some code to read out the BODY field from a Dynamics CRM Email attachment and decode the Base64 string back to a file to write to the file system.</p> <p>This process seems to work fine on image files like .PNG etc,...
<p>This is just a guess of mine, I have no idea if this works.</p> <p>Sometimes the character encoding is wrong because text files may have a BOM (<a href="https://en.wikipedia.org/wiki/Byte_order_mark" rel="nofollow">Byte Order Mark</a>) and just arbitrary binary data can interfere with it. You can force the encoding...
How to run firebird as an application? <p>I have downloaded ZIP file and unpacked it.</p> <p>Now, it is said, that FB can run as an application. How to run it this way?</p> <p>Running <code>firebird.exe</code> does nothing.</p> <p>I don't want to install it as a service. </p>
<p>Ok, it is </p> <pre><code>firebird -a </code></pre> <p>It is not listed here: <a href="http://firebirdsql.org/manual/firebird-commandline-utilities.html" rel="nofollow">http://firebirdsql.org/manual/firebird-commandline-utilities.html</a></p>
alternative to multiple data selector <p>I'm using <a href="https://github.com/no81no/jplist" rel="nofollow">jplist</a> plugin and following contributor's recommendations to toggle sorting.</p> <p>But having issue with multiple data-attribute selector.</p> <p>To trigger I need to select the element by multiple attrib...
<p>You have to remove the space between the attributes, so this</p> <pre><code>$('button[data-path="' + sortpath1 + '"] [data-order="desc"]') </code></pre> <p>becomes this</p> <pre><code>$('button[data-path="' + sortpath1 + '"][data-order="desc"]') // ^^ look ma, no space </code><...
HTML5 Canvas and JS Framerate slowly drops to 0 <p>I am trying to setup an html 5 canvas for a game and my fps starts out fine but then it slowly falls to 0 fps and lags the browser window out. I feel like I am missing something very important.</p> <p>JS I am using to manage the refresh and drawing:</p> <pre><code>va...
<p>The reason is, you are not clearing your paths. Use </p> <pre><code>context.beginPath(); </code></pre> <p>at the begin of <code>draw()</code>. This question was asked before <a href="http://stackoverflow.com/questions/9558895/html5-canvas-slows-down-with-each-stroke-and-clear#9559703">here</a></p>
Updating MongoDB document with a wildcard in field name <p>Have a fairly deeply nested document, part of the nesting includes an object that's a hash of ObjectIDs and a corresponding object. I need to update all the documents in the collection by updating just one value in the nested object. So I'm aware that if I ha...
<p>I suppose you know the UUID's :P It's not a array but nested document structure which comes to a update command like:</p> <pre><code>db.mycollection.update({}, {$set : {"addresses.0934029572035702834234092834.street" : "124 Baker St"}}, {multi: true}); </code></pre>
Plot multiple surfaces <p>I'm trying and plot multiple surfaces on the same chart with Plotly package but I just can't get it done. A few days ago I could do this with no problem using the same code, but now it seems that after an update on Plotly it's not possible anymore. Here is an example of what I'm trying to do:<...
<p>Solved. Re-wrote code to:</p> <pre><code>#Create Plotly object plot_ly(showscale = FALSE) %&gt;% #Volcano surface add_surface(z = volcano) %&gt;% #First rectangle add_surface(x = c(10, 60), y = c(10, 50), z = matrix(160, nrow = 2, ncol = 2)) %&gt;% #Second rectangle add_surface(x = c(...
Funcitonal Opposite of Subtract by Key <p>I have two RDDs of the form RDD1[K, V1] and RDD2[K, V2]. I was hoping to remove values in RDD2 which are not in RDD1. (Essentially an inner join on each of the RDD's keys, but I don't want to copy over RDD1's values.)</p> <p>I understand that there's a method <code>subtractByK...
<p>You cannot avoid having some type of value here so applying <code>join</code> and mapping values seems to be the way to go. You can use:</p> <pre><code>rdd2.join(rdd1.mapValues(_ =&gt; None)).mapValues(_._1) </code></pre> <p>which replaces values with dummies (usually you can skip that because there is not much to...
Is there any callback function for Upload Image addon for CKEditor? <p>I am using CKeditor in my project and I have a requirement where I need to upload images too.</p> <p>I have downloaded <a href="http://ckeditor.com/addon/uploadimage" rel="nofollow">http://ckeditor.com/addon/uploadimage</a> Addon and it works fine....
<p>you can set <code>CKEDITOR.config.filebrowserUploadUrl</code> dynamically when you call <code>CKEDITOR.replace()</code>; this gives the ability to set different <code>UploadUrl</code> in different page. </p> <p>In your case I think you just need append different query string to <code>uploadUrl</code></p> <p>like:<...
Add tab to anchor text with regex <p>I have something like this ;</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-html lang-html prettyprint-override"><code>&lt;a href="#" class="example"&gt; Link 1 &lt;/a&gt; ...
<h2>Edit, following the question extension</h2> <p>From his comments, it now appears that the OP targets a more general use, adding <code>\t</code>s to <em>indent all lines</em> between the opening and closing tag.<br> Then its time to remember that <strong>regex is not a good way to parse HTML</strong>, as frequently...
Adding same extensions to multiple controls in winforms <p>I want to add some extensions like move, resize,... to <code>PictureBox</code>, <code>Label</code>, <code>Panel</code> like this:</p> <pre><code>public class LiveControl: PictureBox { private Point cur = new Point(0, 0); public LiveControl() { ...
<p>You can encapsulate the logic in a helper class deriving from <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.nativewindow(v=vs.110).aspx" rel="nofollow"><code>NativeWindow</code></a> class. This way you can do the job without creating a derived class for each control which you want to move/re...
Pushing Laravel 5.2 app to Heroku, all files in public/ are missing <p>I have a Laravel application deployed on Heroku. However, all files that are in 'public' folder of my application are not loaded.</p> <p>That is, no css and / or js are loaded pages after deployment. Only HTML is loaded.</p> <p>This is the structu...
<p>It's very strange.</p> <p>Are you sure that the files exist in the public folder?</p> <p>Laravel 5.2 does not include html helpers function out the box, do you update your composer? </p> <p>You can remove helper function and try without it, just use... </p> <p>for css </p> <pre><code> &lt;link href="/css/bootst...
PHP explode in array <p>I was wondering is it possible to convert the following array:</p> <pre><code>Array ( "2016-03-03 19:17:59", "2016-03-03 19:20:54", "2016-05-03 19:12:37" ) </code></pre> <p>Into this:</p> <pre><code>Array ( "2016-03-03", "2016-03-03", "2016-05-03" ) </code></pre> <p>W...
<p>There's no explicit loops, if you can use <a href="http://php.net/manual/en/function.array-map.php"><code>array_map</code></a>, although internally it loops:</p> <pre><code>function format_date($val) { $v = explode(" ", $val); return $v[0]; } $arr = array_map("format_date", $arr); </code></pre> <p>From the PHP...
counting COUNT(*) results in MySQL <p>I need to count the number of records returned from a MySQL query. </p> <pre><code>SELECT COUNT(sa.facility_hmis) AS deployed FROM facility_service_area sa GROUP BY sa.facility_hmis </code></pre> <p>this will give me lets say 6 rows as the result, but i need it to give ...
<p>If all you need is to count number of distinct <code>facility_hmis</code> you can do that explicitly, without counting of anything else:</p> <pre><code>SELECT COUNT(DISTINCT facility_hmis) FROM facility_service_area </code></pre>
In Highstocks, how do I change the default time/day labels when hovering over graph? <p>I have managed to change the default x-axis labels in highcharts/highstocks with a formatter function, but despite looking in the API I cannot figure out how to change the on-hover title (Example: When I hover over the columns for '...
<p>So you want to customize the tooltip? This is how to do it.</p> <p><a href="https://jsfiddle.net/yfgpg5x2/12/" rel="nofollow">https://jsfiddle.net/yfgpg5x2/12/</a></p> <pre><code> tooltip: { formatter: function() { var curTickLabelString = this.points[0].series.xAxis.ticks[this.x].label.text...
Python : Hash extension attack in python <p>I want to use h to generate the same md5 as b</p> <p>Here is the code:</p> <pre><code>k = "secret" m = "show me the grade" m2 = "show me the grade and change it to 100" x = " and change it to 100" a = md5(k + m) b = md5(k + m2) print "have---&gt; " + a.hexdigest() #9f4bb32a...
<p>This is because the hash you expected (aba1..) is the md5 hash of <code>k + m + x</code> while the hash you got (958a..) is the md5 hash of <code>k + m + padding + x</code>.</p> <p>The length extension attack lets you generate a hash <code>h2 = md5(k + m + padding + x)</code> based on only knowing the hash <code>h1...
How to join two supplier results <p>I have selected and used sum() over PARTITION for the sales data every month by branch. I have tried group by but then I could not get the branch total sales.</p> <p>And I want to specifically see the results of two suppliers and their value in percentage to total sales. </p> <pre>...
<p>It is not the best solution and it is not the final one, but I have not enough information - for example I don't know how do you join to dim table. I guess you should use PIVOT. Here goes some dirtier solution:</p> <pre><code>SELECT sv.Branch [Branch] --,dim.ExclusiveGroup_KEY [Exclusive Tag] ,(SELECT SUM(svint.Rev...
Hide Android keyboard in Nativescript on input field blur <p>I have a registration form which contains several TextFields and other inputs. When a user taps one of the fields the Android soft keyboard will always show as expected. If I tap outside of the field though the keyboard does not hide. Is there a way to captur...
<p>You can put the on tap listener to the parent view so that when you click on it (anywhere outside textfield), it will clear the focus of the textfield that are showing keyboard. The way you are doing is to clear the focus of the container while it should be exactly the textfield:</p> <p>In XML:</p> <pre><code>&lt;...
Why does this While loop cycle twice? <p>I made this while loop that is supposed to fulfill functions for different shapes and after it fulfills the function for that shape, it will keep asking for shapes until the user types "Exit". I have only done Triangles so far so I just have some filler functions to fulfill to m...
<p>It might be that you are using <code>keyboard.nextLine();</code>. In your code outside the while loop make sure that you are always using <code>.nextLine()</code> and nothing else.</p> <p>Reasoning: If you use <code>.next()</code>, it'll only consume one word so the next time you call <code>.nextLine()</code>, it'l...
Is there a solution for transpiling Lua labels to ECMAScript3? <p>I'm re-building a Lua to ES3 transpiler (a tool for converting Lua to cross-browser JavaScript). Before I start to spend my ideas on this transpiler, I want to ask if it's possible to convert Lua labels to ECMAScript 3. For example:</p> <pre class="lang...
<p>I can't quite follow your idea, but it seems someone already solved the problem: JavaScript allows labelled <code>continue</code>s, which, combined with dummy <code>while</code> loops, permit emulating <code>goto</code> within a function. (And unless I forgot something, that should be all you need for Lua.)</p> <p...
jQuery - Not adding class in safari? <p>I've written some jQuery which works with the Image Map Hotspot plugin to add classes to the pop-up based on the icon used. </p> <p>This works across Chrome and Firefox, but not in Safari, I was wondering if anyone could identify why?</p> <pre><code>$(window).load(function() { ...
<p>Thanks To Jaromanda X - Not sure why I didn't think of logging the bgImg to see what Safari thought it was!</p> <p>Turns out Most browsers were returning the url("http://...") string, whereas Safari was dropping the double quotes, resulting in the url being tracked as url(<a href="http://.." rel="nofollow">http://....
Y86 Code - doesn't return or show rax <p>I am doing a class project which I am to take C code, turn it in x86-64 assembly and then change it to Y86. An in this I am suppose to return the sum of the elements in a linked list to to rax. However, when i try to use the y86 compiler, it doesn't appear. The y86 I made looked...
<p>Looking at the code, it seems that the pointer to node should be at 16(rbp), not 24(rbp). 0(rbp) = saved rbp value, 8(rbp) = return address, 16(rbp) = pointer to node (to the linked list). I don't see where the extra 8 bytes are pushed onto the stack before rbp is saved.</p> <p>The program ends at a halt instructio...
How do I resize a Label's width? <p>I've been trying to resize a label's width for a while, but it seems IMPOSSIBLE, or at least incomprehensible for me...</p> <p>I'll explain my situation with images for the sake of clarity.</p> <p><a href="http://i.stack.imgur.com/buTNI.png" rel="nofollow"><img src="http://i.stack....
<p>You may want to read about frame clock in Gtk 3.12. Here is a good <a href="https://blogs.gnome.org/alexl/2013/11/04/the-modern-gtk-drawing-model/" rel="nofollow">article</a>. The new method to use in order to queue a resize is Gtk.Widget.queue_resize()</p> <blockquote> <p>If some state changes that causes the si...
JS debug - var bankroll value is way off <p>This is the first JS program I've ever written so any help would be greatly appreciated!</p> <p>I'm getting a bankroll value that is WAY off. For instance if you use</p> <p>runs=1, start=5000, bonusMultiplier = anything between 0 and 1</p> <p>I am usually getting a value ...
<p><code>start</code> is being interpreted as string. If you sum a string and a number, the number gets converted into a string, which is then concated with the other one. Change </p> <pre><code>start = prompt("Starting chips?"); </code></pre> <p>to </p> <pre><code>start = parseFloat(prompt("Starting chips?")); </co...
How to implement voting system closing date feature? <p>I am implementing a node.js not real-time poll creating and voting system, where the admin can create a poll and set a closing date and then when this date is arrived the system closes the poll, send subscribed users an email and the users can't vote anymore. I ha...
<p>There are two basic approaches - in-process and out-of-process. In-process is simpler, but it requires your main program to be running. Out-of-process is more robust, because you can use systems whose primary function is to reliably execute scheduled jobs (cron for example).</p> <p>For the in-process approach in Ja...
ERROR: could not find function "chartJSRadarOutput" deploy <p>My shiny app performs successfully at my local computer, but when I want to deploy it, it says <code>ERROR: could not find function "chartJSRadarOutput"</code> However, I have <code>library(radarchart)</code> already.</p> <p>I also went through this <a href...
<p>You need to load the package in both files. I tested this on my own shinyapps.io account and the error went away.</p> <p>Your code still has the error I mentioned in the comments (<code>2016-10-10T02:14:15.159934+00:00 shinyapps[130687]: Warning: Error in &lt;-: object 'output' not found</code>) because it's missin...
Alert the user that other datatypes (eg string) was inserted without crashing <p>This is the interface for calculation. The interface has two methods <code>calculateArea</code> and <code>totalCost</code>.</p> <pre><code>public interface ICalculation { int calculateArea();int totalCost() } </code></pre> <p>Here I'm ...
<p>I would say validate using a while loop.</p> <pre><code>int i; while (true) { var line = Console.ReadLine(); if (int.TryParse(line, out i)) break; Console.WriteLine("Invalid number"); } </code></pre>
Pascal's Triangle Formatting Issue for "n" Rows (Java) <p>I am trying to create and properly format Pascal's Triangle where the user inputs a value "n" for the number of rows that will be output. The issue here is getting the proper format past 13 rows. I am thinking the issue resides with the %4d since numbers that ...
<p>This is a possible solution using a matrix...</p> <pre><code>import java.util.Scanner; public class PascalTriangle { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Type N: "); pascalTriangle(scanner.nextInt()); scanner.close...
cronjob can't find file on EC2 <p>I have a script, called <code>script.py</code> that is on an EC2 instance. The script reads a file in the same folder (code: <code>open(data.csv, 'r')</code>) called <code>data.csv</code>. Here is the cron job:</p> <pre><code>* * * * * /home/ubuntu/anaconda3/bin/python /home/ubuntu/pr...
<p>Assuming <code>/home/ubuntu</code>...</p> <pre><code>* * * * * cd /home/ubuntu/ &amp;&amp; ./anaconda3/bin/python ./project/script.py &gt; /var/log/myjob.log 2&gt;&amp;1 </code></pre> <p>Adding <code>2&gt;&amp;1</code> to the end is unrelated to your question, but captures the <code>STDERR</code> output into your ...
display DateTime format into readable string in PHP <p>i have a stored DateTime with this format [2016-10-05 11:58:04]. What i want to do is, display the stored time into this readable format [Wed, 11:58 AM].</p>
<p>Since you tagged your question with <code>mysqli</code> and <code>php</code> here are solutions for both:</p> <h2>MySQL</h2> <p>You can format the date directly in your query:</p> <pre><code>select DATE_FORMAT(column_name, "%a, %h:%i %p") AS formatted_date FROM table_name </code></pre> <p>See docs: <a href="http...
static constexpr member initialization in header only library <p>I have <a href="https://stackoverflow.com/questions/11709859/how-to-have-static-data-members-in-a-header-only-library">found</a> <a href="https://stackoverflow.com/questions/28226251/static-member-in-header-only-library">questions</a> that are almost exac...
<p>The issue here does not appear to be the default parameter, but the initialization. By switching to the uniform initialization syntax, and explicitly declared the static class member, this compiles without issues, with gcc 6.2.1:</p> <pre><code>#include &lt;chrono&gt; template &lt;typename T&gt; class Foo { public...
Websphere 7 jconsole support but with memory and threads <p>I went through these steps and got jconsole to connect to IBM websphere but the memory is greyed out and disabled, I want to be able to monitor memory usage in real time. I see the mbeans configuration. I basically want to use jconsole to connect to a local ...
<p>To monitor basic parameters of the IBM JVM you can could use <a href="https://www.ibm.com/support/knowledgecenter/SS3KLZ/com.ibm.java.diagnostics.healthcenter.doc/topics/introduction.html" rel="nofollow">IBM Health Center</a> instead of jConsole. It can be installed either as a add on to IBM Support Assistant, or as...
Java AWT fillOval() not working <p>I'm working on a program that draws a graph, so I would like to draw points! I'd like the points to be circular since that's usually how points are represented, and to the best of my knowledge, <code>g2.fillOval(x, y, height, width)</code> should draw a filled oval with height <code>h...
<p>You will want to set your Graphic2D's RenderingHints to handle aliasing. This smooths out the jaggies that may be causing your (small) circle to render as a square. Something like:</p> <pre><code>Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);...