input
stringlengths
51
42.3k
output
stringlengths
18
55k
Pizza Parallel Arrays <p>I need to define three arrays (Size, Price, and Extra). I then had to ask them their size and their choice for toppings. </p> <p>Using a for loop and the parallel array technique, walk through the size array to find the size that matches the user’s input. Using the current index of your loo...
<p>Try changing your "for" loop to:</p> <pre><code> for (int i = 0; i &lt; sizes.Length; i++) { if (sizes[i] == inputSize) { var totalPrice = prices[i] + (inputToppings == "Y" ? extra[i] : 0); Console.WriteLine("You ordered a {0} pizza that costs {...
Primitive / Non-Nullable typenames in C# <p>What are the primitive typenames in C#? Yes, we have a similar answer, but that only mention types, not the typenames: <a href="http://stackoverflow.com/a/13530321/3691653">http://stackoverflow.com/a/13530321/3691653</a></p> <p>E.g. it mentions types such as <code>System.Int...
<p>Like these:</p> <pre><code>alias type (in System namespace) byte Byte sbyte SByte short Int16 ushort UInt16 int Int32 uint UInt32 long Int64 ulong UInt64 decimal Decimal float Single double Double </code></pre> <p>Read the rest at <a href="https://msdn.microsoft.com/en-us/library/ya5y69d...
Margins Prevent Text Align; <p>(If there is a simpler solution to this problem, please tell me)</p> <p>I want this website to have 2 sections of text, one on each side of the screen.</p> <p>I did this successfully. I used text align and translate3d to move the text to the right, then up.</p> <p>The only problem was ...
<p>There are many ways to achive side by side layouts in HTML. One of the simplest is to use two divs side by side, as in this snippet.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-ove...
Application of functions and Kleisli arrows <p><code>(.)</code> and <code>(&lt;=&lt;)</code> are quite similar:</p> <pre><code>(.) :: (b -&gt; c) -&gt; (a -&gt; b) -&gt; (a -&gt; c) (&lt;=&lt;) :: Monad m =&gt; (b -&gt; m c) -&gt; (a -&gt; m b) -&gt; (a -&gt; m c) </code></pre> <p>and are available...
<p>As Daniel's comment says, <code>(=&lt;&lt;)</code> already encompasses <code>($)</code>. There is already a newtype (similar to how there is a <code>Kleisli</code> newtype for <code>a -&gt; m b</code> for <code>Category</code>) for <code>a</code> called <a href="http://hackage.haskell.org/package/base-4.9.0.0/docs/D...
JQuery calendar not working after ajax call, but the button is there? <p>i'm having an issue here with JQuery calendar, it doesn't work after an ajax call. I've tried a lot of options, but any of them worked</p> <p>this is my js:</p> <pre><code>function carregar(metodo, div) { var loading = new Image(); loadi...
<p>When you reload your html, you are destroying the element that had the datepicker attached to it and recreating it anew.</p> <p>As such, you'll need to re-initialize the datepicker after you replace the html, with something like this:</p> <pre><code> success: function (data) { $...
How to pass specific value to one thread? <p>I'm working through a thread exercise in C, it's a typical thread scheduling code many schools teach, a basic one can be seen here, my code is basically the same except for my altered runner method <a href="http://webhome.csc.uvic.ca/~wkui/Courses/CSC360/pthreadScheduling.c"...
<p>You want to make <code>param</code> point to a data structure or variable who's lifetime will exist longer than the thread lifetime. And you cast the <code>void*</code> parameter to the actual data type it was allocated as.</p> <p>Easy example:</p> <pre><code>struct thread_data { int thread_index; int sta...
Iterating an Array List to calculate the percentage of population growth <p>I want to create a method calculate the percent change of population growth from the years 1994-2013, and prints out each percentage change. I have the data all stored in, but I am not sure how to iterate the ArrayList to accomplish this</p> <...
<p>Some of the items I'm going to point out are more code review items that aren't specifically related to the business logic of what you're trying to do, however, in the long run your code will be more readable and maintainable.</p> <p>First, it's a good idea to separate your data model from your controller logic. Th...
I'm trying to write a line of code at ask the user for two inputs but can't figure out how to complete this <h1>Why does this line of code not split the two</h1> <pre><code>Lat1,long1 = input("Enter the Lat and Long of the source point separated by a comma eg 20,30").split() </code></pre>
<p>By default using <code>split()</code> will only split on a space. You are asking the user to enter two entries separated by a <code>,</code>, so you will end up getting a</p> <pre><code>ValueError: not enough values to unpack (expected 2, got 1) </code></pre> <p>To resolve this, you need to split on the identifier...
Why does this code take so long to be executed? - Python <p>I coded this on Python. It took way too long to finish if the input were just 40x40 (it's for image processing using <code>numpy</code>). Its behavious is the following: there's an array with objects in it (which have an 'image' attribute which is a numpy arra...
<p>Instead of this:</p> <pre><code>if not np.array_equal(self.__sub_images[i][j].get_image(), to_compare_image.get_sub_images()[k][l].get_image()): same = False else: same = True #snip if not same: #snip </code></pre> <p>You can do this:</p> <pre><code>same=np.array_equal(self.__sub_images[i][j].get_...
what is the equivalent of an if-statement in ARM? <p>So, I am working on a program in ARM that takes a bunch of numbers from a file and tells if they are even or odd. </p> <p>The problem is that I know how to multiply by 0.5, but I don't know how to do something like this high level statement in ARM</p> <pre><code>if...
<p>A brief answer: you don't need to multiply by 0.5 or anything like that. You need to check the value of LSB (least significant bit) of the value. It will be 0 for even numbers and 1 for odd numbers.</p> <p>Upd.: your "C" code is also wrong. You want to use A % 2, not A / 2</p>
Accessing elements in a multidimensional array in PHP <p>I am trying to associate every subdomain, from a list, with its main domain name and I am doing this like so:</p> <pre><code>&lt;?php $main_domains = ['example.co.uk','example.com','example.org']; $subdomains = ['sub.example.com','ftp.example.org','ftp.example....
<p>most importantly is to set up the initial structure.</p> <pre><code>$dom=array('example.co.uk'=&gt;array('ftp.example.co.uk','zzz.example.co.uk')); foreach($dom as $domain=&gt;$sub){ foreach($sub as $s){ echo $domain.' '.$s."\n"; } } </code></pre> <p>output:</p> <blockquote> <p>example.co.uk f...
Java 8 lambda expression bytecode consistency <p>I've been digging through Java lambda expression bytecode as compiled by my OpenJDK compiler, and I'm wondering, can lambda expression bytecode vary by compiler/runtime? I'd like to know that my inspection logic will work across platforms, or not.</p>
<blockquote> <p>can lambda expression bytecode vary by compiler/runtime?</p> </blockquote> <p>In theory yes. The JLS does NOT specify that particular bytecodes / sequences must be generated. </p> <p>You would need to check the bytecodes emitted by existing Java 8 &amp; Java 9 compilers to see how much they differ...
If statemtent is true dont run else <p>I have two buttons one in <code>if(button1)</code> and the other in <code>else(button2)</code></p> <p>How can i make it so that if the <code>if(button1)</code> is executed it doesn't let the user do use <code>else(button2)</code>?</p> <p>The bug i have is when i press <strong>Bu...
<p>The <strong>else statement</strong> is to be executed if the <strong>if statement</strong> is false. So by default, if the <strong>if statement</strong> is true and ends up executing, the <strong>else statement</strong> will not run.</p>
How to bypass or ignore a number? <p>Hey guys python noobie here. I'm trying to determine which type of credit card a user has and whether it's valid or not. For the following example, Visa cards start with the number 4 and both cards would be valid because they both start with 4. If there are zeros in front, you would...
<p>You could copy then number and put that number in a list. Then if the first number is zero then remove it from the list. Repeat this until there is no zero in front. </p>
Rails: Capistrano change database.yml to database.yml.example causes error <p>When I deploy a new app to nginx using Capistrano. <br> I follow tutorial to do <code>git mv database.yml database.yml.example</code> and <code>git mv secrets.yml secrets.yml.example</code> , then created a new <code>database.yml</code> file ...
<p>The guide just tells you that storing database credentials in a repository is bad practice and you shouldn't do it, but it doesn't mean you don't need to have this files at all.You application still needs it, so you definitely need to create it, just don't store it in main repo with code, this security critical info...
delete rows and return an id of the deleted rows <p>is it possible to delete a row and return a value of the deleted row?</p> <p>example <code>DELETE FROM table where time &lt;= -1 week SELECT all id that were deleted</code></p>
<p>If you want to control the operations in the database, you could consider to use JOURNAL tables. There's a question <a href="http://stackoverflow.com/questions/9484714/how-to-store-datas-change-history">here</a> in SO about this.</p> <p>They are a mirrored table, usually populated by a trigger with the operation pe...
Set size of inner arrays in Java <p>I have an ArrayList of Arrays:</p> <pre><code>ArrayList&lt;byte[]&gt; arrayOfBytes = new ArrayList &lt;&gt;(); </code></pre> <p>I want (and I don't know how) to set a predefined size of the Inner Arrays (the bytes arrays).</p> <p>Is this possible? If it is, how can I do it?</p> <...
<p>The one and only way is to set the size when you're adding those arrays into the list.</p> <pre><code>list.add(new byte[size]); </code></pre> <p>There are no arrays in the List without you explicitly adding them. Just create the arrays at the right size.</p>
awk/sed: Insert file content before last line of specific block number <p>Given are two files, the first is an Apache config file:</p> <pre><code>$ cat vhosts-ssl.conf &lt;VirtualHost *:443&gt; vhost 1 foobar 1 foobar 2 barfoo 1 barfoo 2 &lt;/VirtualHost&gt; &lt;VirtualHost *:443&gt; vhost 2 foobar 2 ...
<p><code>awk</code> to the rescue!</p> <p>requires multi-char record separator, supported by <code>gawk</code></p> <pre><code>$ awk 'NR==FNR{insert=$0; next} {print $0 (FNR==2?insert:"") RT}' RS='^$' insert.file RS="&lt;/VirtualHost&gt;" file </code></pre> <p>read the first file in complete and assign to the var...
How to print full array inside a block or outside block? <p>Hello I have an array of floats, but I just can't print the full array </p> <p>here's the first block which saves successfully the floats into the array floatDataArray</p> <pre><code> double valuesArray[882000]; double *floatDataArray = valuesArray; __block...
<p>If you want to print a C array of floats you will need to write a function to do so. You can't use <code>printf</code> or <code>NSLog</code> to print a C array without writing a for loop</p> <p>If you were to uncomment the <code>printf</code> line in your top block of code you'd see your array. However, if you real...
UWP Background Media Playback <p>I'm trying to follow <a href="https://msdn.microsoft.com/pl-pl/windows/uwp/audio-video-camera/background-audio?f=255&amp;MSPPError=-2147217396" rel="nofollow">this tutorial</a> to set up the background audio player in my app but I'm stuck at step one. There is no capability called <code...
<p>I thought that page was fairly straightforward. As mentioned on the page, the capability is "Background Media Playback".</p> <p><a href="https://i.stack.imgur.com/gUGIp.png" rel="nofollow"><img src="https://i.stack.imgur.com/gUGIp.png" alt="Screenshot"></a></p> <p>If you still don't see <em>that</em> in the list, ...
How do I remove the circular dependency in my Organization-Owner-Member models? <p>Heyo, I'm fairly new to this stuff so please pardon me if this is a stupid question. I'm trying to create an app where users can create organizations and join already existing ones. My requirements are:</p> <ul> <li>an organization may...
<p>I still can't see why you have so much looping information. Your <code>OrgMember</code> class has an organization field, even though <code>Org</code> already has a <code>ManyToMany</code> with <code>OrgMember</code>. Same thing with <code>OrgOwner</code> - except that points to <code>OrgMember</code> which already p...
How to create a String instead of printing it to standard out? <p>Consider the following function:</p> <pre><code>use std::io; pub fn hello() { println!("Hello, How are you doing? What's your characters name?"); let mut name = String::new(); io::stdin().read_line(&amp;mut name).expect("Failed to read na...
<p>Use the <a href="https://doc.rust-lang.org/stable/std/macro.format!.html"><code>format!</code></a> macro.</p> <pre><code>pub fn hello() -&gt; String { println!("Hello, How are you doing? What's your characters name?"); let mut name = String::new(); io::stdin().read_line(&amp;mut name).expect("Failed t...
Find Maximum value of a distribution <p>Question: I have a function <code>X</code>, and want to find the value <code>y</code> that maximizes <code>X(y)</code>.</p> <pre><code>set.seed(8) A &lt;- seq (1:20) B &lt;- c(0,rbinom(18,1,0.5),1) X &lt;- function (y) { fx &lt;- prod(1*B-pnorm(A-y)*(-1)^B) fx } X(10) [1] 3....
<p><code>optimize()</code> converges to the maximum value in the interval:</p> <pre><code>optimize(X,c(0,20),maximum=TRUE) ## $maximum ## [1] 19.99993 ## ## $objective ## [1] 0 </code></pre> <p>Plotting the curve confirms this.</p> <pre><code>x &lt;- seq(0,20,length=1000) y &lt;- sapply(x,X) plot(x,y,type="l") </co...
Slide Up Transition of React Component <p>I am just starting to use animations/transition in my <code>React.js</code> projects. In the GIF below, when I close a <code>Message</code> component, it fades out. After it fades, I hide the component using <code>onAnimationEnd</code>.</p> <p>What I want to happen is when a <...
<p>I would suggest you to use <code>css transitions</code>. </p> <p>Have a class called <code>open</code> attached to the root of the <code>Message</code> component. <code>onAnimationEnd</code> remove the class <code>open</code>. Now, use <code>height</code> to animate that class.</p> <p>Pseudo code.</p> <pre><code>...
SQL Server: Determining games made more than 2 years ago <p>The question I have is Which developers have games that were released more than two years ago?</p> <p>My code looks like this:</p> <pre><code>SELECT devName FROM DEVELOPER as d INNER JOIN GAME as g ON d.devID = g.devID WHERE gameReleaseDate &lt; (WH...
<p>I think something like this should work (assuming that the field being compared is one of the <code>DATE</code> / <code>DATETIME</code> data types):</p> <pre><code>DATEADD(year, -2, GETDATE()) </code></pre> <p><a class='doc-link' href="http://stackoverflow.com/documentation/sql-server/1471/dates/15054/dateadd-for-...
Initializing a char array with values in C cause Segmentation Fault <p>I have an array of <code>char</code> defined as followed</p> <pre><code>char users[5] = ""; </code></pre> <p>I then add users to this array by assignment as follow</p> <pre><code>users[0] = "UserOne"; users[1] = "UserTwo"; </code></pre> <p>Howev...
<p>A char is a single character.</p> <pre><code>char* user[5]; </code></pre> <p>would be the right way to create an array of pointers to char arrays(strings).</p> <p>I don't know the purpose of the <code>= ""</code> in the user declaration, but it should be an error. You could do</p> <pre><code>char* user[5] = { ""...
Moving nodes within a Dijit Tree <p>I am using a tree as an input tool to allow the user to organize categories.</p> <p>I would like the users to be able to move the nodes around at the top level, specifically reordering them under the same parent.</p> <p>Everything looks fine until it is time for the store to be upd...
<p>You need to place the aspect around the store's put function before wrapping it with Observable. With your code Observable hasn't got access to the replaced put function. It will work if you replicate closely the <a href="https://dojotoolkit.org/reference-guide/1.10/dijit/Tree.html#drag-and-drop" rel="nofollow">exam...
strange behavior of enable_if <p>does anyone know why the following code compiles</p> <pre><code>static const size_t CONSTANT = /* ... */; template&lt; size_t M = CONSTANT, typename std::enable_if_t&lt; M!=1, size_t &gt; = 0 &gt; res_type&lt;/*...*/&gt; foo() { // ... } </code></pre> <p>while this does not:</p> <...
<p>SFINAE requires the failed substitution to be dependant on a template parameter. </p> <p>If the substitution failure happens at the first phase of the lookup (in other words, when it is not dependant on template parameters) the program is ill-formed, no diagnostics required. But the popular compilers yield a readab...
JSch SCP file transfer using "exec" channel <p>I'm very new to the SCP protocol and JSch. I have to transfer a file fro a remote device via SCP to Android. The server side developers refused to tell be anything about their device except for the file location, and the root account which can be used to access it with SCP...
<p>If the device supports SCP only, do not try to use SFTP, use SCP.</p> <p>There's an official example for implementing the SCP download using the JSch:<br> <a href="http://www.jcraft.com/jsch/examples/ScpFrom.java.html" rel="nofollow">http://www.jcraft.com/jsch/examples/ScpFrom.java.html</a></p> <hr> <p>Do not get...
loop within a loop in javascript <p>I am trying to run a loop inside a loop to get some valid dates but doesnt seem to work fine. my sample data is like</p> <p>these are valid days <code>[ 'Monday', 'Thursday', 'Friday', 'Sunday' ]</code></p> <p>and these are valid dates</p> <pre><code>[ Sun Oct 09 2016 05:00:00 GMT...
<p>You can do it simply using only javascript:</p> <p>Instead of taking full names in day array you can use 0-6 for days and then</p> <pre><code> //sunday=0,monday=1 ....saturday=6 var days=[1,4,5,0]; var result_arr=[]; // required array for result for(date in dates) { if(days.indexOf(n...
Add multiple UIButtons with color images programmatically to the UIViewController scene <p>I have UIViewController class in which I add multiple color buttons programmatically to the scene. I have 11 different colors, so 11 UIButtons which I add to the scene in viewDidLoad function. See below how I add gray and red col...
<p>As rightly suggested by @rmaddy to put the colours in an array and then use those colours in a loop. You may use a variable to keep track of the position of your array.</p> <pre><code>var i = 0 for images in arrayImages { let imageButton = UIButton(frame: CGRect(x: buttonX, y: 643, width: 25, height: 125)) ...
Unable to find class within a class capybara <p>My html code is :</p> <pre><code>&lt;button type="button" class="close" data-dismiss="modal"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;span class="sr-only"&gt;Close&lt;/span&gt;&lt;/button&gt; </code></pre> <p>I tried: </p> <pre><code>1. find(:xpath...
<p>By default Capybara doesn't find non-visible elements (which anything with a class of 'sr-only' usually is), and even when you tell it find non-visible elements (through the visible: false (or :hidden/:all) option) you won't be able to click on the element because there would be no way for a user to click on a non-v...
My Reachability Notifier is only able to be called once <p>So, I have the following in my AppDelegate.<br>It will notify my when I turn my WIFI off but will not react after that initial run.<br>I have had this working in the past.<br>I'm on swift 3 with Xcode 8 and the reachability that is for this version of the swift...
<p>There are some changes in Reachability in Swift 3. Download the latest <code>Reachability.swift</code> file and add that in your project. <a href="https://github.com/ashleymills/Reachability.swift/blob/master/Reachability/Reachability.swift" rel="nofollow">Link</a></p> <p>For <strong>Swift 2.x</strong> code please ...
Trying to make a simple Tic Tac Toe game in Javascript for an assignment. No errors, but nothing happens when I click the boxes <p>so I'm in a beginner web programming course, and my assignment is to make a Tic Tac Toe game in Javascript. My teacher provided a template for use to fill out, which should have been really...
<p>This is a beginner question, so I'm going to post an answer appropriate to a beginner.</p> <blockquote> <p>No errors or messages, nothing. Chrome isn't showing me any errors, so I have no idea where to even look.</p> </blockquote> <p>You are correct that errors (you looked in Developer Tools > Console right?) ar...
Center both the label and input in a page <p>I had tried to center the input boxes in a form using <code>margin: 0 auto</code>, and it worked. Problem is, since the input boxes were now block-level elements, the input boxes and labels were not aligned. They were on top of the other, like a line break. </p> <p>So, I fi...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>div.center { display: inline-block; border: solid; } form { border: solid; text-align: center }</code></pre> <pr...
Assembly + C - Sorting Structures <p>I'm working on a project that uses x86 Assembly (NASM) and C together. There's a subroutine written in Assembly that uses indexed addressing modes to figure out if a certain year (int) is lesser or greater than another, then returns -1, 1, or 0 depending on the outcome. It appears t...
<p>I got it. It was because I was setting min = i in the wrong spot. It should be like this:</p> <pre><code>for (i = 0; i &lt; numBooks - 1; i++) { /*** WAS HERE ***/ for (j = i + 1; j &lt; numBooks; j++) { /*** SHOULD BE HERE ***/ min = i; /* Copy pointers to ...
How to detect fast moving soccer ball with OpenCV, Python, and Raspberry Pi? <p>This is the code. I am trying to detect different types of soccer ball using OpenCV and python. Soccer ball could of different colors. I can detect the ball if it is not moving. But, the code does not work if the ball is moving fast.</p> <...
<p>May I suggest you read this post?</p> <p><a href="http://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/" rel="nofollow">http://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/</a> </p> <p>There are also a few comments below indicating how to detect multiple balls rather than one.</p>
how make files training and testing in svm multi label? <p>how make files training and testing in svm multi label? my question is <a href="https://www.quora.com/Can-anyone-give-me-some-pointers-for-using-SVM-for-user-recognition-using-keystroke-timing" rel="nofollow">https://www.quora.com/Can-anyone-give-me-some-pointe...
<p>Are your labels 1 and -1? If so, you will need to know those classes for your test data as well. The point of testing your classifier is to see how well it can predict unseen data. </p> <p>As a small example you could build your classifier with your training data: <code>x_train = [65, 134], [70,98]....... [79, ...
Using liftA2 with functions <p>I am wondering how this works. </p> <pre><code>x 9001 = True x _ = False g 42 = True g _ = False (liftA2 (||) x g) 42 = True liftA2 :: Applicative f =&gt; (a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c x :: (Eq a, Num a) =&gt; a -&gt; Bool g :: (Eq a, Num a) =&gt; a -&gt; Bool </co...
<p>Remember that <code>((-&gt;) a)</code> is a <code>Monad</code> (also known as the reader monad), and hence an <code>Applicative</code> too. Taken <a href="https://hackage.haskell.org/package/base-4.9.0.0/docs/src/GHC.Base.html#line-641" rel="nofollow">from the source for base</a></p> <pre><code>instance Applicative...
What's wrong with my JPQL query? <p>I am trying to implement join but I am facing error. I have product table and store table. product table references store table through foreign key as shown below:</p> <p><strong>Product.java</strong></p> <pre><code>@Entity public class Product { @Id @GeneratedValue(strate...
<p>The query is invalid. You refer to a <code>p.storeId</code> which doesn't exist. I think something like this should be sufficient:</p> <pre><code>select p from Product where p.store.city = :city </code></pre> <p>Or:</p> <pre><code>select p from Product join p.store as store where store.city = :city </code></pre> ...
AUTO_INCREMENT & NOT NULL are not necessary after PRIMARY KEY (alone it's sufficient)? <p>I <del>know</del> <em><strong>Think</strong></em> that PRIMARY KEYs have to be <s>AUTO_INCREMENT</s> &amp; NOT NULL ,,, but do i have to define them myself? <br/> P.S.: is the answer affected by the DBMS I'm using ?!</p> <p><i></...
<p>Primary key doesn't have to be auto_increment (or some equivalent in other engines).</p> <p>It doesn't have to be defined as NOT NULL either.</p> <p>The PRIMARY INDEX enforces the NOT NULL check and will cause the INSERT to fail in case you try inserting NULL value. Unless the engine supports inserting NULL which ...
Nonewline python <p>I am trying to print random numbers using random , but when I try to print the output in one line using <code>end= " "</code> the output doesnt show anything until I break the program.</p> <pre><code>import random import time while True: x = random.randint(1,6) print(x, end=" ") time.sl...
<p>You can disable buffering by passing <code>flush=True</code> to <code>print</code> function (in python3)</p> <pre><code>print(x, end=" ", flush=True) </code></pre>
insert operation in Binary tree error? <p>I am getting error in the insertion operation for the binary tree the question link is( <a href="https://www.hackerrank.com/challenges/binary-search-tree-insertion" rel="nofollow">https://www.hackerrank.com/challenges/binary-search-tree-insertion</a> ) my code is :</p> <pre><...
<p>For starters, you need to allocate a new node on each insertion.</p> <p>Start your declaration like this:</p> <pre><code>node* insert(node * root, int value) { node* xx = new node(); xx-&gt;left = NULL; xx-&gt;right = NULL; xx-&gt;data = value; </code></pre>
Create a new instance of a generator in python <p>I am trying to scrape a page which has many links to pages which contain ads. What I am currently doing to navigate it is going to the first page with the list of ads and getting the link for the individual ads. After that, I check to make sure that I haven't scraped ...
<p>It looks to me like your code would be a lot simpler if you put the logic that scrapes successive pages into a generator function. This would let you use <code>for</code> loops rather than messing around and calling <code>next</code> on the generator objects directly:</p> <pre><code>def urls_gen(driver): while ...
Matching words and valid sub-words in elasticseach <p>I've been working with ElasticSearch within an existing code base for a few days, so I expect that the answer is easy once I know what I'm doing. I want to extend a search to yield the same results when I search with a compound word, like "eyewitness", or its compon...
<p>there are two things you could could do:</p> <ol> <li>you could split words into their compounds, i.e. <code>firetruck</code> would be split into two tokens <code>fire</code> and <code>truck</code>, <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-compound-word-tokenfilter.html" rel...
infowindow is not updating with marker google maps <p>I am developing a web page for viewing vehicle locations using gps data. I have make the back end working fine with the help of Mr. Aruna a genius in stack Overflow. Now I need a help for updating my google map infowindow. marker is updating its location no issue w...
<p>Your <code>click</code> event listener is called asynchronously, long after your <code>for</code> loop has completed. So the value of <code>i</code> is not what you expect.</p> <p>This is easy to fix (assuming there are not other problems as well).</p> <p>Take all of the code inside the <code>for</code> loop body ...
How to detect if users are near each other - Swift <p>I know how to use region monitoring to trigger an event when a user enters or exits a certain region, however, I am if it is possible to do the same thing in case two (or more) users are near each other (around 100 meters from each other). </p> <p>I'm afraid iBeaco...
<p>You can achieve this through <a href="https://developer.apple.com/reference/multipeerconnectivity" rel="nofollow">Apple's Multipeer Connectivity Framework</a>.</p> <p>It is limited up to 7 other connected iOS devices at a time within 100 meters.</p> <p>There's also a WWDC video on it here too <a href="https://deve...
Python - remainder operator <p>Although I know there is a built in <code>str()</code> <code>function</code> in <code>python</code>, I'm trying to understand its logic.</p> <pre><code>def intToStr(i): digits = '0123456789' if i == 0: return '0' result = '' while i &gt; 0: result = digits...
<p>% means mod, a number mod 10, result in the last number in it.<br> So 5 % 10, you will get 5.<br> You should try it yourself first.</p>
Merging numeric and characters from different datasets <p>I am trying to combine two datasets. Dataset 1 has ca. 4000 rows and Dataset 2 has 132 rows. I want to match the <code>Brand</code> names in Dataset 2 with the <code>UPS</code> one in dataset 1. So All the <code>UPS</code> have the corresponding <code>Brands</co...
<p>Based on your description, I think you need:</p> <pre><code> merge(PAW, UB, by.x = "UPS", by.y = "UPC", all.x = TRUE) </code></pre> <p>to get what you want. As Nicola already said in the comments, the only way you can match the <code>Brand</code> names in <code>UB</code> to the <code>UPS</code> codes in <code>PAW<...
Microsoft Graph Send Mail giving ErrorSubmissionQuotaExceeded <p>I am using Microsoft Graph API to send mails to users of a domain in which I am an admin. I have created a script for doing so. I am able to send some mails (around 10000) after which it returns an error </p> <p>"ErrorSubmissionQuotaExceeded" and says pl...
<p>Transport within exchange limits the number of emails that a given account can send per minute. The default settings in O365 are 30 messages per minute. Try it again by limit your submission rate to 1 mail every 2 seconds. I'm not sure how it is calculated off the top of my head (per minute, per hour, per whateve...
how we cam make a sharp edge of div from middle in css? <p>I want to make a div with something like this.</p> <p><a href="https://i.stack.imgur.com/8k9kz.png" rel="nofollow"><img src="https://i.stack.imgur.com/8k9kz.png" alt="enter image description here"></a></p> <p>After twitter circle the edge is showing in middle...
<p>Something like this ? </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>body {background:#FFFFFF;padding:20px} p {background:black; -webkit-border-radius: 10px; -moz...
Session not working after moving from 5.2 to 5.3 <p>When i move my site then controller don't get session available but get session view page. My previous version was laravel 5.2 to move laravel 5.3</p> <p>Please can me help me any guys.</p>
<p><strong>This is Directly from laravel docs, Upgrade guide from 5.2 to 5.3 :</strong></p> <p><strong>Session In The Constructor</strong></p> <p>In previous versions of Laravel, you could access session variables or the authenticated user in your controller's constructor. This was never intended to be an explicit fe...
How to prevent page to scroll to top after gridview checkbox changed <p><a href="https://i.stack.imgur.com/G95zF.png" rel="nofollow">enter image description here</a>i tried many solutions before to prevent page scroll top after checkbox in grid view was changed but no one solve my problem .. please help! thanks in adva...
<p>Put this in the page directive <strong>&lt;%@ Page %></strong></p> <pre><code>MaintainScrollPositionOnPostback = "true" </code></pre> <p>It happens due to page PostBack. The above ensures the position of the scroll after page PostBack. </p> <p>Or keep the <code>GridView</code> in a div and use <code>JavaScript</c...
Postgresql, Rails - could not fork autovacuum worker process: Resource temporarily unavailable <p>This is happening to me while in my local environment, Mac OSX, every time I start my server - puma - and workers - resque. </p> <p>The logs don't say anything helpful, just a repeated, "could not fork autovacuum worker ...
<p>I followed these two articles, and so far this seems to work. Will update if something changes.</p> <p><a href="https://github.com/sociam/indx/wiki/Increasing-max-connections-under-os-x" rel="nofollow">https://github.com/sociam/indx/wiki/Increasing-max-connections-under-os-x</a> </p> <p><a href="http://big-elephan...
vim match for complete html tags <p>Helllaw world?</p> <pre><code>&lt;font color=red&gt;&lt;font color=red&gt;I am stupid&lt;/font&gt;&lt;/font&gt; </code></pre> <p>We can see that <code>&lt;font color=red&gt;</code> is duplicated, so I can delete it by a command</p> <pre><code>:%s,&lt;font color=red&gt;\(&lt;font c...
<p>Just for information. </p> <p>I am the person who asked above original question.</p> <p>I wrote following code.</p> <pre><code>let g:position=[0,0,0,0] function! SetQQ(arg_0, arg_1, arg_2, arg_3) let g:position[0] = a:arg_0 let g:position[1] = a:arg_1 let g:position[2] = a:arg_2 le...
python csv new line <p>iam using this code to convert db table to csv file, it is converting in to csv but instead of new line / line breck its using double quotes , can someone help me ...
<p>SQL queries will return results to you in a list of tuples from <code>fetchall()</code>. In your current approach, you iterate through this list but call <code>str()</code> on each tuple, thereby converting the whole tuple to its string representation.</p> <p>Instead, you could use a list comprehension on each tupl...
Why it raises error when print the return values of function for non-linear equations <p>I use fsolve to solve equations, but when I put the solution into the KMV() function again, it raises an exception. I can not figure it out... </p> <pre><code>def KMV(x, *args): valueToEquity = float(x[0]) volOfValue = flo...
<p>If you remove the leading <code>*</code> from <code>args</code> in the declaration of <code>KVM</code> you can call it like that, but other code would fail if you did that. <code>*args</code> is for <em>variadic</em> functions, that is functions with a variable number of parameters. </p> <p>If you want to pass ke...
Can't call CMake from a Python script <p>I'm trying to call the <a href="http://en.wikipedia.org/wiki/CMake" rel="nofollow">CMake</a> command from a Python script. This is my code:</p> <pre><code>cmakeCmd = ["C:\Program Files\CMake\bin\cmake.exe",'-G Visual Studio 11 Win64', 'C:\Users\MyUser\Desktop\new\myProject'] re...
<p>A backslash (<code>\</code>) in a Python string is an escape character. That's why the string <code>"C:\Program Files\CMake\bin\cmake.exe"</code> is translated to <code>C:\\Program Files\\CMake\x08in\\cmake.exe</code> (notice that <code>\b</code> equals <code>\x08</code>). To fix this, tell Python you want the strin...
Oracle Apex apex_application.g_f10.COUNT is 0 <p>Oracle Apex: 5</p> <p>This appears to be simple however I'm unable to get through this.</p> <p>I'm testing the <code>apex_application.g_f10.COUNT</code> by inserting the checked value in a dummy table following is the code I'm using:</p> <pre><code>declare begin :P20_...
<p>When ever we use check box as report column in report we have to make sure that column attribute should be <strong><em>Standard report column</em></strong> .Then only it will written the value </p> <p><a href="https://i.stack.imgur.com/flYag.png" rel="nofollow"><img src="https://i.stack.imgur.com/flYag.png" alt="en...
How to insert values to a database in Class B from a JTextField input that is in Class A <p>I am making a Online food ordering system for a project but i m still new to java. I have two classes. Signin.java and other is mextable.java. I am trying to access a textfield (part of signin.java), read <em>that</em> value fr...
<p>As far as i can analys from the question the flow goes from signin to mextable. And everyuser will have the username.in that case you can make the field JTextField as public static and use that field in the mextable class. </p> <p>In signin class</p> <p>Public static JTextField val ;</p> <p>And to access in mex...
More Elegant Way of Coding a Setter <p>I was wondering if their was a smarter and more elegant way of writing a setter, or for that matter, any code which has to check for whether user input is correct</p> <p>This just seems odd. I'm a novice, so maybe this is just the standard way of approaching this problem, but if ...
<p>First of all you can simplify your code like this:</p> <pre><code> public void setMonth() { int input = 0; do { input = scan.nextInt(); } while(input &lt;= 0 || input &gt;= 13) this.month = input; } </code></pre> <p>In addition to that I'd separate this into two functions. A setter should ...
Trying to Solve Numerical Diff Eq Using Euler's Method, Invalid Value Error <p>I am trying to learn it from this website: <a href="http://nbviewer.jupyter.org/github/numerical-mooc/numerical-mooc/blob/master/lessons/01_phugoid/01_03_PhugoidFullModel.ipynb" rel="nofollow">http://nbviewer.jupyter.org/github/numerical-moo...
<p>The solution is very simple. You forgot the return statement in euler_step. Change</p> <pre><code>def euler_step(u, f, dt): u + dt * f(u) </code></pre> <p>to</p> <pre><code>def euler_step(u, f, dt): return u + dt * f(u) </code></pre> <p>and it will work</p>
How to structure big projects in Angular2? <p>We are looking into Angular2 right now and want to introduce it into the next project. There are two things that are bugging us right now. </p> <ol> <li>How big should an Angular2 application maximal get? </li> <li>How should we structure a >3MM project?</li> </ol> <p>We ...
<blockquote> <p>Are there any good guidelines on that topic?</p> </blockquote> <p>For best practices, checkout <a href="https://angular.io/styleguide" rel="nofollow">the official style guide</a></p> <blockquote> <p>How big should an Angular2 application maximal get? </p> </blockquote> <p>I'm not aware of a size ...
How to connect X-Lite softphone from host to guest vm with asterisk? <p>I am desperate. I've install asterisk on vm 1 (centos) and opensips on vm2(centos), and everything works well so far. Now I need to connect softphone from host to vm1 (to make a call (I'm traying to set up auto-dial out system))) and don't know how...
<p>Simplest way - use bridged network to your router.</p> <p>But host-only also work ok(at least in vmware and virtualbox), check your firewall rules</p>
PHP session_start doesn't work <p>My issue is that, when I use session_start(); in my php code, instead of a PHPSESSID cookie being set, a cookie with blank title and value "HttpOnly" is set instead. Using var_dump($_SESSION), I see that I can set session variables and they'll display on the page, but they won't displa...
<p>Check assigned values to <code>session.use_cookies</code>, <code>session.use_only_cookies</code> on php.ini file in your server. </p> <p>You need to set the value of <code>session.use_cookies</code> and <code>session.use_only_cookies</code> in php.ini:</p> <pre><code>session.use_cookies=1 session.use_only_cookies...
How do you define a function during dynamic Python type creation <p>(This is in Python 3 btw)</p> <p>Okay so say we use <code>type()</code> as a class constructor:</p> <p><code>X = type('X', (), {})</code></p> <p>What I'm trying to find is how would <code>type()</code> accept a function as an argument and allow it t...
<p>You need to pass the function. In your code, you call the function, and pass the result.</p> <p>Try:</p> <pre><code>def print_hello(self): print("Hello {0}!".format(self.name)) X = type('X', (), {'name':'World', 'greet': print_hello}) </code></pre>
How to convert UTC timezone to local timezone location <p>I have following Code:</p> <pre><code>UTC&lt;br/&gt; &lt;div id="divUTC"&gt;'UTC+5:30'&lt;/div&gt;&lt;br/&gt; &lt;br/&gt; &lt;div id="divLocal"&gt; &lt;/div&gt; </code></pre> <p>In My javascript I am trying to convert UTC+5:30 to IST-Indian Standard Time (Chen...
<p>One of the problems of converting UTC+XX to whatever local timezone text is that it is not 1:1 mapping. Still, if you use momentjs with time zones, you could get yourself a list of possible locations.</p> <p>1) get all the known timezones:</p> <pre><code>var names = moment.tz.names(); // names now contain an array...
Python - First and last character in string must be alpha numeric, else delete <p>I am wondering how I can implement a string check, where I want to make sure that the first (&amp;last) character of the string is alphanumeric. I am aware of the <code>isalnum</code>, but how do I use this to implement this check/substit...
<p>Though not exactly what you want, but using str.strip should serve your purpose</p> <pre><code>import string st.strip(string.punctuation) Out[174]: 'jkkujkl-ghjkjhkj' </code></pre>
Cocoa protocol for cut, copy and paste actions <p>Is there any protocol in Cocoa implementing standard actions for cut: copy paste:, like there is UIResponderStandardEditActions for UIKit?</p> <p>I would like to do something like this without implementing delete(_:) in this class, with the new Swift3 #selector:</p> <...
<p>You can define your own protocol:</p> <pre><code>@objc protocol MyStandardActionProtocol { func cut(_: Any) func copy(_: Any) func paste(_: Any) } </code></pre> <p>And use <code>#selector</code> like:</p> <pre><code>override func supplementalTarget(forAction action: Selector, sender: Any?) -&gt; Any? ...
Method that returns the first n odd numbers <p>Just a quick question -- I'm probably overlooking something here. </p> <p>The below method outputs the first 2 odd numbers correctly: [1,3]</p> <p>If I'm not mistaken, shouldn't I want the length of the array to eventually <strong>equal</strong> n? As I understand it, th...
<p>Let's do your example with <code>n == 2</code>.</p> <p>Iteration 1: <code>array.length == 0</code>. Iteration 2: <code>array.length == 1</code>.</p> <p>Both of these values are <code>&lt; 2</code>. Now if you change <code>&lt;</code> to <code>&lt;=</code>, you'd have a 3rd iteration where <code>array.length == 2</...
Remove the function and command from the output <p>I have trying out defaultdict with lamba function. However, I could not get the output I want. I will demonstrate with more details. Below is my code:</p> <pre><code>from collections import defaultdict the_list = [ ('Samsung', 'Handphone', 10), ('Samsung', '...
<p>Just convert each <code>defaultdict</code> back to a regular <code>dict</code>, you can do it easily using <a class='doc-link' href="http://stackoverflow.com/documentation/python/196/comprehensions/738/dictionary-comprehensions#t=201610160749050862097">dict comprehension</a>:</p> <pre><code>{ k:dict(v) for k,v in d...
Filter search data from Microsoft Access Database and filter in datagridview c# <p>I use this code to try and make the application filter the text in the textbox but it refuses to do so and an error message keeps popping up. Here is the code:</p> <pre><code>using System.Windows.Forms; using System.Configuration; using...
<p>The second command calls NEW on the OleDbConnection variable. The result is that this recreates the OleDbConnection but misses the initialization of the required connectionstring </p> <p>In this context you should still use the global object and do not create a new connection. So just remove this line</p> <pre><co...
How get to img element <p>I want when user clicked on <code>.fa-search-plus</code> an alert shows the src of the <code>.img-reponsive</code></p> <p>Here is my code:</p> <pre><code>&lt;div class="col-lg-push-4 col-lg-3 col-md-3 col-sm-12 col-xs-12"&gt; &lt;div class="grid"&gt; &lt;figure class="effect-her...
<p>Using this code may be helpful for you:</p> <pre><code>var someimage = document.getElementById('this_one'); var myimg = someimage.getElementsByTagName('img')[0]; var mysrc = myimg.src; </code></pre>
PCI Express interrupts in driver <p>Hello iam developing PCIe communication between Xilinx FPGA and Intel PC... I have written a kernel module(linux driver), i am using INTx interrupts. I am facing the problem in interrupt handling....</p> <p><strong>Before loading kernel module:</strong></p> <p>from lspci: INT A-->1...
<p>You don't show where your <code>dev-&gt;gIrq</code> is set from, but your kernel module should be taking the interrupt number from the <code>struct pci_dev</code> associated with your device. See this comment in <code>include/linux/pci.h</code>:</p> <pre><code>struct pci_dev { ... /* * Instead of touch...
How to write Node.js binary stream from zip to an S3 <p>I want to zip up files and dump the binary output right to AWS S3. I'm testing out my code first by making sure it can even write to a local ZIP file, which is not working.</p> <pre><code>function zipFiles(filenames) { return new Promise((resolve, reject) =&gt;...
<p>Got it!</p> <pre><code>function zipFiles(filenames) { return new Promise((resolve, reject) =&gt; { const out = fs.openSync('testing.zip', 'a'); const child = spawn(zipCmd, ['-'].concat(filenames)); let buffer = new Buffer(''); child.stdout.on('data', (data) =&gt; { buffer = Buffer.concat([b...
How to map json arrays in angularjs controller <p>I am having problem in mapping json array in angularjs, can someone please look how can i correctly map the arrays and iterate their values. In arrays icdCode requires to be dynamic field (this is the other part i need help on) how can i achieve this correctly. thanks</...
<p>If You want to iterate over this object , You can use nested loop</p> <pre><code>angular.forEach(your_object.preAuthDiagnosisVOs, function(value, key) { if (angular.isObject(value)) { angular.forEach(value, function(value1, key) { if (angular.isObject(value1)) { angular.forEa...
logstash parsing IPV6 address <p><strong>I am a newbie to logstash / grok patterns.</strong></p> <p>In my logfile i have a line in this format as below:</p> <pre><code>::ffff:172.19.7.180 - - [10/Oct/2016:06:40:26 +0000] 1 "GET /authenticator/users HTTP/1.1" 200 7369 </code></pre> <p>When I try to use a simple IP pa...
<p>Note that the log contains <strong>both</strong> IPv4 and IPv6 addresses separated by a colon, so the correct pattern you need to use is the following one:</p> <pre><code>%{IPV6:ipv6}:%{IPV4:ipv4} </code></pre> <p>Then in your event you'll have two fields:</p> <pre><code>"ipv6" =&gt; "::ffff" "ipv4" =&gt; "172.19...
With Chromium Embedded is there a way to communicate to the program, from Javascript? <p>If you have a chromium embedded web browser widget in an application, is there a way to notify the application that something has occurred at any point in time? for example let's say an item is resized or a button is clicked and it...
<p>The following addition to the Chromium GuiClient demo works for me in D7:</p> <pre><code>procedure TMainForm.TestJS; begin if crm.Browser &lt;&gt; nil then crm.Browser.MainFrame.ExecuteJavaScript( 'alert(''JavaScript execute works!''); console.log(''From Javascript'')', 'about:blank', 0); end; procedur...
can someone help me to fix this error <pre><code> UIAlertController *alert = [[UIAlertController alloc] initWithTitle: alertString message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; </code></pre> <p>I'm having this error: </p> <pre><code>No visible @interface for 'UIAlertCon...
<p>This true of step to declare <code>UIAlertController</code> </p> <pre><code>UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; // add action button UIAlertAction *okAction = [UIAlertAction actionWithTitle:actionTitle s...
Add data in recyclerview <p>In this way I create my <code>recyclerview</code> contents:</p> <pre><code>MyAdapter adapter = new MyAdapter(new String[]{"one", "two", ..."}); rv.setAdapter(adapter); </code></pre> <p>But now I want add more data, for example, how can I add a new string <code>new String[]{"nine", "ten", ....
<p>Take an ArrayList&lt;>(), say stringList and add data to it. And then notify your adapter about dataset change.</p> <p>Initialize your adapter with this data structure.</p> <pre><code>MyAdapter adapter = new MyAdapter(stringList); rv.setAdapter(adapter); </code></pre> <p>Add more items with this call.</p> <pre><...
SAP NetWeaver Application Server ABAP 7.03 trial, error during installation <p>Any suggestion as how to solve this installation error?</p> <p><a href="https://i.stack.imgur.com/rzOPa.png" rel="nofollow"><img src="https://i.stack.imgur.com/rzOPa.png" alt="enter image description here"></a></p> <p><a href="https://i.st...
<p>Problem eventually solved by copying of [c:\windows\system32\drivers\etc] folder to [c:\windows\SysWOW64\drivers].</p>
setinterval working very randomly <p>Hi,</p> <p>I have this code:</p> <pre><code>//&lt;![CDATA[ $(window).load(function(){ setInterval(function(){ // toggle the class every 10 seconds $('body').addClass('new'); setTimeout(function(){ // toggle back after 10 seconds $('body').removeClass('new'); ...
<p>You've told the code adding the class to run every 10 seconds. Every 10 seconds, you also schedule a timer to remove the class 10 seconds later. So as of the 20th second, you have a race&nbsp;&mdash; will the first timer get there first, or will the second? In any case, it won't have the result you want.</p> <p>Use...
Issues with retrieving data from Access database using criteria from JTextField objects <p>I have created user login window in java and i am getting some issues regarding retrieving saved data from ms access database. Here is my code:</p> <pre><code>package databaseretrievedata; import java.awt.event.ActionEvent; impo...
<p>Your <code>sql</code> is missing something, your statement:</p> <pre><code>String sql="select Username,Password from simba where Username='"+field+"'and Password='"+field1+"'"; </code></pre> <p>This won't be what you're actually expecting here. Since the <code>JTextField</code> does not provide a special <code>toS...
Is there a popular Linux/Unix format for binary diffs? <p>I'm going to be producing binary deltas of multi-gigabyte files.</p> <p>Naively, I'm intending to use the following format:</p> <pre><code>struct chunk { uint64_t offset; uint64_t length; uint8_t data[]; }; struct delta { uint8_t file_a_checks...
<p>For arbitrary binaries, of course it makes sense to use a general purpose tool:</p> <ul> <li>xdelta</li> <li>bspatch</li> <li>rdiff-backup (rsync)</li> <li>git diff</li> </ul> <p>(Yes, <code>git diff</code> works on files that aren't under version control. <code>git diff --binary --no-index dir1/file.bin dir2/file...
Symfony and Bootstrap dateTimePicker : expected a string <p>I am trying to create a DateTimePickerType to easily add a Bootstrap dateTimePicker to a field, simply by using the type "date_time_picker" in the Form Builder.<br> Unfortunately I am running into some problems. Specifically, Symfony is giving me this error :<...
<p>Apparently this is because there's a need to convert the time format between PHP and JS. I fixed the problem by using only a DateType (time wasn't that necessary).</p> <p>This might be useful for those who still need a DateTime, tho I haven't tested it : <a href="https://github.com/stephanecollot/DatetimepickerBund...
How to use Quartz.NET with ASP.NET Core Web Application? <p>In traditional <code>ASP.NET</code> application, we (re-)intialize the <code>Quartz.NET</code> scheduler in the <code>Application_Start</code> handler in <code>global.asax.cs</code>. But I have no ideas where to write the code for scheduling jobs as there isn'...
<p>You may use <code>ConfigureServices</code> or <code>Configure</code> methods. Although <code>Configure</code> method is mainly used to configure the HTTP request pipeline, the benefit is that you directly can use <code>IHostingEnvironment</code> (and so get configuration settings) and <code>ILoggerFactory</code> int...
how to use owl carousel sync with RTL direction <p>i want to use owl carousel sync with RTL direction but not working</p> <p>i wrote following style to fixed this problem bug my sync owl carousel not working : </p> <pre><code>.owl-carousel .owl-item{ float: right !important; } </code></pre> <p>what to do now?</p>...
<p>Try rtl: true</p> <pre><code>$('.owl-carousel').owlCarousel({ rtl:true, loop:true, margin:10, nav:true, responsive:{ 0:{ items:1 }, 600:{ items:3 }, 1000:{ items:5 } } }) </code></pre>
What do I need to include SQL Server Express in my Wizard installation? <p>I've just finished a project with a SQL Serer database, so in my launch project I use this connection string </p> <pre><code>Data Source=(local);Integrated Security=True </code></pre> <p>And I check every time if database exists locally; if no...
<p>You seem to have an <em>unnamed</em> default instance on your development PC so that you can connect to it using <code>data source=(local)</code>.</p> <p>When SQL Server <strong>Express</strong> is installed, by default, it uses a <strong>named</strong> instance of <code>SQLEXPRESS</code>, so your connection string...
how to synchronize mysql on 2 different workspaces? <p>I have 2 computer in 2 different workspace.<br> I want work on 1 project in 2 place.<br> I use bitbuket.org as vcs system for this project.<br> I need synchronize database (mysql) for this 2 computer .<br> What is best practice for this work? </p>
<p>The best practice in this case, on dev environment, is to use db migrations (e.g. <a href="http://www.liquibase.org/" rel="nofollow">liquibase</a> or tool provided with framework you've chosen) and data fixtures (sample solution for <a href="http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html)" ...
Ruby on Rails : Find record of an object without querying database <p>I want to know how to get a specific record from an object example</p> <pre><code>@user = User.all </code></pre> <p>In <code>index.html.erb</code>, I want to show only the record that in the 3rd order , I try, but this gives me all the records. : ...
<p>Also you can take array element directly in template. For reason – if you need all another users to</p> <pre class="lang-html prettyprint-override"><code>&lt;div class="super-user"&gt; &lt;%= @users[3].name %&gt; &lt;/div&gt; &lt;div class="other-users"&gt; &lt;% @users.each do |u| %&gt; &lt;a href="#"&...
How to create a Lisp FLI function corresponding to a C macro <p>I want to create a lisp function which corresponds to a macro in C. e.g., there is one HIWORD in win32 API, which is defined as a macro in the header file.</p> <p>I tried to define it as below but was told that HIWORD is unresolved.</p> <pre><code>CL-USE...
<p>You cannot do this directly. C preprocessor macros are not preserved in the compilation process, i.e., there is simply no artifact in the generated object files, which would correspond to the C macro itself (though its expansion may be part of the object file multiple times). And since there is no artifact, there is...
How to Dump Headers From Response In php <p>Any one knows how to dump headers from from response in php while creating script</p> <p>I am not able to pick uo the headers from response sent from first request.</p>
<p>Reading request is very easy in Php. Try to use apache_response_headers function which dumps all HTTP response headers.</p> <pre><code>&lt;?php print_r(apache_response_headers()); ?&gt; </code></pre> <p>will print data like this </p> <pre><code>Array ( [Content-Location] =&gt; phpinfo.de.php [Vary] =&gt; ...
react-redux store not updating within onClick function <p>I'm experiencing this weird issue where my react-redux store is updating, but is not updating within the function that calls the actions.</p> <p><code>this.props.active</code> is <code>undefined</code>, then I set it to an integer with <code>this.props.actions....
<p>Your Redux state updates synchronously with the dispatch of your action. Your reducer has executed by the time the <code>dispatch</code> call returns.</p> <p>However, React isn't Redux. Redux tells React-Redux's wrapper component that the state has changed. This also happens before <code>dispatch</code> returns.</p...
@ng-bootstrap NgbDatepicker met "Can't bind to 'ngModel' since it isn't a known property of 'ngb-datepicker'" <p>I use <strong>@ng-bootstrap/ng-bootstrap</strong> and <strong>Angular2-cli</strong></p> <p>with NgbDatepicker met errs :</p> <p>NgModule:</p> <pre><code>@NgModule({ imports: [CommonModule,NgbModule.forR...
<p>You are missing FormsModule. Try importing like this-</p> <pre><code>import {FormsModule} from '@angular/forms'; </code></pre> <p>and use it in AppModule like this-</p> <pre><code>@NgModule({ imports: [ BrowserModule, FormsModule, NgbModule ], </code></pre> <p>You can use ngbDatepicker like this too-</p> <pr...
Convert gridview row values to string <p>If i have grid view that has the following data</p> <pre><code>TechnicianID FirstName LastName 1 yasser jon 2 ali kamal </code></pre> <p>How can convert these grid row values into string in this below format</p> <pre><code>yasser jon , ali kam...
<p>You can use <code>Foreach</code> loop on rows in your <code>DataGridView</code> and get values. This sample show how you can resolve your problem. </p> <pre><code> string yourString = String.Empty; foreach (GridViewRow rowDatos in this.gridtechnicians.Rows) { if (rowDatos.RowType == DataControlRowType...
ORA-00923 error: FROM keyword not found where expected <p>When calculating retention on Oracle DB, I wrote this code:</p> <pre><code>select sessions.sessionDate , count(distinct sessions.visitorIdd) as active_users, count(distinct futureactivity.visitorIdd) as retained_users, count(distinct futureactivity.visitorId...
<p>Oracle does not recognize <code>::</code> syntax of Postgres, so it complains of the missing <code>FROM</code> keyword not being found where expected.</p> <p>Use a cast instead:</p> <pre><code>count(distinct futureactivity.visitorIdd) / cast(count(distinct sessions.visitorIdd) as float) as retention </code></pre>
Is there a more Pythonic/elegant way to expand the dimensions of a Numpy Array? <p>What I am trying to do right now is:</p> <pre><code>x = x[:, None, None, None, None, None, None, None, None, None] </code></pre> <p>Basically, I want to expand my Numpy array by 9 dimensions. Or some N number of dimensions wher...
<p>One alternative approach could be with <code>reshaping</code> -</p> <pre><code>x.reshape((-1,) + (1,)*N) # N is no. of dims to be appended </code></pre> <p>So, basically for the <code>None's</code> that correspond to singleton dimensions, we are using a shape of length <code>1</code> along those dims. For the fir...
Restrict Number of downloads by User IP Adrress in PHP <p>I'm building a PHP webpage which has a Button to download an image. I want to restrict unsigned user to download this image 3 times only.</p> <p>I don't want to use neither Session nor Cookies because the user can delete his cookies!</p> <p>I want to use IP, s...
<p>Not all IPs are dynamic, this depends on the ISP. Your problem is identifying the user uniquely, which is impossible to do without requiring users to log in. No matter what you use, IPs, cookies, sessions, client side scripts to do browser fingerprinting or store tokens in the localStorage, a skilled used will alway...
Rotate TextView from left edge instead of from center <p>I need to rotate TextView with image background. Here is my code</p> <pre><code>&lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentLeft="true" a...
<p>Try setting the <a href="https://developer.android.com/reference/android/view/View.html#attr_android:transformPivotX" rel="nofollow">transformPivotX</a> attribute to 0sp.</p> <pre><code> android:transformPivotX="0sp" </code></pre> <p>It's supposed to set the <em>x location of the pivot point around which the v...
Convert RGBA to NRGBA <p>I am trying to return the pixels that have changed and their color. The following func works fine, but it does not give me the 255,255,255 value i require. Is it possible to convert it to the format required?</p> <p>I already looked at the documentation here -> <a href="https://golang.org/pkg/...
<p>Do you mean this? I did other refactors, your code seemed needlessly complex. </p> <p>I haven't tested this, didn't test images. </p> <pre><code>// Pixels are pixels. type Pixel struct { x, y int color color.NRGBA } func diffImages(imgOne image.RGBA, imgTwo image.RGBA) []Pixel { var pixels []Pixel ...