input
stringlengths
51
42.3k
output
stringlengths
18
55k
How will Perl 6 handle the new combining emoji length? <p>Some emoji now combine. For instance, U+1f441 (👁) U+200d (ZWJ) U+1f5e8 (🗨) combine to make 👁‍🗨 (<a href="http://iwitnessbullying.org/" rel="nofollow">I am a witness</a>). Rakudo 2016.07.1 on MoarVM 2016.07 says there are two graphemes:</p>...
<p>The ZWJ sequence you mentioned is only part of <a href="http://unicode.org/Public/emoji/4.0/emoji-zwj-sequences.txt" rel="nofollow">Unicode Emoji 4.0</a> which is still in draft status and planned for release in <a href="http://blog.emojipedia.org/whats-planned-for-emoji-4-0/" rel="nofollow">November 2016</a>. Under...
Char pointer subtraction in C <p>I have read about integer pointer subtraction in C in this thread: <a href="http://stackoverflow.com/questions/3238482/pointer-subtraction-confusion">Pointer subtraction confusion</a>, which was simple enough to grasp and test out.</p> <p>However, I tried to replicate a similar scenari...
<p>In this example, <code>a_arr</code>, <code>a</code>, <code>b_arr</code>, and <code>b</code> are probably all allocated on the stack. The compiler doesn't have to give you any particular guarantees about the arrangement of variables on the stack. So the compiler might be padding to multiples of 16 bytes, or might b...
Rendering javascript one at a time <p>I have a javascript that draws hundreds of lines on a webpage. When the page loads, it renders all the lines at the same time.</p> <p>To make the question simpler lets say I have a js file that has 3 functions.</p> <pre><code>drawing_one drawing_two drawing_three </code></pre> ...
<p>Based on your post, you can try setTimeout functions:</p> <pre><code>$(document).ready(function () { setTimeout(function () { drawing_one(); }, 1000); }); </code></pre> <p>Then drawing_one() could look like this:</p> <pre><code>function drawing_one() { //do stuff, then setTimeout(func...
Prevent Reader (OpenXMLReader SAX) Breaking String Chunk every 1026 Chars <p>I am using some great code taken from StackOverflow and converted to VB NET to:</p> <ul> <li>Extract all rows of text from all speadsheets in an excel .xlsx file</li> <li>Append each row to a StringBuilder.</li> </ul> <p>The code runs really...
<p>Must be when the StringBuilder resets its buffer, do you have to use String Builder?</p>
How to remove leading and trailing " , remove leading and trailing spaces from each row each field in ksh <p>I have many functions in ksh scripts(which uses gawk a lot) which does many computations on files. Files are pipe delemited. But now my source files changed. Now each field in the file comes within double quotes...
<p>with <code>sed</code></p> <pre><code>$ sed 's/ *" *//g' file Name|Designation|emlid Alex|Software Design Engg|E0023 Corner|SDE|E0056 </code></pre> <p>can be combined in the <code>awk</code> script without this extra step as well.</p>
Accessing characters of a String beyond the range of Integer <p>I have a <code>String/character</code> sequence that is being repeated infinitesimally... Naturally ,characters will go out of range of Integer and start falling into range of Long, since methods used for accessing characters for both String as well as <c...
<p>You should definitely not construct a string and do measurements on it.</p> <p>This is a test on how well you are able to abstract things. I will give you some code you may study. You should not copy+paste it for several reasons - including the possibility that I did some mistake.</p> <p>The idea is, to simply com...
How to pass securely SSH Keys to Docker Build? <p>I want to create a Docker image for devs that reproduces our production servers. Those servers are configured by Ansible.</p> <p>My idea is to run an <code>ansible-pull</code> to apply all the configuration inside the container. The problem is that I need the SSH key t...
<p>You could mount the SSH Keys into the Container on runtime.</p> <pre><code>docker run -v /path/to/ssh/key:/path/to/key/in/container image command </code></pre>
Plotting in matlab with cosine and sine <p>Considering a function f(x)=sin(x)+cos(4x)-0.3 am supposed to</p> <p>Write a Matlab script file that plots f(x) for 0 ≤ x ≤ 2π. I have tried</p> <pre><code>x = [0 : x: 2pi]; pi = 3.14; y = sin(x); g = cos(4x)-0.3; plot(x, y, x, g); </code></pre>
<p>Try the following:</p> <pre><code>x = [0:0.01:2*pi]; fx = sin(x) + cos(4*x) - 0.3; plot(x,fx); </code></pre> <p>On the first row where x-values are generated, you can adjust the middle term depending on how many points you want from the interval <code>(0,2pi)</code>.</p>
AJAX request to other page not working <p>Currently I am trying to add content to my page using AJAX. Since it is my first time using AJAX I am not really sure about what I am doing. I wrote a bit of code here:</p> <p>JavaScript:</p> <pre><code>jQuery(function(){ jQuery("#nearby_customers_link").click(function(){ ...
<p>It looks like there is a mistake in your code. in test.php you are using variable <code>$_GET['city']</code>, but in fact the variable is called <code>$_GET['nearby']</code>. Try fixing that and seeing if it works.</p>
Diagonal corner to corner gradient in canvas <p>I need to have a diagonal gradient from corner to corner in a canvas, not css.</p> <pre><code>Check example : http://jsfiddle.net/58y8b/77/ </code></pre> <p>The first box is fine, since it's a square the gradient coordinates are just top left and bottom right. Is there ...
<h2>Fitting a gradient to 4 corners of Rectangle</h2> <p>This can be done with a little trig.</p> <p><strong>The solution</strong></p> <p>The diagram shows what needs to be done.</p> <p><a href="http://i.stack.imgur.com/aka1H.png" rel="nofollow"><img src="http://i.stack.imgur.com/aka1H.png" alt="enter image descrip...
Running Gatling from container <p>I am using denvazh/gatling container and everything works well except one thing i try to pass list of simulations like this:</p> <pre><code>Attaching to gatling gatling_1 | GATLING_HOME is set to /opt/gatling gatling_1 | Choose a simulation number: gatling_1 | [0] AppsPods gatlin...
<p>You need to give the fully qualified classname i.e </p> <p><code>docker run -it --rm -v /home/core/gatling/conf:/opt/gatling/conf \ -v /home/core/gatling/user-files:/opt/gatling/user-files \ -v /home/core/gatling/results:/opt/gatling/results \ denvazh/gatling -s computerdatabase.advanced.AdvancedSimulationStep01</c...
Create a stub of 3rd party Java library <p>My task is to create stubs for a 3rd party Java library that our application will make calls to. My problem is how to define the class of the method "return type" (if that's the correct Java terminology). I don't have access to the full documentation of the 3rd party API, just...
<p>One possibility (academically at least) is to use a facade to the actual 3rd party library. You could probably create a class which has the methods that you need and your main code calls this class in place of the the 3rd party library, include all the methods that you need and return 1/0 etc., when the library is a...
How do I constrain a Kotlin extension function parameter to be the same as the extended type? <p>I want to write an extension method on a generic type T, where the matched type constrains a method parameter.</p> <p>This compiles:</p> <pre><code>"Hello".thing("world") </code></pre> <p>But this doesn't compile, as 42 ...
<p>As mentioned by <a href="http://stackoverflow.com/a/39596613/155213">@Alexander Udalov</a> it's not possible to do directly but there's a workaround where you define the extension method on another type like so:</p> <pre><code>data class Wrapper&lt;T&gt;(val value: T) val &lt;T&gt; T.ext: Wrapper&lt;T&gt; get() = ...
toString an arraylist containing object <p>I have an array list of type car. I have an overriding <code>toString</code> method which prints my car in the desired format. I'm using the <code>arraylist.get(index)</code> method to print the cars. I only have one for now it works, but I want it do print for all of the cars...
<p>Your <code>Garage</code> should have the implementation of <code>toString()</code> which uses <code>ArrayList#toString()</code> implementation:</p> <pre><code>public String toString() { return "Garage: " + myGarage.toString(); } </code></pre> <p>Also remember to implement <code>toString()</code> in <code>Cars....
Cannot load RevoScaler <p>I have just installed R evolution (Windows 7, 64 bit).</p> <p>Immediately after loading, RStudio shows the following error:</p> <blockquote> <p>Error : .onLoad failed in loadNamespace() for 'RevoScaleR', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: T...
<p>There last line seems to give some insight... </p> <blockquote> <p>The evaluation period has expired. </p> </blockquote> <p>Do you have a valid commercial license? If not, potentially there is your reason. If so, support should be your first stop.</p> <p>To ensure you have either a free developer version or a ...
Laravel belongsToMany not returning results <p>I have the following schema set up:</p> <p>users:</p> <ul> <li>id</li> </ul> <p>departments:</p> <ul> <li>id</li> </ul> <p>department_user:</p> <ul> <li>id</li> <li>department_id</li> <li>user_id</li> </ul> <p>I also have the following relationships set up:</p> <p>...
<p>Why don't you set up your models like it is suggested in the documentation <a href="https://laravel.com/docs/5.2/eloquent-relationships#inserting-many-to-many-relationships" rel="nofollow">here</a>:</p> <p>So your models would look something like this:</p> <p><strong>User Model</strong></p> <pre><code>public func...
404 Not Found When Debugging, but URL Works in Browser <p>I just moved from a Win 7 laptop to Win 10. When debugging the web app on Win 10, I get a 404 Not Found error. However, if I paste the URL into a browser, it works. Is there something funky about Win 10 or IIS 10 that needs to change to allow this to work? This ...
<p>Put <code>127.0.0.1</code> instead rootWebApiUrl. I believe the server doesn't know the address when is debugging, by request lookback address. Windows 10 and the new servers are more prepared to use IPv6, and only localhost affect this. Now, why this difference between normal mode to debug mode, it's not really ass...
Why do the R functions mean() and sum() behave differently with vectors vs. raw strings? <p>I was wondering if there was an <strong>underlying programming logic</strong> as to why some basic R functions behave differently towards raw data input into them vs. vectors. </p> <p>For example, if I do this</p> <pre><code>...
<p>the second argument taken by <code>mean</code> is <code>trim</code>, which is not a listed argument for <code>sum</code>. the first argument for <code>sum</code> is <code>\dots</code>, so, I believe, the function will try to compute the sum of all values entered as unnamed arguments.</p> <p><code>mean</code> and <c...
Spring Boot app should only listen on Actuator's port <p>I have a Spring Boot asynchronous app which doesn't expose anything, since it only consume messages from a queue. However, I want to expose actuator on a management port (8081) for this app.</p> <p>Is there a way to only expose management port (8081) and not bus...
<p>It seems that the <code>application.properties</code> conf bellow is enough but is it the best solution ?</p> <pre><code># ---------------------------------------- # WEB PROPERTIES # ---------------------------------------- # EMBEDDED SERVER CONFIGURATION (ServerProperties) server.port=8081 # --------------------...
spring-security, testing the filter chain without webapp <p>We are using spring-security in many applications with the same configuration. So we have created a library for it.</p> <p>But today I have to changes many things in this library and I would like to test it so that I'm sure to not breaking anything.</p> <p>I...
<p>Spring security has very convenient API for testing with spring mvc testing <a href="http://docs.spring.io/spring-security/site/docs/4.1.3.RELEASE/reference/htmlsingle/#test-mockmvc" rel="nofollow">http://docs.spring.io/spring-security/site/docs/4.1.3.RELEASE/reference/htmlsingle/#test-mockmvc</a></p>
How to resolve the highlight active menu in css <p>I am a beginner in designing and I want to highlight the active menu<br> I did some R&amp;D but I have find a solution regarding for list<br> <strong>In my case list is not using for Menu</strong></p> <p>here is my menu code:</p> <p><div class="snippet" data-lang="...
<p>I see you are using Nextend Accordion Menu to generate the menu. Here is what the author sais on the plugin site <a href="https://wordpress.org/plugins/nextend-accordion-menu/" rel="nofollow">https://wordpress.org/plugins/nextend-accordion-menu/</a></p> <blockquote> <p><del>Complete control from the backend over ...
WPF and Metro Binding <p>Perhaps you could help with this, I already tried several different ways but I m unable to achieve the desired results...</p> <p>Using MahApps, I want to use ComboBoxes to change the applied theme to my WPF Window.</p> <p>I used some of the code from MahApps Demo and adaped to my Project/Solu...
<p>This is how you change the theme/accent</p> <pre><code>ThemeManager.ChangeAppStyle(Windows.Application.Current, ThemeManager.GetAccent(AccentName), ThemeManager.GetAppTheme(ThemeName)) </code></pre> <p>You are already using that in DoChangeTheme of AccentColorMenuData and AppThemeMenuData : AccentColorMenuData</p>...
Run workflow process from other workflow process <p>guys. I am a newbie in AEM and have a problem. I need to execute com.day.cq.dam.core.process.UnarchiverProcess process(inherited from AbstractAssetWorkflowProcess) from my own. So I need something like this(code below is obviously not working):</p> <pre><code>import ...
<p><code>UnarchiverProcess</code> is a standalone process, is there a reason to create a custom step to just invoke <code>UnarchiverProcess</code>. You could simply add another process step in your workflow model and configure it for <code>UnarchiverProcess</code>.</p> <p>In case you want to do it (I however do not r...
How does Linux's sort command apply subsequent passes to data? <p>There's an example in <em>A Practical Guide to Linux Commands, Editors, and Shell Programming</em> that looks like this.</p> <p>You have a file, "fruit", that contains the following:</p> <pre><code>Pear Pear apple pear Apple </code></pre> <p>Executing...
<p>By using secondary sorting key, you're telling sort "if the fields are the same, use this to compare them". So, <code>-k1f</code> sees <code>Apple</code> and <code>apple</code> as equal, so calls <code>-k1</code> to compare them. The result isn't "equal", so <code>-u</code> doesn't remove anything.</p>
How can I position nested lists side-by-side? <p>My fiddle: <a href="https://jsfiddle.net/a1g49g2t/7/" rel="nofollow">https://jsfiddle.net/a1g49g2t/7/</a></p> <p>I want the ol and ul items to be next to eachother. Is this possible?</p> <p>Structure:</p> <pre><code>&lt;ol class="level1"&gt; &lt;li&gt;item1&lt;/li&g...
<pre><code>ol ul { position: absolute; left: 200px; top: 0; background: #aaa; } </code></pre> <p><strong><a href="https://jsfiddle.net/a1g49g2t/10" rel="nofollow">Demo</a></strong></p> <p>Note that the top-level list could be positioned relatively for easier page layout. It doesn't matter as long as i...
Can FastMember.ObjectReader take DisplayName into account? <p>I'm using FastMember.ObjectReader to copy a list of structs to a DataTable, which I then use as the DataSource of a gridview:</p> <pre><code>struct Foo { [DisplayName("title1")] public string Bar { get; set; } } ... var rows = new List&lt;Foo&gt;();...
<p>Oh, I see what you mean; you want the <code>IDataReader</code> to expose the <code>[DisplayName]</code> in the metadata; however, the primary way that is exposed is via <code>GetSchemaTable()</code>, and AFAIK there is no recognised key to represent <code>[DisplayName]</code>. It would be incorrect to pass that as ...
should pass resolved pixel dimension instead of resource id here:getResource().getDimession*(ViewGroup.LayoutParams.WRAP_CONTENT) <pre><code>TextView textView = new TextView(getActivity()); textView.setBackgroundResource(R.drawable.shape_item_talker_realm); textView.setText(skill.skill_n...
<p><code>MATCH_PARENT</code> and <code>WRAP_CONTENT</code> are indeed valid input for <code>LayoutParams</code> width and height.</p> <p>This is hyperactive <a href="https://developer.android.com/studio/write/lint.html" rel="nofollow">Lint</a> in action. You can safely ignore the warning.</p> <p>Select the underlined...
TreeTableView: Displaying different data types <p><br/></p> <p>I have a <code>Factory</code> class which contains a list of employees. I want to use a <code>TreeTableView</code> to display the <code>Factory</code> data. It is pretty forward to display the name and the size of a <code>Factory</code>, but i don't know h...
<p>In a <code>TreeView</code> or <code>TreeTableView</code> all nodes in the tree have to be of the same type. This makes the kind of design you want (which is very natural) something of a pain. Basically, you have to make the type of the <code>TreeView</code> or <code>TreeTableView</code> the most specific superclass ...
What does this code do(Sorting Multiple Arrays)? <p>I was searching for "how to sort multiple arrays at once" and found this question here: <br><a href="http://stackoverflow.com/questions/13960105/sorting-multiple-arrays-at-once">Sorting multiple arrays at once</a><br>And there a nice answer from Alexander solving my p...
<p>It is sorting an array of indices by the respective values in <code>arr</code>. To be exact, <code>comparator</code> takes an array and returns a closure function that can be used to compare two index numbers with each other, by looking up the values at these indices in the <code>arr</code> and comparing them.</p>
Java 8 Stream multiple files flatmap to lines <p>Given an array of filenames:</p> <pre><code>bigList = Arrays.stream(files) .flatMap(file -&gt; { try { return Files.lines(Paths.get(path + SEPARATOR + file)); } catch (IOException e) { ...
<p>It is because of the call to <code>distinct()</code>.</p> <p>When you call <code>flatmap</code>, it combines all lines in all of your files to a single <code>Stream&lt;String&gt;</code>, so <code>distinct()</code> will return lines which are distinct among all files. </p> <p>When you use a for loop, you only are ...
Sharing configuration between Azure services <p>How can configuration in Azure be shared between an Azure Worker Role and an Azure Web Service?</p>
<p>Cannot be shared directly - there is no magic wand or out-of-the-box-system-valid-for-all-possible-programming-languages-supported-on-azure. You can, however write your own <a href="https://msdn.microsoft.com/en-us/library/2tw134k3.aspx" rel="nofollow">custom configuration section</a> and store / retrieve data from...
Browser alert not getting handled results in exception <p>I am trying to handle a unexpected browser alert on Chrome (for leaving required fields blank) and was earlier getting an exception for loading status which was resolved once I changed chrome driver to be 2.24 and now I am using this code snippet to accept the ...
<p>You seem to have imported <code>javafx.scene.control.Alert</code> into your class file (I assume by being too quick in the IDE, and just accepting the first recommendation it gave you)</p> <p>Also, why not use the <a href="http://www.gebish.org/manual/0.9.1/javascript.html#alert" rel="nofollow">Geb mechanism for al...
Selenium Python Xpath where to insert ends-with to find a text at the end of the string <p>I have the following Xpath:</p> <pre><code>'.//*[@id="reporting_usn_browser_tab_source_tree_5_crm_f1/5_address"]' </code></pre> <p>I would like to use ends with as I would like to find the text address which is at the end of th...
<p>try the below xpath ,</p> <pre><code>.//*[substring(@id, string-length(@id) - string-length('address') +1) = 'address'] </code></pre>
Flip flyout closebutton around without changing position <p>I'm trying to flip the arrow to point to the other direction in my flyout without changing the Position to left.</p> <p><a href="http://i.stack.imgur.com/zkqjE.png" rel="nofollow"><img src="http://i.stack.imgur.com/zkqjE.png" alt="enter image description here...
<p>Add a new <code>Trigger</code> to the default <code>HeaderTemplate</code>:</p> <pre><code> &lt;DataTemplate x:Key="HeaderTemplate1" x:Shared="False"&gt; &lt;DockPanel x:Name="dpHeader" Margin="10,25,10,10" VerticalAlignment="Center" LastChildFill...
Getting success response from AWS SNS but SMS not delivered <p>I am writing a simple program to send SMS using SNS service using the Javascript client.</p> <pre><code>var AWS = require('aws-sdk'); var sns = new AWS.SNS({ region : 'ap-southeast-1', accessKeyId: '', secretAccessKey: '' }); sns.publish({ Mess...
<p>We need to specify more SNS parameters.</p> <p>Documentation pages that might help:</p> <ul> <li>Pushing to SNS: <a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html#publish-property" rel="nofollow">http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html#publish-property</a></li> </ul> ...
Should a REST API parameter ever influence which other parameters are required? <p>For instance, I can create a vehicle, and must give it a type which can be "automobile" or "airplane". Automobiles require a tire size parameter and airplanes require a wingspan parameter. Similar question regarding whether a REST API ...
<p>While this happens in practice, it is best avoided as it makes it difficult to document your API. This is particularly true if you are using a documentation technology such as Swagger which does not allow these "conditionally required" parameters. By adding them, you are actually adding extra semantics to your API w...
My Category NSDate+Api does not work now for Date class in Swift (After Migration to Swift 3 and Swift Interoperability) <p>I have a problem with all my categories written for NSDate, NSString ... The Migration to Swift 3 did change now all NSDate properties to Date (in swift files). Now I cannot call my NSDate+Additi...
<p>This is intended behaviour of swift 3.0. Developers from Apple confirmed that. NSDate and Date are too difference types and (categories) from NSDate to Date extensions are not bridged. But in case of NSString and String yes.</p>
NullPointerException on Button in onCreate method <p>I get the error </p> <blockquote> <p>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setEnabled(boolean)' on a null object reference</p> </blockquote> <p>When I try to set a button to be enabled or not. Is this a lif...
<p>This is a <code>MenuItem</code>, try handling the logic in this method:</p> <pre><code>@Override public boolean onOptionsItemSelected(MenuItem item) { Log.i(TAG, String.valueOf(item.getItemId())); switch (item.getItemId()) { case R.id.action_forward: if (myWebView.canGoForward()) { ...
http-proxy-middleware does not forward the full path <p>I am trying to configure BrowserSync to work in server mode and to proxy my API requests to the backend that runs on the same machine on a different port, using <a href="https://github.com/chimurai/http-proxy-middleware" rel="nofollow">http-proxy-middleware</a>. I...
<p>The <code>prependPath</code> option is <code>true</code> by default. This option is provided by the underlying lib: <a href="https://github.com/nodejitsu/node-http-proxy" rel="nofollow">http-proxy</a>.</p> <blockquote> <p><strong>prependPath</strong>: true/false, Default: <strong>true</strong> - specify whether y...
C# iterate through the groupbox themselves <p>Iv been looking around and i havnt really found anything of meaning.</p> <p>what i am trying to do, is change between groupboxes at the click of a button.</p> <p>what i have is a windows form with 32 groupbox containers and there are 12 textboxes in each, some of the text...
<p>Use two loops?</p> <pre><code> foreach(GroupBox gb in Controls.OfType&lt;GroupBox&gt;()) { foreach(TextBox tb in gb.Controls.OfType&lt;TextBox&gt;()) { int A1 = 0; int.TryParse(tb.Text, out A1); TOTAL += A1; //defined outside o...
Why Add-Migration suddenly generates a non empty code migration? <p>Using EF6 Code based</p> <p>My actual entities have not been changed, but a new DBSet was added to allow to query for a navigation property directly.</p> <p>If I run <strong>Add-Migration</strong>, it generates a non empty migration with just a weird...
<p>Entity Framework conventions will create a column to hold relationship information that is not explicitly defined in your model. In the msdn <a href="https://msdn.microsoft.com/en-nz/data/jj679962.aspx" rel="nofollow">documentation</a> it states:</p> <blockquote> <p>In addition to navigation properties, we recomm...
Handle Overflowing Text in TextView <p>I have a layout where I show some amount next to person's name. I have set it in <code>LinearLayout</code> and provided weigh to put it exactly when laied out in list. But if my amount value goes larger, it splits into the 2 row which I don't want. If amount is large, name should ...
<p>Okay, I found out.</p> <p>Removing <code>layout_weight</code>,adding <code>minWidth</code> and setting <code>layout_width</code> to <code>wrap_content</code> did the trick.</p> <p>Here is the changed TextView of id <code>amount</code>:</p> <pre><code>&lt;TextView android:id="@+id/amount" android:layout_wi...
Python's fuzzywuzzy returns unpredictable results <p>I'm working with fuzzy wuzzy in python and while it claims it works with a levenshtein distance, I find that many strings with a single character different produce different results. For example.</p> <pre><code>&gt;&gt;&gt;fuzz.ratio("vendedor","vendedora") 94 &gt;&...
<p>You are correct about how fuzzywuzzy works in general. A larger output number from the <code>fuzz.ratio</code> function means that the strings are closer to one another (with a 100 being a perfect match). I preformed a couple of additional test cases to check out how it worked. Here they are:</p> <pre><code>fuzz.ra...
Mathematical algorithm failing but seems correct <p>I've been given a problem in which a function is fed in A and B. These are target numbers from 1, 1, whereby B may only increase by A and A may only increase by B (Ex, 1 1 -> 2 1 or 1 2. 2 1 -> 3 1 or 2 3. 2 3 -> 5 3 or 2 5). This creates a binary tree. In the problem...
<p>You didn't say whether you're using Python 2 or Python 3, but the <code>math.floor( m / f )</code> only makes sense in Python 3. There the <code>m / f</code> is a float, which is imprecise. You'd better simply use integer division: <code>numgen += m // f</code>. An example where it matters is <code>M, F = str(10**30...
What is the internal representation of timestamp values in MySQL <p>I have a <strong>.dat</strong> file that represents a Table in a database and has a particular column for <code>timestamp</code> values. Now the values are stored in the following way: - </p> <p><code>978302039</code></p> <p>I'm required to copy all ...
<p>Per <a href="https://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html" rel="nofollow">MySQL Documentation</a></p> <blockquote> <p>MySQL recognizes <code>TIMESTAMP</code> values in these formats:</p> <p>As a number in either <code>YYYYMMDDHHMMSS</code> or <code>YYMMDDHHMMSS</code> format, provide...
Git PR for multiple repositories <p>Currently I am thinking of making something like this</p> <p><a href="http://i.stack.imgur.com/Xds7Q.png" rel="nofollow"><img src="http://i.stack.imgur.com/Xds7Q.png" alt="enter image description here"></a></p> <p>The idea is that I want to have one shared library living in its own...
<p>The solution here would be to put the shared library in a git <a class='doc-link' href="http://stackoverflow.com/documentation/git/306/submodules/1074/adding-a-submodule#t=20160920151332315398">submodule </a>in each of the repositories. That way, you can commit changes to the shared library from either of your repos...
400 Error on API endpoint in Guzzle that works fine in Browser & Postman <p>I am trying to access the following public API resource:</p> <p><a href="http://www.nomisweb.co.uk/api/v01/dataset/NM_17_5.data.json?geography=1946157081,943718401...943718512,2092957698&amp;date=latest&amp;variable=18&amp;measures=20599,21001...
<p>All you need to do is <a href="http://guzzle3.readthedocs.io/http-client/response.html#response-body" rel="nofollow">get the body of the response</a> (which is put into a Stream object) and then get the contents of that response:</p> <pre><code>$apiResource = "http://www.nomisweb.co.uk/api/v01/dataset/NM_17_5.data....
How get new installed product attribute in magento (using helper) on category pages <p>I've installed new product attribute using my module script - mysql4-install-1.0.0.php:</p> <pre><code>&lt;?php $installer = $this; $installer-&gt;startSetup(); $setup = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup')...
<p>In my helper file - Data.php I added two function which set and get product</p> <pre><code>protected $_currentProduct = ''; public function setCurrentProduct($label) { $this-&gt;_currentProduct = $label; return $this; } public function getCurrentProduct() { return $this-&gt;_currentProduct; } </code><...
Merge N sorted in vectors c++ <p>I have a vector of sorted c++ classes that have comparison operators. I need a vector of the objects sorted. Is there any open source algorithms that would take either a list of vectors or vector of vectors and make one sorted vector?</p> <p>for n=2, this works fine:</p> <pre><code>...
<p>The standard library contains the <a href="http://en.cppreference.com/w/cpp/algorithm/merge" rel="nofollow"><code>merge</code> function</a>, allowing to merge two sorted vectors (in particular). </p> <p>Say you have <em>k</em> sequences, with total length <em>n</em>. Of course, you could merge each time 2 sequences...
Update CSS styles dynamically using AngularJS <p>I'm new to AngularJS and I'm not really sure how to create the effect I want using it.</p> <p>I'd like to compare the values of two elements and conditionally update the CSS for the elements based on that comparison.</p> <p>This seems very simple to do with jQuery or V...
<p><a href="http://jsfiddle.net/0gc8arn3/" rel="nofollow">Using ng-style tag</a>:</p> <pre><code>&lt;input ng-model="MinimumPrice"/&gt; &lt;input ng-model="NewPrice"/&gt; &lt;p ng-style="getStyle()"&gt; Text &lt;/p&gt; </code></pre> <hr> <pre><code>function MyCtrl($scope) { $scope.getStyle = function(){ ...
swift ios when do I need to use mediaTypes kUTTypeImage <p>I have a image picker in my app where you can select images from camera roll or take a new picture then upload the images to my backend server.</p> <p>But looking around others code I see that some people use this: <strong>imagePickerController.mediaTypes = ...
<p><code>kUTTypeImage</code> is actually default for the <code>mediaTypes</code> property. It states, that one can only pick still images. If you are ok with this default, you don't need to set it explicitly in your code.</p> <p>Here is the documentation: <a href="https://developer.apple.com/reference/uikit/uiimagepic...
Alamofire 4.0 RequestRetrier should(_,retry,with,completion) not being called <p>I am using the <code>RequestRetrier</code> of Alamofire 4.0 to control the retrying of requests for expired access token. I am following the documentation <a href="https://github.com/Alamofire/Alamofire#adapting-and-retrying-requests" rel=...
<p>Maybe you are not getting an error. 400 responses aren't considered as error by <code>Alamofire</code>. In case you want get an error when receiving a 400 code you should chain <code>validate()</code> to the request. If this is your case you can find more information <a href="https://github.com/Alamofire/Alamofire/i...
Center Text QML type based on the dot of a decimal number <p>I've got a simple <code>Text</code> <code>QML</code> type:</p> <pre><code>Item { anchors.fill: parent Text { id: centerText text: "6.9" anchors.horizontalCenter: parent.horizontalCenter y: 570 } } </code></pre> <...
<p>Here is a quick example how you can achieve that. The "dummy" hidden text is used to measure how wide the integer part of the number is, obtained by using <code>Math.floor()</code>. Then you simply position it so that the decimal point is always in the center of the parent object regardless of what the number is.</p...
Rotating a matrix to create a spiral order of values <p>How do I rotate a matrix to create a spiral order of values?</p> <p>For example, </p> <pre><code>12 4 2 8 3 11 6 7 2 </code></pre> <p>I am supposed to to display <code>12 4 2 11 2 7 6 8 3</code> but I don't know how to terminate at the 1st row and rotate the f...
<p><em>Hint</em>:</p> <p>Check the <code>spiral</code> function:</p> <blockquote> <p><code>spiral(n)</code> is an <code>n</code>-by-<code>n</code> matrix with elements ranging from <code>1</code> to <code>n^2</code> in a rectangular spiral pattern.</p> </blockquote> <p>Use its output to build an index into t...
WPF Inherited Datepicker with custom style won't allow children to be tabbed to <p>I wanted to create a custom DatePicker that instead of a DatePickerTextBox I replaced it with a MaskedTextBox (from WPFToolkit). For whatever reason I am unable to tab to the MaskedTextBox within the control. Instead, when the item is ta...
<p>Resolved this by overriding OnGotFocus and OnGotKeyboardFocus in code.</p> <pre><code>Public Partial Class CustomMaskedDatePicker Inherits DatePicker Public Shared ReadOnly MaskedSelectedDateProperty As DependencyProperty = DependencyProperty.Register("MaskedSelectedDate", GetType(String), GetType(CustomMa...
What does ^= mean in CSS? <p>In CSS, what does the <code>^=</code> means?</p> <p>See this code:</p> <pre><code>$(".navbar-dark ul li a[href^='#']").on('click', function(e) { } </code></pre>
<p>it is an <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors" rel="nofollow">attribute selector</a></p> <blockquote> <p><strong>[attr^=value]</strong></p> <p>Represents an element with an attribute name of attr and whose first value is prefixed by "value".</p> </blockquote> <p>Lets...
Cook-Torrance shader cuts off really weird when NdotL <= 0 <p>So i've been trying to implement the Cook-Torrance shader model in a toy project I'm working on and it looks quite good when looking at the right angle: <img src="http://i.stack.imgur.com/grT7I.jpg" alt="Normal"> But when you're looking from a shallow angle ...
<p>Here is my independent implementation of Cook-Torrance based on Beckmann distribution:</p> <pre><code>layout(location = 0) in PerVertex { special3 pos; // tangent to view vec2 texcoord; vec4 diffuse; } IN; layout(location = 0) out vec4 OUT; layout(binding = 0) uniform sampler2D u_bump; layout(binding ...
How to move cursor position in Delphi StringGrid cell? <p>When you have a TStringGrid with the goEditing option set and a cell has several lines of text in it, when you go to edit that cell by clicking on it, the cursor will be at the very end of that text. How can you move the cursor to another position? My particular...
<p>Rather than trying to manipulate the editor's cursor, I would suggest trying to avoid storing trailing line breaks in the StringGrid to begin with. You can use the <code>OnGetEditText</code> event to trim off the trailing line breaks when the editor is activated, and the <code>OnSetEditText</code> event to trim the...
send form with upload file in nodejs <p>i use busbody to upload file in nodejs i can upload file but i cant get text message in bodyparser my fornt end code is :</p> <pre><code>&lt;script&gt; $("input[type='button']").click(function(){ var files = $("input[type='file']").get(); var formData = new FormDa...
<p>I think this is because of this line: <code>file.pipe(fstream);</code>, this should be <code>fstream.pipe(file)</code>.</p> <p>And like Steven say multer is a good alternative.</p>
unable to retrieve csr information for ssl cert - geotrust <p>I have a website, i bought the domain from godaddy. Bought a hosting plan from hostgator, used that for sometime. Then I got a VPS (centos) on the azure cloud and now I point my website from the hostgator server to the VPS where the actual website files are ...
<p>To create a CSR in your cPanel, you should perform following instruction, <a href="https://support.comodo.com/index.php?/Knowledgebase/Article/View/648/19/csr-generation-cpanel-11" rel="nofollow">https://support.comodo.com/index.php?/Knowledgebase/Article/View/648/19/csr-generation-cpanel-11</a></p> <p>This will h...
How to get real max size of stringstream without write anything into it? <p>I am dealing big libpacp files with the program below.</p> <p>I am confused about the real max size of memory that stringstream can allocate from the OS.</p> <p>The first part of code is the program for processing libpacp files.</p> <p>The s...
<p>The short answer is that you generally can't/won't know except by trying it.</p> <p>The OS has a single pool of memory. That pool is shared between all processes currently executing on the system (plus a few things like device drivers that aren't exactly part of a process, but that distinction doesn't matter much f...
Android Studio pref Editor.putString identifier expected <p>Getting a - cannot resolve symbol "putString" "putInt" "commit" - in the code below.Help please.</p> <pre><code> public class Alpha extends Activity { public static final String GAME_PREFERENCES = "GamePrefs"; SharedPreferences setting...
<p>Before start coding randomly, have a look at some android tutorials for example <a href="https://www.youtube.com/watch?v=QAbQgLGKd3Y" rel="nofollow">this is the best</a> <strong>in my opinion</strong>.</p> <p>After you can start with coding.</p> <p>btw the solution is moving it inside the "onCreate" method:</p> <...
Cannot set property 'tgt' of null <p>Recently began recieving this error in logs from many users on my website:</p> <pre><code>TypeError: Cannot set property 'tgt' of null at HTMLDocument.r (eval at C (eval at exec_fn (unknown source)), :43562:25) </code></pre> <p>It happens only in Chrome (from v45 to the latest) an...
<p><a href="https://github.com/kogg/InstantLogoSearch/issues/199" rel="nofollow">This thread</a> say it's <a href="https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en" rel="nofollow">Tampermonkey</a></p>
How to run monkey testing ONLY in application? <p>How to run monkey testing ONLY in testing application? How can I set border for monkey testing. I don't want that it touches any button out of my testing application.</p>
<p>According to the <a href="https://developer.android.com/studio/test/monkey.html" rel="nofollow">doc</a>. You can use the option <code>-p</code> to limit your test in specific package.</p> <p>Something like this:</p> <pre><code>adb shell monkey -p your.package.name -v 500 </code></pre>
Using DataTables' range filter with language.decimal <p>I've been trying to try range filter using datatables.net's datatable. But my price column price ranges from millions to millions. Therefore, it will need to have commas to separates one, tenth, hundreds, thousands.. and so on.</p> <p>I've seen Datatable's langu...
<p>You should only need to convert the strings that exist for your large values into numbers by stripping out the non-numeric values. Building off of the <a href="https://datatables.net/examples/plug-ins/range_filtering.html" rel="nofollow">range filter example</a> on dataTables, I've done it here using a regex on the ...
Clearing a polyline on a Polymer Google Map <p><strong>Case:</strong> You enter 2 cities on a form and submit ; the Google Map gets the coordinates and 2 markers will appear (one for each city) with a polyline connecting those markers. When there is a new submit with another cities, I want the markers and the polyline ...
<p>Your data binding in <code>&lt;markers-polyline&gt;</code> looks correct to me. It's possibly a bug (similar to <a href="https://github.com/GoogleWebComponents/google-map/issues/299" rel="nofollow">issue #299</a>) that you might want to report in GitHub.</p> <blockquote> <p>It works well when I just clear the arr...
Visibility of tcp connections of containers from the host <p>On plain lxc (not docker or any other flavor), is there a way to see the tcp connections and socket allocations of containers from the host from the command line - perhaps a netstat option or an lxc-command? We are using ubuntu for both the host and containe...
<p>you could use lxc-netstat for this job</p> <p><a href="https://manned.org/lxc-netstat/01c5f51e" rel="nofollow">https://manned.org/lxc-netstat/01c5f51e</a></p> <p>HTHs</p> <p>Thanks,</p> <p>//P</p>
How to remove "save&new" button from popup in odoo? <p>I have a <code>one2many</code> field, and when I click to create a new record, I have 2 buttons.</p> <p>I want to remove the <code>"Save &amp; New"</code> button and keep the <code>"Save &amp; Close"</code> button.</p> <p><a href="http://i.stack.imgur.com/AJ87J.p...
<p>I hope you do not mind sleazy hacks.</p> <p>In your form view you can try this. You may need to clear your cache before it works for you. This is only sensible if you do not want it to appear but its not really a security thing just for looks and process. You may need to ensure the class selector is correct for you...
How to notify the change in RecyclerView Items <p>Here's my problem:</p> <p>I have an <code>AlbumActivity</code> that lists all the albums name using <code>RecyclerView</code>.</p> <p>When one item is clicked it will go to <code>ImagesActivity</code> where all of the images inside the Album will be listed. I also use...
<p>once you add the images, are you calling <code>notifydatasetchanged()</code> ? <a href="https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#notifyDataSetChanged()" rel="nofollow">https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#notify...
UnboundLocalError: local variable 'k' referenced before assignment <p>I have read <a href="https://stackoverflow.com/questions/17097273/unboundlocalerror-local-variable-referenced-before-assignment">StackQ1</a> and <a href="https://stackoverflow.com/questions/20873285/unboundlocalerror-local-variable-input-referenced-b...
<pre><code>class My_Class(object): def __init__(self, **kwargs): super(My_Class, self).__init__() self.k = "hello" def data(self, *args): print "call data" return self.k my_class = My_Class() print my_class.data() </code></pre>
Javascript: Maintaining position of elements in parent div when rescaled <p>I'm trying to save an elements position after it has been dragged and dropped (using Top and Left) and then place it correctly when it is reloaded (even if the parent container has a different size).</p> <p>Right now what Im doing is that I le...
<p>I was being silly, I forgot to calculate the new aspect-ratio height for the container both when calculating the percentage on save and when previewing it on a different size.</p>
Selenium and Firefox profile setting <p>I need your help to set up my Firefox profile with Firebug. What I'd like to have is to have the Firebug add-on to be loaded with the Firefox instance when I start it via Selenium WebDriver. Here is sample of my code:</p> <pre><code>final File file = new File("C:\\Program Files ...
<p>You have to add the extension instead of setting the preference:</p> <pre><code>final String firebugPath = "C:\\FF_Profile\\firebug.xpi"; FirefoxProfile profile = new FirefoxProfile(); profile.addExtension(new File(firebugPath)); WebDriver driver = new FirefoxDriver(profile); </code></pre> <p>You can...
Call a javascript file from a Java Bean <p>I have 3 files :</p> <ul> <li>index.xhtml : I used JSF, to make a 2 fields form (x : int, y : int) with a submission button.</li> <li>map.js : contains a Js function.</li> <li>MbZoomtoXy.java : That call the previous Js function.</li> </ul> <p>What I try to do is when I ente...
<p>You need put <code>map.js</code> in <code>src/main/webapp/resources/js/map.js</code>, and include in <code>index.html</code></p> <p><strong>index.html</strong></p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1...
My code stops at a certain condition <p>In this code I input a test case number t and then input t numbers (n). Then my code prints the nth prime number. In the 1st line of the function, prime(), if I write <code>if(a &gt; 43000) return;</code> Then the code works perfectly. But if I write <code>if(a &gt;= 165000) retu...
<p>First, I'll point out that your array <code>p</code> has only 15000 elements and that the 15001-th prime number is 163,847. This means that if you do a check for <code>a &gt;= 165000</code> before quiting you'll end up trying to fill indices of your array that are outside the bounds of your array.</p> <p>Second, ev...
Can I load and use a model in MY_Controller using CI3 <p>I'm using Codeigniter 3 and I need some data available to all methods. I will query the data from the database and then I need to display it on every page.</p> <p>I have created a MY_Controller extending CI_Controller and saved it in /application/core/</p> <p>B...
<p>MY_Controller</p> <p>not used to direct any function to __construct() __construct to only load to any model write other function to MY_Controller look like this</p> <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed'); class MY_Controller extends CI_Controller { public $location_...
How to concatenate two strings with many null characters? <p>How to concatenate two strings for example </p> <pre><code>char s[5]={'s','a','\0','c','h'}; char m[11]={'b','e','\0','c','h','b','\0','e','\0','c','h'}; </code></pre> <p>that has many null characters. I tried <code>strcat()</code>. Its not working. Is the...
<p>This is tricky, because by definition C-strings are null-terminated. So what you really have are two byte buffers that you want to put together, not two strings. (This is why functions like <code>strcat</code> don't work here, by the way -- they expect their arguments to be C-strings.)</p> <p>Since you can't use th...
SIGABRT error in Xamarin.Forms app <p>I have a Xamarin.Forms application that we are ready to deploy to production but I keep getting this SIGABRT error. I've setup a HockeyApp to monitor any crash that may occur. It seems that this error keeps on appearing crash or not. I've included the upper portion of the stack tra...
<p>I've have had the same error before HockeyApp NuGet package or any NuGet package can have the same error I am not sure if it a Linking error, try to turn off the linker ("Don't link") if that does not work try to use a different version of HockeyApp (3.7.1.0) works fine for me.</p> <p>The problem may persist tho, i...
Firing modal function onload <p>I am using Ng2-modal, and cannot figure out how to fire the myModal.open() function as soon as the page loads. If you attach it to a button <code>(click)="myModal.open"</code> everything works fine. After a lot of research I have seen answers referencing spys, hooks, and complex Jquery f...
<p>@Viewchild and ngOnInit() solved this for me, here is an example as followed.</p> <p><strong>component</strong></p> <pre><code>@Component({ template: ' &lt;modal #mymodal&gt; &lt;modal-header&gt; &lt;h1&gt;test&lt;/h1&gt; &lt;/modal-header&gt; &lt;modal-content&gt; ...
Showing stream video acquired from webcam with opencv into windows form <p>i'm creating a windows form application which has 2 picture box and a couple of button. When i click a button, one picture box start showing the stream from webcam correctly but as soon as i click another button (even if this does nothing), the ...
<p>you should use waitKey(100) inside the while loop for showing the images.</p>
How to get Butterknife working? <p>I am using Butterknife for my android project. I have previously used this, but for some reason it no longer works with the new update.</p> <p>Here is my setup:</p> <p>(App Module) <strong>build.gradle</strong>:</p> <pre><code>compile 'com.jakewharton:butterknife:8.4.0' </code></pr...
<p>You need to add:</p> <pre><code>classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' </code></pre> <p>in Project gradle file</p> <p>And Add:</p> <pre><code>apt 'com.jakewharton:butterknife-compiler:8.4.0' </code></pre> <p>and this at top:</p> <pre><code>apply plugin: 'android-apt' </code></pre> <p>for b...
Check List to find out all values are same in R <p>I have list as follows</p> <pre><code>l = list(c("a", "b", "c"), c("a", "b", "c"), c("a", "b", "c")) </code></pre> <p>I want to check that each of them contain same values using apply family functions.</p> <p>I want following answer</p> <pre><code>TRUE, TRUE, TRUE...
<p>We can use <code>duplicated</code></p> <pre><code>duplicated(l)|duplicated(l, fromLast=TRUE) #[1] TRUE TRUE TRUE </code></pre> <p>If we need to compare all the combinations of <code>list</code> elements, <code>combn</code> is another way</p> <pre><code>combn(seq_along(l), 2, FUN= function(x) all(l[[x[1]]] == l[[x...
cordova-plugin-fcm - FCMPlugin is not defined <p>I am using Ionic 2, and am trying to get Push Notifications working.</p> <p>I have registered my app with Firebase, and can push notifications to it successfully.</p> <p>I now need to set up, so that I can push notifications from my app. So I decided to use the followi...
<p>I think, removing this line "declare var FCMPlugin;" should solve your problem.</p> <p>FCMPlugin object is defined in the plugin and is global. I think you are creating another local variable by declaring it again which is not initialized and is null.</p>
Undefined jQuery error in browserify/gulp build <p>I have a problem loading <code>jquery-ui</code> in a project that's built with browserify via gulp. In my code, I have:</p> <pre class="lang-js prettyprint-override"><code>import $ from "jquery"; import "jquery-ui"; </code></pre> <p>The error is <code>Uncaught Refere...
<p>The problem is that after transformation by babel, the statement <code>import</code> rises to the top:</p> <pre><code>import $ from 'jquery'; window.jQuery = window.$ = require('jquery'); import 'jquery-ui'; </code></pre> <p><strong>=></strong></p> <pre><code>'use strict'; var _jquery = require('jquery'); var _...
Incompatible bit masks in findBug intellij <p>I am running findbugs on the below code it giving me below error</p> <p>Incompatible bit masks This method compares an expression of the form (e | C) to D. which will always compare unequal due to the specific values of constants C and D. This may indicate a logic error or...
<p>The error you're getting is strictly related to how Clover works. It instruments every single line of your code to record its execution. When it instruments branch conditions it adds additional conditions to record <em>true branch execution</em> in such way that logical condition remains unchanged. So in your case i...
crontab not fully working. only echo statements being run <p>I have a job in my crontab to run a script (<code>/home/sys_bio/username/tracer.sh</code>) every minute. The script contains</p> <pre><code>#!/usr/bin/env bash echo "starting" /home/sys_bio/username/p35/bin/python3.5 -m qefunctional.qe.tests.prodprobe -p po...
<p>Including the path to bash shell might be needed:</p> <pre><code>* * * * * /bin/sh /home/sys_bio/username/tracer.sh &gt;&gt; ... </code></pre> <p><code>cron</code> otherwise might not really know what to do. </p> <p>The same principle also applies to what is included in your script. Using relative file names can ...
Vertices with edges not drawn with plotly in a network graph <p>I have been following the instruction from here to draw a network graph: <a href="http://nbviewer.jupyter.org/gist/empet/07ea33b2e4e0b84193bd" rel="nofollow">http://nbviewer.jupyter.org/gist/empet/07ea33b2e4e0b84193bd</a></p> <p>I have been replicating th...
<p>After further investigation, I found out the root of the problem. There was a mismatch between the identifiers of the nodes and the edges.</p> <p>I was still using the labels of the nodes to add the edges instead of the node identifiers (integers used for positioning). As a consequence, plotly did not know where to...
Pymongo replace_one modified_count always 1 even if not changing anything <p>Why and how can this work like this?</p> <pre><code>item = db.test.find_one() result = db.test.replace_one(item, item) print(result.raw_result) # Gives: {u'n': 1, u'nModified': 1, u'ok': 1, 'updatedExisting': True} print(result.modified_count...
<p>This is because MongoDB stores documents in binary (<a href="http://bsonspec.org/" rel="nofollow">BSON</a>) format. Key-value pairs in a BSON document can have any order (except that _id is always first). Let's start with the <a href="https://docs.mongodb.com/manual/mongo/" rel="nofollow">mongo shell</a> first. The...
How to integrate checked out local git project with Eclipse IDE? <p>I checked out a maven project (foo) from GitLab to my local windows box (H:/my_git_project/foo) where git bash is available.</p> <p>I created a local branch "foo_local" out of "develop" branch via "git checkout -b foo_local" command.</p> <p>I opened ...
<p>You should not set the workspace location to your Git project folder. It's usually a bad practice as Eclipse IDE is meant to support multiple projects from different sources simultaneously in the same workspace.</p> <p>Instead, consider setting the workspace to a totally different folder (it's only use to store you...
How to design/architecture a server program <p>I want to design a server architecture akin to lobby based game servers :</p> <ol> <li>Clients connect to a master server, and they can chat or browse stats while they wait for a game.</li> <li>When enough players are found, a game instance is created, and all players pla...
<p>I found the answer with that question : <a href="http://stackoverflow.com/questions/14320566/client-server-application-design-patterns-and-protocols">Client Server application design patterns and protocols</a> which led me to the "Patterns of Enterprise Application Architecture" book, by Martin Fowler.</p> <p>And a...
Text of two strings not matching on click <h1>Objective</h1> <ul> <li><p>I'm trying to compare the text of two strings — the first being the text in a list containing spans. It's default text reads "Pick a defenseman" and then the name of the player just clicked.</p></li> <li><p>The aim is to make it so that names o...
<p>The problem is in this line:</p> <pre><code>var spanText = $(".player__pick").eq(0).text(); </code></pre> <p>it selects the first element with <code>player__pick</code> class.<br> That's why this:</p> <pre><code>if (spanText !== playerName) { </code></pre> <p>will always compare <code>playerName</code> to the <s...
How to change color of TimePickerAndroid in React Native? <p>Is it possible to change default color of the TimePickerAndroid component ?</p> <p><a href="http://i.stack.imgur.com/5fMXZ.png" rel="nofollow"><img src="http://i.stack.imgur.com/5fMXZ.png" alt="enter image description here"></a></p>
<p>Using React-native, unfortunately no.</p> <p>However, by changing some java files in RN and using <a href="http://stackoverflow.com/questions/26015798/change-timepicker-text-color">this solution from SO</a> you might be able to do it. If you succeed doing this, I suggest you create a Pull Request on RN's repositor...
bootstrap datepicker, beforeShowDay works after second click <p>I have some issues with <code>beforeShowDay</code> function with bootstrap datepicker. My intention is when I click any day, the 5 days after the selected day must contain the active class.</p> <p>When the page loads, the function works perfectly. But whe...
<p>After think and search a lot I found a possible solution, If it's effective or not, just tell me, thanks</p> <pre><code>var selectedDay = new Date().getTime(); $('.datepicker').datepicker({ beforeShowDay: function (date) { var d = date.getTime(); if (d &gt; selectedDay &...
UIActivities in Swift 3 <p>Trying to re-integrate the sharing button in my application. Apple again changed things in <code>Swift 3</code> for <code>iOS 10</code>. I just updated to the <code>Xcode 8</code> release version and it's been giving me some issues with <code>UIActivities</code>. </p> <p>Found that many of t...
<p><code>UIActivityType</code> is a type-safe thin wrapper for String representation of activity type. If you have found some activity types which has no predefined constants, you can define your own with extension.</p> <pre><code>extension UIActivityType { static let remindersEditorExtension = UIActivityType(rawV...
Execute separate spring batch job if original job failed <p>I have one main spring batch job that has multiple steps. If that job for some reason fails, I need to call another job to update a table in my database with the failure results.</p> <p>How can I configure my batch flow to do this?</p> <p>I created a JobExec...
<p>You need to add a listener class to your job which implements <code>JobExecutionListener</code> interface and call your logic in <code>public void afterJob(JobExecution jobExecution)</code> method after checking condition <code>jobExecution.getStatus() == BatchStatus.FAILED</code>. </p>
trouble using defaultDate attribute of datepicker <p>I'm trying to write a form that includes multiple datepickers, and I want to define the default date for each of them separately.</p> <p><a href="https://api.jqueryui.com/datepicker/#option-defaultDate" rel="nofollow">https://api.jqueryui.com/datepicker/#option-defa...
<p>I think your problem is that you first init datepicker using class selector, than you are trying to modify its options using id selector. You have to do this like this:</p> <pre><code>$( ".datepicker" ).datepicker({ dateFormat: "mm-dd-yy", altFormat: "yy-mm-dd", altField: "#altField", defaultDate: 1...
Kinesis Analytics SQL: Throtte only 1 row every N minutes <p>I am writing a SQL that outputs a row when there is a specific condition. This is connected to a stream and then a Lambda is called. The problem comes when this condition asserts true several times in a short time of period. I would like to trigger my Lambda ...
<p>I guess I misunderstood some concepts about the streaming. If you need to send an event just every N minutes, use something like:</p> <pre><code>CREATE OR REPLACE PUMP "STREAM_PUMP_PRE" AS INSERT INTO "PREDESTINATION_SQL_STREAM" SELECT STREAM FID, COUNT(*) OVER SLIDING_WINDOW AS TOTAL FROM "SQL_STREAM_BOTTLENECK" W...
Subsetting multiple vectors based on a specific condition <p>In R I am trying to subset a df with multiple vectors which are categorical. Both vectors are factors and I am trying to return a subsetted vector that meets the following conditions. From the column called Tail, I would like to identify only the Tail's which...
<p>Well, I am not sure if <code>Tail</code> and <code>Class</code> are part of the same dataframe or are two seperate vectors. If they are two seperate vectors, maybe you can merge the two vectors in a dataframe</p> <pre><code>df &lt;- data.frame(Tail = as.character(Tail), Class = as.character(Class)) </code></pre> <...
Marquee loop not infinite <p>I have a marquee in a game that i would like to repeat once finished. </p> <pre><code>var elems = "&lt;br /&gt;"; elems += "&lt;marquee id='m1' direction='left' width='800' scrolldelay='5' scrollspeed='true' scrollamount='2' loop='infinite' &gt;"; if (exp &gt;= 0) { e...
<p>try changing your loop to <code>-1</code> like this:</p> <pre><code>&lt;marquee id='m1' direction='left' width='800' scrolldelay='5' scrollspeed='true' scrollamount='2' loop='-1' &gt; </code></pre>
How to retrieve Google Calendar event ID after creating event in PHP <p>I have a PHP file that will create an event in my Google Calendar successfully from data Posted from my CRM, however, I can't find any documentation on how it can retreive the id of the event it just created and return a JSON data string.</p> <p>H...
<p>If you know the corresponding <code>calendarID</code>, you may use <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list" rel="nofollow">Events: list</a>. </p> <p>By sending HTTP request with the <code>calendarId</code> parameter, you can retrieve <code>eventId</code>. Request like:</...
yii2 batch insert with ActiveRecord <p>I want to insert multiple record in my table using yii2 ActiveRecord. I already know that I can use this code </p> <pre><code>$connection-&gt;createCommand()-&gt;batchInsert('user', ['name', 'age'], [ ['Tom', 30], ['Jane', 20], ['Linda', 25], ])-&gt;execute(); </code>...
<p>I think is not good idea to use <code>beforeSave</code> events (and similar stuff) because it will trigger for <strong>each</strong> model. However you want save <strong>multiple models at once</strong>. I recommend to use bulk methods.</p> <p>In similar cases I use usually following "bulk" approach (code not tes...