pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
28,517,254
0
<p>You can start looking at developer tools of chrome where you can understand more about rendering of html elements.. Check the image attached for one such instance. Your h2(id="block-bens-main-menu-menu") tag has by default margin-top &amp; margin-botom values which is actually creating the space. Investigate more by yourself ;) <img src="https://i.stack.imgur.com/lFIVg.png" alt="enter image description here"></p>
15,733,439
0
<p>Your new table should look like this:</p> <pre><code>public class MessageByPerson { @ManyToOne private Message message; @ManyToOne private Person person; @Column private Date date; } </code></pre>
1,766,363
0
<p>There is also another attempt to emulate position: fixed :</p> <p><a href="http://cubiq.org/scrolling-div-on-iphone-ipod-touch/5" rel="nofollow noreferrer">http://cubiq.org/scrolling-div-on-iphone-ipod-touch/5</a></p> <p>But it's hacky, and not very performant too.</p> <p>You are right, Titanium or phonegap do the job well...</p>
3,546,105
0
<p><code>[playSoundButton = [UIButton buttonWithType:UIButtonTypeCustom] retain];</code> should read <code>playSoundButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];</code></p> <p>(i.e. move the first <code>[</code> further right to <code>UIButton</code>)</p>
4,956,245
0
How to manage shared resources for several web apps in Maven AND Eclipse? <p><em>Note: I didn't get any response in the first version of this question, so I modified it to be more generic...</em></p> <p><strong>Context</strong></p> <p>My project is divided into several maven modules and several web-applications. Here is the structure:</p> <pre><code>my-project + pom.xml +-- commons +-- persistence +-- ... +-- web-app-1 +-- web-app-2 +-- ... </code></pre> <p>All the web applications share common resources, such as JS, CSS and images files.</p> <p>Instead of duplicating these resources in each <code>web-app-X</code>, I decided to create another project called <code>web-resources</code>, which is a WAR project. The structure is then the following one:</p> <pre><code>my-project + pom.xml +-- commons +-- persistence +-- ... +-- web-app-1 +-- web-app-2 +-- ... +-- web-resources +-- pom.xml +-- src/main/webapp +-- web.xml (which is almost empty, just need to be present for Maven) +-- web_resources +-- css +-- images +-- javascript </code></pre> <hr/> <p><strong>Maven</strong></p> <p>In Maven 2 (or Maven 3, as I just migrated my project to maven 3.0.2), this configuration is easy to manage as all <code>web-app-X</code> declare <code>web-resources</code> as a dependency:</p> <pre><code>&lt;groupId&gt;foo.bar&lt;/groupId&gt; &lt;artifactId&gt;web-app-1&lt;/artifactId&gt; ... &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;foo.bar&lt;/groupId&gt; &lt;artifactId&gt;web-resources&lt;/artifactId&gt; &lt;version&gt;${preclosing-version}&lt;/version&gt; &lt;type&gt;war&lt;/type&gt; &lt;/dependency&gt; ... </code></pre> <p>So when I build my WAR project, it first get the <code>web-resources.war</code> (built just before), unzip it, and build <em>on top of it</em> the <code>web-app-X</code> web-application. This way, my WAR file will contains also a directory called <code>web-resources/</code> that contains the shared resources.</p> <p>This is the war overlay principle.</p> <p>So on a Maven point of view, everything is fine!</p> <hr/> <p><strong>Eclipse</strong></p> <p>Now, here comes the main problem: having a good Eclipse configuration.</p> <p><em>Question</em>: How can I use my current configuration to be managed correctly by Eclipse? In particular, when I deploy any <code>web-app-X</code> in Tomcat using Eclipse...</p> <p>Note that I want to get the more automatizable (?) configuration, and avoid any manual steps, as this configuration should be used by dozens of developers...</p> <p>For me, the best solution seems to use the <em>linked resources</em> of Eclipse. Thus, I set the following configuration in my <code>web-app-X</code> pom.xml:</p> <pre><code>&lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;wtpversion&gt;1.5&lt;/wtpversion&gt; &lt;linkedResources&gt; &lt;linkedResource&gt; &lt;name&gt;web_resources&lt;/name&gt; &lt;type&gt;2&lt;/type&gt; &lt;location&gt;${project.basedir}\..\web-resources\src\main\webapp\web_resources&lt;/location&gt; &lt;/linkedResource&gt; &lt;/linkedResources&gt; &lt;/configuration&gt; &lt;/plugin&gt; ... </code></pre> <p>When I run the <code>mvn eclipse:eclipse</code> configuration, it adds succesfully this information in my <code>.project</code> file:</p> <pre><code>&lt;projectDescription&gt; ... &lt;linkedResources&gt; &lt;link&gt; &lt;name&gt;web_resources&lt;/name&gt; &lt;type&gt;2&lt;/type&gt; &lt;location&gt;C:\dev\project\web-resources\src\main\webapp\web_resources&lt;/location&gt; &lt;/link&gt; &lt;/linkedResources&gt; &lt;projectDescription&gt; </code></pre> <p>Now, I import my project in Eclipse. Problem: in <code>Project properties &gt; Java Build Path &gt; Source</code>, I don't see the Link Source present. I only see my four Maven default directories (<code>src/main/java</code>, <code>src/main/resources</code>, <code>src/test/java</code> and <code>src/test/resources</code>). What is strange is that when I try to manually add the linked resources, it refuses and says that it already exists...</p> <p>So when I deploy my web application on my Tomcat in Eclipse, it does <em>not</em> deploy the web_resources directory, and thus I don't get the CSS / JS / images deployed. </p> <p>After some tests, it seems that I have to do two modifications:</p> <ol> <li>Add the line <code>&lt;classpathentry kind="src" path="web_resources" output="src/main/webapp/web_resources"/&gt;</code> in my <code>.classpath</code> file;</li> <li>Remove the <code>&lt;project&gt;preclosing-web-resources&lt;/project&gt;</code> in the <code>.project</code> file.</li> </ol> <p>Note that using this configuration, Eclipse will copy (and keep synchronization) the content of web_resources project in my <code>web-app-X/src/main/webapp/web_resources</code>, but this is not a problem (this directory is ignored by the SCM).</p> <p>The only automated solution I found was to create a simple Maven plugin that do the two previous modification, and then run the following command (or use a .bat file):</p> <pre><code>mvn eclipse:clean eclipse:eclipse myEclipsePlugin:eclipse </code></pre> <hr/> <p><strong>Question</strong></p> <ul> <li>Is there a better way to manage such configuration?</li> </ul> <hr/> <p><em>Technical information</em></p> <p>Java 6, Maven 3.0.2, maven eclipse plugin 2.8, Eclipse 3.3.2 (but I can test with newer version of Eclipse), <strong>no</strong> m2eclipse plugin.</p>
3,915,493
0
<p>It seems like you can't. You can only go as far as ...</p> <pre><code>CompositeId() .KeyProperty(x =&gt; x.Id1, "ID1") .KeyProperty(x =&gt; x.Id2, "ID2"); </code></pre> <p>There is no option for type or length. </p> <p>But in version 1.1 there seems to be a possibility</p> <pre><code>CompositeId() .KeyProperty(x =&gt; x.Id1) .KeyProperty(x =&gt; x.Id2, kp =&gt; kp .ColumnName("ID2") .Type(typeof(string))); </code></pre>
3,954,285
0
<p>You can write a Diary application. Whose functionalities include:-</p> <ol> <li><p>Writing the daily diary and saving it which must be searchable via data/keywords(Basic function)</p></li> <li><p>Contacts with basic information about the person.</p></li> <li><p>Give a feature to export your matter to a suitable file format, say doc.</p></li> <li><p>Of course, login with password for different users, you can use file systems to store the data(but in encrypted format).</p></li> </ol> <p>This will be a good application to start with. :)</p>
31,260,691
0
<p>The line in your gunicorn configuration file</p> <pre><code>user = newuser </code></pre> <p>does appear to be the central problem. As is sorta shown by</p> <pre><code>$ id uid=1001(msw) gid=1001(msw) groups=1001(msw),4(adm),8(mail) … </code></pre> <p>A user has one uid and one gid. All other groups listed are groups that you belong to but are not your gid. To change the gid you have to explicitly ask for it to be switched as in:</p> <pre><code>$ newgrp mail $ id uid=1001(msw) gid=8(mail) groups=1001(msw),4(adm),8(mail) … </code></pre> <p>does change my gid to one of my other groups. Unfortunately newuser probably now looks like:</p> <pre><code> $ id uid=22(newuser) gid=22(newuser) groups=22(newuser), 455(giri26) … </code></pre> <p>and since newuser might never log in to a shell nor even have a password, there is no good place to run newgrp. </p> <p>To fix it, you should make giri26 the gid of newuser by modifying <code>/etc/passwd</code></p> <pre><code>newuser:x:22:22: … </code></pre> <p>becomes:</p> <pre><code>newuser:x:22:455: … </code></pre> <p>This could have effects on newuser's other files and directories, be wary.</p>
40,186,817
0
Continuous Deployment of builds onto servers from build server <p>I'm using ansible to deploy and install builds on to my servers, but I have to feed Ansible with build name, to grab it and deploy. I would like to close this loop since I have to deploy the builds thrice a day. Is there a tool to do this so that everytime it sees a new build it will automatically invoke the ansible playbook. Or should I go ahead and write my own tool to do this. I'm open to suggestions.</p>
35,910,896
0
<p>You use <code>$this-&gt;form_validation</code> only from inside controllers and/or models. </p> <p>When you are inside the library itself, you're in a different scope, where the <code>form_validation</code> property doesn't exist ... and you don't need it in the first place - you just use <code>$this</code>, so it's <code>$this-&gt;set_message()</code> instead of <code>$this-&gt;form_validation-&gt;set_message()</code>.</p> <p>Read up on how OOP works: <a href="http://www.php.net/manual/en/language.oop5.basic.php" rel="nofollow">http://www.php.net/manual/en/language.oop5.basic.php</a></p>
18,706,446
0
returning rows from $wpdb - losing my mind <p>spent the last two hours trying to get this $wpdb->get_results to return an array the same way while ($row = mysql_fetch_array($result)) would. I have tried everything, get_col, get_row, etc... went through the wp codex and tried all their examples and literally nothing works. Everything returns either Array ( ) or NULL. I am losing my mind here, any help is GREATLY appreciated.</p> <p>I originally coded this plugin in PDO and then realized wordpress doesn't support that. I am not a fan of wpdb sql. Here it is;</p> <pre><code>$query = $wpdb-&gt;get_results("SELECT * FROM admin WHERE user_id = '$userid'"); foreach ($query as $row) { echo $row-&gt;date; } </code></pre>
13,491,922
1
What is the difference between url() and tuple for urlpatterns in Django? <p>So in Django the two lines of url code below work the same:</p> <pre><code>urlpatterns = patterns('', url(r'^login/$', 'django.contrib.auth.views.login'), (r'^login/$', 'django.contrib.auth.views.login') ) </code></pre> <p>AFAIK, the only difference is I can define <code>name='login'</code> so I can use it for reversing url. But besides this, is there any other differences?</p>
33,597,552
0
How to retain the shell returned from runtime.exec(); <p>I'm making a terminal app and using the following code</p> <pre><code> try { process = runtime.exec(command); BufferedReader stream = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; while ((line = stream.readLine()) != null) { stringBuilder.append(line); stringBuilder.append('\n'); } stream = new BufferedReader(new InputStreamReader(process.getErrorStream())); while ((line = stream.readLine()) != null) { stringBuilder.append(line); stringBuilder.append('\n'); } } catch (IOException e) { e.printStackTrace(); } </code></pre> <p>Problem is that everytime <code>exec()</code> is executed, a new <code>shell</code> is created. (That's what I read)</p> <p>Let's say I execute <code>cd</code>, it will change the directory, but next time I execute a command, it will execute from <code>/</code>.</p> <p>How do I use the same shell till the app is closed?</p> <p><strong>PS:</strong> This question is not same as <a href="http://stackoverflow.com/questions/4157303/how-to-execute-cmd-commands-via-java">How to execute cmd commands via Java</a> I am able to execute commands, no problem! I'm not trying to execute known commands by putting them in source code. I'm getting the commands from the user. Problem is I'm not able to maintain the shell environment constant. </p>
8,969,409
0
<p>Before storing, cast the pointer with a <code>dynamic_cast&lt;void*&gt;</code> - this will give you a void pointer to the <em>most derived object</em>; this void pointer will, for the same objects, have the same address stored.</p> <p>See also <a href="http://stackoverflow.com/questions/8123776/are-there-practical-uses-for-dynamic-casting-to-void-pointer">this question</a>.</p>
31,403,686
0
<blockquote> <p>Just a simple trick you can do</p> </blockquote> <p>just use a string variable for messages appending and counter.</p> <pre><code>$(document).ready(function () { var Messages; var counter=0; $('#btnSave').click(function (e) { validateTitle(); validatePrefix(); validateTextBoxes(); if(counter &gt; 0) { alert(Messages); e.preventDefault(); counter=0; } }); function validateTitle() { debugger; if ($("#ddlTitle").val() &gt; "0") { if ($("#ddlTitle").val() == "1104" &amp;&amp; $("#txtTitle").val() === "") { Messages += "Please enter the text in other title"; Messages += "\n"; counter ++; } } else { Messages += 'Please select the title'; Messages += "\n"; counter ++; } } function validatePrefix() { debugger; if ($("#ddlPrefix").val() &gt; "0") { if ($("#ddlPrefix").val() == "1110" &amp;&amp; $("#txtPrefix").val() === "") { Messages += "Please enter the text in other prefix"; Messages += "\n"; counter ++; } } else { Messages += 'Please select the prefix'; Messages += "\n"; counter ++; } } function validateTextBoxes() { debugger; if ($("#txtFirstName").val() === "") { Messages += 'First name is required'; Messages += "\n"; counter ++; } if ($("#txtMiddleName").val() === "") { Messages += 'Middle name is required'; Messages += "\n"; counter ++; } if ($("#txtLastName").val() === "") { Messages += 'Last name is required'; Messages += "\n"; counter ++; } if ($("#txtFatherName").val() === "") { Messages += 'Father name is required'; Messages += "\n"; counter ++; } if ($("#txtCurrentCompany").val() === "") { Messages += 'Current company is required'; Messages += "\n"; counter ++; } if ($("#txtDateofJoin").val() === "") { Messages += 'Date is required'; Messages += "\n"; counter ++; } if ($("#txtCurrentExp").val() === "") { Messages += 'Current Experience is required'; Messages += "\n"; counter ++; } } }); </code></pre> <blockquote> <p>Just update counter and impliment check if check > 0 show message (alert)</p> <p>it will benefit you two things </p> </blockquote> <ol> <li><p>User dont need to click each time and get alert.. dont need to return false.user Must know at once what erors are in form.</p></li> <li><p>Secondly code is simple/Simple logic.</p></li> </ol>
27,513,976
0
<p>Well…try this steps:</p> <ol> <li>Open the "Start" menu and click "Computer" or "My Computer" depending on your version of Windows. Navigate to the C drive.</li> <li>Open the "Notes" folder. Double-click on the "Notes.ini" file to open it in Notepad.</li> <li>Place a semicolon (;) in front of the following two lines to temporarily disable VirusScan: AddInsMenus=NCMenu EXTMGR_ADDINS=NCExtMgr</li> <li>Click the "Save" option from the "File" menu. Close Notes.ini.</li> </ol> <p>Or visit: <a href="https://social.technet.microsoft.com/Forums/appvirtualization/en-US/612aacd1-c4ba-47eb-bf9c-0940d2ea1a05/lotus-notes-backup-data-nsf-file-corrupted?forum=itproxpsp" rel="nofollow">https://social.technet.microsoft.com/Forums/appvirtualization/en-US/612aacd1-c4ba-47eb-bf9c-0940d2ea1a05/lotus-notes-backup-data-nsf-file-corrupted?forum=itproxpsp</a> U can find info for solution this problem</p>
6,210,573
0
<p>It all depends on y our app structure. If the data in the hidden div confidential, then by no means setting it's display to none a secure method since the client has full access to all client side data. But when talking about a button that invokes a back-end behavior, you should also be doing back-end validation on all requests.</p>
33,601,141
0
<p>You created a service account but it looks like you're trying to access it using a client flow.</p> <p>Have a look at the service account documentation here: <a href="https://developers.google.com/identity/protocols/OAuth2ServiceAccount" rel="nofollow">https://developers.google.com/identity/protocols/OAuth2ServiceAccount</a></p> <p>The first step would be to go back to the developer console and generate a p12 key. Then the basic flow for Python looks like this:</p> <pre><code>from oauth2client.client import SignedJwtAssertionCredentials scope = 'https://www.googleapis.com/auth/drive.readonly https://spreadsheets.google.com/feeds' client_email = '&lt;your service account email address&gt;' with open("MyProject.p12") as f: private_key = f.read() credentials = SignedJwtAssertionCredentials(client_email, private_key, scope) http_auth = credentials.authorize(Http()) </code></pre>
10,257,596
0
Experiencing difficulty with a bubblesort exercise <p>I have an exercise where I need to use a WebMethod to perform a bubble sort, Ascending and Descending. </p> <p>This is the method that I use for an Ascending sort for example.</p> <pre><code>[WebMethod] public Boolean larger(int a, int b) { Boolean isLarger; if (a &lt; b) { isLarger = false; } else { isLarger = true; } return isLarger; } </code></pre> <p>This is the C# application that accesses the method to perform the sort. We are required to sort 5 numbers only.</p> <pre><code>ArrayList numbersAL = new ArrayList(); for (int i = 0; i &lt; 5; i++) { numberInput = Int32.Parse(Console.ReadLine()); numbersAL.Add(numberInput); } Boolean swap; do { swap = false; for (int j = 0; j &lt; numbersAL.Count - 1; j++) { Console.WriteLine("output"); int a = (int)numbersAL[j]; int b = (int)numbersAL[j + 1]; result = s.larger(a, b); if (result) { temporary = a; a = b; b = temporary; swap = true; } } } while (swap == true); </code></pre> <p>With this however I get an infinite loop and I guess the reason for this is that the numbers in the ArrayList still remains in the original order after the numbers were swapped around and then the process just repeats itself.</p> <p>How could I rectify this situation.</p> <p>Kind regards</p>
15,854,810
0
<p>Try crystal Reports as these are widely used to generate reports and invoices. Follow these links, may be they'll be helpful for you:</p> <ul> <li><a href="http://www.codeproject.com/Articles/15859/Basics-of-Crystal-Report-for-NET-Programmers" rel="nofollow">http://www.codeproject.com/Articles/15859/Basics-of-Crystal-Report-for-NET-Programmers</a></li> <li><a href="http://infynet.wordpress.com/2010/10/06/crystal-report-in-c/" rel="nofollow">http://infynet.wordpress.com/2010/10/06/crystal-report-in-c/</a></li> </ul> <p>Or you can google it for more tutorials, there are too many.</p>
19,215,331
0
<p>From what I can tell, your paint code should work fine</p> <p>The problem is, most likely, in the fact that the images are not loading, but since you've chosen to ignore any errors that are raised by this process, you won't have any idea why...</p> <p>So, instead of <code>// dont know</code>, use <code>e.printStackTrace()</code> when loading your images</p> <pre><code>for (int i = 0; i &lt; 5; i++) { try { URL url = new URL(getCodeBase(), imageString[i]); images[i] = ImageIO.read(url); } catch (IOException e) { e.printStackTrace(); } } </code></pre> <p>This will at least provide you with some more clues as to the problems you are facing.</p> <p>You should also avoid using AWT (<code>Button</code>) components on Swing (<code>JAppelt</code>) containers. They tend not to play nice well together.</p> <p>Having said all that, I would encourage you not to use <code>JAppelt</code> as a learning tool. Applets come with a swag of their own issues which are difficult to diagnose at the best of times, more so when you're trying to learn Java and the Swing API. The Swing API is complex enough with adding unnecessary challenges.</p> <p>You should also avoid extending from top level containers (in this case, you have no choice), but you should also avoid painting directly to top level containers. Apart from the complexities of the paint process, they are not double buffered, which introduces flickering when the UI is updated.</p> <p>Instead, start with something like a <code>JPanel</code> and override it's <code>paintComponent</code> method. <code>JComponent</code>s are double buffered by default, so they won't flicker when they are repainted. You must also call <code>super.paintXxx</code>. As I said, the paint process is a complex process, each <code>paintXxx</code> method is a link in the chain, if you break the chain, you should be prepared for some strange and unexpected behaviour down the track.</p> <p>Once you have your component setup, you are free to choose how to deploy it, by adding it to something like a <code>JFrame</code> or <code>JApplet</code>, making your component more flexible and reusable.</p> <p>Take a look at <a href="http://docs.oracle.com/javase/tutorial/uiswing/painting/" rel="nofollow">Performing Custom Painting</a> for more details</p> <p>The next question that comes to mind is why? Why do any custom painting at all, when <code>JLabel</code>s will not only do the job, but would probably do it better.</p> <p>Take a look at <a href="http://docs.oracle.com/javase/tutorial/uiswing/" rel="nofollow">Creating an GUI with Swing</a> for more details...</p>
15,262,841
0
<p>Yes it's possible and few samples here</p> <ul> <li><a href="http://support.microsoft.com/kb/815799" rel="nofollow">How to bind an array of objects to a Windows Form by using Visual C++ .NET or Visual C++ 2005</a></li> <li><a href="http://msdn.microsoft.com/en-us/library/aa290064%28v=vs.71%29.aspx" rel="nofollow">Programming Windows Forms with Managed Extensions for C++</a></li> <li><a href="http://technet.microsoft.com/en-us/subscriptions/downloads/1te0bbs8%28v=vs.90%29.aspx" rel="nofollow">How to: Do DDX/DDV Data Binding with Windows Forms</a></li> </ul>
18,731,102
0
<p>For what i know Microsoft kinect for windows SDK does not best to detect open and close hands. Microsoft provides tracking of 20 <a href="http://i.msdn.microsoft.com/dynimg/IC584844.png" rel="nofollow">body</a> parts and does not include the fingers of the hand. You can take advantage of the kinect interactions for that in an inderect way. This tutorial shows how: <a href="http://dotneteers.net/blogs/vbandi/archive/2013/05/03/kinect-interactions-with-wpf-part-iii-demystifying-the-interaction-stream.aspx" rel="nofollow">http://dotneteers.net/blogs/vbandi/archive/2013/05/03/kinect-interactions-with-wpf-part-iii-demystifying-the-interaction-stream.aspx</a></p> <p>But i think the best solution when tracking finger movements would be using <a href="http://www.openni.org/" rel="nofollow">OpenNI</a> SDK.</p> <p>Some of the <a href="http://www.openni.org/software/?cat_slug=file-cat1" rel="nofollow">MiddleWares</a> of OpenNI allow finger tracking.</p>
40,600,187
0
<p>Linq is your friend. You can re-write all that code in 1 line:</p> <pre><code>peeps.OrderBy(x =&gt; x.Age).ThenBy(x =&gt; x.LastName); </code></pre> <p>That's all there is to it :). You can get rid of all that IComparable junk, that's old school.</p> <p>EDIT: for IComparable, you can do:</p> <pre><code> public int CompareTo(object obj) { Person other = (Person)obj; if (age &lt; other.age) return -1; if (String.Compare(vorname, other.vorname) &lt; 0) return -1; return 1; } </code></pre> <p>Seems to work for my quick testing, but test it more :).</p>
26,042,800
0
MvvmCross Not Loading Plugins in iOS 8 <p>I'm working on an enterprise iOS app using MvvmCross 3.2.1 and iOS 8 (with updated profile 259) and it's throwing exception "Failed to resolve parameter for parameter factory of type ISQLiteConnectionFactory when creating MyDataService".</p> <p>The same application works fine using MvvmCross 3.1.1 and iOS 7 and profile24.</p> <p>It's appearing that the PlugIns aren't being loaded in time based on the application output.</p> <p>Here's a snippet of the output from the version that works:</p> <blockquote> <p>2014-09-25 09:30:36.453 MyApp[2665:70b] mvx: Diagnostic: 5.19 Setup: MvvmCross settings start 2014-09-25 09:30:36.453 MyApp[2665:70b] mvx: Diagnostic: 5.19 Setup: Singleton Cache start 2014-09-25 09:30:36.454 MyApp[2665:70b] mvx: Diagnostic: 5.19 Setup: Bootstrap actions 2014-09-25 09:30:36.466 MyApp[2665:70b] mvx: Diagnostic: 5.20 Setup: StringToTypeParser start 2014-09-25 09:30:36.469 MyApp[2665:70b] mvx: Diagnostic: 5.21 Setup: ViewModelFramework start 2014-09-25 09:30:36.470 MyApp[2665:70b] mvx: Diagnostic: 5.21 Setup: PluginManagerFramework start 2014-09-25 09:30:36.475 MyApp[2665:70b] mvx: Diagnostic: 5.21 Ensuring Plugin is loaded for Cirrious.MvvmCross.Plugins.File.PluginLoader 2014-09-25 09:30:36.478 MyApp[2665:70b] mvx: Diagnostic: 5.22 Ensuring Plugin is loaded for Cirrious.MvvmCross.Plugins.Network.PluginLoader 2014-09-25 09:30:36.479 MyApp[2665:70b] mvx: Diagnostic: 5.22 Ensuring Plugin is loaded for Cirrious.MvvmCross.Plugins.Visibility.PluginLoader 2014-09-25 09:30:36.480 MyApp[2665:70b] mvx: Diagnostic: 5.22 Ensuring Plugin is loaded for Cirrious.MvvmCross.Community.Plugins.Sqlite.PluginLoader 2014-09-25 09:30:36.481 MyApp[2665:70b] mvx: Diagnostic: 5.22 Ensuring Plugin is loaded for Cirrious.MvvmCross.Plugins.Messenger.PluginLoader 2014-09-25 09:30:36.482 MyApp[2665:70b] mvx: Diagnostic: 5.22 Ensuring Plugin is loaded for Cirrious.MvvmCross.Plugins.ResourceLoader.PluginLoader 2014-09-25 09:30:36.483 MyApp[2665:70b] mvx: Diagnostic: 5.22 Ensuring Plugin is loaded for Cirrious.MvvmCross.Plugins.WebBrowser.PluginLoader 2014-09-25 09:30:36.484 MyApp[2665:70b] mvx: Diagnostic: 5.22 Setup: App start</p> </blockquote> <p>And here's the output for the iOS version that throws the exception:</p> <blockquote> <p>2014-09-25 09:36:35.078 MyApp[2889:122068] mvx: Diagnostic:<br> 6.69 Setup: MvvmCross settings start 2014-09-25 09:36:35.078 MyApp[2889:122068] mvx: Diagnostic: 6.69 Setup: Singleton Cache start 2014-09-25 09:36:35.079 MyApp[2889:122068] mvx: Diagnostic: 6.69 Setup: Bootstrap actions 2014-09-25 09:36:35.096 MyApp[2889:122068] mvx: Diagnostic: 6.71 Setup: StringToTypeParser start 2014-09-25 09:36:35.098 MyApp[2889:122068] mvx: Diagnostic: 6.71 Setup: CommandHelper start 2014-09-25 09:36:35.098 MyApp[2889:122068] mvx: Diagnostic: 6.71 Setup: ViewModelFramework start 2014-09-25 09:36:35.099 MyApp[2889:122068] mvx: Diagnostic: 6.71 Setup: PluginManagerFramework start 2014-09-25 09:36:35.101 MyApp[2889:122068] mvx: Diagnostic: 6.71 Setup: App start</p> </blockquote> <p>With the missing "Ensure PlugIn loaded" statements, I'm thinking that the PlugIns aren't being loaded (I'm using File, Messenger, Visibility, Community Sqlite, Network, ResourceLoader and WebBrowser).</p> <p>As part of my debugging process, I integrated my application directly with the MvvmCross source code, using project references rather than packages. Not sure if that makes a difference but thought I should mention it.</p> <p>Still relatively new to MvvmCross, and any thoughts on why the PlugIns aren't loaded or what I might be missing in the conversion to iOS 8 would be greatly appreciated</p>
19,468,225
0
<p>Although technically it is possible as Aladdin has answered, I would strongly suggest you not to use PHP/Yii for this. Neither Yii nor PHP is desgined for this sort of work. Yii is really a wonderful framework but it won't really help you with GA programming. PHP is versatile and fast, great for scripting etc. But it is not designed to be used in cases of GA where you will run many generations and runtime performance is a big factor. C++ or similar performing languages you should be considering.</p> <p>You mentioned time as a constraint both run time and development time. I would advice you to use a existing python/C++ library for GA algorithims and quickly implement the same </p> <p>Python Library: <a href="http://pyevolve.sourceforge.net/" rel="nofollow">http://pyevolve.sourceforge.net/</a> Source here: <a href="https://github.com/perone/Pyevolve" rel="nofollow">https://github.com/perone/Pyevolve</a></p> <p>C++ Library: <a href="http://lancet.mit.edu/ga/" rel="nofollow">http://lancet.mit.edu/ga/</a></p> <p>If performance of the algorithm is extremely important then C++ is the obvious choice. If presentation and flexibility then use the Python one, which I prefer personally. </p> <p>However if you wish to still use Yii/PHP, i suggest you compile these programs and call them in a console application / command in Yii and just use Yii to process the parameters store and display the output. </p>
15,796,025
0
Execute a SQL query With Anchor Tag <p>please help to solve this issue,</p> <p>I have a Anchor Tag in my page.</p> <p>i want to perform a SQL UPDATE query when users click the anchor tag, how can i do that without reloading the page?</p> <p>Thanks in advance.</p>
14,688,536
0
Move adjacent tab to split? <p>Is there an easy way to move an adjacent tab in Vim to current window as a split?</p> <p>While looking around I reached a mailing list discussion where someone said it's the reverse of the operation <kbd>Ctrl</kbd>+<kbd>W</kbd>,<kbd>T</kbd> without providing the solution.</p>
1,700,180
0
<p>If I understood correctly, you need something like this:</p> <pre><code>foreach(datarow r in datatable.rows) { if(((int)r["Menu_ID"])==7) { //Don't apply CSS } else { //Apply CSS } } </code></pre> <p>this is assuming your Menu_ID column is numeric. If it is a string, change to:</p> <pre><code>if(((string)r["Menu_ID"])=="7") </code></pre>
29,261,399
0
<p>This is incorrect:</p> <pre><code>CKEDITOR.editorConfig = function(config) { config.extraPlugins = 'timestamp'; config.extraPlugins = 'sharedspace'; }; </code></pre> <p>You first set <code>extraPlugins</code> to <code>'timestamp'</code> and right after that you set it to <code>'sharedspace'</code>. You need to set it once, with both values:</p> <pre><code>CKEDITOR.editorConfig = function(config) { config.extraPlugins = 'timestamp,sharedspace'; }; </code></pre>
37,508,754
0
<p>All the occurances of <code>stocklevel</code> are getting replaced with the value of <code>newlevel</code> as you are calling <code>s.replace (stocklevel ,newlevel)</code>.</p> <blockquote> <p><strong>string.replace(s, old, new[, maxreplace]):</strong> Return a copy of string s with all occurrences of substring old replaced by new. If the optional argument maxreplace is given, the first maxreplace occurrences are replaced.</p> </blockquote> <p><a href="https://docs.python.org/2/library/string.html" rel="nofollow">source</a></p> <p>As you suggested, you need to get the <code>code</code> and use it replace the stock level. </p> <p>This is a sample script which takes the 8 digit code and the new stock level as the command line arguments adn replaces it:</p> <pre><code>import sys import re code = sys.argv[1] newval= int(sys.argv[2]) f=open("stockcontrol.csv") data=f.readlines() print data for i,line in enumerate(data): if re.search('%s,\d+'%code,line): # search for the line with 8-digit code data[i] = '%s,%d\n'%(code,newval) # replace the stock value with new value in the same line f.close() f=open("in.csv","w") f.write("".join(data)) print data f.close() </code></pre> <p>Another solution using the <a href="https://docs.python.org/2/library/csv.html" rel="nofollow">csv</a> module of Python:</p> <pre><code>import sys import csv data=[] code = sys.argv[1] newval= int(sys.argv[2]) f=open("stockcontrol.csv") reader=csv.DictReader(f,fieldnames=['code','level']) for line in reader: if line['code'] == code: line['level']= newval data.append('%s,%s'%(line['code'],line['level'])) f.close() f=open("stockcontrol.csv","w") f.write("\n".join(data)) f.close() </code></pre> <p><strong>Warning:</strong> Keep a back up of the input file while trying out these scripts as they overwrite the input file.</p> <p>If you save the script in a file called <code>test.py</code> then invoke it as:</p> <p><code>python test.py 34512340 10</code>.</p> <p>This should replace the stockvalue of code 34512340 to 10.</p>
24,181,422
0
<p>You can simply do this:</p> <pre><code>SELECT order_date, SUM(CASE WHEN male_or_female_bike IS NULL THEN 1 WHEN male_or_female_bike='M' THEN 1 ELSE 0 END) as MaleCount, SUM(CASE WHEN male_or_female_bike ='F' THEN 1 ELSE 0 END) as FemaleCount FROM Bike_orders GROUP BY order_date ORDER BY order_date DESC </code></pre> <p>Result:</p> <pre><code>ORDER_DATE MALECOUNT FEMALECOUNT April, 08 2014 00:00:00+0000 2 2 February, 12 2014 00:00:00+0000 1 0 </code></pre> <p><kbd><a href="http://www.sqlfiddle.com/#!2/49321/3" rel="nofollow"><strong>Fiddle Demo</strong></a></kbd></p>
4,227,607
0
<p>I haven't seen anything like this before but was thinking of trying to create something like this</p>
4,415,199
0
<p>This is the classic <strong>assignment in conditional</strong> error - the expression is evaluated as following (because comparison has higher <a href="http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm">precedence</a> then assignment):</p> <pre><code>if ( killedpid = ( wait( &amp;status ) &gt;= 0 )) { ... </code></pre> <p>The <code>killedpid</code> will get a value of TRUE, which is <code>1</code> in C. To get around this use parenthesis and <strong>compile with high warning levels</strong> like <code>-Wall -pedantic</code>:</p> <pre><code>if (( killedpid = wait( ... )) &gt;= 0 ) { ... </code></pre>
9,672,587
0
<p><code>read</code> is a <a href="http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html" rel="nofollow">reserved word,</a> and so needs to be specially quoted with backticks for it to work in query</p> <p>so try</p> <pre><code>if (!mysql_query("UPDATE $tblname SET `read`='$read' WHERE id='$id'")) { die("update failed with error ".mysql_error()); } </code></pre> <p>Also, the $id value isn't being sanitized in any way, so the code is vulnerable to an SQL injection attack. Definitely worth your time learning about such things.</p>
10,536,462
0
Creating tabs with different heights in Android <p>How I can create the following layout?</p> <p><img src="https://i.stack.imgur.com/qJqcd.png" alt="enter image description here"></p>
10,943,384
0
<p>The URL scheme for programmatically launching Settings.app to a particular settings panel was briefly exposed (though I'm not sure if it was documented) in iOS 5. However, the capability has been suppressed for third-party apps in iOS 5.1. As it stands, there is currently no way to do this from a third-party app on the latest version of the OS - at least, not in a way that won't get your app rejected from the App Store. There's likely a jailbreak way to do this, but I don't dabble in that, so I wouldn't know.</p>
10,604,690
0
Noise/distortion after doing filters with vDSP_deq22 (biquad IIR filter) <p>I'm working on a DSP class (obj-c++) for <a href="http://alexbw.github.com/novocaine/" rel="nofollow">Novocaine</a>, but my filters only seem to cause noise/distortion on the signal.</p> <p>I've posted my full code and coefficients here: <a href="https://gist.github.com/2702844" rel="nofollow">https://gist.github.com/2702844</a> But it basically boils down to:</p> <pre><code>// Deinterleaving... // DSP'ing one channel: NVDSP *handleDSP = [[NVDSP alloc] init]; [handleDSP setSamplingRate:audioManager.samplingRate]; float cornerFrequency = 6000.0f; float Q = 0.5f; [handleDSP setHPF:cornerFrequency Q:Q]; [handleDSP applyFilter:audioData length:numFrames]; // DSP other channel in the same way // Interleaving and sending to audio output (Novocaine block) </code></pre> <p>See the gist for full code/context.</p> <p>The coefficients:</p> <pre><code>2012-05-15 17:54:18.858 nvdsp[700:16703] b0: 0.472029 2012-05-15 17:54:18.859 nvdsp[700:16703] b1: -0.944059 2012-05-15 17:54:18.860 nvdsp[700:16703] b2: 0.472029 2012-05-15 17:54:18.861 nvdsp[700:16703] a1: -0.748175 2012-05-15 17:54:18.861 nvdsp[700:16703] a2: 0.139942 </code></pre> <p>(all divided by <code>a0</code>)</p> <p>Since I presumed the coefficients are in the order of: <code>{ b0/a0, b1/a0, b2/a0, a1/a0, a2/a0 }</code> (see: <a href="http://stackoverflow.com/questions/10375359/iir-coefficients-for-peaking-eq-how-to-pass-them-to-vdsp-deq22">IIR coefficients for peaking EQ, how to pass them to vDSP_deq22?</a>)</p> <p>What is causing the distortion/noise (the filters don't work)?</p>
20,196,226
0
<p>The following regex will strip the first and last slashes if they exist,</p> <pre><code>var result = "/installers/services/".match(/[^/].*[^/]/g)[0]; </code></pre>
15,435,248
0
<p>You want the <a href="http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes" rel="nofollow">visibility attribute</a> extension of GCC.</p> <p>Practically, something like:</p> <pre><code> #define MODULE_VISIBILITY __attribute__ ((visibility ("hidden"))) #define PUBLIC_VISIBILITY __attribute__ ((visibility ("default"))) </code></pre> <p><sup>(You probably want to <code>#ifdef</code> the above macros, using some configuration tricks à la <code>autoconf</code>and other <em>autotools</em>; on other systems you would just have empty definitions like <code>#define PUBLIC_VISIBILITY /*empty*/</code> etc...)</sup></p> <p>Then, declare a variable:</p> <pre><code>int module_var MODULE_VISIBILITY; </code></pre> <p>or a function </p> <pre><code>void module_function (int) MODULE_VISIBILITY; </code></pre> <p>Then you can use <code>module_var</code> or call <code>module_function</code> inside your shared library, but not outside.</p> <p>See also the <a href="http://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html" rel="nofollow">-fvisibility</a> code generation option of GCC.</p> <p>BTW, you could also compile your whole library with <code>-Dsomeglobal=alongname3419a6</code> and use <code>someglobal</code> as usual; to really find it your user would need to pass the same preprocessor definition to the compiler, and you can make the name <code>alongname3419a6</code> random and improbable enough to make the collision improbable.</p> <hr> <p>PS. This visibility is <strong>specific to GCC</strong> (and probably <strong>to ELF shared libraries</strong> such as those on Linux). It won't work without GCC or outside of shared libraries.... so is quite Linux specific (even if some few other systems, perhaps Solaris with GCC, have it). Probably some other compilers (<code>clang</code> from <a href="http://llvm.org/" rel="nofollow">LLVM</a>) might support also that <em>on Linux</em> for <em>shared libraries</em> (not static ones). Actually, the real hiding (to the several compilation units of a single shared library) is done mostly by the linker (because the <a href="http://en.wikipedia.org/wiki/Executable_&amp;_Linkable_Format" rel="nofollow">ELF</a> shared libraries permit that).</p>
16,811,289
0
<p>Read <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html">here</a></p> <blockquote> <p>Tiered Compilation</p> <p>Tiered compilation, introduced in Java SE 7, brings client startup speeds to the server VM. Normally, a server VM uses the interpreter to collect profiling information about methods that is fed into the compiler. In the tiered scheme, in addition to the interpreter, the client compiler is used to generate compiled versions of methods that collect profiling information about themselves. Since the compiled code is substantially faster than the interpreter, the program executes with greater performance during the profiling phase. In many cases, a startup that is even faster than with the client VM can be achieved because the final code produced by the server compiler may be already available during the early stages of application initialization. The tiered scheme can also achieve better peak performance than a regular server VM because the faster profiling phase allows a longer period of profiling, which may yield better optimization.</p> </blockquote>
2,273,122
0
How do I validate that two values do not equal each other in a Rails model? <p>I have a User model, which has an email and a password field. For security, these may not be equal to each other. How can I define this in my model?</p>
16,311,007
0
knockout.js using the mapping plugin <p>I am a newbie with knockout.js and want to start using the automatic mapping plugin. How can I convert this manually mapped code to use the mapping plugin?</p> <p><a href="http://jsfiddle.net/infatti/jWTtb/6/" rel="nofollow">http://jsfiddle.net/infatti/jWTtb/6/</a></p> <pre><code>// Here's my data model var ViewModel = function (firstName, lastName) { var self = this; self.firstName = ko.observable(firstName); self.lastName = ko.observable(lastName); self.loadJson = function () { $.getJSON("http://echo.jsontest.com/firstName/Stuart/lastName/Little", function (data) { self.firstName(data.firstName); self.lastName(data.lastName); }); return true; }; }; var vm = new ViewModel(); ko.applyBindings(vm); // This makes Knockout get to work </code></pre>
23,217,931
0
<p>There is no need to create a folder specifically for your configuration file, you can specify its path with the <code>-c /path/to/your/file</code> or <code>--configuration=/path/to/your/file</code> option.</p> <p>Source: <a href="http://supervisord.org/running.html" rel="nofollow">http://supervisord.org/running.html</a></p>
6,658,394
0
C++, Can't find loaded C# DLL while enumerating loaded modules <p>thank you for taking the time to read this.</p> <p>The situation is basically, I'm using EnumProcessModulesEx to enumerate all the modules in a loaded process. I've verified that the process I'm getting with GetCurrentProcess is correct (via the ID). I seem to be getting all the loaded modules except the one I want! It's a C# DLL that is only loaded when the C# DLL function is called. I made sure the DLL was loaded before I ran the enumerating function. Is there a reason this C# DLL won't show up?</p> <p>I also put this enumeration after I load a couple of other C# DLLs in my C++ code. It doesn't seem to be finding those either. All of these C# DLLs are dynamically loaded. I figure it shouldn't matter because a) everything is mapped into the process address space anyways, and b) I have a C++ DLL that is injected (dynamically loaded?) and I can find that just fine. My goal is to be able to hook a C# DLL function, so being able to find these C# DLLs is a must in this project. </p> <p>Thank you all again for any tips or insights! =)</p>
36,641,217
0
<p>This way <code>Users.visible_to</code> will return premium and admin users. </p> <pre><code>scope :visible_to, -&gt; (user) do where(users.premium? = ? OR users.admin? = ?, true, true) end </code></pre>
7,061,267
0
Send Event Email Reminder asp.net mvc <p>im not using an event scheduler just asp.net mvc and need to send a reminder 4 days before event. I have the Date Stored of Event(Event_Start), can u please help?</p> <p>I have created a class in the controller public void Reminder() , but now im stuck</p>
28,982,891
1
pandas print all non empty rows <p>I have this data</p> <pre><code>time-stamp ccount A B C D E F G H I 2015-03-03T23:43:33+0000 0 0 0 0 0 0 0 0 0 0 2015-03-04T06:33:28+0000 0 0 0 0 0 0 0 0 0 0 2015-03-04T06:18:38+0000 0 0 0 0 0 0 0 0 0 0 2015-03-04T05:36:43+0000 0 0 0 1 0 0 0 0 0 0 2015-03-04T05:29:09+0000 0 0 0 1 0 0 0 0 1 0 2015-03-04T07:01:11+0000 0 0 1 0 1 0 0 0 0 0 2015-03-03T15:27:06+0000 19 0 1 0 1 0 0 0 0 0 2015-03-03T15:43:38+0000 10 0 1 0 1 1 0 0 0 0 2015-03-03T18:16:26+0000 0 0 0 1 0 0 0 0 0 0 2015-03-03T18:19:48+0000 0 0 0 0 0 0 0 0 0 0 2015-03-03T18:20:02+0000 4 0 0 0 0 1 0 0 0 0 2015-03-03T20:21:55+0000 2 0 0 0 0 0 1 0 0 0 2015-03-03T20:37:36+0000 0 0 0 0 0 0 0 0 0 0 2015-03-04T03:03:51+0000 1 0 0 0 0 0 1 0 0 0 2015-03-03T16:33:04+0000 9 0 0 0 0 0 0 0 0 0 2015-03-03T16:18:13+0000 1 0 0 0 0 0 0 0 0 0 2015-03-03T16:34:18+0000 4 0 0 0 0 0 0 0 0 0 2015-03-03T18:11:36+0000 5 0 0 0 0 0 0 0 0 0 2015-03-03T18:24:35+0000 0 0 0 0 0 0 0 0 0 0 </code></pre> <p>I want to slice all rows which have atleast single one ("1") in their columns A-to-I. i.e. for above data , output will be</p> <pre><code>time-stamp ccount A B C D E F G H I 2015-03-04T05:36:43+0000 0 0 0 1 0 0 0 0 0 0 2015-03-04T05:29:09+0000 0 0 0 1 0 0 0 0 1 0 2015-03-04T07:01:11+0000 0 0 1 0 1 0 0 0 0 0 2015-03-03T15:27:06+0000 19 0 1 0 1 0 0 0 0 0 2015-03-03T15:43:38+0000 10 0 1 0 1 1 0 0 0 0 2015-03-03T18:16:26+0000 0 0 0 1 0 0 0 0 0 0 2015-03-03T18:20:02+0000 4 0 0 0 0 1 0 0 0 0 2015-03-03T20:21:55+0000 2 0 0 0 0 0 1 0 0 0 2015-03-04T03:03:51+0000 1 0 0 0 0 0 1 0 0 0 </code></pre> <p>i.e. we have ignored all the rows which dont have a "1" in any of the columns from [A:I]</p>
25,523,083
0
<p>I've run into the exact same issue (with a different password of course).</p> <p>To keep the connection string to the database working on the developer machines i've modified the publish settings to use a 'different' connections string. </p> <p>For your example: web.config would contain:</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="MyDB" connectionString="server=Server1;uid=user1;pwd=abc123%72;database=Database1;" &lt;/connectionStrings&gt; </code></pre> <p>Under the publish settings right-click project, select publish..., go to settings->databases. For the database MyDB, enter</p> <pre><code> server=Server1;uid=user1;pwd=abc123%72;database=Database1; </code></pre> <p>This allowed my developer machine to retain it's connection to the database and the host machine to automatically use the correct connection string both by publishing directly or through teamcity.</p>
35,777,332
0
FullCalendar fetching events from server not working <p>I am trying to fetch events from my LocalDB server and have them display on my calendar, but they aren't appearing.</p> <p>I am using the following method to fetch the events.</p> <pre><code>public JsonResult GetEvents(double start, double end) { var fromDate = ConvertFromUnixTimestamp(start); var toDate = ConvertFromUnixTimestamp(end); var eventList = from e in db.Events select new { ID = e.ID, Title = e.Title, StartDate = e.StartDate.ToString("s"), EndDate = e.EndDate.ToString("s"), EventType = e.EventType, Hours = e.Hours, AllDay = true }; var rows = eventList.ToArray(); return Json(rows, JsonRequestBehavior.AllowGet); } private static DateTime ConvertFromUnixTimestamp(double timestamp) { var origin = new DateTime(1970, 1, 1, 0, 0, 0, 0); return origin.AddSeconds(timestamp); } </code></pre> <p>My calendar is rendered as follows:</p> <pre><code>@Styles.Render("~/Content/fullcalendar") @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/fullcalendar") &lt;br /&gt; &lt;div id="calendar"&gt;&lt;/div&gt; &lt;br /&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { $('#calendar').fullCalendar({ header: { left: 'title', center: '', right: 'prev,next today' }, defaultView: 'month', weekends: false, editable: false, events: "/Home/GetEvents/" }); }); &lt;/script&gt; </code></pre> <p>Any help is greatly appreciated.</p> <p><strong>EDIT:</strong></p> <p>This is in my web console:</p> <pre><code>no element found abort:1:1 Use of getPreventDefault() is deprecated. Use defaultPrevented instead. browserLink:37:40278 no element found send:1:1 no element found send:1:1 no element found send:1:1 no element found GET http://localhost:54802/Home/GetEvents/ [HTTP/1.1 500 Internal Server Error 10ms] </code></pre>
14,760,056
0
<p>I think you are going the wrong way. Backpropagation isn't a good choice for this type of learning (somehow incremental learning). To use backpropagation you need some data, say 1000 data where <strong>different types of similaritiy (input)</strong> and the <strong>True Similarity (output)</strong> are given. Then weights will update and update until error rate comes down. And besides you need test data set too that will make you sure the result network will do good even for similarity values it didn't see during training.</p>
25,943,857
0
<p>To draw multi line text with Snap.svg is a bit bother.<br> When you call Paper.text method with string array, Snap.svg creates tspan elements under the text element.<br> If you want to display the text element as multi line, you should set position to each tspan element manually.<br></p> <pre><code>var paper = Snap(200,200); paper.text({text:["Line1", "Line2", "Line3"]}) .attr({fill:"black", fontSize:"18px"}) .selectAll("tspan").forEach(function(tspan, i){ tspan.attr({x:0, y:25*(i+1)}); }); </code></pre>
13,246,014
0
<p>Please refer the default icon names..</p> <blockquote> <pre><code>Iphone(non retina) :icon.png </code></pre> <p>Iphone(retina) :[email protected]</p> <p>Ipad(Non retina) :Icon-72.png</p> <p>IPad(Retina) :[email protected]</p> </blockquote>
19,106,932
0
<p>Frame will be different at run time: this means that the location of a frame on the storyboard is different than where your constraints dictate it should be.</p> <p>Ambiguous: this means that you're missing some constraints.</p> <p>To resolve these issues, if you open up your storyboard, you'll see yellow or red arrows beside certain scenes on the list to the left. Clicking the arrow will reveal a view with all the issues with that scene. To fix the "frame will be different at run time" error, change the x, y, width, and height of the frame rectangle of the view with the wrong frame. To fix the ambiguous warning, add extra constraints.</p>
9,865,292
0
trouble debugging and running sample android project <p>I installed the Android 2.2 SDK (2.2 is the version i have on my smartphone). I've tried running the NotePad sample project as an Android project. Here is what happens: the emulator loads, but when I click on the app, the screen goes blank. There are no errors being thrown. Has anyone else run into this problem? If so, how have you fixed it?</p>
16,696,122
0
<p>Whenever you open a stream (or a writer / reader, which wrap a stream), that locks the file.</p> <p>You need to close your streams using the <code>using</code> statement.</p>
10,992,734
0
<p>try <code>right: 100%</code> instead of <code>left: 0</code>, which basically tells your menu that it should position its left edge to the leftmost edge of its parent. <code>right: 100%</code> should tell it to align its rightmost edge with your parent menus leftmost edge. Hope this helps!</p>
10,615,789
0
<p>You may checkout the <a href="http://msdn.microsoft.com/en-us/library/system.environment.username.aspx" rel="nofollow">UserName</a> property:</p> <pre><code>string username = Environment.UserName; </code></pre>
17,391,616
0
Serving static files with Nginx + Gunicorn + Django <p>This is my nginx config:</p> <pre><code> server { listen 80; server_name localhost; keepalive_timeout 5; access_log /home/tunde/django-projects/mumu/nginx/access.log; error_log /home/tunde/django-projects/mumu/nginx/error.log; root /home/tunde/django-projects/mumu; location / { try_files $uri @proxy_to_app; } location @proxy_to_app { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://127.0.0.1:8000; } } </code></pre> <p>My settings.py looks like:</p> <pre><code> import os settings_dir = os.path.dirname(__file__) PROJECT_ROOT = os.path.abspath(os.path.dirname(settings_dir)) STATIC_ROOT = '/home/tunde/django-projects/mumu/STATIC/' STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(PROJECT_ROOT, 'static/'), ) </code></pre> <p>My supervisord.conf file looks like:</p> <pre><code>[program: mumu] command = /home/tunde/ENV1/bin/gunicorn -w 1 --bind=127.0.0.1:8000 mumu.wsgi:application directory = /home/tunde/django-projects/mumu/ stdout_logfile= /home/tunde/django-projects/mumu/supervisor/logfile.log stderr_logfile= /home/tunde/django-projects/mumu/supervisor/error.log user = tunde </code></pre> <p>The problem is that static files don't get served and I have no idea what I'm doing wrong. A url like /static/css/styles.css returns a 404. Help will be greatly appreciated.</p>
15,722,041
0
<p>There is currently not a managed DLL available from Microsoft that wraps the Management API; however, there are a few other options. First, there are command line tools such as the PowerShell CmdLets and the CLI tools found at <a href="http://www.windowsazure.com/en-us/downloads/" rel="nofollow">http://www.windowsazure.com/en-us/downloads/</a>. If you only need to script these calls to delete the deployment these will work for you just fine. In my opinion I would suggest NOT looking at csmanage as that is an old sample and not maintained. The command line tools are the replacement.</p> <p>Second, you can do so using code to call the REST based management API much like Neil indicated in the first link you included in your question. The documentation for the API can be found at <a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee460812.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windowsazure/ee460812.aspx</a>. Note that there is a Delete Deployment specifically at <a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee460815.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windowsazure/ee460815.aspx</a>. Just like Neil's examples you'll use calls direct to the REST API. </p>
1,057,979
0
where is lstrncpy's head file? <p>I know lstrcpy is used for string copy for both unicode and ascii, But I can not use lstrncpy, because I can't find the head file. What is the name of the head file, I googled it, and find someone is using it. Many thanks!</p>
16,714,062
0
Replace a method with parameters by a closure in metaclass <p>I have two class:</p> <pre><code>class Foo { String doSomething(String a, String b) { return 'Not Working' } } class Bar { String methodIWannaTest() { return new Foo().doSomething('val1', 'val2') } } </code></pre> <p>And I want to replace 'doSomething' in a test but it dosent work</p> <pre><code>class BarTests { @Test void testMethodIWannaTest() { Foo.metaClass.doSomething {String a, String b -&gt; return 'Working'} assert new Bar().methodIWannaTest() == 'Working' //THIS TEST FAIL, return 'Not Working' } } </code></pre> <p>*I know the test doesn't really make sens, it's just to show my point</p> <p>What do I do wrong ? Is it possible to do it without using 'mockFor' ?</p>
26,607,495
0
<p>This is a bug in Unity. You may want to submit a bug report and wait for a patch release to fix it (though you used a preview image, it is also likely to happen on retail Android 5.0).</p> <p>Edit: I tried on a Nexus Player, and the fonts were rendering just fine. Looks like Google forgot to add some fonts to the preview image. If you are experiencing this issue with a retail version of Android 5.0, please submit a bug for Unity.</p>
14,526,832
0
<p>I'm feeling rather clever about this answer, but I strongly suspect that I've made too many assumptions about your data, in particular the constant nature of var2 and var3:</p> <pre><code>ddply(dat,.(permno,dte,var2,var3), function(x) { dcast(x,permno + dte + var2 + var3 ~ ttm,value.var = 'var1') }) permno dte var2 var3 20 30 1 123 2012-01-01 10 100 1 -1 2 124 2012-01-01 20 200 2 -2 </code></pre>
4,165,054
0
missing ; before statement : $(this).closest('tr').find('.tableRow'){\n <pre><code>$('.removeItem').live('click',function(){ var postData = {}; $(this).closest('tr').find('.tableRow'){ var keyPrefix = 'data[' + index + ']'; postData[keyPrefix + '[index]'] = $(this).closest('tr').find('.row_id').text(); postData['data['+ index +'][order_id]'] = $('#order_id').text(); }; </code></pre> <p>I'm not sure if its obvious what i'm trying to do but can anyone spot where i'm going wrong?</p> <p>EDIT:</p> <p>Completely my fault, was slightly misleading in my original post, this is my complete code:</p> <pre><code>$('.removeItem').live('click',function(){ var postData = {}; $(this).closest('tr').find('.tableRow'){ var keyPrefix = 'data[' + index + ']'; postData[keyPrefix + '[index]'] = $(this).closest('tr').find('.row_id').text(); postData['data['+ index +'][order_id]'] = $('#order_id').text(); )}; $.ajax ({ type: "POST", url: "deleterow.php", dataType: "json", data: postData, cache: false, success: function() { alert("Item Deleted"); } }); $(this).closest('tr').remove(); calcTotal(); }); </code></pre>
9,751,278
0
<p>no idea if this helps, but I just found this in some code:</p> <pre><code> void XFakeKeypress(Display *display, int keysym) { XKeyEvent event; Window current_focus_window; int current_focus_revert; XGetInputFocus(/* display = */ display, /* focus_return = */ &current_focus_window, /* revert_to_return = */ &current_focus_revert); event.type = /* (const) */ KeyPress; event.display = display; event.window = current_focus_window; event.root = DefaultRootWindow(/* display = */ display); event.subwindow = /* (const) */ None; event.time = 1000 * time(/* tloc = */ NULL); event.x = 0; event.y = 0; event.x_root = 0; event.y_root = 0; event.state = /* (const) */ ShiftMask; event.keycode = XKeysymToKeycode(/* display = */ display, /* keysym = */ keysym); event.same_screen = /* (const) */ True; XSendEvent(/* display = */ display, /* w = (const) */ InputFocus, /* propagate = (const) */ True, /* event_mask = (const) */ KeyPressMask, /* event_send = */ (XEvent *)(&event)); event.type = /* (const) */ KeyRelease; event.time = 1000 * time(/* tloc = */ NULL); XSendEvent(/* display = */ display, /* w = (const) */ InputFocus, /* propagate = (const) */ True, /* event_mask = (const) */ KeyReleaseMask, /* event_send = */ (XEvent *)(&event)); } </code></pre>
11,384,315
0
django radio buttons in forms <p>I have a form in Django with radio buttons that have various properties for users. When an admin user (in my application...not the django admin) wants to edit properties for different users, the same form objects should appear for all users in a list. So say there is a list of possible permissions for users, I have a table with the list of users, and the user permissions options (radio buttons) should appear next to them. In the form I have a radio button choice field with all available permissions. But in the view, how do I get it to appear for each user? Also, how do I set initial data when there're are many of the same form object? Is there an example of this somewhere? Thanks!</p> <p><strong>[EDIT]</strong></p> <p>Below is basically what I am trying to show:</p> <pre><code> &lt;table class="admin_table"&gt; &lt;tr&gt; &lt;th&gt;Firstname&lt;/th&gt; &lt;th&gt;Lastname&lt;/th&gt; &lt;th&gt;User Permission&lt;/th&gt; &lt;/tr&gt; {% if users|length &gt; 0 %} {% for user in users %} &lt;tr&gt; &lt;td&gt;{{ user.first_name }}&lt;/td&gt; &lt;td&gt;{{ user.last_name }}&lt;/td&gt; &lt;td&gt;[RADIO BUTTONS]&lt;/td&gt; &lt;/tr&gt; {% endfor %} {% endif %} &lt;/table&gt; </code></pre> <p>The place where I wrote <code>[RADIO BUTTONS]</code>, is where I woud like to show multiple radio buttons which should appear for each <em>user</em>, not for the whole form.</p> <p>Also, I'm looking at this site: <a href="http://jacobian.org/writing/dynamic-form-generation/" rel="nofollow">http://jacobian.org/writing/dynamic-form-generation/</a>. Not sure if that's the solution, but the problem the author is trying to solve is very interesting anyway.</p>
19,387,031
0
<p>You can create a List(Of String) e.g.</p> <pre><code>Dim arr As New List(Of String) </code></pre> <p>And inside of your loop collect your strings:</p> <pre><code>arr.Add(CurrentString) </code></pre> <p>After the loop <code>arr</code> would have all the strings. Then you can run a simple LINQ query:</p> <pre><code>Dim Summary = From a In arr Group By Name = a Into Group _ Select Name, Cnt = Group.Count() </code></pre> <p>This Summary will give you the counts. You can use it for example </p> <pre><code>For Each elem In Summary 'Output elem.Name 'Output elem.Cnt Next </code></pre> <p>For your example this will produce</p> <pre><code>Name = "Jane", Cnt = 3 Name = "Matt", Cnt = 4 Name = "Paul", Cnt = 1 </code></pre>
24,299,268
0
Adding a WCF Service reference in Visual Studio 2013 <p>Following an example about WCF, it seems that in VS 2010 you could right click the references, hit "Add Service Reference", and then hit the "Discover" to get find services in the solution. </p> <p>This does not work in VS 2013. I have my Service dll, I have a service host, but it will not find any services.<br> Clean, rebuild, try again -> same outcome.</p> <p>I'm running VS as an administrator (Win 8 + VS 2013 -> can't run WCF if not admin).</p> <p>The option of running the service through VS and then adding a reference does not exist (won't allow to add service reference when running), so the only solutions I've found are: </p> <ul> <li>Use svcutil manually (works though)</li> <li>run the service.exe manually (as admin), and then point to it's end point.</li> </ul> <p>Any ideas what's up? </p>
12,714,690
0
<p>I sadly do not have the SEO answer to your question, but a solution would be to use a negative margin to hide the element off screen. Then when javascript kick in you set the correct position and hide, then you fade in or do what ever you want to do.</p>
30,762,999
0
<p>Using what you posted, it works fine for me, it produces the red "!" above the textbox. However, I DID remember to set my DataContext, ie.</p> <pre><code>public MainWindow() { InitializeComponent(); this.DataContext = this; } </code></pre> <p>Without this, it won't work.</p>
9,029,791
0
2 drop down menus w/o submit button <p>I would like to know how to submit two drop down menus w/o a submit button. I want to populate the second drop down menu on selection of the first and then be able to echo out the selection of the second drop down menu. Data for the second drop down menu is obtained from a mySQL database. I am using two forms on my page, one for each drop down menu.</p> <pre><code> &lt;form method="post" id="typeForm" name="typeForm" action=""&gt; &lt;select name="filterType" onchange="document.getElementById('typeForm').submit()"&gt; &lt;option &lt;?php if ($_POST['filterType'] == 'none') print 'selected '; ?&gt; value="none"&gt;Filter by...&lt;/option&gt; &lt;option &lt;?php if ($_POST['filterType'] == 'employee') print 'selected '; ?&gt; value="employee"&gt;Employee&lt;/option&gt; &lt;option &lt;?php if ($_POST['filterType'] == 'taskName') print 'selected '; ?&gt; value="taskName"&gt;Task&lt;/option&gt; &lt;/select&gt; &lt;noscript&gt;&lt;input type="submit" value="Submit"/&gt;&lt;/noscript&gt; &lt;/form&gt; &lt;form method="post" id="categoryForm" name="typeForm" action=""&gt; &lt;select name="filterCategory" onchange="document.getElementById('categoryForm').submit()"&gt; &lt;option &lt;?php if ($_POST['filterCategory'] == 'none') print 'selected '; ?&gt; value="none"&gt;&lt;/option&gt; &lt;? $count2 = 0; echo $rowsAffected2; while ($count2&lt;$rowsAffected2) { echo "&lt;option value='$filterName[$count2]'&gt;$filterName[$count2]&lt;/option&gt;"; $count2 = $count2 + 1; } ?&gt; &lt;/select&gt; &lt;noscript&gt;&lt;input type="submit" value="Submit"/&gt;&lt;/noscript&gt; &lt;/form&gt; </code></pre> <p>I can submit the first form with no problem. It retrieves values into the second drop down menu successfully.But on selecting a value from the second menu the page refreshes and I'm left with an two unselected drop down menus. I tried echoing the $_POST['filterCategory'] and didn't get a result. I tried using onchange="this.form.submit();" in both forms and I still get the same result. Is there a way to do this without using AJAX, JQuery or any complex Javascript script? I require to this completely in PHP. </p> <p>I want to avoid the second refresh but still be able to gather the $_POST[''] data from the second selection.</p>
19,889,679
0
<p>Try this :</p> <pre><code>JTextArea txt = new JTextArea(); JScrollPane jsp = new JScrollPane(history, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); txt.setCaretPosition(txt.getDocument().getLength()); // do this afeter any event </code></pre> <p>Hope that helps you</p>
32,547,573
0
<p>The way I've solved it was to render the context into a buffer and then write it to file as JPG. I'll have to further see how to optimise this flow on older gen iOS devices, but it seems to work well in comparison to createCGImage. This code is also useful for turning a CIImage into JPEG or bitmap NSData. Full sample code can be seen here: </p> <p><a href="https://github.com/mmackh/IPDFCameraViewController" rel="nofollow">https://github.com/mmackh/IPDFCameraViewController</a></p> <pre><code>static CIContext *ctx = nil; if (!ctx) { ctx = [CIContext contextWithOptions:@{kCIContextWorkingColorSpace:[NSNull null]}]; } CGSize bounds = enhancedImage.extent.size; int bytesPerPixel = 8; uint rowBytes = bytesPerPixel * bounds.width; uint totalBytes = rowBytes * bounds.height; uint8_t *byteBuffer = malloc(totalBytes); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); [ctx render:enhancedImage toBitmap:byteBuffer rowBytes:rowBytes bounds:enhancedImage.extent format:kCIFormatRGBA8 colorSpace:colorSpace]; CGContextRef bitmapContext = CGBitmapContextCreate(byteBuffer,bounds.width,bounds.height,bytesPerPixel,rowBytes,colorSpace,kCGImageAlphaNoneSkipLast); CGImageRef imgRef = CGBitmapContextCreateImage(bitmapContext); CGColorSpaceRelease(colorSpace); CGContextRelease(bitmapContext); free(byteBuffer); if (imgRef == NULL) { goto release; } CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:filePath]; CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypeJPEG, 1, NULL); CGImageDestinationAddImage(destination, imgRef, nil); CGImageDestinationFinalize(destination); CFRelease(destination); success = YES; goto release; release : { CFRelease(imgRef); if (success) { //completionHandler(filePath); } dispatch_resume(_captureQueue); } </code></pre>
13,744,223
0
<p>Option 1 using pointers is a bad idea. Use either <code>boost::scoped_ptr</code> or, if you can, <a href="http://herbsutter.com/elements-of-modern-c-style/" rel="nofollow"><code>std::unique_ptr</code></a>.</p> <p>Option 2, as you implement it, should not be used. See <a href="http://www.gotw.ca/gotw/028.htm" rel="nofollow">GotW #28: The Fast Pimpl Idiom</a>. In C++11 however, this can be done correctly using <code>std::aligned_storage&lt;&gt;</code>. I once wrote a <code>pimpl_ptr&lt;T, Size, Align=default&gt;</code> that does the casting, copying, destructor call for you and checks that you have chosen the right <code>Size</code>.</p> <p>In general, use pimpl unless you have profiled and shown that this is the bottleneck.</p> <p>But as always, don't reinvent the wheel. Mutex and Threads are part of the new C++11 standard, so either upgrade the compiler or use Boost instead. For files use Boost. The reasoning is, that many parts of the new C++11 library are taken from Boost.</p>
30,183,330
0
<p><strong>Both != and &lt;> has same Properties IN SQL:</strong></p> <p><strong>!= :</strong><br> Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. </p> <pre><code>(a != b) is true. </code></pre> <p><strong>&lt;>:</strong> </p> <p>Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. </p> <pre><code>(a &lt;&gt; b) is true. </code></pre>
9,021,528
0
<p>I think you might be trying to do the first case outlined here:</p> <p><a href="http://dev.mysql.com/doc/refman/5.5/en/create-table-select.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/create-table-select.html</a></p> <p>..which for your example would look like:</p> <pre><code>CREATE TEMPORARY TABLE tmp (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) SELECT valueName AS valueName FROM sometable WHERE sometable.somevalue='00'; </code></pre> <p>..so it might just be the parens in the wrong places that bit you in your first try.</p>
38,776,323
0
<p>@TeckSupport how about if you set up a function that pulls and writes the IP.dst:</p> <pre><code>from scapy.all import * fob = open("IP.txt","w") def ip_dst(pkt): fob.write(pkt[IP].dst+'\n') sniff(filter='ip',count=10,prn=ip_dst) fob.close() </code></pre> <p>Is this what you were looking to do?</p>
15,326,328
0
IIS throwig error when im refrencing a javascript file? <p>im messing around with a master page, and i want to use jquery and another javascript file to a simple tamplate im creating.</p> <p>i have a wierd problem that i dont understand, when i run the apsx on the browser, i dont see the changes i made in the javascript file. when i looking at the code [view source on chrome] and try to see the code on the javascript file and the jquery 1, i get an error</p> <blockquote> <p>The request filtering module is configured to deny a request that contains a double escape sequence.</p> </blockquote> <p>this is how i refrence the fiels in the head element:</p> <pre><code>&lt;head runat="server"&gt; &lt;script type="text/javascript" src="../Jquery1.6+vsdoc/jquery-1.7.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="Main.js"&gt;&lt;/script&gt; </code></pre> <blockquote> <p></p> </blockquote> <p>what can be the problem?</p> <p>im using visual studio 2012 if that helps. (sorry for my english)</p>
29,298,617
0
<p>Thanks Pradeep. The following code fixed my problem</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack ) { txt_rname.Enabled = false; txt_rmobile.Enabled = false; txt_remail.Enabled = false; con.Open(); // string qry = "select * from Reporter where Reporter_ID= " + DropDownList1.SelectedValue + ""; lbl_1.Text = Session["id"].ToString(); string qry = "select * from Reporter where Reporter_ID= " + Session["id"] + " "; SqlCommand cmd = new SqlCommand(qry, con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); // table data-&gt; data table con.Close(); txt_rname.Text = dt.Rows[0][1].ToString(); txt_remail.Text = dt.Rows[0][2].ToString(); txt_rmobile.Text = dt.Rows[0][3].ToString(); } else { } } </code></pre>
20,477,953
0
<p>OK here is a jsFiddle with AN answer: <a href="http://jsfiddle.net/ccarns/2gMyx/" rel="nofollow">http://jsfiddle.net/ccarns/2gMyx/</a></p> <p>The reason I say that is I cheated a bit because every(2).months(); and other methods I tried for every two weeks would return unexpected results.</p> <pre><code>later.parse.recur().on(_dayOfTheMonth).dayOfMonth().every(2).month(); </code></pre> <p>For instance a start date of 12/1/2013 would return the same results as 1/1/2103 (both returning the first value as 1/1/2103). It seem like the implimenation treated every 2 as every odd month. Try the original fiddle at top to see what I mean.</p>
18,990,841
0
<p>I t makes a lot of sense to have separate tables for stages, grades, semesters, ...</p> <p>You have already mentioned the best reason for this, you can add individual data for each of these levels. You can name the foreign keys in a sensible way (i.e. <code>stage_id</code> in the table for the grades). And I doubt you will ever need a list of subjects mixed in with lessons or semesters.</p>
392,507
0
In Windows Mobile (5/6) SDK, where did windns.h go? <p>According to <a href="http://msdn.microsoft.com/en-us/library/aa916070.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa916070.aspx</a> (DnsQuery_W), DNS query libraries are available on Windows Mobile / CE developers for versions 5.0 onwards. Yet, "#include " gives nasty "file not found" errors. What gives? Strangely enough "dnsapi.lib" is available. Does Microsoft actually expect developers to scavenge the file from somewhere?.. </p>
37,131,833
0
<p>This is the Code I am Looking For and I found out myself </p> <pre><code>//you must install these two in your node js using npm var expect = require("chai").expect; var request = require('superagent'); describe("Name For The Test Suite", function() { it("Testing Post Request using Mocha", function(done) { request.post('localhost:8081/yourRequestCatcherName') .set('Content-Type', 'application/json') .send('{"fieldName":"data"}') .end(function(err,res){ //your code to Test done(); }) }); }); </code></pre> <p>it Works Perfectly in the way What I want.</p>
40,994,753
0
jquery DataTable function options are not working <p>I want to change some settings of my table with DataTable function, but the arguments</p> <pre><code>paging: false, scrollY: 400 </code></pre> <p>are not having any effect on the table whatsoever. </p> <hr> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta charset=utf-8 /&gt; &lt;link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;table id='example'&gt; &lt;thead&gt; &lt;tr&gt;&lt;th class='site_name'&gt;Name&lt;/th&gt;&lt;th&gt;Url &lt;/th&gt;&lt;th&gt;Type&lt;/th&gt;&lt;th&gt;Last modified&lt;/th&gt;&lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"&gt;&lt;/script&gt; &lt;script&gt; $("#example").DataTable({ "aaData":[ ["Sitepoint","http://sitepoint.com","Blog","2013-10-15 10:30:00"], ["Flippa","http://flippa.com","Marketplace","null"], ["99designs","http://99designs.com","Marketplace","null"], ["Learnable","http://learnable.com","Online courses","null"], ["Rubysource","http://rubysource.com","Blog","2013-01-10 12:00:00"] ], paging: false, scrollY: 400 } ); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <hr> <p>I took the code from <a href="https://www.sitepoint.com/working-jquery-datatables/" rel="nofollow noreferrer">https://www.sitepoint.com/working-jquery-datatables/</a> and the instructions for the options from <a href="https://datatables.net/manual/options" rel="nofollow noreferrer">https://datatables.net/manual/options</a>.</p>
34,645,101
0
<p>You're getting errors on your php script. The first step is to turn on your error reporting, so put the code below right under your opening <code>&lt;?php</code> tags:</p> <pre><code>ini_set('display_errors', 1); error_reporting(-1); </code></pre> <p>That will show you the errors. Now reading the comments, you're query seems to be failing.</p> <p>You should be checking the query to ensure it is actually successful before you try and fetch results as such.</p> <pre><code>$query = " Select * FROM users; "; $result = mysqli_query($connect, $query); // this checks if query failed and prints error. if(!$result){ die("SQL Error: ". mysqli_error($connect)); } // will only get here if your query runs successfully. $number_of_rows = mysqli_num_rows($result); ///... rest of your code... </code></pre> <p>Now, let us know what errors you get and if you managed to fix them. I'll update this answer as you reply.</p>
15,436,922
0
get value from child from to parent form <p>i have 2 form in my media player project i have make object of from1 (parent form) and by that get value from form1 in form3. but i also need to get value of a variable from form3 to form1. but the problem is that when i make the object of form3 in form1 like this </p> <pre><code> Form3 m_child; public Form1(Form3 frm3) { InitializeComponent(); m_child = frm3; } </code></pre> <p>it shows the error in the <strong>program.cs</strong> that <strong>from1 does not contain a constructor that contain 0 argument</strong>. i know i have to pass there a parameter in <code>Application.Run(new Form1());</code> </p> <p>but what i should pass i have no idea. plz help if is there any solution or any other way to get the value from child to parent form. </p> <p>this is my code for form3 now i want to use value of smileplay, surpriseplay ,sadplay,normalplay,ambiguousplay in form1</p> <pre><code> Form1 m_parent; public Form3(Form1 frm1) { InitializeComponent(); m_parent = frm1; } private void Form3_Load(object sender, EventArgs e) { WMPLib.IWMPPlaylistArray allplaylist= m_parent.axWindowsMediaPlayer1.playlistCollection.getAll(); for (int litem = 0; litem &lt; allplaylist.count; litem++) { smilecombo.Items.Add( allplaylist.Item(litem).name); surprisecombo.Items.Add(allplaylist.Item(litem).name); sadcombo.Items.Add(allplaylist.Item(litem).name); normalcombo.Items.Add(allplaylist.Item(litem).name); ambiguouscombo.Items.Add(allplaylist.Item(litem).name); } } private void savebtn_Click(object sender, EventArgs e) { WMPLib.IWMPPlaylist smileplay= m_parent.axWindowsMediaPlayer1.playlistCollection.getByName(smilecombo.SelectedItem.ToString()).Item(0); WMPLib.IWMPPlaylist surpriseplay = m_parent.axWindowsMediaPlayer1.playlistCollection.getByName(surprisecombo.SelectedItem.ToString()).Item(0); WMPLib.IWMPPlaylist sadplay = m_parent.axWindowsMediaPlayer1.playlistCollection.getByName(sadcombo.SelectedItem.ToString()).Item(0); WMPLib.IWMPPlaylist normalplay = m_parent.axWindowsMediaPlayer1.playlistCollection.getByName(normalcombo.SelectedItem.ToString()).Item(0); WMPLib.IWMPPlaylist ambiguousplay = m_parent.axWindowsMediaPlayer1.playlistCollection.getByName(ambiguouscombo.SelectedItem.ToString()).Item(0); } </code></pre>
31,479,681
0
<ol> <li><p>The variables <code>jpg_data</code> and <code>png_data</code> are lists containing captured URLs. Your loops iterate over each URL, placing the URL string in the variable <code>image</code>. Then, in both loops, you write the URL string to the file, not the actual image. It actually looks like the commented out <code>urllib</code> lines would do the trick, instead of what you're currently doing now.</p></li> <li><p>The <code>.write()</code> function expects you to give it an object that matches the mode of the file. When you call <code>open(..., 'wb')</code>, you're saying to open the file in <code>write</code> and <code>binary</code> mode, which means that you need to give it <code>bytes</code> instead of <code>str</code>.</p></li> </ol> <p>Bytes are the fundamental way everything is stored in a computer. Everything is a series of bytes -- the data on your hard drive, and the data you send and receive on the Internet. Bytes don't really have meaning on their own -- each one is just 8 bits strung together. The meaning depends on how you <em>interpret</em> the bytes. For instance, you could interpret a single byte as representing a number from 0 to 255. Or, you could interpret it as a number from -128 to 127 (both of these are common). You could also assign these "numbers" to characters, and interpret a sequence of bytes as text. However, this only allows you to represent 256 characters, and there are many more than that in the world's various languages. So, there are multiple ways of representing text as sequences of bytes. These are called "character encodings". The most popular modern one is "UTF-8".</p> <p>In Python, a <code>bytes</code> object is just a series of bytes. It has no special meaning -- nobody has said what it represents yet. If you want to use that as text, you need to decode it, using one of the character encodings. Once you do that (<code>.decode('UTF-8')</code>), you have a <code>str</code> object. In order to write it to disk (or the network), your <code>str</code> will have to eventually be <em>encoded</em> back into bytes. When you open a file in text mode, Python chooses your computer's default encoding, and it will decode everything you read using that, and encode everything you write with it. However, when you open a file in <code>b</code> mode, Python expects that you will give it <code>bytes</code>, and so it throws an error when you give it a <code>str</code> instead. Since you know the HTML file you downloaded and put in <code>data</code> is text, it would have been best for you to save it to a file in text mode. However, encoding it as <code>UTF-8</code> and writing it to a binary file works too, as long as your system's default encoding is <code>UTF-8</code>. In general, when you have a <code>str</code> and you want to write it to a file, open the file in text mode (just don't pass <code>b</code> in the mode parameter) and let Python pick the encoding, since it knows better than you do!</p> <p>For more info on the character sets and encoding stuff (which I only glossed over), you really should read <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="nofollow">this</a> article.</p>
11,319,128
0
<p>You could also try:</p> <pre><code>set rowcount 1000 delete from mytable where id in (select id from ids) set rowcount 0 --reset it when you are done. </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/ms188774.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms188774.aspx</a></p>
24,773,795
0
Value from MYSQL is coming null <p>I am fetching code from codeignitor using implode function. here is the code</p> <pre><code>$this-&gt;load-&gt;database(); $session_data = $this-&gt;session-&gt;userdata('logged_in'); $user_id = $session_data['user_id']; $this-&gt;db-&gt;select('skill_id'); $this-&gt;db-&gt;from('user_info_skillset'); $this-&gt;db-&gt;where('user_id',$user_id); $query = $this-&gt;db-&gt;get(); foreach($query-&gt;result() as $row) { $skill_id[] = $row-&gt;skill_id; } $test = implode(',',$skill_id); // echo '&lt;pre /&gt;'; // print_r($test); exit; $this-&gt;db-&gt;select('project_id'); $this-&gt;db-&gt;from('project'); $this-&gt;db-&gt;where_in('required_skills',$test); $query1 = $this-&gt;db-&gt;get(); echo '&lt;pre /&gt;'; print_r($query1); exit; return $query1-&gt;result(); </code></pre> <p>The problem is i can not able to fetch data for </p> <pre><code> echo '&lt;pre /&gt;'; print_r($query1); exit; return $query1-&gt;result(); </code></pre> <p>When i try enter this database query manually in mysql workbench it is working, but by code it displays null value. is that anything missing in code? please guide me. below is my output.</p> <p>Output</p> <pre><code>CI_DB_mysql_result Object ( [conn_id] =&gt; Resource id #34 [result_id] =&gt; Resource id #38 [result_array] =&gt; Array ( ) [result_object] =&gt; Array ( ) [custom_result_object] =&gt; Array ( ) [current_row] =&gt; 0 [num_rows] =&gt; 0 [row_data] =&gt; ) </code></pre>
4,103,668
0
Variables to get windows directories in x64 bit version? <p>In x64 bit version of windows, i see that are also x86 bit directories. How do we get that using envirnoment variables ?</p>
614,881
0
Dynamically changing height of div element based on content <p>I'm working on a Facebook-like toolbar for my website.</p> <p>There's a part of the toolbar where a user can click to see which favorite members of theirs are online.</p> <p>I'm trying to figure out how to get the div element that pops up to grow based on the content that the AJAX call puts in there.</p> <p>For example, when the user clicks "Favorites Online (4)", I show the pop up div element with a fixed height and "Loading...". Once the content loads, I'd like to size the height of the div element based on what content was returned.</p> <p>I can do it by calculating the height of each element * the number of elements but that's not very elegant at all.</p> <p>Is there a way to do this with JavaScript or CSS? (note: using JQuery as well).</p> <p>Thanks.</p> <p>JavaScript:</p> <pre><code> function favoritesOnlineClick() { $('#favoritesOnlinePopUp').toggle(); $('#onlineStatusPopUp').hide(); if ($('#favoritesOnlinePopUp').css('display') == 'block') { loadFavoritesOnlineListing(); } } </code></pre> <p>CSS and HTML:</p> <pre><code> #toolbar { background:url('/_assets/img/toolbar.gif') repeat-x; height:25px; position:fixed; bottom:0px; width:100%; left:0px; z-index:100; font-size:0.8em; } #toolbar #popUpTitleBar { background:#606060; height:18px; border-bottom:1px solid #000000; } #toolbar #popUpTitle { float:left; padding-left:4px; } #toolbar #popUpAction { float:right; padding-right:4px; } #toolbar #popUpAction a { color:#f0f0f0; font-weight:bold; text-decoration:none; } #toolbar #popUpLoading { padding-top:6px; } #toolbar #favoritesOnline { float:left; height:21px; width:160px; padding-top:4px; border-right:1px solid #606060; text-align:center; } #toolbar #favoritesOnline .favoritesOnlineIcon { padding-right:5px; } #toolbar #favoritesOnlinePopUp { display:block; border:1px solid #000000; width:191px; background:#2b2b2b; float:left; position:absolute; left:-1px; top:-501px; /*auto;*/ height:500px;/*auto;*/ overflow:auto; } #toolbar #favoritesOnlineListing { font-size:12px; } &lt;div id="toolbar"&gt; &lt;div id="favoritesOnline" style=" &lt;?php if ($onlinestatus == -1) { echo "display:none;"; } ?&gt; "&gt; &lt;img class="favoritesOnlineIcon" src="/_assets/img/icons/favorite-small.gif" /&gt;&lt;a href="javascript:favoritesOnlineClick();"&gt;Favorites Online (&lt;span id="favoritesOnlineCount"&gt;&lt;?php echo $favonlinecount; ?&gt;&lt;/span&gt;)&lt;/a&gt; &lt;div id="favoritesOnlinePopUp"&gt; &lt;div id="popUpTitleBar"&gt; &lt;div id="popUpTitle"&gt;Favorites Online&lt;/div&gt; &lt;div id="popUpAction"&gt;&lt;a href="javascript:closeFavoritesOnline();"&gt;x&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="favoritesOnlineListing"&gt; &lt;!-- Favorites online content goes here --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
3,939,138
1
developing for modularity & reusability: how to handle While True loops? <p>I've been playing around with the pybluez module recently to scan for nearby Bluetooth devices. What I want to do now is extend the program to also find nearby WiFi client devices.</p> <p>The WiFi client scanner will have need to have a <code>While True</code> loop to continually monitor the airwaves. If I were to write this as a straight up, one file program, it would be easy.</p> <pre><code>import ... while True: client = scan() print client['mac'] </code></pre> <p>What I want, however, is to make this a module. I want to be able to reuse it later and, possible, have others use it too. What I can't figure out is how to handle the loop.</p> <pre><code>import mymodule scan() </code></pre> <p>Assuming the first example code was 'mymodule', this program would simply print out the data to stdout. I would want to be able to use this data in my program instead of having the module print it out...</p> <p>How should I code the module?</p>
18,918,666
0
<p>Well actually all browsers comply with the same-origin policy. The reason for it is that if the policy didn't apply, upon visiting evil site, that site would essentially control your browser, could take use of any active sessions and cookies etc. You would be able to make ajax requests to any website the person is logged in using his session and perform virtually any task you'd like. You could also make requests to different ports, which again could be abused, used to make zombies, and hundreds other things more creative people would think off...</p> <p>Essentially the integrity of all your session would be gone upon visiting a any site. </p> <p>I would suggest reading <a href="https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy" rel="nofollow">this</a> for a detailed explanation of the issue.</p>
5,792,060
1
easy_install with various versions of python installed, mac osx <p>I have various versions of python on a mac OSX 10.6 machine, some of them installed with macports:</p> <pre><code>&gt; python_select -l Available versions: current none python24 python26 python26-apple python27 </code></pre> <p>The default or system version is <code>python26-apple</code>. I am now using python27, which I selected with</p> <pre><code>&gt; sudo python_select python27 </code></pre> <p>I recently tried installing django using <code>easy_install</code>, but it got installed with the default python (I can check that by python_selecting python26-apple and importing django). If, instead, I download the django tarball, expand and use</p> <pre><code>&gt; sudo python setup.py install </code></pre> <p>everything works as expected, i.e. I get django in python 2.7. Now the question is, is there a way to get <code>easy_install</code> to work with the version of python I have selected with <code>python_select</code>? </p> <p><strong>UPDATE</strong> Apparently <code>python_select</code> is deprecated. The following command seems to be equivalent:</p> <pre><code>port select --list python </code></pre> <p>producing:</p> <pre><code>Available versions for python: none python24 python26 python26-apple python27 (active) </code></pre>
31,044,697
0
Keep selected value after post check <p>I have a enquete. 1 of the pages looks like this:</p> <pre><code>&lt;form method="POST"&gt; &lt;input type="hidden" value="true" id="x" name="x"&gt; &lt;table&gt; &lt;b&gt;How relevant where the topics for your current and/or future business?&lt;/b&gt; &lt;hr /&gt; &lt;tr&gt; &lt;input type="hidden" value="1" name="question1"&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="1"&gt;1&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="2"&gt;2&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="3"&gt;3&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="4"&gt;4&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="5"&gt;5&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="6"&gt;6&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="7"&gt;7&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="8"&gt;8&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="9"&gt;9&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer1" value="10"&gt;10&lt;/td&gt; &lt;td&gt; &lt;textarea rows="4" cols="50" name="comment1"&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt;&lt;br /&gt; &lt;table&gt; &lt;b&gt;How did you value the networking opportunity?&lt;/b&gt; &lt;hr /&gt; &lt;tr&gt; &lt;input type="hidden" value="2" name="question2"&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="1"&gt;1&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="2"&gt;2&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="3"&gt;3&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="4"&gt;4&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="5"&gt;5&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="6"&gt;6&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="7"&gt;7&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="8"&gt;8&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="9"&gt;9&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="answer2" value="10"&gt;10&lt;/td&gt; &lt;td&gt; &lt;textarea rows="4" cols="50" name="comment2"&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input id="enquete_next" type="submit" name="Add" value="Next"&gt; &lt;?php //If the form gets submitted, check if everything is okay. if(isset($_POST['x'])){ $validcomment = false; //validate if the answers are not empty. if they are empty go the the else statement. if(!empty($_POST['answer1'])){ if(!empty($_POST['answer2'])){ $validcomment = true; }else{ echo "Please fill in all the questions!" . "&lt;br&gt;"; } }else{ echo "Please fill in all the questions!" . "&lt;br&gt;"; } //If the form is filled in, and checked. Then do this! if($validcomment){ insert_page1(); } } ?&gt; &lt;/form&gt; </code></pre> <p>The following code is working. So when i fill in answer 1, but leave answer 2 empty. i get a message: Please fill in all the questions.</p> <p>However, i would like the form to keep its values. so i only have to fill in the empty answer instead of the whole form.</p> <p>Because right now, when it checks. The form gets empty and i have to fill it in all over again. </p>
7,880,123
0
<p>I believe you can use the defaultdict in the collections module for this. <a href="http://docs.python.org/library/collections.html#collections.defaultdict" rel="nofollow">http://docs.python.org/library/collections.html#collections.defaultdict</a></p> <p>I think the examples are pretty close to being exactly what you want.</p>
36,712,742
0
How to add a button next to a field in vtiger CRM? <p>I made a script outside of vtiger CRM with a button and if you click on it the button opens a pop up and you can select a location within that popup which then puts the x and y coordinates in a textbox.</p> <p>What I want is to have that button next to a field I already have in vtiger CRM, the problem is is that with vtiger you can't simply just add some PHP, almost everything goes via the database.</p> <p>I need to add a custom UI Type which allows me to add a field with for example <code>uitype 595</code> which always has a button next to the field, the current list can be found here:<br /> <a href="https://wiki.vtiger.com/index.php/UI_Types" rel="nofollow">https://wiki.vtiger.com/index.php/UI_Types</a></p> <p>That is what I think would be the best solution even though I am sure there are easier methods of doing something like this.</p> <p>Are there any other methods of doing this? If so, how can I add a button next to a textbox field without messing with PHP code(can't change source code)?</p>
13,539,554
0
<p>try this</p> <pre><code>$discounts = $this-&gt;model_catalog_product-&gt;getProductDiscounts($product_id); $product_discounts = array(); foreach($discounts as $discount) { $product_discounts = array( 'quantity' =&gt; $discount['quantity'], 'price' =&gt; $this-&gt;currency-&gt;format($this-&gt;tax-&gt;calculate($discount['price'], $product_info['tax_class_id'], $this-&gt;config-&gt;get('config_tax'))) ); } </code></pre>
6,316,920
0
<p>I don't think MPG files have detailed meta data embedded in them. However, have a look at <a href="http://stackoverflow.com/questions/220097/read-write-extended-file-properties-c">this post</a> which explains how to get extended data from the tags stored with the file. If you right-click on the video file...<code>Properties</code>...<code>Details</code>, the file may have its <code>Frame Width</code> and <code>Frame Height</code> information filled in. You can extract this information, using the details from the link, to get the relevant information.</p>