pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
5,722,203
0
Keybords inputs in a WPF user control are not sent to the WinForms container <p>We have a WinForms application that we are progressively converting to WPF. At this point the application's main form is a Form (WinForm) that contains a vertical sidebar built in WPF. The sidebar is hosted in an ElementHost control.</p> <p...
16,835,738
0
<p>You can always animate the <code>contentOffset</code> property yourself and use <code>UIViewAnimationOptionBeginFromCurrentState</code> option. As soon as the second animation begins, the first will end, and by using current state option, the second animation will start from where the first left off. </p>
21,717,089
0
computing multiple fixed effects on large dataset <p>I'm trying to perform a fixed effects regression for two factor variables in a CSV dataset containing over 4000000 rows. These variables can respectively assume about 140000 and 50000 different integer values.</p> <p>I initially attempted to perform the regression us...
10,837,994
0
<p>The output is different for failures. For IsTrue, the message will be something like "Expected true but was false." For GreaterOrEqual, the message will be something like "Expected 1 or greater, but was -15." GreaterOrEqual provides more info in that you will see the actual value, which is more useful when debuggin...
23,083,505
0
<p>Same as @hsz answer but with one difference..</p> <pre><code>foreach ($test as $key=&gt;$value) { // +1 because 1st array key is 0 ${'test' . ($key+1)} = $value; } </code></pre> <p>or with counter</p> <pre><code>$i = 1; foreach ($test as $value) { ${'test' . $i++} = $value; } </code></pre> <p>But it all depends on ...
1,235,336
0
Jquery tab reload with a parameter <p>After some events in a tab, I would like to reload it. I need to send a parameter to the page that loads into the tab. </p> <p>The following reloads the page: $("#tabs").tabs( 'load' , 6);</p> <p>But, how can I send a parameter with it?</p>
30,293,857
0
<p>So I have found the "silver bullet" that seems to resolve a great number of challenges regarding auto layout of prototype cells. </p> <p>In the cellForRowAtIndexPath function I added the following line of code right before I return the cell:</p> <pre><code>lobj_NearbyLocationEntry!.layoutIfNeeded() </code></pre> <p...
7,498,206
0
Can a ClickOnce application return a value to the page that loaded it? <p>I have an online ClickOnce application that launches from a web page. After the application is closed, I would like the user to return to that page with some results passed from the application. Is this possible? </p> <p>Right now the only soluti...
17,835,952
0
Returning only updated fields from database <p>I'm building stored procedure which will be used by my Web API application. Now, I have multiple databases and multiple stored procedures which returns me all data which is specified by API contract. What I want to do is to customize my SP's in the way that they are going ...
16,054,118
0
<p>It might be easier if you think of the comma-expression list you present like this: </p> <pre><code>((a += 3, b = c * 2), d = a + b) </code></pre> <p>First the innermost comma-expression is evaluated:</p> <pre><code>a += 3, b = c * 2 </code></pre> <p>That expression will be evaluated in two steps:</p> <pre><code>a ...
24,081,707
0
Google Spreadsheet: Count rows with not empty value <p>In a Google Spreadsheet: How can I count the rows of a given area that have a value? All hints about this I found up to now lead to formulas that do count the rows which have a not empty content (including formula), but a cell with =IF(1=2;"";"") // Shows an empty ...
10,810,407
0
Already php sms function convert to C# success <p>i have already configured SMS gateway &amp; some php code.Now my project is thatone convert it to Csharp with minor changes,</p> <p>probably i have to write new code.but so.. experienced guys from you i wanted to know is that possible ? Sample code below.</p> <pre><code...
8,385,604
0
Lines with an applied DashStyle are wrongly drawn <p>Doing some GIS programming I stumbled over the following strange issue: When I apply a transformation matrix with fairly large transformation values to a Graphics object and then draw a line from point A to point B, it is drawn crooked as soon as I apply a DashStyle ...
38,718,459
0
<p>you must not perform the substitutions yourself in a SQL query as this makes your code vulnerable to <a href="https://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">SQL injections</a>. </p> <p>The correct version is:</p> <pre><code>cr.execute( 'select distinct(value) from ir_translation ' 'where name = %s and ...
21,398,381
0
<p>You're trying to assign an array of bytes (<code>byte[]</code>) to a single byte, hence the error.</p> <p>Try the following code:</p> <pre><code>byte[] imgarray = new byte[imglength]; </code></pre>
22,802,834
0
<p>For desktop app, please check your project properties "Security" setting, to make sure disable the ClickOnce security settings. Good luck!</p>
13,378,535
0
<pre><code>&lt;?php require './config.php'; require './facebook.php'; //connect to mysql database mysql_connect($db_host, $db_username, $db_password); mysql_select_db($db_name); mysql_query("SET NAMES utf8"); //Create facebook application instance. $facebook = new Facebook(array( 'appId' =&gt; $fb_app_id, 'secret' =&g...
28,574,861
0
Convert string to date and merge data sets R <p>I have a column of data in the form of a string, and I need to change it to date because it is a time series.</p> <pre><code>200612010018 --&gt; 2006-12-01 00:18 </code></pre> <p>I've tried unsucessfully,</p> <pre><code>strptime(200612010018,format ='%Y%M%D %H:%MM') </cod...
26,792,987
0
<p><a href="http://dmauro.github.io/Keypress/" rel="nofollow">KEYPRESS</a> is focused on game input and supports any key as a modifier, among other features. It's also <a href="https://atmospherejs.com/keypress/keypress" rel="nofollow">pre-packaged for Meteor</a>.</p>
36,517,321
0
<p>This is a great use-case for custom directives. Here is an example of a custom directive that adds jQuery functionality to Vue: <a href="https://vuejs.org/examples/select2.html" rel="nofollow">https://vuejs.org/examples/select2.html</a></p>
10,192,134
0
Why am I getting index out of bounds error from database <p>I know what index out of bounds is all about. When I debug I see why as well. basically what is happening is I do a filter on my database to look for records that are potential/pending. I then gather a array of those numbers send them off to another server to ...
21,571,515
0
<p>By passing the interface you are creating the opportunity to pass all the classes which implements the interface. But in case1 you can only pass the <code>MyClass</code> and its subclasses.</p> <p>For example think about the following case</p> <pre><code>public class YourClass implements MyInterface { public void f...
34,449,869
1
Unpacking "the rest" of the elements in list comprehension - python3to2 <p>In Python 3, I could use <code>for i, *items in tuple</code> to isolate the first time from the tuple and the rest into items, e.g.:</p> <pre><code>&gt;&gt;&gt; x = [(2, '_', 'loves', 'love', 'VBZ', 'VBZ', '_', '0', 'ROOT', '_', '_'), (1, '_', '...
18,467,408
0
<p>As written your formula will always return zero because the last two conditions are mutually exclusive - did you mean those last two to be &lt;> rather than = (or did you refer to the wrong columns)?</p> <p>In any case I can see from the use of whole columns that you must be using <code>Excel 2007</code> or later (...
11,830,949
0
<p>OpenLayers <a href="http://www.openlayers.org/" rel="nofollow">http://www.openlayers.org/</a> is the most featureful web-mapping client. It will happily read your data locally via standard GeoJSON files for vectors and geo-referenced images for rasters.</p> <p>You could even grab a bunch of tiles from something lik...
5,850,596
0
Conversion of long to decimal in c# <p>I have a value stored in a variable which is of type "long".</p> <pre><code>long fileSizeInBytes = FileUploadControl.FileContent.Length; Decimal fileSizeInMB = Convert.ToDecimal(fileSizeInBytes / (1024 * 1024)); </code></pre> <p>I want to convert the fileSizeInBytes to decimal num...
28,868,524
0
<p>Integer or floats values other than 0 are treated as True:</p> <pre><code>In [8]: bool(int(1)) Out[8]: True In [9]: bool(int(0)) Out[9]: False In [10]: bool(int(-1)) Out[10]: True In [16]: bool(float(1.2e4)) Out[16]: True In [17]: bool(float(-1.4)) Out[17]: True In [20]: bool(0.0) Out[20]: False In [21]: bool(0.000...
955,853
0
<p>You could put a helper method in the view's codebehind, and then do something like:</p> <pre><code>Type modelType = this.Model.GetType(); if (modelType == typeof(NewsSummary)) this.RenderPartial("newspartial", this.Model as NewsSummary); else if (modelType == typeof(GigSummary)) this.RenderPartial("gigpartial", thi...
101,836
0
<p>You could try to get spanning-tree protocol information out of the smart switches; even unmanaged switches have to participate in this protocol (this doesn't apply to hubs, though).</p>
16,851,657
0
<pre><code>function functionTwo(b) { if(functionOne(b)) return true; else return false; } </code></pre>
17,244,406
1
Python : How to access file from different directory <p>I have the following project structure</p> <pre><code>SampleProject com python example source utils ConfigManager.py conf constants.cfg </code></pre> <p>How to access constants.cfg from ConfigManager.py. </p> <p>I have a limitation</p> <ol> <li>I can not give full...
5,588,446
0
<p>They won't be able to install and run the app (until they upgrade the OS on their device to that of the Deployment Target or above). But they might be able to buy and download the app using iTunes on their Mac or PC.</p>
40,728,428
0
<p>You can make a function like this:</p> <pre class="lang-python prettyprint-override"><code>def get_item(d, keys): current = d for k in keys: current = current[k] # You can add some error handling here return current </code></pre> <p>Example of usage: <a href="https://repl.it/E49o/1" rel="nofollow noreferrer">https:...
3,659,507
0
<p>Converting is not an option, since you don't know anything about what the user meant. For example, when I input the number '3', you can't determine if I meant 3 days or 3 months.</p> <p>Let me elaborate a bit: if I input '3' and select 'days', the time in seconds is: 60 * 60 * 24 * 3 = 259200 seconds. When displayi...
7,190,464
0
<p>The subtlety you miss is that the standard input and positional parameters are not the same thing.</p> <p>Standard input, which you can redirect with the '&lt;', or even from another program with '|' is a sequence of bytes. A script can read stdin with, well, the <code>read</code> command.</p> <p>Positional paramet...
37,488,010
0
<p>You don't need quotes around spaced entities when you use <code>fgrep</code>. <code>fgrep</code> takes each line literally already. It's only in the command line that you need quotes in order to disambiguate a string from extra command line arguments. Your file can just be:</p> <pre><code>content1 c o n t e n t 2 <...
11,400,927
0
<p>This is outside of the language specification and I think if this is a feature that you wish to have in the language another language would be of more use to you that has this kind of functionality in it. </p> <p>The only way I can think of implementing this is by doing some preprocessing tricks, which just seems l...
2,625,241
0
Jquery Autocomplete Unable to Empty Input on Internet Explorer <p>I´ve got a Jquery autocomplete input like the following:</p> <pre><code>$("#cities").autocomplete(regionIDs, { minChars: 2, width: 310, autoFill: true, matchContains: "word", formatItem: function(row) { return row.city + ", " + "&lt;span&gt;" + row.count...
16,028,715
0
split a comma separated string in a pair of 2 using php <p>I have a string having 128 values in the form of :</p> <pre><code>1,4,5,6,0,0,1,0,0,5,6,...1,2,3. </code></pre> <p>I want to pair in the form of :</p> <pre><code>(1,4),(5,6),(7,8) </code></pre> <p>so that I can make a for loop for 64 data using PHP.</p>
23,633,468
0
Apply ISNULL like SQL in LINQ <p>I have the next LINQ where <b>o.Value</b> and <b>p.Value</b> are decimal types</p> <pre><code>from o in dbContext.Ammounts where o.Value &gt; (from p in dbContext.Payments select p).Sum(p =&gt; p.Value)) </code></pre> <p>The inner LINQ <code>from p in dbContext.Payments select p).Sum(p ...
5,439,542
0
animate div up and down <p>I am just making a panel, ( div ) that has cookie, and can be opened or closed. I would like though to animate the div open or closed on click.</p> <p>The code I have so far is:</p> <pre><code>var state; window.onload=function() { obj=document.getElementById('closeable'); state=(state==null)?...
39,925,370
0
Lucida Console font underscores not showing in input <p>I am using the <code>font-family: "Lucida Console", Monaco, monospace</code> in my CSS. I am trying to use the same font as my terminal (or similar).</p> <p>The problem is that when used in an input element, the underscores are not shown.</p> <p>Here is an example...
18,701,116
0
Cannot find library reference to libmysqlclient_r Angstrom <p>I downloaded the MySQL Connector / C++ code from dev.mysql.com. I also used opkg to download the libmysqlclient-r-dev package, which gave me libmysqlclient_r.so and .la in my /usr/lib directory.</p> <p>When I attempt to make the source code for the MySQL con...
1,832,445
0
<p>Just got a notification from PHPClasses, with one of the runner-ups of the monthly innovation award: <a href="http://www.phpclasses.org/browse/package/5721.html" rel="nofollow noreferrer">Text to Timestamp</a></p> <p>You could try that...</p>
38,411,503
0
<p>You could do:</p> <pre><code>def hour = Calendar.instance.HOUR_OF_DAY​ if(hour &gt;= 8 &amp;&amp; hour &lt; 17) { // It's between 8am and 5pm } </code></pre>
31,891,230
0
<p>Try this working link at plnkr: <a href="http://plnkr.co/edit/OaQBWxlIfa2fVvanKKEl?p=preview" rel="nofollow">http://plnkr.co/edit/OaQBWxlIfa2fVvanKKEl?p=preview</a></p> <p>Hope it helps!!! HTML</p> <pre><code>&lt;div class="blockcontainer"&gt; &lt;div class="blockcenterbox"&gt; &lt;div class="blocktop"&gt;abc&lt;/d...
33,866,122
0
<p><a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.2_r1/android/support/v17/leanback/app/BrowseFragment.java#BrowseFragment.0mOnFocusSearchListener" rel="nofollow">BrowseFragment class</a> accesses search icon using title view's <code>getSearchAffordanceView()</code></...
3,939,880
0
<p>Have you added <a href="http://msdn.microsoft.com/en-us/library/ez524kew%28VS.80%29.aspx" rel="nofollow">project reference</a>?</p>
7,273,665
0
<p>You're trying to set the <em>field names</em> as parameters - you can't do that. You can only specify <em>values</em> as parameters. So basically your first 14 <code>setString</code> calls should go away, and you should put those field names in the SQL:</p> <pre><code>String query = "INSERT INTO emp(epfno, fname, l...
34,067,879
0
Avoiding DbSet objects count using ToList() <p>Using C# Entity Framework v6.1.1, I was trying to make a Count operation on a <code>DbSet</code>:</p> <pre><code>//Items is a List&lt;Item&gt; int count = db.MyObjects.Count(o =&gt; o.Items.FirstOrDefault(i =&gt; i.ItemID == 1) != default(Item)); </code></pre> <p>I did not...
16,591,598
0
<p>Assuming that your HTML resembles the following:</p> <pre><code>&lt;input name="demo" type="checkbox" checked value="1" /&gt; &lt;input name="demo" type="checkbox" value="2" /&gt; &lt;input name="demo" type="checkbox" checked value="3" /&gt; </code></pre> <p>Then simply retrieve the elements of the relevant name, t...
12,832,100
0
<p>Yes this can be easily done using Clojure (for backend) and ClojureScript OR JavaScript (for frontend).</p> <p>Basically the client js code will use websockets to connect to clojure server and on server you can have a state wrapped in an atom that is access by each client and each client is updated about the state ...
33,108,577
0
<p>Here is an example that will help you get started:</p> <pre><code>const TCHAR szFilter[] = _T("CSV Files (*.csv)|*.csv|All Files (*.*)|*.*||"); CFileDialog dlg(FALSE, _T("csv"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, this); if(dlg.DoModal() == IDOK) { CString sFilePath = dlg.GetPathName(); m_FilePa...
902,770
0
<p>Depending on the exact version of the IBM JDK you are using, there are various options for tracking "large allocations". The differences are mainly in the implementation, and the result is a logging Java stack trace when an allocation over a certain size is made (which should help you track down the culprit).</p> <...
19,490,947
0
Retrieving last monday but no data in result set <p>I am trying to retrieve last monday when given date is monday below is the code.</p> <pre><code>select Case when to_char(to_date('21/10/2013','dd/mm/yyyy'), 'DAY') = 'MONDAY' then to_date(next_day(to_date('21/10/2013','dd/mm/yyyy')-7,'Tuesday') - 1, 'dd/mm/yyyy') END ...
2,451,641
0
<p>The most sargable option, short of using dynamic SQL, is to use an IF statement and two queries:</p> <pre><code>IF LEN(@Title) &gt; 0 SELECT r.* FROM RECORDS r WHERE r.title LIKE '%'+ @Title +'%' ELSE SELECT r.* FROM RECORDS r </code></pre> <p>The SQL Server 2005+ dynamic SQL version would resemble:</p> <pre><code>...
22,719,135
0
Objective C Regex Extract Data from Line Containing Text <p>I'm using objective c to create a program that will pull out data from a HTML file using regexes. The only lines that are important to the program contain the text <code>popupName</code> and I need to stip all HTML tags from it as well. Can this be done with o...
29,327,287
0
<p>I don't think <code>pivot</code> is useful here. Try this</p> <pre><code>WITH cte1 AS (SELECT Row_number()OVER(ORDER BY Id) RN, value AS Data1 FROM yourtable WHERE col_id = 1), cte2 AS (SELECT Row_number()OVER(ORDER BY Id) RN, value AS Data2 FROM yourtable WHERE col_id = 2), cte3 AS (SELECT Row_number()OVER(ORDER B...
40,777,459
0
<p>Have you tried to look at this one?</p> <pre><code>Dim PathofYourFile As String = "c:\MyDirectory\MYFile.txt" Dim FileName As String = IO.Path.GetExtension(PathofYourFile) MsgBox(FileName) </code></pre>
10,771,007
0
<p>Make sure its in the right package, runs for me. I'm using this plugin</p> <p><a href="http://scala-ide.org/" rel="nofollow">http://scala-ide.org/</a></p>
21,226,843
0
<p>You want to use <a href="http://www.mathworks.com/help/signal/ref/findpeaks.html" rel="nofollow"><code>findpeaks</code></a></p> <pre><code>[pks,locs] = findpeaks(data) </code></pre> <p>You could find the local maxes that way, go left and right until it drops to a certain threshold or by a certain percentage (since ...
34,358,645
0
Wrapping in a form action into a curl php <p>I'm new to php development and i just heard of curl. i have this data i post in a form action</p> <pre><code>&lt;form id="new_member_sms" name="new_member_sms" method="post" action="http://myserver.com/app_api.php?view=send_sms&amp;amp;&amp;amp;user=username&amp;amp;&amp;amp...
8,966,113
0
<p>You can check the referrer of the Request object. But this is very easily spoofed, and should not be relied on.</p>
5,483,771
0
How can I chain together SELECT EXISTS() queries? <p>I have this simple query</p> <pre><code>SELECT EXISTS(SELECT a FROM A WHERE a = 'lorem ipsum'); </code></pre> <p>That will return a 0 or 1 if there exists a row in A that contains 'lorem ipsum'</p> <p>I would like to chain this behavior together. So I would get multi...
5,564,687
0
PHP on IIS or Apache ( advantages and disadvantages) <p>What are the advantages and disadvantages of running php on IIS?</p> <p>or</p> <p>What are the advantages and disadvantages of running php on Apache?</p>
27,794,955
0
<p>Running into the same issue as you. I found the code here:</p> <p><a href="https://github.com/GoogleChrome/webrtc/tree/master/samples/web/content/apprtc" rel="nofollow">https://github.com/GoogleChrome/webrtc/tree/master/samples/web/content/apprtc</a></p> <p>Currently looking through the changes to see what could ha...
12,028,035
0
<p>You can't change your IP like this. Your code obviously doesn't work, because you've just created a variable of type IPAddress and assigned some value to it. If you want a different IP address that you currently have assigned from your internet provider, you need to use a Proxy or TOR if you can't achieve a change ...
7,932,352
0
Right banner margin CSS <p>On the site: <a href="http://ukrainiansecret.com" rel="nofollow">ukrainiansecret.com</a></p> <p>I would like to get rid of that green right margin of the banner, and to have it exactly as the left side. Have tried to stretch the banner width but it didn't work out.</p> <p>Thanks</p>
37,068,320
0
<p>ConnectionHandler is not serializable because it contains references to Socket and ServerSocket, which are not serializable. You would have to write your own serialization and deserialization methods to make it serializable.</p> <p>However, it doesn't make sense to make it serializable anyway, since it doesn't have...
25,554,245
0
How to check ping between client and server in php? <p>I have a problem, I need to check the connection between client server, i need to get the response time in ms between the client and a "x" server with php, how I can do that?</p>
2,207,527
0
Changing a label in Qt <p>I'm trying to make a simple program consisting of a button and a label. When the button is pressed, it should change the label text to whatever is in a QString variable inside the program. Here's my code so far:</p> <p>This is my widget.h file:</p> <pre><code>class Widget : public QWidget { Q_...
30,067,366
0
<p>jQuery's <a href="http://api.jquery.com/val/" rel="nofollow"><code>.val()</code></a> method is both a getter and a setter.</p> <p>Try this:</p> <p><code>$('input[name="x"]').val($hello);</code></p>
26,625,772
0
How to Join a group facebook using facebook SDK in C# <p>I'm using facebook sdk 6.8.0 for deverloping an app in windows using C-sharp. I have a group id, how do i send a request to group's admin to join this group using FB sdk? Please!</p>
37,210,341
0
<p>From python's <a href="https://docs.python.org/2/library/stdtypes.html#mapping-types-dict" rel="nofollow">docs</a>:</p> <p>iter(dictview)</p> <pre><code>Return an iterator over the keys, values or items (represented as tuples </code></pre> <p>of (key, value)) in the dictionary.</p> <pre><code>Keys and values are it...
12,087,022
0
<p>If the editor is in an iframe, you need to target the <code>top</code> window:</p> <pre><code>window.top.location = "http://"+url+""; </code></pre> <p>You should also make sure that the editor accept script tags (not all editors do).</p>
31,528,821
0
Worklight Java adapter invoke another adapter get I/O issue <p>I have a issue when I try to call adapter (HTTP/MYSQL) from a Java adapter.</p> <p>When I am using Postmen test it (added Authorization on the header) It's always get a IO issue: </p> <p><code>[I O: Invalid token on line 1, column 14]</code>.</p> <p>First, ...
17,575,011
0
<p>It's an ugly solution but you may try this ..</p> <pre><code>While DR.Read txtData.Text = txtData.Text &amp; DR.Item("CostumerOrder") &amp; Space(10) &amp; DR.Item("OrderPrice") &amp; vbCrLf Application.DoEvents() End While </code></pre>
1,925,552
1
Get Cygwin installation path in a Python script <p>I'm writing a cross-platform python script that needs to know if and where Cygwin is installed if the platform is NT. Right now I'm just using a naive check for the existence of the default install path 'C:\Cygwin'. I would like to be able to determine the installation...
6,576,259
0
<p>Or you can check first if key exists by using isset().</p> <pre><code>if ( isset($preset[$table]) ) </code></pre> <p>Return true if exists, otherwise return false.</p>
38,190,485
0
<p>Queries which are Unioned are independent of one another.<br> You want to join these tables.</p> <pre><code>select C2,C4 from D2.T2 a INNER JOIN D2.T3 b ON b.C3=a.C2; </code></pre>
6,348,427
0
Does HTML 5 application cache have any benefit for online apps? <p>Does the HTML 5 application (offline) cache have any benefit for online/connected apps? </p> <p>My page needs to be online to function and is loaded exclusively in a UIWebView as part of an iOS app. This page is loading some large dependencies and I was...
7,220,201
0
Record Terminal output? <p>Im using a cool program in terminal but it's pre-compiled... Luckily all I need is the output of this system, but the way I need it is tricky... I need it to run normally but output the last line of text in the window to a text file. I jabs been looking around but people only make it so that ...
33,638,975
0
Return blank cell only if referred cell is blank, but return aging if date is entered <p>I'm attempting an aging formula. I have one column with dates I've submitted info, but some rows in the column haven't been submitted. In another column I want to have an aging formula. If the "submitted date" cell is blank, I want...
2,355,728
0
JPQL Create new Object In Select Statement - avoid or embrace? <p>I've learnt recently that it is possible to create new objects in JPQL statements as follows:</p> <pre><code>select new Family(mother, mate, offspr) from DomesticCat as mother join mother.mate as mate left join mother.kittens as offspr </code></pre> <p>I...
6,103,593
0
<p>First of all, you should always put <code>use strict;</code> at the top of your program. That will catch numerous errors early.</p> <p>The last line in your <code>foreach</code> loop is the one that dereferences <code>$thingy</code> correctly. But since you've put <code>@{$thingy}</code> on the left-hand side of th...
32,205,707
0
Filter data on the query or with Java stream? <p>I have a Play 2.3.x Java application connected to a MongoDB database via Morphia.</p> <p>I activated slow query profiling in MongoDB and saw that a query comes often. It looks like this :</p> <pre><code>"query": { "field1": null, "field2": true, "field3": "a061ee3f-c2be-...
36,595,396
0
<p>check out how CardLayout works</p> <p><a href="https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html" rel="nofollow">https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html</a></p> <p>if you only want to switch between the windows:</p> <ol> <li>Add jPanel to your jFrame which will contain all jP...
11,480,503
0
How to add custom app icon on Android in Phonegap? <p>Do you know how to add a custom .png icon on Android in Phonegap? I changed the AndroidManifest.xml "android:icon="@drawable/ic_launcher" to a custom name but it's not working. In addition, my icons are all in the www/res/drawable folders with the correct sizes each...
9,216,542
0
How do I count the number of elements in each group? <p>How do I get a count of the elements within a particular group? So in the query below I want to know how many cancelled and active subscriptions each account has. What I am getting is either 0 or 1, depending on whether they have at least one cancelled or active s...
6,119,557
0
<p>Class level variables can't maintain their value on postback.</p> <p>But there are two ways you can maintain Data on the Page's PostBack: <code>ViewState and Session State</code>. But I would suggest in your Scenario to put it in the <code>ViewState</code>.</p> <pre><code>ViewState["theDataTable"] = theDataTable; S...
19,043,514
0
<p>You've escaped the <code>}</code> for boost, but you need to escape the <code>\</code> escape char for the compiler as well.</p> <pre><code>boost::wregex rightbrace(L"\\}"); </code></pre>
37,077,994
0
<pre><code>angular .module('app', []) .controller('Ctrl', function() { this.tags = [ { name: 'bob' }, { name: 'rick' }, { name: 'dave' } ]; }) &lt;body ng-controller="Ctrl as vm"&gt; &lt;ul&gt; &lt;li ng-repeat="obj in vm.tags" ng-class="{'active': vm.active == obj.name}"&gt; &lt;a ng-click="vm.active = obj.name"&gt;{...
25,662,942
0
DocumentDb User Data Segregation <p>I'm testing out the recently released DocumentDb and can't find any documentation indicating best practice on how to perform user data segregation. </p> <p>I imagine the rough design would be:</p> <ul> <li>Authenticate the user and create new/obtain existing user id</li> <li>On docum...
11,674,164
0
<p>From custom password validator you can return FaultCode that describe what's wrong:</p> <pre><code>throw new FaultException("Invalid user name or bad password.", new FaultCode("BadUserNameOrPassword")); throw new FaultException("Password expired.", new FaultCode("PasswordExpired")); throw new FaultException("Intern...
40,516,789
0
<p>In this case could be better a CreateCommand </p> <p>for do this you should bild raw query using join eg: </p> <pre><code>select * from `feed` join `website` on `website`.id = `feed`.`website_id` WHERE website`.`user_id`= 1 AND `feed`.id IN (2, 3) </code></pre> <p>or for delete </p> <pre><code>delete from `feed` jo...
37,375,733
0
<blockquote> <p>how vecor is initialised?</p> </blockquote> <p>It's default initialized implicitly (i.e. initialized by the default constructor). To be complete, it's default initialized at first, and then copy assigned in the body of constructor.</p> <p>The more effiient way is using <a href="http://en.cppreference.c...
25,735,350
0
<p>You can do this in this way.</p> <p>In HTML do like below.</p> <pre><code>&lt;ul&gt; &lt;li data-ng-repeat="record in records"&gt; &lt;input type="checkbox" ng-model="selected[record.Id]"&gt; {{record.Id}} &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And in controller you have to add selected property.</p> <pre><code>f...
27,798,343
0
<p><code>Base64</code> encoding takes 3 input bytes and converts them to 4 bytes. So if you have 100 Mb file that will end up to be 133 Mb in <code>Base64</code>. When you convert it to Java string (<code>UTF-16</code>) it size will be doubled. Not to mention that during conversion process at some point you will hold ...
36,031,822
0
<p>You can use <strong>Project Dependencies</strong> to adjust build order:</p> <ol> <li>In Solution Explorer, select a project.</li> <li>On the <strong>Project</strong> menu, choose <strong>Project Dependencies</strong>.The <strong>Project Dependencies</strong> dialog box opens.</li> <li>On the <strong>Dependencies</...
28,057,527
0
<p>THIS is the right way to do it.</p> <p>One more thing to keep in mind is that you MUST set the FILE SIZE:</p> <pre><code>curl_easy_setopt(curlHandle, CURLOPT_INFILESIZE,(curl_off_t)putData.size); </code></pre> <p>Otherwise your server might throw an error stating that the request length wasn't specified.</p> <p>put...