pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
25,899,116 | 0 | Powershell Environment Setup <p>This is a very quick question because I'm nervous to break my batch file/java environment or make my laptop explode.</p> <p>I used to used to execute a .bat file from cmd.exe to set my environment to java which worked and that but now I've upgraded to Windows Powershell.</p> <p>I've created a Powershell .ps version of the .bat file to set my java environment path as bellow.</p> <pre><code>echo "setting environment to Java" $env:path="$env:Path;C:\Program Files\Java\jdk1.8.0\bin" </code></pre> <p>This works fine but I was wondering if it's possible to include a second line to add the JDBC to the classpath as well</p> <pre><code>echo "setting environment to Java" $env:path="$env:Path;C:\Program Files\Java\jdk1.8.0\bin" $env:path="$env:Path;C:\Program Files (x86)\MySQL\MySQL Connector J" </code></pre> <p>just wanted a second opinion to avoid breaking everything (which I have done before).</p> <p>Will this end up setting my environment and adding an additional classpath or will it just overwrite the environment with just the MySQL Connector path.</p> |
5,480,650 | 0 | <p>Try this:</p> <pre><code>imageView.opaque = NO; imageView.backgroundColor = [UIColor clearColor];</code></pre> <p>Also, the image used to mask should be black and white (not transparent).</p> |
12,665,688 | 0 | <p>You are checking for <code>Submit</code> in <code>$_POST</code>, but the method specified in the form is <code>GET</code>.</p> <p>To have it work, change the PHP code to look for <code>$_GET['Submit']</code>.</p> <p>(But I'd move instead everything, form method included, to <code>POST</code>).</p> <p>That said, your script seems to have been pasted twice, the second version using <code>$q</code> instead of <code>$trimmed</code> (is <code>$q</code> defined?), and a SQL table called 'table' instead of 'questions':</p> <pre><code>// get results $query = "SELECT * FROM table WHERE question LIKE '%$q%' OR name LIKE '%$q%' or detail like '%$q%'"; $result = mysql_query($query) or die("Couldn't execute query"); </code></pre> |
25,828,708 | 0 | <p>Ok so I fixed the mins subtracting but I am still confused on reporting the ticket. And where do I set pm and pc</p> |
24,901,426 | 0 | <h1>PubNub Unsubscribe All Users from a Specific Channel</h1> <p>Use a control channel to specify which channels all users should subscribe to.</p> <pre><code>// Subscribe to 'control' channel pubnub.subscribe({ channel : 'control', message : function(command) { // Unsubscribe Command if (command.type == 'unsubscribe') return pubnub.unsubscribe({ channel : command.channel }); } }) // Subscribe to other channels pubnub.subscribe({ channel : 'ch1,ch2', message : function(msg) { console.log(msg) } }) </code></pre> <p>This will signal all users listening on the <code>control</code> channel to unsubscribe from a specific channel name. This works pretty well out of the box. And the signal you would send to unsubscribe will look like this:</p> <pre><code>pubnub.publish({ channel : 'control', message : { command : 'unsubscribe', channel : 'channel_to_unsubscribe' } }) </code></pre> |
14,197,211 | 0 | <p>Technically, the distinction is not really made between "unrecoverable error" and "recoverable error", but between checked exceptions and unchecked exceptions. Java <em>does</em> distinguish between them as follows:</p> <ul> <li>you <em>must</em> declare a checked exception in your <code>throws</code> clause; if using a method which throws a checked exception in a <code>try</code> block, you must either <code>catch</code> said exception or add this exception to your method's <code>throws</code> clause;</li> <li>you <em>may</em> declare an unchecked exception in your <code>throws</code> clause (not recommended); if using a method which throws an unchecked exception in a <code>try</code> block, you <em>may</em> <code>catch</code> that exception or add this exception to your method's <code>throws</code> clause (not recommended either).</li> </ul> <p>What is certainly not recommended, unless you <em>really</em> know what you are doing, is to "swallow" any kind of unchecked exception (ie, <code>catch</code> it with an empty block).</p> <p><code>Exception</code> is the base checked exception class; <code>Error</code> and <code>RuntimeException</code> are both unchecked exceptions, and so are all their subclasses. You will note that all three classes extend <code>Throwable</code>, and the javadoc for <code>Throwable</code> states that:</p> <blockquote> <p>For the purposes of compile-time checking of exceptions, Throwable and any subclass of Throwable that is not also a subclass of either RuntimeException or Error are regarded as checked exceptions.</p> </blockquote> <p>Classical examples of (in)famous unchecked exceptions:</p> <ul> <li><code>OutOfMemoryError</code> (extends <code>Error</code>);</li> <li><code>StackOverflowError</code> (extends <code>Error</code>);</li> <li><code>NullPointerException</code> (extends <code>RuntimeException</code>);</li> <li><code>IllegalArgumentException</code> (extends <code>RuntimeException</code>);</li> <li>etc etc.</li> </ul> <p>The only real difference between <code>Error</code> and <code>RuntimeException</code> is their estimated severity level, and is a "semantic" difference, not a technical difference: ultimately, both behave the same. Some IDEs (Intellij IDEA comes to mind) will also yell at you if you catch an <code>Error</code> but do not rethrow it.</p> |
30,327,271 | 0 | <p>Another possible workaround is instead of <code>Visibility</code> property use <code>Opacity</code>. In this case calling <code>Focus()</code> actually sets focus.</p> |
4,171,212 | 0 | <p>The result shows that dot is more preferable if there are no variables or $ symbol involved which is around 200% faster. On the other hand, commas will help to increase around 20%-35% efficiency when dealing with $ symbols.</p> <p><a href="http://hungred.com/useful-information/php-micro-optimization-tips/" rel="nofollow">source</a></p> |
2,778,233 | 0 | <p>You should be using <a href="http://ruby-doc.org/core/classes/Kernel.html#M005965" rel="nofollow noreferrer"><code>Kernel::Float</code></a> to convert the number; on invalid input, this will raise an error instead of just "trying" to convert it.</p> <pre><code>>> "10.5".to_f => 10.5 >> "asdf".to_f # do you *really* want a zero for this? => 0.0 >> Float("asdf") ArgumentError: invalid value for Float(): "asdf" from (irb):11:in `Float' from (irb):11 >> Float("10.5") => 10.5 </code></pre> |
31,303,423 | 0 | <p>You need to quote the string, because your shell is eating the content of the <code>{}</code> as an expansion. So use <code>git stash apply 'stash@{2}'</code>. Alternatively you can use the SHA of the stash, or next time when you apply it, you can name the stash yourself.</p> |
28,365,063 | 0 | <p>Two quick thoughts:</p> <ol> <li><p>You can give some threshold for the confidence value you want. For example, mallet is saying that Page 1 belongs to Class A with 90% confidence, accept it. If it is saying that Page 2 belongs to Class C, with 60% confidence, and that is the best value, may be, reject that suggestion. You can get the scores of classification through the function-getClassificationScores (<a href="http://mallet.cs.umass.edu/api/cc/mallet/classify/MaxEnt.html#getClassificationScores(cc.mallet.types.Instance,%20double[])" rel="nofollow">documentation: </a><a href="http://mallet.cs.umass.edu/api/cc/mallet/classify/MaxEnt.html#getClassificationScores(cc.mallet.types.Instance" rel="nofollow">http://mallet.cs.umass.edu/api/cc/mallet/classify/MaxEnt.html#getClassificationScores(cc.mallet.types.Instance</a>, double[])</p></li> <li><p>You can you scikit-learn in python. I have heard that if it doesn't know which class your page belongs to, it will tell <code>NA</code>. </p></li> </ol> |
4,074,857 | 0 | merge and match two csv files with .net <p>i've got two csv files that i want to merge. Basically, i've got my source file, and the second file will add information to that file using a primary key that they both share.</p> <p>I've done this using v-lookup but since this will be a weekly process, i want to automate it using vb.net or C#. any ideas?</p> <p>Thanks</p> |
4,731,341 | 0 | <p>NSOutlineView is an NSTableView subclass. Therefore -rowsInRect: can be combined with -visibleRect (from NSView). Use -levelForRow: to determine the level.</p> |
13,308,828 | 0 | <p>Try changing</p> <p>move_uploaded_file($file_tmp, '/members/'); in move_uploaded_file($file_tmp, 'members/' + $filename);</p> <p>And make sure to set permission right with chamod. chmod -R 0755 members. Also make sure that you're app have access at $file_temp location and read/write permision</p> |
30,672,381 | 0 | <p>11.2 sums it up for iOS, you must use In-App Purchase for purchase from within the app. You may not direct or link the user to an outside payment option.</p> <p>It is possible to use payments completely outside the app in a similar manner to Amazon Books but there can to be a link or reference to that service. Take a good hard look at Amazon Kindle app.</p> |
40,820,693 | 0 | Two different values at the same memory address - assembly <p>I have some code in assembly which behaves a little bit strange. I have a C extern function that calls with <em>asm</em> another function from an .asm file. This C function puts on the stack three addresses used by my function from .asm file. All went well untill this appeared:</p> <pre><code>; Let's say we take from the stack first parameter from my C function. ; This parameter is a string of bytes that respect this format: ; - first 4 bytes are the sign representation of a big number ; - second 4 bytes are the length representation of a big number ; - following bytes are the actual big number section .data operand1 dd 0 section .text global main main: push ebp mov ebp, esp mov eax, [ebp + 8] ; Here eax will contain the address where my big number begins. lea eax, [eax + 8] ; Here eax will contain the address where ; my actual big number begins. mov [operand1], eax PRINT_STRING "[eax] is: " PRINT_HEX 1, [eax] ; a SASM macro which prints a byte as HEX NEWLINE PRINT_STRING "[operand1] is: " PRINT_HEX 1, [operand1] NEWLINE leave ret </code></pre> <p>When running this code, I get at the terminal the correct output for [eax], and for [operand1] it keeps printing a number which will not change if I modify that first parameter of my C function. What am I doing wrong here?</p> |
5,323,995 | 0 | how to get the url/xmlhttprequest that loads to get the data from a server? <p>i have this problem that i can't solve for days now...here is my code. i want to get the xmlhttprequest or the url that loads everytime i clicked the $("#btnQuery"). what happened here is when i clicked the button, it will display the data in jqgrid from the server. </p> <pre><code> $("#btnQuery").click( function() { var params = { "ID": $("#eID3").val(), "dataType": "data" } var url = 'process.php?path=' + encodeURI('project/view') + '&json=' + encodeURI(JSON.stringify(params)); $('#tblD').setGridParam({ url:url, datatype: ajaxDataType, }); $('#tblD').trigger('reloadGrid'); $('#firstur').append('the url: ' + url+'<br>');//the xmlhttpRequest should disply here in my html $('#secur').append('response: ' + url+'<br>'); //the response of xmlhttpRequest should display here in my html }); </code></pre> <p>here's the code of my process.php. this is where i'm going to get the data for my jqgrid.</p> <pre><code> <?php print(file_get_contents("http://localhost/" . $_GET["path"] . "?json=" . ($_GET["json"]))); ?> </code></pre> <p>in firebug console, the xmlhttprequest/location that displays is: <a href="http://localhost/process.php?....%22:%22%22,%22Password%22:%22%22%7D" rel="nofollow">http://localhost/process.php?....%22:%22%22,%22Password%22:%22%22%7D</a></p> <p>and it's response body is simething like:</p> <pre><code>{"result":{"ID":"1C1OMk123tJqzbd"}, "time_elapsed":0} </code></pre> <p>does anybody here knows how to get the url/xmlhttprequest that loads to get the data? and its response body? i wan to display it in my html body aside from my jqgrid...is there anyone who can help me?..please... thank you so much</p> |
4,867,515 | 0 | <p>This is strange, if I'm reading your code correctly. Is there a reason that you can't maintain the collection and modify it (as opposed to re-creating it) so that you don't need to <code>RaisePropertyChanged</code> at all? That's what <code>ObservableCollection(of T)</code> does, after all. </p> <p>As I'm reading it, it might as well be an <code>IEnumerable(of T)</code>.</p> <p>(Creating a new <code>ObservableCollection(of T)</code> in a property getter is almost always a mistake. A <code>ReadOnlyObservableCollection(of T)</code> makes a lot more sense in that context.)</p> |
30,308,560 | 0 | <p>This is happening because of less information. I think you want to do this:</p> <pre><code>In [7]: x = Symbol('x', real=True) In [8]: (log(exp(exp(x)))).simplify() Out[8]: exp(x) </code></pre> |
36,737,513 | 0 | <p>As you said in the answers above, the field got manually removed from the database, so the migration tries to delete a field that is no longer existing in the database.</p> <p>Normally you should never delete fields directly in the db but use the migrations instead. As the field is already gone you can now only fake the migration to tell django that the changes were already made:</p> <pre><code>manage.py migrate rentals 0002 --fake </code></pre> <p>Make sure though that you are at migration 0001, otherwise that would be faked aswell.</p> <p>just to be sure, you could run the following command first:</p> <pre><code>manage.py migrate rentals 0001 </code></pre> |
40,672,286 | 0 | Android show GPS position on "ground" <p>I want to make a GPS application that shows a flat plain as ground and arrow (as user position) in the middle, while it should be possible to move along, the arrow should stay in the middle of screen and the ground should move. Also with a possibility of drawing on this "ground". Something like this:</p> <p><a href="https://i.stack.imgur.com/OdEHD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OdEHD.jpg" alt="."></a></p> <p>I have GPS coordinates from external GPS through USB ports, so I would like to use them instead of phones GPS - I already have that one part. I am really stuck on how can I show the ground and move arround with drawing a path. I do not want to use google maps, because I dont need a map. Is something like this possible to do? I do not need 3D, a 2D would be OK as well. Please, help me on showing the ground and moving arround with a location (or I can convert my location to carthesian coordinations). </p> |
13,792,488 | 0 | <pre><code>CC=gcc CPPFLAGS=-I include VPATH=src include main: main.o method1.o method2.o method3.o method4.o -lm $(CC) $^ -o $@ main.o: main.c main.h $(CC) $(CPPFLAGS) -c $< method1.o: method1.c $(CC) $(CPPFLAGS) -c $< method2.o: method2.c $(CC) $(CPPFLAGS) -c $< method3.o: method3.c $(CC) $(CPPFLAGS) -c $< method4.o: method4.c $(CC) $(CPPFLAGS) -c $< </code></pre> <p>it worked like this</p> |
20,958,258 | 0 | Is throwing InterruptedException essential when stopping threads? Can I use another exception type? <p>I have tournament code for students' codes. Therefore I have no control over the students' codes.</p> <p>I need to implement timeout for students' code calls (they run in separate threads). So I instrumented their code and inserted right after loop and method definitions the following code:</p> <pre><code>if (Thread.interrupted()) throw new InterruptedException(); </code></pre> <p>The problem is <code>InterruptedException</code> is checked, and therefore I have to add <code>throws</code> declarations to all methods, which can break overriding methods' signatures.</p> <p>So I thought I could not throw <code>InterruptedException</code>, but an unchecked one, e.g. <code>RuntimeException</code>. Can I do it? Will there be some difference?</p> <p>In my tournament code I start the students' code as a futrure in an <code>ExecutorService</code> and try to get the result using <code>get()</code> with timeout.</p> |
39,367,174 | 0 | <p>If you want to Read value of PBI Slicer/ Filter and recalculate the Data and Generate Graph accordingly, R Script Visual is the answer.</p> <ul> <li>Create R script using loaded columns and filters, </li> <li>Make sure this generates visual, else ERROR. </li> <li>During calculation Generated DF are not loaded in Datasource But can be used to Refresh the Graph.</li> <li>The visual, reads data from filter, runs script generates DF and hence Dynamic graphs.</li> </ul> <p><a href="https://i.stack.imgur.com/QQAZw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QQAZw.png" alt="enter image description here"></a></p> |
24,932,015 | 0 | <p>the empty view positioning in the layout is done 100% by the developer. Yes, that is by design, Android in general favours flexibility than easy of coding.</p> <p>If you look in the <a href="https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/AdapterView.java" rel="nofollow"><code>AdapterView</code> source code</a> you'll see what I'm talking about, around line 737 you'll see this</p> <pre><code>mEmptyView.setVisibility(View.VISIBLE); </code></pre> <p>and this</p> <pre><code>if (mEmptyView != null) mEmptyView.setVisibility(View.GONE); </code></pre> <p>that means, all that the <code>ListView</code> do with the <code>emptyView</code> object you're passing is calling <code>setVisibility(boolean)</code> on it.</p> <p>So, now that we know it's just a normal layout, with no special treatment it's easier to handle it. If you don't want to write on your layout again and again the same XML for empty view, you can (should) have a empty_view.xml with just the empty view and inside each of your XML with the list you position the empty_view.xml using the <code><include></code> tag. Like this: <a href="http://developer.android.com/training/improving-layouts/reusing-layouts.html" rel="nofollow">http://developer.android.com/training/improving-layouts/reusing-layouts.html</a> and on the code you simply call:</p> <pre><code>listview.setEmptyView(root.findViewById(R.id.empty_view)); </code></pre> <p>or you can do it by code still... but that will involve setting layout params for the "parent" to proper organise it.</p> <p>hope it helps.</p> |
38,947,552 | 0 | <p><code>hobby</code> is a <code>String</code> and <code>String</code>s don't have a method called <code>add</code> in Java.</p> <p>You should change <code>hobby</code>'s type from <code>String</code> to <code>String[]</code> because there is a <code>hobby[rando]</code> in the code that indicates <code>hobby</code>'s type must be <code>String[]</code></p> |
28,779,585 | 0 | What's wrong with gcc version before 4.4 implementation on thread local storage? <p>I saw this, </p> <blockquote> <h1>warning "GCC versions before 4.4 implement thread_local storage incorrectly, so you can not use some parts of Loki."</h1> </blockquote> <p>in the loki library source code. More details on this page:</p> <p><a href="http://sourceforge.net/p/loki-lib/code/HEAD/tree/trunk/include/loki/ThreadLocal.h#l53" rel="nofollow">http://sourceforge.net/p/loki-lib/code/HEAD/tree/trunk/include/loki/ThreadLocal.h#l53</a></p> <p>So, What's wrong with gcc version before 4.4 implementation on thread local storage?</p> |
11,013,373 | 0 | Backbone error, Cannot read property 'c18' of undefined <p>I'm making a massive multi page backbone site.</p> <p>I'm sometimes re-using collections and views across multiple pages of the site, as if they were controls. I've now done something which is coming up with errors like this,</p> <p>Cannot read property 'c18' of undefined</p> <p>At the moment, the c18 is always the same.</p> <p>I'm also using backbone relational.</p> <p>Any ideas anyone?</p> |
9,835,991 | 0 | <p>first, look at this: <a href="http://www.w3schools.com/jsref/jsref_replace.asp" rel="nofollow">http://www.w3schools.com/jsref/jsref_replace.asp</a> and then do not use stackoverflow for questions of this kind</p> |
20,365,507 | 0 | <p>Why not just use the array you've created?</p> <pre><code> For(int i = 0; i< sL.length; i++){ String wavFileName = sl[i] + ".wav"; // do whatever you need to do here } </code></pre> <p>For on demand (press a button get a specific sound) then Jeroen's idea of using a map will work.</p> |
5,605,359 | 0 | <p>I'm fairly certain that <a href="http://code.google.com/p/wwwsqldesigner/" rel="nofollow"><code>WWWSQLDesigner</code></a> can do it for you. There's a demo <a href="http://ondras.zarovi.cz/sql/demo/" rel="nofollow"><code>here</code></a>. You'll need to download it and install it on a local server.</p> |
20,635,273 | 0 | <p>You don't need to set the '!' at all - except you want force your sites to be crawled by search engines (see <a href="https://developers.google.com/webmasters/ajax-crawling/docs/specification?hl=de&csw=1" rel="nofollow">GoogleDevelopers Spec</a>). Some people even say, these hash bangs are <a href="http://danwebb.net/2011/5/28/it-is-about-the-hashbangs" rel="nofollow">very bad UI practice</a>.</p> <p>Or is it a requirement for your application that its whole content is indexed by search engines ?</p> |
17,401,981 | 0 | <p>I have made mistake when i add model to collection, I have added a type instead of instance of the type.</p> <pre><code>var backgridModel = Backbone.Model.extend({ }); </code></pre> <p>is the type i should have added </p> <p><code>var row = new backgridModel()</code> instead i have used <code>backgridModel</code> to create a new row.</p> |
15,320,259 | 0 | <p>Ok i think i understand your problem :</p> <p>The after_destroy method in PictureFileCallbacks will be auto-magically called by rails :</p> <p>When rails destroys your PictureFile object, it will instantiate a PictureFileCallbacks object and try to run an after_destroy method in it.</p> <p>Everything works by convention, if you follow the naming properly everything will work out of the box.</p> <p>Try it on a dummy project, and if you have some trouble making this work come back with some code to show.</p> |
26,380,336 | 0 | <p>This is most optimal way</p> <pre><code>if (is_array($data) && isset($data['yes'])) { } </code></pre> <p>If you do <code>array_key_exists</code> without checking if <code>$data</code> is array, you will get error, because second parameter for the <code>array_key_exists</code> function must always be type of <code>array</code></p> <p><a href="http://php.net/manual/en/function.array-key-exists.php" rel="nofollow">http://php.net/manual/en/function.array-key-exists.php</a></p> |
16,194,342 | 0 | <pre><code> describe ArticlesController do let(:user) do user = FactoryGirl.create(:user) user.confirm! user end describe "GET #index" do it "populates an array of articles of the user" do #how can i create an article of the user here sign_in user get :index assigns(:articles).should eq([article]) end it "renders the :index view" do get :index response.should render_template :index end it "assign all atricles to @atricles" do get :index assigns(:atricles).your_awesome_test_check # assigns(:articles) would give you access to instance variable end end end </code></pre> |
11,832,795 | 0 | android html links <p>Using this code <code>map.put(TAG_LINK, "" + Html.fromHtml(link));</code> i am able to parse json hyperlinks into my view. But the problem is it will only show me the word and i`m not able to click on it. For example if i have </p> <pre><code><a href="http://something"> CLICK </a> </code></pre> <p>, i can only see CLICK but i cant click it. I understand there is more to html.fromhtml to work, setMovementMethod. BUt i don't know how to use it with map.put. Can someone help me with this?</p> |
20,960,384 | 0 | <p>A stop-gap measure would be to insert one (or several) line(s) of </p> <p>DoEvents</p> <p>after the change and before ActiveWindow....NextHeaderFooter. That command yields execution to the OS. That may give Word the time it needs to catch up. </p> <p>Of course, you would do better to avoid using ActiveWindow... altogether and iterate through the sections with a For loop.</p> |
36,569,405 | 0 | <p>You can define the content of the <code>onOptionsItemSelected(MenuItem item)</code> method in a helper and then using flavors load the needed helper :</p> <pre><code>@Override public boolean onOptionsItemSelected(MenuItem item) { HelperPart.selectItem(this, item); } // Helper loaded for flavor "part1" static class MenuHelper{ public static boolean selectItem(Activity act, MenuItem item){ switch (item.getItemId()) { case R.id.action_reload: // TODO reload return true; default: return act.onOptionsItemSelected(item); } } } // Helper loaded for flavor "part2" and "full" static class MenuHelper{ public static boolean selectItem(Activity act, MenuItem item){ // Do nothing } } </code></pre> |
12,837,275 | 0 | How to stop my Custom Keyboard from 'floating' or being undocked on iPad <p>I have a custom Keyboard that gets displayed for a certain UITextField when I set the textField's inputView to my KeyboardView. The keyboard works fantastically well but it has become apparent that the keyboard will 'float' if the user has previously undocked the built in Apple Keyboard or indeed split it.</p> <p>I have searched for many hours for a way to ensure my custom keyboard does not act like this and instead stays docked to the bottom of the screen regardless as to whether the user has previously undocked the built in Apple Keyboard.</p> <pre><code>self.keyboardInputView = [[[KeyboardInputViewController_iPad alloc] initWithNibName:@"KeyboardInputViewController_iPad" bundle:[NSBundle mainBundle]] autorelease]; self.keyboardInputView.delegate = self; self.keyboardInputView.keyboardTextField = myTextField; myTextField.inputView = self.keyboardInputView.view; [myTextField becomeFirstResponder]; </code></pre> |
23,888,102 | 0 | <p>The padding is likely part of the font, not the widget. Fonts need space above and below the space for average sized characters to make room for <a href="http://en.wikipedia.org/wiki/Ascender_%28typography%29" rel="nofollow">ascenders</a> and <a href="http://en.wikipedia.org/wiki/Descenders" rel="nofollow">descenders</a>. The larger the font, the more space that is needed . Without the space below, for example, where would the bottom part of a lowercase "g" or "y" go?</p> |
987,055 | 0 | <p>One of the ways to handle this is to write your DLL to return a SAFEARRAY of type Byte as the function result (VB arrays are OLE SafeArrays).</p> <p>To do this you have to read up on the SafeArray APIs and structures. I don't know of it myself, but the main things you'll need are the SAFEARRAYBOUND structure and the SafeArrayCreate API. What the API returns to you, you return to VBA. And you'll be done.</p> |
16,492,535 | 0 | <p>Why not put the custom tool property back in to be able to rapidly test it? then take it out when you are happy?</p> <p>another option is to write a .tt file that consumes/includes that .tt to operate as your <a href="http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop" rel="nofollow">REPL</a> harness</p> |
32,523,773 | 0 | <p>Mentioned in Oracles <a href="https://docs.oracle.com/javase/tutorial/reflect/special/arrayComponents.html" rel="nofollow">Tutorial</a> this is easily achievable with <code>array.getClass().getComponentType()</code>. This returns the class of the instances in the array. </p> <p>Afterwards you can check it against the primitive class located inside each wrapper object. For example:</p> <pre><code>if (array.getClass().getComponentType().equals(Boolean.TYPE)) { boolean[] booleanArray = (boolean[]) array; } </code></pre> |
9,173,264 | 0 | <p>According to the yaml <a href="http://yaml.org/type/set.html" rel="nofollow">specification</a> the set syntax is the following one : </p> <pre><code>- Person(paul): firstName: Paul lastName: Lumbergh children : !!set ? Person(bill) ? Person(jane) – </code></pre> |
37,350,051 | 0 | <p>Well, there is a huge mess here :D</p> <p>First of all, the NullPointerException is thrown because the values are not sent, and the values are not sent because they're not in the form. </p> <p>You should enclose them in the form like this for them to be sent to the <code>ActionSelect</code> action:</p> <pre class="lang-xml prettyprint-override"><code><s:form action="ActionSelect"> <div class="invoicetext1">Event Name :</div> &nbsp;&nbsp; <s:select name="dp.eventState" list="%{state}" class="billlistbox1" id="eventName" /> <div> <s:select name="dp.companyState" class="billlistbox2" listKey="companyState" list="%{status}"> </s:select> </div> <div class="invoicetext2">Company Name :</div> <div class="clear"></div> </div> <s:submit value=" Click Here"/> </s:form> </code></pre> <p>Solved the mistery, this doesn't solve your problem, though.</p> <p>You have two main ways to contact actions from a page:</p> <ul> <li><p>Using a standard submit (as you're doing):</p> <p>you either submit a form with its content, or call a link by eventually passing parameters in the querystring. This creates a Request, that will contact an action, that will return an entire JSP, that will be loaded in place of the page you're on now.</p></li> <li><p>Using AJAX:</p> <p>you POST or GET to an action without changing the current page, and the action can return anything, like a JSP snippet, a JSON result, a binary result (through the Struts2 Stream result), etc...</p> <p>You then can choose what to do with the returned data, for example load it inside a <code><div></code> that before was empty, or had different content.</p></li> </ul> <p>Now your problem is that you're contacting an action that is not the one you're coming from (is not able to re-render the entire JSP you're on) and you're calling it without using AJAX, then whatever the object mapped to the <code>"success"</code> result is (the whole JSP, or a JSP snippet), it will be loaded in place of the JSP you're on, and it will fail.</p> <p>Since you seem to be quite new to this, I suggest you start with the easy solution (without AJAX), and after being expert with it, the next time try with AJAX.</p> <p>That said, </p> <ol> <li>avoid putting logic in getters and setters;</li> <li>avoid calling methods that are not setter as setters (<code>setState</code>, <code>setStatus</code>...);</li> <li>always make your attributes private;</li> <li>try giving speaking names to variables: state and status for event states and company states are really confusing; and what about "state" instead of "name" (in jsp and on DB is "name");</li> <li>consider loading informations like selectbox content in a <code>prepare()</code> method, so they will be available also in case of errors;</li> <li>you're not closing the connections (and BTW it would be better to use something more evoluted, like Spring JDBC, or better Hibernate, or even better JPA, but for now keep going with the raw queries)</li> </ol> <p>The following is a refactoring of your code to make it achieve the goal. I'll use <code>@Getter</code> and <code>@Setter</code> only for syntactic sugar (they're Lombok annotations, but you keep using your getters and setters, it's just for clarity):</p> <pre class="lang-xml prettyprint-override"><code><head> <script> $(function(){ $("#event, #company").on('change',function(){ $("#myForm").submit(); }); }); </script> </head> <body> <form id="myForm"> <div> ... <s:select id="event" name="event" list="events" /> ... <s:select id="company" name="company" list="companies" /> ... </div> </form> <div> ... Table - iterate **dataForBillsJspList** here ... </div> </body> </code></pre> <pre class="lang-java prettyprint-override"><code>public class RetrieveEvNaCoNaAction extends ActionSupport { private static final long serialVersionUID = -5418233715172672477L; @Getter private List<Event> dataForBillsJspList = new ArrayList<Event>(); @Getter private List<String> events = new ArrayList<String>(); @Getter private List<String> companies = new ArrayList<String>(); @Getter @Setter private String event = null; @Getter @Setter private String company = null; @Override public void prepare() throws Exception { Connection con; try { con = new Database().Get_Connection(); // load companies PreparedStatement ps = con.prepareStatement("SELECT DISTINCT company_name FROM event"); ResultSet rs = ps.executeQuery(); while (rs.next()) { companies.add(rs.getString("company_name")); } // load events ps = con.prepareStatement("SELECT DISTINCT event_name FROM event"); rs = ps.executeQuery(); while (rs.next()) { events.add(rs.getString("event_name")); } } catch(Exception e) { e.printStackTrace(); } finally { con.close(); } } @Override public String execute() { Connection con; try { con = new Database().Get_Connection(); // load the table. The first time the table is loaded completely String sql = "SELECT EVENT_ID, EVENT_NAME, COMPANY_NAME, CONTACT_PERSON, CONTACT_NO, EMAIL_ID, EVENT_VENUE, " + "date_format(FROM_DATE,'%d/%m/%Y') as dateAsFrom, date_format(TO_DATE,'%d/%m/%Y') as dateAsTo ,EVENT_TIME " + "FROM event"; String where = ""; // if instead this action has been called from the JSP page, // the result is filtered on event and company: if (event!=null && company!=null) { where = " WHERE event_name = ? AND company_name = ?"; } // load companies PreparedStatement ps = con.prepareStatement(sql + where); if (where.length()>0) { ps.setString(1,event); ps.setString(2,company); } ResultSet rs = ps.executeQuery(); while (rs.next()) { dataForBillsJspList.add(new Event(rs.getString("EVENT_ID"),rs.getString("EVENT_NAME"),rs.getString("COMPANY_NAME"), rs.getString("CONTACT_PERSON"),rs.getString("CONTACT_NO"),rs.getString("EMAIL_ID"), rs.getString("EVENT_VENUE"), rs.getString("dateAsFrom"), rs.getString("dateAsTo"), rs.getString("EVENT_TIME"))); } } catch(Exception e) { e.printStackTrace(); } finally { con.close(); } return SUCCESS; } } </code></pre> <p>It is a kickoff example, but it should work.</p> <p>The next steps are:</p> <ol> <li>create a POJO with id and description, show the description in the select boxes, but send the id</li> <li>use header values ("please choose an event"...) and handle in action conditional WHERE (only company, only event, both)</li> <li><strong>PAGINATION</strong></li> </ol> <p>Good luck</p> |
37,525,418 | 0 | <p>Normally, when you build your APK, all the libs you have imported (jars) are included and transformed to dex files, as the rest of your code. So, yes all the classes are included, even if you don't use them. You can use Proguard to remove them from the APK. Look at this post : <a href="http://stackoverflow.com/questions/14288769/use-proguard-for-stripping-unused-support-lib-classes">Use Proguard for stripping unused Support lib classes</a></p> |
20,306,465 | 0 | iterating through PictureBoxes in visual c++ <p>I'm programming in visual c++, and i have about 60 pictures (indexed p0...p63), and i want to make a loop that goes through all the pictures and change their <code>ImageLocation</code> under some conditions.</p> <p>I figured the <code>Tag</code> property and one of my attempts was like this: i tagged my pictures from 0 to 63 and then tried the following:</p> <pre><code>for(int i=0; i<64; i++) { PictureBox->Tag[i]->ImageLocation="possible-.gif"; } </code></pre> <p>It's not working... I get this error:</p> <pre><code>syntax error : missing ';' before '->' line: 1514 syntax error : missing ';' before '->' line: 1514 </code></pre> <p>(twice, same line)</p> <p>What's the right way of doing it?</p> <p>Thank you!</p> <p><strong><em>edit:</em></strong></p> <p>OK now i have the pictures in an array. Is there a way to have a common rule for all of them? I want to make a click event for each and every one of the pictures. Is the only way setting a rule for each independently? Or can i set a rule for the array itself by saying something like:</p> <pre><code>if(Pictureboxes[i]_Clicked) { Pictureboxes[i].something = "something else"; } </code></pre> |
39,112,997 | 0 | <p>There are two steps to accomplish this: 1. Change your parent div style to this:</p> <pre><code>#my-projects-section { background-color: black; height: 500px; width:100%; } </code></pre> <p>2. Add this to your child styles:</p> <pre><code>#image-one, #image-two, #image-three { width: 30%; margin: 1.66%; height: 200px; background-size: cover; background-repeat: no-repeat; transition: .2s ease-out, .2s ease-in; } </code></pre> <p><a href="http://codepen.io/westefan/pen/Lkoooq" rel="nofollow">http://codepen.io/westefan/pen/Lkoooq</a></p> <p>Currently this is statically defined, if you would like to add a new project into the section, you have to modify the CSS. There are also options to calculate margins, but it is not yet supported: <a href="https://developer.mozilla.org/en/docs/Web/CSS/calc" rel="nofollow">https://developer.mozilla.org/en/docs/Web/CSS/calc</a> Another option would be to use Javascript to count childelements and create style completely dynamical based on the amount of children.</p> |
26,658,216 | 0 | Excel Macro - Windows().Activate not taking value <p>The code that works is the following:</p> <pre><code>Windows("Contract Drilldown (3).xls").Activate </code></pre> <p>When I use :</p> <pre><code> Windows(Chr(34) & ddlOpenWorkbooks.Value & Chr(34)).Activate </code></pre> <p>I get:</p> <blockquote> <p>Runtime Error '424': Object Required</p> </blockquote> <hr> <p>If I use a String Variable to pass in the values i.e.:</p> <pre><code>Dim wbn As String wbn = "Contract Drilldown (3).xls" Windows(Chr(34) & wbn & Chr(34)).Activate </code></pre> <p>I get:</p> <blockquote> <p>Run-time error '9': Subscript out of range</p> </blockquote> <hr> <p>And if I use</p> <pre><code>wbn = ddlOpenWorkbooks.Value Windows(Chr(34) & wbn & Chr(34)).Activate </code></pre> <p>I also get </p> <blockquote> <p>Runtime Error '424': Object Required</p> </blockquote> <hr> <p>Anyone have any idea how I can pass in the <em>ddlOpenWorkbooks.Value</em> in without getting an error?</p> <h2>Edit - More Info</h2> <p>Ok so the application looks like this: <img src="https://i.stack.imgur.com/FiAhi.png" alt="enter image description here"></p> <p>the full code block for the Import Data Button is:</p> <pre><code>Public Sub Data_Import() Windows(ddlOpenWorkBooks.Value).Activate Columns("A:V").Select Selection.Copy Omni_Data.Activate Range("A1").Select ActiveSheet.Paste Omni_Data.Range("A:Z").Interior.ColorIndex = 0 Omni_Data.Range("A:Z").Font.Name = "Segoe UI" Omni_Data.Range("A:Z").Font.Name = "Segoe UI" 'Setting Background Colour to white and changing font End Sub </code></pre> <p>The above Sub is called on Click Event for the button.</p> <p>As a test the close button has the following code:</p> <pre><code>Private Sub cmdCancel_Click() MsgBox (ddlOpenWorkbooks.Value) End End Sub </code></pre> <p>Which works fine:</p> <p><img src="https://i.stack.imgur.com/hHtYv.png" alt="enter image description here"></p> <h2>Update</h2> <p>So we have found the problem.</p> <p>As this is being called from a module it didn't know where ddlOpenWorkbooks was and where to pull that data from. </p> <p>The corrected code in the Sub is:</p> <pre><code>Public Sub Data_Import() Windows(frmOmniDataManipulation.ddlOpenWorkbooks.Value).Activate Columns("A:V").Select Selection.Copy Omni_Data.Activate Range("A1").Select ActiveSheet.Paste Omni_Data.Range("A:Z").Interior.ColorIndex = 0 Omni_Data.Range("A:Z").Font.Name = "Segoe UI" Omni_Data.Range("A:Z").Font.Name = "Segoe UI" 'Setting Background Colour to white and changing font End Sub </code></pre> <p>This will allow me to call the sub.</p> <p>Thanks All!</p> |
20,864,408 | 0 | <blockquote> <p>I am trying to obtain a handle on one of the views in the Action Bar</p> </blockquote> <p>I will assume that you mean something established via <code>android:actionLayout</code> in your <code><item></code> element of your <code><menu></code> resource.</p> <blockquote> <p>I have tried calling findViewById(R.id.menu_item)</p> </blockquote> <p>To retrieve the <code>View</code> associated with your <code>android:actionLayout</code>, call <code>findItem()</code> on the <code>Menu</code> to retrieve the <code>MenuItem</code>, then call <code>getActionView()</code> on the <code>MenuItem</code>. This can be done any time after you have inflated the menu resource.</p> |
7,018,235 | 0 | <p>There are 2 things you can do in this instance.</p> <p>First of all you are correct, it is not accepting it because it is now a comma seperated list.</p> <p>Basically what you need to do is parse out that comma seperated list and use a function with an IN clause in your main query. Here's a very good article explaining how to do this:</p> <p><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/ssrs_multi_value_parameters" rel="nofollow">http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/ssrs_multi_value_parameters</a></p> <p>Otherwise another method would be to return everything in your SQL code and filter on the SSRS side. The way to do this would be to remove your where clause in SQL which filters your vouchers. This will then bring back all vouchers. In SSRS then set up a parameter the same way you normally would for a multi select parameter. Then in SSRS design view, you right click your table and go to properties. There is then a tab called filters. You can set up the filter here by saying do not show these vouchers. Basically it hides them.</p> <p>The first way I explanined is definitely the best way to do it as it is faster and can be re-used in the long run. It is very simple once all the function are setup.</p> |
25,690,125 | 0 | <p>Why, you use</p> <pre><code>var dropdownlist = $(container.find("#ddlActionType")).data("kendoDropDownList"); </code></pre> <p>instead. </p> <p>You're welcome!</p> |
25,304,005 | 0 | <p>The highest available version of GCC in the 12.04 repositories is 4.6. You can use the package manager to install a newer version, but you will have to add a PPA. <a href="http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/" rel="nofollow">This</a> link should help, although it is for a slightly older version of GCC (but can be used for the newest version).</p> <p>As a commenter pointed out, if your own built version of GCC was compiled with the <code>--prefix</code> parameter, the entire installation should be in that directory under <code>/usr/local</code> or wherever you installed it, and can be removed.</p> |
26,501,899 | 0 | jQuery for hiding other columns options(dynamic) except column one. and onClick it shows other <p>I am having a problem regarding jQuery. In my (codeigniter)view file i have created a columns which are fetching data from the database perfectly. All i want is to put a jQuery that shows only column_one(id : col_1) firstly, and all the remaining columns would be blank. when i click on any option of the first column it shows second column options.</p> <p>I am newbie to jQuery and i wonder if i can do this. Sorry, in advance if it is a silly one!</p> <p>Here is my script i am trying in my view file. Hope you all can get what i am trying.</p> <p><strong>Script :</strong></p> <pre><code>$('document').ready(function()) { var link = "<?php echo base_url(); ?>" ; //click cat_1, get cat_2 $('#cat_1').click(function() { var cat_1 = $(this).val(); // getting data of cat_level_2 from cat_1 $.post(link + 'admin/admin_cat/category/cat_level_2' , {cat_1:cat_1}, function(data) { $('#cat_3').html(''); $('#cat_level_4').html(''); $('#cat_2').html(data); }); }); $('#cat_2').click(function(){ var cat_2 = $(this).val(); // getting data of cat_level_2 from cat_1 $.post(link + 'admin/admin_cat/category/cat_level_3 ' , {cat_2:cat_2}, function(data) { $('#cat_3').html(data); $('#cat_level_4').html(''); }); }); } </code></pre> <p>Here i have created a columns in view file. which is fetching data from database.</p> <p><strong>Columns :</strong> </p> <pre><code><div class="category-col"> <select size="15" name='cat_1' id='cat_1'> <?php foreach ($dropdown as $cat_1) ?> <?php { ?> <option value=" <?php echo form_dropdown('cat_level', $dropdown);?> "> </option> <?php } ?> </select> </div> <script type="text/javascript"> </script> <div class="category-col"> <select size="15" name='cat_2' id='cat_2'> <?php if(isset($cat_level_2) && $cat_level_2 != false){ ;?> <?php foreach ($cat_level_2 as $cat_2) {?> <option value=""> <?php echo $cat_2; ?> </option> <?php } }?> </select> </div> <div class="category-col"> <select size="15" name='cat_3' id='cat_3'> <?php if(isset($cat_level_3) && $cat_level_3 != false){ ;?> <?php foreach ($cat_level_3 as $cat_3) {?> <option value=""> <?php echo $cat_3; ?> </option> <?php } }?> </select> </div> </code></pre> <p>Thanks for the consideration mates!</p> |
16,225,251 | 0 | <p>Get rid of:</p> <pre><code><uses-library android:name="com.actionbarsherlock" /> </code></pre> <p>as <code><uses-library></code> is only for firmware libraries.</p> <p>Also, you appear to be using both Maps V1 and Maps V2, which is possible but unlikely. If you are trying to use Maps V2, get rid of:</p> <pre><code> <uses-library android:name="com.google.android.maps"/> </code></pre> <p>as that is Maps V1.</p> |
4,892,679 | 0 | <pre><code>var select = document.getElementById('myselect'); var newoption = document.createElement('option'); newoption.value = 0; // or whatever newoption.innerHTML = '0'; // or whatever select.insertBefore(newoption, select.options[0]); </code></pre> |
13,816,356 | 0 | <p>To get the aggregate of the whole set you can use an empty <code>OVER</code> clause</p> <pre><code>WITH T(Result) AS (SELECT FloatColumn - Avg(FloatColumn) OVER() - Stdev(FloatColumn) OVER () FROM Data) SELECT Count(*), Result FROM T GROUP BY Result </code></pre> |
19,100,930 | 0 | <p>The access token returned in the call to the OAuth2 endpoint identifies the caller and privileges (which api calls you can make). This is required for any of the api calls (REST) to create payments, execute, refunds etc. Some calls require more privileges than others, i.e. you need to have requested more information or provided more credentials when createing the access token.</p> <p>The token returned in the URL identifies the payment, this is so that when a user is redirected back to your site, you have a way to identify which payment has been redirected back to your site and identify the proper information, i.e. execute the correct payment.</p> |
1,521,859 | 0 | Nonrepresentable section on output error during linking on linux <p>I get this error at the linker stage when compiling the webkit-1.1.5 package on my Ubuntu 9.04 box:</p> <pre><code>libtool: link: gcc -ansi -fno-strict-aliasing -O2 -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -fvisibility=hidden -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -O2 -o Programs/.libs/GtkLauncher WebKitTools/GtkLauncher/Programs_GtkLauncher-main.o -pthread ./.libs/libwebkit-1.0.so /usr/lib/libgtk-x11-2.0.so /usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so /usr/lib/libpangoft2-1.0.so /usr/lib/libgdk_pixbuf-2.0.so -lm /usr/lib/libpangocairo-1.0.so /usr/lib/libgio-2.0.so /usr/lib/libcairo.so /usr/lib/libpango-1.0.so /usr/lib/libfreetype.so -lfontconfig /usr/lib/libgmodule-2.0.so /usr/lib/libgobject-2.0.so /usr/lib/libgthread-2.0.so -lrt /usr/lib/libglib-2.0.so -pthread make[1]: Leaving directory `/home/nagul/build_area/webkit-1.1.5' WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp: In function ‘NPError webkit_test_plugin_get_value(NPP_t*, NPPVariable, void*)’: WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp:221: warning: deprecated conversion from string constant to ‘char*’ WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp:224: warning: deprecated conversion from string constant to ‘char*’ WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp: In function ‘char* NP_GetMIMEDescription()’: WebKitTools/DumpRenderTree/gtk/TestNetscapePlugin/TestNetscapePlugin.cpp:260: warning: deprecated conversion from string constant to ‘char*’ /usr/bin/ld: Programs/.libs/GtkLauncher: hidden symbol `__stack_chk_fail_local' in /usr/lib/libc_nonshared.a(stack_chk_fail_local.oS) is referenced by DSO /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status make[1]: *** [Programs/GtkLauncher] Error 1 make: *** [all] Error 2 </code></pre> <p>I'd like some pointers on how to attack this problem, either by looking into the "hidden sybmol" error or by helping me understand what the "Nonrepresentable section on output" message from the linker actually means. </p> <p>I have already checked that this is consistent behaviour that persists across a <code>make clean;make</code> invocation.</p> |
36,162,322 | 0 | Controlling when participants are added with vanity a/b test <p>Using <a href="https://github.com/assaf/vanity" rel="nofollow">vanity</a> to conduct an A/B test. The test is reliant on a modal that is conditionally shown to certain users. The modal contains different incentives based on which side of the test you see.</p> <p>The code for the modal is in a partial that gets loaded on several pages in our app. </p> <p>Example: </p> <pre><code><%= render partial: 'modals/example' %> </code></pre> <p>That partial contains a condition for the content that will be shown:</p> <pre><code><% if ab_test(:whatever) == "something" %> <p>Stuff to show</p> <% else %> <p>Different stuff to show</p> <% end %> </code></pre> <p>I'm tracking the relevant metric in the relevant place.</p> <p>The test itself works as expected in terms of showing the content and converting. The problem I'm running into is that because the partial is loaded even when the modal isn't show...everyone that lands on a page that references this partial is being added as a "participant" and I would like to only count people who have actually seen the modal as participants.</p> <p>We use mixpanel as well and I can pivot into running the test with that. I like vanity, though, and would prefer to use it if there's a reasonable solution that isn't going to significantly increase the time it takes to implement. Was hoping someone SO could point out what I'm missing and how to approach solving.</p> |
17,364,133 | 0 | How can I update a file incrementally in iOS. (File patching) <p>I have a huge text file in my application (version 1.0).</p> <p>Lets assume that a new version (2.0) of this file was just released. Most of the file remained the same but the new (2.0) version has a few modifications (some lines removed, others added).</p> <p>I now wish to <strong>update</strong> the file (1.0) to the new version (2.0), but do not wish to download the whole file again. I would love to just patch the file with the changes of the new file, thus saving bandwith from downloading the WHOLE new file from my server. (Similar to the way versioning systems like git or svn act)</p> <p>How can I do this programmatically? Are there any iOS libraries available?</p> <p>Thank you</p> |
18,539,082 | 0 | Struts 2 problem to run the program <p>I am new in Struts 2. I want to create a simple Hello program using struts2 and when I try to run the program, i am getting the following message in the console:</p> <pre class="lang-none prettyprint-override"><code>Aug 30, 2013 11:33:35 AM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\HP SimplePass\x64;C:\Program Files (x86)\HP SimplePass\;;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Autodesk\Backburner\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Git\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Java\jdk1.7.0_25\bin;C:\javaworks\apache-ant-1.9.2\bin;;. Aug 30, 2013 11:33:36 AM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ExampleTracker' did not find a matching property. Aug 30, 2013 11:33:36 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Aug 30, 2013 11:33:36 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Aug 30, 2013 11:33:36 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 661 ms Aug 30, 2013 11:33:36 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Aug 30, 2013 11:33:36 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.42 Aug 30, 2013 11:33:37 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger error SEVERE: Dispatcher initialization failed java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301) at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438) at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207) at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93) at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487) at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484) at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:584) at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:324) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:221) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299) ... 28 more Caused by: java.lang.ExceptionInInitializerError at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:84) ... 33 more Caused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency! at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:168) ... 34 more Caused by: java.lang.ClassNotFoundException: javassist.ClassPool at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:165) ... 34 more Aug 30, 2013 11:33:37 AM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter struts2 java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector File: ContainerImpl.java Method: inject Line: 301 - com/opensymphony/xwork2/inject/ContainerImpl.java:301:-1 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:502) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301) at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438) at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207) at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93) at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487) at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484) at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:584) at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:324) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:221) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) ... 15 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299) ... 28 more Caused by: java.lang.ExceptionInInitializerError at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:84) ... 33 more Caused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency! at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:168) ... 34 more Caused by: java.lang.ClassNotFoundException: javassist.ClassPool at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:165) ... 34 more Aug 30, 2013 11:33:37 AM org.apache.catalina.core.StandardContext startInternal SEVERE: Error filterStart Aug 30, 2013 11:33:37 AM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/ExampleTracker] startup failed due to previous errors Aug 30, 2013 11:33:37 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Aug 30, 2013 11:33:37 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Aug 30, 2013 11:33:37 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 1277 ms </code></pre> <p>My original code block are the followings:</p> <p>HelloWorld.java</p> <pre class="lang-java prettyprint-override"><code>package com.xyz; import com.opensymphony.xwork2.ActionSupport; public class HelloWorld extends ActionSupport{ /** * */ private static final long serialVersionUID = 1L; private String greeting; public String getGreeting() { return greeting; } public void setGreeting(String greeting) { this.greeting = greeting; } @Override public String execute() throws Exception { setGreeting("hello program"); return SUCCESS; } } </code></pre> <p>struts.xml</p> <pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="basicStruts" extends="struts-default"> <action name="hello" class="com.xyz.HelloWorld"> <result name="success">/HelloWorld.jsp</result> </action> </package> </struts> </code></pre> <p>After running when I try to access through the link <code>http://localhost:8080/ExampleTracker/hello</code>, i got the following page: </p> <p><img src="https://i.stack.imgur.com/BEsR7.png" alt="enter image description here"></p> <p>Can anybody help me how to solve this problem.</p> <p>Thanks</p> |
18,087,841 | 0 | Microsoft BIDS How to clear table data before new transfer? <p>I have a database from which I am pulling rows from, manipulating the data a bit and then putting into another table. Every time I run the package, it doesnt remove any data from the destination and thus grows by X number of rows each time.</p> <p>Is there any way that I can clear the destination before adding the new rows?</p> |
35,597,142 | 0 | <p>Do you want to end it with an "and"?</p> <p>For this situation, I created an npm module.</p> <p>Try <a href="https://github.com/dawsonbotsford/arrford" rel="nofollow">arrford</a>:</p> <p><br></p> <h2>Usage</h2> <pre><code>const arrford = require('arrford'); arrford(['run', 'climb', 'jump!']); //=> 'run, climb, and jump!' arrford(['run', 'climb', 'jump!'], false); //=> 'run, climb and jump!' arrford(['run', 'climb!']); //=> 'run and climb!' arrford(['run!']); //=> 'run!' </code></pre> <p><br></p> <h2>Install</h2> <pre><code>npm install --save arrford </code></pre> <p><br></p> <h2>Read More</h2> <p><a href="https://github.com/dawsonbotsford/arrford" rel="nofollow">https://github.com/dawsonbotsford/arrford</a></p> <p><br></p> <h2>Try it yourself</h2> <p><a href="https://tonicdev.com/dawsonbotsford/56f46dd154d4e814002e34b9" rel="nofollow">Tonic link</a></p> |
19,710,113 | 0 | Hadoop - set reducer number to 0 but write to same file? <p>My job is computational intensive so I am actually only using the distribution function of Hadoop, and I want all my output to be in 1 single file so I have set the number of reducer to 1. My reducer is actually doing nothing...</p> <p>By explicitly setting the number of reducer to 0, may I know how can I control in the mapper to force all the outputs are written into the same 1 output file? Thanks. </p> |
13,855,764 | 0 | JXL datetime no need the part time <p>Hello i wrote this code to add a Date in excel but when the cell is added he show also the time. I want eliminated the time part. Thank you in advance if someone can help .. </p> <p>Tabla[tabReg][tabCol]); is String Array</p> <pre><code> SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Date convertedDate = dateFormat.parse(Tabla[tabReg][tabCol]); DateFormat df = new DateFormat("yyyy/MM/dd"); WritableCellFormat wdf = new WritableCellFormat(df); cf = new WritableCellFormat(df); cell = new jxl.write.DateTime(exCol,exReg, convertedDate); cell.setCellFormat(wdf); sheet2.addCell(cell); </code></pre> |
9,295,118 | 0 | Return distance in elasticsearch results? <p>My question is similar to this <a href="http://stackoverflow.com/questions/9290057/compute-geo-distance-in-elasticsearch">one</a>.</p> <p>Simply, is there a way to return the geo distance when NOT sorting with _geo_distance?</p> <p>Update: To clarify, I want the results in random order AND include distance.</p> |
20,258,294 | 0 | How to create human readable time stamp? <p>This is my current PHP program:</p> <pre><code>$dateStamp = $_SERVER['REQUEST_TIME']; </code></pre> <p>which I later log.</p> <p>The result is that the <code>$dateStamp</code> variable contains numbers like: </p> <p>1385615749</p> <p>This is a Unix timestamp, but I want it to contain human readable date with hour, minutes, seconds, date, months, and years.</p> <p>So I need a function that will convert it into a human readable date.</p> <p>How would I do that?</p> <p>There are other similar questions but not quite like this. I want the simplest possible solution.</p> |
22,024,213 | 0 | Calling scanf_s() with array of chars <p>I tried this code, but it is not working.</p> <pre><code>char word1[40]; printf("Enter text: \n"); scanf_s("%s", word1); printf("word1 = %s", word1); </code></pre> <p>When I execute it, it shows:</p> <blockquote> <pre><code>word1 = </code></pre> </blockquote> |
28,872,797 | 0 | <p>Personally, for the admin account I won't go with the basic Spring Security user service, mainly because it lacks the flexibility of a DB-based user management approach. Indeed, you probably don't want to have your admin credentials established once for all, since they can be guessed or stolen or simply forgotten.</p> <p>Conversely, both password <strong>modification and recovery mechanisms</strong> should be put in place for all accounts, including the admin one (provided you use a trusted email account for password recovery, but this is a reasonable assumption).</p> <p>Getting concrete, my approach is the following: I use an <code>AuthenticationManager</code> where I inject a <code>CustomUserDetailService</code></p> <pre><code> <authentication-manager alias="authenticationManager"> <authentication-provider user-service-ref="customUserDetailsService" > <password-encoder ref="passwordEncoder" /> </authentication-provider> </authentication-manager> <b:bean id="passwordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" /> </code></pre> <p>which is the following</p> <pre><code> @Service public class CustomUserDetailsService implements UserDetailsService{ @Autowired @Qualifier("userDaoImpl") private UserDao userDaoImpl; @Override @Transactional public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userDaoImpl.loadByUsername(username); if (user != null) return user; else throw new UsernameNotFoundException(username + " not found."); } } </code></pre> <p>this works for all users, not only the admin.</p> <p>Now it comes <strong>the problem of having the admin account full functional when the application starts</strong>. This is accomplished by using an <strong>initialization</strong> bean to be executed at startup, detailed in the following</p> <pre><code> @Component public class Initializer { @Autowired private HibernateTransactionManager transactionManager; @Autowired @Qualifier("userDaoImpl") private UserDao userDao; @Autowired private CredentialsManager credentialsManager; private String resetPassword = "makeItHardToGuess"; private String adminUsername = "admin"; @PostConstruct private void init() { //since we are executing on startup, we need to use a TransactionTemplate directly as Spring may haven't setup transction capabilities yet TransactionTemplate trxTemplate = new TransactionTemplate(transactionManager); trxTemplate.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus status) { buildAdmin(); } }); } private void buildAdmin() { //here I try to retrieve the Admin from my persistence layer ProfiledUser admin = userDao.loadByUsername(adminUsername); try { //If the application is started for the first time (e.g., the admin is not in the DB) if(admin==null) { //create a user for the admin admin = new ProfiledUser(); //and fill her attributes accordingly admin.setUsername(adminUsername); admin.setPassword(credentialsManager.encodePassword(resetPassword)); admin.setAccountNonExpired(true); admin.setAccountNonLocked(true); admin.setCredentialsNonExpired(true); admin.setEnabled(true); admin.setEulaAccepted(true); Authority authority = new Authority(); authority.setAuthority("ROLE_ADMIN"); admin.getAuthorities().add(authority); } //if the application has previously been started (e.g., the admin is already present in the DB) else { //reset admin's attributes admin.setPassword(credentialsManager.encodePassword(resetPassword)); admin.getAuthorities().clear(); Authority authority = new Authority(); authority.setAuthority("ROLE_ADMIN"); admin.getAuthorities().add(authority); admin.setAccountNonExpired(true); admin.setAccountNonLocked(true); admin.setCredentialsNonExpired(true); admin.setEnabled(true); } userDao.save(admin); } catch (Exception e) { e.printStackTrace(); System.out.println("Errors occurred during initialization. System verification is required."); } } } </code></pre> <p>please note that the <code>@PostConstruct</code> annotation does not guarantee that spring has its transaction services available, that's why I had to manage the transaction my own. Please refer to <a href="http://stackoverflow.com/questions/19876637/how-to-get-transactions-to-a-postconstruct-cdi-bean-method/20740252#20740252">this</a> for more details.</p> |
29,484,810 | 0 | <p>Simply use the current object <code>this</code> keyword</p> <p><code>var id = $(this).attr('id');</code></p> |
27,539,955 | 0 | <p><strong>@chipChocolate.py</strong> gave a brilliant solution! This is an improvement based on his.</p> <ol> <li><p>In Firefox <code>transparent</code> behaves like <code>rgba(0,0,0,0)</code> which leaves a thin gray line at the edge. Change to <code>rgba(255,255,255,0)</code> looks better.</p></li> <li><p>Make the visual effect closer to OP's screenshot: 36 strips, each occupies a 10 degree angle.</p></li> <li><p>Effective on <code><html></code> tag, like OP's try.</p></li> </ol> <p>BTW: Chrome's render engine sucks, best viewed in Firefox.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html { height: 100%; position: relative; } html:before, html:after { content: ''; height: 100%; width: 50%; position: absolute; top: 0; background-size: 200% 100%; background-image: linear-gradient(85deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(75deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(65deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(55deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(45deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(35deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(25deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(15deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(5deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(-5deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(-15deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(-25deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(-35deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(-45deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(-55deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(-65deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(-75deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db), linear-gradient(-85deg, rgba(255,255,255,0) 50%, #000 50%, #000), linear-gradient(-95deg, rgba(255,255,255,0) 50%, #12e0db 50%, #12e0db); } html:before { left: 50%; transform: rotate(180deg); }</code></pre> </div> </div> </p> |
14,931,699 | 0 | <p>This is just something related to the <strong>debugger</strong>, not the CLR or anything else. In any given scope, there is only one accessible variable or object with specified name, so the debugger does not try to distinguish the same names appearing in different palces.</p> <p>Hovering over a <em>name</em> is equivallent of adding a <em>watch</em> for the varialbe in the debugger's watch window. It doesn't matter where you picked the <em>name</em> from.</p> |
4,560,070 | 0 | <p>You can put the image into the checkbox's label, which effectively makes it part of the checkbox (so clicking on it will toggle the checkbox):</p> <pre><code><label for="moreinfo"> <img src="darkCircle.jpg"/> <input name="moreinfo" type="checkbox" id="moreinfo" style="display:none"> </label> $("#moreinfo").change(function() { if(this.checked) { $(this).prev().attr("src", "lightCircle.jpg"); } else { $(this).prev().attr("src", "darkCircle.jpg"); } }); </code></pre> |
20,671,323 | 0 | find() element based on id starting with... and css property <p>How do I select a descendant of an element based on:</p> <ul> <li>its <code>id</code> <strong>starting</strong> with: foo; and</li> <li>its css <code>visibility</code> set to visible?</li> </ul> <p><code>$('#parentEle')find('id^=foo:visible').css({...});</code> ?</p> |
25,402,839 | 0 | <p>Give unique id to your input text</p> <p>for example </p> <p>and in OnClick event function write following line of code</p> <p>$("#1").val('some text');</p> |
11,365,653 | 0 | <p>If your string can be ANY length and you want to match the cases when you have 0 to 3 charaters you should use:</p> <pre><code>\d?\d?\d?\d?$ </code></pre> <p>or, if the regex engine understands it: </p> <pre><code>\d{0-4}$ </code></pre> |
28,339,893 | 0 | Why is IIS exiting with code 0 whenever I preview in Chrome from Visual Studio? <p>I started on a new <a href="/questions/tagged/asp.net" class="post-tag" title="show questions tagged 'asp.net'" rel="tag">asp.net</a> site yesterday with <a href="/questions/tagged/vb.net" class="post-tag" title="show questions tagged 'vb.net'" rel="tag">vb.net</a>; I am familiar with VB.NET but not ASP.NET.</p> <p>My primary browser is Google Chrome, but when I attempt to 'emulate' (debug) the site, the debugger exits the local development server spawned by Visual Studio and as a result, Chrome can never load the website (since when it tries to the webserver isn't running). This can be seen easily by viewing Chrome and Visual Studio side-by-side; Visual Studio's status bar turns orange for a second or so then goes back to blue, and IIS exits with code <code>0</code>:</p> <pre><code>The program '[73048] iisexpress.exe: Program Trace' has exited with code 0 (0x0). The program '[73048] iisexpress.exe' has exited with code 0 (0x0). </code></pre> <p>However this can be temporarily fixed by 'emulating' in Internet Explorer and then with Chrome again, but this fix must be applied on every reboot in order for it to work.</p> <p>Why is this happening, and how can I properly debug in Chrome without the webserver exiting?</p> <p>I read <a href="http://stackoverflow.com/questions/19568762/how-can-i-prevent-visual-studio-2013-from-closing-my-iis-express-app-when-i-end">How can I prevent Visual Studio 2013 from closing my IIS Express app when I end debugging?</a> but however none of the solutions helped me in this respect, and that the issue is that Visual Studio seems to be closing <code>iisexpress.exe</code> when the debugging has started.</p> <p>Chrome runs each tab in a separate process (sandboxing), so perhaps it could be that Visual Studio is expecting Chrome's 'base' PID when Chrome actually spawns an entirely new PID for the new tab created when the 'emulator' starts?</p> <p>Is there any solution to this other than use Internet Explorer (or the 'fix') for debugging the site?</p> <p><a href="https://www.youtube.com/watch?v=GQKgpMPg6HM&feature=youtu.be" rel="nofollow">I have recorded what's happening here, and I still find it odd that Internet Explorer is able to 'cure' the problem temporarily.</a> </p> <p>I am using Visual Studio 2013 Ultimate with Windows 8.1 Pro (Media Centre Edition) and Chrome 40.0.2214.93 m.</p> |
6,265,270 | 0 | <p><code>char *str = "foo"</code> gives you a pointer to a string literal (you should really be doing <code>const char *</code>, but C allows non-<code>const</code> for backwards compatiblity reasons).</p> <p>It is undefined behaviour to attempt to modify a string literal. <code>strtok</code> modifies its input.</p> |
40,797,343 | 0 | Excel Workbook - Sheet Sync / Version Control <p>Let's say I have a workbook with two sheets: A and B.</p> <p>I'm looking for a simple version control system that would allow two users to work on one workbook and keep it in sync. So,</p> <ul> <li>User 1 works on sheet A</li> <li>User 2 works on sheet B</li> </ul> <p>What's a nice & simple way to keep the workbook synced for both users? I don't know if this would require a Macro to compare sheets or if there is some kind of version control software like git to do this.</p> |
4,246,010 | 0 | <p>Does <code>Status</code> touch the UI? Because it seems like it.</p> <p>I can only guess but I imagine <code>Status</code> changes something on UI which needs to be done through <code>Dispatcher.Invoke()</code>.</p> |
38,615,181 | 0 | OnClick in a CardView <include> layout <p>I have a xml that contains some <code>CardView</code> <code><include></code>, I want to set <code>onClick</code> in the <code>CardView</code> includes to open an <code>Activity</code> in my project. I tried to set the <code>onClick</code> in the <code>CardView</code> layout as you will see in the code below, it opens normally but triggers an error sometimes and the application stops. How can I set the <code>onClick</code> in this include?</p> <p>This is the <code><include></code> in my xml</p> <pre><code> <include layout="@layout/view_caderno" android:id="@+id/view_caderno" /> </code></pre> <p>and here is the <strong>CardView</strong></p> <pre><code><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="wrap_content" card_view:cardCornerRadius="10dp" card_view:cardElevation="15dp" android:layout_margin="5dp" android:onClick="Caderno" > <RelativeLayout android:layout_width="match_parent" android:layout_margin="2dp" android:layout_height="match_parent"> <ImageView android:id="@+id/pic1" android:layout_width="100dp" android:layout_height="135dp" android:scaleType="centerCrop" android:padding="5dp" android:src="@drawable/note" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/pic1" android:maxLines="3" android:text="Diário" android:padding="10dp" android:textColor="#222" android:textStyle="bold" android:textSize="22dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/title" android:maxLines="3" android:padding="5dp" android:drawableRight="@drawable/baby2" android:text="@string/diário" android:textColor="#666" android:textSize="14dp" /> </RelativeLayout> </code></pre> <p></p> |
23,643,308 | 0 | <p>Here are my thoughts. I would NEVER have any replication going on between dev and production. That's just way too risky in my opinion and not a Best Practice. Maybe that's not exactly what you're doing I'm not sure.</p> <p>Here's what I do and as far as I know everyone on my team:</p> <p>Our Dev server has a test database. This is a COPY from production. Personally I refresh it now and then so it's basically a snapshot.</p> <p>We have a local template for all dev work. We program in the template and refresh the test database. Typically we don't need to do a "restart task http" as part of the refresh process UNLESS we make a change to a managed bean or are working with SXD. Then yes we refresh the dev application and restart the server and test.</p> <p>In the OLD days I would have a production template on the production server. This was not a replica of anything but it inherited design from the DEV template. So to promote updates to production I'd first refresh the production template from the dev version. Then refresh the production app from the production template.</p> <p>In the world of source control and SourceTree where you have a feature branch, develop branch and default/production branch that kinda eliminates the need for a production template. I'm not in love with that but it is what it is. So we refresh production from our local templates and rely on SourceTree to make sure it's the correct branch at the time we refresh. I think it's a little more risky but this allows the ability to do real hotfixes and stuff.</p> <p>Historically I've not needed to do a restart task http but I've not promoted anything that uses SXD and even my managed bean promotions have been limited to this point. But I imagine I will need to do more with restarting the http task.</p> |
1,000,637 | 0 | <p>Try setting the dialog's owner:</p> <pre><code>var uploadWindow = new UploadWindow(); uploadWindow.Owner = this; uploadWindow.ShowDialog(); </code></pre> |
10,786,592 | 0 | <p>Not with <code>foreach</code>.</p> <pre><code>for (var i = 0; i < array.length; i += 2) { var name = array[i]; var time = array[i + 1]; // do whatever } </code></pre> |
500,006 | 0 | What is the purpose of anonymous { } blocks in C style languages? <p>What is the purpose of anonymous { } blocks in C style languages (C, C++, C#)</p> <p>Example -</p> <pre><code> void function() { { int i = 0; i = i + 1; } { int k = 0; k = k + 1; } } </code></pre> <p><strong>Edit</strong> - Thanks for all of the excellent answers!</p> |
35,489,986 | 0 | <p>You're setting the image:</p> <pre><code>if (userGuess == 'r'){ var displayRock = "<img src='images/rock-user.png' alt='User Rock'>"; document.querySelector("#userGuess").innerHTML = displayRock; } </code></pre> <p>And it is immediatelly being replaced a few lines below:</p> <pre><code>document.querySelector('#userGuess').innerHTML = displayUserGuess; </code></pre> <p>You might want to use the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML" rel="nofollow">insertAdjacentHTML('beforeend', displayUserGuess)</a> function.</p> <p>Also, it is not good practice to query for the same element multiple times - it is better to query once and keep it in a variable like:</p> <pre><code>var userGuessEl = document.querySelector('#userGuess'); // and then below userGuessEl.innerHTML = ... </code></pre> |
4,299,773 | 0 | Post html code to PHP using jQuery <p>I allow users to edit webpages using CKEditor and then save their modified HTML snippets to the server so that I can show them on subsequent page deliveries. </p> <p>I'm using this code to send the HTML and a few IDs to the server:</p> <pre><code>var datatosend = JSON.stringify( { page: 1, block: 22, content: editor1.getData() } ); $.ajax({ url: "/ajax/fragment/", type: "POST", dataType: 'json', data: "data=" + datatosend, success: function (html) { }, error: function (xhr, status, msg) { alert( status + " " + msg ); } }); </code></pre> <p>And on the server side I am using PHP and am doing this:</p> <pre><code> $json = stripslashes( $_POST[ "data" ] ); $values = json_decode( $json, true ); </code></pre> <p>This works a lot of the time when non-HTML snippets are sent but does not work when something like this is sent in the content:</p> <pre><code><img alt="" src="http://one.localbiz.net/uploads/1/Dido-3_2.JPG" style="width: 173px; height: 130px;" /> </code></pre> <p>I'm really not sure what I am supposed to be doing in terms of encoding the data client-side and then decoding server-side? Also not sure if dataType: 'json' is the best thing to use here?</p> |
30,779,220 | 0 | <p>Add this </p> <pre><code>@Override public void onBackPressed() { if (getFragmentManager().getBackStackEntryCount() > 0) { getFragmentManager().popBackStack(); } else { super.onBackPressed; } } </code></pre> |
2,021,079 | 0 | <p>To answer my own question, following is a complete working Chronology class (for 8 hours days). I am posting it here so it might help other people that trying to solve similar problems.</p> <pre><code> import org.joda.time.Chronology; import org.joda.time.DateTimeZone; import org.joda.time.DurationFieldType; import org.joda.time.field.PreciseDurationField; import org.joda.time.chrono.AssembledChronology; import org.joda.time.chrono.GregorianChronology; public final class EightHoursDayChronology extends AssembledChronology { private static final EightHoursDayChronology INSTANCE_UTC; static{ INSTANCE_UTC = new EightHoursDayChronology(GregorianChronology.getInstanceUTC()); } public static EightHoursDayChronology getInstance(){ return INSTANCE_UTC ; } private EightHoursDayChronology(Chronology base) { super(base, null); } @Override protected void assemble(org.joda.time.chrono.AssembledChronology.Fields fields) { int millisPerDay = 1000 * 60 * 60 * 8 ; fields.days = new PreciseDurationField(DurationFieldType.days(), millisPerDay) } @Override public Chronology withUTC() { return INSTANCE_UTC ; } @Override public Chronology withZone(DateTimeZone zone) { throw new UnsupportedOperationException("Method was not implemented"); } @Override public String toString() { return "EightHoursDayChronology"; } } </code></pre> |
40,266,027 | 0 | <p>You can find the approximate number of active threads in the <code>ThreadPoolExecutor</code> by calling the <code>getActiveCount</code> method on it. However you shouldn't need to.</p> <p>From the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool-int-" rel="nofollow">Java documentation for Executors.newFixedThreadPool</a></p> <blockquote> <p>Creates a thread pool that reuses a fixed number of threads operating off a shared unbounded queue. At any point, at most nThreads threads will be active processing tasks. If additional tasks are submitted when all threads are active, they will wait in the queue until a thread is available. If any thread terminates due to a failure during execution prior to shutdown, a new one will take its place if needed to execute subsequent tasks. The threads in the pool will exist until it is explicitly shutdown.</p> </blockquote> <p>So you should be able to keep submitting tasks to the thread pool and they will be picked up and run as threads become available.</p> <p>I also note that you are wrapping your tasks in <code>Thread</code> objects before submitting them to the thread pool which is not necessary.</p> |
21,447,324 | 0 | switching between divs and iframes <p>I have a main viewing area that I want to be switchable from a menu by clicking on a menu item. </p> <p>In this main viewing area I want to have the flexibility of being able to switch between a <code>div</code> and <code>iframe</code>. I know how to change them separately. </p> <p>My question is how can I do this and what is the best way to do this? I'm not sure how to support both divs and iframes in a single viewing area and what would be the best way to do this. </p> <p>I'm using JQuery and bootstrap currently but I'm open to suggestions if they are needed.</p> |
9,833,981 | 0 | <p>See <a href="http://qt-project.org/doc/qt-4.8/qstringlist.html#join" rel="nofollow"><code>QStringList::join</code></a></p> |
12,817,268 | 0 | <p>Start your activity B by Activity A</p> <pre><code>Intent intent = new Intent(ActivityA.this,ActivityB.Class); startActivityForResult(intent,0); </code></pre> <p>finish your activity B with </p> <pre><code>Intent intent = new Intent(); setResult(RESULT_OK,intent ); finish(); </code></pre> <p>now in ActivityA</p> <pre><code>@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //Do your work here in ActivityA } </code></pre> |
2,708,031 | 0 | <p>You can get the index like so:</p> <pre><code>$("#eq > span").each(function (index, Element) { alert(index); ... </code></pre> <p>see <a href="http://api.jquery.com/each/" rel="nofollow noreferrer">http://api.jquery.com/each/</a></p> |
9,103,137 | 0 | <pre><code>$(document).ready(function(){ if($('#contentblock').is(':hidden')) { $('#contentblock').slideDown('slow'); } }); </code></pre> <p>if you have jquery added to your project and your div is display none ... something like this should work.</p> |
14,412,135 | 0 | <p>Check this code. Yo have to create a class with any name example conexionDB, and into the class put the next code:</p> <pre><code>import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * * @author programmerhn */ public class ConexionDB { private Connection con; /** * */ public void Conectar() { try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); con = DriverManager.getConnection("jdbc:derby://localhost:1527/accounts", "username", "password"); System.out.println("Connection successfully"); }catch( ClassNotFoundException | SQLException e) { System.out.println(e.getMessage()); } } } </code></pre> |
7,724,358 | 0 | <p>Based on your requirement(And as you haven't posted XML layout here that you have tried so far), i assume and can suggest the following:</p> <ol> <li>give bottom margin to your listview: <code>android:layout_marginBottom="60dip"</code></li> <li>If you are using RelativeLayout then just give listview as <code>android:layout_above="@+id/footer"</code></li> </ol> <p>I suggest to you go with 2nd option.</p> <h2>Update:</h2> <p>Based on the XML you have posted, try this correct XML layout:</p> <pre><code><RelativeLayout android:id="@+id/relativeLayout1" android:layout_height="wrap_content" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <ListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/companylistView" android:layout_above="@+id/textView1"> </ListView> <TextView android:text="Footer Text" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:layout_alignParentBottom="true"> </TextView> </RelativeLayout> </code></pre> |
7,220,921 | 0 | <p>Subscribing to events in VB.NET requires either the AddHandler or Handles keyword. You will also have a problem with the lambda, the Function keyword requires an expression that returns a value. In VS2010 you can write this:</p> <pre><code> AddHandler m_switchImageTimer.Tick, Sub(s, e) LoadNextImage() </code></pre> <p>In earlier versions, you need to either change the LoadNextImage() method declaration or use a little private helper method with the correct signature:</p> <pre><code> AddHandler m_switchImageTimer.Tick, AddressOf SwitchImageTimer_Tick ... Private Sub SwitchImageTimer_Tick(sender As Object, e As EventArgs) LoadNextImage() End Sub </code></pre> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.