pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
3,827,551
0
Complete flash wordpress theme is possible? (with a php pipe of course) <p>Is possible to have the posts loaded into an swf using the wordpress framework? i mean, i want to write a post using the wordpress wp-admin interface and then see the result in a swf... I know that if i access using a php pipe the mysql server i can retrive the posts, but as i said i want to use the facebook framework... Is out there an allready made script to do this? any ideas? Thanks!</p>
17,587,278
0
<p>create a <code>DataGridViewCheckBoxColumn</code> and connect to the <code>CellContentClick</code> event. then use this code:</p> <pre><code>private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0)// checkbox column { object curr = dataGridView1[e.ColumnIndex, e.RowIndex].Value; if (curr == null || (bool)(curr) == false) { for (int i = 0; i &lt; dataGridView1.RowCount; i++) { if (i != e.RowIndex) { dataGridView1[e.ColumnIndex, i].Value = false; } } } } } </code></pre>
24,056,456
0
<p>Declare every view , controller , model , store whatever you are using in ur application in <code>app.js</code>:</p> <pre><code>Ext.application({ name: 'AppName', requires: [], models:['Model-1','Model-2'], controllers : ['Main'], views : ['View-1','View-2'], stores : [ 'Store-1' , 'Store-2'], launch : function() { Ext.fly('appLoadingIndicator').destroy(); Ext.Viewport.add({ xclass: 'AppName.view.View-1', autoDestroy: false, showAnimation:false }); } }); </code></pre>
31,338,068
0
AspectJ plugin in Android Studio error messages not clickable <p>I am using <a href="https://github.com/uPhyca/gradle-android-aspectj-plugin" rel="nofollow">this</a> plugin for AspectJ support in my android project.</p> <p>When I am making syntax errors , such as missing semicolon , I expect to see <strong>clickable</strong> error in messages log after I try to build the project. Something like this :</p> <blockquote> <p>...\designlibdemo\MainActivity.java Error:(89, 63) error: ';' expected</p> </blockquote> <p>When I click on the error line , it takes me to the class and the line where the error is occurred.</p> <p>But now when I am using aspectJ plugin , I only see the error description , which is actually <strong>not clickable</strong> , and I cannot follow the error to the code. Looks like this : </p> <blockquote> <p>Error:Execution failed for task ':app:compileProductionDebugAspectj'. Syntax error, insert ";" to complete BlockStatements</p> </blockquote> <p>Does anyone know how to make it clickable , so it will take me to the error line ?</p>
27,120,748
0
<p>try with this => put </p> <pre><code>int temp; cin&gt;&gt;temp; </code></pre> <p>before <code>return 0;</code> to pause the program, because the execution finished (successfully) before the last output could be written to the console.</p>
21,016,890
0
<p>As shown in this complete <a href="http://stackoverflow.com/a/11113648/230513">example</a>, <code>DefaultMutableTreeNode</code> "may also hold a reference to a user object." Your <code>userObject</code> can return the display name in <code>toString()</code>, while providing an accessor for the search name. </p> <p>Addendum: <em>I need only the name to be shown there, not the date.</em></p> <p>The <code>getTreeCellRendererComponent()</code> method of <code>DefaultTreeCellRenderer</code> invokes "<code>convertValueToText()</code>, which ultimately invokes <code>toString()</code> on <code>value</code>." Your implementation should instead call <code>setText()</code> with your preferred value, perhaps derived from the value established by the <code>super</code> implementation. </p>
15,253,115
0
No package identifier when getting value for resource number 0x0000000a ? android manifest? <p>I have been searching stack and have found no help regarding this topic</p> <pre><code>03-06 11:37:02.448: W/ResourceType(14147): No package identifier when getting value for resource number 0x0000000a 03-06 11:37:02.448: D/AndroidRuntime(14147): Shutting down VM 03-06 11:37:02.448: W/dalvikvm(14147): threadid=1: thread exiting with uncaught exception (group=0x41d1b438) 03-06 11:37:02.448: I/Process(14147): Sending signal. PID: 14147 SIG: 9 03-06 11:37:02.448: E/AndroidRuntime(14147): FATAL EXCEPTION: main 03-06 11:37:02.448: E/AndroidRuntime(14147): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sliderexample/com.example.sliderexample.FragmentControllers.LeftRightSliderFragmentController}: android.content.res.Resources$NotFoundException: Resource ID #0xa </code></pre> <p>I am including a library, and the LeftRightSliderFragment class has a base class that is apart of that project library. Do I need to some how include the project library in the main project android manifest?</p> <p>If so how do I do this I can't seem to find this on google.</p>
13,186,953
0
<p>I'm not sure I got your DB structure right, but I hope my idea will help you in either case. So I suggest providing more information on DB structure, e.g. can there be many <code>Iterations</code> for a <code>Test</code>?</p> <p>So, here is my proposal:</p> <pre><code>UPDATE test a set a.Iteration_ID = (nvl(( SELECT i.ID FROM Iteration i, (SELECT id, first_value(id) over(partition by connect_by_root(id)) first_id FROM Folder START WITH parent_id IS NULL CONNECT BY parent_id = PRIOR id) folder_flat WHERE a.TEST_ID = folder_flat.first_id and i.Folder_ID = folder_flat.ID ),0)); </code></pre> <p>General idea is flattening hierarchical structure in subquery so it can be easily joined.</p>
36,117,167
0
How to run jigdo on Windows 10 <p>I am used to using <a href="http://atterer.org/jigdo" rel="nofollow">Jigdo</a> to compile Debian CD/DVD images. Since moving from WIndows 7 to Windows 10, I get the following message when I try to run jigdo-lite.bat:</p> <pre><code>Jigsaw Download "lite" Copyright (C) 2001-2005 | jigdo@ Richard Atterer | atterer.net 0 [main] sh 2712 sync_with_child: child 10236(0x170) died before initialization with status code 0xC0000142 1197 [main] sh 2712 sync_with_child: *** child state waiting for longjmp jigdo-lite: fork: Resource temporarily unavailable Press any key to continue . . . </code></pre> <p>I managed to find <a href="http://atterer.org/jigdo/debian-jigdo-mini-howto#comment-3983" rel="nofollow">this comment</a> from someone having the same problem with Windows 8. The link given in the solution is out of date, though. I have also tried updating my msys-1.0.dll file by installing MSYS-1.0.11.exe and copying the DLL into jigdo-bin. The error goes away, but jigdo still refuses to run.</p> <p>Has anybody managed to get jigdo working on Windows 10?</p>
35,753,658
0
<p>Split the S3 permissions into separate statements, and modify the resource setting for those statements. Something like this:</p> <pre><code>{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "cloudwatch:*", "cognito-identity:ListIdentityPools", "cognito-sync:GetCognitoEvents", "cognito-sync:SetCognitoEvents", "dynamodb:*", "events:*", "iam:ListAttachedRolePolicies", "iam:ListRolePolicies", "iam:ListRoles", "iam:PassRole", "kinesis:DescribeStream", "kinesis:ListStreams", "kinesis:PutRecord", "lambda:*", "logs:*", "sns:ListSubscriptions", "sns:ListSubscriptionsByTopic", "sns:ListTopics", "sns:Subscribe", "sns:Unsubscribe" ], "Resource": "*" }, { "Effect":"Allow", "Action":[ "s3:ListBucket", "s3:GetBucketLocation" ], "Resource":"arn:aws:s3:::lambda-scripts" }, { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": "arn:aws:s3:::lambda-scripts/*" } ] } </code></pre>
28,451,639
0
<p>this seemed to work for me VB.NET 3.5 returns a list of items in the past 10 minutes ... I'm sure it can be adjusted to meet your needs</p> <pre><code> ' if online time is greater than 10 minutes ago pickup user check onLineTime.Date = now.AddMinutes(-10).Date check onLineTime.TimeOfDay = now.AddMinutes(-10).TimeOfDay Dim rsl = From s In db.tblSessions Where (s.SessionID &lt;&gt; context.Session.SessionID AndAlso s.onLineTime.Date = DateTime.Now.AddMinutes(-10).Date AndAlso s.onLineTime.TimeOfDay &gt; DateTime.Now.AddMinutes(-10).TimeOfDay) </code></pre> <p>where s.onLineTime is a SQL DATETIME field ie. 2015-02-11 04:49:26.283</p>
12,359,432
0
<p>Removing folder</p> <pre><code>Developer-3.2.6 </code></pre> <p>has solved the problem.</p> <p>Thanks Ned Deily for your answer</p>
30,083,920
0
<p>You have 2 paste operations in your code. One that you know of:</p> <p>WshtCrnt.Paste</p> <p>and one that is part of this range copy statement:</p> <p>. . With WshtSht1 .Range(.Cells(1, 1), .Cells(RowSht1DataFirst - 1, ColSht1LastHdr)).Copy_ Destination:=WshtCrnt.Range("A1") . .</p> <p>By specifying a "Destination" you are requesting a copy AND paste of your range.</p>
40,900,242
0
Bootstrap column that is responsive to 100% of the page height <p>So I successfully coded and implemented a website with a column on the side, that has a hidden div on the side of the column that appears when a button is clicked, I need the height of the column to remain 100% of the browser, but when it came to responsiveness my code lacked since it was custom made.</p> <p>I decided to switch to bootstrap but I find the grid system a bit confusing, so if I have the following set up:</p> <pre class="lang-html prettyprint-override"><code>&lt;div id="container"&gt; &lt;div id="column1"&gt; &lt;div id="row1"&gt; ... ... &lt;/div&gt; &lt;div id="row2"&gt; ... ... &lt;/div&gt; &lt;/div&gt; &lt;div id="column2"&gt; &lt;div id="row3"&gt; ... ... &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>But I wanted to implement bootstrap to get the following look:<br> <a href="https://i.stack.imgur.com/9STmz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9STmz.jpg" alt="enter image description here"></a></p> <p>And if the user resizes it would adjust in this manner, where it would resize based on heights and not widths:<br> <a href="https://i.stack.imgur.com/LCNyg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LCNyg.jpg" alt="enter image description here"></a></p>
13,463,294
0
Creating a scatter plot for multiple rows in R <p>I have a data frame that looks something like this:</p> <pre><code> Samp1 Samp2 Samp3 Samp4 Samp5 Gene1 84.1 45.2 34.3 54.6 76.2 Gene2 94.2 12.4 68.0 75.3 24.8 Gene3 29.5 10.5 43.2 39.5 45.5 ... </code></pre> <p>I am trying to create a scatter plot where the x-axis are the samples(Samp1-5), and the y-axis are the rows(Gene1-3 and so on), but I want the data of each row to be plotted as a different color on the same plot.</p> <p>Any thoughts on how to do this in R? I am more than willing to use ggplot2, lattice, car or any other package in R.</p>
6,030,136
1
Python - Generate a multiple row update query <p>My goal is dynamically generate in Python a SQL query similar to,</p> <pre><code>UPDATE SURV_SCF_ID_STATUS SET AGE_STATUS = CASE NAME WHEN 'entityXp1' THEN '1' WHEN 'entityXp3' THEN '0' WHEN 'entityXpto1' THEN '1' WHEN 'entityXpto3' THEN '1' END WHERE NAME IN ('entityXp1', 'entityXp3', 'entityXpto1', 'entityXpto3') </code></pre> <p>This is what I have so far, but still feels like an ugly hack,</p> <pre><code>logs_age_list = [['entityXp1', '1'], ['entityXp3', '0'], ['entityXp1', '1'], ['entityXpto3', '1']] conditions_list = [] where_list = [] for entity, status in logs_age_list: conditions_list.append("\t\tWHEN %(entity)s THEN %(value)s" % locals() ) where_list.append(entity) conditions_string = '\n'.join(conditions_list) where_string = ', '.join(where_list) sql = ''' UPDATE SURV_SCF_ID_STATUS SET AGE_STATUS = CASE NAME %(conditions_string)s END WHERE NAME IN (%(where_string)s) ''' % locals() print sql </code></pre> <p>Is there some more obvious way to do it? I didn't find any Python module which allow this.</p> <p>Thanks</p>
4,769,380
0
<p>Because you cannot declare class properties with variable expressions. That means you cannot use any arithmetic operators <code>+ - * /</code> or the concatenation operator <code>.</code>, and you can't call functions. Out of your three lines, only <code>$test</code> should work; the other two will give you errors.</p> <p>If you need to build your strings dynamically, do it in the constructor.</p> <pre><code>class Object { public $test = "Hello"; public $var2; public function __construct() { $this-&gt;var2 = $this-&gt;test . "World"; } } </code></pre> <p>By the way, <code>.</code> is not a "string separator". It's the concatenation operator. You use it to <em>join</em> strings, not <em>separate</em> them.</p>
15,097,280
0
<p>Try <a href="http://technet.microsoft.com/en-us/library/ms187316.aspx" rel="nofollow">@@ROWCOUNT</a></p> <pre><code>--Simple T-Sql Proc CREATE PROCEDURE usp_OutputRowExample @Count INT OUTPUT AS BEGIN SELECT * FROM &lt;table&gt;; --Get your entities SELECT @Count = @@ROWCOUNT; --@@ROWCOUNT returns the amount of --affected rows from the last query END //From C# public Tuple&lt;IEnumerable&lt;object&gt;, int&gt;&gt; GetObjects() { using(var connection = new SqlConnection(_connectionString)) { connection.Open(); using(var command = sqlConnection.CreateCommand()) { command.CommandText = "usp_OutputRowExample"; command.CommandType = CommandType.StoredProcedure; var outputParameter = new SqlParameter("@Output", SqlDbType.Int) { Direction = ParameterDirection.Output }; command.Parameters.Add(outputParameter); using(var reader = command.ExecuteReader()) { var entities = new List&lt;entities&gt;(); while(reader.Read()) { //Fill entities } } var outputCount = outputParameter.Value as int? ?? default(int); return new Tuple&lt;IEnumerable&lt;object&gt;, int&gt;(entities, outputCount); } } } </code></pre>
15,478,129
0
IMDB rating plugin not working with ajax <p>I have a page <code>movies.jsp</code> that is called through ajax from the page <code>home.jsp</code>. <code>movies.jsp</code> contains the code for the IMDB rating plugin (<a href="http://www.imdb.com/plugins?titleId=tt1623205&amp;ref_=tt_plg_rt" rel="nofollow">link</a>) :</p> <pre><code>&lt;span class="imdbRatingPlugin" data-user="ur17960624" data-title="&lt;%=request.getParameter("movieId") %&gt;" data-style="p4"&gt; &lt;a href="http://www.imdb.com/title/&lt;%=request.getParameter("movieId") %&gt;/?ref_=plg_rt_1"&gt; &lt;img src="http://g-ecx.images-amazon.com/images/G/01/imdb/plugins/rating/images/imdb_31x14.png" alt="Oz the Great and Powerful (2013) on IMDb" /&gt; &lt;/a&gt; &lt;/span&gt; &lt;script&gt;(function(d,s,id){var js,stags=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}js=d.createElement(s);js.id=id;js.src="http://g-ec2.images-amazon.com/images/G/01/imdb/plugins/rating/js/rating.min.js";stags.parentNode.insertBefore(js,stags);})(document,'script','imdb-rating-api');&lt;/script&gt; </code></pre> <p>My ajax request is called like this :</p> <pre><code>$(document).on('click', 'imdb-button', function(){ $('content').load('movies.jsp&amp;movieId='+imdbmovieId'); }); </code></pre> <p>The problem is that the request works fine the first time, but clicking on other movies with other movieIds returns just the IMDB logo and no rating. I suspect there's a problem with script in the plugin. I tried enclosing the script in a jquery function, and firing that function as a callback to the <code>load</code> everytime but that doesnt work. And ideas?</p>
2,057,565
0
<p>This is a (nasty) bug in WASCE. It should have been <code>"file:///C:/Program Files/IBM/...."</code>. The <code>file://</code> is here the protocol which was missing due to the space in <code>Program Files</code>. The IBM guys should have quoted path names, but they apparently overlooked it.</p> <p>To fix this problem, either install WASCE in a path without spaces, or upgrade to the latest version available.</p>
30,140,725
0
<p>Got it myself:</p> <pre><code> db.xy.update({_id: ObjectId("55081de2162072120758fc53"), "items._id": ObjectId("554df987a8e9950134aa72bd")}, {$set: { "items.$.checked": true}} </code></pre>
27,274,455
0
<p>I am finding evidence which suggests that this problem is related to MySQL version 5.5.8. What version of MySQL are you running?</p>
24,025,641
0
Passing array from system verilog to VHDL <p>I have a code in VHDL which requires an array of elements as generic. COEF_LIST : coef :=(0,0,1,1,2,-2,1,-2,1)</p> <p>How do I send new set of COEF_LIST from my system verilog testbench to VHDL entity?</p> <p>Generic in VHDL is same as parameter in verilog.</p> <p>I declared coef as </p> <pre><code> parameter real COEFF[8:0] = '{0,0,1,1,2,-2,1,-2,1}; </code></pre> <p>in system verilog.</p> <p>I tried passing using (in my verilog testbench)</p> <pre><code> vhdl_entity #( .COEF_LIST(COEFF) ) </code></pre> <p>I get the following error</p> <pre><code> **.COEF_LIST(COEFF) | </code></pre> <p>ncelab: *E,CFIGTC (./vhdl_entity_tb.vams,41|36): VHDL generic vhdl_entity.COEF_LIST (../views/rtl/vhdl_entity.vhd: line 34, position 14) type is not compatible with Verilog. irun: <em>E,ELBERR: Error during elaboration (status 1), exiting.*</em></p> <p>This doesn't work. How do I make it compatible with VHDL? I am using incisiv 13.20.008 version</p> <p>Could anyone please suggest what to do?</p>
40,383,253
0
<p>Because you 1. Didn't include jQuery in your fiddle, and 2. had a typo in your code. New fiddle: <a href="https://jsfiddle.net/yx0ehdy5/2/" rel="nofollow noreferrer">https://jsfiddle.net/yx0ehdy5/2/</a></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var idName = $('.a').closest('li').attr('id'); $('.a').attr('id', idName + 'B');</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;ul&gt; &lt;li id="a"&gt; &lt;div class="a"&gt;something &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt;</code></pre> </div> </div> </p>
28,442,442
0
<p>You are only assigning 'checkedIfInsured' inside an 'if' block. If the condition doesn't hold, it won't get assigned, and that is what the compiler is complaining about.</p> <p>Make sure you assign 'checkedIfInsured' outside the 'if' block.</p>
4,573,079
0
<p>The inner class must be public.</p> <pre><code>package org.example; public class Foo { public abstract static class MyInnerClass { abstract void print(String s); } public void pr() { System.out.println("foo"); } } </code></pre> <p><strong>First test</strong>: Subclass and instantiate the outer <code>Foo</code> class:</p> <pre><code>$ java -classpath $PWD:/usr/share/java/js.jar:/usr/share/java/jline.jar:. org.mozilla.javascript.tools.shell.Main Rhino 1.7 release 2 2010 01 20 js&gt; var a = new JavaAdapter(Packages.org.example.Foo, { &gt; pr: function() { print("jsfoo"); }, &gt; }); js&gt; a.pr(); jsfoo </code></pre> <p><strong>Second test</strong>: Subclass and instantiate the inner class:</p> <pre><code>js&gt; var b = new JavaAdapter(Packages.org.example.Foo.MyInnerClass, { &gt; print: function(s) { print("Inner: " + s); }, &gt; }); js&gt; b.print("one"); Inner: one undefined </code></pre> <p><strong>Note</strong>: If I change the inner class not to be public, I get the exact same error you reported.</p>
8,982,693
0
<pre><code>using System.Collections.Generic; public class Test&lt;T&gt; { public T Value { get { return _Value; } set { if (!EqualityComparer&lt;T&gt;.Default.Equals(_Value, value)) { _Value = value; } } } private T _Value; } </code></pre>
34,433,246
0
<p>Go to the <a href="https://developers.google.com/maps/documentation/android-api/" rel="nofollow">official link</a>, click Get A Key and follow the instructions. <strong>Try to google firstly before asking.</strong></p>
34,807,138
0
<p>Avoid <code>exit;</code> / <code>function exit;</code> or <code>die;</code> will terminate execution, its better practice in only debugging your code.</p> <p>Try like below.</p> <pre><code>public function index(){ if($xx) return TRUE; } </code></pre>
40,647,043
0
Saving image to local storage from canvas <p>Hi I am trying to save to file from canvas, but cannot <strong>name</strong> the file, this works but saves a file as "download" I would like give it any name. Any help is appreciated, lc.getImage gets image from canvas. </p> <pre><code> $('#download_btn').click(function() { var image = lc.getImage(); document.location.href = image.toDataURL("image/png").replace("image/png", "image/octet-stream"); }); </code></pre>
20,504,851
0
Using xcodebuild with an iOS Project and the iOS Simulator <p>This <a href="http://stackoverflow.com/questions/12889065/no-architectures-to-compile-for-only-active-arch-yes-active-arch-x86-64-valid">question</a> is related, but does not resolve the specific issue I am having.</p> <p>I am using Xcode 4.6.3 under OS X 10.7.5.</p> <p>I simply created the default project for a single view iOS app and made no changes to the project settings. The project, of course, builds in Xcode for the iOS Simulator. However, when I try to use xcodebuild from the command line, xcodebuild fails.</p> <p>The project name is just: temp</p> <p>I tried:</p> <pre><code>xcodebuild -scheme temp -sdk iphonesimulator6.1 </code></pre> <p>and that produced the results:</p> <pre><code>Build settings from command line: SDKROOT = iphonesimulator6.1 === BUILD NATIVE TARGET temp OF PROJECT temp WITH CONFIGURATION Debug === Check dependencies No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386). ** BUILD FAILED ** The following build commands failed: Check dependencies (1 failure) </code></pre> <p>Based on the other SO question, I tried:</p> <pre><code>xcodebuild ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO -scheme temp -sdk iphonesimulator6.1 </code></pre> <p>and got similar results:</p> <pre><code>Build settings from command line: ARCHS = armv7 armv7s ONLY_ACTIVE_ARCH = NO SDKROOT = iphonesimulator6.1 === BUILD NATIVE TARGET temp OF PROJECT temp WITH CONFIGURATION Debug === Check dependencies No architectures to compile for (ARCHS=armv7 armv7s, VALID_ARCHS=i386). ** BUILD FAILED ** The following build commands failed: Check dependencies (1 failure) </code></pre> <p>What xcodebuild command do I need to execute to be able to build with xcodebuild?</p> <p>Thank you.</p>
31,234,976
0
<p>@Erik Paulson, check out <a href="https://www.npmjs.com/package/sql-cli" rel="nofollow">SQL-CLI</a>, its a great command line tool to connect to Azure SQL Database and SQL Server natively on a Mac. </p>
589,872
0
<p>What Eclipse and Mylyn version are you using ?</p> <p>The is a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=232664" rel="nofollow noreferrer"><strong>bug</strong></a> somewhat relative to this issue, supposedly fixed, but only in Mylyn 2.3 (in eclipse3.4)</p> <hr> <p>Do not forget, according to the <strong><a href="http://wiki.eclipse.org/index.php/Mylyn/FAQ#Why_am_I_missing_elements_when_I_retrieve_someone_else.E2.80.99s_context.3F" rel="nofollow noreferrer">Mylyn FAQ</a></strong>, that:</p> <blockquote> <p>To identify elements within a project, Mylyn relies on the name of the project being consistent across workspaces.<br> If the project name in the workspace that the context was created with is different than its name in your workspace, the task context will not show elements within that project (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=164058" rel="nofollow noreferrer">bug 164058</a>).<br> The other case where context can be lost is if the elements change names outside of the workspace (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=164243" rel="nofollow noreferrer">bug 164243</a>). </p> </blockquote> <p>(not exactly your issue, but still something to check)</p>
2,896,608
0
<p>You would have to some how invoke a compiler (such as Suns javac), parse its output in case of errors and load the resulting classes dynamically.</p> <p>There is no API-classes in the Java runtime library that will parse, compile and run Java source code.</p>
29,934,881
0
<p>When you write:</p> <blockquote> <p>arr["Hello"]=...</p> </blockquote> <p>you are creating a new Object associated with the <code>arr</code> Array object, which does not affect the length of <code>arr</code>.</p> <p>You can achieve the same effect by writing:</p> <blockquote> <p>arr.Hello=...</p> </blockquote>
40,414,985
0
resque worker stops automatically on aws ec2 <p>My application is hosted on AWS ec2. I am using resque worker for background jobs. I am starting the worker using this command <code>bundle exec rake resque:work QUEUE='*'</code> this does start the worker but after sometime it automatically stops, and i have login into session and start again.</p>
29,729,711
0
Checkbox value not being set <p>In my database there's a bool fiedd called <code>IsAvailable</code>.In my edit function i wanted to fill that checkbox is <code>IsAvailable</code> or <code>not</code> but in here always checkbox not filled.</p> <pre><code>($("#chkcomp").prop('checked') == msg._prodlng[0].IsAvailable); </code></pre> <p>but <br></p> <pre><code>msg._prodlng[0].IsAvailable // this one returns true or false correctly according to database value </code></pre>
8,726,459
0
<p>What is the problem with this code? only one curly braces i found is missing else it is working fine.</p> <p>This will create a dir test in c drive if does not exist else it will list the files in test dir over n over again</p> <pre><code>String entitiesFolderDirectory = "C:\\test"; File entitiesFolder = new File(entitiesFolderDirectory); try { List&lt;String&gt; entitiesDirectoryContents = Arrays.asList(entitiesFolder.list()); for (String entityPropertiesFileName : entitiesDirectoryContents) { System.out.println(entityPropertiesFileName); } }catch (NullPointerException e) { System.out.println("creating new folder"); entitiesFolder.mkdirs(); } </code></pre>
34,056,503
0
<p>In Python 2, <code>map()</code> produces a <code>list</code>, which has the method <code>sort()</code>. In Python 3, <code>map()</code> produces a <code>map</code> object, which acts as a lazy generator and does not have the method <code>sort()</code>. If you want to use <code>sort()</code> on it, you'll have to pass that object to <code>list()</code> first:</p> <pre><code>sub = list(sub) sub.sort() </code></pre> <p>Of course, if you're doing that, you might as well just use <code>sorted()</code>, which works on Python 3 <code>map</code> objects as well as <code>list</code> objects:</p> <pre><code>sub = sorted(sub) </code></pre>
16,169,540
0
Way to avoid ctrl+F5 to get latest changes on web page <p>I have developed SPA using Knockout. I use Visual studio 2012 for development. My application connects to WCF services and displays the data. I make changes to my application and deploy on test server. When i type url and load application, it shows the old contents on the web page. I have to press ctrl+ F5 to get the latest changes. Why is it so and what is the way to avoid it? Cant we just press F5 and get the latest changes? Please let me know what other information you need.</p>
9,450,197
0
<p>First thought:</p> <p>Shouldn't you be using ".each" for your function call:</p> <pre><code>$(".game").load(compose(".game", "yellow")); </code></pre> <p>since there are multiple elements with the "game" class? Just a thought. Also, attaching your function to the loading of the element seems like a potential issue, because what you're after is the width of the <em>window</em>, not the width of the element. The element will load before the whole window has loaded. Try it with window.onload instead. (You're going to get a flash of unstyled content, but that's a separate issue.)</p> <p>But there are also other connected problems: load the page at 1300px wide, then stretch it wider to 1500 and you'll see a similar error on the right side in both Webkit and FF10. There are other weird bugs down below, also on the "noticias" div. The issue is probably a bug with the onresize event, which jquery has (mostly) normalized, but nobody's perfect.</p> <p>Hombre, this is a LOT of work to get around a template limitation. I think you're arguably off on the wrong foot there in the first place, and even if you can get it to work it's obviously js-dependent, which is unnecessary. This is really a CSS issue, not a js issue. And even then, you're building the site so that it will never be responsive to narrow viewports, arguably a bad idea.</p> <p>Why not just do a pure css approach? Set the wrappers to 100% width, with no padding. Then set your asides to 100% width too, with some internal container that has a max width. Leave the WP loops the same, just wrap them in new divs that are set to center. Then set </p> <pre><code>background-size:cover </code></pre> <p>on your background images for each aside. It won't work on ancient browsers, but it'll get you a lot closer.</p> <p>OR... just set crazy wide background images (big enough to cover any realistic situation) on the body or #whitewrap? Or if that's too much to contemplate just add dummy child divs inside the various sections, that are pushed absolutely outside of each area to cover the margins. And then set the container to overflow:hidden so things don't stick out. It's ugly semantically, but more straightforward. There are a much easier ways hacks to fix this with css that don't introduce document reflow problems. You will realistically never write js that matches every single browsers css idiosyncracies!</p>
20,540,114
0
<p>The solution is quite easy:</p> <p>You can provide the jacob.dll (and your 3rd party dll for that matter) as part of your applet - so there is no local installation in any directory necessary. Jacob itself provides a quite nice applet example for that:</p> <p>Download the jacob source from <a href="http://sourceforge.net/projects/jacob-project/files/jacob-project/1.17/jacob-1.17_src.zip/download" rel="nofollow">here</a> and have a look at the applet example:</p> <pre><code>jacob-1.XX\samples\com\jacob\samples\applet </code></pre> <p>There is a readme.txt file exactly describing what you must do - it even supplies an example applet calling some native activeX component to demonstrate its feasibility. It doesn't get easier than that...</p> <p>Update:</p> <p>To deploy an applet using an jnlp file have a look <a href="http://www.oracle.com/technetwork/java/javase/index-142562.html" rel="nofollow">here</a>.</p>
27,311,543
0
<p>%JAVA_HOME%\bin;<strong>%M2%</strong>;C:\Windows\Microsoft.NET\Framework\v4.0.30319;D:\sytemapps\Python27;%<strong>M2</strong>%;%JAVA_HOME%/bin;C:\Developer\Android\sdk\platform-tools\;%GRADLE_HOME%\bin;%DEVKIT_HOME%\bin;%DEVKIT_HOME%\mingw\bin</p> <p>change to </p> <p>%JAVA_HOME%\bin;<strong>%M2_HOME%</strong>;C:\Windows\Microsoft.NET\Framework\v4.0.30319;D:\sytemapps\Python27;%<strong>M2_HOME</strong>%;%JAVA_HOME%/bin;C:\Developer\Android\sdk\platform-tools\;%GRADLE_HOME%\bin;%DEVKIT_HOME%\bin;%DEVKIT_HOME%\mingw\bin</p> <p>Issue might be becuase of environment variable path name. For maven environment varibale name should be <strong>M2_HOME</strong> or <strong>MAVEN_HOME</strong>(for older version)</p>
454,825
0
<p>When you look here at the <a href="http://mysql-python.sourceforge.net/MySQLdb.html#cursor-objects" rel="nofollow noreferrer">mysqldb documentation</a> you can see that they implemented different strategies for cursors. So the general answer is: it depends.</p> <p>Edit: Here is the <a href="http://mysql-python.sourceforge.net/MySQLdb-1.2.2/" rel="nofollow noreferrer">mysqldb API documentation</a>. There is some info how each cursor type is behaving. The standard cursor is storing the result set in the client. So I assume there is a overhead if you don't retrieve all result rows, because even the rows you don't fetch have to be transfered to the client (potentially over the network). My guess is that it is not that different from postgresql.</p> <p>When you want to optimize SQL statements that you call repeatedly with many values, you should look at cursor.executemany(). It prepares a SQL statement so that it doesn't need to be parsed every time you call it:</p> <pre><code>cur.executemany('INSERT INTO mytable (col1, col2) VALUES (%s, %s)', [('val1', 1), ('val2', 2)]) </code></pre>
23,057,306
0
<p>Here's a simple hide/show sidebar script for you to get the idea:</p> <pre><code>&lt;div id="sidebar" style="height:600px; width:100px; right:-75px; position:absolute; background-color:black;"&gt; //sidebar styling &lt;/div&gt; &lt;script&gt; $('#sidebar').hover(function() { $('#sidebar').stop().animate({'right' : '0px'}, 250); }, function() { $('#sidebar').stop().animate({'right' : '-75px'}, 350); }); </code></pre> <p></p> <p>Here is a working example: <a href="http://jsfiddle.net/XTDHx/" rel="nofollow">http://jsfiddle.net/XTDHx/</a></p>
27,103,070
0
<p>The approach is ok.</p> <p>If you do not have enough memory for JVM, you can increase it with -Xmx option</p> <p>For the accurate retrieval it's better to create a unigram language model with frequencies of the words, not just a plain list. See for details</p> <p><a href="http://cmusphinx.sourceforge.net/wiki/tutoriallm" rel="nofollow">http://cmusphinx.sourceforge.net/wiki/tutoriallm</a></p> <p>For the best accuracy it's better to use latest high-level API, see for details</p> <p><a href="http://cmusphinx.sourceforge.net/wiki/sphinx4" rel="nofollow">http://cmusphinx.sourceforge.net/wiki/sphinx4</a></p>
38,598,009
0
how to pass dynamic url in c3.js? <p>There is one page on which data is displayed in csv format. And when I'm passing this url in <code>c3.js</code> then I'm not getting proper output.</p> <h2>Here is the code of <code>c3.html</code>:</h2> <pre><code>&lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="c3.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="chart"&gt;&lt;/div&gt; &lt;script src="d3.min.js"&gt;&lt;/script&gt; &lt;script src="d3.v3.min.js" charset="utf-8"&gt;&lt;/script&gt; &lt;script src="c3.min.js"&gt;&lt;/script&gt; &lt;script&gt; var chart = c3.generate({ data: { url: 'view1.php/id=34.csv', } }); &lt;/script&gt; &lt;/body&gt; </code></pre> <h2> </h2> <p>When I run this script then Ii get a output like this:<a href="https://i.stack.imgur.com/89qLo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/89qLo.png" alt="enter image description here"></a></p> <p>Output of view1.php?id=34.csv is :<a href="https://i.stack.imgur.com/d9okX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d9okX.png" alt="enter image description here"></a> and code of view1.php is : <a href="https://i.stack.imgur.com/dh2A2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dh2A2.png" alt="enter image description here"></a> Can any one help me to resolve this issue?</p>
17,068,706
0
<p>I would suggest using <code>document.getElementById('result').value</code> opposed to <code>result.value</code> within your <code>updateScore</code> function to ensure your accessing the correct element.</p> <p>I had included an example where <a href="https://developer.mozilla.org/en-US/docs/Web/API/window.setInterval" rel="nofollow"><code>setInterval</code></a> will call your <code>updateScore</code> every second to illustrate the result being updated,</p> <pre><code>var score = 20; function updateScore (){ score = score + 10; document.getElementById("result").value = score; } setInterval(updateScore,1000); </code></pre> <p>This can be modified at the following fiddle,</p> <p><a href="http://jsfiddle.net/d3QqN/" rel="nofollow">http://jsfiddle.net/d3QqN/</a></p>
2,143,252
0
<p>SVN command line errors go to stderr, not stdout, which is why you aren't able to see them. What you want to do is redirect stderr to stdout and then <code>print_r($output)</code> to determine the cause of the error. </p> <pre><code>exec('svn commit &lt;stuff&gt; 2&gt;&amp;1', $output, $returnStatus); if ( $returnStatus ) { print_r($output); } </code></pre> <p>Sample output:</p> <pre><code>Array ( [0] =&gt; svn: Commit failed (details follow): [1] =&gt; svn: '/path/to/&lt;stuff&gt;' is not under version control ) </code></pre> <p>This is not ideal because it mixes stderr with stdout when it would otherwise be unnecessary, but I don't know of another way to get the desired output in this case. If someone else does, please comment.</p> <p><strong>Note:</strong> The third parameter to <a href="http://us3.php.net/manual/en/function.exec.php" rel="nofollow noreferrer">exec(...)</a> is the return <strong>status</strong>, not the error message, so you need to tweak your code accordingly for that as well.</p> <p>If the error output after making the <code>2&gt;&amp;1</code> modification doesn't help solve the root cause of your problem, please post the new output here.</p> <p><strong>Edit after new information:</strong></p> <p>Did you upload this SVN working copy to your server from somewhere else? That would explain this error.</p> <p>If I check out a working copy from my local repository, upload it to my remote server, and then try to commit, I get the same error.</p> <p>If that's the case, you need to execute the "svn checkout" of the working copy <strong>on the server running the PHP script</strong> in order to be able to commit to it. If that server can't communicate with the repository's server, then that's a whole other problem.</p>
15,112,185
0
draw a multicolor line with a CGPath <p>below you see a code that draws a multicolor line each time drawMulticolorLine is called.</p> <pre><code> void drawMulticolorLine { CGContextBeginPath(secondaryContext); CGContextMoveToPoint(secondaryContext, h, v); for( int i = 1; i &lt; lineWidth; ++ ) { SetStrokeColor(i); CGContextAddLineToPoint(secondaryContext, h+i, v); CGContextDrawPath(secondaryContext, kCGPathFillStroke); CGContextMoveToPoint(secondaryContext, h+i, v); } } //a function that sets a different color for each i void SetStrokeColor(int i) { CGContextSetRGBStrokeColor(secondaryContext,… } </code></pre> <p>the code above works but if i use it in real live, it is a perfomance killer. so i try to improve the drawing performance with the code below.</p> <pre><code> void drawMulticolorLine { CGContextBeginPath(secondaryContext); CGContextMoveToPoint(secondaryContext, h, v); for( int i = 1; i &lt; lineWidth; ++ ) { SetStrokeColor(i); CGContextAddLineToPoint(secondaryContext, h+i, v); } CGContextDrawPath(secondaryContext, kCGPathFillStroke); } //a function that sets a different color for each i void SetStrokeColor(int i) { CGContextSetRGBStrokeColor(secondaryContext,… } </code></pre> <p>this code works with a good performance if the line color is always the same.</p> <p>my issue now is that once CGContextDrawPath is called the whole line is drawn in the color of the last CGContextSetRGBStrokeColor.</p> <p>is there a way that the path keeps the colors of every line segment that was added ?</p> <p>any help is greatly appreciated.</p> <p>cheers, bzt</p>
37,078,011
0
<p>usea global js variable</p> <pre><code>var gblPreviousTxtBoxValue = $('#txtboxid').val(); </code></pre> <p>use setInterval function to call the function every 5 sec</p> <pre><code>setInterval(function(){ var currentTxtBoxValue =$("#your_id").val(); if(gblPreviousTxtBoxValue != currentTxtBoxValue) //check if current and previous textbox values are not equal { $.ajax({ url: "yoururl", type: "post", data: { "textboxname": currentTxtBoxValue }, success: function(response) { //Code }, error: function(xhr) { //Do Something to handle error } }); } gblPreviousTxtBoxValue = currentTxtBoxValue; //assign current value }, 5000); </code></pre>
17,126,539
0
Can you automatically retrieve a foreign document in your mongodb model using c#? <p>I would like to setup my mongo db poco models so that they automatically retreive their foreign documents, similarly to how its handled by EF and nhibernate.</p> <p>This is the solution that I have come up with so far, its a bit clunky but the best that I could manage:</p> <p>Basic model:</p> <pre><code> public class DocumentOwner { public virtual ObjectId OwnerID { get; set; } } </code></pre> <p>Extended model with manual retrieval of foreign documents:</p> <pre><code>public class DocumentOwner { public MongoDatabase DB { get; set; } public virtual ObjectId OwnerID { get; set; } public virtual Individual Owner { get { return this.DB.GetCollection&lt;Individual&gt;().FindOne(Query&lt;Individual&gt;.EQ(x =&gt; x.Id, this.OwnerID)); } } </code></pre> <p>The main problem with this solution is that I have to manually inject the mongo database instance which is quite clunky, if there was a way to use ninject to inject this instance that would be a lot tidier. Even better if somehow I could use MongoDBRef to retrieve the individual without having to perform a manual query...</p>
14,121,121
0
Display text when clicked on the Button of AlertDialog in android <p>I'm working with android and I want to make an event on <code>AlertDialog</code> button. I want to change the text on the button dynamically, this is my code </p> <pre><code>AlertDialog.Builder alert = new AlertDialog.Builder(Soto_Betawi.this); alert.setTitle("Payment"); alert.setMessage("Total Price : Rp. " + total); final EditText input = new EditText(Soto_Betawi.this); alert.setView(input); alert.setPositiveButton("Change Due", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { cash = Integer.parseInt(input.getText().toString()); change = cash - total; //I want to set a text from the operation above in a text } }); alert.setNegativeButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alert.setCancelable(true); alert.create().show(); </code></pre>
23,186,807
0
<p>Your string is equal to <code>\r\n\r\n\t\r\ndata\r\n\t</code> which is <code>CR LF CR LF TAB CR LF "data" CR LF TAB</code>. You're only trimming <code>LF</code> (<code>\n</code>) in your <code>trim()</code> call, which is why you don't trim <code>CR</code> (<code>\r</code>) and <code>TAB</code> (<code>\t</code>) also present in your string. </p> <p>Try removing the second parameter (which specifies what characters should be trimmed), it will take care all of the whitespace characters.</p> <p>As of <a href="http://www.php.net/manual/en/function.trim.php" rel="nofollow">Docs</a>:</p> <blockquote> <p>This function returns a string with whitespace stripped from the beginning and end of str. <strong>Without the second parameter, trim() will strip these characters:</strong></p> </blockquote> <pre><code>" " (ASCII 32 (0x20)), an ordinary space. "\t" (ASCII 9 (0x09)), a tab. "\n" (ASCII 10 (0x0A)), a new line (line feed). "\r" (ASCII 13 (0x0D)), a carriage return. "\0" (ASCII 0 (0x00)), the NUL-byte. "\x0B" (ASCII 11 (0x0B)), a vertical tab. </code></pre>
26,801,162
0
<p>You can express your query as:</p> <pre><code>SELECT IdPerson FROM Person p JOIN CustomFieldXPerson cfxp on cfxp.IdPerson = p.IdPerson JOIN Filter f on f.IdField = cfxp.IdField AND (f.Criteria = '=' and f.Value = cfxp.Value or f.Criteria = '&lt;' and f.Value &lt; cfxp.Value or f.Criteria = '&lt;=' and f.Value &lt;= cfxp.Value or f.Criteria = '&gt;' and f.Value &gt; cfxp.Value or f.Criteria = '&gt;=' and f.Value &gt;= cfxp.Value ) WHERE f.GroupId = X ; </code></pre> <p>EDIT:</p> <p>If you want to get persons that match all filters, just use <code>group by</code>:</p> <pre><code>SELECT IdPerson FROM Person p JOIN CustomFieldXPerson cfxp on cfxp.IdPerson = p.IdPerson LEFT JOIN Filter f on f.IdField = cfxp.IdField AND (f.Criteria = '=' and f.Value = cfxp.Value or f.Criteria = '&lt;' and f.Value &lt; cfxp.Value or f.Criteria = '&lt;=' and f.Value &lt;= cfxp.Value or f.Criteria = '&gt;' and f.Value &gt; cfxp.Value or f.Criteria = '&gt;=' and f.Value &gt;= cfxp.Value ) AND f.GroupId = X GROUP BY idPerson HAVING COUNT(f.IdField) = COUNT(*) OR COUNT(f.IdField) = 0; </code></pre> <p>In other words, all the filters that match the person, in the group, match. The additional condition in the <code>HAVING</code> clause is in case the filter group has no filters.</p>
14,025,348
0
<p>You don't need the ' in <code>NSPredicate</code>. They are being inserted automatically.</p> <p>Just try</p> <pre><code>[NSPredicate predicateWithFormat:@"(name like %@)",name]; </code></pre> <hr> <p>The reason this crashed was because the predicate value was interrupted. If you create a string with format, like in your example, your going to end up with <strong>(name like 'family's')</strong>, which obviously can't work. </p> <p>If you use <code>predicateWithFormat:</code> on the other hand, you can let it handle this itself. It will escape your special characters.</p>
6,407,200
0
<p>You can write a pseudo <code>IO</code> class that will write to multiple <code>IO</code> objects. Something like:</p> <pre><code>class MultiIO def initialize(*targets) @targets = targets end def write(*args) @targets.each {|t| t.write(*args)} end def close @targets.each(&amp;:close) end end </code></pre> <p>Then set that as your log file:</p> <pre><code>log_file = File.open("log/debug.log", "a") Logger.new MultiIO.new(STDOUT, log_file) </code></pre> <p>Every time <code>Logger</code> calls <code>puts</code> on your <code>MultiIO</code> object, it will write to both <code>STDOUT</code> and your log file.</p> <p><strong>Edit:</strong> I went ahead and figured out the rest of the interface. A log device must respond to <code>write</code> and <code>close</code> (not <code>puts</code>). As long as <code>MultiIO</code> responds to those and proxies them to the real IO objects, this should work.</p>
21,956,763
0
<p>This is more or less what you wrote. To be more precise:</p> <p>Yellowish line signal Cython command which are not directly translated to pure C code but which work by calling CPython API to do the job. Those line includes:</p> <ul> <li>Python object allocation</li> <li>calls to Python function and builtins</li> <li>operating on Python high level data stuctures (eg: list, tuples, dictionary)</li> <li>use of overloaded operation on Python types (eg: +, * in Python integers vs C int)</li> </ul> <p>In any case, this is a good indication that thing might be improved.</p>
25,580,296
0
Flipped copy of a Rectangle using ScaleTransform in WPF <p>I am trying to create a flipped copy of a rectangle in Left, Right, Up and Down directions.</p> <p>However I am able to do it when the selected rectangle has no prior transformation applied on it.</p> <p>But once a rectangle is being transformed with <code>ScaleTransform</code> and I try to flip it again in the desired direction, the solution does not work for me.</p> <p>Please correct me what I am doing wrong here.</p> <p>Here is the code I am using</p> <p><strong>XAML</strong></p> <pre><code>&lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="Auto"&gt;&lt;/ColumnDefinition&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Canvas Name="canvas" Background="LightGray" MouseDown="Canvas_MouseDown"&gt; &lt;Rectangle x:Name="rect" StrokeThickness="2" Stroke="Black" Height="60" Width="100" Canvas.Left="500" Canvas.Top="300" MouseDown="rect_MouseDown"&gt; &lt;Rectangle.Fill&gt; &lt;LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"&gt; &lt;GradientStop Color="#FFFB7D0E" Offset="0" /&gt; &lt;GradientStop Color="#FF59C103" Offset="1" /&gt; &lt;GradientStop Color="#FFFFFFFF" Offset="0.51" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Rectangle.Fill&gt; &lt;/Rectangle&gt; &lt;/Canvas&gt; &lt;StackPanel Grid.Column="2"&gt; &lt;Button Content="Left" Click="Button_Click"&gt;&lt;/Button&gt; &lt;Button Content="Right" Click="Button_Click"&gt;&lt;/Button&gt; &lt;Button Content="Up" Click="Button_Click"&gt;&lt;/Button&gt; &lt;Button Content="Down" Click="Button_Click"&gt;&lt;/Button&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; </code></pre> <p><strong>C#</strong></p> <pre><code> Rectangle selectedRect; //Flip private void Button_Click(object sender, RoutedEventArgs e) { if (selectedRect == null) return; //Create a copy of rectangle string rectXaml = XamlWriter.Save(selectedRect); StringReader stringReader = new StringReader(rectXaml); XmlReader xmlReader = XmlReader.Create(stringReader); Rectangle newRect = (Rectangle)XamlReader.Load(xmlReader); //Calculate the bounding box var boundingRect = newRect.RenderTransform.TransformBounds(new Rect(0, 0, newRect.Width, newRect.Height)); double cX, cY, sX, sY; sX = 1; sY = 1; cX = (boundingRect.Left + boundingRect.Right) / 2; cY = (boundingRect.Top + boundingRect.Bottom) / 2; switch ((sender as Button).Content.ToString()) { case "Up": sX = 1; sY = -1; cY = boundingRect.Top; break; case "Down": sX = 1; sY = -1; cY = boundingRect.Bottom; break; case "Left": sX = -1; sY = 1; cX = boundingRect.Left; break; case "Right": sX = -1; sY = 1; cX = boundingRect.Right; break; } newRect.Stroke = Brushes.Black; newRect.RenderTransform = new ScaleTransform(sX, sY, cX, cY); newRect.MouseDown += new MouseButtonEventHandler(rect_MouseDown); //Add new rect to Canvas canvas.Children.Add(newRect); } //To select a rectangle on canvas private void rect_MouseDown(object sender, MouseButtonEventArgs e) { if (selectedRect != null) selectedRect.Stroke = Brushes.Black; selectedRect = sender as Rectangle; selectedRect.Stroke = Brushes.Blue; e.Handled = true; } //clear the selection private void Canvas_MouseDown(object sender, MouseButtonEventArgs e) { if (selectedRect != null) { selectedRect.Stroke = Brushes.Black; selectedRect = null; } e.Handled = true; } </code></pre>
9,008,038
0
SQL Assertion/Trigger: how to set an attribute to forbid decreasing updates <p>I have a table called person, one of the attributes is years_worked.</p> <p>I need to find a way to restrict years_worked from being decreased, so that a trigger/assertion (not sure what to use here) will only allow increases on updates.</p>
31,109,964
0
JavaScript storing search matches in array <p>How to store the search matches from <code>id="post_body"</code> to array?</p> <blockquote> <pre><code>&lt;textarea name="post[body]" id="post_body"&gt; </code></pre> <p>--Lorem ipsum-- dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et --Dolore-- magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. --Duis aute-- irure dolor in reprehenderit in voluptate velit esse cillum --Dolore-- eu fugiat nulla pariatur</p> <p><code>&lt;/textarea&gt;</code></p> </blockquote> <p>The target are all words surrounded by '--'. In Ruby, I do that with:</p> <pre><code>matches = tex.scan(/--(.+?)--/).flatten matches = matches.uniq </code></pre> <p>In this case, the array would be: </p> <pre><code>matches = ["Lorem ipsum", "Dolore", "Duis aute"]; </code></pre> <p>NB: the word "Dolore" appears twice surrounded with <code>--</code>, but in the array it should be stored only once.</p>
29,398,451
0
<p>The general strategy here is that you want to <em>maintain a context</em> as you traverse the list, and at each step, you use that piece of context to answer the question of whether the current item should be kept or thrown out. In pseudo-code:</p> <pre><code>public static &lt;A&gt; List&lt;A&gt; removeDuplicates(List&lt;? extends A&gt; original) { List&lt;A&gt; result = new ArrayList&lt;A&gt;(); /* initialize context */ for (A item : original) { if ( /* context says item is not a duplicate */ ) { result.add(item); } /* update context to incorporate the current `item` */ } return result; } </code></pre> <p>Some people have brought up the question of whether you mean consecutive duplicates or non-consecutive ones. In reality, the difference in the solutions is small:</p> <ol> <li>For consecutive duplicates the context is the most recently seen item.</li> <li>For non-consecutive it's the <code>Set&lt;A&gt;</code> of all items seen up to that point.</li> </ol> <p>I'll let you fill in the pattern for those cases.</p>
25,326,069
0
<p>I had the same issue and found a solution thanks to <a href="http://stackoverflow.com/users/496099/chris">chris</a> (see <a href="http://stackoverflow.com/questions/17041735/jpa-criteria-api-where-subclass">JPA Criteria API where subclass</a>).</p> <p>For this you need JPA 2.1, and you make use of one of the <a href="http://docs.oracle.com/javaee/7/api/javax/persistence/criteria/CriteriaBuilder.html#treat(javax.persistence.criteria.Path,%20java.lang.Class)" rel="nofollow"><code>CriteriaBuilder.treat()</code></a> methods. Just replace your <code>builder.equal...</code> line by:</p> <pre><code>builder.equal(builder.treat(root.get("article"), Book.class).get("title"), "Foo"); </code></pre>
33,318,594
0
<p>Most likely your routing is not doing what you think so you are hitting a different route entirely than you think you are. Probably you are hitting the default 404 not found handler route. Instead of posting the 1 line you think is wrong, post a <a href="http://stackoverflow.com/help/mcve">Minimal, Complete, and Verifiable example</a> and we can help you find the problem.</p>
25,366,339
0
<p>As the commenter pointed out, I would recommend you use PDO as this is an escaping issue and opens you up to SQL injection vulnerabilities. On the change that you are using mysql_* instead, try escaping the variable with mysql_real_escape_string() first.</p>
5,071,837
0
<p>There is a trick you could use. If your version of jQuery is second which loads, you will need first move to safety theirs version before you load it, something like this</p> <pre><code>&lt;script type="text/javascript"&gt; (function($){ var theirs_jquery = $; })(jQuery); &lt;/script&gt; </code></pre> <p>Then add your jQuery version script include tag</p> <pre><code>&lt;script src="link/to/my/jquery.js"&gt;&lt;/script&gt; &lt;!-- add your plugins --&gt; &lt;script src="link/to/my/jquery/plugins/plugin1.js"&gt;&lt;/script&gt; &lt;script src="link/to/my/jquery/plugins/plugin2.js"&gt;&lt;/script&gt; </code></pre> <p>then add another script block with folowing</p> <pre><code>&lt;script type="text/javascript"&gt; (function(){ var $$ = jQuery; // this is your shortcut var $ = theirs_jquery; // put back their version })(jQuery); &lt;/script&gt; </code></pre> <p>after this you can access your jquery version with $$ shortcut</p>
41,014,111
0
<p>First: bare variables are not supported since Ansible 2.2<br> Second: <code>files</code> is a list in your example</p> <pre><code>- debug: msg="{{ item.files[0].path }}" with_items: "{{ foundFiles.results }}" </code></pre> <p>If you have multiple entries under in <code>files</code> list, you should consider to <code>map</code> it.</p>
1,915,342
1
Python: List of lists of integers to absolute value to single number <p>If i had a list of list of integers say:</p> <blockquote> <p>[['12' '-4' '66' '0'], ['23' '4' '-5' '0'], ['23' '77' '89' '-1' '0']]</p> </blockquote> <p>I wanted to convert the numbers to their absolute values and then to a single number, so the output would be:</p> <blockquote> <p>1246602345023778910</p> </blockquote>
3,873,925
0
<p>You can use the <a href="http://www.oracle.com/technetwork/java/javame/downloads/sdk30-mac-jsp-137878.html" rel="nofollow">Java ME SDK</a> which is based on Netbeans. And as this SDK is based on Netbeans I'm pretty sure that you can find a way to have directly those features in Netbeans.</p>
16,141,778
0
c# Many Unmanaged Memory in WinForm Application <p>I've a c# winform application. Now after startup when the mainscreen is shown, I've a huge amount of unmanaged memory about 110MB, the whole managed ram is about 20 MB.</p> <p>Here some things that could be uncommon:</p> <ul> <li>The application consists of many assemblies which are in total 98 MB file size.</li> <li>Some Forms have a wpfhost, but which are loaded this time (but perhaps some other WPF framework libraries)</li> <li>The Ram does not seem to be growing.</li> <li>There are a lot strings shown many of them are part of the WPF like "margin"</li> <li>The Main form is quite big and has a infragistics datagrif with about 30 Rows.</li> </ul> <p>When I load all assemblies with <strong>Assembly.Load</strong> in a console app they only cost 1 MB of unmanaged ram.</p> <p>Where can this unmanaged memory come from ? Can someone give me a hint on what kind of elements could be involved?</p>
22,524,887
0
error: cannot find symbol symbol: class JTextFieldLimit class: Login <p>I have 2 files named <code>Login.java</code> and <code>JTextFieldLimit.java</code> (both files kept in <code>c:\java programs\planning sheet\with re_allotted</code>) </p> <p>Login.java </p> <pre><code>import javax.swing.*; import java.awt.*; import java.awt.event.*; class Login extends JFrame implements ActionListener,KeyListener { JButton SUBMIT; JPanel panel, panel1; JLabel label1, label2; static JTextField text1, text2; Login() { label1 = new JLabel(); label1.setText("Username:"); String username = System.getProperty("user.name"); System.out.println(username); text1 = new JTextField(15); text1.setDocument(new JTextFieldLimit(7)); text1.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if(!(Character.isLetterOrDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE) || (c == KeyEvent.VK_PASTE))) { JOptionPane.showMessageDialog(null, "Only numbers and alphabets allowed"); e.consume(); } } }); text1.setText(username); text1.setEditable(false); label2 = new JLabel(); label2.setText("Password:"); text2 = new JPasswordField(15); text2.setDocument(new JTextFieldLimit(6)); text2.setEditable(false); text2.addKeyListener(this); username = username.toLowerCase(); if((("hrv1pen").equals(username)) || (("rar1pen").equals(username)) || (("sut5pen").equals(username))) text2.setText("admin"); else text2.setText(""); text2.requestFocusInWindow(); SUBMIT = new JButton("SUBMIT"); JPanel panel1 = new JPanel(new BorderLayout()); JLabel label = new JLabel(); label.setIcon(new ImageIcon("banner.jpg")); panel1.add(label,BorderLayout.EAST); JLabel label3 = new JLabel(" Login Screen"); panel1.add(label3,BorderLayout.CENTER); panel = new JPanel(new GridLayout(3,1)); panel.add(label1); panel.add(text1); panel.add(label2); panel.add(text2); panel.add(SUBMIT); add(panel1, BorderLayout.NORTH); add(panel, BorderLayout.CENTER); SUBMIT.addActionListener(this); setTitle("LOGIN FORM"); } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if(key == KeyEvent.VK_ENTER) { String username = text1.getText().trim(); username = username.toLowerCase(); String value1 = text2.getText().trim(); } } public void actionPerformed(ActionEvent ae) { String username = text1.getText().trim(); username = username.toLowerCase(); String value1 = text2.getText().trim(); if((("").equals(username)) &amp;&amp; (("").equals(value1))) { System.out.println("username and password cannot be blank"); JOptionPane.showMessageDialog(null, "Username and Password fields cannot be empty", "Error", JOptionPane.ERROR_MESSAGE); text2.setText(""); text1.setText(""); text1.requestFocusInWindow(); } } public static void main(String arg[]) { Login frame = new Login(); frame.pack(); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); } } </code></pre> <p>JTextFieldLimit.java </p> <pre><code>import javax.swing.text.PlainDocument; import javax.swing.text.*; public class JTextFieldLimit extends PlainDocument { private int limit; JTextFieldLimit(int limit) { super(); this.limit = limit; } public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException { if(str == null) return; if((getLength() + str.length()) &lt;= limit) { super.insertString(offset,str,attr); } } } </code></pre> <p>All these days the file <code>Login.java</code> was compiling and running. </p> <p>But, today, when I tried to compile the file in command prompt by changing the directory to <code>c:\java programs\planning sheet\with re_allotted</code> and<br> then compiling using <code>javac Login.java</code>, I get the following compilation error: </p> <pre><code>Login.java:27: error: cannot find symbol text1.setDocument(new JTextFieldLimit(7)); symbol: class JTextFieldLimit location: class Login Login.java:53: error: cannot find symbol text2.setDocument(new JTextFieldLimit(6)); symbol: class JTextFieldLimit location: class Login </code></pre> <p>Don't know what am I doing wrong. </p> <p>Kindly guide me. </p> <p>Thanks in advance</p>
26,027,594
0
<p>You do the math before you read the input. You need to do it the other way around.</p> <p>Also, there's no reason to pass a meaningless and uninitialized value to the <code>celsius</code> function.</p> <p>Lastly, <code>180/100</code> is 1 remainder 80 because when you divide two integers, you get integer division. You can use <code>180.0/100.0</code>.</p> <p>Basically, you need to learn C.</p>
22,048,391
0
Operations using ffdfwith in R <p>I am using ff and R because I have a huge dataset (around 16 GB) to work with. As a test case, I got the file to read around 1M records and wrote it out as a ff database.</p> <pre><code>system.time(te3 &lt;- read.csv.ffdf(file="testdata.csv", sep = ",", header=TRUE, first.rows=10000, next.rows=50000, colClasses=c("numeric","numeric","numeric","numeric"))) </code></pre> <p>I have uploaded the resulting file (te3) here: <a href="http://bit.ly/1c8pXqt" rel="nofollow">http://bit.ly/1c8pXqt</a></p> <p>I tried to do a simple calculation to create a new variable</p> <pre><code>ffdfwith(te3, {odfips &lt;- ofips*100000 + dfips}) </code></pre> <p>I get the following error (there are no missing records) which has flummoxed me:</p> <pre><code>Error in if (by &lt; 1) stop("'by' must be &gt; 0") : missing value where TRUE/FALSE needed In addition: Warning message: In chunk.default(from = 1L, to = 1000000L, by = 2293760000, maxindex = 1000000L) : NAs introduced by coercion </code></pre> <p>Any insights will be appreciated. Also, related to FF, is it possible to use standard R packages such as MCMC (I need to use the inverse gamma function) with FF databases?</p> <p>TIA,</p> <p>Krishnan</p>
22,938,835
0
Inner join doesn't show all data in sql server 2008 <p>I made a query in sql server 2008 as bellow for my online book shop :</p> <pre><code>SELECT Packages.packageName , Packages.healthStatus , Packages.Stock , Packages.Description , Packages.Image , Packages.YearOfPub , Packages.Edition , updatePackage.price , publisher.publisherName , writer.writerName , translator.translatorName , Categories.CategoriesName , Packages.packageID FROM Packages INNER JOIN updatePackage ON Packages.packageID = updatePackage.packageID INNER JOIN writer ON Packages.writerId = writer.writerId INNER JOIN publisher ON Packages.publisherId = publisher.publisherId INNER JOIN book_translator ON Packages.packageID = book_translator.packageID INNER JOIN translator ON book_translator.translatorId = translator.translatorId INNER JOIN Categories ON Packages.CategoriesId = Categories.CategoriesId </code></pre> <p>but when I execute query SQL server return only books(packages) that has one or many translator because some books hasn't translator/s and in other word, package and translator has many to many relation so I break it by two one to many relation.</p> <p><strong>EDIT :</strong></p> <p>Thanks to Calvin Smith I resolve my problem and change my query to this :<br></p> <pre><code>SELECT Packages.packageName , Packages.healthStatus , Packages.Stock , Packages.Description , Packages.Image , Packages.YearOfPub , Packages.Edition , updatePackage.price , publisher.publisherName , writer.writerName , translator.translatorName , Categories.CategoriesName , Packages.packageID FROM Packages LEFT JOIN updatePackage ON Packages.packageID = updatePackage.packageID LEFT JOIN writer ON Packages.writerId = writer.writerId LEFT JOIN publisher ON Packages.publisherId = publisher.publisherId LEFT JOIN book_translator ON Packages.packageID = book_translator.packageID LEFT JOIN translator ON book_translator.translatorId = translator.translatorId LEFT JOIN Categories ON Packages.CategoriesId = Categories.CategoriesId </code></pre>
8,650,087
0
<p>Unicode character <code>U+25BC</code> is a solid triangle pointing down: ▼. You can also finagle html block elements to look like triangles by giving them a width and height of zero and applying special border properties to three of the element's sides. This technique is known as the <a href="http://davidwalsh.name/css-triangles" rel="nofollow">CSS triangle hack</a>.</p>
35,360,909
0
<p>You can use <code>case</code> and <code>sum</code> like;</p> <pre><code>SELECT t1.Date, sum(case when t2.country = 'Saudi Arabia' then 1 else 0 end) `Saudi Arabia`, sum(case when t2.country = 'Kuwait' then 1 else 0 end) `Kuwait`, sum(case when t2.country in ('Saudi Arabia', 'Kuwait') then 0 else 1 end) others FROM Online_customer_activity_v2 t1 JOIN `players` t2 ON t1.`Customers` = t2.`username` GROUP BY t1.Date </code></pre> <p>You can use <code>if</code> like,</p> <pre><code>SELECT t1.Date, sum(if(t2.country = 'Saudi Arabia', 1, 0)) `Saudi Arabia`, sum(if(t2.country = 'Kuwait', 1, 0)) `Kuwait`, sum(if(t2.country in ('Saudi Arabia', 'Kuwait'), 0, 1)) others FROM Online_customer_activity_v2 t1 JOIN `players` t2 ON t1.`Customers` = t2.`username` GROUP BY t1.Date </code></pre>
33,973,137
0
<p>Glyphicons use a font to display icons, each icon being a character in the font.</p> <p>Therefore it is simple to use them in JButtons.</p> <ol> <li>Create a swing Font for the glyphicon font.</li> <li>Set the font on your JButton.</li> <li>Set the button label to the character of a glyphicon icon. The characters codes can be found for example in bootstrap.css.</li> </ol> <p>Here is a detailed explanation using <a href="http://stackoverflow.com/questions/24177348/font-awesome-with-swing">fontawesome</a> instead of glyphicons but the technique is the same.</p>
12,317,377
0
<p>Instead of using <code>MODIFY</code>, use a field symbol:</p> <pre><code>DATA: lt_materials TYPE TABLE OF zzllog. FIELD-SYMBOLS: &lt;ls_line&gt; TYPE zzllog. * other code with strange comments :-) LOOP AT lt_materials ASSIGNING &lt;ls_line&gt; WHERE matnr IS INITIAL. SELECT SINGLE MATNR FROM zlldet INTO &lt;ls_line&gt;-matnr WHERE palet = &lt;ls_line&gt;-palet. ENDLOOP. </code></pre> <p>This is just an example for the correct syntax. It's not a good idea to do this in a real program because there's a fair chance thtat you'll be hitting the database with thousands of requests, and potentially draw quite a bit of performance. It'd be better to preselect the <code>PALET</code> numbers that have no <code>MATNR</code> into a separate table and then use <code>FOR ALL ENTRIES IN</code> to read all the <code>MATNR</code>s in a single query.</p> <p>EDIT: Added type names. BTW, your way of declaring the internal table is somewhat outdated...</p>
40,353,985
0
<p>Ok i got it ! try this</p> <pre><code> angular.module('myApp', []) .controller('myController', function($scope, $interval) { var count = 0; var addPerson = function() { count++ $scope.person = { name: 'person' + count, age: 20 + count }; }; var timer = $interval(addPerson, 1000); }) .directive('myDirective', function($compile) { return { restrict: "A", transclude: true, scope: "=", link: function(scope, element, attrs) { scope.handleClick = function(event) { console.log(event.target.innerText) } scope.$watch(function() { return scope.person; }, function(obj) { var elementToRender = angular.element('&lt;div ng-click="handleClick($event)"&gt;' + obj.name + '&lt;/div&gt;'); function renderDiv() { return elementToRender } element.append(renderDiv()); $compile(elementToRender)(scope); }, false); } }; }); </code></pre> <p>template</p> <pre><code>&lt;div ng-app="myApp" ng-controller="myController"&gt; &lt;div my-directive data="{{person}}"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre>
2,027,552
0
Background of cell in a DataGridView <p>I've been playing around with datagridviews for a bit and a question has came up. -> Doesn't changing a cells background work out of the CellFormatting event. I've tried this:</p> <pre><code>private void dataGridView1_CellFormatting(object sender, dataGridViewCellFormattingEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name.Equals(dnsList.First&lt;String&gt;())) { DataGridViewRow row = dataGridView1.Rows[e.RowIndex]; DataGridViewCell cell = row.Cells[e.ColumnIndex]; cell.Style.BackColor = Color.FromArgb(194, 235, 211); } } </code></pre> <p>Which works perfectly, whereas this:</p> <pre><code>private void ApplyColoring() { if (dataGridView1.DataSource != null) { foreach (DataGridViewRow dataGridRow in dataGridView1.Rows) { DataGridViewCell cell = dataGridRow.Cells[dnsList.First&lt;String&gt;()]; cell.Style.BackColor = Color.FromArgb(194, 235, 211); } } } </code></pre> <p>Debugging tells me everything is sound, null-reference-or-whatever-exception-wise... Any tips?</p>
11,119,158
0
custom font wingding is not working in my application <p>EveryBody i am trying to use custom font such as wingding in my ios application i have followed all those steps for adding custom font like adding the custom font file in my application resource and added the key fontsprovidedbytheapplication in plist and make it as array and below i have mentioned my custom font file name but, still those(wingding) are not working .when i try with other custom fonts they are working properly.</p> <p>This is the code i have used so offer</p> <pre><code> - (void)viewDidLoad { mine = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 240, 40)]; [mine setFont:[UIFont fontWithName:@"wingding" size:20]]; [mine setText:@"Where i am doing wrong"]; [self.view addSubview:mine]; [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } </code></pre> <p>where i am missing ant suggestion will be a great help.</p>
24,409,078
0
<p>This is pretty clean CSS to target the 3rd <code>&lt;p&gt;</code></p> <pre><code>.product-Detail p:nth-of-type(3) { display: block; } </code></pre> <p><a href="http://jsfiddle.net/U5Tfp/3/" rel="nofollow">http://jsfiddle.net/U5Tfp/3/</a></p>
14,826,812
0
<p>You can hit the key <kbd>q</kbd> (for <em>quit</em>) and it should take you to the prompt.</p> <p>Please see this <a href="http://stackoverflow.com/questions/1696433/how-to-exit-a-git-status-list-in-terminal">link</a>.</p>
5,098,462
0
<p>I believe this may be handled in the PageRequestManager endRequest event.</p>
32,084,362
0
<p>your form should be something like this</p> <pre><code>&lt;form&gt; &lt;label for='qpInputdata'&gt;No Selection&lt;/label&gt; &lt;input id="qpInputdata" class="form-control name="xCaasType" ng-model="fData.selection" type="radio" ng-value="true" value="no"&gt; &lt;label for='qpInputdata'&gt;Select This One&lt;/label&gt; &lt;input id="qpInputdata" class="form-control name="xCaasType" ng-model="fData.selection" type="radio" ng-value="true" value="selected"&gt; &lt;/form&gt; </code></pre> <p>now the model <strong>fData.selection</strong> will hold one of these two values "no","selected" according to the selected option</p>
2,076,878
0
<p>You could exclude at source?</p> <pre><code>var sum = GroupProduct.Where(a =&gt; a.Product.ProductID==1 &amp;&amp; a.Amount != null) .Sum(a =&gt; (decimal)a.Amount); </code></pre>
16,142,527
0
Delphi IdNNTP: download a file from Usenet according to NZB-file <p>I have a NZB file, something like this: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;nzb xmlns="http://www.newzbin.com/DTD/2003/nzb"&gt; &lt;head&gt; &lt;meta type="title"&gt;Your File!&lt;/meta&gt; &lt;meta type="tag"&gt;Example&lt;/meta&gt; &lt;/head&gt; &lt;file poster="Joe Bloggs &amp;lt;[email protected]&amp;gt;" date="1071674882" subject="Here's your file! abc-mr2a.r01 (1/2)"&gt; &lt;groups&gt; &lt;group&gt;alt.binaries.newzbin&lt;/group&gt; &lt;group&gt;alt.binaries.mojo&lt;/group&gt; &lt;/groups&gt; &lt;segments&gt; &lt;segment bytes="102394" number="1"&gt;[email protected]&lt;/segment&gt; &lt;segment bytes="4501" number="2"&gt;[email protected]&lt;/segment&gt; &lt;/segments&gt; &lt;/file&gt; &lt;/nzb&gt; </code></pre> <p>Is there any way to download and assemble this file using Indy IdNNTP? I will be grateful for any sample code. Thanks in advance.</p>
16,407,377
0
<p>If you did not prepare for this question then there is no build in way to get to that information. However, you could use third party log reader tools to recover (all) the last statements that where executed against the database. This requires the database to be in Full recovery mode. You could potentially go back as far as you have log backups with this method.</p> <p>If you want to prepare for that question being ask in the future, you have several options. The most obvious one is Change Data Capture. You also could write a trigger yourself that records data changes. You could also run a trace capturing SQL Batch Started. Finally you could use a third party network sniffer/logger to capture all statements send to the server (this however requires that connection encryption is not used).</p>
36,021,850
0
<p>You can try to set the cell-format to text via</p> <pre><code>CellStyle cellStyle = wb.createCellStyle(); cellStyle.setDataFormat( createHelper.createDataFormat().getFormat("@")); cell.setCellStyle(cellStyle); </code></pre> <p>Note: CellStyles shoudl be re-used for all applicable cells, do not create new ones for every cell.</p> <p>You could also try to use the "Ignore errors" feature in the .xlsx format, however support for it is not fully done yet, see <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=46136" rel="nofollow">Issue 46136</a> and <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=58641" rel="nofollow">Issue 58641</a> for some ongoing discussion.</p> <p>See also <a href="https://msdn.microsoft.com/en-us/library/dd944168%28v=office.12%29.aspx" rel="nofollow">this MSDN page</a> for some additional information</p>
33,950,310
0
<p>You have missed <code>name</code> in select and input:</p> <pre><code> &lt;select id="tdarea" name="tdarea"&gt; &lt;option value="a" selected="selected"&gt;Area A&lt;/option&gt; &lt;option value="b"&gt;Area B&lt;/option&gt; &lt;option value="c"&gt;Area C&lt;/option&gt; &lt;/select&gt; &lt;input required type="text" id="name" name="name"/&gt; </code></pre>
32,682,813
0
<p>There are probably better ways to design that array, but here's a function that should give you what you asked for:</p> <pre><code>function gethours($x, $myoptions){ foreach($myoptions as $o){ if($o[0] == $x){ return $o[1]; } } } echo gethours('3 days', $myoptions); </code></pre> <p>If the column you search in is always the same you could just go for an associative array and use that column as array keys. </p>
23,512,970
1
How to implement multiple signals in a program? <p>I am starting to learn Python (newbie), so not much idea about the different modules etc.</p> <p>Scenario that I want to simulate:</p> <p>I have a program <code>prg1.py</code> that I want to run for some user defined time say <code>t</code> seconds. After this time (<code>t</code> seconds), the program should exit. For this I am using <code>signal.signal()</code> to create alarm. Below is the working code:</p> <pre> import signal import time import sys def receive_alarm(signum, stack): sys.exit('Exiting!') signal.signal(signal.SIGALRM, receive_alarm) signal.alarm(10) while 1: print 'Working...' time.sleep(1) </pre> <p>The program runs for 10 seconds and then exits as expected.<br> Note: The while loop below is just for testing, it would be replaced by my working code.</p> <p>Now I want to implement multiple signals to do different tasks at different intervals of time. </p> <p>e.g. In <code>EVERY</code>: <br> <code>5</code> seconds: execute a specific function <code>fun1()</code> <br> <code>10</code> seconds: execute a specific function <code>fun2()</code>, and so on... (tasks I want to perform in the program)</p> <p>I tried adding another alarm as shown below, but didn't work:</p> <pre><code>import signal import time import sys def receive_alarm(signum, stack): sys.exit('Exiting!') def receive_alarm_two(signup, stack): print 'Call to other functions!' signal.signal(signal.SIGALRM, receive_alarm) signal.alarm(10) # Second Alarm signal.signal(signal.SIGALRM, receive_alarm_two) signal.alarm(2) while 1: print 'Working...' time.sleep(1) </code></pre> <p>This doesn't work! Simple exits without any error or exit message :(</p> <p>How can this functionality be implemented?</p> <p>NOTE: <code>Use of Threads is restricted.</code><br></p> <p>NOTE: <code>As I want the program to keep listening to different signals, it can't sleep i.e. cannot use time.sleep().</code></p>
6,273,973
0
Problem with file location when using Fixtures.loadModels("...") <p>I'm using the Play Framework <em>yabe</em> tutorial and came across a problem when adding tags. I'm not sure what code I added that caused the change, but now the Fixtures.loadModels(data.yml) piece of code searches for a file in .../some_folder/play-1.2.1/modules/docviewer/app/data.yml instead of .../some_folder/yabe_tutorial/conf/data.yml as it should. </p> <p>Here's my code in the default package of /yabe_tutorial/app: </p> <pre><code>@OnApplicationStart public class Bootstrap extends Job { public void doJob() { if (User.count() == 0) { Fixtures.delete(); Fixtures.loadModels("data.yml"); } } } </code></pre> <p>Is there any settings I can use to change the directory that loadModels uses?</p> <p>I'm new to this all, so I'd really appreciate some help. Thanks!</p>
2,593,644
0
GAE update different fields of the same entity <p>UserA and UserB are changing objectA.filedA objectA.filedB respectively and at the same time. Because they are not changing the same field one might think that there are no overlaps. Is that true? or the implementation of pm.makePersistnace() actually override the whole object... good to know...</p>
9,253,991
0
how to pass dynamic theme from swf to swc? <p>I have one swf file which takes theme from network during runtime. Now I conerted that swf to swc, and created another container swf to point to that swc. Seems the new swf file has the theme information, which the swc does not take the theme.</p> <p>How do I enable swc to take the same theme as its parent container swf file?</p> <p>Thanks.</p>
40,736,909
0
<p>I do have created a subclass of UITextField, it is easy to implement and use. Here is the GitHub link:</p> <p>Visit <a href="https://github.com/subhajitregor/SHPickerFieldExample" rel="nofollow noreferrer">https://github.com/subhajitregor/SHPickerFieldExample</a></p> <p>Please see the example to see how to use. The Readme file is also updated now.</p>
11,500,055
0
How can we implement drag and drop feature in html5 <p>Hello everyone please suggest me how to implement drag and drop feature inside CANVAS of html5 using kineticJS it drag and dropped object should be able to display the id of the object.</p>
10,219,042
0
<p>One very simple way is to add a middle term containing a timestamp or a counter value. So for example: </p> <pre><code>&gt;&gt;&gt; heap = [] &gt;&gt;&gt; counter = itertools.count() &gt;&gt;&gt; for i in range(10): ... heapq.heappush(heap, (i, -next(counter), str(i) + ' oldest')) ... heapq.heappush(heap, (i, -next(counter), str(i) + ' newest')) ... &gt;&gt;&gt; heapq.heappop(heap) (0, -1, '0 newest') &gt;&gt;&gt; heapq.heappop(heap) (0, 0, '0 oldest') &gt;&gt;&gt; heapq.heappop(heap) (1, -3, '1 newest') &gt;&gt;&gt; heapq.heappop(heap) (1, -2, '1 oldest') </code></pre> <p>As agf mentions, this is the approach used by the <a href="http://docs.python.org/library/heapq.html#priority-queue-implementation-notes" rel="nofollow"><code>heapq</code></a> docs, only using negative indices. (The implementation there also includes a nice task-removal and priority-change routine.)</p>
17,580,905
0
<p>There's a <a href="https://connect.microsoft.com/VisualStudio/feedback/details/551183/loading-toolbox-content-from-package-takes-55-seconds-or-more" rel="nofollow" title="Connect Bug Report">Connect bug report</a> for this. It's already closed, so you can't vote, but let Microsoft know you had the problem by clicking "I can too".</p>
23,074,129
0
<p>Yep, hes using an absolute path for image, but the project isn't in server root folder then you need's to inform the name of the folder in path...</p> <p>Use <code>&lt;img src="/finalprojectneat/image/Picture2.png"&gt;</code> then you have your logo display on every page. But is not the most indicated because when you send to production server, you didn't have the "finalprojectneat" folder then you have to remove all paths using "projectneat".</p> <p>One solution is to define a constant in your "index.php", not necessary in "index.php" but required in root folder of project</p> <pre><code>define ('_IMAGES_', realpath(dirname(__FILE__) . '/image')); </code></pre> <p>if you put this constant in another file inside root folder, use "require" to import these constants to your views...</p> <p>and in your views, use</p> <pre><code>&lt;?php echo _IMAGES_ . '/Picture2.png'; ?&gt; </code></pre>