input
stringlengths
51
42.3k
output
stringlengths
18
55k
LINQ to Entities does not recognize the method <p>Overview: In CompletedQuestions table, UserId corresponds to the user which completed that question. Id property corresponds to one of the questions in the Questions table. I know, i didn't specify relationships properly. But i'm not very experienced. I just want to fin...
<p>Entity framework/linq2sql works by converting your compiled C#/IL into SQL. It can only convert methods it knows. The error is telling you that LastOrDefault isn't one of those.</p> <p>You can fix this by putting .ToList() before LastOrDefault, which takes it away from the sql-converter into vanilla C# and you ge...
Make IDE-wide configuration changes in Eclipse <p>I have been working on some GUI-related projects in Eclipse CDT. They always require me a specific command line pattern (Project > GCC C Linker) in order to load the libraries properly:</p> <p><a href="http://i.stack.imgur.com/qrpiU.png" rel="nofollow"><img src="http:/...
<p>IMHO it is not possible. See in <code>Windows &gt; Preferences &gt; C/C++ Build &gt; Setttings</code> these options were not provided.</p> <p>So all these options are specific to a project. Means you can have different options for different projects.</p>
Folder Subdirectory "Table of contents" listing <p>I have zero scripting/coding experience.</p> <p>My objective is this:</p> <p>To create a script (VBS, Powershell, CMD.bat) that will dynamically create a table of contents of a Flash Drive.</p> <p>This flash drive will be used in multiple machines, so the drive lett...
<p><strong>Dir2Html.vbs</strong> generate a list of files and folders in HTML with tree :</p> <pre><code>Option Explicit Dim oFilesys,oFiletxt,Path,Ws,SourceImgFolder,StartTime,MsgTitre,DurationTime,objFolder,CheminDossier,Dossier,Copyright Dim SizeKo,SizeMo,SizeGo,objShell,size,Sig,OutFile,MsgAttente,oExec,Temp Co...
Having issues overloading "+,-,*" operators for vectors- "no match for operator..." <p>I'm attempting to overload the basic arithmetic operators for vectors. The idea is to create a calculator that adds, subtracts, and multiplies very long numbers (e.g. with a length of 4000). When I add two vectors, I want my program...
<p>Your code doesn't compile because <code>friend</code> declarations only make the name available to <a href="http://en.cppreference.com/w/cpp/language/adl" rel="nofollow">argument-dependent lookup</a>.</p> <p>Since the arguments are in <code>std</code>, then only <code>std</code> is searched for operators. Your fun...
Altering dictionaries/keys in Python <p>I have ran the code below in Python to generate a list of words and their count from a text file. How would I go about filtering out words from my "frequency_list" variable that only have a count of 1? </p> <p>In addition, how would I export the print statement loop at the botto...
<p>For the first part - you can use dict comprehension:</p> <p><code>frequency = {k:v for k,v in frequency.items() if v&gt;1}</code></p>
will_paginate "breaks" query result <p>I have a query which shows 3566 results what is ok. When I use paginate on it, result is 18 but in console I see that query which it runs is ok</p> <p>this is my controller</p> <pre><code> def listcontractors @listcons = Contract.paginate(:page =&gt; params[:page], :per_page =&...
<p>thanks to gmcnaughton I created this solution</p> <pre><code>ids = Contractor.order("name").pluck(:id) @listcons = ids.paginate(:page =&gt; params[:page], :per_page =&gt; 50) @groupedcons = Contractor.joins(:contracts) .where(id: @listcons) .select("contractors.id,name,ico,city,country,count(resultinfo_...
JSX - load an image <p>I'm playing with reactjs and am trying to change the image on click. There seems to be a problem with finding the images.</p> <p>The piece of code is:</p> <pre><code>render() { const text = this.state.liked ? 'holes' : 'emilia'; return ( &lt;div className={text} onClick={this.hand...
<p>As you're writing this using ES6, one way to do what you're asking would be to use string literals.</p> <pre><code>&lt;img src={`images/${text}.jpg`} /&gt; </code></pre> <p>You could also use string concatenation, but I think the above method is the most readable, and follows closely with what you've already writt...
Writing a conditional statement <p>I am a student learning Java and am stuck on the last part of a homework problem. I need to write a conditional statement that prints whether the roll of the dice was a Yahtzee or not (all five dice are equal to one another). I cannot figure out how to do this since I used ints and no...
<p>If you use just <code>&amp;</code>, that is the bitwise AND, therefore it compares the bits of all the numbers. What you want is <code>&amp;&amp;</code>, which is logical AND:</p> <pre><code>if(die1 == die2 &amp;&amp; die2 == die3 &amp;&amp; die3 == die4 &amp;&amp; die4 == die5) { // Something here... } </code>...
Why do we use super in ruby when I can inherit without its use? <p>Ok, so I have searched on here for an answer to this question and couldn't find what I was after (in exact terms) so I'm gonna be slightly greedy and ask for some of the communities time. I hope to make my question as applicable as possible. </p> <p>So...
<p>Using <code>super</code> lets a class override a method that it inherits from its parent and customize it.</p> <p>For instance, in your example, <code>Dog</code> and <code>Cat</code> inherit <code>#initialize</code> from <code>Animal</code> - but what if we wanted some special logic for <code>Dog</code>?</p> <pre>...
Runtime restart application in visual studio debug mode <p>I use the following code to restart my console application:</p> <pre><code>System.Diagnostics.Process.Start(Environment.GetCommandLineArgs()[0]); Environment.Exit(0); </code></pre> <p>This works just fine when I start it directly from its built executable. Bu...
<p>1) In project properties, disable "Visual Studio Hosting Process". Then no "*.vshost.exe" will be used. 2) If you call <a href="https://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.break(v=vs.110).aspx" rel="nofollow">System.Diagnostics.Debugger.Break()</a>, the debugger selection dialog will be show...
Z3Py: constraint of not equal tuples <p>I've got bunch of Bools:</p> <pre><code>a=Bool('a') ... z=Bool('z') </code></pre> <p>How to pack some of these bools to tuples and then to add constraint about their non-equality?</p> <p>I tried:</p> <pre><code>tuple1=(a,b,c,d) tuple2=(e,f,g,h) # so far so good s=Solver() s.a...
<p>The python tuple does not get reflected to Z3 tuples. You can create a tuple type for Z3 in the following wayL</p> <pre><code>from z3 import * a,b,c,d,e,f,g,h = Ints('a b c d e f g h') tuple = Datatype('tuple') tuple.declare('tuple',('1', IntSort()), ('2', IntSort()), ('3', IntSort()), ('4', IntSort())) tuple = tu...
Python Loop To Print Asterisks Based on User Input <p>I'm trying to create a python program to print a certain number of asterisks based on user input. My code is below</p> <pre><code>num_stars = 3 num_printed = 0 while num_printed &lt;= num_stars: print('*') </code></pre> <p>The output is an infinite loop. I wa...
<p>The issue is that num_printed is not getting incremented.</p> <p>In the while loop, add <code>num_printed += 1</code>, and change the condition to <code>num_printed &lt; num_stars</code>, otherwise you will be printing 4 stars:</p> <pre><code>num_stars = 3 num_printed = 0 while num_printed &lt; num_stars: pri...
Please describe how to use a priority queue to implement a queue <p>I don't understand this question....</p> <p>Please describe how to use a priority queue to implement a queue.</p> <p>Do I simply assign the priority as the time of entrance? and since a queue is fifo I would min prioritize so the oldest time comes fi...
<p>Using the time as the priority key is one way to do it. Be careful, though, to use a time that doesn't change externally. You wouldn't want to be using local time when it comes time to set your clocks back an hour during the Daylight Saving Time switch.</p> <p>You could also start an integer counter at 0, and incre...
2 different layouts for the type of each row <p>I know that there are similar questions, but i couldn't really understand, so i decided to ask again.</p> <p>I am trying to do something similar to a chat, so in the list view there would be 2 types of rows, the ones of the received items and the ones of the sent items. ...
<p>You need to use getItemViewType because of recycling. Otherwise you can try to recycle a received item into a non-received view, which will screw things up royally. However it is ok for getItemViewType to just return 0 or 1 based on that boolean. It doesn't need to be very complicated for 2 view types.</p>
Select.. Into MS Access to SQL Server equivalent <p>Lets for arguments sake say I have the following <strong>query</strong> in <strong>MS Access</strong></p> <pre><code>select id, value into newtable from oldtable </code></pre> <p>I need to replicate that in <strong>sql server</strong> stored procedure Would it be ...
<p>If the table doesn't exist, you would do:</p> <pre><code>select id, value into newtable from oldtable; </code></pre> <p>If the table does exist:</p> <pre><code>drop table newtable; select id, value into newtable from oldtable; </code></pre>
I cant install my published app script in the chrome web store <p>I have a working apps script that works perfectly when I run it as a web app 'Test' and 'current web url'. I uploaded it to the Chrome Web Store and everything looks good. I then try to install it and I get an error.</p> <p>Could not add application "...
<p>You can't install it because you already have a version of it installed. The Web App version of it. So when it tries to install it, its conflicting with your google-app-script version of the App you created.</p>
Recursion clarification <p>I just wanted to make sure that I was completely solid on recursion. I have used it in a bunch of applications, but realized that when someone asked me to define it (a newer programmer asked this), I was a bit shaky on the definition and had a bit of trouble explaining it. I just wanted to re...
<p>You're on the right track. I would break this up into pieces:</p> <ol> <li>Definition: By dictionary definition, recursion is a a process calling itself. This call is usually direct, as in your example, but can also be indirect: f1 and f2 call each other, but not themselves.</li> <li>Example: Just as you did ... ...
MYSQL choosing continuous record has conditions <p>For instance</p> <pre><code>No Condition 1 NULL 2 O 3 NULL 4 NULL 5 NULL 6 NULL 7 NULL 8 O 9 NULL 10 NULL 11 ...
<p>Assuming the <code>no</code> is consecutive with no gaps -- as in your sample data -- then you can use <code>join</code>:</p> <pre><code>select t.no from t join t1 on t1.no = t.no + 1 join t2 on t2.no = t.no + 2 where t.condition is null and t1.condition is null and t2.condition is n...
submit and fetch data from database in modal with one click without page reload using ajax <p>[i enter image you can check demo]I'm developing a modal dialog that enables the user to add skills. The modal contains three fields: two input fields and one output field. When the user adds a skill, I want to update the outp...
<p>in <strong>routes.php</strong></p> <pre><code>//skill Route::get('/skill','SkillController@viewskill'); Route::post('/addSkills','SkillController@addskill'); </code></pre> <p><strong>in SkillController.php</strong> </p> <pre><code>&lt;?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Ht...
Deleting image element on HTML5 Canvas with mouse event? <p>I have a canvas where I can drag and resize image element inside the canvas, but I'm not sure how I can be able to delete it? I am creating a wireframing like tool where user can drag things around and resize it on the canvas, so I want it to be able to delete...
<p>Hard to work out what you are doing or how you want to remove the sprite. So i will just provide a function that will safely remove the sprite referance from the array <code>visibleElements</code> I do not know how you intend to identify the sprite so I have made the function able to delete by <code>index</code>, <c...
How do I crawl a website written in JSP (Java Server Pages) using Perl Script? <p>I have here this website:<a href="https://www.connect2nse.com/iislNet/UserFolder.jsp" rel="nofollow">https://www.connect2nse.com/iislNet/UserFolder.jsp</a> Firstly i tried using WWW::Mechanize, but it doesn't seem to work. WWW::Mechanize ...
<p>As far as the client is concerned, JavaServer Pages is identical to PHP, Perl, or even static HTML files. The result is a page of HTML that can be rendered and displayed, and the source of the data isn't the reason for <code>WWW::Mechanize</code> failing to do what you want</p> <p><strong><em>Doesn't work</em></str...
How to link rand() to a while loop condition? <p>I'm making a simple coin flip game and i'm not sure how to get it to print out a result if that makes sense. basically I'm not sure what to make the while condition to see if the answer is true or false. here is what i have so far. any help would be appreciated </p> <pr...
<p>Here goes-</p> <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;ctime&gt; using namespace std; int main() { srand(static_cast&lt;unsigned int&gt;(time(0))); char answer; int bank=10; char guess; char result; cout &lt;&lt; "Welcome to the coin flip game. It cost a ...
Is this implementation of insertion in array incorrect? <p>I was reading a tutorial at tutorialspoint.com for <a href="https://www.tutorialspoint.com/data_structures_algorithms/array_data_structure.htm" rel="nofollow" title="data structures">Data Structures</a>. In the section about the array data structure is this im...
<blockquote> <p>Is'nt accesing an element outside of the bounds of an array undefined behaviour</p> </blockquote> <p>Yes. Good spotting.</p> <blockquote> <p>and therefore very bad practice?</p> </blockquote> <p>I can't argue with that, except maybe to say that it's a little understated. A program that exhibits...
Tag Div impossible to locate the next element, via jquery <p>Friends, I have the following question:</p> <p>The following code below finds the next element from the clicked select: </p> <pre><code>&lt;div class="caixa-dependentes2"&gt; &lt;select name="campo0[1]" id="campo0[1]" class="form-control aa" required&gt; ...
<p>You can find next <code>.bb</code> element this way (not impossible, but EZ with jQuery):</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.caixa-dependentes2').on('ch...
Program that removes duplicate entries from an array does not remove certain entries <p>I've written the following short program that prompts a user to construct an ArrayList of integers and then displays that same array with duplicates removed. The program works just fine with simple numbers, such as 1, 10, or even 10...
<p>Use for comparing not this <code>numbers.get(i) == numbers.get(i-1)</code> but <code>numbers.get(i).equals(numbers.get(i-1))</code> method.</p> <p>The reason of a such strange behavior is internally JVM has a cache of <code>Integer</code> values from -128..127 (see <code>Integer#valueOf</code> method implementation...
How to create a group from a group in crossfilter/reductio? <p>With the following data:</p> <pre><code>const now = new Date const data = [ { player: 'bob', color: 'blue', date: new Date(+now + 1000) }, { player: 'bill', color: 'green', date: new Date(+now + 2000) }, { player: 'bob', color: 'red', date: new Date(...
<p>I'm not sure if crossfilter is going to help you very much here - it doesn't really consider the order of values, and it certainly doesn't have a way to sort by one key and then bin by another.</p> <p>Here is a fake group that will do close to what you want, by using another dimension for ordering, and a couple of ...
how to store a stream of values returned by console, swift 2.2 <p>How can I store each sample value (heartrate beats per minute) streamed from the console, to store each 'value' of the 'values' and calculate the average in my next function. Using NSUserDefaults is just storing the last value.</p> <pre><code> func up...
<p>It's a little hard to make sense of your question, but I think the problem stems from your use of the term <code>values</code> in your code when this is in fact only one value! If you want to store each value as it arrives, use an array property:</p> <pre><code>var values = [Double]() func updateHeartRate(samples: ...
Timeout expired while running INSERT INTO SQL statement <p>I want to insert data using SQL INSERT INTO statement, but an error Timeout expired occur. Anybody can help me. Thanxs. The code are like this.</p> <pre><code>SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS"].ConnectionStr...
<p>If you got a timeout exception during a query execution, that clearly shows that your C# code managed to pass the query over to the database and the database tried executing the query, but it couldn't complete the execution before the timeout. </p> <p>So here are few troubleshooting steps I would take. </p> <ol> <...
Passing in an array for a Ruby Class <p>I have the following code: </p> <pre><code>class MyGreeting def initialize(name) # Instance variables @name = name end def say_hello name.each do |x| puts "Hello #{x}" end def say_bye name.each do |x| puts "Bye #{x}" end end obj = MyGre...
<p>You've got a few problems here, but the biggest one is that your indentation is completely out of control and needs to be addressed. It's extremely important to keep your code clean and orderly so you can spot mistakes at a glance and so the structure is apparent to anyone working on it. Fixing the indentation shows...
Adding proper permissions to AWS S3 bucket to allow SEO <p>I'm trying to verify my site for SEO purposes with Google using <a href="https://www.google.com/webmasters/tools/home?hl=en" rel="nofollow">https://www.google.com/webmasters/tools/home?hl=en</a>. I am using AWS S3 to host my content, and AWS Cloudfront to serve...
<p>You have three issues.</p> <ul> <li><p>CloudFront will return errors to the browser for 5 minutes after you fix the problem, by default. When the origin server returns an error, <em>usually</em> there is no reason for CloudFront to continually retry. In a case like this, you may want to reconfigure the Error Cach...
Best way to "mangle" (represent) the memory <p>I would like to know what would be the best way to map/represent the memory. I mean, how to describe, for example, a structure with all its field to be serialized. </p> <p>I am creating a RPC library that will create the client and server using the dwarf debug data, so i ...
<p>I use the "cereal" library for serialization (<a href="http://uscilab.github.io/cereal/" rel="nofollow">http://uscilab.github.io/cereal/</a>)</p> <p>Alternatives include Google's Protocol Buffers, although I found it too difficult to integrate for my comparably simple serialization tasks.</p> <p>For communication ...
In python how can I add a special case to a regex function? <p>Say for example I want to remove the following strings from a string: </p> <pre><code>remove = ['\\u266a','\\n'] </code></pre> <p>And I have regex like this:</p> <pre><code>string = re.sub('[^A-Za-z0-9]+', '', string) </code></pre> <p>How can I add "rem...
<p>you can always remove them before doing the regex like so:</p> <pre><code>remove = ['\\u266a','\\n'] for substr in remove: string = string.replace(substr, '') </code></pre>
Return id of row that has duplicate data <p>I am needing to get the row id of rows which have duplicate</p> <pre><code>Select Name from table1 group by Name having count(1) &gt; 1 </code></pre> <p>table1</p> <pre><code>ID | Name | ClientID ---------------------------- 01 | John | 01 02 | Sam | 01 03 | Su...
<p>Use a window function:</p> <pre><code>select t1.* from (select t1.*, count(*) over (partition by name) as cnt from table1 t1 ) t1 where cnt &gt; 1; </code></pre> <p>The <code>count(*) over (partition by name)</code> counts the number of rows for each name. However, it does this by appending the count o...
Segmentation fault (core dumped) <p>I'm working on a code in my class and it looks good, but when I go to compile it, it compiles, but when I enter a string, I get the error: Segmentation fault (core dumped). My goal is to be able to sort strings alphabetically. Below is my code and any help is appreciated:</p> <pre><...
<p>Try debugging. Use gdb under terminal and set a break point at main function and step over each instruction like this</p> <pre><code>gcc -g filename.c gdb a.out </code></pre> <p>..................</p> <p>Now , set the breakpoint</p> <pre><code>break main </code></pre> <p>then ... Run your program by typing run ...
How to recursively go through list of lists and combine the lists in different ways <p>This is a follow-up to <a href="https://stackoverflow.com/questions/39650598/problems-with-recursion-trying-to-learn-scheme">this question</a>.</p> <p>I have lists or "records" that are appended together into an empty list, that are...
<p>The main problem is that you rely on <code>fetchRecord</code> which not only does not work, but isn't valid Scheme: the <code>else</code> clause should have only 1 argument, not 3.</p> <p>And you shouldn't be surprised that a function that would use recursion to handle the <code>rest</code> of a list doesn't handle...
Bash - get notification from nmap output if out of IP range <p>I'm trying to create a script to give me a notification of specific conditions of an nmap scan on my network. If I use this command in the script:</p> <pre><code>nmap -n -sP 192.168.15.0/24 | awk '/^Nmap scan/{IP=$5};/^MAC/{print IP,$3};{next}' </code></pr...
<p>Suppose that nmap's output is:</p> <pre><code>Nmap scan report for 192.168.15.117 MAC : 00:11:22:33:44:55 Nmap scan report for 192.168.15.125 MAC : 0a:1b:2c:3d:4e:5f </code></pre> <p>To print out <code>Beyond</code> whenever the IP range is 124 or beyond:</p> <pre><code>$ nmap -n -sP 192.168.15.0/24 | awk '/^Nmap...
Delete folder on multiple usb drives VBS <p>I am looking to delete folder on multiple usb driver at the same time. </p> <pre><code>sDeleteFolder = "\Test" Set oFS = CreateObject("Scripting.FileSystemObject") Set dUSBKeys = ScanForUSBKeys() For Each oUSBKey in dUSBKeys.Keys If Left(oUSBKey, 1) = "\" Then sKe...
<ol> <li>Study the docs for <a href="https://msdn.microsoft.com/en-us/library/ca0at0xh(v=vs.84).aspx" rel="nofollow">.DeleteFolder</a></li> <li>Make sure you pass the full path (not just "\test") and the appropriate boolean (not a string like oUSBKey) when you call the Sub</li> <li>Use <a href="https://msdn.microsoft.c...
What will happen if I define more than one parameter but only pass in one parameter? <p>The function was defined as follow, but I don't know how the function will work if I pass in only one parameter and ignore the order.</p> <pre><code>function setCookie(name,value,path,expires){ value = escape(value); if(!e...
<p>The rest will be <code>undefined</code>. </p> <p>This would have been a good thing to try out on your own before asking. You could have written a test program and tested it in probably the same amount of time it took you to write the question. </p>
MCV Web application with On-Premise ADFS Authentication <p>really hope that I can get some pointers with this before I go wasting too much time. In truth, I'm not even one hundred percent sure where I need to be asking this. I'm dealing with a whole heap of technologies I've had little to know experience with. Histo...
<p>My 2-cent:</p> <ol> <li>There will be a learning curve, but if all the users are stored in AD, using ADFS will give you some advantages such as SSO, federation against other providers if you ever need it later on.</li> <li>Using self-signed certificates during dev/test is fine. You can turn off certificate revocati...
How can I find an explicit solution to this equation? <p>In the field in which I work there's a kind of score called a SEDI:</p> <p><a href="http://i.stack.imgur.com/OvFlq.png" rel="nofollow"><img src="http://i.stack.imgur.com/OvFlq.png" alt="SEDI"></a></p> <p>I've been asked to solve this equation for F. I've been i...
<p>Or there is an analytical solution that programs have trouble finding. I tried to do it in Mathematica and it didn't want to solve the equation. However, I was able to solve it by hand. If I didn't make an error, there are three solution. However, one of them 0 and does not fit the original equation. Therefore, the...
Cant find inserted values in C++ map using struct as key <p>I'm trying to use a map to store map information using coordinates x,y as key. I cant iterate properly trough this map using the auto iterator or map.find(). It just wont return me the correct map value. I'm using C++14, here is my chunk of code:</p> <pre><c...
<p>Your <code>operator &lt;</code> is completely messed up.</p> <p>You are saying that A is less than B if its X coordinate is equal and its Y coordinate is equal. So (1,1) &lt; (2,2) is false, but (1,1) &lt; (1,1) is true. No wonder the map can't manage to find the right entry.</p> <p>In particular:</p> <ul> <li>si...
Resize the image to fit the background <p>I have used this method to resize the image</p> <pre><code>extension UIColor { static func imageWithBackgroundColor(image: UIImage, bgColor: UIColor) -&gt; UIColor { let size = CGSize(width: 70, height: 70) UIGraphicsBeginImageContextWithOptions(size, fals...
<pre><code>- (UIImage *)resizeImage:(UIImage *)image withMaxDimension:(CGFloat)maxDimension { if (fmax(image.size.width, image.size.height) &lt;= maxDimension) { return image; } CGFloat aspect = image.size.width / image.size.height; CGSize newSize; if (image.size.width &gt; image.size.height) { newSize = ...
What is the difference between Selenium's mouseMove() and an actual mouse movement? <p>Let's say I have element A and an element B. I've fired up Selenium or PhantomJS, which also has the capability to move the mouse via coordinate sets. </p> <p>I locate the shape of element A (a link) and element B (a submit button)....
<p>From my experience if you track the mouse from JS and a bot simply uses selenium to <strong>move</strong> the mouse pointer without a "sophisticated movement curves" <strong>the answer is yes</strong>. </p> <p><strong>But,</strong></p> <p>if the 'bot' is specifically designed to create a "sophisticated movement cu...
Concatenate multiple rows of Column B until column A contains X then, loop again <p><a href="http://i.stack.imgur.com/cWTOB.png" rel="nofollow">enter image description here</a></p> <p>I need to do this in excel and I do know how to do this with python etc, but it has to be done in excel either VBA or formula (best opt...
<p>If you can use column D (as an intermediate step) as well as C, set C2 to</p> <pre><code>=IF(A2="W",D2,"") </code></pre> <p>and set D2 to </p> <pre><code>=B2&amp;IF(A3="W","",";;"&amp;D3) </code></pre> <p>then copy column C and D down as far as necessary.</p>
php - How to show values in array randomly <p>I have an array with values,</p> <pre><code>$member[1] = "John"; $member[2] = "Mary"; $member[3] = "Berry"; $member[4] = "James"; $member[5] = "Lincoln"; </code></pre> <p>I can show them randomly using</p> <pre><code>echo $member[rand(1,5)]; echo $member[rand(1,5)]; echo...
<p>If you want to consume the entire array at random order use <a href="http://php.net/shuffle" rel="nofollow"><code>shuffle</code></a>.</p> <pre><code>shuffle($member); foreach($member as $memberName) { echo $memberName; } </code></pre> <p>If you want to select one or more elements from the array at random use ...
Postgres order of combined index <p>I have a table contains 10M lines data</p> <pre><code>CREATE TABLE log_info ( id serial NOT NULL, created_date date, # date in month - max 30-31 distinct value dept_id integer, # max 50 distinct value group_id integer, # 10000 distinct value ....... ) </code></pre> <p>Mos...
<p>Which order is best depends on what kind of queries are you planning to run. Consider the following examples:</p> <pre><code>WHERE created_date=? AND dept_id=? WHERE created_date=? AND dept_id&gt;=? WHERE created_date=? AND dept_id=? AND group_id BETWEEN ? AND ? </code></pre> <p>For all of them, the index <code>(c...
Reading .txt File Input not Working <p>So I am a beginner to C, and I am trying to open and read a file, storing each element of the file in an array. The following code seems like it should work in practice, but when the output gives me </p> <p><code>50 2500</code></p> <p>for whatever reason. If anybody could offer ...
<p>When you use fgets(), you're pulling strings(character arrays) from the file with the newline char as the delimiter. fscanf() would be more appropriate for pulling ints from files.</p> <p>The reason your program prints 50 is because the value of magicSquareArray[0] after the while loop is '2', not 2, and the ascii ...
Bootstrap 3 - Equal Size Image Gallery <p>I display images in my web application using bootstrap grid. Like this:</p> <pre><code>&lt;div class="row"&gt; &lt;div class="col-xs-4"&gt; &lt;img class="img-responsive" src="https://images.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png"&gt; &l...
<p>Give some class to the <strong>img tag</strong> and set their width and height to whatever ratio you want. It will fix the image size and responsiveness OF THE IMAGE WILL ALSO BE MAINTAINED.</p> <pre><code>&lt;img class="img-responsive center-block size" src="https://s-media-cache-ak0.pinimg.com/564x/d0/24/ae/d024a...
More than 3 items per sub items GridView Android <p>I want to display the data from content provider in gridview more than 3 sub items or line </p> <p>here is my java source code</p> <pre><code>@Override public void onLoadFinished(Loader&lt;Cursor&gt; arg0, Cursor cursor) { players.clear(); // First Check if...
<p>You need make height of <code>GridView</code> is <code>match_parent/wrap_content</code> (based on your layout), don't fix size 420dp</p>
Plot multivariate data in Python <p>I have a data of human activity performing various leg movements. The data consists of X, Y, Z gyro sensor orientation. Data looks like below:</p> <p>Activity 1:</p> <p>timestamp, X rad/sec, y rad/sec, z rad/sec</p> <p>1474242172.0203, -0.440601, -2.37...
<p>in python, you could use <a href="http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html" rel="nofollow">pylab</a> to plot in 3d using something like: <code>plt.plot(x_vals_list,y_vals_list,z_vals_list)</code> . If you have more than 3 dimensions you can use <a href="http://scikit-learn.org/stable/modules/generate...
MATLAB: Why is the anoynomous function missing `(t,y)` here? <pre><code>function yprime=example1(t , y) yprime=cos(t)./(2*y-2); Then type &gt;&gt; [t,y] =ode45(@example1, [0, 4*pi],3); &gt;&gt; plot(t , y) </code></pre> <p>On the line <code>ode45(@example...)</code>. Why isn't it <code>ode(@45(t,y)example...)</code>?...
<p>The <code>@</code> operator can create two (maybe more) different <a href="http://www.mathworks.com/help/matlab/matlab_prog/creating-a-function-handle.html" rel="nofollow">types of handles</a>: simple and anonymous. A simple function handle is one that directly references a function file and has no other levels of ...
What is the most efficient way to iterate numeric string in Lua? <p>I have a string which consists of numbers:</p> <pre><code>str = "1234567892" </code></pre> <p>And I want to iterate individual characters in it and get indices of specific numbers (for example, "2"). As I've learned, I can use <code>gmatch</code> and...
<p>Simply loop over the string! You're overcomplicating it :)</p> <pre><code>local indices = {[0]={},{},{},{},{},{},{},{},{},{}} --Remove [0] = {}, if there's no chance of a 0 appearing in your string :) local str = "26842170434179427" local container for i = 1,#str do container = indices[str:sub(i, i)] conta...
Understanding Angular data binding <p>While reading <a href="https://angular.io/docs/ts/latest/guide/architecture.html" rel="nofollow">Angular 2 documentation</a>, I came across this (emphasis mine)</p> <blockquote> <p>Angular processes all data bindings <strong><em>once per JavaScript event cycle</em></strong>, fro...
<p>I think it refers to any change or event triggered(Like changing input field ).Once any change occurs it starts from top to bottom. you can learn more here <a href="https://vsavkin.com/change-detection-in-angular-2-4f216b855d4c#.a3ggxt9hl" rel="nofollow">https://vsavkin.com/change-detection-in-angular-2-4f216b855d4...
Make outbound call using Plivo sub account <p>I am trying use Plivo android SDK to make outbound call. I am following android project sample from plivo documentation (<a href="https://www.plivo.com/docs/getting-started/android/plivo-outbound/" rel="nofollow">https://www.plivo.com/docs/getting-started/android/plivo-outb...
<p>Plivo Sales Engineer here.</p> <p>To make outbound calls from a sub account, you should attach the Plivo application (linked to your endpoint) to a sub account. To view the debug logs of a call made from a particular sub account, you should select the sub account name from the drop down <a href="https://manage.pliv...
USB HID difference between "Get Input Report" and "Input report" <p>I'm implementing a custom HID device that has the following interface:</p> <pre><code>0x06, 0xA0, 0xFF, // Usage Page (Vendor Defined 0xFFA0) 0x09, 0x01, // Usage (0x01) 0xA1, 0x01, // Collection (Application) 0x85, 0x01, // R...
<p>Have a look at <a href="http://www.usb.org/developers/hidpage/HID1_11.pdf" rel="nofollow">USB HID v1.1</a>, there is definition for Get_Report request on page 51:</p> <blockquote> <p>This request is useful at initialization time for absolute items and for determining the state of feature items. This request is no...
Redshift - Simplify Query Plan <p>I have two tables in Redshift that I am trying to do a join on to get zip code demographics based on a users normalized ip address. By normalized address, I mean that it is concerted to a uniform length string that has the periods stripped out and can be directly compared to one anothe...
<p>I'm not sure why you're using the <code>with</code> statement here. Did you read the documentation? I guess what's happening is, that it's executing the query in the with block for every entry in the visitor_detail table and then has to broadcast this to the other node <code>XN Nested Loop DS_BCAST_INNER</code>. Als...
Displaying UTC datetime from database in local time when it has no offset <p>For one of the records in my database we store two timestamps which represent the same moment in time. </p> <p>One which is UTC such as this <strong>'2016-09-23 11:43:34.0000000'</strong></p> <p>And another that has a local time to the devi...
<p>use <code>var date =new GetUTCDate(//any date);</code></p> <p>you will get date in UTC formate </p>
Highlighting individual axis labels in bold using ggplot2 <p>I want to highlight individual axis labels in bold. I am aware of this <a href="http://stackoverflow.com/a/30036353/4308815">answer</a> by @MrFlick but I can't figure out how to do this <strong>a)</strong> for more than one item, and <strong>b)</strong> wheth...
<p>Here's a generic method to create the emboldening vector:</p> <pre><code>colorado &lt;- function(src, boulder) { if (!is.factor(src)) src &lt;- factor(src) # make sure it's a factor src_levels &lt;- levels(src) # retrieve the levels in their order brave &lt;- ...
FCM Web Push Notification (Chrome) ONLY for Desktop <p>I am new in web developing and is unfamiliar with lots of stuff. So I have been trying to implement push-notification for website Google Chrome. At first I implemented push notification from GCM (<a href="https://developers.google.com/web/fundamentals/getting-start...
<blockquote> <p>FCM and Firebase RealTime Database are two different products out of a group of products under same header tagname "Firebase". </p> </blockquote> <p>Anwser to first question:</p> <ul> <li>Details of subscribers Using FCM are not added to firebase database. So your database quota is not affected at a...
How to sort CSV column data <p>I have a weird column of start dates that I have to sort according to earliest to latest.</p> <p>However, I don't know how to interpret the current numbers. </p> <p>Here are a few examples: </p> <pre><code>1365985819 1441584686 1397661886 1472340552 </code></pre> <p>Why are the dates ...
<p>They look like Unix time stamps. You can convert them to a readable format. before putting them into a DB or just use them that way and convert on viewing. Sorting smallest to largest will give you older to newer.</p> <p>To convert them with Ruby use <code>Time.at</code>:</p> <pre><code>Time.at(1441584686) =&gt;...
Integrate radio button into table PHP / Yii 2 <p>how can i integrate a radio button into a table? I have this modal where I need to put a radio button on each table, the radio button will contain some kind of value to differentiate the tables. Here is an output of the table that will be integrated with a radio button.<...
<p>You can actually use <a href="http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html" rel="nofollow">GridView</a> for table. You may get less work to do in future because it automatically generates necessary divs and boostrap style. But let's say you're doing this and you want to use radio button. Now it a littl...
Correct datatype to use for Type mappings? <p>I'd like to implement a basic mapping system similar to AutoMapper, but all explicit mappings, no convention-based mappings.</p> <p>To do this I've written a class that is supposed to maintain a register of "mapping" functions and look them up on demand in order to map one...
<p>When I try to run your above code, I get the result I expect:</p> <pre><code>Mapper.Register&lt;string, Regex&gt;(s =&gt; new Regex("not using the given string")); Mapper.Register&lt;string, Regex&gt;(s =&gt; new Regex(s)); var regex = Mapper.Map&lt;string, Regex&gt;(@"\w*"); // regex is now the Regex object instan...
Can an ASP.NET app and Console app work off of the same class library DLLs? <p>My ASP.NET 4.5 application references a class library project. All the DLLs are in the normal place - the BIN folder of the website. I'd like to create a Console app that references the same class library project. I can obviously deploy t...
<blockquote> <p>it would also be possible to put the Console App EXE in the website BIN folder and have both the ASP.NET website and the Console App running off of the same DLLs in the same physical folder?</p> </blockquote> <p>You can probably do it, but I wouldn't. There is not normally any issue at all in sharin...
Queryset filter with three-deep nested models (multiple one-to-many relationships) <p>I'm trying to figure out how to filter some queries in Django with my models setup something like this:</p> <pre><code>class Team(models.Model): name = models.CharField() class TeamPosition(models.Model): description = model...
<p><strike>One question before answering: Is the line <code>carmodel = models.ForeignKey(Model)</code> ok? or should it be <code>ForeignKey(CarModel)</code> instead?</strike></p> <p>Try this query (this should give you all CarCompany objects whose CarModel's ModelYear's <code>last_availability</code> date is in the fu...
Separate IP Range to Separate IPs <p>I have a list of customers in a tab-delimited file, each with a corresponding set of IP ranges. However, I am uploading them to a database that does not accept a range in the third octet. That is, an IP of 24.53.241.150-185 is acceptable, but 24.53.150-185.241 is not. </p> <p>In or...
<p>I have figured this out using Ruby code, and applied it after saving the Excel file as a tab-delimited TXT file.</p> <pre><code> def expand_lines(line) id, inst, ip = line.split("\t") ip_compontents = ip.split('.') if ip_compontents[2] =~ /(\d+)-(\d+)/ $1.to_i.upto($2.to_i).map do |i| new_ip = [*ip...
Unable to find layout for following design <p>All buttons text are dynamically generated from the server. I have tried all the basic given layouts to form this design but unable to get desired result. Please help me , how can i solve this design implementation in android.</p> <p><a href="http://i.stack.imgur.com/hnXKq...
<p>The widget you need is AutoResize TextView</p> <p>Try below class, it may help you</p> <pre><code>import android.annotation.TargetApi; import android.content.Context; import android.content.res.Resources; import android.graphics.RectF; import android.os.Build; import android.text.Layout.Alignment; import android.t...
The multi-part identifier "publicdb.dbo.TBL_ITEM.FLD_PID" could not be bound <p>I try to insert data from 1 table to other table (all difference database) I got some error like this "The multi-part identifier "publicdb.dbo.TBL_ITEM.FLD_PID" could not be bound."</p> <p>I use this command in SQL2005 it work fine. but in...
<p>You can't use something like [publicdb].[dbo].[TBL_ITEM].[FLD_PID] in where clause for field comparison. Put appropriate join condition of table [Z_publicdb].[dbo].[TBL_XWWL_ITEM] with [publicdb].[dbo].[TBL_ITEM] and you will get proper insertion.</p>
How to get total messages sent/received per user in ejabberd? <p>I am trying to get total messages received/sent per user in ejabberd server + also in MUC. Can i get this info in ejabberdctl command ? Or any module available ? </p>
<p>No, you do not have that info available. You would have to write a custom module register the hook you would like to track, for example user_send_packet, user_receive_packet. See for reference: <a href="https://docs.ejabberd.im/developer/hooks/" rel="nofollow">https://docs.ejabberd.im/developer/hooks/</a></p> <p>Fr...
Excel code, my 'add data' button is not working <p>I am new to coding and have got this far by googling. I am hoping it is a fairly simple change in the code. I have a form which shows what I want it to. My close button works however my 'add data' button doesn't work. As in it isn't populating the information I ent...
<p>This line should never validate:</p> <p><code>If Trim(Me.textbox_lineno.Value) = " " Then</code></p> <p>You never increment your column assignments. If I know that an Object exists then I will usually opt for a <code>With Object</code> statement over using another variable.</p> <p>I extracted the code for cleari...
Creating Databases in SQLite <p>We were asked to create a database in sqlite3 and then create a table in it. I used this command: </p> <pre><code> $sqlite3 me5.db </code></pre> <p>and tried to create a table with this statement: </p> <pre><code>CREATE TABLE me5.petID(pet id PRIMARY KEY int(3), pet name varchar(10),...
<p>try this</p> <pre><code>CREATE TABLE petID(pet_id int(3) PRIMARY KEY, pet_name varchar(10), pet_type varchar(10), pet_age int(3)); </code></pre> <ol> <li>you dont have to specify the database name because you're already using it after the command <code>sqlite3 me5.db</code>.</li> <li>you have spaces in the names o...
Xcode 8.0 Beta 3 vs. Xcode 8.0 <p>I am not sure what the difference is between the Xcode 8.0 Beta 3 I have been using and the regular Xcode 8.0 that is now available to download but I have been running fine in the Beta but if I open my project in the regular version I get like 50 errors. I tells me to remove the () aft...
<p>This is normal.</p> <p>There were many changes in the Swift APIs during the beta (testing) phase.</p> <p>Throw away the beta and use only the final release.</p>
How to run NSTimer more than 180sec in background? <p>I had integrated pedometer and i am doing some calculation when the app is on background. But after 180sec my application get forcefully terminated by the Apple OS. Is there any way to run timer more than 180sec.</p>
<p>If time is of your concern and want to know exact after a specified interval , i suggest instead of using a timer you register for a local notification with fire date after your desired time interval.</p> <p>If you need to perform a long task in background instead , you have to register it with system calling begin...
Can't load json file <p>I put my html file and json file under the same folder. When I run my code, it can't load the json file. Here is the html file:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-ht...
<p>as @Jaromanda X mentioned in his comment, you are loading json asynchronously so that when you invoke <code>myfunction</code> the value of <code>nodes1</code> is still <code>undefined</code></p> <p>to make it work you should move <code>myfunction</code> invocation to <code>json</code> callback:</p> <pre><code>d3.j...
HTML: Wrap lines of two rows with space reserved for each row on the new line <p>I am attempting to use flexbox or another technology to create a kind of word processor. </p> <p>Lines in the word processor would consist of two rows, and would wrap onto new lines while reserving space for both rows on the new line.</p>...
<p>I can think of a small trick to do this <em>without</em> using anything special such as a <code>flexbox</code>:</p> <ol> <li><p>Absolutely position both the <code>text</code> and <code>topic</code> divs.</p></li> <li><p>Adjust the <code>line-height</code> and offset one of them with <code>margin</code> to create th...
why hashCode() gives different output for same object in java? <p>I have this code</p> <pre><code>class A { public static void main(String reds[]) { A ob=new A(); System.out.println("Object "+ob); System.out.println("HashCode "+ob.hashCode()); } } </code></pre> <p>Output is: <a href="http://i.stack.i...
<p>When you call <code>println()</code> on your object (of type <code>A</code>), it prints <code>getClass().getName() + "@" + Integer.toHexString(hashCode()</code> i.e, it converts hashCode to <em>hexString</em>. If you do the same for your hashCode (when printing), you will get the same value.</p>
What is the easiest way to get a list of the keywords in a string? <p>For example:</p> <pre><code>str = 'abc{text}ghi{num}' </code></pre> <p>I can then do</p> <pre><code>print(str.format(text='def',num=5)) &gt; abcdefghi5 </code></pre> <p>I would like to do something like</p> <pre><code>print(str.keywords) # funct...
<p>Check out the <a href="https://docs.python.org/3.5/library/string.html#string.Formatter" rel="nofollow"><code>string.Formatter</code> class</a>:</p> <pre><code>&gt;&gt;&gt; import string &gt;&gt;&gt; text = 'abc{text}ghi{num}' &gt;&gt;&gt; [t[1] for t in string.Formatter().parse(text)] ['text', 'num'] </code></pre>...
Why the if statement is not accepting bracket-notation instead of dot-notation? <pre><code>var contacts = [ { "firstName": "Akira", "lastName": "Laine", "number": "0543236543", "likes": ["Pizza", "Coding", "Brownie Points"] }, { "firstName": "Harry", "lastName": "Potter", "number": "09943726...
<p>The brackets are for <em>variables</em>. If you want to use them with String literals, you could, but you have to quote them: <code>contacts[i]['firstName']</code>. But unless the property name contains restricted characters (such as another dot or a space), that is just silly.</p> <p>Note that you already used it...
AngularJS external javascript libraries do not run <p>First off I do apologize if this is already answered somewhere.</p> <p>I am having an issue with AngularJS and external libs. For some reason when I attempt to have an external lib preform any sort of visual operation on an element it simply does not run. </p> <p>...
<p>Why don't you try this:</p> <p><a href="https://ruhley.github.io/angular-color-picker/" rel="nofollow">https://ruhley.github.io/angular-color-picker/</a></p> <p>It's fully integrated in angular without dependencies on jQuery.</p>
How to add extension in cakephp url? <p>I want to generate xml link for my cakephp site, www.jegeachi.com. I generated this by xml-sitemaps.com from this online tool I am informed that this xml file should be visible at <a href="http://jegeachi.com/sitemap.xml" rel="nofollow">http://jegeachi.com/sitemap.xml</a>. So I d...
<p>Why not just</p> <pre><code>Router::connect("/sitemap", array('controller' =&gt; 'frontends', 'action' =&gt; 'sitemap')); </code></pre> <p>And then call and link with ext instead.</p> <p>The extension will be added as needed automatically.</p>
C# Multithreading Loop Datatable <p>I have a <code>datatable</code> with <code>1000 records</code>. Each row has a column with a link.I will loop the <code>datatable</code> and fetch record from the website using the link in the <code>datatable</code>. The code is working fine , but this is taking too much time to retr...
<blockquote> <p>How can we do using threading C#, Any help appreciated.</p> </blockquote> <p>Don't use <code>threading / parallel api</code> to achieve this, since it will be do little precious except waiting for the remote call to return and thus will waste precious resources.</p> <blockquote> <p>Available Optio...
Scrollspy Navbar jumping over tab? <pre><code> &lt;body data-spy="scroll" data-target=".navbar" data-offset="50"&gt; &lt;nav class="navbar navbar-default navbar-fixed-top"&gt; &lt;div class="container-fluid"&gt; &lt;div class="navbar-header"&gt; &lt;button typ...
<p>This should works: </p> <pre><code>.ui-widget-content[aria-hidden="true"] { display: block !important; height: 0px; overflow: hidden; } .ui-widget-content[aria-hidden="false"] { display: block !important; height: auto; } </code></pre>
Copy Artifact Plugin - Copy from WORKSPACE without the path from Artifacts to copy <p>I would like to copy Jenkins <code>WORKSPACE</code> items from a job to another using <strong>Copy Artifact Plugin</strong> as follows:</p> <ul> <li>from Job A's <code>WORKSPACE</code>: <code>/output/bundle/&lt;all files and folders&...
<p>There should be a "flatten directory" option in the advanced setting, which will expand whatever you have in the source directory to the target directory. However, this will also expand the folder in the source directory, to solve that you need to be more specific on the source folder and the destination folder. Fo...
Vue.js make menu item active <p>How could I make a menu item active in Vue.js when someone visits the page? I can't find any great example on the web?</p> <pre><code> &lt;header&gt; &lt;nav&gt; &lt;ul class="navigation"&gt; &lt;li class="navigation-item ritten" v-if="user.authenticated" v-link=...
<p>You can toggle an <code>active</code> class in your <code>v-link</code></p> <pre><code>v-link="{path : 'your-link', activeClass: 'active', exact: true}" </code></pre>
How to make an Application for Google TV remote in Android Programming? <p>I have to make Like this remote Application-:<a href="https://play.google.com/store/apps/details?id=fr.bouyguestelecom.remote&amp;hl=en" rel="nofollow">Link of App Play Store</a></p> <p>I don't have good english comm. that's why i shared a link...
<p>As far as Anymote lib implementation is concerned it had clear API available for the reason. </p> <p>From <a href="https://github.com/entertailion/Android-Anymote" rel="nofollow">Android-Anymote</a> implementation in <a href="https://github.com/entertailion/Android-Anymote/blob/master/src/com/entertailion/android/a...
Google Big Table Vs Big Query for ad server data analysis <p>We are looking to build a solution on GCP for campaign/ad analytics (ingest doubleclik and other ad-server data into DW). Data is ingested as batch, with star schema but will have updates trickling in for up to a week, need trend analysis for multiple clients...
<p>Every situation is different, so it's difficult to give you a specific answer.</p> <p>You might find reading <a href="https://cloud.google.com/solutions/data-lifecycle-cloud-platform" rel="nofollow">Data Lifecycle on Google Cloud Platform</a> useful in making your decision.</p> <p>BigQuery v2 now supports updates ...
Key value pair storing and iteration in angular <pre><code>{ "ordersList": [{ "ordersDto": { "testMast": { "testId": 9, "testName": "HIV" }, "sample": { "sampleId": 9050 } } }, { "ordersDto":...
<p>sampleIdTestNameMap will have sampleId as key and testName list as value.</p> <pre><code>var sampleIdTestNameMap = {}; angular.forEach(vm.ordersList, function(item) { if (item.ordersDto.sample != null &amp;&amp; item.ordersDto.sample.sampleId != null) { if (sampleId.indexOf(item.ordersDto.sample.sample...
How can we take backup of one single schema with Data in SQL server, data is in billions <p>I have a Database which has around 100 schemas. Out of this I want to take backup of single schema which has around millions/billions record per table, is there a method to do so? </p> <p>I want to do it once as data is consumi...
<p>I am afraid, taking backup of single schema is not possible. However you can transfer all your tables belong to one schema to a specific filegroup. Then you can choose "<strong>Files and filegroups</strong>" as Backup component by making Recovery model NOT Simple . </p>
Creating a pod with cocoapods fails <p>I've just tried to create a pod using <code>pod lib create Test</code> and went with all the defaults. However, when it is done asking me questions I get:</p> <blockquote> <p>Running pod install on your new library.</p> <p>[!] No `Podfile' found in the project directory.</...
<p><em>Following is working on Cocoapods <strong>1.1.0.rc.2</strong> version.</em> <br><br> You haven't done anything wrong. It's a pre-release version, just a few more steps required. Podfile is already there, but in the Example folder. Open terminal, proceed to Example folder: </p> <pre><code>cd [path] </code></pre...
Implement CSS3 style for drag and drop angularjs after click a button <p>I had done an Angularjs drag and drop method in my project. I do not have any problems in drag and drop, however I got problems on how to make style for draggable element after next action was taken.</p> <p>For my case, if user drag <em>Goose</em...
<p>You just need to add some logic to your check answer function, which actually checks the answer and assigns a boolean:<br> <sub>(In my example I'm just alternating between true and false)</sub></p> <pre><code>var i = 0; $scope.checkAnswer = function() { $scope.droppedObjects1.concat($scope.droppedObjects2).forEac...
Python Flask app- leading zeros in TOTP error. (Python 2.7) <p>I have written a python flask application in which app generate totp for validation. (Python 2.7)</p> <p>I use onetimepass library to validate totp against the application secret. code:</p> <pre><code> json_data=request.get_json() my_token=json_da...
<p>Answer was simple as my_token was coming as string and i was converting it to a number. Adding this before converting to a number did the trick:</p> <p><code>my_token.lstrip("0") #removes leading characters</code></p>
DataBase connectivity in wordpress <p>In WordPress how to store the data submitted from a form to a database through php file? I used many plugins but still can't find the solution </p>
<p>for inserting any data from wordpress from to wordpress database you need to do this by manually code. create a new file in wordpress theme template and use wp insert query on this page. currently we are developing a plugin for custom db insert in to database from admin, very soon we will upload it in wordpress fre...
Running a docker container as a task in marathon <p>I have setup the mesos and marathon on my local system. Also, I have docker engine running on my system, and when I do, <code>sudo docker images</code>, I get the following, </p> <pre><code>REPOSITORY TAG ...
<p>The JSON seems fine from a JSON schema perspective. TBH, the <code>cmd</code> property contents doesn't really make sense if you want to test running containers on Mesos.</p> <p>I even think the command you're using will not be able to work, executing Docker within the application context...</p> <p>Please use a st...
Setting MONGO_URL not applying remote mongo connection to Atlas from local run <p>I'm trying to connect to a remote mongodb setup on MongoDB Atlas from a local run. I have a normal mongo url from Compose:</p> <pre><code> MONGO_URL=mongodb://[username]:[password]@aws-us-east-1-portal.21.dblayer.com:10170/[database] </...
<p>Using '&amp;' chars in a environment variable can be problematic (Mac OS). Be sure to type the variable in quotes:</p> <pre><code>MONGO_URL='mongodb://[username]:[password]@cluster0-shard-00-00-xgnuk.mongodb.net:27017,cluster0-shard-00-01-xgnuk.mongodb.net:27017,cluster0-shard-00-02-xgnuk.mongodb.net:27017/[databas...
group multiple field data as one field in sql <p>My sql query </p> <pre><code>select status,count(id) from table group by status; </code></pre> <p>returns following Data</p> <pre><code>Resolved- 4 Closed - 12 Verified - 3 New* - 23 Unconfirmed* - 4 Needmoreinfo* - 5. </code></pre> <p>What i want mysql to return is<...
<p>your question is missing information to help you.. but maybe you want this</p> <pre><code>SELECT CASE WHEN (status NOT IN ('Resolved', 'Closed', 'Verified')) THEN 'Found*' ELSE status END as status, count(id) FROM table GROUP BY CASE WHEN (status NOT IN ('Resolved', 'Closed', 'Verified')) THEN 'Found*' ELSE stat...
Delete rows which are not formatted as dates <p>In my column A I have cells which consists of formatted dates and general formatting. I want to delete rows which are not dates, and I've made this code, but I have to run it multiple times to get it to delete all the rows which aren't dates.</p> <p><a href="http://i.sta...
<p>you could try</p> <pre><code>Sub del_row_not_date() With Sheet1 .Range("A1", .Cells(.Rows.Count, "A").End(xlUp)).SpecialCells(xlCellTypeConstants, xlTextValues).EntireRow.Delete End With End Sub </code></pre> <p>what above deletes all column "A" not-numbers cells entire row</p> <p>if you have cell...
CMFCColorButton popup does not close when clicking outside <p>I have a <code>CMFCColorButton</code>inside a <code>CPropertyPage</code>. When I click the button, the color choice popup comes up. I can select a color and the popup closes, I can get the color etc.. all good. But when I click somewhere else while the popup...
<p>I know this problem from when you use this special popups in a dialog. You must use CDialogEx instead of CDialog.</p> <p>CDialogEx uses OnNcActivate with a CDialogImpl class that closes popups. As I see the same handling is used in CMFCPropertySheet and CMFCPropertyPage.</p> <p>SO the solution should be using CMFC...
Segmentation fault when pointer used as key points to something in std::unordered_map <p>I was testing <code>std::unordered_map</code>s to get used to them before actually using them in a project.</p> <p>And I noticed that, if I use pointers as keys, I get a segfault error when the pointer used as the key actually poi...
<p>You declared a pointer, not an <code>int</code>. The pointer points to nowhere, as you did not initialize it. There is no place to write the <code>18</code> to, because the pointer doesn't point to any space.</p> <p>Note that your issue is completely unrelated to unordered maps.<br> <code>int * key; *key = 18;</cod...
Dynamic JSON Model <p>Here, I'm trying to parse this JSON Object into model. But I'm stuck here with the dynamic field names. Here is the example of the JSON Object</p> <pre><code>{ "1": { "state": { "on": false, "bri": 0, "hue": 0, "sat": 0, "eff...
<p>You need to wrap json in one root element then use model like this</p> <pre><code>public class RootElement{ private Map&lt;String, DataInfo&gt; rootElement; } public class DataInfo { private State state= null; private String type= null; // all your field under 1, 2 } </code></pre> <p>And your...
Ionic Angular pass data to PHPfile and insert into MySQL database <p>Something strange happen, I pass insert data from angular controller to php file. Next, php file is inserting data into MySQL database. All the data is successfully inserted. However once I click on button two record is inserted into MySQL database. O...
<pre><code>$sql = "INSERT INTO use_directory (user,email,pass) VALUES ( '$user','$email', '$pass')" ; if(mysqli_query($conn, $sql)){ echo "Add successfully\n"; }else{ die('Could not edit data'); } </code></pre> <p>Have you tried like this? Hope it helps :)</p>
How do I let whole DIV can be click and redirect to next page <p>I want to make a whole <code>DIV</code> can be clicked and redirect to next page. How do I edit this code. I am new in <code>MVC</code></p> <p>Here is my <code>MVC</code> 5 code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console=...
<pre><code>&lt;a href="@Url.Action("Index","UserTables")" class="defaultpage_menu"&gt; &lt;div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 defaultpage_menu_button" id="defaultpage_menu_userlisting"&gt; &lt;h1 class="default_menu_title"&gt;User Listing&lt;/h1&gt; &lt;/div&gt; &lt;/a&...