pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
36,200,028
0
<p>Try <strong>disabling all breakpoints when launching the app</strong> from Xcode. You can enable them afterwards.</p>
7,977,897
0
<p>I am the product manager for the OpenPlug tools.</p> <p>Our tools are not the only ones that allow IPA signing on Windows (you mentioned marmalade, but there is also Adobe CS5/AIR/Flash Builder, and certainly others ...)</p> <p>As far as I know, Apple hasn't banned any app built with those tools on the ground that they were developed on a non-Apple-branded computer.</p> <p>For publishing your app you anyway need to access iTunes Connect from a Mac.</p> <p>Having the possibility to sign IPAs on Windows facilitates the dev/debug cycle on device if you are a developer with a Windows host.</p> <p>Technically, the signing tools are available open source from the Mach open source distribution of MacOSX. You can refer to the comments section of this post on Corona's blog (another app development tool) for discussion about legalities: <a href="http://blog.anscamobile.com/2010/03/does-flash-cs5-for-windows-violate-the-iphone-developer-agreement/" rel="nofollow">http://blog.anscamobile.com/2010/03/does-flash-cs5-for-windows-violate-the-iphone-developer-agreement/</a>.</p> <p>The last time I looked at Apple's agreements, its only the "SDK" (i.e. xCode and associated iOS SDK) that was only allowed for use on Apple-branded computers only.</p> <p>Hope this helps</p> <p>Guilhem</p>
15,871,394
0
<p>this worked for me :)</p> <blockquote> <p>select * from Common </p> <p>where </p> <p>common_id not in (select <strong>ISNULL(common_id,'dummy-data')</strong> from Table1)</p> <p>and common_id not in (select <strong>ISNULL(common_id,'dummy-data')</strong> from Table2)</p> </blockquote>
22,864,141
0
Importing data to an array from db file in android <p>I have made a db file in sqlitestudio. I have saved the db file in assets folder of my application. Now I want to get data from that db file and store it in an array or list and use it in my app. Please help!</p>
9,378,889
0
sending data to servlet in json and other formats <p>I have my client as an android program. I take the user details from the the user and send it to the server for storing it in the database. I have used a URLConnection object to send data to the servlet. I am sending the user details in using 'writeObject'.</p> <pre><code>URL url = new URL("http://10.0.2.2:8080/hello"); URLConnection connection = url.openConnection(); connection.setDoOutput(true); ObjectOutputStream out=new ObjectOutputStream(connection.getOutputStream()); String s="check"+","+susername+","+password+","+email; out.writeObject(s); out.flush(); out.close(); </code></pre> <p>As you see I have seperated the details with ",". In the servlet, I used string .split() function to retrieve back the values. It is working perfectly fine. Except that I see and hear people telling me to send it in json format because it is faster. I don't understand how? The content is going to be the same right? Is it completely different protocol for transfering data? How should it be used? please suggest some links if you think this is a very trivial question.</p>
9,980,884
0
RijndaelManaged can not decrypt <p>The code can be found at: <a href="http://pastebin.com/3Yg5bHra" rel="nofollow">http://pastebin.com/3Yg5bHra</a></p> <p>My problem is, that when I decrypt then nothing gets returned at all. Nothing gets decrypted.</p> <p>It goes wrong somewhere around line 111-114. The cryptoStream (csDecrypt) is empty, eventhough I put data into the memorystream (msDecrypt)</p> <p><strong>EDIT</strong> Nudier came up with a solution</p>
16,219,227
0
<p>First of all, you want</p> <pre><code>for (int x=0; x&lt;= numOfStudents; x++) </code></pre> <p>or when numOfStudents = 0 you'll never go into the loop.</p> <p>Also, does addButtonActionPerformed have a for loop that contains the code you've given us? Otherwise, it seems like every time you go into that method numOfStudents will be 0 and when you exit it'll be 1, but the code is only executed for numOfStudents = 0. Am I missing something?</p>
38,959,172
0
<p>There is no way to get a set of IDs as a result of a bulk <code>INSERT</code>. </p> <p>One option you have is indeed to run a <code>SELECT</code> query to get the IDs and use them in the second bulk <code>INSERT</code>. But that's a hassle.</p> <p>Another option is to run the 2nd bulk <code>INSERT</code> into a <em>temporary</em> table, let's call it <code>table3</code>, then use <code>INSERT INTO table2 ... SELECT FROM ... table1 JOIN table3 ...</code></p> <p>With a similar use case we eventually found that this is the fastest option, given that you index <code>table3</code> correctly. Note that in this case you don't have a <code>SELECT</code> that you need to loop over in your code, which is nice.</p>
35,984,966
0
Angular bind to filtered count <p>I have this array:</p> <pre><code>[ { type: "hhh", items: [ { "name": "EGFR", "type": "a", "selected": true } ] }, { type: "aaa", items: [ { "name": "mm", "type": "b", "selected": false } ] }, { type: "ii", items: [ { "name": "pp", "type": "bb", "selected": true } ] } ] </code></pre> <p>I want to show a counter of the items with selected property "true". I want it to be changed real time when change. (Without watch and function)</p> <p>Thnaks!</p>
14,065,146
0
<h1>Edited</h1> <p>Note that is answer is no longer working because of the updated version of the MaltParser API in NLTK since August 2015. This answer is kept for legacy sake.</p> <p>Please see this answers to get MaltParser working with NLTK:</p> <ul> <li><a href="http://stackoverflow.com/questions/13207394/step-by-step-to-getting-malt-parser-in-nltk-to-work">Step by step to getting malt parser in NLTK to work?</a></li> </ul> <p><strong>Disclaimer</strong>: This is not an eternal solutions. The answer in the above link (posted on Feb 2016) will work for now. But when MaltParser or NLTK API changes, it might also change the syntax to using MaltParser in NLTK.</p> <hr> <p>A couple problems with your setup:</p> <ul> <li>The input to <code>train_from_file</code> must be a file in CoNLL format, not a pre-trained model. For an <code>mco</code> file, you pass it to the <code>MaltParser</code> constructor using the <code>mco</code> and <code>working_directory</code> parameters.</li> <li>The default java heap allocation is not large enough to load that particular <code>mco</code> file, so you'll have to tell java to use more heap space with the <code>-Xmx</code> parameter. Unfortunately this wasn't possible with the existing code so I just checked in a change to allow an additional constructor parameters for java args. See <a href="https://github.com/nltk/nltk/commit/f63cdccca48c39141f18f79a2cd182f3964eaa93" rel="nofollow">here</a>.</li> </ul> <p>So here's what you need to do:</p> <p>First, get the latest NLTK revision:</p> <pre><code>git clone https://github.com/nltk/nltk.git </code></pre> <p>(NOTE: If you can't use the git version of NLTK, then you'll have to update the file <code>malt.py</code> manually or copy it from <a href="https://github.com/nltk/nltk/blob/master/nltk/parse/malt.py" rel="nofollow">here</a> to have your own version.)</p> <p>Second, rename the jar file to <code>malt.jar</code>, which is what NLTK expects:</p> <pre><code>cd /usr/lib/ ln -s maltparser-1.7.2.jar malt.jar </code></pre> <p>Then add an environment variable pointing to malt parser:</p> <pre><code>export MALTPARSERHOME="/Users/dhg/Downloads/maltparser-1.7.2" </code></pre> <p>Finally, load and use malt parser in python:</p> <pre><code>&gt;&gt;&gt; import nltk &gt;&gt;&gt; parser = nltk.parse.malt.MaltParser(working_dir="/home/rohith/malt-1.7.2", ... mco="engmalt.linear-1.7", ... additional_java_args=['-Xmx512m']) &gt;&gt;&gt; txt = "This is a test sentence" &gt;&gt;&gt; graph = parser.raw_parse(txt) &gt;&gt;&gt; graph.tree().pprint() '(This (sentence is a test))' </code></pre>
9,335,384
0
<p>Well, dosen't really solve the problem, but as the container size was full size and the window is full size, i just checked the screen resolution and change the rect accordingly.</p>
21,122,427
0
hover parent change child of child <p>In the next example i want things to happen to my childs divs when i hover over the complete parent div. For example: i want the h2 and span of child1 to underline and the span of child2 to change from color (but not underline!).</p> <p>Is this possible with pure css? Or should i consider using JQuery? If so, could you help me get started on this in Jquery?</p> <pre><code> &lt;div class="parent"&gt; &lt;a href="#"&gt; &lt;div class="child1"&gt; &lt;h2&gt;text&lt;/h2&gt; &lt;span&gt;text&lt;/span&gt; &lt;/div&gt; &lt;div class="child2"&gt; &lt;span&gt;text&lt;/span&gt; &lt;/div&gt; &lt;/a&gt; &lt;/div&gt; </code></pre>
26,152,658
0
Auto-hiding navbar that works in IE <p>I made an auto-hiding navbar and it works great in chrome, but IE11 freaks out. the idea is that when you scroll down it hides, but it reappears if you scroll up. In IE11, I scrolled down and it hid the navbar. And then when I scrolled back up nothing happened for a second... and then the navbar appeared and disappeared 3 times in rapid succession... then a few seconds later it did it again. Any idea what's wrong?</p> <pre><code>&lt;script&gt; var lastScrollTop = 0; $(window).scroll(function(){ var st = $(this).scrollTop(); if (st &gt; lastScrollTop){ $('#header').animate({ marginTop: '-70px', opacity: 0 }, 200); } else { $('#header').animate({ marginTop: '0px', opacity: 1 }, 200); } lastScrollTop = st; }); &lt;/script&gt; </code></pre>
17,504,037
0
<blockquote> <p>Is there a way to see how much ram the device has so i can use both resultion and memory to determin what size bitmap to use?</p> </blockquote> <p>The device RAM does not matter. The available memory <em>for your process</em> matters.</p> <p>To find out the memory class of your app, call <code>getMemoryClass()</code> on <code>ActivityManager</code> -- that basically returns the amount of available RAM for your process in MB.</p>
27,428,482
0
getting an instance of a CompiledMethod class <p>As far as I understand CompiledMethod is a class holding the compiled form of a method. An instance of this class is created each time a method is compiled. This instance is saved in the class to which the method belongs. </p> <p>My question is if I have a the name of the method, how can I get that instance that holds the compile form of a method in order to run that method with valueWithReceiver: ? </p> <p>is it by using compiledMethodAt: selector ?</p>
17,531,186
0
<p>You need to pass it as a parameter or create a "global variable"</p> <p>IE you could do either of the following...</p> <pre><code>public void methodOne(String string){ System.out.println(string); } public void methodTwo(){ String string = "This string will be printed by methodOne"; methodOne(string); } </code></pre> <p>OR (a better solution)</p> <p>Create a global variable under the class declaration...</p> <pre><code>public class ThisIsAClass { String string; //accessible globally .... //way down the class public void methodOne(){ System.out.println(string); } public void methodTwo(){ String string = "This string will be printed by methodOne"; //edit the string here methodOne(); } </code></pre> <p>Let me know if you have any questions. Of course you will have to change <code>String string;</code> accordingly but it is the same concept with any variable. </p> <p>You said that your "sentence" is created in one of these methods and it hasn't been created when you declare it globally. All you need to do is create it globally, <code>String weatherLocation = null;</code> and then set it whenever you need to. I think it your example it would be under <code>weatherInfo()</code> </p> <pre><code>public void WeatherInfo(){ weatherLocation = weatherLoc[1].toString(); } </code></pre> <p>Instead of creating a new one we just edit the one we created globally.</p> <p>-Henry</p>
26,749,587
1
Yammer API wrapper <p>is the Yampy package, yammer-API wrapper for python still maintained? Authorization is easily completed, but I try to get messages from a certain user only.</p> <p>The reccomended way of doing so is using the messages factory (described here: <a href="http://pythonhosted.org/yampy/api.html#yampy.apis.MessagesAPI" rel="nofollow">http://pythonhosted.org/yampy/api.html#yampy.apis.MessagesAPI</a>)</p> <p>eg. <code>messages.from_user()</code> or <code>messages.sent()</code></p> <pre class="lang-python prettyprint-override"><code>yamm = yampy.Yammer(access_token=session.get('yammer_access_token')) user_id = current_user.get(u'id') msgs_dict = yamm.messages.from_user(user_id=user_id, limit=limit) msgs = msgs_dict.get(u'messages') for msg in msgs: print msg.get(u'sender_id') print "-----------------------------------" bla= yamm.messages.sent(limit=limit).get(u'messages') for blu in bla: print blu.get(u'sender_id') print "-----------------------------------" </code></pre> <p>The output of both of them is the same, and both of them don't match the user_id and the sender_id</p> <p>The Output will look like this:</p> <pre class="lang-none prettyprint-override"><code>user_id "-----------------------------------" user_id2 "-----------------------------------" user_id3 "-----------------------------------" another_user_id "-----------------------------------" </code></pre> <p>only one or two of the messages will actually match the wanted user_id of the <em>current_user</em></p> <p>The last commit has been 1 year back and I'm having doubts.</p>
16,703,836
0
<p>Understanding that you're probably talking about a local/desktop machine and would probably like to <em>continue</em> talking about a local/desktop machine, I'll throw an alternative out there for you just in case it might help you or someone else:</p> <p>Set up multiple virtual server instances in the cloud, and share your code between them as a git repository (or mercurial, I suppose, though I have no personal experience all you really need is something decentralized). This has the benefit of giving you as close to a production experience as possible, and if you have experience setting up servers then it's not that complicated (or expensive, if you just want to spin a server up, do what you need to do, then spin it down again, then you're talking about a few cents up to say 50 cents, up to a few bucks if you just leave it running).</p> <p>I do all of my project development in the cloud these days and I've found it much simpler to manage the infrastructure than I ever did when using local/non-virtualized installs, and it makes this sort of side-by-side scenario fairly straight forward. I just wanted to throw the idea out there if you hadn't considered it.</p>
30,942,186
0
Need to write a C Program to remove repeated characters adjacent to each other <p>I need to remove only the repeated characters that are adjacent to each other. </p> <p>Example: if the input is <code>"heeellooo wooorllldd"</code>, the output should be <code>"helo world"</code>. The output I am currently getting is <code>"helo wrd"</code>.</p> <p>This is the code i have.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; main() { char str[]="heeello wooorld"; redundant(str); } void redundant(char *str) { int check=0; int i,j; char ch; while(str[check]) { ch = str[check]; i = j = check + 1; while(str[i]) { if(str[i] != ch) { str[j] = str[i]; j++; } i++; } str[j]='\0'; check++; } printf("String after removing duplicates : %s\n",str); } </code></pre>
24,789,791
0
Copy specific Google Form response values into different Google Sheet <p>I have a Google Form that has many questions, but I only want to record some of the responses into a separate, condensed spreadsheet. These are the responses I want to record:</p> <pre><code>First Name Last Name Company Role </code></pre> <p>This is my script, which is triggered to execute on form submission:</p> <pre><code>function copyCondensedResponseData(e) { var array_to_paste_in_participant_attendance_sheet = []; array_to_paste_in_participant_attendance_sheet.push(e.namedValues["First Name"].toString()); array_to_paste_in_participant_attendance_sheet.push(e.namedValues["Last Name"].toString()); array_to_paste_in_participant_attendance_sheet.push(e.namedValues["Role"].toString()); array_to_paste_in_participant_attendance_sheet.push(e.namedValues["Company"].toString()); var participant_attendance_sheet = SpreadsheetApp.openById(/* id */).getSheets()[0]; participant_attendance_sheet.getRange(participant_attendance_sheet.getLastRow()+1,1).getValues()[0] = array_to_paste_in_participate_attendance_sheet; } </code></pre> <p>But nothing is pasted into the participate_attendance_sheet. I know that typically you copy data from one sheet into another by calling getRange() and setValues(), but I think that's only if the data I want to copy is of the class Object [ ] [ ]. Any thoughts?</p>
15,948,282
0
<p>Look at signature:</p> <pre><code> IEnumerable&lt;SafeModeResult&gt; InsertBatch( Type nominalType, IEnumerable&lt;Object&gt; documents, SafeMode safeMode </code></pre> <p><a href="http://api.mongodb.org/csharp/1.1/html/cac72c74-ae6d-9b2e-a503-303a40104143.htm" rel="nofollow">SafeMode</a> can cause postpone you real batch write. Play with <code>FSyncTrue</code> (can be very slow) or <code>True</code>.</p>
14,968,488
0
Perl String Parsing to Hash <p>So lets say I had the string.</p> <pre><code> $my str = "Hello how are you today. Oh thats good I'm glad you are happy. Thats wonderful; thats fantastic." </code></pre> <p>I want to create a hash table where each key is a unique word and the value is the number of times it appears in the string i.e., I want it to be an automated process.</p> <pre><code>my %words { "Hello" =&gt; 1, "are" =&gt; 2, "thats" =&gt; 2, "Thats" =&gt; 1 }; </code></pre> <p>I honestly am brand new to PERL and have no clue how to do this, how to handle the punctuation etc.</p> <p>UPDATE:</p> <p>Also, is it possible to use</p> <pre><code> split('.!?;',$mystring) </code></pre> <p>Not with this syntax, but basically split at a . or ! or ? etc.. oh and ' ' (whitespace)</p>
23,703,133
0
<p>Your first problem is that <code>-lpthread</code> is a linker option, so it belongs on the linker line (the second command) rather than the compilation line. (Note that the order of the parameters can matter; I got it to work by putting <code>-lpthread</code> on <strong>last</strong>. I also tried using <code>-pthread</code> instead of <code>-lpthread</code>, which did appear to work and was also less sensitive to where it was put on the linker line. But again, it's a <em>linker</em> option, not a <em>compile</em> option.)</p> <p>After fixing that, I was able to get your program to compile and run, but it exited with a different exception: <code>terminate called without an active exception</code>. To fix this problem, call <code>thread_fct.join();</code> in <code>main()</code>. (All threads must be joined, detached, or moved-from before they go out of scope, or your program will abort.)</p>
12,893,215
0
Windows languages without framework dependency? <p>I want to develop application which will communicate with my php server. This application will be used by multiple users. Please suggest any language which does not depend upon like c# depends upon dot net framework. I want something simple like gtalk which does not need to install any dependent framework.</p>
7,916,802
0
<p>Change your HTML to:</p> <pre><code>&lt;div id="content" style="background-color: #E5E5E5; width:500px; height:500px;"&gt; &lt;div class="demo" style="border-style: dashed; background-color: #CCCCCC"&gt; &lt;div class="closebtn"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Then change <code>.demo:before</code> in your CSS to <code>.closebtn</code> and add this to your JavaScript:</p> <pre><code>$('.closebtn').click(function(e) { e.stopPropagation(); $(this).parent().hide(); }); $('#content').click(function(e) { $('.demo').css({top:0,left:0}).show(); }); </code></pre> <p><a href="http://jsfiddle.net/mblase75/g6cdL/48/" rel="nofollow">http://jsfiddle.net/mblase75/g6cdL/48/</a></p>
23,703,831
0
How to call a method in another class from a generic method? <p>Why doesn't the line marked with <code>//Dont work in the bottom of the code</code> compile?</p> <p>I want to reuse the <code>WriteMessage</code> method with different Classes, I try to use <code>generics</code>, but I'm not sure how to use it.</p> <pre><code>class ClassOne { public string MethodOne() { return ("ClassOne"); } public string MethodTwo() { return ("ClassOne -MethodTwo "); } } class ClassTwo { public string MethodOne() { return ("ClassTwo"); } public string MethodTwo() { return ("ClassOne -MethodTwo "); } } class Program { private static void Main() { var objectOne = new ClassOne(); WriteMessage(objectOne); var objectTwo = new ClassTwo(); WriteMessage(objectTwo); Console.ReadKey(); } public static void WriteMessage&lt;T&gt;(T objectA) { var text = objectA.MethodTwo(); //Dont Work Console.WriteLine("Text:{0}", text); } } </code></pre>
1,978,267
0
<p>You can also just put { } inside each case: statement<br> without them the whole case stack is evaluated as a single unit, so no variables can be defined within one case:</p> <p>But by putting </p> <pre><code> case blah: { // do stuff } break; </code></pre> <p>You can put anythign you want inside the case statement.</p>
40,400,581
0
Knockout JS: How to subscribe to changes in code similar to how binding handlers work <p>Let's say there is a path in the view-model property which needs to be observed, like this:</p> <pre><code>&lt;div data-bind="myBindingHandler: { data1: prop1().prop2().prop3() }"&gt;&lt;/div&gt; </code></pre> <p>This is easy to do in HTML with <code>data-bind</code> and binding handler, but doing this manually in JS code with <code>.subscribe()</code> is tedious.</p> <p>Is there a way in KO to be able to somehow give the same string and listen to changes? I imagine it would be something like this:</p> <pre><code>viewModelInstance.prop1.observe("prop2().prop3()", function (newValue) { console.log('prop3 value is", newValue); }); </code></pre> <p>I'm pretty sure somewhere in the KO implementation it's possible, but I wonder if it's really exposed. </p>
19,268,903
0
Restoring buttons back to its position <p>I searched stackoverflow for answers buy am unable to find one so i am posting a question.A helping hand is much appreciated.</p> <p>I am creating a quiz app.The layout contains six textview box and 12 buttons with letters.when user clicks on button textview gets filled with each letter and increments textview based on position so that all six textview box gets filled.i have also made buttons to disappear as soon as the text gets filled in textview.i am successful in implementing these steps but my question is how to make filled textview text empty so that the corresponding button gets reappeared?to be more clear i added onClickListener to textview but filled text in textview doesn't decrement. hope you have understand the question .i am still learning and am developing app from scratch.</p> <pre><code>switch(v.getId()) { case R.id.button1: { b1=(Button) findViewById(R.id.button1); String name1=b1.getText().toString(); tv.setText(name1); position++; b1.setVisibility(View.INVISIBLE); } break; case R.id.button2: b2=(Button) findViewById(R.id.button2); String name2=b2.getText().toString(); //blankbut.setText(name2); tv.setText(name2); position++; b2.setVisibility(View.INVISIBLE); break; case R.id.button3: b3=(Button) findViewById(R.id.button3); String name3=b3.getText().toString(); tv.setText(name3); //blankbut.setText(name3); position++; b3.setVisibility(View.INVISIBLE); break; case R.id.button4: b4=(Button) findViewById(R.id.button4); String name4=b4.getText().toString(); tv.setText(name4); //blankbut.setText(name4); position++; b4.setVisibility(View.INVISIBLE); break; case R.id.button5: b5=(Button) findViewById(R.id.button5); String name5=b5.getText().toString(); tv.setText(name5); //blankbut.setText(name5); position++; b5.setVisibility(View.INVISIBLE); break; case R.id.button6: b6=(Button) findViewById(R.id.button6); String name6=b6.getText().toString(); tv.setText(name6); //blankbut.setText(name6); position++; b6.setVisibility(View.INVISIBLE); break; case R.id.button7: b7=(Button) findViewById(R.id.button7); String name7=b7.getText().toString(); tv.setText(name7); // blankbut.setText(name7); position++; b7.setVisibility(View.INVISIBLE); break; case R.id.button8: b6=(Button) findViewById(R.id.button8); String name8=b8.getText().toString(); tv.setText(name8); //blankbut.setText(name8); position++; b8.setVisibility(View.INVISIBLE); break; case R.id.button9: b9=(Button) findViewById(R.id.button9); String name9=b9.getText().toString(); tv.setText(name9); //blankbut.setText(name9); position++; b9.setVisibility(View.INVISIBLE); break; case R.id.button10: b10=(Button) findViewById(R.id.button10); String name10=b10.getText().toString(); tv.setText(name10); //blankbut.setText(name10); position++; b10.setVisibility(View.INVISIBLE); break; case R.id.button11: b11=(Button) findViewById(R.id.button11); String name11=b11.getText().toString(); tv.setText(name11); //blankbut.setText(name11); position++; b11.setVisibility(View.INVISIBLE); break; case R.id.button12: b12=(Button) findViewById(R.id.button12); String name12=b12.getText().toString(); tv.setText(name12); //blankbut.setText(name12); position++; b12.setVisibility(View.INVISIBLE); break; } </code></pre>
22,612,337
0
R shiny, load data based on input <p>I have data for each day in server side and want to load data based on date input </p> <p>On server side, I have this:</p> <pre><code> dateInput("date","Enter a date:",value = "2014-01-13")) </code></pre> <p>On UI side, </p> <pre><code>library(shiny) library(googleVis) library(rpart.plot) load("data_2014_01_13_new.RData") #seg and fit are data in this file shinyServer(function(input, output) { output$values &lt;- renderGvis({ gvisTable(seg[seg$rate &gt;= input$test[1] &amp; seg$rate &lt;= input$test[2],]) }) output$plot &lt;- renderPlot({ prp(fit,extra=T) }) }) </code></pre> <p>I want to put load into server function and can load different data as date changes. Thanks!</p>
12,300,989
0
<p>You can use the <code>start-with</code> in xpath to locate an attribute value that starts with a certain text.</p> <p>For example, assume you have the following link on the page:</p> <pre><code>&lt;a href="mylink_somerandomstuff"&gt;link text&lt;/a&gt; </code></pre> <p>Then you can use the following xpath to find links that have an href that starts with 'mylink':</p> <pre><code>//a[starts-with(@href, "mylink")] </code></pre>
29,457,168
0
<p>The easiest way for executing phantomjs from C# code is using wrapper like <a href="https://www.nuget.org/packages/NReco.PhantomJS/" rel="nofollow">NReco.PhantomJS</a>. The following example illustrates how to use it for rasterize.js:</p> <pre><code>var phantomJS = new PhantomJS(); phantomJS.Run( "rasterize.js", new[] { "https://www.google.com", outFile} ); </code></pre> <p>Wrapper API has events for stdout and stderr; also it can provide input from C# Stream and read stdout result into C# stream. </p>
39,322,893
0
<p>This could be shortened heavily but I don't feel like rewriting your entire program. This should work as expected.</p> <pre><code>total_guess = 0 wins = 0 loss = 0 import random characters = ["rock", "paper", "scissors", "lizard", "spock"] computer = characters[random.randint(0,4)] print(computer) def valid(text, flag): error_message= "" while True: var = input(error_message + text) if flag == "s": if var.isalpha()==True: break else: error_message = "This is not valid, " elif flag =="i": if var.isdigit()==True: var = int(var) break else: error_message = user_name + " this is not a number, " elif flag == "g": if var == "rock" or var == "paper" or var == "scissors" or var == "lizard" or var == "spock": break else: error_message = user_name + " this is not valid! " return(var) user_name = valid("What is your name?", "s") num_rounds = valid(user_name +" how many rounds do you want?", "i") while True: while num_rounds &gt; total_guess: player = valid(user_name + """ ,What do you want as your character: Rock, paper, scissors, lizard or spock""", "g" ) total_guess = total_guess + 1 if player == computer: print("Draw!") # -------------------------------------------- elif player == "Rock" or player == "rock": if computer == "paper" or computer == "spock" : loss = loss + 1 print(' '.join(("You lost", computer, "beats", player))) if computer == "scissors" or computer == "lizard": wins = wins + 1 print(' '.join(("You win", player, "beats", computer))) elif player == "Paper" or player == "paper": if computer == "scissors" or computer == "lizard": loss = loss + 1 print(' '.join(("You lost", computer, "beats", player))) if computer == "rock" or computer == "spock": wins = wins + 1 print(' '.join(("You win", player, "beats", computer))) elif player == "Scissors" or player == "scissors": if computer =="Spock" or computer == "rock": loss = loss + 1 print(' '.join(("You lost", computer, " beats ", player))) if computer =="paper" or computer == "lizard": wins = wins + 1 print(' '.join(("You win", player, "beats", computer))) elif player == "Lizard" or player =="lizard": if computer =="scissors" or computer == "rock": loss = loss + 1 print(' '.join(("You lost", computer, "beats", player))) if computer == "paper" or computer == "spock": wins = wins + 1 print(' '.join(("You win", player, "beats", computer))) elif player == "Spock" or player == "spock": if computer == "lizard" or computer == "paper": loss = loss + 1 print(' '.join(("You lost", computer, "beats", player))) if computer =="rock" or computer == "scissors": wins = wins + 1 print(' '.join(("You win", player, "beats", computer))) end_game = input("To exit enter N, to play again enter any key ") if end_game == 'n' or end_game == 'N': print("THANKS FOR PLAYING " + user_name + '!') break total_guess = 0 </code></pre>
4,211,328
0
<p>This is VBA short-form for setting the value of a range of cells (or in this case, a single cell). So the example you've provided will actually insert the text value "FALSE" into cell AF6.</p> <p>If the colour of the other cell is not being set in code, then I would suggest it was done through conditional formatting.</p>
10,612,421
0
<p>You can do this using the excel concatenate function. Here's a link to a <a href="http://office.microsoft.com/en-us/excel-help/concatenate-HP005209020.aspx" rel="nofollow">good tutorial</a></p> <p>Also, to deal with the duplicates, you can have excel highlight duplicate entries so they can be easily deleted. <a href="http://office.microsoft.com/en-us/excel-help/locate-duplicates-by-using-conditional-formatting-HA001136616.aspx" rel="nofollow">See here</a></p>
257,689
0
<p>Note that if you're creating a object that can be mutated after creation, the hash value must <em>not change</em> if the object is inserted into a collection. Practically speaking, this means that the hash value must be fixed from the point of the initial object creation. See <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/doc/uid/20000052-BBCGFFCH" rel="nofollow noreferrer">Apple's documentation on the NSObject protocol's -hash method</a> for more information:</p> <blockquote> <p>If a mutable object is added to a collection that uses hash values to determine the object’s position in the collection, the value returned by the hash method of the object must not change while the object is in the collection. Therefore, either the hash method must not rely on any of the object’s internal state information or you must make sure the object’s internal state information does not change while the object is in the collection. Thus, for example, a mutable dictionary can be put in a hash table but you must not change it while it is in there. (Note that it can be difficult to know whether or not a given object is in a collection.)</p> </blockquote> <p>This sounds like complete whackery to me since it potentially effectively renders hash lookups far less efficient, but I suppose it's better to err on the side of caution and follow what the documentation says.</p>
9,327,611
0
<p>IMO the best choice for color selection is using system pickers like <code>NSColorWell</code> or (on toolbar) <code>NSToolbarItem</code> with identfier = <code>NSToolbarShowColorsItemIdentfier</code></p>
34,505,799
0
how to pass dynamic table name into mySQL Procedure with this query? <p>I have create procedure and when i pass table name manually then its working fine, but when i pass dynamic table name then it says <strong>dbname.tblname doesn't exist</strong>. </p> <pre><code>DELIMITER $$ CREATE PROCEDURE `lmsonline`.`delProc`(tblName VARCHAR(20),sr INT) BEGIN DELETE FROM tblName WHERE srno=sr; SET @num := 0; UPDATE tblName SET srno = @num := (@num+1); ALTER TABLE tblName AUTO_INCREMENT = 1; END$$ DELIMITER ; </code></pre> <p>and to execute i have <code>CALL delProc('beginner',6);</code></p>
11,775,989
0
ARC Semantic Issue with simple protocol example? <p>I have just been trying something out with a quick test and I have a question, in the following code:</p> <pre><code>@protocol stuffieProtocol &lt;NSObject&gt; @required -(void)favouiteBiscuit; @end </code></pre> <p>.</p> <pre><code>// DOG &amp; TED ARE IDENTICAL, THEY JUST LIKE DIFFERENT BISCUITS @interface Dog : NSObject &lt;stuffieProtocol&gt; @property (strong, nonatomic) NSString *name; @end @implementation Dog - (id)init { return [self initWithName:@"Unknown"]; } - (id)initWithName:(NSString *)name { self = [super init]; if(self) { _name = name; } return self; } - (void)whoAreYou { NSLog(@"MY NAME IS: %@ I AM A: %@", [self name], [self class]); } - (void)favouiteBiscuit { NSLog(@"FAVOURITE BISCUIT IS: Costa Jam Biscuit"); } @end </code></pre> <p>.</p> <pre><code>Dog *stuffie_001 = [[Dog alloc] initWithName:@"Dog Armstrong"]; Ted *stuffie_002 = [[Ted alloc] initWithName:@"Teddy Sullivan"]; NSArray *stuffieArray = @[stuffie_001, stuffie_002]; for(id&lt;stuffieProtocol&gt; eachObject in stuffieArray) { [eachObject whoAreYou]; // &lt;&lt; ERROR [eachObject favouiteBiscuit]; } </code></pre> <p>My question is I am getting an error <code>"ARC Semantic Issue: No known instance method for selector 'whoAreYou'"</code> </p> <p>If I prefix <code>[eachObject whoAreYou];</code> with <code>[(Dog *)eachObject whoAreYou];</code> then this works for all the iterations of the loop, but that just feels wrong as the all the objects in the array are not of type <code>Dog</code>.</p> <p>What should I be prefixing this with to be correct?</p>
24,956,560
0
<p>Use a <code>using</code> block instead.</p> <pre><code>using (var c = new Connection()) using (var u = new UsesConnection(c)) { // Do your work here } </code></pre> <p>But don't <code>return</code> as that will dispose both objects. Don't let <code>UsesConnection</code> to dispose <code>Connection</code>.</p> <p>You should be in charge of maintaining the life-cycles of your disposable references, not some caller - ask yourself "what if they never dispose of my object?"</p>
39,861,995
0
<p>You first add the data to the $vendor_data array and then apply it using the following:</p> <pre><code>//Add the data to the array $vendor_data['paypal'] = $email; $vendor_data['profile'] = $description; //Update the term meta with the above values. update_term_meta($return['term_id'], 'vendor_data', $vendor_data); </code></pre>
22,793,589
0
<p>I'm writing a Google Glass Development book for Apress and just finished the chapter Network and Bluetooth, with some working samples to let Glass communicate with iPhone for data transfer. You're right that Glass as of now (API level 15) doesn't support Bluetooth Low Energy (BLE). I have implemented three ways to make the data transfer between Glass and iOS happen:</p> <ol> <li><p>Let Glass talk to an Android device, such as Nexus 7 with Android 4.3 or above with BLE support, via Classic Bluetooth or socket, and Nexus 7 acts as a BLE central to talk to iOS as a BLE peripheral. Notice you shouldn't use BLE to send large data such as photo.</p></li> <li><p>Let Glass talk to iOS directly via socket - you can use C socket code running as a server and Glass Java socket client, or vice versa. This would require your Glass and iOS device on the same Wifi, but can transfer large data. </p></li> <li><p>Use a server-based solution - upload data from Glass to a server and let iOS get it via Apple Push Notification. I used this method to share photos on Glass with friends on WhatsApp and WeChat, both apps run on iOS.</p></li> </ol> <p>Sample iOS code acting as socket server:</p> <pre><code>- (void) runSocketServer { int listenfd = 0; __block int connfd = 0; struct sockaddr_in serv_addr; __block char sendBuff[1025]; listenfd = socket(AF_INET, SOCK_STREAM, 0); memset(&amp;serv_addr, '0', sizeof(serv_addr)); memset(sendBuff, '0', sizeof(sendBuff)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(6682); bind(listenfd, (struct sockaddr*)&amp;serv_addr, sizeof(serv_addr)); listen(listenfd, 10); dispatch_async(dispatch_get_global_queue(0, 0), ^{ connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); int count = 1; while (count++ &lt; 120) { char rate[100]; sprintf(rate, "%i\n", bpm); write(connfd, rate, strlen(rate)); sleep(1); } close(connfd); }); } </code></pre> <p>Sample Glass code acting as a socket client:</p> <pre><code>public void run() { String serverName = "192.168.1.11"; int port = 6682; try { socket = new Socket(serverName, port); BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); do { result = input.readLine(); runOnUiThread(new Runnable() { public void run() { mTvInfo.setText(result); } }); } while (result != null); }); } catch(Exception e) { try { socket.close(); } catch (Exception e2) {}; e.printStackTrace(); } } </code></pre>
38,045,956
0
<p>You have to use <strong>floating property</strong> and some <strong>width to counter part</strong>, then it will work. Why don't you use some <strong>calc()</strong> style property value/attribute there?</p> <p><a href="https://jsfiddle.net/9xr8urz1/5/" rel="nofollow"><strong>Check this fiddle here</strong></a></p> <p>HTML for example purpose</p> <pre><code>&lt;ul&gt; &lt;li class="check-label"&gt;But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born&lt;/li&gt; &lt;li class="check-counter"&gt;1&lt;/li&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;/ul&gt; &lt;ul&gt; &lt;li class="check-label"&gt;But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born&lt;/li&gt; &lt;li class="check-counter"&gt;2&lt;/li&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;/ul&gt; </code></pre> <p><strong>Your CSS will be</strong></p> <pre><code>ul{ list-style:none; background:#FFFFFF; width:300px; padding:10px; margin:0px; border-bottom:solid 1px #CCCCCC; } ul li{ margin:0px; } ul li.check-label{ float:left; width:calc(100% - 50px); } ul li.check-counter{ width:50px; float:left; text-align:center; color:red } .clearfix:before, .clearfix:after { content: " "; /* 1 */ display: table; /* 2 */ } .clearfix:after { clear: both; } </code></pre>
11,824,866
0
mp4 that can be played using Quicktime on PC but not on Mac <p>I have couples of .mp4 files, all of them can be opened and played using QuickTime Player 7.7 installed on PC.</p> <p>But some of them cannot be opened using QuickTime Player 10.1 on Lion.</p> <p>It said "The document xxx.mp4 could not be opened. This media may be damaged." And these unplayable files cannot be played on iPod too.</p> <p>All files are converted in same way in same format. </p> <p>What's wrong? </p>
3,474,417
0
<p>Wikipedia has a long <a href="http://en.wikipedia.org/wiki/C%2B%2B0x" rel="nofollow noreferrer">overview</a>. I would hightlight rvalue references and lambdas. </p>
38,542,153
0
GCE: Both TCP and HTTP load balancers on one IP <p>I'm running a kubernetes application on GKE, which serves HTTP requests on port 80 and websocket on port 8080.</p> <p>Now, HTTP part needs to know client's IP address, so I have to use HTTP load balancer as ingress service. Websocket part then has to use TCP load balancer, as it's clearly stated in docs that HTTP LB doesn't support it.</p> <p>I got them both working, but on different IPs, and I need to have them on one.</p> <p>I would expect that there is something like iptables on GCE, so I could forward traffic from port 80 to HTTP LB, and from 8080 to TCP LB, but I can't find anything like that. Anything including forwarding allows only one them.</p> <p>I guess I could have one instance with nginx/HAproxy doing only this, but that seems like an overkill</p> <p>Appreciate any help!</p>
13,027,372
0
<pre><code>public partial class Form1 : Form { TextBox[] tb; public Form1() { InitializeComponent(); tb = new TextBox[2]; //... } private void button1_Click(object sender, EventArgs e) { int a = Convert.ToInt32(tb[0].Text); } } </code></pre>
6,115,164
0
jQuery UI autocomplete multiple instances after the field was added <p>I am using jQuery UI autocomplete plugin and I am adding new fields to the form dynamically by append() in jQuery. The problem is that i would like to make the newly added field and autocomplete field, so there would be more than 1 autocomplete field, even with same source URL. Any help ?</p> <p>Thanks.</p>
35,434,488
0
<p>You can do this with plain old html. Put a DIV around where the link should take you: </p> <pre><code>-# &lt;DIV ID="FT001"&gt;&lt;b&gt;FT001:&lt;/b&gt;&lt;/DIV&gt; I, as -# &lt;DIV ID="FT002"&gt;&lt;b&gt;FT002:&lt;/b&gt;&lt;/DIV&gt; I, as </code></pre> <p>I'm not an HTML expert, but <code>&lt;A NAME="anchor" ...</code> might be better than <code>&lt;DIV ...</code>. </p> <hr> <p>Elsewhere in the same file you can reference it with this.</p> <pre><code>&lt;a href="#FT001"&gt;Link to section elsewhere in this file&lt;/a&gt; </code></pre> <hr> <p>You might want to create an alias in your config file to make this more readable, like either of these:</p> <pre><code>ALAISES += "anchor{2}=&lt;DIV ID=\"\1\"&gt; \2 &lt;DIV&gt; ALAISES += "bookmark{2}=&lt;DIV ID=\"\1\"&gt; \2 &lt;DIV&gt; </code></pre> <hr> <p>You can also reference the link like this.</p> <pre><code>[Link to elsewhere](#FT001) </code></pre>
23,974,773
0
How can I work around this JRE bug in getNetworkPrefixLength()? <p>There appears to be a known bug in the JRE implementation:</p> <ul> <li><a href="http://bugs.java.com/view_bug.do?bug_id=6707289" rel="nofollow">http://bugs.java.com/view_bug.do?bug_id=6707289</a></li> <li><a href="https://bugs.openjdk.java.net/browse/JDK-7107883" rel="nofollow">https://bugs.openjdk.java.net/browse/JDK-7107883</a></li> </ul> <p>But how can I fix it without updating the JRE/JDK? I need to get broadcast address, and use <code>getBroadcast()</code> for this, but it returns 0.0.0.0 (because <code>getNetworkPrefixLength()</code> returns -1, although the real network mask is 24).</p>
6,284,656
0
<p>Try explicitly giving Mongoid the class name</p> <pre><code>class Engine::Blog include Mongoid::Document embeds_many :posts, :class_name =&gt; "Engine::Post" end </code></pre>
35,812,234
0
<p>Use library to load images in your application. Like <a href="http://square.github.io/picasso/" rel="nofollow">Picaso</a> or <a href="https://github.com/bumptech/glide" rel="nofollow">Glide</a></p> <p>Also read difference between them <a href="http://inthecheesefactory.com/blog/get-to-know-glide-recommended-by-google/en" rel="nofollow">here</a></p> <p>I hope this will solve your problem.</p>
28,301,434
0
Dates on xaxis with highcharts <p>I need to have dates on my xaxis on my chart. I collect my data through a range datepicker where the user can enter a range of 14 days. I need the first value on the xaxis to be the start date of the range and the last value to be the end date of the range. i want the the xaxis labels to read something like "27th Jan 2015" , "28th Jan 2015" or something in that direction and each tic to be 1 day. I've read the API-documentation and i've played around alot with the settings of the chart but for some reason i can not get it to work.</p> <pre><code> $('#graphColumn').highcharts({ title: { text: '', x: -20 //center }, xAxis: { categories: [dayArray[0], dayArray[1], dayArray[2], dayArray[3], dayArray[4], dayArray[5], dayArray[6], dayArray[7], dayArray[8], dayArray[9], dayArray[10], dayArray[11], dayArray[12], dayArray[13]] }, yAxis: { title: { text: '' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { valueSuffix: '' }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0 }, credits: { enabled: false }, series: [{ showInLegend: false, name: ' ', data: series, color: '#77B7C5', marker: { symbol: 'circle' } }, { showInLegend: false, name: '1 år sedan', data: series1yearago, color: "#71C73E", marker: { symbol: 'circle' } }] }); </code></pre> <p>here is my chart. I know the xaxis has categories set now but thats only for the moment, i know it should be datetime. My series are regular int arrays with one number on each index. I would apreciate any help that could be given here!</p> <p>Edit: Here is a working jsfiddle example: <a href="http://jsfiddle.net/g0p00tLv/1" rel="nofollow">http://jsfiddle.net/g0p00tLv/1</a></p>
19,971,140
0
<p><code>nginx</code> must be writing that message to standard error, not standard output. If you want to pipe it, you have to redirect stderr to stdout:</p> <pre><code>nginx -v 2&gt;&amp;1 | awk -F/ '{print $2}' </code></pre>
12,592,513
0
Extracting a list of files and creating a new file containing this list <p>I am a researcher and my skill in Unix commands is limited. I am currently dealing with a folder containing about 1000 files and I have to extract some filenames from this folder and create another file (configuration file) containing these filenames.</p> <p>Basically, the folder has filenames in the following format :</p> <pre><code>1_Apple_A_someword.txt 1_Apple_B_someword.txt 2_Apple_A_someword.txt 2_Apple_B_someword.txt 3_Apple_A_someword.txt 3_Apple_B_someword.txt </code></pre> <p>and so on up until</p> <pre><code>1000_Apple_A_someword.txt 1000_Apple_B_someword.txt </code></pre> <p>I just want to extract out all files which have "Apple_A" in them. Also, I want to create another file which has 'labels' (Unix variables) for each of these "Apple_A" files whose values are the names of the files. Also, the 'labels' are part of the filenames (everything up until the word "Apple") For example,</p> <pre><code>1_Apple=1_Apple_A_someword.txt 2_Apple=2_Apple_A_someword.txt 3_Apple=3_Apple_A_someword.txt </code></pre> <p>and so on...till</p> <pre><code>1000_Apple=1000_Apple_A_someword.txt </code></pre> <p>Could you tell me a one-line Unix command that does this ? Maybe using "awk" and "sed"</p>
13,855,435
0
Windows Phone Emulator 7.1 doesnt open <p>I successfully installed windows phone SDK 7.1 in my pc but when I tried to open the Windows phone emulator it shows an error says "Windows phone emulator is not supported on this computer bcoz this computer does not have the required graphics processing unit configuration. An XNA framework game or page will not function without a graphics processing unit. A silverlight Application may run, but with reduced functionality"</p> <p>I have OS which is win7 ultimate (32-bit), 1-GB DDR-II ram, Intel Dual Core Processor; I know that it needs 3GB ram but I have seen it in a forum that it can also be installed with 1-GB of ram &amp; I don't think there is a problem of ram here but of graphics. I am a newbie in this stuff but desperately wants to learn to create apps please help! </p>
30,814,037
0
<p>Look at the file you give with the <code>excelFormat</code> item I would guess it is due to the following line in it:</p> <pre><code>&lt;Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="68" x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15"&gt; </code></pre> <p>You can see that it has a mention of an <code>ExpandedRowCount</code> which is set to 68. A quick search for <code>&lt;Row</code> in that same file gives 44 results. If you add your 22 lines this brings you up to 66 which is only 2 short. I'm not quite sure where this goes wrong since there is still a difference of 2, but I'd guess that this is your issue. Try changing the ExpandedRowCount attribute to be something higher and test again (with less than 22 items, exactly 22 items, and more than 22 items). </p>
18,505,244
0
<p><code>Answer</code> of @Mangesh Parte can be <strong>short</strong> like,</p> <pre><code>&lt;?php function load_external_jQuery() { wp_deregister_script( 'jquery' ); // deregisters the default WordPress jQuery $url = 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'; // the URL to check against $test_url = @fopen($url,'r'); // test parameters if( $test_url !== false ) { // test if the URL exists if exists then register the external file wp_register_script('jquery', $url); } else{// register the local file wp_register_script('jquery', get_template_directory_uri().'/js/jquery.js', __FILE__, false, '1.7.2', true); } wp_enqueue_script('jquery'); // enqueue the jquery here } add_action('wp_enqueue_scripts', 'load_external_jQuery'); // initiate the function ?&gt; </code></pre>
14,226,204
0
<p>The Function SaveAs is defined so : .SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)</p> <p>Thas is, to use the semicolon (if your regional language option are correctly set) </p> <p>ExcelObj.Workbooks(1).SaveAs csvFile, 6,,,,,,,,,,True</p>
19,070,016
0
<p>Sure it is.</p> <p>If you use supported libraries: <a href="http://developer.android.com/tools/support-library/index.html" rel="nofollow">http://developer.android.com/tools/support-library/index.html</a></p> <p>And then create your App out of Fragments - then you can make an App for 2.3.3 with it's own Tablet layout. <a href="http://developer.android.com/guide/components/fragments.html" rel="nofollow">http://developer.android.com/guide/components/fragments.html</a></p>
6,682,011
0
Passing array of strings from c# to c++ - memory management <p>In my code I have c DLL that accepts array of strings: void Helper::ProcessEvent(PEVENT_RECORD pEvent,wchar_t** OutPutFormattedData)</p> <p>I'm invoking it with this code:</p> <pre><code>[DllImport("Helper.dll", EntryPoint = "ProcessEvent")] internal static extern uint ProcessEvent( [In, Out] ref EVENT_RECORD pEvent, [In, Out] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] ref string[] pResult); </code></pre> <p>In c++ code here is the main code I'm using to fill the array:</p> <pre><code>for(int i=0;i&lt;list.Size;i++) { EventWrapperClass *EWC = new EventWrapperClass(); EWC = list.Events[i]; OutPutFormattedData[i] = new wchar_t [wcslen(HelperFormatMessage(L"%s: %s\n",EWC-&gt;GetProperyName(),EWC-&gt;GetProperyValue()))+1]; wcscpy(OutPutFormattedData[i] ,HelperFormatMessage(L"%s: %s\n",EWC-&gt;GetProperyName(),EWC-&gt;GetProperyValue())); </code></pre> <p>}</p> <p>And the invoke code:</p> <pre><code>string[] strArr= new string[1]; NativeHelper.ProcessEvent(ref eventRecord, ref strArr); </code></pre> <p>I have two questions:</p> <ol> <li><p>Why when I check the value of the passed array in c# after calling this function I see it's empty (data is exist in c++ code, I debugged it) ?</p></li> <li><p>If I'm allocating memory in c++ dll, where I need to free it? in c++ or c#?</p></li> </ol> <p>Many thanks!</p> <p>Edit:</p> <p>signture of c++:</p> <pre><code>static __declspec(dllexport) void ProcessEvent(PEVENT_RECORD pEvent, wchar_t** OutPutFormattedData); </code></pre>
26,101,847
0
<p>Outlook Object Model cannot be used from a service. You can use </p> <ol> <li>Extended MAPI (C++ or Delphi only) </li> <li><a href="http://msdn.microsoft.com/en-us/library/office/dd877045(v=exchg.140).aspx" rel="nofollow">Exchange Web Services</a> if you are dealing with Exchange 2007 (or newer) mailboxes</li> <li><a href="http://www.dimastr.com/redemption/" rel="nofollow">Redemption</a> (its <a href="http://www.dimastr.com/redemption/rdo_introduction.htm" rel="nofollow">RDO family of objects</a> wraps Extended MAPI and can be used from any language).</li> </ol>
29,681,773
0
Run one jQuery function after another one finishes effect <p>I've written the following two functions:</p> <pre><code>&lt;script&gt; $('.tile').on('click', function () { $(".tile").addClass("flipOutX",1000).promise().done(function () { $(".tile-group.six").load("musability-musictherapy-company-overview.html"); }); }); &lt;/script&gt; </code></pre> <p>The first one performs a transition on some tiles that lasts about 3 seconds, and even though I have included .promise and .done the second function still loads the html page right away instead of waiting for the effect/transition to finish. I was thinking of using a setTimeinterval to make the second function wait until the first one finishes but I don't know how to use that to accomplish my desired behavior.</p> <p>THE WHOLE CSS OF TRANSITIONS ON THE PAGE </p> <pre><code>.animated { -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } .animated.infinite { -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; } .animated.two { -webkit-animation-delay: 120ms; animation-delay: 120ms; } .animated.three { -webkit-animation-delay: 320ms; animation-delay: 320ms; } .animated.four { -webkit-animation-delay: 520ms; animation-delay: 320ms; } .animated.five { -webkit-animation-delay: 720ms; animation-delay: 720ms; } .animated.six { -webkit-animation-delay: 920ms; animation-delay: 920ms; } .animated.seven { -webkit-animation-delay: 1020ms; animation-delay: 1020ms; } .animated.eight { -webkit-animation-delay: 1220ms; animation-delay: 1220ms; } .animated.nine { -webkit-animation-delay: 1620ms; animation-delay: 1620ms; } .animated.ten { -webkit-animation-delay: 1820ms; animation-delay: 1820ms; } .animated.eleven { -webkit-animation-delay: 2020ms; animation-delay: 2020ms; } .animated.twelve { -webkit-animation-delay: 2220ms; animation-delay: 2220ms; } @-webkit-keyframes flipInX { 0% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); transform: perspective(400px) rotate3d(1, 0, 0, 90deg); -webkit-transition-timing-function: ease-in; transition-timing-function: ease-in; opacity: 0; } 40% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); transform: perspective(400px) rotate3d(1, 0, 0, -20deg); -webkit-transition-timing-function: ease-in; transition-timing-function: ease-in; } 60% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); transform: perspective(400px) rotate3d(1, 0, 0, 10deg); opacity: 1; } 80% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); transform: perspective(400px) rotate3d(1, 0, 0, -5deg); } 100% { -webkit-transform: perspective(400px); transform: perspective(400px); } } @keyframes flipInX { 0% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); transform: perspective(400px) rotate3d(1, 0, 0, 90deg); -webkit-transition-timing-function: ease-in; transition-timing-function: ease-in; opacity: 0; } 40% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); transform: perspective(400px) rotate3d(1, 0, 0, -20deg); -webkit-transition-timing-function: ease-in; transition-timing-function: ease-in; } 60% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); transform: perspective(400px) rotate3d(1, 0, 0, 10deg); opacity: 1; } 80% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); transform: perspective(400px) rotate3d(1, 0, 0, -5deg); } 100% { -webkit-transform: perspective(400px); transform: perspective(400px); } } .flipInX { -webkit-backface-visibility: visible !important; backface-visibility: visible !important; -webkit-animation-name: flipInX; animation-name: flipInX; } /*CSS BIT FOR REVERSING THE ANIMATION ONCLICK EVENT 8*/ @-webkit-keyframes flipOutX { 0% { -webkit-transform: perspective(400px); transform: perspective(400px); } 30% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); transform: perspective(400px) rotate3d(1, 0, 0, -20deg); opacity: 1; } 100% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); transform: perspective(400px) rotate3d(1, 0, 0, 90deg); opacity: 0; } } @keyframes flipOutX { 0% { -webkit-transform: perspective(400px); transform: perspective(400px); } 30% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); transform: perspective(400px) rotate3d(1, 0, 0, -20deg); opacity: 1; } 100% { -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); transform: perspective(400px) rotate3d(1, 0, 0, 90deg); opacity: 0; } } .flipOutX { -webkit-animation-name: flipOutX; animation-name: flipOutX; -webkit-backface-visibility: visible !important; backface-visibility: visible !important; } </code></pre>
5,303,701
0
<p>They are ASP.NET Expressions.</p> <p>A very common usage is when using a resource file, like so</p> <pre><code>&lt;asp:Label id="label1" runat="server" text="&lt;%$ Resources: Messages, ThankYouLabel %&gt;" /&gt; </code></pre> <p>Read more on them here: <a href="http://msdn.microsoft.com/en-us/library/d5bd1tad.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/d5bd1tad.aspx</a></p>
37,387,514
0
OpenLayers3 - Animated .fit to a specific extent <p>I have created a map using OpenLayers3. I can succesfully zoom to a layer on the map using the following code: </p> <pre><code>map.getView().fit(extent, map.getSize()); </code></pre> <p>However I woulld like something similiar in an animated way.</p> <p>I know about the following animations:</p> <pre><code>ol.animation.pan ol.animation.zoom </code></pre> <p>By using these I can't zoom to a layer, using ol.animation.pan I can only pan to a point (and not to a boundingbox) and using ol.animation.zoom I can zoom to a resolution (and not to a boundingbox). So what I am looking for is an animated .fit so I can zoom animated to an extent.</p> <p>Any suggestions on how I can achieve that would be appreciated :)</p>
16,488,658
0
<p>When it comes to extracting data from an HTML document on the server-side, <a href="http://nodejs.org/" rel="nofollow">Node.js</a> is a fantastic option. I have used it successfully with two modules called <a href="https://github.com/mikeal/request" rel="nofollow">request</a> and <a href="https://github.com/MatthewMueller/cheerio" rel="nofollow">cheerio</a></p> <p>You can see an example how it works <a href="http://procbits.com/2012/04/11/quick-and-dirty-screen-scraping-with-node-js-using-request-and-cheerio" rel="nofollow">here</a></p>
38,205,189
0
ionic framework/bower install ng-cordova <p>I am working on ionic project to install ng-cordova, I ran this command</p> <blockquote> <p>bower install ngCordova</p> </blockquote> <p>this shows me</p> <blockquote> <p>bower ionic#1.3.1 ENOGIT git not installed or not in the path. </p> </blockquote> <p>Can anybody pls put me through?</p>
21,978,919
0
How can i insert decoded json data using json string in php mysql database <p>I have this JSON string.</p> <pre><code>{"Challenges":[{"phoneNumber":"1234567809","name":"Test2 Test2"},{"phoneNumber":"1234567890","name":"Test1 Test1"},{"phoneNumber":"8733806964*","name":"Dennish Desouzs"}],"Message":[{"message":"testchallenge1"}],"Level":[{"level_name":"testchallenge1","level_design":"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022200000000000080002000000000000000002000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000200000000000000000002000000000000000000220000000000000000002000000000000000000020000060000000000000200000000000000000002000000000000000000000000000000000000000000000000000000","win_time":3,"play_no":1,"top_user_id":"45","no_challenge":0,"user_id":"45","win_no":1}]} </code></pre> <p>code is as below: <pre><code>mysql_select_db("hello") or die('Cannot select Database'); mysql_select_db("hello") or die('Cannot select Database'); $string=$_GET['records']; $arr=json_decode($string); $levelArray=array(); foreach ($arr['Level'] as $key=&gt;$value) { $levelArray[] = $arr-&gt;Level; print_r($levelArray); $j = 0 ; foreach($levelArray as $levelItem) { mysql_query("INSERT INTO level(user_id,level_name,no_challenge,level_design,play_no,win_no,win_time,top_user_id)VALUES('".$levelArray[$j]-&gt;user_id."','".$levelArray[$j]-&gt;level_name.'","'.$levelArray[$j]-&gt;no_challenge.'","'.$levelArray[$j]-&gt;level_design.'","'.$levelArray[$j]-&gt;play_no.'","'.$levelArray[$j]-&gt;win_no.'","'.$levelArray[$j]-&gt;win_time.'","'.$levelArray[$j]-&gt;top_user_id."'"); } } ?&gt; </code></pre> <p>Problem is that I cannot insert data in the database by getting the values and at first I have to get all the data from the above string and then level string have to insert level table and challenge record string array should be insert in challenge table so what I should do to get this above string output?</p>
13,417,781
0
<p>In my case I have these messages when I show the sherlock action bar inderterminate progressbar. Since its not my library, I decided to hide the Choreographer outputs.</p> <p>You can hide the Choreographer outputs onto the Logcat view, using this filter expression :</p> <p><strong>tag:^((?!Choreographer).*)$</strong></p> <p>I used a regex explained elsewhere : <a href="http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word">Regular expression to match string not containing a word?</a></p>
8,887,146
0
<p>What is your desired functionality? I assume: shifting which LED is on every 2 seconds, keeping all the other LEDs off? "Sliding LED"...</p> <p>Also, I am assuming your target is an FPGA-type board.</p> <p>There is no free "wait for X time" in the FPGA world. The key to what you are trying to do it counting clock cycles. You need to know the clock frequency of the clock that you are using for this block. Once you know that, then you can calculate how many clock rising edges you need to count before "an action" needs to be taken.</p> <p>I recommend two processes. In one, you will watch rising edge of clock, and run a counter of sufficient size, such that it will roll over once every two seconds. Every time your counter is 0, then you set a "flag" for one clock cycle.</p> <p>The other process will simply watch for the "flag" to occur. When the flag occurs, you shift which LED is turned on, and turn all other LEDs off.</p>
15,689,640
0
Firewall blocking Android <p>I wrote an application using a lightweight http server in c# called nancyfx. the problem is that i can call the framework from the browser(localhost and from LAN pc) but android (also LAN) gets blocked.</p> <pre><code> String url = "http://192.168.178.35:8080/issue"; HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet(url); HttpContext localContext = new BasicHttpContext(); HttpResponse res = client.execute(get, localContext); </code></pre> <p>It gets stuck in the execute method and looks like its waiting for a timeout. Then comes the http exception HttpHostConnectionException: connection refused.</p> <p>If i turn off windows firewall it works. I also added a firewall rule for the program just in case. </p> <p>Are there any special rules for Android devices?</p>
6,415,176
0
<p>This is probably what you want. It creates a 'maximized' window without hiding the taskbar.</p> <pre><code>public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load( object sender, EventArgs e ) { FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; Left = Top = 0; Width = Screen.PrimaryScreen.WorkingArea.Width; Height = Screen.PrimaryScreen.WorkingArea.Height; } } </code></pre>
1,622,186
0
<p>I propose two solutions. The first mimics what NetBeans IDE generates:</p> <pre><code>CC=gcc .PHONY: all clean all: post-build pre-build: @echo PRE post-build: main-build @echo POST main-build: pre-build @$(MAKE) --no-print-directory target target: $(OBJS) $(CC) -o $@ $(OBJS) clean: rm -f $(OBJS) target </code></pre> <p>The second one is inpired by what Eclipse IDE generates:</p> <pre><code>CC=gcc .PHONY: all clean .SECONDARY: main-build all: pre-build main-build pre-build: @echo PRE post-build: @echo POST main-build: target target: $(OBJS) $(CC) -o $@ $(OBJS) @$(MAKE) --no-print-directory post-build clean: rm -f $(OBJS) target </code></pre> <p>Note that in the first one, pre and post builds are always called regardless of whether the main build is determined to be up to date or not.</p> <p>In the second one, the post-build step is not executed if the state of the main build is up to date. While the pre-build step is always executed in both.</p>
37,498,236
0
<p>numpy <strong>vectorized</strong> approach will be <strong>much</strong> faster compared to regular for/list comprehension/etc. especially on big lists:</p> <pre><code>import numpy as np listA = np.array([51, 988, 1336, 2067, 1857, 3160]) listB = np.array([1, 2, 3, 4, 5, 6]) result = listA / np.pi * ((listB*0.1)+1)**2 - np.pi * (listB*0.1)**2 </code></pre> <p>Output:</p> <pre><code>In [175]: result Out[175]: array([ 19.61148715, 452.74017757, 718.41005008, 1289.07255327, 1329.19288378, 2573.86868192]) </code></pre> <p><strong>Timing and comparison on two 1M lists:</strong></p> <pre><code>In [183]: A = np.random.randint(1,100, 10**6) In [184]: B = np.random.randint(1,100, 10**6) In [185]: formula = lambda n,x: n / pi * ((x*0.1)+1)**2 - pi * (x*0.1)**2 </code></pre> <p>Vectorized numpy approach:</p> <pre><code>In [186]: %timeit formula(A, B) 10 loops, best of 3: 65.4 ms per loop </code></pre> <p>List comprehension:</p> <pre><code>In [191]: %timeit [ formula(a,b) for a,b in zip(A.tolist(),B.tolist()) ] 1 loop, best of 3: 3.6 s per loop </code></pre> <p><strong>Conclusion:</strong> vectorized approach is 55 times faster</p>
12,512,366
0
Broadcast Receiver and Alarm manager <p>Hello I am building a news application in android, so that every time a new data is entered into database user must receive a notification in the notification bar. So after research I found that I have to use broadcast receiver and alarm manager. But what I am not able to understand is that when the application is closed how it will know that a new data is entered? and how to make the alarm manager activate the application for checking new data let's say every 5 minutes? Thank you.</p>
14,097,522
0
<pre><code>#menu { postion:fixed; top:0; background:#3B5998; same color as fb has width:100%; height:46px; left:0; z-index:2; //give this so, your header or menu will not get under content! } </code></pre>
4,937,427
0
<p>Try setting a specific width on div_timestamp, with JavaScript or CSS, 113px would do it for you.</p>
29,361,160
0
How to handle 'half-open' connections- managing client-side socket crash <p>We have a code of Client-Server written in 'C' underlying TCP protocol. The regular socket operations are being performed on both Client and Server. And <code>select()</code> function is being used to monitor multiple connections 'read/ write' mechanisms. The connection has been successfully <code>ESTABLISHED</code>. And using the same <code>select()</code> the connected client sends a message to server for releasing the connection. Up-to this we are happy.</p> <p>The main problem comes when the Client has some issues and has crashed/ stuck-up/ hanged in the middle or because of some other reasons mentioned in here: <a href="http://blog.stephencleary.com/2009/05/detection-of-half-open-dropped.html" rel="nofollow">Detection of Half-Open (Dropped) Connections</a>. The author mentioned about the 'four-way' handshaking! But how can we know the status of the client that has crashed until it sends some signal to Server? Is there a way to know about whether my client is still running (alive) or has some problems (dead) such that the Server closes that particular socket connection that was established? Please let us know. Thank you all... :)</p>
4,373,783
0
<p>I do not completely understand what do you mean by opening two shells ? If you run your silverlight application in two different windows or you have 2 instances of your WPF app then your Shells do not conflict. Even if you have one application with 2 instances of Bootstrapper there is no conflict - your two shells work completely independently. Let me know whether this help.</p>
9,941,015
0
<p>There's no built-in way to do that, you'd have to generate the XML yourself. That said, there are two cmdlets in PowerShell that creates an XML-based representation of an object: <code>Export-CliXml</code> and <code>ConvertTo-Xml</code>. Check the help for more information.</p>
25,893,800
0
r: how to remove row numbers coming from a separate list in multiple data frames using lapply <p>I have many data frames organized in a list object. And I have a second list of vectors, that contain row numbers that I want to remove in my data frames. The rows to be removed are different for each data frame. Therefore the number of elements in the list of data frames is equal to the number of elements in the list of vectors. Here the code I've tried out:</p> <pre><code>test_list&lt;-vector(mode="list",5) test_list&lt;-lapply(test_list, function(x) data.frame(1,1:10,"c")) vec_list&lt;-vector(mode="list",5) vec_list&lt;-lapply(vec_list, function (x) x&lt;-sample(seq(1,10),4)) clean_list&lt;-lapply(test_list, function (x,y) clean_list&lt;-x[-y,],vec_list) </code></pre>
15,980,707
0
<p>You can create a custom filter that inherits from FilterAttribute and implements IExceptionFilter. Then register it in global.asax.cs. Also you must enable custom errors handling in the web.config: </p> <pre><code>&lt;customErrors mode="On"/&gt; public class HandleErrorAndLogExceptionAttribute : FilterAttribute, IExceptionFilter { /// &lt;summary&gt; /// The method called when an exception happens /// &lt;/summary&gt; /// &lt;param name="filterContext"&gt;The exception context&lt;/param&gt; public void OnException(ExceptionContext filterContext) { if (filterContext != null &amp;&amp; filterContext.HttpContext != null) { if (!filterContext.IsChildAction &amp;&amp; (!filterContext.ExceptionHandled &amp;&amp; filterContext.HttpContext.IsCustomErrorEnabled)) { // Log and email the exception. This is using Log4net as logging tool Logger.LogError("There was an error", filterContext.Exception); string controllerName = (string)filterContext.RouteData.Values["controller"]; string actionName = (string)filterContext.RouteData.Values["action"]; HandleErrorInfo model = new HandleErrorInfo(filterContext.Exception, controllerName, actionName); // Set the error view to be shown ViewResult result = new ViewResult { ViewName = "Error", ViewData = new ViewDataDictionary&lt;HandleErrorInfo&gt;(model), TempData = filterContext.Controller.TempData }; result.ViewData["Description"] = filterContext.Controller.ViewBag.Description; filterContext.Result = result; filterContext.ExceptionHandled = true; filterContext.HttpContext.Response.Clear(); filterContext.HttpContext.Response.TrySkipIisCustomErrors = true; } } } </code></pre>
38,297,444
0
<p>Unless you really need them, it's easiest not to store the numbers you generate any longer than you need, as there will be 250640000 of them, taking about a Gb of memory. Instead, you can just call <code>table</code> immediately on them. Using <code>replicate</code> instead of a <code>for</code> loop (you're not using <code>i</code> anyway) will put the results into a nice matrix for you too:</p> <pre><code>Record &lt;- replicate(5000, table(sample(x = 0:9, size = 50128, replace = T))) Record[, 1:10] ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] ## 0 4999 4971 4919 5116 5101 5016 4861 5109 5063 4991 ## 1 5060 4959 4935 5047 5142 4927 5005 4920 5098 5023 ## 2 4916 4954 5019 4966 4994 4954 5049 5013 5031 5081 ## 3 4907 5007 5075 5042 4993 5015 5078 5037 4936 5073 ## 4 5117 4935 5003 5000 4970 5084 5008 4948 5115 5010 ## 5 4966 5146 5054 4944 5048 4935 5016 5104 5042 5010 ## 6 5055 4899 4964 5006 4977 5076 4943 5048 5064 4817 ## 7 5082 5040 5070 5034 4976 5056 5049 5012 4985 4983 ## 8 5094 5108 5014 4949 5052 5037 5073 5000 4894 5082 ## 9 4932 5109 5075 5024 4875 5028 5046 4937 4900 5058 </code></pre> <p>If you really need to store the numbers as well, you can use a similar approach:</p> <pre><code># Make a matrix of terms. Warning: big. Terms &lt;- replicate(5000, sample(x = 0:9, size = 50128, replace = T)) # Apply table to each column (set of samples) Record &lt;- apply(Terms, 2, table) </code></pre> <p>Alternately, if you're storing the samples, instead of using <code>replicate</code> you could just sample directly into a matrix:</p> <pre><code>Terms &lt;- matrix(sample(x = 0:9, size = 50128 * 5000, replace = T), nrow = 50128) Record &lt;- apply(Terms, 2, table) </code></pre> <p><code>Record</code> (and <code>Terms</code>, if stored) will look the same regardless, though the time required may vary.</p>
1,488,531
0
.Net WinForm System Beep on a 64 Bit OS <p>My application needs to beep when validation fails so the user (who may be several feet away) may hear it. I'd like to use the <code>Console.Beep()</code> but this is <a href="http://msdn.microsoft.com/en-us/library/8hftfeyw.aspx" rel="nofollow noreferrer">unavailable in a x64 environment (see the remarks)</a>. There may or may not be speakers in/at the computer, so I can't use <code>System.Media.SystemSounds.Beep.Play()</code>. </p> <p>The current target platform is a x86 environment, but I'd like to have the ability for the application to run in x64 also.</p> <p>Is there a way to do this or should I just give up?</p> <p><strong>Edit</strong>: Added link to the method.</p>
38,611,508
0
getting duplicate values in map for every key <p>I am trying to put all values in map and i have more then 20k values , now I am trying to put values in map by using idea as key 1 contains values from 1(consider i) to 1000 (i.e i*1000) but the output I'm getting contains duplicate values (key 1 &amp; 2 have same values), not sure what wrong I am doing </p> <p>here is code</p> <pre><code> public class GetNumbers { public static List&lt;String&gt; createList() throws IOException { List&lt;String&gt; numbers = new LinkedList&lt;&gt;(); Path path = null; File file = null; BufferedReader reader = null; String read = ""; try { path = Paths.get("file.txt"); file = path.toFile(); reader = new BufferedReader(new FileReader(file)); while ((read = reader.readLine()) != null) { numbers.add(read); } } catch (FileNotFoundException e) { e.printStackTrace(); } return numbers; } public static Map&lt;Integer, List&lt;String&gt;&gt; createNewFiles() throws IOException { Map&lt;Integer, List&lt;String&gt;&gt; myMap = new HashMap&lt;&gt;(); List&lt;String&gt; getList = GetNumbers.createList(); List&lt;String&gt; list = null; int count = getList.size() / 1000; ---------------------------doubt full code----------------------------------- for (int i = 1; i &lt;= count; i++) { if (getList.size() &gt; 1000) { list = getList.subList(i, i * 1000); } else if (getList.size() &lt; 999) { list = getList.subList(i, getList.size()); } ----------------------------------------------------------------------------- myMap.put(i, list); } return myMap; } public static void getMap() throws IOException { Map&lt;Integer, List&lt;String&gt;&gt; map = GetNumbers.createNewFiles(); List&lt;String&gt; listAtIndexOne = map.get(2); List&lt;String&gt; listAtIndexTwo = map.get(1); for (String elementFromFirstList : listAtIndexOne) { for (String elementFromSecondList : listAtIndexTwo) { if (elementFromFirstList.equals(elementFromSecondList)) { System.out.println("duplicate copy"); } } } } public static void main(String[] args) { try { GetNumbers.getMap(); } catch (IOException e) { e.printStackTrace(); } } } </code></pre> <p><strong>EDIT</strong></p> <p>if I change my Code to </p> <pre><code>for (int i = 0; i &lt;= count; i++) { if (getList.size() &gt; (i * 1000)) { list = getList.subList(i, (i + 1) * 1000); } else if (getList.size() &lt; 999) { list = getList.subList(i, getList.size()); } myMap.put(i, list); } </code></pre> <p>I'm getting</p> <blockquote> <p>Exception in thread "main" java.lang.IndexOutOfBoundsException: toIndex = 25000 at java.util.SubList.(Unknown Source) at java.util.AbstractList.subList(Unknown Source) at com.dnd.GetNumbers.createNewFiles(GetNumbers.java:43) at com.dnd.GetNumbers.getMap(GetNumbers.java:54) at com.dnd.GetNumbers.main(GetNumbers.java:69)</p> </blockquote> <p>Any help is appreciated</p> <p>Thanks </p>
26,495,170
0
<p>One could use Where-Object</p> <p><code> if ((Get-Service | Where-Object {$_.Name -eq $serviceName}).length -eq 1) { "Service Exists" } </code></p>
25,614,742
0
<p>There are many ways. Check this out:</p> <pre><code>&lt;img id="theImage" src="" /&gt; &lt;ul&gt; @foreach (var i in Model.Picture) { &lt;li&gt;&lt;a href="#" data-image="@i.picturePath" class="change-image"&gt;@i.picturePath&lt;/a&gt;&lt;/li&gt; } &lt;/ul&gt; &lt;script type="text/javascript"&gt; $(function () { //Click event for the image links $('.change-image').click(function (e) { e.preventDefault(); e.stopPropagation(); $('#theImage').attr('src', $(this).data('image')); }); //Display the first link $('#theImage').attr('src', $('ul li:first-child a.change-image').data('image')); }); &lt;/script&gt; </code></pre> <p>Notice that I'm using jQuery.</p> <p>Please let me know if this helps.</p>
5,104,402
0
Shared Access 2003 database performance <p>I've to create a Access 2003 database and share it among 100 users, users won't be doing any modifications, only viewing several reports that are generated daily (and once) using a scheduled task on the host machine.</p> <p>Would a simultaneous 100 users break the performances down in that context?</p> <p>What would you advise me regarding this workflow?</p> <p>Exclude:</p> <ul> <li>Using a database server (sqlserver,...etc) is out of topic</li> <li>I've already thought about outputting the reports into static html, but now I want to first evaluate the sharing of the whole database (because filtering capability might be needed)</li> <li>I'd like to avoid replication</li> </ul>
16,048,022
0
<p>It means your <code>dataArray</code> is used to give a sorted array based on the comparison of the "1" property of each element of the original array. </p> <p>For example if it is an array of strings, the second char is used as the comparator. If it is an array of arrays, the second element of each array is used. </p> <p>Its a shortcut for defining an iterator function which extract the given property of each item.</p> <p>Then reverse does what it has always done, reversing the array.</p>
39,547,700
0
unexpected title bar behavior in WPF RibbonWindow <p>i am using the Microsoft ribbon control. i need to merge the ribbon title bar and the window title bar but i get very bad results as it is shown in below picture. Also what i need is in the picture.</p> <p>please provide me the solution for these:</p> <ul> <li>the title bar to be usual as other applications like paint.</li> <li>show the quick access toolbar items in title bar</li> </ul> <p>thank you</p> <p><a href="https://i.stack.imgur.com/J1AM3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J1AM3.jpg" alt="enter image description here"></a></p> <p>the code in xaml is as below:</p> <pre><code>&lt;ribbon:RibbonWindow x:Uid="RibbonWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking" x:Class="WpfRibbonApplication1.MainWindow" Title="MainWindow" x:Name="RibbonWindow" Width="640" Height="480"&gt; &lt;Grid x:Uid="LayoutRoot" x:Name="LayoutRoot"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition x:Uid="RowDefinition_1" Height="Auto"/&gt; &lt;RowDefinition x:Uid="RowDefinition_2" Height="*"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;ribbon:Ribbon x:Uid="Ribbon" x:Name="Ribbon" Title="Ribbon Title"&gt; &lt;ribbon:Ribbon.HelpPaneContent&gt; &lt;ribbon:RibbonButton x:Uid="ribbon:RibbonButton_1" Content="1" /&gt; &lt;/ribbon:Ribbon.HelpPaneContent&gt; &lt;ribbon:Ribbon.QuickAccessToolBar&gt; &lt;ribbon:RibbonQuickAccessToolBar x:Uid="ribbon:RibbonQuickAccessToolBar_1" &gt; &lt;ribbon:RibbonButton x:Uid="QATButton1" x:Name="QATButton1" Content="2" /&gt; &lt;ribbon:RibbonButton x:Uid="QATButton2" x:Name="QATButton2" Content="3" /&gt; &lt;/ribbon:RibbonQuickAccessToolBar&gt; &lt;/ribbon:Ribbon.QuickAccessToolBar&gt; &lt;ribbon:Ribbon.ApplicationMenu&gt; &lt;ribbon:RibbonApplicationMenu x:Uid="ribbon:RibbonApplicationMenu_1"&gt; &lt;ribbon:RibbonApplicationMenuItem x:Uid="MenuItem1" Header="Hello _Ribbon" x:Name="MenuItem1" /&gt; &lt;/ribbon:RibbonApplicationMenu&gt; &lt;/ribbon:Ribbon.ApplicationMenu&gt; &lt;ribbon:RibbonTab x:Uid="HomeTab" x:Name="HomeTab" Header="Home"&gt; &lt;/ribbon:RibbonTab&gt; &lt;/ribbon:Ribbon&gt; &lt;/Grid&gt; </code></pre> <p></p>
30,485,991
0
<p>The answer is: You cannot use an alias name in GROUP BY.</p> <p>So:</p> <pre><code>GROUP BY (SELECT customer_address.post_code ...); </code></pre> <p>Or:</p> <pre><code>select postcode, sum(order_no) from ( SELECT (SELECT customer_address.post_code FROM customer_address WHERE customer_address.address_type = 0 AND customer_address.customer_no = orders.customer_no) postcode, orders.order_no FROM orders, customer_address WHERE orders.delivery_date = '27-MAY-15' ) GROUP BY postcode; </code></pre> <p>EDIT:</p> <p>However, your query seems wrong. Why do you cross-join orders and customer_address? By mistake I guess. Use explicit joins (<code>INNER JOIN customer_address ON ...</code>), when using joins to avoid such errors. But here I guess you'd just have to remove <code>, customer_address</code>.</p> <p>Then why do you add order numbers? That doesn't seem to make sense.</p>
7,084,812
0
<pre><code>TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); </code></pre>
30,332,291
0
Excel Visual Basic Run-time error '1004' when initializing a variable <p>I am learning visual basic and this script I'm using is coming up with an error when I am initializing the variable <code>i</code>.</p> <p>I'm not sure what the problem is but I am getting the error message:</p> <blockquote> <p>Run-time error '1004': Application-defined or object-defined error</p> </blockquote> <p>Here is my code:</p> <pre><code>Sub excelmacro() Sheets("Sheet1").Select Range("A1").Select Sheets("Sheet2").Select Range("B1").Select i = 1 While i &lt;&gt; 10 If Len(ActiveCell.Value) &gt; 1 Then Sheets("Sheet1").Select xname = Right(ActiveCell.Value, Len(ActiveCell.Value) - 6) xsalary = Right(ActiveCell.Value, Len(ActiveCell.Offset(2, 0).Value) - 8) xdesignation = Right(ActiveCell.Value, Len(ActiveCell.Offset(1, 0).Value) - 13) Sheets("Sheet2").Select ActiveCell.Value = xname ActiveCell.Offset(0, 1).Value = xdesig ActiveCell.Offset(0, 3).Value = xsalary ActiveCell.Offset(1, 0).Select Sheets("Sheet1").Select ActiveCell.Offset(3, 0).Select Else i = 10 End If Wend End Sub </code></pre>
8,779,108
0
How do I make a libGDX Desktop application resizable? <p>libGDX Applications must implement the .resize(int width, int height) method, so I figured that resizing a libGDX app is not a big deal, but I found no way to make the actual application JFrame or whatever that is draggable as with JFrame.setResizable(true). Is that simply not possible with libGDX ?</p>
32,369,957
0
<p>Maybe your routing can be simplified as follows</p> <pre><code>angular.module("nk.login", [ 'ngRoute', 'ngAnimate' ]). config(['$stateProvider',function($stateProvider){ $stateProvider .state('app.login', { url: '/login', templateUrl: 'src/login/templates/login.html', controller: 'loginController' }) .state('app.forgotPassword', { url: '/forgot', templateUrl: 'src/login/templates/forgotPassword.html', controller: 'forgotPasswordController' }) }]); </code></pre> <p>Is there any specific reason for the views/content property?</p>
3,615,473
0
<p>Perhaps, one way that I can think of is </p> <ol> <li>Create a wrapper class - say KeyProcessor to queue up items for a key. </li> <li>KeyProcessor.Run() method will be capable of whatever queuing semantics that you need for. Essentially it would look for internal queue for any pending work and then keep doing it sequentially.</li> <li>Maintain the dictionary of KeyProcessor objects.</li> <li>For any new task, check in the dictionary for the same key. If does not exist then add it. Queue the task on it. If its not running then schedule it with TPL using Run method as action.</li> <li>Use ContinueWith to schedule maintainer task - for example, whenever Task executing KeyProcessor.Run is completed, continuation tasks can check if there are any more tasks been scheduled for the same key (since it has completed) and start it again OR remove from dictionary.</li> </ol> <p>All above would have been tricky from thread sync point not for few interesting collections present in <a href="http://msdn.microsoft.com/en-us/library/system.collections.concurrent.aspx" rel="nofollow noreferrer">System.Collections.Concurrent</a> namespace. This would make the above logic much more simpler. For example, <a href="http://msdn.microsoft.com/en-us/library/ee378677.aspx" rel="nofollow noreferrer">ConcurrentDictionary.GetOrAdd </a> will allow to lookup and/or add the KeyProcessor object in thread-safe way.</p>
4,214,547
0
Windows Mobile - Hide Application <p>I am developing an application for enterprise which can be installed on employee phones to track usage of phones and enforce certain security policies on phone.</p> <p>My application needs to be hidden. It should not be shown in: </p> <ol> <li>Running Programs in Task Manager</li> <li>Program Files</li> </ol> <p>How to do above using .NETCF 2.0 and C#?</p>
37,951,439
0
<p>Found my answer in <a href="http://vimcasts.org/episodes/the-file-explorer/" rel="nofollow">this</a> Vimcast. <code>:Explore</code> or <code>:E</code> will open up Netrw in the current file's directory. I got an <code>ambiguous use of user-defined command</code> error at first when I tried to use <code>:E</code>, but <a href="http://stackoverflow.com/questions/14367440/map-e-to-explore-in-command-mode">this</a> SO answer helped fix that. I just had to add this command to my <code>.vimrc</code>, <code>command! -nargs=* -bar -bang -count=0 -complete=dir E Explore &lt;args&gt;</code>. <code>:E</code> only works if there are no other possible commands that start with <code>:E</code>.</p>
36,366,818
0
<p>There are well-tested wheels used to tear apart URLs into the component parts so use them. Ruby comes with <a href="http://ruby-doc.org/stdlib-2.3.0/libdoc/uri/rdoc/URI.html" rel="nofollow">URI</a>, which allows us to easily extract the <code>host</code>, <code>path</code> or <code>query</code>:</p> <pre><code>require 'uri' URL = 'http://foo.com/a/b/c?d=1' URI.parse(URL).host # =&gt; "foo.com" URI.parse(URL).path # =&gt; "/a/b/c" URI.parse(URL).query # =&gt; "d=1" </code></pre> <p>Ruby's <a href="http://ruby-doc.org/core-2.3.0/Enumerable.html" rel="nofollow">Enumerable</a> module includes <a href="http://ruby-doc.org/core-2.3.0/Enumerable.html#method-i-reject" rel="nofollow"><code>reject</code></a> and <a href="http://ruby-doc.org/core-2.3.0/Enumerable.html#method-i-select" rel="nofollow"><code>select</code></a> which make it easy to loop over an array or enumerable object and reject or select elements from it:</p> <pre><code>(1..3).select{ |i| i.even? } # =&gt; [2] (1..3).reject{ |i| i.even? } # =&gt; [1, 3] </code></pre> <p>Using all that you could check the host of a URL for sub-strings and reject any you don't want:</p> <pre><code>require 'uri' %w[ http://www.speedtest.net/ http://webcache.googleusercontent.com/search%3Fhl%3Den%26biw%26bih%26q%3Dcache:M47_v0xF3m8J ].reject{ |url| URI.parse(url).host[/googleusercontent\.com$/] } # =&gt; ["http://www.speedtest.net/"] </code></pre> <p>Using these methods and techniques you can reject or select from an input file, or just peek into single URLs and choose to ignore or honor them.</p>
37,363,011
0
<p>Let try this query instead:</p> <pre><code>uniqBk = Bikehistory.where("JOIN ( SELECT id, DISTINCT bike_numbers FROM bikehistories ) as temp ON temp.id = id") .order(:bike_numbers) </code></pre>