pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
16,383,856 | 0 | <p>You should try a later dtrace release. I believe this was fixed - the stack walk code had to keep on being rewritten due to erraticness of compilers, distros and 32 vs 64 bit kernels.</p> |
37,562,195 | 0 | <p>For logical reasons, tables are filled row by row in iText:</p> <p><a href="https://i.stack.imgur.com/SXI4A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SXI4A.png" alt="enter image description here"></a></p> <p>If you want to change the order, you need to do this yourself by creating a data matrix first. One way to do this, is by creating a two-dimensional array (there are other ways, but I'm using an array for the sake of simplicity).</p> <p>The <a href="http://developers.itextpdf.com/examples/tables/render-data-table#1834-rowcolumnorder.java" rel="nofollow noreferrer">RowColumnOrder</a> example shows how it's done.</p> <p>This is the normal behavior:</p> <pre><code>document.add(new Paragraph("By design tables are filled row by row:")); PdfPTable table = new PdfPTable(5); table.setSpacingBefore(10); table.setSpacingAfter(10); for (int i = 1; i <= 15; i++) { table.addCell("cell " + i); } document.add(table); </code></pre> <p>You want to change this behavior, which means that you have to create a matrix in which you change the order rows and columns are filled:</p> <pre><code>String[][] array = new String[3][]; int column = 0; int row = 0; for (int i = 1; i <= 15; i++) { if (column == 0) { array[row] = new String[5]; } array[row++][column] = "cell " + i; if (row == 3) { column++; row = 0; } } </code></pre> <p>As you can see, there is no iText code involved. I have 15 cells to add in a table with 5 columns and 3 rows. To achieve this, I create a <code>String[3][5]</code> array of which I fill every row of a column, then switch to the next column when the current column is full. Once I have the two-dimensional matrix, I can use it to fill a <code>PdfPTable</code>:</p> <pre><code>table = new PdfPTable(5); table.setSpacingBefore(10); for (String[] r : array) { for (String c : r) { table.addCell(c); } } document.add(table); </code></pre> <p>As you can see, the second table in <a href="http://gitlab.itextsupport.com/itext/sandbox/raw/master/cmpfiles/tables/cmp_row_column_order.pdf" rel="nofollow noreferrer">row_column_order.pdf</a> gives you the result you want.</p> |
7,992,624 | 0 | <p>I would re-think your storyboard layout here a bit. The title screen and login screens are essentially just modal views on top of the main part of your app, the <code>UITabBarController</code>. I would have the <code>UITabBarController</code> be the initial view controller in the storyboard and then conditionally present the title view/login screen modally as soon as the application finishes launching. </p> <p>Now with this design, showing the login screen is as simple as performing any modal segue. You may want to think about using delegation from the settings view controller to notify the presenting view controller that the user logged out and that the login view controller should be presented.</p> |
14,327,896 | 0 | <p>A singleton would be fine if you're not going to store any of the information in between sessions.</p> <p>For example, if you wanted to save a user's email address so they don't have to fill it out every time to log in, you'll need to use </p> <pre><code>[[NSUserDefaults standardUserDefaults] valueForKey:@"someKeyName"]; </code></pre> <p>Just like in your question.</p> |
25,167,304 | 0 | <p><code>char</code> isn’t special in this regard (besides its implementation-defined signedness), all conversions to signed types usually exhibit this “cyclic nature”. However, there are undefined and implementation-defined aspects of signed overflow, so be careful when doing such things.</p> <p>What happens here:</p> <p>In the expression</p> <pre><code>c=c+10 </code></pre> <p>the operands of <code>+</code> are subject to the <em>usual arithmetic conversions</em>. They include <em>integer promotion</em>, which converts all values to <code>int</code> if all values of their type can be represented as an <code>int</code>. This means, the left operand of <code>+</code> (<code>c</code>) is converted to an <code>int</code> (an <code>int</code> can hold every <code>char</code> value<sup>1)</sup>). The result of the addition has type <code>int</code>. The assignment implicitly converts this value to a <code>char</code>, which happens to be signed on your platform. An (8-bit) signed <code>char</code> cannot hold the value 135 so it is converted in an implementation-defined way <sup>2)</sup>. For <a href="https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html#Integers-implementation" rel="nofollow">gcc</a>:</p> <blockquote> <p>For conversion to a type of width <strong>N</strong>, the value is reduced modulo <strong>2<sup>N</sup></strong> to be within range of the type; no signal is raised.</p> </blockquote> <p>Your <code>char</code> has a width of <strong>8</strong>, <strong>2<sup>8</sup></strong> is <strong>256</strong>, and <strong>135 ☰ -121 mod 256</strong> (cf. e.g. <a href="https://en.wikipedia.org/wiki/Two's_complement" rel="nofollow">2’s complement on Wikipedia</a>).</p> <p>You didn’t say which compiler you use, but the behaviour should be the same for all compilers (there aren’t really any non-2’s-complement machines anymore and with 2’s complement, that’s the only reasonable signed conversion definition I can think of).</p> <p>Note, that this implementation-defined behaviour only applies to conversions, not to overflows in arbitrary expressions, so e.g.</p> <pre><code>int n = INT_MAX; n += 1; </code></pre> <p>is undefined behaviour and used for optimizations by some compilers (e.g. by optimizing such statements out), so such things should definitely be avoided.</p> <p>A third case (unrelated here, but for sake of completeness) are unsigned integer types: No overflow occurs (there are exceptions, however, e.g. bit-shifting by more than the width of the type), the result is always reduced modulo <strong>2<sup>N</sup></strong> for a type with precision <strong>N</strong>.</p> <p>Related:</p> <ul> <li><a href="http://stackoverflow.com/questions/24156897/a-simple-c-program-output-is-not-as-expected">A simple C program output is not as expected</a></li> <li><a href="http://stackoverflow.com/questions/4240748/allowing-signed-integer-overflows-in-c-c">Allowing signed integer overflows in C/C++</a></li> </ul> <hr> <p><sup>1</sup> At least for 8-bit <code>char</code>s, signed <code>char</code>s, or <code>int</code>s with higher precision than <code>char</code>, so virtually always.</p> <p><sup>2</sup> The C standard says (C99 and C11 (n1570) 6.3.1.3 p.3) “[…] either the result is implementation-defined or an implementation-defined signal is raised.” I don’t know of any implementation raising a signal in this case. But it’s probably better not to rely on that conversion without reading the compiler documentation.</p> |
6,546,737 | 0 | Installer not creating instead of compiling install.xml <p>I have given the following command at the <code>bin</code> directory of <code>Izpack</code> like this</p> <pre><code>C:\Program Files\IzPack\bin>compile D:\ant\guage install.xml </code></pre> <p>Is this the correct way to give ?</p> |
13,178,095 | 0 | <p>Are you really fetching so many rows to web server? If yes, review your code to narrow down to what's required.</p> <ol> <li>Try archiving old data to another table based on datetime. Re-write logic to fetch older data only when required.</li> <li>As others have mentioned, indexes / keys should help a mile in most cases</li> </ol> <p>If you can't do any of the above, another ugly solution (not sure if it will not go worse) is to create in-memory table, filter and fetch what's required and then fetch CLOB data.</p> |
36,089,653 | 0 | <p>Just answer your question in title, yes you can have AMP and NON-AMP pages. You can see WordPress plugin here <a href="https://wordpress.org/plugins/amp/" rel="nofollow">https://wordpress.org/plugins/amp/</a> , they are currently generating AMP page for each Blog Post in Single view, however any other custom post types like Pages, Archive pages, Category pages,front page are all non-AMP.</p> |
9,604,054 | 0 | <p>What version of Simple_form are you using? How did you integrate bootstrap?</p> <p>Presuming you used simple_form's wiki to integrate with twitter/bootstrap then please verify:</p> <ol> <li>lib/simple_form/contained_input_component.rb is being loaded and is implemented as-is</li> <li>config/initializers/simple_form.rb is calling the above library</li> <li>there is only one simple_form.rb in config/initializers and config/production</li> </ol> <p>If all of the above is in order, please update the question with your view code.</p> |
39,752,437 | 0 | <p>Your current example method has value hard coded to "Mult" but I assume that would be changed in your actual implementation.</p> <p>Assuming "value" contains the enumeration value corresponding to the button clicked, your Switch Statement should switch on that variable:</p> <pre><code>switch(value) </code></pre> |
19,003,558 | 0 | Inner query in Linq <p>How to write a linq query to retreive questions from questions table which is not attempt by user before.</p> <p>question table</p> <pre><code>create table questions ( questionID int, question varchar, primary key(questionID) ); create table result { id int, answered_by varchar, questionid int, answer varchar, primary key (id), foreign key ( questionid) references question(questionID) ); </code></pre> |
18,266,138 | 0 | How to get a password encrypted since the Java Script file in my web application? <p>I'm designing some code for a standard login in a web application, I consider that doing the <strong>password encryption</strong> on <strong>client side</strong> is better than making mongo server doing it.</p> <p>So, if I have this code ...</p> <pre><code>$("#btnSignUp").click( function () { var sign = { user:$("#signUser").val(), pass:$("#signPass").val() }; }); </code></pre> <p>And then I'd do a <strong>post</strong> of <code>sign</code> with the password value already encrypted, how could I achieve this? Does JavaScript support AES?</p> |
31,978,911 | 0 | <p>Declare the variable outside of both the functions so it can be accessed by either function.</p> <pre><code>private string getFileName = ''; protected override void SomeFunction(){ switch (ofd.ShowDialog()) { case DialogResult.OK: getFileName = Path.GetFullPath(ofd.FileName); labelStatus.Text += getFileName; break; } } private void button1_Click(object sender, EventArgs e) { try { Process.Start(getFileName); } catch { //... } } </code></pre> <p>I suggest you search YouTube for c#.net variable scope to better understand when an where a variable can be accessed :)</p> |
4,130,588 | 0 | <p>You can use the <code>setTestProviderLocation</code> method of the <code>LocationManager</code> to mock new locations and have the <code>onLocationChanged</code> method of the registered listeners called when you want.</p> <p>You should check the <a href="http://developer.android.com/reference/android/location/LocationManager.html" rel="nofollow">reference page</a>. You also have an example <a href="http://markmail.org/message/koo6pdhusseubuth" rel="nofollow">here</a>.</p> |
34,144,314 | 0 | how to have fread perform like read.delim <p>I've got a large tab-delimited data table that I am trying to read into R using the data.table package fread function. However, fread encounters an error. If I use read.delim, the table is read in properly, but I can't figure out how to configure fread such that it handles the data properly.</p> <p>In an attempt to find a solution, I've installed the development version of data.table, so I am currently running data.table v1.9.7, under R v3.2.2, running on Ubuntu 15.10.</p> <p>I've isolated the problem to a few lines from my large table, and you can <a href="https://dl.dropboxusercontent.com/u/34644229/problemRows.txt" rel="nofollow">download it here</a>.</p> <p>When I used fread:</p> <pre><code>> fread('problemRows.txt') Error in fread("problemRows.txt") : Expecting 8 cols, but line 3 contains text after processing all cols. It is very likely that this is due to one or more fields having embedded sep=',' and/or (unescaped) '\n' characters within unbalanced unescaped quotes. fread cannot handle such ambiguous cases and those lines may not have been read in as expected. Please read the section on quotes in ?fread. </code></pre> <p>I tried using the parameters used by read.delim:</p> <pre><code>fread('problemRows.txt', sep="\t", quote="\"") </code></pre> <p>but I get the same error.</p> <p>Any thoughts on how to get this to read in properly? I'm not sure what exactly the problem is.</p> <p>Thanks!</p> |
38,971,499 | 0 | <pre><code>You don't need all those thing just do it like this.. <object width="420" height="315" data="http://www.youtube.com/v/XGSy3_Czz8k"> </object> </code></pre> <p>OR</p> <pre><code><embed width="420" height="315" src="http://www.youtube.com/embed/XGSy3_Czz8k"> </code></pre> |
3,894,160 | 0 | <p>In the first case the scope of the String declaration is within the switch statement therefore it is shown as duplicate while in the second the string is enclosed within curly braces which limits the scope within the if/else conditions,therefore it is not an error in the second case.</p> |
27,491,188 | 0 | <p>Most likely your script isn't running slower- check your server logs. What you're seeing is the high latency of cellular data plans. Basically, it takes a long time for requests to get from your phone to the tower. It isn't causing your php to run slower, its just taking a while for the data to transfer to your server and back.</p> |
38,606,976 | 0 | <p>I spent a lot of time getting this done. Here is a clear step-by-step things to be done to query special characters in SolR. Hope it helps someone.</p> <ol> <li>Edit the schema.xml file and find the solr.TextField that you are using.</li> <li><p>Under both, "index" and query" analyzers modify the <code>WordDelimiterFilterFactory</code> and add <code>types="characters.txt"</code> Something like:</p> <pre><code><fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter catenateAll="0" catenateNumbers="0" catenateWords="0" class="solr.WordDelimiterFilterFactory" generateNumberParts="1" generateWordParts="1" splitOnCaseChange="1" types="characters.txt"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter catenateAll="0" catenateNumbers="0" catenateWords="0" class="solr.WordDelimiterFilterFactory" generateNumberParts="1" generateWordParts="1" splitOnCaseChange="1" types="characters.txt"/> </analyzer> </fieldType> </code></pre></li> <li><p>Ensure that you use WhitespaceTokenizerFactory as the tokenizer as shown above.</p></li> <li><p>Your characters.txt file can have entries like-</p> <pre><code> \# => ALPHA @ => ALPHA \u0023 => ALPHA ie:- pointing to ALPHA only. </code></pre></li> <li><p>Clear the data, re-index and query for the entered characters. It will work.</p></li> </ol> |
33,026,165 | 0 | ImageJ if statement won't execute roiManager("Select",#); <p>Finally got my code working except for one if statement that I cannot fix. I am selecting ROIs 3 and 4 in the first step, and then if the "if" statement is satisfied I want to select just the 4th ROI and delete that. For whatever reason it skips the selection of ROI 4 and deletes the already selected 3 and 4. I've tried selectWindow("ROI Manager"); before with no luck. Not really sure what the issue is or how to fix. Thanks!</p> <pre><code>roiManager("Select", newArray(3,4)); roiManager("Measure"); tempX1=getResult("X", 0); tempY1=getResult("Y", 0); tempX2=getResult("X", 1); tempY2=getResult("Y", 1); selectWindow("Results"); run("Close"); if (tempX1>(tempX2-2) && tempX1<(tempX2+2) && tempY1>(tempY2-2) && tempY1<(tempY2+2)) { selectWindow("ROI Manager"); roiManager("Select", 4); roiManager("Delete"); } </code></pre> |
14,341,290 | 0 | <p>You can have distinct patterns only for positive and negative values.You should do something like: </p> <pre><code>public class DecimalScientificFormat extends DecimalFormat { private static DecimalFormat df = new DecimalFormat("#0.00##"); private static DecimalFormat sf = new DecimalFormat("0.###E0"); @Override public StringBuffer format(double number, StringBuffer result, FieldPosition fieldPosition) { String decimalFormat = df.format(number); return (0.0001 != number && df.format(0.0001).equals(decimalFormat)) ? sf.format(number, result, fieldPosition) : result.append(decimalFormat); } } </code></pre> |
4,570,505 | 0 | <p>It is absolutely the same in C++, so not only a python / pyqt problem (played around with that for some time now to see if I can find a solution). I first thought this is the old bug with Qt::ItemIsEnabled coming back which we already had in 4.2, but it was not.</p> <p>This is either working as intended and not enough described in the documentation (my +1 for this), or a bug.</p> <p>To be sure about this, I would file a bug at <a href="http://bugreports.qt.nokia.com" rel="nofollow">http://bugreports.qt.nokia.com</a>, and see what they say about this.</p> |
12,424,460 | 0 | <p>You can create a <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.modelvalidatorprovider%28v=vs.108%29.aspx" rel="nofollow"><code>ModelValidatorProvider</code></a> for Enterprise Library validation. Brad Wilson has a <a href="http://bradwilson.typepad.com/blog/2009/10/enterprise-library-validation-example-for-aspnet-mvc-2.html" rel="nofollow">blog post</a> describing how to do this.</p> <p>However, it looks like this will only perform server side validation. If the attributes you are using are very similar to DataAnnotations, I would recommend using them instead.</p> |
29,749,900 | 0 | Extract details that are in both using awk or sed <p>I'm trying to write a script which needs to extract details that exist on both versions. </p> <pre><code>ABC-A1 1.0 tomcat BBC-A1 2.0 tomcat CAD-A1 1.0 tomcat ABC-A1 2.0 tomcat BBC-A1 2.0 tomcat </code></pre> <p>In the above data , I would like to extract the names that exist in both 1.0 and 2.0 ( that will be <code>ABC-A1</code> and <code>BBC-A1</code> )</p> <p>How can I do this using <em>awk or sed</em> or any other?</p> |
30,306,385 | 0 | Not getting values from grid table when checkbox is checked? <p>I want to get value of row where checkbox is checked. I am new to C# windows forms and so far unsuccessful. I want to eventually use these row values, so if user selects multiple row and then I should get value for those checked. Also, I have set the selection mode to 'fullrowselect'</p> <p>Please suggest changes to my code</p> <pre><code>private void button1_Click(object sender, EventArgs e) { StringBuilder ln = new StringBuilder(); dataGridView1.ClearSelection(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (dataGridView1.SelectedRows.Count>0 ) { ln.Append(row.Cells[1].Value.ToString()); } else { MessageBox.Show("No row is selected!"); break; } } MessageBox.Show("Row Content -" + ln); } </code></pre> |
36,376,059 | 0 | <p>This is an aggregation query, but you don't seem to want the column being aggregated. That is ok (although you cannot distinguish the rk that defines each row):</p> <pre><code>select count(*) as CountOfId, max(dateof) as maxdateof from t group by fk; </code></pre> <p>In other words, your subquery is pretty much all you need.</p> <p>If you have a reasonable amount of data, you can use a MySQL trick:</p> <pre><code>select substring_index(group_concat(id order by dateof desc), ',', 1) as id count(*) as CountOfId, max(dateof) as maxdateof from t group by fk; </code></pre> <p>Note: this is limited by the maximum intermediate size for <code>group_concat()</code>. This parameter can be changed and it is typically large enough for this type of query on a moderately sized table.</p> |
26,902,204 | 0 | <p>Try start cmd /k to run the bat in new window. For goto, notice no colon before A. Lastly, your set command as written will include the space. I closed it here.</p> <pre><code>:begin SET /P runscript=[Question Here] if %runscript%==:100 start cmd /k blahblah.bat if %runscript%==EXIT goto A pause </code></pre> |
37,499,139 | 0 | OpenCV 2.4.9 - Traincascade problems <p>I use OSX 10.11. I'm new to opencv and I'm trying to train a simple (and surely weak) cascade classifier to detect an object. I have already read several answers, posts, guide, docs and tutorials about cascade classifier but I have some problems. I referred to this guide:</p> <p><a href="http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html" rel="nofollow noreferrer">guide</a></p> <p>That follow opencv doc. Now I have 8 jpg with my interest object and 249 background images (I know that it's a poor dataset but it's only an attempt).</p> <p>When I call opencv_createsamples I noticed the author of guide generate 1500 samples and also I do it. It means that generate 1500 samples from my 8 positive images?</p> <pre><code>perl bin/createsamples.pl positives.txt negatives.txt samples 1500 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40" </code></pre> <p>Note that in sample folder I have only 7 img*.jpg.vec file. They would not be 1500? After when I call:</p> <pre><code>g++ `pkg-config --libs --cflags opencv` -I. -o mergevec mergevec.cpp cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp cvhaartraining.cpp -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect </code></pre> <p>I have some errors because missing "OpenCL" "AppKit" "QuartzCore" "QTKit" "Cocoa". Where I can retrieve these? However I'm tried to continue and I generate samples.vec file.</p> <pre><code>find ./samples -name '*.vec' > samples.txt ./mergevec samples.txt samples.vec </code></pre> <p>Finally I train my classifier with this code:</p> <pre><code>opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 -numNeg 249 -featureType LBP -w 80 -h 40 -precalcValBufSize 2048 -precalcIdxBufSize 4096 </code></pre> <p>After read some posts I've choosen -numPos smaller than 1500 samples previously generated (but where are they?). When I start the training, the one stuck in this situation:</p> <p><a href="https://i.stack.imgur.com/iYs1D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iYs1D.png" alt="terminal"></a></p> |
7,477,211 | 1 | Using Django Caching with Mod_WSGI <p>Is anyone aware of any issues with Django's caching framework when deployed to Apache/Mod_WSGI?</p> <p>When testing with the caching framework locally with the dev server, using the profiling middleware and either the FileBasedCache or LocMemCache, Django's very fast. My request time goes from ~0.125 sec to ~0.001 sec. Fantastic.</p> <p>I deploy the identical code to a remote machine running Apache/Mod_WSGI and my request time goes from ~0.155 sec (before I deployed the change) to ~.400 sec (post deployment). That's right, caching <strong>slowed everything down</strong>.</p> <p>I've spent hours digging through everything, looking for something I'm missing. I've tried using FileBasedCache with a location on tmpfs, but that also failed to improve performance.</p> <p>I've monitored the remote machine with top, and it shows no other processes and it has 6GB available memory, so basically Django should have full rein. I love Django, but it's incredibly slow, and so far I've never been able to get the caching framework to make any noticeable impact in a production environment. Is there anything I'm missing?</p> <p>EDIT: I've also tried memcached, with the same result. I confirmed memcached was running by telneting into it.</p> |
32,823,450 | 0 | <p>Do it with <code>Java.util.Scanner</code>. Thats a really basic thing in java. I recommend you to do some research :) Here is an easy tutorial on that: <a href="http://www.homeandlearn.co.uk/java/user_input.html" rel="nofollow">http://www.homeandlearn.co.uk/java/user_input.html</a></p> <p>here an answere anyway:</p> <pre><code>public static void main(String[] args){ Scanner user_input = new Scanner( System.in ); String anInputString; anInputString = user_input.next( ); if (anInputString.equals("1 11")){ System.out.println("4") } if (anInputString.equals("11 111"){ System.out.println("34") } } </code></pre> <p>edit: </p> <p>if you want to achieve an output of "4" while your input lies between "1" and "11". Or "34" if its between "10" and "112" you should try this:</p> <pre><code> public static void main(String[] args){ Scanner user_input = new Scanner( System.in ); int anInputInt; anInputInt = user_input.nextInt( ); if (0 < anInputInt && anInputInt < 11 ){ //if input is (1-10) System.out.println("4") } if (11 <= anInputInt && anInputInt <= 111){ //if input is (11-111) System.out.println("34") } } </code></pre> <p>Anyway you should edit your question :D I think many people are happy to help you, but just cant understand your question at all 0.0</p> <p><strong>finally after I understood what you really want to do:</strong></p> <pre><code> public static void main(String[] args){ Scanner user_input = new Scanner( System.in ); int anInputInt; anInputInt = user_input.nextInt( ); if(anInputString < 0){ anInputString = anInputstring*(-1); } int oneCount = 0; //gets all numbers in your specified range //if you want to start at number "xx" change the value of aNumberInRange likewise for (int aNumberInRange = 0; aNumberInRange < anInputInt; aNumberInRange++){ String str = String.valueOf(aNumberInRange); //iterates through every character of an aNumberInRange and counts if a "1" occurs for(int i = 0; i < str.length(); i++){ char c = str.charAt(i); if (c == 1){ oneCount++ } } } system.out.println(oneCount); } </code></pre> <p><strong>For whoever reads this solution. The client wanted to count all the occurences of the number "1" in a specified range. This should also work with negative Numbers</strong></p> |
20,446,616 | 0 | <p>Got it working, when I renamed the id, I forgot to rename the digarm element with the new id. I corrected it. </p> |
25,719,570 | 0 | SpriteKit: Callback after all nodes finished actions <p>Simplified problem (in Swift but I think also in Objective-C): I've got two nodes where actions have started. The information about the initial runtime of the action is not available (got lost). I'd like to be informed <em>after both actions</em> have been performed.</p> <p>After performing additional actions will be assigned according to the current state (which is not available in advance).</p> <p>Any simple solution known?</p> |
26,303,123 | 0 | <p><strong>No</strong>, you don't need to migrate these projects to Apache Flex.</p> <p>Flex 4.6 projects can still be built and deployed; they just don't have the latest SDK changes. Your projects will remain compatible with future Flash Player versions.</p> <p>The only reason to update to Apache Flex at this point is if you need features introduced in a later version of the Flex SDK.</p> |
14,987,510 | 0 | <p>You can import contacts by chunks and validate every record before saving it. Take a look at <a href="https://github.com/tilo/smarter_csv" rel="nofollow">smarter_csv</a> which allow chunk and parallel processing of CSV files.</p> |
21,390,196 | 0 | Detect linux version 5 or 6 <p>I am new to shell script as I do to detect the version of linux? with shell script would detect if the version is 5 or 6 Linux with IF if possible to execute a block of installation.</p> |
24,301,734 | 0 | <p>If you specify context configuration location on your test class, and use spring test runner the context will be cached not reloaded each time.</p> <p>Something like :</p> <pre><code>@RunWith (SpringJUnit4ClassRunner.class) @ContextConfiguration (locations = "classpath:/config/applicationContext-test.xml") @WebAppConfiguration public class MyTest {} </code></pre> |
15,528,539 | 0 | JBoss 7 and Camel 2.11 - BeanManager complaining about "non-portable behaviour" <p>I'm using camel 2.11-SNAPSHOT in an ear which is running on JBoss AS 7.1.</p> <p>When deploying the app and while the routes are being constucted (in a <code>@Singleton</code> <code>@Startup</code> bean, using an <code>@Inject</code>ed CdiCamelContext) i get a lot of warnings (ca. 30) like this in my server log:</p> <pre><code>2013-03-20 16:40:55,153 WARNING [org.apache.deltaspike.core.api.provider.BeanManagerProvider] (MSC service thread 1-2) When using the BeanManager to retrieve Beans before the Container is started, non-portable behaviour results! </code></pre> <p>and after the the context has been started i get this WARNINGs:</p> <pre><code>2013-03-20 16:40:56,339 WARNING [org.apache.deltaspike.core.api.provider.BeanManagerProvider] (Camel (camel-2) thread #1 - file:///tmp/exchange/tmobile/in) When using the BeanManager to retrieve Beans before the Container is started, non-portable behaviour results! </code></pre> <p>What does it mean? I couldn't find anything useful on google. Is it a bug? Did i configure camel wrong?</p> |
11,181,436 | 0 | <p>In case you wont get proper drivers for your tablet you can try adb over network.</p> <ol> <li>Connect your device to wifi as well as your computer.</li> <li>turn on ADB over network in Options for developers (maybe some ROM dont support it). Eventualy you can enable this using specific commands on your tablet.</li> <li>on your computer run terminal and use: <code>adb connect <ip>:<port></code> where <code><ip></code> refers to IP of your tablet and <code><port></code> refers to port on which adb is listening (usually 5555).</li> <li>run <code>adb devices</code> to verify that device is connected</li> </ol> |
746,730 | 0 | <p>Developing UI is time consuming and error-prone because it involves <a href="http://en.wikipedia.org/wiki/Design" rel="nofollow noreferrer">design</a>. Not just visual or sound design, but more importantly interaction design. A good API is always interaction model neutral, meaning it puts minimal constraints on actual workflow, localisation and info representation. The main driver behind this is encapsulation and code re-use.</p> <p>As a result it is impossible to extract enough information from API alone to construct a good user interface tailored to a specific case of API use. </p> <p>However there are UI generators that normally produce <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" rel="nofollow noreferrer">CRUD</a> screens based on a given API. Needless to say that such generated UI's are not very well-suited for frequent users with demands for higher UI efficiency, nor are they particularly easy to learn in case of a larger system since they don't really communicate system image or interaction sequence well.</p> <p>It takes a lot of effort to create a good UI because it needs to be designed according to specific user needs and not because of some mundane API-UI conversion task that can be fully automated. </p> <p>To speed the process of building UI up and mitigate risks it is possible to suggest either involving UI professionals or learning more about the job yourself. Unfortunatelly, there is no shortcut or magic wand, so to speak that will produce a quality UI based entirely and only on an API without lots of additional info and analysis. </p> <p>Please also see an excellent question: "<a href="http://stackoverflow.com/questions/514083/why-is-good-ui-design-so-hard-for-some-developers">Why is good UI design so hard for some developers</a>?" that has some very insightful and valuable answers, specifically:</p> <ul> <li><p>Shameless plug for <a href="http://stackoverflow.com/questions/514083/why-is-good-ui-design-so-hard-for-some-developers/516204#516204">my own answer</a>.</p></li> <li><p><a href="http://stackoverflow.com/questions/514083/why-is-good-ui-design-so-hard-for-some-developers/537490#537490">Great answer</a> by Karl Fast.</p></li> </ul> |
14,601,720 | 0 | Flex/air mobile - Display All mp3 Song From the SD card with id3 info and poster image <p>I am trying to fetch all mp3 songs from SD card . I want only the .mp3 files to be displayed and not any of the folders/ sub folders. I need every mp3 song that exists in SD card and how to get ID3 info from loaded mp3 songs.</p> <p>Your feedback is highly appreciated….</p> |
8,851,986 | 0 | <p>Try the following command:</p> <pre><code>function s:WipeBuffersWithoutFiles() let bufs=filter(range(1, bufnr('$')), 'bufexists(v:val) && '. \'empty(getbufvar(v:val, "&buftype")) && '. \'!filereadable(bufname(v:val))') if !empty(bufs) execute 'bwipeout' join(bufs) endif endfunction command BWnex call s:WipeBuffersWithoutFiles() </code></pre> <p>Usage:</p> <pre><code>:BWnex<CR> </code></pre> <p>Note some tricks:</p> <ul> <li><code>filter(range(1, bufnr('$')), 'bufexists(v:val)')</code> will present you a list of all buffers (buffer numbers) that vim currently has.</li> <li><code>empty(getbufvar(v:val, '&buftype'))</code> checks whether buffer actually should have a file. There are some plugins opening buffers that are never supposed to be represented in filesystem: for example, buffer with a list of currently opened buffers emitted by plugins such as minibufexplorer. These buffers always have <code>&buftype</code> set to something like <code>nofile</code>, normal buffers have empty buftype.</li> </ul> |
26,737,984 | 0 | Zurb foundation grid - repeating columns without row <p>Is it wrong to do it like this?</p> <pre><code><div class="row"> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> </div> </code></pre> <p>Instead of:</p> <pre><code><div class="row"> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> </div> <div class="row"> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> </div> <div class="row"> <div class="medium-6 columns">some content</div> <div class="medium-6 columns">some content</div> </div> </code></pre> <p>From what I can see the result is the same but with less <code>div</code>s.</p> |
8,278,163 | 0 | lightbox is crashing <p>I have several pages made from the a template that has a navigation made with idTabs, in javascript. </p> <p>This is what I have in <code><head></code>:</p> <pre><code> <script type="text/javascript" src="jquery.idTabs.min.js"></script> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/lightbox.js" type="text/javascript"></script> <link href="css/lightbox.css" rel="stylesheet" type="text/css" /> <link href="css/sample_lightbox_layout.css" rel="stylesheet" type="text/css" /> </code></pre> <p>Then in <code><body></code>: </p> <pre><code><div id="poze"> <div id="gallery" class="lbGallery"> <ul> <li> <a href="images/lightboxdemo2.jpg" title=""><img src="images/lightboxdemo_thumb2.jpg" width="72" height="72" alt="Flower" /></a> </li> <li> <a href="images/lightboxdemo5.jpg" title=""><img src="images/lightboxdemo_thumb5.jpg" width="72" height="72" alt="Tree" /></a> </li> </ul> </div> <script type="text/javascript"> // BeginOAWidget_Instance_2127022: #gallery $(function(){ $('#gallery a').lightBox({ imageLoading: '/images/lightbox/lightbox-ico-loading.gif', // (string) Path and the name of the loading icon imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif', // (string) Path and the name of the prev button image imageBtnNext: '/images/lightbox/lightbox-btn-next.gif', // (string) Path and the name of the next button image imageBtnClose: '/images/lightbox/lightbox-btn-close.gif', // (string) Path and the name of the close btn imageBlank: '/images/lightbox/lightbox-blank.gif', // (string) Path and the name of a blank image (one pixel) fixedNavigation: false, // (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface. containerResizeSpeed: 400, // Specify the resize duration of container image. These number are miliseconds. 400 is default. overlayBgColor: "#999999", // (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color. overlayOpacity: .6, // (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9 txtImage: 'Image', //Default text of image txtOf: 'of' }); }); // EndOAWidget_Instance_2127022 </script> </div> </code></pre> <p>The navigation has two links: a <code><div></code> with text, and a <code><div></code> with lightbox gallery. The lightbox is a widget from Dreamweaver.</p> <pre><code><div id="navidtabs"> <ul class="idTabs"> <li><a href="#info">informatii</a></li> <li><a href="#pictures">poze</a></li> </ul> </div> </code></pre> <p>Something unbelievable happens: I apply the template to a new page, make the modifications, save it, load it into the wamp server, switch between the navigation links, test the lightbox, it works! But when I switch for example, to a different page, and return, the lightbox crashes. I can see the pictures, but when I click it opens another page just for the picture. </p> <p>I forgot to say that I have a third <code><div></code> conected into the navigation, a select command to retrieve data from database. The entire file is PHP.</p> <p>What can I do to mantain the lightbox effect?</p> |
25,891,688 | 0 | <p>Try re-writing your query to:</p> <pre><code>$name = trim($form_state['values']['name']); $formwem = $form_state['values']['settings']['active']; $result = db_query("INSERT INTO twittername (name, Blogurt, Twitter_name) VALUES (':name',':blogurt',':twitter_name')", array(':name' => $name, ':blogurt' => $formwem, ':twitter_name' => $formwem)); </code></pre> <p>Though I'm not sure which form field populates the two columns <code>Blogurt</code> and <code>Twitter_name</code>. Can you please explain?</p> |
16,521,763 | 0 | <p>Don't rely on order by when using mutlirows variable assignment.</p> <p>try this for instance:</p> <pre><code>DECLARE @c INT = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND 3 ORDER BY 1 - x DESC SELECT @c SET @c = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND 3 ORDER BY x DESC SELECT @c </code></pre> <p><a href="http://sqlmag.com/sql-server/multi-row-variable-assignment-and-order" rel="nofollow">http://sqlmag.com/sql-server/multi-row-variable-assignment-and-order</a></p> |
15,339,179 | 0 | <p>I guess, at runtime, container method calls are just resolved in the private Empty class, which makes your code fail. As far as I know, dynamic can not be used to access private members (or public members of private class)</p> <p>This should (of course) work :</p> <pre><code>var num0 = ((IContainer)container).Value; </code></pre> <p>Here, it is class Empty which is private : so you can not manipulate Empty instances outside of the declaring class (factory). That's why your code fails.</p> <p>If Empty were internal, you would be able to manipulate its instances accross the whole assembly, (well, not really because Factory is private) making all dynamic calls allowed, and your code work.</p> |
37,359,579 | 0 | append value to textbox on changing dynamic selectbox <p>I have created a dynamic bootstrap form. Input field is being created by clicking 'add field' button. now am trying to get value of select box into respective textbox in same parent div. but i failed to do so. my code is below:</p> <pre><code><div class="input_fields_wrap_credit "> <div class="form-group"> <h3>Credit / Deposit <a href="#add_credit_control" class="add-btn pull-right add_credit_field_button"><i class="fa fa-plus-circle"></i> add credit field</a></h3> </div> <!-- /form-group --> <div class="form-group"> <div class="form-input col-md-2"> <input id="cr_ac_no" name="cr_ac_no[]" type="text" placeholder="Account no." class="form-control input-sm" required="" value=""> </div> <div class="form-input col-md-6 col-xs-12 "> <select name="cr_gl_head[]" class="form-control cr_gl_head"><?=$accounts->GET_CHART_OF_AC()?></select> </div> <!-- /controls --> <div class="form-input col-md-3 col-xs-12 "> <input type="text" name="cr_amount[]" class="form-control cr_amt" maxlength="10" placeholder="Amount"> </div> <!-- /controls --> <a href="#" class="remove_field"><i class="fa fa-remove"></i></a> </div><!--form-group --> </div> </code></pre> <p>JQUERY:</p> <pre><code><!--credit --> <script type="text/javascript"> $(document).ready(function() { var max_fields = 10; //maximum input boxes allowed var wrapper = $(".input_fields_wrap_credit"); //Fields wrapper var add_button = $(".add_credit_field_button"); //Add button ID var y = 1; //initlal text box count $(wrapper).on('click','.add_credit_field_button',function(e){ //on add input button click e.preventDefault(); if(y < max_fields){ //max input box allowed y++; //text box increment $(wrapper).append('<div class="form-group"><div class="form-input col-md-2"><input id="cr_ac_no" name="cr_ac_no[]" type="text" placeholder="Account no." class="form-control input-sm" required="" value=""></div><div class="form-input col-md-6 col-xs-12 "><select name="cr_gl_head[]" class="form-control cr_gl_head"><?=$accounts->GET_CHART_OF_AC()?></select></div> <!-- /controls --> <div class="form-input col-md-3 col-xs-12 "><input type="text" name="cr_amount[]" class="form-control cr_amt" maxlength="10" placeholder="Amount"></div> <!-- /controls --><a href="#" class="remove_field"><i class="fa fa-remove"></i></a></div><!--form-group -->'); //add input box $('#num_cr').val(y); //number of credit field }else{ alert('Maximum allowed 10 fields.'); } }); $(wrapper).on("click",".remove_field", function(e){ //user click on remove text e.preventDefault(); $(this).parent('div').remove(); y--; }) }); </script> //append ac no. to text box <script type="text/javascript"> $(document).ready(function() { var wrapper = $(".input_fields_wrap_credit"); //Fields wrapper $(wrapper).on("change",".cr_gl_head", function(e){ //user click on remove text e.preventDefault(); var ac_no = $(this).val(); var txt = $(this).parent('div').find('#cr_ac_no').val(ac_no); }); }); </script> </code></pre> <p>Any help please?</p> |
25,142,740 | 0 | jQuery alert text in option from select tag <p>I have a select code with two option. Is there a way I can use jQuery to alert me the text within the option tag of the option I have selected? Currently I have option two selected so when I use the code below it comes back as "5". I need it to come back as "Option 2".</p> <pre><code>alert (jQuery('#bw_status').val()); </code></pre> <p>The code below is the example code I am using.</p> <pre><code><select id="bw_status"> <option value="7">Option 1</option> <option value="5">Option 2</option> </select> </code></pre> |
6,034,938 | 0 | <p>I'm not sure if this will solve your problem, but don't use == for string comparisons. Use the <code>compare:</code> method of the <code>NSString</code> class.</p> <pre><code>if ([myNSStringObject compare:anotherNSStringObject] == NSOrderedSame) { //proceed with processing based on resultant matched strings } else { //proceed with processing based on resultant non-matched strings } </code></pre> <p>Not sure if this will make a difference, but as your program becomes more complex, you might run into trouble not doing it this way.</p> |
1,863,293 | 0 | <p>I don't think xpath works with SAX, but you might take a look at StAX which is an extended streaming XML API for Java.</p> <p><a href="http://en.wikipedia.org/wiki/StAX" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/StAX</a></p> |
34,492,246 | 0 | Methods for Linear system solution with matlab <p>I have a linear system Ax = b , which is created by natural splines and looks like this: </p> <p><a href="https://i.stack.imgur.com/ElFVj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ElFVj.png" alt="enter image description here"></a></p> <p>where <a href="https://i.stack.imgur.com/bx0PX.gif" rel="nofollow noreferrer"> <img src="https://i.stack.imgur.com/bx0PX.gif" alt=" enter image description here"></a></p> <p>The code in matlab which is supposed to solve the system is the following: </p> <pre><code> clear; clc; x = [...] ; a = [...]; x0 = ...; n = length(x) - 1 ; for i = 0 : (n-1) h(i+1) = x(i+2) - x(i+1) ; end b= zeros( n+1 , 1 ) ; for i =2: n b(i,1) = 3 *(a(i+1)-a(i))/h(i) - 3/h(i-1)*(a(i) - a(i-1) ) ; end %linear system solution. l(1) =0 ; m(1) = 0 ; z(1) = 0 ; for i =1:(n-1) l(i+1) = 2*( x(i+2) - x(i) ) - h(i)* m(i) ; m(i+1) = h(i+1)/l(i+1); z(i+1) = ( b(i+1) - h(i)*z(i) ) / l ( i+1) ; end l(n+1) =1; z(n+1) = 0 ; c(n+1) = 0 ; for j = ( n-1) : (-1) : 0 c(j+1) = z(j+1) - m(j+1)*c(j+2) ; end </code></pre> <p>but I can't understand which method is being used for solving the linear system. If I had to guess I would say that the LU method is used, adjusted for tridiagonal matrices, but I still can't find the connection with the code...</p> <p>Any help would be appreciated!!!</p> |
16,033,371 | 0 | Zope (ZPT) overlapping tags <p>I try to create an open <code>div</code> tag condition and close a <code>div</code> tag in another condition with TAL in a Zope Page Template but I'm not allowed to overlap tags.</p> <p>Here is my code :</p> <pre><code><div id="notaccordion"> <tal:x repeat="item python:range(26)"> <tal:x define="global block_name python:current.values()[0]['block_name']"> <tal:x condition="python:isDone"> </div> </tal:x> <tal:x condition="python:not isDone"> <tal:x replace="python:block_name"> </tal:x> <div> </tal:x> </tal:x> </tal:x> </div> </code></pre> <p>The important part is:</p> <pre><code> <tal:x condition="python:isDone"> </div> </tal:x> </code></pre> <p>And here is the error.</p> <pre><code>Compilation failed zope.tal.taldefs.TALError: TAL attributes on <tal:x> require explicit </tal:x> </code></pre> <p>I tried with a Python script but it didn't work either.</p> <pre><code><div id="notaccordion"> <tal:x repeat="item python:range(26)"> <tal:x define="global block_name python:current.values()[0]['block_name']"> <tal:x condition="python:isDone"> <tal:x content="python:context[close_div]()"> </tal:x> </tal:x> <tal:x condition="python:not isDone"> <tal:x replace="python:block_name"> </tal:x> <tal:x content="python:context[open_div]()"> </tal:x> </tal:x> </tal:x> </tal:x> </div> </code></pre> <p>With <code>close_div</code> script:</p> <pre><code>print '</div>' return printed </code></pre> <p>It returns <code>&lt;/div&gt;</code> instead of <code></div></code></p> <p>If you wonder why I'm doing it. I have a tree structure that I need to display. Since I (think I) can't do it recursively, I try to emulate it using a LIFO list. And <code>current</code> is my current node.</p> <p>I try to achieve this (node is dict of dict... used as a tree) :</p> <pre><code>lifo = list() lifo.append([node, False]) while lifo: current, isDone = lifo[-1] block = current.keys()[0] if isDone: print '</div>' lifo.pop() else: lifo[-1][1] = True print '<div>' print block children = current[block].get('children', {}) if children: for childBlock, childValue in children.items(): lifo.append([{childBlock:childValue}, False]) </code></pre> <p>Any help or suggestion is appreciated</p> |
2,050,207 | 0 | Is there a limit for the total variables size on the stack? <p>While coding should we consider some limit on the total size of variables created on the stack? If yes, on what basis should we decide it? Is it dependent on OS, Memory Availability etc? Are there any compiler options which can check this?</p> <p>Any pointers in the direction will also be helpful.</p> |
9,975,436 | 0 | <p>On a second reading, I think I misunderstood your question, so here's an updated version:</p> <p><a href="http://jsfiddle.net/HSMfR/4/">http://jsfiddle.net/HSMfR/4/</a></p> <pre><code>$(function () { var $canvas = $('#canvas'), ctx = $canvas[0].getContext('2d'), offset = $canvas.offset(), draw, handle; handle = { color: '#666', dim: { w: 20, h: canvas.height }, pos: { x: 0, y: 0 } }; $canvas.on({ 'mousedown.slider': function (evt) { var grabOffset = { x: evt.pageX - offset.left - handle.pos.x, y: evt.pageY - offset.top - handle.pos.y }; // simple hit test if ( grabOffset.x >= 0 && grabOffset.x <= handle.dim.w && grabOffset.y >= 0 && grabOffset.x <= handle.dim.h ) { $(document).on({ 'mousemove.slider': function (evt) { handle.pos.x = evt.pageX - offset.left - grabOffset.x; // prevent dragging out of canvas if (handle.pos.x < 0) { handle.pos.x = 0; } if (handle.pos.x + handle.dim.w > canvas.width) { handle.pos.x = canvas.width - handle.dim.w; } //handle.pos.y = evt.pageY - offset.top - grabOffset.y; }, 'mouseup.slider': function () { $(document).off('.slider'); } }); } } }); draw = function() { var val = (100 * (handle.pos.x / (canvas.width - handle.dim.w))).toFixed(2) + '%'; ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.fillStyle = handle.color; ctx.fillRect(handle.pos.x, handle.pos.y, handle.dim.w, handle.dim.h); ctx.textBaseline = 'hanging'; ctx.font = '12px Verdana'; ctx.fillStyle = '#333'; ctx.fillText(val, 4, 4); ctx.fillStyle = '#fff'; ctx.fillText(val, 3, 3); }; setInterval(draw, 16); }); </code></pre> <hr> <p><strong>prev version</strong>:</p> <p>Very simple solution to extend upon:</p> <p><a href="http://jsfiddle.net/HSMfR/">http://jsfiddle.net/HSMfR/</a></p> <pre><code>$(function () { var ctx = $('#canvas')[0].getContext('2d'), $pos = $('#pos'), draw; draw = function() { var x = ($pos.val() / 100) * (ctx.canvas.width - 20); ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.fillStyle = 'black'; ctx.fillRect(x, 0, 20, 20); }; setInterval(draw, 40); }); </code></pre> |
13,724,727 | 0 | <p>I suggest you inverse the logic:</p> <pre><code>sub vcl_recv { if (req.url ~ "(?i)force=(true|yes)") { return(pass); } // other values will fall through to the safe default VCL that will do return(lookup). } </code></pre> |
10,076,817 | 0 | <p>The answer is here: <a href="http://www.utteraccess.com/forum/Append-Query-Selects-L-t1984607.html" rel="nofollow">http://www.utteraccess.com/forum/Append-Query-Selects-L-t1984607.html</a></p> |
27,716,571 | 0 | <p>Is your page rendered inside of a frame? A frame by default supports Navigation. If this is the case you have to set the navigation visibility property of the frame control to hidden.</p> <pre><code><Frame Name="Frame1" NavigationUIVisibility="Hidden" > </code></pre> |
17,995,653 | 0 | <p>Build your query like this:</p> <pre><code> string query = string.empty query += "select "; if (CheckBoxList1[0].Selected) { query += "first_column, "; }//and so on query += " from tblProject"; </code></pre> |
26,456,812 | 0 | <p>You can do this using <code>void</code> pointer:</p> <pre><code>void *ptr = str; uint8_t version = *(uint8_t*)ptr; ptr = *(uint8_t*)ptr + 1; uint16_t type = *(uint16_t*)ptr; ptr = *(uint16_t*)ptr + 1; uint16_t program = *(uint16_t*)ptr; ptr = *(uint16_t*)ptr + 1; </code></pre> <p>Writing this variables to <code>char* string</code> you can perform in the same way (using void pointer).</p> |
39,568,911 | 0 | Laravel simple relation between models return null <p>In my database I have <code>users</code> and <code>tickets</code> table. Now I want to create simple relation between theme, in <code>phpmyadmin</code> relation created between <code>tickets.userId</code> and <code>users.id</code>, now I wrote some functions on models:</p> <p>User model:</p> <pre><code>public function tickets() { return $this->hasMany('App\Tickets'); } </code></pre> <p>Tickets model:</p> <pre><code>public function user() { return $this->belongsTo('App\User'); } </code></pre> <p>This code as <code>dd(\App\Tickets::with('user')->get());</code> return null on relation result, for example:</p> <pre><code>0 => Tickets {#209 ▼ #table: "tickets" #connection: null #primaryKey: "id" #keyType: "int" #perPage: 15 +incrementing: true +timestamps: true #attributes: array:9 [▶] #original: array:9 [▶] #relations: array:1 [▼ "user" => null ] </code></pre> |
32,152,833 | 0 | <p>Here is an example fiddle for your requirement </p> <pre> http://jsfiddle.net/SantoshPandu/v8z9mm5p/ </pre> |
26,852,020 | 0 | <p>Just set</p> <pre><code>[[GAI sharedInstance] setDryRun:NO]; </code></pre> |
37,854,210 | 0 | <p>tyr only one line add in below:</p> <pre><code>func textFieldDidBeginEditing(textField: UITextField) { if textField == userNameTextField { textField.resignFirstResponder() // this line add pickerUser.hidden = false print("userNameTextField") } else { pickerUser.hidden = true print("@userPasswordTextField") } } </code></pre> |
39,691,033 | 0 | <p>it print GMT+02 because this is your "local" timezone. if you want to print the date without timezone information, use SimpleDateFormat to format the date to you liking.</p> <p>edit : adding the code example (with your variable 'myDate')</p> <pre><code>SimpleDateFormat inputSDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); inputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); Date myDate = inputSDF.parse("2016-09-25 17:26:12"); // SimpleDateFormat outputSDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println(outputSDF.format(myDate)); System.out.println(TimeZone.getDefault().getID()); </code></pre> <p>yield on the (my) console (with my local timezone).</p> <pre><code>2016-09-25 19:26:12 Europe/Paris </code></pre> |
9,657,721 | 0 | Send an oobject from activity to fragment <p>I have an object in my main activity that stores a bunch of data from an XML document and I want to be able to access that information on several different fragments to display the information. How can I go about doing that</p> |
22,148,756 | 0 | <p>If you posted your code it would be easier to help you, but heres the general idea. Just listen on the <code>itemClick</code> event, then fire the play button for that ListItem:</p> <pre><code>// Keep an array of video players or something like that var vidPlayersRefs = [...,...,...]; listView.addEventListener('itemclick', function(e){ // Get the video player for that row var videoPlayer = vidPlayersRefs[e.itemIndex]; videoPlayer.open(); }); </code></pre> |
9,007,058 | 0 | <p>yes, Cairo is a high quality 2D drawing API, and GTK+ uses Cairo to draw itself.</p> <p>Cogl is a GPU programming library that internally can use GL or GLES to access the graphics pipeline (though in theory it could as easily use DirectX on supported platforms).</p> <p>Clutter uses Cogl for rendering, but it can also use Cairo for 2D elements.</p> <p>Clutter will not replace GTK+: GTK+ is a very complex library that provides system integration, complex widgets, and other utility API that Clutter has no interest in providing.</p> <p>the future is going to be a bit more gray than a black-and-white replacement.</p> <p>Cairo can use Cogl to draw; Cogl will program the GPU pipeline, but Cairo will generate the geometry to be submitted, so you can have high quality 2D results. Cairo already can use GL directly, but Cogl has a better state tracking already.</p> <p>Clutter can use GDK, the GTK+ windowing system API, to talk to the windowing system surfaces and get input events.</p> <p>in the future, it's entirely possible that GTK+ will use Clutter internally as the base for its widgets - though that's still a work in progress.</p> <p>in short, a diagram could be:</p> <pre><code> GPU <- [ [ Cogl + Cairo ] <- [ GDK + Clutter ] <- GTK+ ] <- application </code></pre> |
33,996,109 | 0 | <p><a href="http://lookup.computerlanguage.com/host_app/search?cid=C999999&def=696d7065726174697665206c616e6775616765.htm" rel="nofollow"><strong>Imperative programming</strong></a><br> A programming language that requires programming discipline such as C/C++, Java, COBOL, FORTRAN, Perl and JavaScript. Programmers writing in such languages must develop a proper order of actions in order to solve the problem, based on a knowledge of data processing and programming.</p> <p><a href="http://lookup.computerlanguage.com/host_app/search?cid=C999999&def=6e6f6e2d70726f6365647572616c206c616e6775616765.htm" rel="nofollow"><strong>Declarative programming</strong></a><br> A computer language that does not require writing traditional programming logic; Users concentrate on defining the input and output rather than the program steps required in a procedural programming language such as C++ or Java. </p> <p>Declarative programming examples are CSS, HTML, XML, XSLT, RegX.</p> |
31,754,823 | 0 | <p>You need to use the bodyparser middleware:</p> <pre><code>var bodyParser = require('body-parser'); </code></pre> <p>and then</p> <pre><code>app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); </code></pre> |
40,158,302 | 0 | <p>With flat product enabled, you'd better use</p> <pre><code>$collection = Mage::getResourceModel('catalog/product_collection') </code></pre> <p>You will be able to retrieve disabled and enabled products.</p> <p>See this answer for a better explanation: <a href="http://magento.stackexchange.com/a/40001/32179">http://magento.stackexchange.com/a/40001/32179</a></p> |
2,558,144 | 0 | <p>What's the difference between <code><!-- $title --></code> and <code><!-- header() --></code>?<br> Why not to make it the same style and then just do <code><!-- $header --></code> simple str_replace?</p> |
6,156,611 | 0 | <p>You're building a <a href="http://www.sommarskog.se/dyn-search-2008.html" rel="nofollow">dynamic search condition</a>. By forcing one single statement to cover <em>both</em> cases you are cutting the optimizer options. The generated plan has to work in <em>both</em> cases when <code>@seconds</code> is null and when is not null. You'll be much better using two separate statement:</p> <pre><code>IF @SECOND IS NULL THEN SELECT * FROM BANK_DETAIL WHERE X = @FIRST ORDER BY X ELSE SELECT * FROM BANK_DETAIL WHERE X >= @FIRST AND X <= @SECOND ORDER BY X </code></pre> <p>You intuition to 'simplify' into one single statement is leading you down the wrong path. The result is less text, but much more execution time due to suboptimal plans. The article linked at the beginning of my response goes into great detail on this topic.</p> |
37,373,524 | 0 | nsupdate in basic CSH script for BIND in unix <p><br/> I have never used C and I'm not writing this for security reasons, i am just writing this script to test an update via nsupdate to my BIND for a specific zone being "zoneA.unix". But i am receiving "option: undefined variable" <br> And I'm not to sure if this is the correct way to do nsupdate via a user's inputs.</p> <pre><code>echo "First of all we need to grab your username:" set uname = $< if ($uname == "zoneA")then echo "password: " set passwd = $< if ($passwd == "Azone")then echo "you are in" echo "now to do the nsupdate" echo "do you wish to (A)dd or (D)elete a record" set numeric = $< if ($numeric == "A")then $option = "add" $testinga = "add" else if($numeric == "D")then $option = "delete" $testinga = "delete" endif echo "what to $testinga to the zone zoneA.unix?" set innerzonename = $< nsupdate -k /usr/local/etc/namedb/Keys/Kzonea.+157+57916.key -v debug yes zone zonea.unix update $testinga $innerzonename 86400 A 127.0.0.1 show echo "is this correct (Y)es (n)" set sendoff = $< if($sendoff == "Y")then send else if ($sendoff == "N")then quit endif </code></pre> <p>So the code works fine til the $option part and I'm not to sure if it will work after the input needed during the nsupdate because it won't pause it, well i don't know how i can pause it.<br><br> What it seems to be doing is running nsupdate and waiting until nsupdate is finished. anyway i can pass them into it?</p> |
17,492,629 | 0 | <p>The reason the double click event doesn't work on newly added rows is because you are binding the click event before the elements exist. Try binding with this style (event delegation is the term):</p> <pre><code>$("#datatable").on("dblclick", "td", function() { //do stuff }); </code></pre> <p>As per adding a <code>tbody</code> when one is not present, simply do a check to see if one exists:</p> <pre><code>if ($("#datatable tbody").length) { //it exists! } else { //it doesnt exist! } </code></pre> |
2,097,170 | 0 | Why does my CLR function keep disappearing <p>I am a rookie to SQL and here is my questions.</p> <p>I have some CLR sql functions and procedures. When I deploy the 1st one, everything is fine. But after the 2nd one deployed, the first one will disappear.</p> <p>Anyone can help me out?</p> <p>Thanks a lot </p> <hr> <p>Actually, I simply create a new SQL project in VS, adding a new function or stored procedure, click deploy, and I can see the new function in my SQL instance. Then I close that project and open a new one, repeat the above steps, OK, the 2nd function is there i my instance but the 1st one disappeared or be replaced and no longer queryable for use.</p> <hr> <p>Thank you for your reply.</p> <p>All these clr functions and procedures are in the same instance of the database.</p> |
7,186,633 | 0 | <p>I would also propose <strong>Solution 4</strong>: write a code generation tool. </p> <p>Pros:</p> <ul> <li>result is a clean debuggable code;</li> <li>unlimited configurability to your needs (if you have time of course);</li> <li>long-term investment to a dev's toolset.</li> </ul> <p>Cons:</p> <ul> <li>takes some time, esp. at start, not always sutable for write-once code;</li> <li>complicates build process a bit.</li> </ul> |
32,587,201 | 0 | <p>Instead of using 2 nested loops, convert <code>$scope.userList</code> into an object that has the <code>userID</code> as the key. Then you can loop through your <code>userID</code> array and quickly check if a user with the same key exists in your new object.</p> <p>By removing the nested loops, the code below runs in linear time instead of n^2, which is beneficial if you have large arrays. And if you store <code>$scope.userList</code> as an object that's keyed by its <code>userId</code>, then you can save even more time by not having to create the index each time the function is run.</p> <pre><code>$scope.userInfo = function(userID) { var userList = {}; //create object keyed by user_id for(var i=0;i<$scope.userList.length;i++) { userList[$scope.userList._id] = $scope.userList; } //now for each item in userID, see if an element exists //with the same key in userList created above var userDetails = []; for(i=0;i<userID.length;i++) { if(userID[i] in userList) { userDetails.push(userList[userID[i]]); } } return userDetails; }; </code></pre> |
2,372,641 | 0 | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.read.aspx" rel="nofollow noreferrer"><code>SqlDataReader.Read</code></a> method:</p> <pre><code>while (sqlDREmailAddr.Read()) { ... // Assumes only one column is returned with the email address strEmailAddress = sqlDREmailAddr.GetString(0); } </code></pre> |
39,540,091 | 0 | Android Device Monitor's View Hierarchy dump different than appears on device? <p>I am troubleshooting the background colour of a <code>WebView</code>, and changes just weren't appearing on the device I was testing on via USB. </p> <ul> <li><p>I went into <code>Android Device Monitor</code> and got a dump of the view hierarchy, which gave me a snapshot.</p></li> <li><p>The snapshot displayed the behaviour I had been trying to render on the phone but still won't show up on the actual device.</p></li> </ul> <p>Is this typical behaviour? If so, what's the method to use this to find the view causing me the trouble? </p> |
20,331,055 | 0 | How to open a assetportalbrowser in SharePoint 2010 <p>How to use a assetportalbrowser in SharePoint 2010 to attach an existing document in another list?</p> <p>What I tried so far:</p> <pre><code>function InitiateAssetPickerPopUp() { var context = new SP.ClientContext.get_current(); this.Web = context.get_web(); context.load(this.Web); context.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFail)); } function onSuccess(sender, args) { var options = { title: 'My Dialog', width: 500, height: 600, showClose: false, url: _spPageContextInfo.siteServerRelativeUrl + '/_layouts/AssetPortalBrowser.aspx?&AssetUrl=' + _spPageContextInfo.siteServerRelativeUrl + '& RootFolder=' + _spPageContextInfo.siteServerRelativeUrl + '&MDWeb=' + this.Web.get_id() + '&AssetType=Link', dialogReturnValueCallback: function(dialogResult) { alert(dialogResult); } }; SP.UI.ModalDialog.showModalDialog(options); } function onFail(sender, args) { alert('Failed:' + args.get_message()); } </code></pre> <p>But it does not open the popup?!</p> |
28,527,224 | 0 | <p>You're trying this with a content script.</p> <p>Content scripts have a <a href="https://developer.chrome.com/extensions/content_scripts#run_at" rel="nofollow"><code>run_at</code> parameter</a>, which indicates when (relative to page loading) they execute.</p> <p>By default, content scripts run at <code>document_idle</code> level: Chrome waits until the page has completely loaded before executing it.</p> <p>You have two options:</p> <ul> <li><p>You can keep the content script route, but you need to indicate <code>"run_at" : "document_start"</code> parameter in the content script configuration.</p> <p>This will execute your code as soon as possible (before the document is loaded, but after the response is started).</p></li> <li><p>If you're concerned about not loading the page at all (not sending a request to the site), you need to intercept it at a lower level. <a href="https://developer.chrome.com/extensions/webRequest" rel="nofollow"><code>webRequest</code> API</a> can provide the means to do that.</p> <p>If you catch the request at <code>onBeforeRequest</code> event, you can redirect it before it is even sent. Filtering by type is recommended. Note that you won't even need a content script in this case: <code>webRequest</code> events need to be listened to in a background script.</p> <p>See the <a href="https://developer.chrome.com/extensions/samples#catblock" rel="nofollow">CatBlock example</a>.</p></li> </ul> |
17,571,703 | 0 | <p>This will be faster:</p> <pre><code>DELETE B FROM table1 a LEFT OUTER JOIN table2 b ON a.table2id = b.id WHERE b.id IS null </code></pre> |
4,913,700 | 0 | Serialization is the process by which data-structures are converted into a format that can be easily stored or transmitted and subsequently reconstructed. |
38,368,108 | 0 | @beforeClass annotation on Laravel testcase method ignored <p>In my Laravel 5.1 app's base TestCase which extends <code>Illuminate\Foundation\Testing\TestCase</code> I have this method:</p> <pre><code>/** * @beforeClass */ public function resetDatabase() { echo "I never see this message\n"; $this->artisan("migrate:refresh"); } </code></pre> <p>Other @before and @after annotations in that class is honoured as advertised. Why is this method not called in my unit tests?</p> |
3,969,464 | 0 | <blockquote> <p>Audiogram is a constructor and seriesColors are not used apart from this method</p> </blockquote> <p>Assuming that your statement is accurate, and assuming that you posted the entire constructor, the <code>seriesColors</code> attribute (static or not) serves no useful purpose whatsoever. </p> <p>If this is the case, the then fix for the memory leak is to simply <strong>remove</strong> the <code>seriesColors</code> declaration from your code, as follows:</p> <pre><code>// static private ArrayList seriesColors = new ArrayList(); <<<=== remove this line public Audiogram(int widthParm, int heightParm) throws Exception { super(widthParm, heightParm); // seriesColors.add(new Color(0, 0, 255)); <<<=== remove this line // Set the default settings to an industrial audiogram setType(INDUSTRIAL_AUDIOGRAM); } </code></pre> <p>However, I suspect that this is not the whole story ...</p> <p><strong>EDIT</strong></p> <p>Comment out those two lines as indicated. If the code compiles with those two lines commented out, then they are definitely redundant.</p> <p>However, it strikes me that your knowledge of Java must be close to zero. If this is the case, you should NOT be trying to clean up memory leaks and the like in other peoples' code. Learn some Java first.</p> |
10,587,165 | 0 | <p>Note: Providing this answer to move the OP's comment to answer.</p> <p>The problem was that the C++ program was running the native launcher with the <code>-Djava.compiler=NONE</code> setting, which essentially set the JVM to run in "interpretive" mode, disabling JIT (just-in-time) compilation of java bytecode to native code, which naturally makes run slower as the bytecode needs to be interpreted every time it is executed.</p> |
6,665,537 | 0 | <p>Mr. Vale is right. I'll bet you have a quote in Student.AbsensceDescription. You should get into the habit of using stored procedures or at least parameterized queries.</p> |
29,954,001 | 0 | JPQL for a Unidirectional OneToMany <p>I need a jpql query for my Spring repository interface method, to retrieve all Posts for a given Semester.</p> <pre><code>@LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.MERGE) @JoinTable ( name = "semester_post", joinColumns = {@JoinColumn(name = "semester_id", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "post_id", referencedColumnName = "id", unique = true)} ) private List<PostEntity<?>> posts = new ArrayList<>(); </code></pre> <p>PostEntity doesn't have a reference to Semester, and I do not want to add one, because I plan to use this PostEntity for other things than Semester. Maybe I'll have another class (let's say Group) which will also have a OneToMany of PostEntity (like the one in Semester)</p> <p><strong>So, how do I write this SQL query as a JPQL one ?</strong></p> <pre><code>select * from posts join semester_post on semester_post.post_id = posts.id where semester_post.semester_id = 1; </code></pre> <p>My repository</p> <pre><code>public interface PostRepository extends JpaRepository<PostEntity, Long> { String QUERY = "SELECT p FROM PostEntity p ... where semester = :semesterId"; @Query(MY_QUERY) public List<PostEntity> findBySemesterOrderByModifiedDateDesc(@Param("semesterId") Long semesterId); </code></pre> |
32,369,297 | 0 | Failed to load resource: the server responded with a status of 500 (Internal Server Error).Only in server I am getting <p>Below is my code, which handler is called. If I try to call it is throwing error. </p> <pre><code>$.ajaxFileUpload({ url: '../HttpHandler/AjaxFileUploader.ashx', //handler secureuri: false, fileElementId: id, dataType: 'json', data: { name: 'logan', id: 'id' }, responseType: 'json', success: function (data, status) { if (typeof (data.error) != 'undefined') { if (data.error != '') { alert(id) alert(data.error); } else { alert("File Uploaded Successfully"); } } }, error: function (data, status, e) { alert(e); } }); </code></pre> |
37,382,425 | 0 | <p>If I understand your question correctly, then maybe try something like this:</p> <p>First create a "dummy" config file in a directory that you will map as a volume</p> <pre><code>mkdir mapdir touch mapdir/myconfig.cfg </code></pre> <p>In your <code>Dockerfile</code> you'll do what you need to do with that config file. Maybe as part of a <code>CMD</code> clause</p> <pre><code>FROM ... RUN ... CMD ["sed", "<editstuff>, "mapdir/myconfig.cfg" ] </code></pre> <p>Then build and run your container</p> <pre><code>docker build . docker run --name mycontainer -v mapdir:mapdir ... </code></pre> <p>It's still a strange approach, but if you absolute can only change the config file from <em>within</em> your container, give this a go.</p> |
35,811,149 | 0 | Codeigniter 3x Query Builder class seems to be generating extra segments to my query <p>I am using the latest version of the Codeigniter framework for PHP. Here is my code.</p> <pre><code>public function get_user_by_username( $username ) { $this->db->where( 'username', strtolower( $username ) ); $q = $this->db->get( 'users', 1 ); foreach( $q->result() as $row ) { return $row; } return NULL } </code></pre> <p>I called the <strong>last_query()</strong> method to get the query that was generating the problem and this pops up messing up the entire query. I didn't code this. Codeigniter is generating this on its own.</p> <pre><code>SELECT * FROM `users` WHERE `serial` IS NULL AND `password` IS NULL AND `username` = '[username]' LIMIT 1 </code></pre> <p>I need Codeigniter to generate this instead as I expected.</p> <pre><code>SELECT * FROM `users` WHERE `username` = '[username]' LIMIT 1 </code></pre> <p>I'm just now starting to code with Codeigniter 3x after using version 2x for the last couple of years. Thanks in advance.</p> |
19,513,018 | 0 | how to Device test Android 2.3.5 where is Developer option? <p>sorry, I'm little speak english..</p> <p>How to device test Android 2.3.5??? Where is Developer option? I do not know where the developer option button.</p> |
32,027,796 | 0 | Ebay Shop Template - 'Other Items' Link Randomly Appearing/Disappearing? <p>I've been trying to make a custom Ebay shop template for the first time using my own CSS.</p> <p>I've been editing the Ebay classes and adding my own and everything seemed fine.</p> <p>However I've now noticed that in my sidebar where it shows the categories the 'Other' link keeps appearing/disappearing when refreshing the page. It is located underneath 'Baby Products'. If I refresh it one time it appears and then another it's not there. I can't figure out why.</p> <p>It can sometimes take me 8-10 refreshes and it will then suddenly appear again.</p> <p>I tried removing all my custom HTML/CSS thinking I might be messing up Ebay's styling or something and it still it continues to do it.</p> <p>Anyone else had this problem or have any idea why it is happening?</p> <p>Here's the link to the shop:</p> <p><a href="http://stores.ebay.co.uk/ecommerce-hq-store" rel="nofollow">http://stores.ebay.co.uk/ecommerce-hq-store</a></p> <p>Cheers Joe :)</p> |
17,309,715 | 0 | <p>I fixed the issue. By setting $cfg['DefaultDisplay'] = 'horizontal'; in the config.inc.php the view will change once you restart your apache server, and refresh your cache (best method is to logout and log back in).</p> |
6,697,575 | 0 | <p>It makes no sense to clear the buffer.</p> <p>If it were an output buffer e.g. BufferedWriter, then you could flush the buffer to make sure that all buffered content has been written before closing the buffer.<br> In this case you can just close the buffer, after br.readLine() returns null, which means that there is no more input to be read.</p> |
14,962,572 | 0 | <p>Jupiter is a code review plug-in tool for the Eclipse IDE. It is currently under active development, and still in an experimental state. The design of Jupiter involves the following:</p> <ol> <li><p>Open Source: Jupiter carries an open source license.</p></li> <li><p>Free: Jupiter is distributed free of charge.</p></li> <li><p>IDE integration: Jupiter is based upon the Eclipse plug-in architecture.</p></li> <li><p>Cross-platform: Jupiter is available for all platforms supported by Eclipse.</p></li> <li><p>XML data storage: Jupiter stores data in XML format to simplify use and re-use.</p></li> <li><p>Sorting and searching: Jupiter provides filters and sorting to facilitate issue review.</p></li> <li><p>File integration: Jupiter supports jumping back and forth between reviews and source code.</p></li> </ol> <p><a href="http://code.google.com/p/jupiter-eclipse-plugin/" rel="nofollow">http://code.google.com/p/jupiter-eclipse-plugin/</a></p> <p>Or</p> <p><a href="https://github.com/rombert/ereviewboard" rel="nofollow">https://github.com/rombert/ereviewboard</a></p> |
3,588,080 | 0 | <p>I have yet to find any good definitive guides out there.... I usually end up going and looking at the developer blogs of the Adobe staff at <a href="http://www.adobe.com/devnet/flashmediaserver/" rel="nofollow noreferrer">http://www.adobe.com/devnet/flashmediaserver/</a></p> <p>Sorry.. not the answer you were looking for. </p> |
30,257,239 | 0 | Connect netbeans with vagrant <p>I have a project cloned from github repository on my vagrant machine. How can I open it with netbeans on my host machine, and make changes so that it automatically deploys to vagrant?</p> <p>I have been thinking about SFTP, but I don't have vagrant password, user, or other things - it just starts with <code>vagrant ssh</code>. </p> <p>Is there a way to do this?</p> |
8,682,457 | 0 | What code is being used here for use with fonts and glyphs? <p>I was looking through some of the files used in Vexflow and I'm trying to add new glyphs for the score however, I don't know what code is being used here in the vex.flow.font.js file:</p> <pre><code>Vex.Flow.Font = {"glyphs":{"vb":{"x_min":0,"x_max":428.75,"ha":438,"o":"m 262 186 b 273 186 266 186 272 186 b 274 186 273 186 274 186 b 285 186 274 186 280 186 b 428 48 375 181 428 122 b 386 -68 428 12 416 -29 b 155 -187 329 -145 236 -187 b 12 -111 92 -187 38 -162 b 0 -51 4 -91 0 -72 b 262 186 0 58 122 179 "} </code></pre> <p>To my understanding, the code above is referenced by another file (glyph.js) to render an svg. Any help would be greatly appreciated, thank you :)</p> |
14,947,378 | 0 | <p>Based on what I found out here: <a href="http://stackoverflow.com/questions/14945861/sending-correct-json-content-type-for-cakephp">Sending correct JSON content type for CakePHP</a></p> <p>The correct way to return JSON in CakePHP is like so:</p> <pre><code>$this->response->type('json'); $this->response->body(json_encode(array('message'=>'Hello world!'))); </code></pre> <p>This is because the headers can be overridden and therefore the CORS doesn't work unless you do it the 'proper' way using the response object in Cake.</p> |
Subsets and Splits