input
stringlengths
51
42.3k
output
stringlengths
18
55k
How to convert RGBA style color to canvas friendly color? <p>I am trying to draw on canvas with the same colour as a computed style.</p> <p>for colours like so it is fine:</p> <p>rgb(0, 255, 255)"</p> <p>but for something like </p> <p>rgba(0, 0, 0, 0)</p> <p>is is black on the canvas but white in the browser</p>
<h2>Matching DOM colour blending</h2> <p><strong>Red, Green, Blue and the Alpha channel</strong></p> <p>For the most part all the graphics you see in your browser is comprised of 4 channels. The first 3 are colour channels and represent the intensity of each component colour, red, green, and blue. The fourth channel ...
What's the name of the "=>" operator in linq (e.g .Select(x=>x.Prop1) ) <p>What's the name of the "=>" operator (e.g in C# linq .Select(x=>x.Prop1) )</p> <p>It might not even be an operator.</p> <p>Does it have a different name in different languages (C# vs JavaScript)</p> <p><em>Tagging as operator / C# / javascri...
<p>In C# it's called a "lambda operator". In JS it's called an "arrow function operator".</p> <p>References:</p> <ul> <li><a href="https://msdn.microsoft.com/en-nz/library/bb311046.aspx">https://msdn.microsoft.com/en-nz/library/bb311046.aspx</a></li> <li><a href="http://www.ecma-international.org/ecma-262/6.0/#sec-ar...
NAudio Mp3Frame is null while streaming mp3 <p>I am trying to make an mp3 player by streaming. The mp3 file which is on the internet source can be played in real-time in this project. Also I want to make it supports Pause, Stop, Forward, Backward. To get these features, I need to write a flexible player.</p> <p><stron...
<p>If you get a null MP3 frame then this simply means it could not find an MP3 frame in the input data. So are you sure it's valid MP3 you are passing in.</p> <p>Also you may want to check out my blog post about <a href="http://markheath.net/post/how-to-play-back-streaming-mp3-using" rel="nofollow">playing streaming M...
Blocking collection with multiple elements? <p>All C# of the implementations for producer-consumer collections [1] [2] seem to have interfaces vaguely similar to:</p> <pre><code>private Queue&lt;T&gt; items; public void Produce(T item) public T Consume() </code></pre> <p>Any implementations out there like the follow...
<blockquote> <p>The hope is that this would let me produce/consume varying numbers of items at a time without requiring excessive per-item locking.</p> </blockquote> <p>You could use the <a href="https://msdn.microsoft.com/en-us/library/dd267312.aspx" rel="nofollow"><code>BlockingCollection&lt;T&gt;</code></a> class...
Unable to grow my linked list <p>Given below is my code snippet for linked list. I am not able to add number. Whenever I try to add to my list, numbers are getting replaced, so my list never grows. Can you please let me know what is wrong in this code. It would also be very helpful if you could comment on my coding fas...
<p>Why are you using reset on shared pointer?</p> <p><a href="http://en.cppreference.com/w/cpp/memory/shared_ptr/reset" rel="nofollow">http://en.cppreference.com/w/cpp/memory/shared_ptr/reset</a></p> <p>Check the following example:</p> <p><a href="http://codereview.stackexchange.com/questions/33136/singly-linked-lis...
How to sum several months of data separately in a MongoDB collection <p>I'm trying to tally a field in a sub-array of a collection and I want to do it for each month. I had this working in Mongo 2.6 but recently upgrading to 3.0.12 has cause some erroneous results in the query. It almost seems like the sum is not getti...
<p>It seems to be a problem during the <code>$match</code> phase. Your <code>date</code> field has two expressions, and this scenario you need to use the <code>$and</code> operator, as specified in the <a href="https://docs.mongodb.com/manual/reference/operator/query/and/" rel="nofollow">docs</a>:</p> <blockquote> <...
CPU Usage while packet forwarding <p>I'm trying to measure the CPU usage on a dual core ARM Cortex A9 processor to benchmark a it. It will be used a router. I enabled ip forwarding and I'm running iperf tests along with monitoring the CPU usage using top. I'm a little confused about interpreting the results from <stron...
<ol> <li>It means that process context kernel usage is 0.5% i.e. non IRQ/Softirq usage in kernel is 0.5%. 40.5% is softirq as you clearly say. Effective CPU usage is as you say</li> <li>probably because either you<br> a) have only one hard irq for your network device and that's tied to core 0 or<br> b) all IRQs are tie...
Select statement stops working when wrapped in view [Oracle] <p>I have a select statement in a stored procedure that I'd like to pull out and put into a view. The select statement pulls from dba_tables, dba_tab_partitions, and dba_tab_subpartitions.</p> <p>If I run the statement on its own, it works fine. If I wrap it...
<p>This might be caused by the difference between the system privilege <code>SELECT ANY DICTIONARY</code> and the role <code>SELECT_CATALOG_ROLE</code>.</p> <p>On the surface they do the same thing by granting users access to the data dictionary. Either one of them would enable a user to run a query against tables li...
default viewport width of browser <p>All:</p> <p>I am pretty to HTML tag, when I try to follow the tutorial on Udemy about web optimization, there is one lecture says if I do nto set viewport tag, the browser will use 980px as default viewport width, so if I have a body with style <code>width :100%;</code> then it wil...
<p>He said "typically", that does not mean it has to hold for your tested browser. Also, this hold mainly for mobile browsers. So if you check this out at a desktop browser, a body of 100% width, is 100% width, I have never seen a browser which sets its viewport to less.</p>
wildfly 10 database login module <p>I am trying to get the database login module to work with my project in the Wildfly 10 container.</p> <p>I have followed this tutorial: <a href="https://www.examsmyantra.com/article/119/javaee/form-based-login-authentication-in-javaee7-with-wildfly-and-mysql" rel="nofollow">https://...
<p>Okay I was rubber ducking here :S While explaining the problem I realised that it was a policy problem because username was already okay in the EJB</p> <p>And the error "Failed to instantiate class Database: java.lang.ClassNotFoundException" gave me an idea to look at the documentation for policy-module <a href="h...
What would cause click event to fire multiple times? <p>I have a small todo list I made for practice. Here is a <a href="https://jsfiddle.net/railsarr/vr7rn6rt/" rel="nofollow">Fiddle</a> , I cant seem to figure out why the click event that toggle the class that adds and removes the line-through in the todo works on so...
<p>Like Mike commented, you're adding a new handler to the elements again on every enter keypress, instead use <a href="https://learn.jquery.com/events/event-delegation/" rel="nofollow">event delegation</a></p> <hr> <h3>To further explain:</h3> <p>When you add an event handler as shown below, jQuery looks through th...
PostgreSQL check if all surrogate IDs exist in table <p>How do I check if an arbitrary array of user IDs, e.g., <code>'{1, 2, 3}'</code>, all exist in my <code>users</code> table, where <code>users.id</code> is a <code>bigserial</code> and <code>PRIMARY KEY</code>?</p> <p>UPDATE: Thank you for the different solutions....
<p>One method would be to aggregate your ids and use contains operator for arrays</p> <pre><code>select array_agg(id) @&gt; '{1,2,3}' from users </code></pre> <p>Another one would be to unnest the values from array and join it with the table to perform a <em>boolean and</em> across the set</p> <pre><code>select bool...
Python sqlite3 'executemany' not successfully updating my database <p>I'm trying to extract a column from my database, apply a transformation, and create a new column with the results. </p> <p>I ultimately want to save the local variable 'new_proba' (which has a length of 740, the same length as my database) as a new ...
<p>Those values aren't plain <code>float</code>; they're <code>numpy.float64</code>, which the database can't handle.</p> <p>Convert your values to plain <code>float</code> and <code>int</code> like this:</p> <pre><code>new_proba = list(float(z) for z in clf.predict_proba(X)[:,1]) IDs = list(int(zz) for zz in np.aran...
How to update related table in Laravel? <p>I am using Laravel <code>5.3</code>.<br> How to update related table in Laravel?</p> <p>There are 2 tables,<code>students</code> and <code>hobbies</code>, they have many-to-many relations. </p> <p>In view,hobbies are checkboxes,like this:</p> <pre><code>&lt;input class="f...
<p>You shouldn't use update. Use the <code>sync</code> method:</p> <pre><code>$student-&gt;hobbies()-&gt;sync($request-&gt;hobby); </code></pre>
Issue with base64 encoding of data using HMAC <p>Using Nodejs, I'm attempting to generate a HMAC SHA256, base64-encoded signature of an XML message. I currently have the signature generation working using PHP.</p> <p>The process seems fairly straightforward, and I'm able to generate base64-encoded value with Nodejs bu...
<p>The problem here is that PHP's <code>hash_hmac()</code> returns a hex-encoded string by default (see the <code>$raw_output</code> parameter <a href="http://php.net/hash_hmac" rel="nofollow">here</a>), so you are base64-encoding a hex string instead of the actual of the raw, binary result.</p> <p>So change this:</p>...
I can't create an instance of a class c# <p>Okay, so what I'm trying to do here is create an array of classes. My class TEAMLEADER is derived from an abstract class, Employee. However when I try to create an instance of TEAMLEADER in Main, I get an error message saying TEAMLEADER cannot be found. </p> <pre><code>names...
<p>Have you tried adding:</p> <pre><code>using Lab3; </code></pre> <p>to the top of your Main class file?</p>
differences between "this" and "super" when accessing inherited members <p>I'm new to java. Recently I saw some code which was similiar to this:</p> <pre><code>class A { protected int myInt; public static void main(String[] args) { B b = new B(); b.myFunction(); } } class B extends A { ...
<p>You only need to use <code>this</code> or <code>super</code> when need to specify which scope are you using/referring to. In your case, I'll prefer to omit the <code>this</code> to simplify the readability.</p> <p><code>super</code> is used to represents the current instante of a parent class while <code>this</code...
How do I pull data from a Slack API response with WebClient? <p>I am making a portal for our team's Slack channel, and I'm wanting to pull a list of all of our current users using the Slack Web API - using the method <code>api/users.list</code>.</p> <p>The code I am playing around with is:</p> <pre><code>var response...
<p>I needed to encode the response.</p> <p>Just add this after:</p> <pre><code>var encoding = new UTF8Encoding(); var responseText = encoding.GetString(response); </code></pre> <p>I can then use the responseText to pull out the data I need.</p>
How to make xticks evenly spaced despite their value? <p>I am trying to generate a plot with x-axis being a geometric sequence while the y axis is a number between 0.0 and 1.0. My code looks like this:</p> <pre><code>form matplotlib import pyplot as plt plt.xticks(X) plt.plot(X,Y) plt.show() </code></pre> <p>which ge...
<p>You can do it by plotting your variable as a function of the "natural" variable that parametrizes your curve. For example:</p> <pre><code>n = 12 a = np.arange(n) x = 2**a y = np.random.rand(n) fig = plt.figure(1, figsize=(7,7)) ax1 = fig.add_subplot(211) ax2 = fig.add_subplot(212) ax1.plot(x,y) ax1.xaxis.set_ti...
How to manage a YouTube account's playlist automatically <p><strong>What I need</strong></p> <blockquote> <p>I'm working on a C# app that scans Facebook messages for youtube links and adds each new video to an existing playlist. If the playlist doesn't exist yet, it needs to be created.</p> </blockquote> <p><st...
<p>You can use the <a href="https://developers.google.com/youtube/v3/docs/" rel="nofollow">YouTube Data API v3</a> to access the data:</p> <ol> <li><a href="https://developers.google.com/youtube/v3/docs/playlists/list" rel="nofollow">Playlists: list</a> - will allow you to list all the playlists of a user</li> <li><a ...
How to access main thread from worker thread in Java? <p>Read many <a href="http://stackoverflow.com/questions/28604984/how-can-i-get-main-thread-from-thread-currentthread">overkilled</a>, <a href="http://stackoverflow.com/questions/16268693/running-code-on-the-main-thread-from-a-secondary-thread">overcomplicated</a> s...
<p>In Android you can't access the main thread (UI Thread) directly, but you can queue jobs on it, so you need to create a <code>Handler</code> and using that handler to post jobs (<code>Runnable</code>) on main thread.</p> <p>Below is an example of how you can post on <code>UI Thread</code> using <code>Handler</code>...
Template error when doing 3 levels deep of kendo grids (i.e. a detail grid for a detail grid of a main grid) <p>If I have a main Kendo cshtml view with a kendo grid that has a detail that is another grid which then has a detail that is another grid, an invalid template error occurs. An example is shown below with the ...
<p>The key to this problem turned out to be that the partial view reference to the 3rd level detail grid had to be in the top level view (index.cshtml) instead of in the partial view that actually referenced it. The code adjusted for this change is shown below.</p> <p>File 1 Index.cshtml</p> <pre><code>&lt;div id="d...
Apache RewriteRule not splitting variables into query string <pre><code>&lt;Directory /var/www/html/api/&gt; RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]*)(.*)$ index.php?version=$1&amp;method=$2&amp;param1=$3&amp;param2=$4&a...
<p>It is not splitting because your regex is not breaking it into multiple groups.</p> <p>Your regex is capturing <code>(.*)</code> after <code>v1/</code> which will just capture <code>/hello/there/stranger</code> in a single group.</p> <p>You can use these different rules:</p> <pre><code># 2 parts RewriteRule ^([^/...
SQL update from one table to another based on column match on Apache Derby <p>N.B. I'm looking for a solution working on Apache Derby</p> <p>I have two sql tables. The first, called <code>links</code>, contains links of the form</p> <pre><code>SOURCE | TARGET 1234 | 456 15 | 625 ... | ... </code>...
<p>You can't specify multiple tables in an UPDATE list. </p> <p>If ID in the redir table is unique, you should be able do something like this:</p> <pre><code>update links set target = (select redirtarget from redir where redir.id = links.target) where exists (select * ...
Need a way to test SSH with a timeout <p>This is my current code to test if a host is SSH-able. It works just fine when the host is up with or without SSH service running. However, it seems to just hang when the host crashes, which is the unique usecase that I need to depend on it giving me a quick True/False response....
<p>You need to determine if it is actually a connect timeout, or if it can connect, but the server is accepting the connection and doesn't send anything.</p> <p>If you were to use telnet to manually test, telnet 22 and see if you get a response from the server at all, you should see something like this if it connects...
Android - Recyclerview adapter show Images from External Storage <p>I want create image gallery with RecyclerView where use images from phone. I didn't find any RecyclerView adapter which fill image with File type. Is it possible?</p>
<p>For basic functionality of RecyclerView adapters: <a href="http://guides.codepath.com/android/Using-the-RecyclerView" rel="nofollow">http://guides.codepath.com/android/Using-the-RecyclerView</a></p> <p>In your <code>onBindViewHolder</code>, you can get your image like this:</p> <pre><code>String path = Environment...
CreateJS/TweenJS Losing Scope with "change" on Tween <p>I am on a frame in Animate by Adobe. When I add a "change" listener to my tween I lose scope when I hit the change function called animateParticle. Also related, the tween attached to the particle doesn't recognize .setPaused(true) function. </p> <pre><code>this....
<p>The target of the change event will not be the particle, but the tween itself, since it is the dispatching object.</p> <pre><code>createjs.Tween.get(particle).to({x:1000}, 2000) .on("change", function(event) { console.log(event.target); // Tween console.log(event.target.name); // undefi...
Programmatically add label to Message App in Swift? <p>I know this is new with iOS10 and all, but Im trying to build a simple ms messageappextension app, and all the tutorials Ive found add their labels, buttons, etc via storyboard.</p> <p>I hate autlayout and don't use storyboard, so I need to find how to add element...
<p>Change your center calculation to use the height of the superview for <code>y</code>, rather than a portion of the width:</p> <pre><code>pointsLabel.center = CGPoint(x: view.bounds.width * 0.5, y: view.bounds.height * 0.5) </code></pre> <p>While compact, the width is actually greater than the height, so <code>view...
Laravel 5.2 PHPUnit JSON Api request body not being set <p>I am testing POSTing data to an API endpoint we've created using Laravel 5.2, but none of the parameters seem to be reaching the application in the test. The endpoint expects json and responds with json and uses a FormRequestValidator which has required rules f...
<p>422 is the error response for validation errors.. which means either your data is not posted or it doesn't pass server validation, try </p> <pre><code>$this-&gt;json(Request::METHOD_POST, '/v1/cars', [ 'active' =&gt; true, 'make' =&gt; 'Audi' ], ['Authorization' =&gt; 'Bearer '.\JWT::fromUs...
I need to make py to exe. I'm using python 3.5.2 <p>I need to make py to exe. I'm using python 3.5.2. Try to install pyinstaller for it. But didnt understand how it install it properly or how to use it? I'm a beginner of python. Could someone please explaine in in very basic manner? Thank you for your time.</p>
<p>First install pyinstaller with pip: <strong>pip install pyinstaller</strong></p> <p>If the installation is successful, try to create an exe with the following command:</p> <pre><code>pyinstaller --onefile [your_script].py </code></pre> <p>Update your question with the errors, if you get any.</p>
Spring Boot + JdbcTemplate has unexplained query slowness? <p>I'm using Spring Boot with JdbcTemplate and the default Tomcat connection pool.</p> <p>When I hit a route in my MVC application, it runs a query using JdbcTemplate. Here are the logs:</p> <pre><code>Sep 16 16:04:34 beta.dw java[24249]: 2016-09-16 16:04:34....
<p>This turned out to be a performance issue related to MySQL running in a VM.</p>
How to write a recursive function to print a string a certain number of times? <p>I have been trying to write a python function which will receive two arguments: <code>x</code> which is the number of times to repeat and <code>y</code> which is the number or string to be repeated.</p> <p>So far this is what I have been...
<p>True functional recursion should have <em>no</em> assignments (i.e. state). This can be achieved using what's called an <em>accumulator</em>, i.e. an array that is built up successively and passed to each recursive step, until the base case occurs, causing the accumulator's final form to be returned directely, and i...
Unable to successfully call a class string in a for loop <p>I have a class</p> <pre><code>class zero: top = " __ " mid = "| |" bot = "|__|" </code></pre> <p>And I want to use a loop to call the different sections. E.g.:</p> <pre><code>def printnum(list): chunks = ['top','mid','bot'] print section ...
<p>Your <code>zero</code> class doesn't have an attribute called <code>section</code>, what you can do instead is to use <code>getattr</code> which accepts a string (second argument) as the object property to get, like this:</p> <pre><code>class zero: top = " __ " mid = "| |" bot = "|__|" chunks = ['top','mid'...
Sitecore 8.2 Autofac Dependency Injection Error Clarification <p>I'm getting an error below when trying to use the Autofac DI with Sitecore 8.2:</p> <blockquote> <p>The dependency resolver is of type 'Sitecore.Mvc.Controllers.SitecoreDependencyResolver' but was expected to be of type 'Autofac.Integration.Mvc.Aut...
<h1>Root of the issue</h1> <p>This happens because <code>AutofacDependencyResolver</code> is not MVC's current dependency resolver. Here's the description of how <code>AutofacDependencyResolver.Current</code> attempts to locate the current instance of itself:</p> <p><a href="http://docs.autofac.org/en/latest/integrat...
AlarmManager start alarm at specific time and turn off smartphone <p>hello if I create an alarmManager and set it to a specific time and turn off my smartphone, after reboot, is possible application do an old alarm? (my smartphone was off) I want to know if is it possible to do easily. thanks!</p> <p>this is how I set...
<p><code>AlarmManager</code> doesn't keep schedule after reboot. You must manually set it again. In Android, you can do this by receive signal <code>BootComplete</code> event, then trigger again <code>AlarmManager</code>.</p> <p>Firstly, you should declare your receiver in manifest file:</p> <pre><code>&lt;!-- permis...
NSPhotoLibraryUsageDescription supplied in info.plist but apple still asks for one <p>In my first upload from Xcode 8 to iTunes Store I received the following message from Apple</p> <blockquote> <p>This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NS...
<p>well, it turns out that the info.plist that I was editing in Xcode's left file list was not the plist that Xcode was referencing under identities. It was referencing an info.plist from a backup folder.</p> <p>So there was never a problem with the usage description keys.</p>
How to insert multiple elements into a list? <p>In JavaScript, I can use <code>splice</code> to insert an array of multiple elements in to an array: <code>myArray.splice(insertIndex, removeNElements, ...insertThese)</code></p> <p>But I can't seem to find a way to do something similar in Python <em>without</em> having ...
<p>To extend a list, you just use <code>list.extend</code>. To insert elements from any iterable at an index, you can use slice assignment...</p> <pre><code>&gt;&gt;&gt; a = list(range(10)) &gt;&gt;&gt; a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] &gt;&gt;&gt; a[5:5] = range(3) &gt;&gt;&gt; a [0, 1, 2, 3, 4, 0, 1, 2, 5, 6, 7, 8,...
Android: MATCH_PARENT vs FLAG_FULLSCREEN <p>What's the difference between <code>LayoutParams.MATCH_PARENT</code> and <code>LayoutParams.FLAG_FULLSCREEN</code>? while both give same result!</p> <p><code>ViewGroup.LayoutParams.MATCH_PARENT</code>:</p> <p><a href="http://i.stack.imgur.com/h9sOA.png" rel="nofollow"><img ...
<p><code>MATCH_PARENT</code> is used to fill the parent.</p> <p>And <code>FLAG_FULLSCREEN</code> is used to make full screen Window. (Hide statusbar )</p>
How to write not_if to check for directory or file permission <p>The below script runs every time I run my cookbook:</p> <pre><code>execute 'Change group ownership tomcat' do command 'chown -R tomcat.admin /usr/private/tomcat' end </code></pre> <p>Can someone advise how to write a <code>not_if</code> or something ...
<p>There isn't a great option here. Writing the code for this would be more tricky than it it probably worth. I would just let it run every time unless you really need to fix this :( This is on my list to fix at some point, but the short version would be to use <code>Dir#[]</code> or similar to get a list of every file...
YouTube iframe API video ad events <p>What events are issued when a pre-roll ad plays in stream before a video embedded with the YouTube iframe API? </p> <p>I want to make sure to show the player when the ad plays, but it appears that the ad plays outside of the normal queued, buffering, or playing events.</p>
<p>Based on this <a href="http://stackoverflow.com/questions/12464499/what-is-the-youtubes-playerstate-during-pre-roll-ad">SO question</a>, when the video with pre roll ad play, the <code>onStateChange</code> of the video is <strong>PAUSED or (2)</strong>.</p> <p>The <code>onStateChange</code> event fires whenever the...
nativescript angular2 tutorial bombs <p>Dudes of nativescript. Whats thats the delio with your tutorial? tns doctor is ok then why the below error? </p> <pre><code>'tns livesync ios --emulator --watch Executing before-prepare hook from /Users//Documents/frontend/sample-Groceries/hooks/before-prepare/nativescript-dev...
<p>Dependences version of the sample-Groceries project will be updated to the latest NativeScript version soon, however you could open your package.json file and change the following versions: </p> <p><code>tns-ios": {"version": "2.3.0"}</code></p> <p><code>"nativescript-angular": "1.0.0"</code> </p> <p><code>"tns-c...
Why does my div also include a div that is not its child? <p><a href="http://i.stack.imgur.com/ZDLXR.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/ZDLXR.jpg" alt="This is what I am looking for "></a></p> <p>Can you please check out this fiddle: <a href="https://jsfiddle.net/3047p0wy/" rel="nofollow">https://j...
<p>Is this what you're looking for: </p> <p><a href="https://jsfiddle.net/3047p0wy/3/" rel="nofollow">https://jsfiddle.net/3047p0wy/3/</a></p> <p>The HTML</p> <pre><code> &lt;nav class="navbar navbar-default"&gt; &lt;div class="container-fluid" id="navigation-bar"&gt; &lt;div class="navbar-header"&gt...
Use assert in normal code <p>I'm writing a python function to validate a token from an email. In the email, there is a url with the endpoint of it. I have two url parameters, the token and email address. In my endpoint I have to check : </p> <ul> <li>if the parameters are in the URL</li> <li>if there is a associate to...
<p>No, using <code>assert</code> for control flow rather than debugging is poor practice, because assertions can be turned off. Just use an ordinary <code>if</code> statement.</p> <pre><code># pull from url email = request.GET['email'] value_token = request.GET['token'] # test if valid token = EmailValidationToken.obj...
C# Use of unassigned local variable <p>I am trying to do make a basic program in C# that calculates netPay and grossPay, however I am running into a little problem. I included a switch to set my taxRate to a const based off of a letter provided, after I added the switch into my program it says taxRate is an unassigned ...
<p>in the switch-case, if the defual case is met (no other case matches "marStatus"), then taxRate doesn't get asigned with a value. later you try to use this variable, with no value. this is the compilation error you're getting. asign a value to the variable.</p>
Excel array formula to sum for criteria then sort <p>Looking for an excel array formula to sum "weight" for each "code" and sort "code"s in order of weight.</p> <pre><code> | A | B | C | D | E | |1 | Code | Weight | | Code |TotWeight| |2 | 444 | 30 | | 444 | 50 | ...
<p>While this may ultimately be possible with a convoluted and calculation-intensive array formula, for all intents and purposes you are really trying to accomplish a database SELECT statement with an aggregate SUM, GROUP BY and ORDER BY clauses. Something like,</p> <pre><code>SELECT code, weight FROM (SELECT cw.code...
xmlHttpRequest ignores g element in SVG <p>I have an SVG file created in Inkscape. I want to use xmlHttpRequest to import the svg file and then inject the data from the <code>&lt;g&gt;</code> element into the HTML.</p> <p>HOWEVER. The xml response for some reason omits the g element. I can see this when I evaluate the...
<p>As I pointed out in the comments, you cannot use regular Dom methods on SVG before getting the SVG as a DOM object. </p> <p>The best way to do this is something like:</p> <pre><code>var svg=httpresponse.getDocumentElement(); var g=svg.getElementsByTagName('g'); </code></pre> <p>Variable <code>g</code> then will ...
What does render do with instance variables? <p>When I use a scaffold to generate a Foo model/controller, my controller has a default create action that will <code>render :new</code> if <code>@foo.save</code> returns false.</p> <p>What happens to my @foo object when I <code>render :new</code>? </p> <p>My stock <stron...
<p>From the documentation</p> <blockquote> <p>If you want to render the view that corresponds to a different template within the same controller, you can use render with the name of the view:</p> </blockquote> <p>So, <code>render</code> is used to render the view template and does not actually call the action. The ...
Unable to move on to next page http://indianvisa-bangladesh.nic.in/visa/Get_Appointment via httpClient 4.4 <p>Hiii Update 2: thanks 4 the help. I got the cookies now but i am stuck on the same page. I added cookie as header with request but i got the same page as response. Don't know i m doing wrong. Please guide me.</...
<p>Try iterate <code>httpclient.getCookieStore();</code></p> <p>Here examples <a href="http://www.programcreek.com/java-api-examples/index.php?api=org.apache.http.client.CookieStore" rel="nofollow">http://www.programcreek.com/java-api-examples/index.php?api=org.apache.http.client.CookieStore</a></p> <p><a href="http:...
extracting attributes from html using jquery <p>I have a string that I got from outerHTML. It logs like:</p> <pre><code>var responseHtml = jQuery(data).find("#response")[0].outerHTML; console.log(responseHtml); Log: &lt;div id="response" hello="world" big="span" hey="there"&gt;&amp;lt;\/div&amp;gt;" &lt;div class="c...
<p>Rather than creating invalid attributes, you should be using the <code>data</code> attribute like:</p> <pre><code>&lt;div id="response" data-hello="world" data-big="span" data-hey="there"&gt;&lt;/div&gt; </code></pre> <p>And then to get those values with jquery, you can do:</p> <pre><code>var response = $('#respo...
How to Implement An Event in Microsoft Script Control? <p>All docs i've read on MSScriptControl say that it can respond to events of objects added to it. </p> <blockquote> <p>the script control allows you to write script that will automatically fire when an event on an object occurs. <a href="https://msdn.micros...
<p><strong><em>The key to making it work is</em></strong>: You must set the event-firing-object in the listener-class <em>after</em> adding both to the Script Control-- not before. Meaning, this line must be executed inside the SC:</p> <p><code>Set oListener.EventFiringObject = oEventFiringObject</code></p> <p>Here's...
Display Issues CSS <p>Below is a link to a JSFiddle. I am having trouble as there is meant to be an image with text at the very start of the <code>site-wrap</code> div named <code>background-image</code> with <code>text</code> being inside that div.</p> <p>If I add <code>line-height</code> to the <code>text</code> div...
<p>The way you worded your question is a bit confusing but I believe you are looking for:</p> <pre><code>width:100vw; height:100vh; </code></pre> <p><strong>vw</strong> is viewport width and <strong>vh</strong> is viewport height.</p>
error while creating new project with Angular-cli <p>When I am trying to create new project by using the command, <strong>ng new project-name</strong>, I am getting error like below:</p> <blockquote> <p>fs.js:640 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^</p>...
<p>I was having the same issue, and this post was helpful: <a href="https://github.com/angular/angular-cli/issues/2135" rel="nofollow">https://github.com/angular/angular-cli/issues/2135</a></p> <p>It's maybe a little too hacky to really recommend as a solution, but this answer at least got me going:</p> <blockquote> ...
Extract netcdf4 variable slice by dimension name <p>I have a netCDF file with 4 dimensions. I want to extract a slice from the netCDF file by giving the name of one of the dimensions </p> <p>I know how to do this by position. E.g.</p> <pre><code>from netCDF4 import Dataset hndl_nc = Dataset(path_to_nc) # Access by s...
<p>You can use <a href="http://xarray.pydata.org/en/stable/indexing.html#indexing-with-labeled-dimensions" rel="nofollow">xarray</a>'s indexing capabilities to access netcdf data by dimension name. </p> <pre><code>import xarray as xr ds = xr.open_dataset('./foo.nc') var = ds['name_variable'] # Slice var by Dimension "...
Unable to display googleVisMotion chart in Wordpress,Rpubs & Rmd file <p>I am unable to display googleVisMotion Chart in Wordpress,RPubs or as RMarkdown. The googleVisMotion Chart works locally on my computer but I am unable to get it to display anywhere else. I tried the method in post</p> <p><a href="http://stackove...
<p>I saved the chart as a html as suggested in <a href="http://stackoverflow.com/questions/4646779/embedding-googlevis-charts-into-a-web-site?rq=1">Embedding googleVis charts into a web site</a>. I then hosted the Html page as a Github page (gh-pages) and this worked.</p>
Adding returned tuples to a list of lists <p>I am trying to add the returned tuples to a list of lists or list of arrays.</p> <pre><code> dim = 10 for key, figure in sorted(problem.figures.iteritems(), reverse=True): dim -= 1 # print key, dim (img_arr[dim], images[dim]) = vectorize(figu...
<pre><code>img_arr[dim], images[dim] = vectorize(figure) </code></pre>
How to delete or ignore rows in a csv file when training a model? <p>Suppose you have a data set with several features (e.g <a href="http://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data" rel="nofollow">http://archive.ics.uci.edu/ml/machine-learning-databases/pima-ind...
<p><strong>Missing Values in Pima Indians diabetes dataset</strong></p> <ul> <li><p>Visit <a href="https://archive.ics.uci.edu/ml/datasets/Pima+Indians+Diabetes" rel="nofollow">https://archive.ics.uci.edu/ml/datasets/Pima+Indians+Diabetes</a></p> <p>It states: "** UPDATE: Until 02/28/2011 <strong>this web page indica...
Why isn't this element visible (Selenium + Python/Django 1.9) <p>I am using webdriver to fill out a form in Django. The first field, name, is found and filled out. But the second field is somehow not being found. Here's the script I'm using...</p> <pre><code>name = browser.find_element_by_id("name") value = browser...
<p>In my experience, <a href="http://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.action_chains" rel="nofollow"><code>ActionChains</code></a> are often the answer when I have an issue like this in selenium. It is worth a try in this case:</p> <pre><code>from selenium.webdriver.common.action...
Determine if string is made up of characters from a different string (Scrabble-like program) <p>I am writing a program in C# that goes through a list of words and determines if they can be made up by a string that a user input. Just like the Scrabble game. </p> <p>For example, when the user inputs the string "vacation...
<p>If it wasn't for the issue of possible multiple letters (for "overflow", the word "fool" is a match, but "wow" isn't, because there aren't two w characters in the letter set), this Linq code would work</p> <pre><code>string letters = "overflow"; string word = "lover"; bool match = !word.Except(letters).Any(); // u...
SQL Sort of mixed numbers and alphanumeric Value <p>I'm going to sort that column contains the value of numbers and alphanumeric value.</p> <p>But I got the wrong sort (<code>order by</code>) can anyone help me regarding with this problem?</p> <p>I'm using <strong>SQL SERVER 2008 R2</strong>, here's the sample:</p> ...
<p>Once again, normalize your data - this ordering is weird:</p> <pre><code>SELECT TESTER FROM @TableTester ORDER BY CASE WHEN TESTER LIKE '[A-Z]%' THEN LEFT(TESTER,PATINDEX('%[0-9]%',TESTER)-1) ELSE NULL END, CAST( CASE WHEN TESTER LIKE '%[0-9]%' THEN REPLACE(SUBSTRING(TESTER,PATIND...
Whats wrong with this textbook implementation of Singly Linked List? <p>Found in the textbook "Data Structures and Algorithms with Java 6E", this implementation is giving me an error at the addFirst and addLast methods when trying to create a new Node. It says cannot convert from SinglyLinkedList.Node to SinglyLinkedLi...
<p>Update your <code>addFirst</code> and <code>addLast</code> methods like below:</p> <pre><code>public void addFirst(E e) { head = new Node&lt;E&gt;(e, head); // update here if(size == 0){ tail = head; } size++; } public void addLast(E e){ Node&lt;E&gt; newest = new Node&lt;E&gt;(e, null)...
Program loops at id number call as well as not entering information into array <p>So my program is trying to take in some information from a user and add them to an array of structs. If you could help I would appreciate it. The program keeps looping at the "Please enter a valid ID number:" and I don't know why. Also wh...
<p>Change <code>tst3==1</code> to <code>tst3=1</code>. Same for <code>tst1</code>,<code>tst2</code>.</p> <p>The assignment operator (<code>=</code>) and the equality operator (<code>==</code>) appear to be similar but are used for completely different reasons.</p> <p>The assignment operator (<code>=</code>) is used t...
How can I rename this Android Project with hardcoded libraries <p>Currently I am using Android studio to make my first app. I am using a library that I believe requires the app to be called "com.camera.simplemjpeg" and if I try to refactor the name the app just crashes when trying to utilize the library. Is there any w...
<p><strong>In Android Studio, you can do this:</strong></p> <p>For example, if you want to change <code>com.example.app</code> to <code>my.awesome.game</code>, then:</p> <ol> <li><p>In your <strong><em>Project pane</em></strong>, click on the little gear icon ( <img src="http://i.stack.imgur.com/lkezT.png" alt="Gears...
DFS path finding with obstacles <p>I have the following grid and i'm trying to get to the 1's in that grid, the obstacle is shown by 2. The robot has prioritized movement in this order: up, right, down, left. The starting position has a * next to it.</p> <pre><code> 0 0* 0 0 2 0 1 1 0 </code></pre> <p>Wh...
<p>Try this:</p> <pre><code>def dfs2(grid,pos,curr,height,width): x = pos[0] y = pos[1] if grid[x][y]==1: print str(curr) return None elif grid[x][y] ==2: return None last = curr[-1] if x-1 &gt;= 0 and last != 'DOWN': curr.append('UP') ...
Where did the variable type value go in xcode 8's suggester <p>In XCode 7 I enjoyed being able to see the type of each suggestion xcode gave me. That feature appears to be removed in xcode 8.</p> <p>Unfortunately when I went back to xcode 7 to try and get a screenshot of it it was still like xcode 8. All I can rememb...
<p>There must either be some bug in your Xcode because the intellisense shows the type in the list. Here is two examples from my Xcode:</p> <p><a href="http://i.stack.imgur.com/UL6AV.png" rel="nofollow"><img src="http://i.stack.imgur.com/UL6AV.png" alt="enter image description here"></a> <a href="http://i.stack.imgur....
Unable to put spaces in variable names - Visual Studio 2015 (C++) <p>I'm doing some very basic coding for making a receipt in Visual Studio 2015 in C++. I'm having trouble creating names with spaces without being forced to use underscores (ex. Item 1 vs Item_1). I feel like it's a simple fix, but I'm extremely new to c...
<p>You Cant Have Spaces In Between Variable Name.</p> <pre><code>example: int shan kar;//Wrong Declaration int int;//Wrong Declaration You Cant Have Keywords in place of variables int shankar;//Valid Declaration int shan_kar;//Valid Declaration </code></pre> <p>Rules To Declare CPP Variables: <a href="http://www....
List All Routes in a Roda app <p>In Rails I view all the routes I have defined via:</p> <p><code>rake routes</code></p> <p>Is there a built in way to do this in a Roda app?</p> <p>If not, is there a common pattern Roda developers use to quickly view all the routes (maybe a Rake task of some sorts?)</p>
<p>Automatically is not possible. <code>roda</code> routes are evaluated dynamically when a request comes in, so they are not loaded before and stored in a data structure available somewhere.</p> <p>As the <a href="http://roda.jeremyevans.net/rdoc/files/README_rdoc.html" rel="nofollow">documentation</a> says:</p> <bl...
pouchdb not getting attachments with query() <p>I have a design view named <strong>_design/templates</strong> like so (getting all docs that have a specific type):</p> <pre><code>function (doc) { if(doc.type == "template") emit(doc._id, doc); } </code></pre> <p>I then go and grab the view with a query:</p> <pr...
<p>@AlexisCôté helped me with this. Because I'm already retrieving the document with <code>include_docs</code>, I changed my view from:</p> <p>this:</p> <pre><code>function (doc) { if(doc.type == "template") emit(doc._id, doc); } </code></pre> <p>to this:</p> <pre><code>function (doc) { if(doc.type == "te...
How to set OnClickListiner on Navigation Items <p>I am developing an app in which I included navigation and sliding both. But in navigation, I am not able to where I need to write for click on listener so that when I click on that navigation part items,it will respond. Below is my code:</p> <pre><code> private void...
<p>Implement this interface in activity </p> <pre><code>NavigationView.OnNavigationItemSelectedListener </code></pre> <p>Add this in oncreate </p> <pre><code> navigationView.setNavigationItemSelectedListener(this); </code></pre> <p>Handle below part of code in you activity</p> <pre><code>@Override public boo...
Advanced Regex - Capture Whole Group of Complex Statement inside Replace <p>I'm working on a project, and I need to parse related data... the tools I work with is fully command based, and return all kind of stuff, so the regex come handy instead of guess that this line is that, and the other is this, ... so I need to p...
<h2>Capture Groups</h2> <p>Let's back up a bit. First, we need to understand what <a href="http://www.regular-expressions.info/brackets.html" rel="nofollow">capture groups</a> are. Everything put within parenthesis will be a capturing group. So, for instance, the regex <code>(\d)(\d)</code> with the string <code>89</c...
Logging device id in database from data collection app <p>App A is communicating to database X through web service Y. Service Y enables insert, update and delete operations to data in database X. Many authorized people can use app A and connect to database X through service Y. Developer Q wants to create a database tri...
<p>Short answer yes. The how is a bit more involved. You did not include what language the web service is written in so keeping it high level and focusing on the implementation agnostic way first.</p> <p>Most languages used to code web services capture request information - device info, web client info, ip address (no...
Java String To Method <p>How To Execute String Or Object?</p> <p>i Looked for this post on <a href="http://stackoverflow.com/questions/745842/">String to method</a></p> <p>But the code Is available C#,I wonder how can i do this in Java Code?</p> <p>Thanks</p>
<p>What you are looking for is called <code>Reflection</code> which allows to access and instantiate objects at runtime by specifying their <code>Full-Qualified-Name</code> as String Parameter. </p> <p>One Simple way to achieve this is</p> <pre><code> Class x = Class.forName("Your Package name"); Object y = x.newIns...
Apply shift for comparison on multiple columns over groupby pandas <p>I have a dataframe(raw_data) containing multiple columns:</p> <pre><code>raw_data = {'one': ['A', 'B', 'A', 'C', 'B', 'B', 'A', 'C', 'A', 'B', 'C', 'B'],'two' : [3,4,5,6,2,7,9,12,1,10,11,8],'three': ['bcd','qpv', 'cba','klm','zfv','klm','abc','abc',...
<p>You could perform those steps as follows:</p> <pre><code># Groupby column one and sort values by column two df_grouped = df.groupby('one').apply(lambda x: x.sort_values('two')) # Shift by one level up and compare comparison_1 = df_grouped['five']==df_grouped['five'].shift(-1) comparison_2 = df_grouped['four']==df...
How to know when browser finish to process an image after loading it? <p>When an image object is created, can know when is fully loaded using the "complete" property, or the "onload" method, then, this image has processed ( resizing for example ) using some time, that can be some seconds in big files.<br> How to know w...
<p>Here is one way.</p> <p>CanvasContext2D <code>drawImage</code> method is synchronous. Before being able to use this method, the browser has to completely render the image.</p> <p>So you can use it as a waiting method in your <code>waitBIGimage</code> method.</p> <p><div class="snippet" data-lang="js" data-hide="f...
Randomly generate 1 and 0 as a queue <p>I want my program to randomly generate 1 and 0 but it should look like it's in a queue. The 1 is represented by a person and 0 means that there's no person. It should generate random 1 and 0 like this <code>0 0 0 0 1 1 1 1 1 1</code>, if the line is in the left and vice versa if ...
<p>Implemented a simple random function to generate 0s and 1s</p> <pre><code> int[] queue = new int[10]; Random r = new Random(); int rand = r.nextInt(queue.length); int r1 = 1 - rand % 2; int r2 = rand % 2; for (int i = 0; i &lt; queue.length; i++) { if (i &lt;= rand) { queu...
ManagedSynonymFilterFactory is giving empty managedMap <p>I am a newbie to Solr. I have enabled ManagedSynonymFilterFactory in schema.xml file as shown below</p> <pre><code>&lt;fieldType name="managed_en" class="solr.TextField" positionIncrementGap="100"&gt; &lt;analyzer&gt; &lt;tokenizer class="solr.StandardTok...
<p>When you define words in synonym.txt then it is used by SynonymFilterFactory not by the ManagedSynonymFilterFactory.</p> <pre><code>&lt;filter class="solr.SynonymFilterFactory" expand="true" synonyms="synonyms.txt" ignoreCase="true"/&gt; </code></pre> <p>The reason you are getting proper results because the solr...
Codemirror textarea editor need to enable only on previous selection <p>I'm using codemirror to convert my textarea into editor, but there is another problem is that I need to enable that textarea field only on the base of previous input select field selection. How can I do it?</p> <p>Here are code snippets:</p> <p>T...
<p>Just to give you some hints:</p> <p>put your CodeMirror codes inside function, like:</p> <pre><code>function Create_Codemirror_textarea(){ var myCodeMirror = ........ .... } </code></pre> <p>and execute function when select field changes:</p> <pre><code> ............. case 'true': ...
Is there a way to include the same Mixin more than once in a subclass in Python? <p>Normally a Python mixin would only be included once, like:</p> <pre><code>class MyMixin: pass class Child(Base, MyMixin): pass </code></pre> <p>However, in some situation it would be handy if we can use the same Mixin twice. ...
<p>I would recommend using <a href="https://docs.python.org/2/glossary.html#term-decorator" rel="nofollow">python decorator</a>. </p> <p>Here is an example how to get this using plan python class:</p> <pre><code>def custom_fields(**kwargs): def wrap(original_class): """ Apply here your logic, coul...
How can I download a file from mercurial repository without hg command? <p>I would like to know how to download a file in terminal may be by using wget or curl.</p> <p><strong>EDIT:</strong> I have referred some of the thread they have given version number. But I would like to download without worrying about the versi...
<p>Well, generally you cannot checkout single files at a certain revision without using the version control system.</p> <p>If you are using some kind of web-frontend to your repository (like kallithea or hgweb) you might be able to retrieve the desired info via curl or wget</p> <p>See the accepted answer in <a href="...
Issue while adding action to UIButton in Swift 3.0 <p>I am Creating a <code>UIButton</code> programatically in <code>swift 3</code>.</p> <p>But I am unable to add Action to it.</p> <pre><code> //Adding BUtton let btn = UIButton() btn.frame = CGRect(x: 100, y: 100, width: 200, height: 100) btn.addTar...
<p>Just remove the <code>() from self.printname()</code>, so:</p> <pre><code>btn.addTarget(self, action: #selector(self.printname), for: UIControlEvents.touchUpInside) </code></pre> <p>instead of </p> <pre><code>btn.addTarget(self, action: #selector(self.printname()), for: UIControlEvents.touchUpInside) </code></pre...
What is the purpose of CvType.CV_8UC4 <p>I have a snippet code from colorblobdetection but I don't know what is the purpose of CvType.CV_8UC4. The <a href="http://stackoverflow.com/questions/13428689/whats-the-difference-between-cvtype-values-in-opencv">Link</a> here does not really explain how does it works.</p> <pre...
<p>OpenCV types can be read the following:</p> <ul> <li><code>CV_</code></li> <li><code>8U</code>: Unsigned int 8-bit</li> <li><code>C4</code>: Four channels.</li> </ul> <p>Thus <code>mRgba = new Mat(height, width, CvType.CV_8UC4);</code> creates a Matrix with four color channels and values in the range 0 to 255.</p>...
Android set unicode String to textview <p>i can simply set Unicode chars/string to TextView by <code>text</code> properties on <code>xml</code> layout as:</p> <pre><code>android:text="&amp;#xf0f3;" </code></pre> <p>but i can't set Unicode from java code like with this:</p> <pre><code>icon_notify_post_message.setText...
<p>Save the unicode in String.xml with some name .Then for setting it in textview use this: icon_notify_post_message.setText(getstring(//your string)). It's reccomended and standard way of using unicode in textview. or a very common way of doing this(the way i use):</p> <pre><code>String str = "\u00C7" + getContext(...
C# What does the => syntax mean <p>I'm trying to understand C# and am very confused by this block of code. </p> <pre><code>Thread thread = new Thread(new ThreadStart(() =&gt; { Thread.Sleep(_rnd.Next(50, 200)); //do other stuff })); thread.Start(); </code></pre> <p>I know a thread is being created and t...
<p>Below you'll find some different ways to work with functions and delegates. The all do the same thing:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace SO39543690 { class Program { static Ran...
Ajax call to Dispatcher servlet <p>I am trying to make a simple AJAX call to dispatcher servlet from JSP and get string as response.But,I am able to call dispatcher servlet using form tag in jsp and success page is getting called.If I use ajax call is not even reaching dispatcher servlet.Please find the code for refere...
<p><strong>It doesn't matter if you're using Ajax call or not, the request should reach to the desired controller.</strong></p> <p>With that being said, and the fact you wrote that the request doesn't even reach to its destination, then your problem is within your URL. </p> <p>I would recommend using the <strong><em>...
Python 3 Regex and Unicode Emotes <p>Using Python 3, a simple script like the following should run as intended, but appears to choke on unicode emote strings:</p> <pre><code>import re phrase = "(╯°□°)╯ ︵ ┻━┻" pattern = r'\b{0}\b'.format(phrase) text = "The quick brown fox got tired of jumping over do...
<pre><code>(╯°□°)╯ ︵ ┻━┻ </code></pre> <p>This expression has brackets in them, you need to escape them. Otherwise they are interpreted as group.</p> <pre><code>In [24]: re.search(r'\(╯°□°\)╯ ︵ ┻━┻', text, re.IGNORECASE) Out[24]: &lt;_sre.SRE_Match object; span=(72, 85), match='(╯°â...
How to extract multi line and white space including text from another text using RegEx? <p>This is my text:</p> <pre><code>[[&gt; Check this out! And also this one! Well, I also have this [[MyVariable&gt;5:15]] </code></pre> <p>I want to extract:</p> <pre><code>Check this out! And also this one! Well, I also ha...
<p>I see <code>[[..&gt;..]]</code> as a structure which you need to deal with it. If you want to capture everything before and after <code>&gt;</code>:</p> <pre><code>\[\[([^&gt;]*)&gt;([^[\]]*) </code></pre> <p><a href="https://regex101.com/r/zN8aN1/1" rel="nofollow"><strong>Live demo</strong></a></p>
get id of specific option element through its value <p>Here i have a few option element.One of them holding the value apple.I want to get the id of the option element which holds the value apple .So far i did the following.But can't get the parent element of a text node </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&g...
<p><strong>Parent element</strong> will be the <code>select</code> element itself, right?</p> <p>If you want to alert id of that specific option, then</p> <p>Replace</p> <pre><code>if(x[x.selectedIndex].value == str){ alert((x[x.selectedIndex].value).parentElement.id); } </code></pre> <p>with</p> <pre><code>aler...
Indent problems of items in latex <p>I want each line in the list is aligned with other text. I have used the setting</p> <pre><code>\begin{enumerate}[(i),leftmargin=7mm] </code></pre> <p>so that the bullet is left aligned with other text, however the list content in new line still indents like:</p> <pre><code>(i) x...
<p>Use a combination of equivalent <code>itemindent</code> and <code>labelwidth</code>:</p> <p><a href="http://i.stack.imgur.com/JyRMw.png" rel="nofollow"><img src="http://i.stack.imgur.com/JyRMw.png" alt="enter image description here"></a></p> <pre><code>\documentclass{article} \usepackage{enumitem} \begin{documen...
When to use emit and broadcast in Angular JS? <p>I have been playing with Angular for 1 month and every time I thought It would make sense to use emit and broadcast to communicate between different parts of the framework I found articles stating that we should avoid them if we can (for instance: <a href="http://seanhes...
<p>When you need to send a message or a request from inner scope to outer scope you can use $emit and when you want to do same from outer scope to inner scope we use $broadcast.</p>
Force add 'https://' in my cspecific pages by htaccess <p>I have a website built with WordPress cms, i want to add https:// on my contact page by htaccess file of website. I have try different think but i an not able to do it. Here is the site <a href="http://alacartesites.com/contact/" rel="nofollow">link</a></p> <p>...
<p>If you have https enabled for your domain, it would be a good idea to use it for the entire website, not just for one/some pages only.</p> <p>To redirect all existing pages from http to HTTPS, you can use the following .htaccess code snippet:</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteCo...
android: constantly update information from web server in background <p>So i'm working on an app that needs to retrieve constantly updating database information and display it on a map using markers and locations.</p> <p>How would I go about creating an infinite loop in the background that retrieves the information af...
<p>You can use a async task and then start it from the background thread in a given interval.</p> <p>I will recommend that your app don't call the database directly but you create some kind of backend. Then you can cache stuff and put some load off the app.</p>
Reading the whole file and then outputting the lines with a certain order <p>i'm working on a function which reads a file of strings with n lines.</p> <p>Imagine each line in the file is numbered, starting from 0. i m trying to modify this function so it reads the whole file and then outputs the lines numbered 0, 3, 6...
<p>You should use a <code>List&lt;Integer&gt;</code> if you store only int value (with <code>Integer.parseInt(s)</code> and catch the <code>NumberFormatException</code>).</p> <p>Then you have to sort your List (with <code>Collections.sort()</code>) like this :</p> <pre><code> Collections.sort(tmp, new Comparator&l...
how to passing parameter to index and custom route <p>I want to pass parameters to index function and if the parameter is not, redirect to home page. i added custom route also. where did i miss the code?</p> <pre><code>$route['main/(:any)'] = 'main/index/'; // looks like has a mistake </code></pre> <p>www.example.com...
<p>You can achieve this by following code</p> <pre><code>class Main extends CI_Controller { public function index($gender="") { if($gender == "") { $this-&gt;load-&gt;view('home'); } else { $this-&gt;load-&gt;view('female_view'); } } </code></pre> <p>Also as you mentioned to get this URL to wor...
using files with express server <pre><code>var express = require('express'), app = express(), db = require('./db'), bodyParser = require('body-parser'), controller = require('./controller'); app.use(express.static('../public')); app.get('/server', function (req, res) { console.log(__dirname); r...
<p>You can use path module, there is a join method that take multiple paths to make one. </p> <p>Exemple if you do:</p> <pre><code>path.join('test/musicfolder', '../videofolder/allreadyseen') </code></pre> <p>you will get <code>'test/videofolder/allreadyseen'</code> .</p> <p>you can see all the doc here : <a href="...
Is there a way to view a UIViewController behind another UIViewController without messing with the AppDelegate window? <p>There is a library I really enjoy that you could find here (<a href="https://github.com/pixyzehn/MediumMenu" rel="nofollow">https://github.com/pixyzehn/MediumMenu</a>). </p> <p>Essentially it does ...
<p>Short answer is: <strong>Yes</strong>. </p> <p>This can be implemented with by assigning a <code>UIViewControllerTransitioningDelegate</code> to the <code>ViewController</code> containing the <code>list-menu</code> and implementing the <code>interactionControllerForPresentation()</code> and <code>interactionControl...
JavaScript Quiz – animation has glitch when changing classes with jQuery (Animation Que Buildup) <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code> function main() { ...
<p>If you want the animation to fade out the previous question, then fade in the next, you need to wait for the fade to complete before continuing by using the <code>fadeOut</code> callback:</p> <pre><code>$('.btnBack').click(function() { var currentSlide = $('.active-slide').stop().fadeOut(500, function() { $(t...
ArrayList is displaying null in method Te() <pre><code>public class MainActivity extends AppCompatActivity { // Button senddata; //private final String url = "http://19.168.1.58:9090/data/db"; public static final String KEY_EMAIL = "email"; EditText email1; String emailString; String _id, ...
<p>The <code>ArrayList</code> hasn't been initialized up to the point where you have your log message, which is why the <code>ArrayList</code> is <code>null</code>.</p> <p>After tracking through your methods, I can see that you only initialize the list in <code>parsejson()</code>, and <code>parsejson()</code> is only ...
Python setting global variables in different ways in 2.7 <p>I was trying to practice a concept related to setting global variables using diff methods , but the following example is not working as per my understanding .</p> <pre><code>#Scope.py import os x = 'mod' def f1() : global x x = ...
<p>Check out this modified piece of code.</p> <pre><code>x = 'mod' def f1(): global x x = 'in f1' def f2(): import scope scope.x = 'in f2' return scope def print_x(): print(x) def f3(): import sys sc = sys.modules['__main__'] sc.x = 'in f3' return sc if __name__ == "__...
How to create CSS3 bounce effect with PURE CSS <p>I am trying to create a bounce effect at the end of the animation of IMAGES with pure CSS but i have 3 images which i want to have bounce effect with different times format for each image. As my CSS is working only for one image how to change the format of this CSS? </p...
<p>Go to this link and there you will find how to create it. <a href="http://www.tutorialspoint.com/css/css_animation_bounce.htm" rel="nofollow">http://www.tutorialspoint.com/css/css_animation_bounce.htm</a></p>
Custom separator in tableView <p>I have my own separator in .jpg and would like to use it instead of default one in TableView, but the only thing I get is that it disappears. </p> <p>Swift 3.0:</p> <pre><code>override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell { ...
<p>Set separator color on <code>viewDidLoad</code> method...</p> <pre><code>override func viewDidLoad() { super.viewDidLoad() let color = UIColor(patternImage: UIImage(named:"Separator.jpg")!) tableView.separatorColor = color } </code></pre> <p><a href="http://i.stack.imgur.com/Ondng.png" rel="nofollow">...
Changing values in column selectively. Python Pandas <p>for example i have a fruit dataset that contains the name and colour. How do i change the values in colour column based on the fruit name that i select?</p> <pre><code> Name Color Apple NaN Pear Green Pear ...
<p>One way is to use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html" rel="nofollow">.apply()</a>:</p> <pre><code>In [83]: df Out[83]: Name Color 0 Apple NaN 1 Pear Green 2 Pear Green 3 Banana Yellow 4 Watermelon Green In [84]...