pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
35,705,887
0
<p>You can do something like below, this gives the counters as (propertyName, propertyValue) pairs.</p> <pre><code>with T1 as ( select GetArrayElement(iotInput.performanceCounter, 0) Counter, System.Timestamp [EventTime] from iotInput timestamp by context.data.eventTime ) select [EventTime], Counter.categoryName, Counter.available_bytes [Value] from T1 where Counter.categoryName = 'Memory' union all select [EventTime], Counter.categoryName, Counter.percentage_processor_time [Value] from T1 where Counter.categoryName = 'Process' </code></pre> <p>Query that gives one column per counter type can also be done, you will have to either do a join or a group by with 'case' statements for every counter.</p>
20,686,195
0
<p>With CSS3 you could also use <code>a[rel="#"] {display:none}</code></p>
20,106,179
0
<p>You don't need to confirm password for the login $rules array.</p> <pre><code>$rules = array( 'username' =&gt; 'required|email|exists:users', 'password' =&gt; 'required', ); </code></pre> <p>This should work for the postLogin validation rules.</p>
34,420,324
0
Ckeditor plugin : how to unwrap text? <p>I have created a ckeditor plugin that wraps the selected text into a span. I wonder how can I unwrap the selected when I apply this plugin on a text that has been previously wrapped into the span.</p> <pre><code>CKEDITOR.plugins.add('important', { // Register the icons. They must match command names. //trick to get a 16*16 icon : http://www.favicomatic.com icons: 'important', init: function (editor) { editor.addCommand('important', { // Define the function that will be fired when the command is executed. exec: function (editor) { var selected_text = editor.getSelection().getSelectedText(); console.log(editor.getSelection()) ; var newElement = new CKEDITOR.dom.element("span"); newElement.setAttributes({class: 'important'}); newElement.setText(selected_text); editor.insertElement(newElement); //how to unwrap the selected text ? }); // Create the toolbar button that executes the above command. editor.ui.addButton('important', { label: 'Set this as important', command: 'important', toolbar: 'insert' }); } }); </code></pre>
35,058,702
0
<p>try this way it will help</p> <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;LinearLayout android:id="@+id/container_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;include android:id="@+id/toolbar" layout="@layout/toolbar" /&gt; &lt;/LinearLayout&gt; &lt;FrameLayout android:id="@+id/container_body" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; &lt;fragment android:id="@+id/fragment_navigation_drawer" android:name="info.androidhive.materialdesign.activity.FragmentDrawer" android:layout_width="@dimen/nav_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" app:layout="@layout/fragment_navigation_drawer" tools:layout="@layout/fragment_navigation_drawer" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; </code></pre>
7,829,312
0
Why can't post scores via Scores API in Javascript? <p>I'm writing a javascript game library that I want to integrate with Facebook Scores. Games made with my library typically run on static file servers (i.e. just ordinary HTML+JS, no server side scripts).</p> <p>I've been looking at the <a href="http://developers.facebook.com/docs/score/" rel="nofollow">scores documentation</a> and have come across <a href="http://facebook.stackoverflow.com/questions/7211438/how-to-post-a-score-from-the-facebook-javascript-sdk">this problem</a>: you can only submit a score with an app access token.</p> <p>Why?</p> <p>Correct me if I'm wrong, but it seems I can't get an app access token unless I have the app secret, and it seems obvious I should not put the app secret in javascript. For most of these games, server side scripting is out of the question. So I have no way to get an app access token, so none of these games can submit scores.</p> <p>What seems especially dumb is if the user grants the app the "publish_stream" permission, you can automatically make a wall post along the lines of "I just scored 77777 in MySuperGame!". You can do that with just pure HTML+JS. But you can't post a score.</p> <p>Am I missing something or is the API just a bit dumb about this?</p>
32,904,302
0
Searching a text value in multiple excel files and copying below cell value to master file <p>I was working with a code to extract data from multiple excel files in a folder from muliple cells and paste the extracted values to a master file. For example Name was in cell A9, Phone in cell B6 etc. </p> <p>But now there was change in raw data recived and cell places are changed dynamically. The only thing same through which i can find those values is that through searching by text, if I have to find "Name" I need the code to first find text "Name" and the copy the value below the found cell. That is if "Name" found in cell "A10" then I need the code to copy value "A11", same way find text "Phone" and if text found in cell "B23" copy value of "B24" and so on.</p> <pre><code>Sub Consolidate() Dim wkbkorigin As Workbook Dim originsheet As Worksheet Dim destsheet As Worksheet Dim ResultRow As Long Dim Fname As String Dim RngDest As Range Set destsheet = ThisWorkbook.Worksheets("Extractdata") Set RngDest = destsheet.Cells(Rows.Count, 1).End(xlUp) _ .Offset(1, 0).EntireRow Fname = Dir(ThisWorkbook.Path &amp; "/*.xlsx") 'loop through each file in folder (excluding this one) Do While Fname &lt;&gt; "" And Fname &lt;&gt; ThisWorkbook.Name If Fname &lt;&gt; ThisWorkbook.Name Then Set wkbkorigin = Workbooks.Open(ThisWorkbook.Path &amp; "/" &amp; Fname) Set originsheet = wkbkorigin.Worksheets("Table 1") With RngDest .Cells(1).Value = originsheet.Range("A3").Value .Cells(2).Value = originsheet.Range("C21").Value .Cells(3).Value = originsheet.Range("E21").Value .Cells(4).Value = originsheet.Range("A23").Value .Cells(5).Value = originsheet.Range("A31").Value End With wkbkorigin.Close SaveChanges:=False 'close current file Set RngDest = RngDest.Offset(1, 0) End If Fname = Dir() 'get next file Loop End Sub </code></pre> <p>Kindly help me in making the changes with the below code as i am getting it right to work.</p> <p><a href="https://i.stack.imgur.com/2Ex63.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Ex63.jpg" alt="I need the values highlighted in yellow"></a></p> <p>All the values highlighted in yellow needs to be copied. Only thing common is the words or texts above the highlighted cells as range of cells changes as per workbooks.</p>
26,631,439
0
ReSharper - How to show custom snippet in IntelliSense <p>I've created a custom snippet that contains a shortcut <code>proplto</code>. If I hit Ctrl-K, Ctrl-X and open My Code Snippets I can select my snippet. I can also type <code>proplto</code> in code, hit TAB and the snippet is inserted. However, I can't find a way to display my snippet in IntelliSense. It shows <code>prop</code> and <code>propg</code> but not my <code>proplto</code>. I tried adding my snippet by going to <strong>Resharper > Templates Explorer</strong>, selecting <strong>C#</strong> and importing my snippet file. It says "No templates of type 'Live Templates' found in the file.'</p> <p>VS2013 Ultimate ReSharper 8.2</p>
26,108,113
0
<p>Personally I found Stephen Toub's article to be the best source regarding constrained execution regions: <a href="http://msdn.microsoft.com/en-us/magazine/cc163716.aspx#S2" rel="nofollow">Using the Reliability Features of the .NET Framework</a>. And in the end CER are the bread and butter of any fault tolerant code so this article contains pretty much everything you need to know, explained in a clear and concise way.</p> <p>That being said you could rather choose to favor a more radical design where you immediately resort to the destruction of the application domain (or depend on this pattern when the CLR is hosted). You could look at the bulkhead pattern for example (and maybe the <a href="http://www.reactivemanifesto.org/" rel="nofollow">reactive manifesto</a> if you're interested on this pattern and facing complex data flows).</p> <p>That being said, the "let it fail" approach can backfire if you cannot completely recover after that, as <a href="https://www.ima.umn.edu/~arnold/disasters/ariane5rep.html" rel="nofollow">demonstrated by Ariane V</a>.</p>
35,812,557
0
<pre><code>var i = 0; var myImg = document.getElementById("img"); function zoomin(){ i++; myImg.style.transform = "scale(1."+ i +")"; } </code></pre> <p>declare i=0; outside function will solve you probleem</p>
28,845,427
0
Deploy package to multiple IIS sites on same tentacle <p>I am using Octopus Deploy and TeamCity to automate the testing, building, packing, and deployment of a .NET app to multiple servers. Most of the servers have one instance of the app, but a few of them have multiple instances. </p> <p>I cannot figure out the best way to do this, or even if it is reasonably possible in Octopus. </p> <p>Can anyone provide a method to do this? I know I could technically script the entire process in powershell, but it would be nice if I could take advantage of the IIS features of Octopus Deploy.</p>
34,427,928
0
<p>Because your you calculate topping cost all all toppings and apply accross all pizza:</p> <pre><code>$(document).on("change","input[type='checkbox']", function() { var checked = $(":checkbox:checked").length; // this value is used for all pizzas, which is incorrect var toppingCost = (.99 * checked); var formID = $(this).closest('div').attr("id"); for(var i = 0; i &lt; pizzaArray.length; i++) { if (pizzaArray[i].pizzaNumber == formID) { pizzaArray[i].toppingCost = toppingCost; calculateCost(); } } }); </code></pre> <p>You should distinguish which topping belongs to which pizza.</p>
38,305,696
0
<p>I suspect that with mention of nodejs, there are a bunch of npm packages being downloaded as part of the build. On your local machine, these are already present but Kudu is restoring them in a clean folder every time.</p> <p>Secondly, about 5 mins of your build time is spent on building (and probably running) test projects. Unless intentional and required in deployment workflow, I would recommend turning if off via a flag.</p>
28,957,660
0
Magento crons with hour in cron expression not scheduling <p>I have been trying to schedule a cron job at 1830 hours daily but it never is scheduled</p> <pre><code>&lt;cron_expr&gt;30 18 * * *&lt;/cron_expr&gt; //This never works &lt;cron_expr&gt;0 18 * * *&lt;/cron_expr&gt; //This also does not work </code></pre> <p>However when I schedule a cron using the minutes expression, it is always scheduled</p> <pre><code>&lt;cron_expr&gt;*/10 * * * *&lt;/cron_expr&gt; //This surprisingly works! </code></pre> <p>I understand that Magento schedules crons using the UTC timezone, and the expressions that I have tried are to do with times in UTC.</p> <p>Can someone help me with what am I missing out?</p>
25,017,533
0
How to limit the number of objects passed into $firebase object? <p>I'm trying to set the <code>angularjs</code> app with firebase connector angularfire. In my database I have an endless list and I want to display only the last 100 items and any new coming item.</p> <p>according documentation the function <code>$firebase()</code> takes the the <code>Firebase</code> reference as argument with whatever url it was set up with. It automatically loads the content wich can be assigned to <code>$scope</code>. However what happens if there is a very long list of data? is there any option to limit the number of items pulled from <code>firebase</code> the same way as you would do it with when pulling the data directly from Firebase reference with <code>.limit()</code> ? I didn't find anything in angularfire documentation.</p>
6,247,384
0
<p>Html attributes are strings. The problem likely arises with how the css interpreter interprets an unquoted number. It would recognize it as a number and not a string, so it could never match a string value of an html attribute. </p> <p>You the would need to enclose the value you are searching for in quotation marks so that it is correctly interpreted as a string, as has been previously suggested. If the value starts with a non-numeric character, it would be tokenized as a string, which is why the first example works.</p> <p><a href="http://www.w3.org/TR/CSS2/selector.html#attribute-selectors" rel="nofollow">http://www.w3.org/TR/CSS2/selector.html#attribute-selectors</a></p>
9,000,970
0
how to highlight the searched text in textbox using javascript? <p>I am using java script in my application.I want to highlight the search element as well as keep the cursor at the position of search item in textbox. How can I highlight the element using javascript?</p>
11,311,894
0
<p>There is a flexible data generator in <a href="http://elki.dbs.ifi.lmu.de/" rel="nofollow">ELKI</a> that can generate various distributions in arbitrary dimensionality. It also can generate Gamma distributed variables, for example.</p> <p>There is documentation on the Wiki: <a href="http://elki.dbs.ifi.lmu.de/wiki/DataSetGenerator" rel="nofollow">http://elki.dbs.ifi.lmu.de/wiki/DataSetGenerator</a></p>
25,405,877
0
<p>Your links har taller than the box with the background, so set it as:</p> <pre><code>#menu ul.sub-menu li a{ height:13px } </code></pre> <p>.. and not 25px</p>
29,933,268
0
<p>Right before you call this function, add this line.</p> <pre><code>var xml = jQuery.parseXML(xml); </code></pre> <p><em>Note: you might have to play with variable names. Either way, the requirement is that the string must be converted to a <code>XMLObject</code>.</em></p> <p>See if that takes care of it for you.</p>
15,631,496
0
Issue using bootstrap responsive for tablet and phones <p>I am designing a page using bootstrap responsive for the following image and I'm beginner for using bootstrap responsive..<img src="https://i.stack.imgur.com/ssSyK.png" alt="create_account.png for create_account page"></p> <p>And the html is as follows.</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html" /&gt; &lt;meta name="author" content="" /&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Bootstrap Responsive&lt;/title&gt; &lt;meta content="width=device-width, initial-scale=1.0" name="viewport"&gt; &lt;meta content="" name="description"&gt; &lt;link rel="stylesheet" href="css/bootstrap.min.css"&gt; &lt;link rel="stylesheet" href="css/bootstrap-responsive.min.css"&gt; &lt;style&gt; .container { margin-top: 80px; } #main-form { margin: auto; width: 500px; } .profile-photo { vertical-align: middle; } .form { text-align: center; } .profile-image { width: 100%; height: 100%; } &lt;/style&gt; </code></pre> <p></p> <pre><code>&lt;body&gt; &lt;div class="container"&gt; &lt;div class="row text-center"&gt; &lt;img src="img/slider/1.jpg" width="250px" height="250px" /&gt; &lt;/div&gt; &lt;div class="row text-center"&gt; &lt;h2&gt;Create your account&lt;/h2&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div id="main-form"&gt; &lt;div class="span2"&gt; &lt;div class="profile-photo"&gt; &lt;img class="profile-image" src="img/slider/1.jpg" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="span3 form"&gt; &lt;div class="widget-container widget-box4"&gt; &lt;div class="control-group"&gt; &lt;div class="controls"&gt; &lt;input type="text" id="inputEmail" placeholder="Username"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;div class="controls"&gt; &lt;input type="text" id="inputEmail" placeholder="Email"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;div class="controls"&gt; &lt;input type="password" id="inputPassword" placeholder="Password"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;div class="controls"&gt; &lt;input type="password" id="inputPassword" placeholder="Confirm Password"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;div class="controls"&gt; &lt;input type="checkbox"&gt; Remember me &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;div class="controls"&gt; &lt;button type="submit" class="btn"&gt;Sign in&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;script src="js/jquery-1.9.1.min.js"&gt;&lt;/script&gt; &lt;script src="js/bootstrap.min.js"&gt; &lt;script type="text/javascript"&gt; $('.carousel').carousel(); &lt;/script&gt; &lt;/body&gt; </code></pre> <p></p> <p>I wanted it in the middle of the page and I'm getting correctly in Desktop.</p> <p>But problem is the form and profile image are not coming in center.</p> <p>Please help me how to do that?. </p> <p>The work is more appreciated.</p>
38,697,931
0
<p>You could use DLookup for this - much simpler:</p> <pre><code>Private Sub cmbConsultant_Change() Me!txtHourlyRate.Value = DLookup("defaultFee", "tblConsultants", "ID = '" &amp; Me!cmbConsultant.Value &amp; "'") End Sub </code></pre> <p>However, most likely your ID is numeric, thus:</p> <pre><code>Private Sub cmbConsultant_Change() Me!txtHourlyRate.Value = DLookup("defaultFee", "tblConsultants", "ID = " &amp; Me!cmbConsultant.Value &amp; "") End Sub </code></pre>
17,871,476
0
<p>1)Use <a href="http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html" rel="nofollow">KeyBindings</a> KeyListener has 2 big issues,first you listen to all keys and second you have to have focus and be focusable. Instead KeyBinding you bind for a key and you don't have to be in focus.</p> <p>Simple Example:</p> <pre><code>AbstractAction escapeAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //code here example ((JComponent)e.getSource()).setVisible(Boolean.FALSE); }}; String key = "ESCAPE"; KeyStroke keyStroke = KeyStroke.getKeyStroke(key); component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, key); component.getActionMap().put(key, escapeAction); </code></pre> <p>You can use these JComponent constants</p> <pre><code>WHEN_ANCESTOR_OF_FOCUSED_COMPONENT WHEN_FOCUSED WHEN_IN_FOCUSED_WINDOW </code></pre> <p>2) Don't use concrete inheritance if it isn't necessary at all.</p> <p>3) Don't implement ActionListener in top classes, see <a href="http://www.oodesign.com/single-responsibility-principle.html" rel="nofollow">Single Responsability Principle</a> Example Change this:</p> <pre><code>public class Board extends JPanel implements ActionListener{ </code></pre> <p>to:</p> <pre><code> public class Board{ private JPanel panel; private class MyActionListener implements ActionListener{ //code here } } </code></pre> <p>4) Don't use inheritance if it's just the same for example in your <code>KeyAdapter</code> , you don't add nothing to it, just use <code>KeyAdapter</code> (Now you are gonna to use keybinding so this is useless but to know :) ). </p> <p>5) Add @Override annotation when you do overriding , also you should override <code>paintComponent(..)</code> instead of <code>paint(..)</code> in swing.</p>
26,884,313
0
<p>There is no such tool in existence which can perform above specified tasks.</p> <p>You can easily find tools for capturing screenshots, but you will be not able to view changes done after a specified time. You need to develop a crawler to perform this task. You can pick PHP or .net as technology to handle this task.</p> <p>In case, you have any query, you can let us know anytime.</p> <p>Thank You</p>
32,899,676
0
<p>I have filed <a href="http://bugs.python.org/issue25294" rel="nofollow">an issue</a> against Python. The text of this issue is reproduced below:</p> <p>PEP 8 recommends absolute imports over relative imports, and section 5.4.2 of the import documentation says that an import will cause a binding to be placed in the imported module's parent's namespace.</p> <p>However, since (with all current Python versions) this binding is not made until <em>after</em> the module body has been executed, there are cases where relative imports will work fine but absolute imports will fail. Consider the simple case of these five files:</p> <pre><code>xyz.py: import x x/__init__.py: import x.y x/y/__init__.py: import x.y.a x/y/a/__init__.py: import x.y.b; foo = x.y.b.foo x/y/b/__init__.py: foo = 1 </code></pre> <p>This will fail in a fashion that may be very surprising to the uninitiated. It will not fail on any of the import statements; rather it will fail with an AttributeError on the assignment statement in x.y.a, because the import of y has not yet finished, so y has not yet been bound into x.</p> <p>This could conceivably be fixed in the import machinery by performing the binding before performing the exec. Whether it can be done cleanly, so as not to cause compatibility issues with existing loaders, is a question for core maintainers.</p> <p>But if it is decided that the current behavior is acceptable, then at a minimum both the PEP 8 and the import documentation should have an explanation of this corner case and how it can be solved with relative imports.</p>
6,663,571
0
<p>From the documentation of <code>array_unique</code></p> <blockquote> <p>Note: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is the same. The first element will be used.</p> </blockquote> <p>In this case, the objects you're getting out of the XPath query translate to string form like "SimpleXML object" (not exactly like that, but the exact representation is not important). According to the above rules, then, every element looks exactly the same to <code>array_unique</code>.</p> <p>Unfortunately, there's no way to make <code>array_unique</code> behave the way you want, so you will need to fake it yourself:</p> <pre><code>$feeds = array( 'myfeed.xml', 'myfeed.xml' ); // Get all feed entries $entries = array(); foreach ($feeds as $feed) { $xml = simplexml_load_file($feed); $tmp = $xml-&gt;xpath('/rss/channel//item'); foreach ($tmp as $item) { if(!in_array($tmp, $entries)) { $entries[] = $tmp; } } } </code></pre> <p>I'm not sure if this will work, as it depends on being able to compare objects, and also I don't know that identical nodes from separate XML documents would compare the same anyway. But try it, and let me know. I can whip something else up if this doesn't work.</p>
15,359,507
0
<p>Simply declare the desired version in you POM where you specify the surefire plugin.</p> <p>As I recall, Maven 3 will actually complain if you don't explicitly specify the desired version for each plugin.</p> <p>E.g:</p> <pre><code>&lt;plugin&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;version&gt;X.X.X&lt;/version&gt; &lt;/plugin&gt; </code></pre>
37,527,562
0
<p>You can use the <a href="http://effbot.org/imagingbook/image.htm#tag-Image.Image.crop" rel="nofollow">crop</a> method from PIL (or PILLOW)</p> <pre><code>from PIL import Image import glob for filename in glob.glob('yourpath/*.tiff'): im = Image.open(filename) w, h = im.size im.crop((0, 30, w-60, h-30)) </code></pre>
15,779,474
0
selenium run only few methods <p>I know by creating test suite I can run all my class files, using code like</p> <pre><code>suite.addTestSuite( TestCase3.class); suite.addTestSuite( TestCase2.class); suite.addTestSuite( TestCase1.class); </code></pre> <p>But what if I dont want to run all the methods in a class file? I want to run only specific test methods inside a test class, how to do that?</p>
39,323,229
0
<p>I don't think this is possible with command line options.</p> <p>If you want you can make a custom annotator and include it in your pipeline you could go that route.</p> <p>Here is some sample code:</p> <pre><code>package edu.stanford.nlp.pipeline; import edu.stanford.nlp.util.logging.Redwood; import edu.stanford.nlp.ling.*; import edu.stanford.nlp.util.concurrent.MulticoreWrapper; import edu.stanford.nlp.util.concurrent.ThreadsafeProcessor; import java.util.*; public class ProvidedPOSTaggerAnnotator { public String tagSeparator; public ProvidedPOSTaggerAnnotator(String annotatorName, Properties props) { tagSeparator = props.getProperty(annotatorName + ".tagSeparator", "_"); } public void annotate(Annotation annotation) { for (CoreLabel token : annotation.get(CoreAnnotations.TokensAnnotation.class)) { int tagSeparatorSplitLength = token.word().split(tagSeparator).length; String posTag = token.word().split(tagSeparator)[tagSeparatorSplitLength-1]; String[] wordParts = Arrays.copyOfRange(token.word().split(tagSeparator), 0, tagSeparatorSplitLength-1); String tokenString = String.join(tagSeparator, wordParts); // set the word with the POS tag removed token.set(CoreAnnotations.TextAnnotation.class, tokenString); // set the POS token.set(CoreAnnotations.PartOfSpeechAnnotation.class, posTag); } } } </code></pre> <p>This should work if you provide your token with POS tokens separated by "_". You can change it with the forcedpos.tagSeparator property.</p> <p>If you set customAnnotator.forcedpos = edu.stanford.nlp.pipeline.ProvidedPOSTaggerAnnotator</p> <p>to the property file, include the above class in your CLASSPATH, and then include "forcedpos" in your list of annotators after "tokenize", you should be able to pass in your own pos tags.</p> <p>I may clean this up some more and actually include it in future releases for people!</p> <p>I have not had time to actually test this code out, if you try it out and find errors please let me know and I'll fix it!</p>
24,436,121
0
<p>None of the proposed solutions work to show the original column names, so I'm not sure why people are voting them up... I do have a "hack" that works for the original request, but I really don't like it... That is you actually append or prefix a string onto the query for each column so they are always long enough for the column heading. If you are in an HTML mode, as the poster is, there is little harm by a bit of extra white spacing... It will of course slow down your query abit...</p> <p>e.g.</p> <pre><code>SET ECHO OFF SET PAGESIZE 32766 SET LINESIZE 32766 SET NUMW 20 SET VERIFY OFF SET TERM OFF SET UNDERLINE OFF SET MARKUP HTML ON SET PREFORMAT ON SET WORD_WRAP ON SET WRAP ON SET ENTMAP ON spool '/tmp/Example.html' select (s.ID||' ') AS ID, (s.ORDER_ID||' ') AS ORDER_ID, (s.ORDER_NUMBER||' ') AS ORDER_NUMBER, (s.CONTRACT_ID||' ') AS CONTRACT_ID, (s.CONTRACT_NUMBER||' ') AS CONTRACT_NUMBER, (s.CONTRACT_START_DATE||' ') AS CONTRACT_START_DATE, (s.CONTRACT_END_DATE||' ') AS CONTRACT_END_DATE, (s.CURRENCY_ISO_CODE||' ') AS CURRENCY_ISO_CODE, from Example s order by s.order_number, s.contract_number; spool off; </code></pre> <p>Of course you could write a stored procedure to do something better, but really it seems like overkill for this simple scenario.</p> <p>This still does not meet the original posters request either. In that it requires manually listing on the columns and not using select *. But at least it is solution that works when you are willing to detail out the fields.</p> <p>However, since there really is no problem having too long of fields in HTML, there is an rather simple way to fix Chris's solution to work it this example. That is just pick a use the maximum value oracle will allow. Sadly this still won't really work for EVERY field of every table, unless you explicitly add formatting for every data type. This solution also won't work for joins, since different tables can use the same column name but a different datatype.</p> <pre><code>SET ECHO OFF SET TERMOUT OFF SET FEEDBACK OFF SET PAGESIZE 32766 SET LINESIZE 32766 SET MARKUP HTML OFF SET HEADING OFF spool /tmp/columns_EXAMPLE.sql select 'column ' || column_name || ' format A32766' from all_tab_cols where data_type = 'VARCHAR2' and table_name = 'EXAMPLE' / spool off SET HEADING ON SET NUMW 40 SET VERIFY OFF SET TERM OFF SET UNDERLINE OFF SET MARKUP HTML ON SET PREFORMAT ON SET WORD_WRAP ON SET WRAP ON SET ENTMAP ON @/tmp/columns_EXAMPLE.sql spool '/tmp/Example.html' select * from Example s order by s.order_number, s.contract_number; spool off; </code></pre>
20,612,022
0
<p>Try This one, May be help full </p> <pre><code>newView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:[NSString stringWithFormat:@"lightwood%d.jpg", indexPath.row]]]; </code></pre> <p>indexPath.row increase one by one and your images name also increasing one by one.... Thanks </p>
36,225,137
0
sensu-client is failing during start <p>My sensu-client is failing during start (fresh install) and <code>/var/log/sensu/sensu-client.log</code> doesn't show much despite me adding <code>LOG_LEVEL=debug</code> into <code>/etc/default/sensu</code> . I used similar client.json and rabbitmq.json config files (inside /etc/sensu/conf.d) on my other sensu-clients (copied ssl certificates). </p> <pre><code> $ sudo service sensu-client start [FAILED] sensu-client[ OK ] </code></pre> <p>Below is sensu-client log</p> <pre><code>$ tail -f /var/log/sensu/sensu-client.log from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/daemon.rb:187:in `setup_transport' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:412:in `start' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:19:in `block in run' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:18:in `run' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/bin/sensu-client:10:in `&lt;top (required)&gt;' from /opt/sensu/bin/sensu-client:23:in `load' from /opt/sensu/bin/sensu-client:23:in `&lt;main&gt;' ^C </code></pre> <p>Here is default config</p> <pre><code>$ cat /etc/default/sensu EMBEDDED_RUBY=false LOG_LEVEL=debug </code></pre> <p>Even reboot of my RHEL7 doesnt help, see log below </p> <pre><code>Mar 25 13:09:24 nms02w sensu-client: Starting sensu-client[ OK ]#015[FAILED] Mar 25 13:09:24 nms02w systemd: sensu-client.service: control process exited, code=exited status=1 Mar 25 13:09:24 nms02w systemd: Unit sensu-client.service entered failed state. Mar 25 13:09:24 nms02w systemd: sensu-client.service failed. </code></pre> <p>Adding more log:</p> <pre><code> systemctl status sensu-client.service ● sensu-client.service - LSB: Sensu monitoring framework client Loaded: loaded (/etc/rc.d/init.d/sensu-client) Active: failed (Result: exit-code) since Fri 2016-03-25 13:09:24 EDT; 1h 47min ago Docs: man:systemd-sysv-generator(8) Process: 948 ExecStart=/etc/rc.d/init.d/sensu-client start (code=exited, status=1/FAILURE) Mar 25 13:09:21 nms02w systemd[1]: Starting LSB: Sensu monitoring framework client... Mar 25 13:09:21 nms02w runuser[983]: pam_unix(runuser:session): session opened for user sensu by (uid=0) Mar 25 13:09:24 nms02w sensu-client[948]: [38B blob data] Mar 25 13:09:24 nms02w systemd[1]: sensu-client.service: control process exited, code=exited status=1 Mar 25 13:09:24 nms02w systemd[1]: Failed to start LSB: Sensu monitoring framework client. Mar 25 13:09:24 nms02w systemd[1]: Unit sensu-client.service entered failed state. Mar 25 13:09:24 nms02w systemd[1]: sensu-client.service failed. </code></pre>
19,751,863
0
<p>If you are on windows use MinGW or like most have suggested ggo with GCC on Linux</p> <p>Though ofcourse since it's commandline so you might find Dev-C++ and/or Code::Blocks, Eclipse CDT etc which are IDEs useful for you to make your job simpler.</p> <p>There is no standard and each compiler and it's libraries differ from one another.</p>
27,730,637
0
add Account(settings) method doesn't start Activity <p>I want to create custom app account in settings.</p> <h1>Problems</h1> <ol> <li>There is an option with icon in <code>settings &gt; Add account</code> but no name</li> <li>When click on that(Add account), <code>AuthenticatorActivity</code> doesn't start. I debug <code>Authenticator</code> class, <code>addAccount</code> method is called but no activity popped.</li> </ol> <p>I did the following steps:</p> <h1>Authenticator class(partial)</h1> <pre><code>public class AccountAuthenticator extends AbstractAccountAuthenticator{ @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.ARG_ACCOUNT_TYPE, accountType); intent.putExtra(AuthenticatorActivity.ARG_AUTH_TYPE, authTokenType); intent.putExtra(AuthenticatorActivity.ARG_IS_ADDING_NEW_ACCOUNT, true); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountAuthenticator.KEY_INTENT, intent); return bundle; } } </code></pre> <h1>AuthenticatorService</h1> <pre><code>public class AuthenticatorService extends Service{ @Override public IBinder onBind(Intent intent) { authenticator = new AccountAuthenticator(this); return authenticator.getIBinder(); } } </code></pre> <h1>manifest</h1> <pre><code>&lt;service android:name="com.voillo.utils.AuthenticatorService" android:exported="false" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.accounts.AccountAuthenticator" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator" /&gt; &lt;/service&gt; </code></pre> <h1>authenticator xml</h1> <pre><code>&lt;account-authenticator xmlns:android="http://schemas.android.com/apk/res/android" android:accountType="com.example.myapp" android:icon="@drawable/myapp_icon" android:smallIcon="@drawable/myapp_icon_small" android:label="myapp" /&gt; </code></pre>
16,894,022
0
<p>You can do it by making changes in the ps_order_detail table. In that table, PS stores all information for an ordered product like product id, name, product purchased quantities etc etc.</p> <p>There is a column named <strong>product_quantity</strong>, change it and it will change the number of products bought. </p>
28,698,609
0
<p>I suggest you try this:</p> <p>Add this permutation of your compound index.</p> <pre><code> (campaign_id,domain,log_time,log_type,subscriber_id) </code></pre> <p>Change your query to remove the <code>WHERE log_type IN()</code> criterion, thus allowing the aggregate function to use all the records it finds in the range scan on <code>log_time</code>. Including <code>subscriber_id</code> in the index should allow the whole query to be satisfied directly from the index. That is, this is a <em>covering index</em>.</p> <p>Finally, you can filter on your <code>log_type</code> values by wrapping the whole query in </p> <pre><code> SELECT * FROM (/*the whole query*/) x WHERE log_type IN ('EMAIL_SENT', 'EMAIL_CLICKED', 'EMAIL_OPENED', 'UNSUBSCRIBED') ORDER BY log_type </code></pre> <p>This should give you better, and more predictable, performance.</p> <p>(Unless the log_types you want are a tiny subset of the records, in which case please ignore this suggestion.)</p>
8,417,342
0
How to get all the ids of elements inside a list using jquery <p>I've a list as</p> <pre><code>&lt;ul id="list"&gt; &lt;li id="one"&gt;&lt;/li&gt; &lt;li id="two"&gt;&lt;/li&gt; &lt;li id="three"&gt;&lt;/li&gt; ..... .... .... &lt;/ul&gt; </code></pre> <p>I want to get the <code>ids</code> of every <code>li</code> element inside the <code>ul#list</code>. Since the number of <code>li</code> item is unknown, I would want to go through a loop for as long as an <code>li</code> item exist. Something like</p> <pre><code>while($('#list li') exists){ //Get id of the element } </code></pre> <p>Can anyone help me with this?</p>
28,383,735
0
<p>Hy, my answer is late but it seems that *.php page is not support... Try using *.html and it should work.</p> <p>Maybe I'm wrong and in this case, <strong>please give to us the solution</strong>.</p> <p>Regards,</p>
12,794,591
0
<p>Here's the first method that came to mind. Yes, it <em>is</em> ugly, but it seems to work:</p> <pre><code>function renderArray(_checkbox) { var output = [], rangeStart = 0; function outputCurrent() { if (rangeStart &lt; i - 1) output.push(_checkbox[rangeStart] + " to " + _checkbox[i - 1]); else output.push(_checkbox[i - 1]); rangeStart = i; } for (var i = 1; i &lt; _checkbox.length; i++) if (_checkbox[i] != _checkbox[i - 1] + 1) outputCurrent(); outputCurrent(); return "{" + output.join("; ") + "}"; } console.log(renderArray([1,3,4,5,7,9,10,11,14])); // logs "{1; 3 to 5; 7; 9 to 11; 14}" </code></pre> <p>Demo: <a href="http://jsfiddle.net/Jq2sQ/2/" rel="nofollow">http://jsfiddle.net/Jq2sQ/2/</a></p>
19,710,353
0
<p>You can use <a href="https://code.google.com/p/html5shiv/" rel="nofollow">html5shiv</a> to make IE support HTML5!</p>
21,588,845
0
<p>I'm the maintainer of JSTileMap. I have a sample project I did about a month ago that has some examples of what you're talking about here. You are welcome to have a look at my code: <a href="https://dl.dropboxusercontent.com/u/14626689/Platformer%20Test%201.zip">https://dl.dropboxusercontent.com/u/14626689/Platformer%20Test%201.zip</a></p> <p>It should give you most of the answers you are looking for as well as having some slight tweaks to JSTileMap that are as yet unpublished.</p>
2,261,561
0
What is involve in creating a music player in .NET? <p>I have always wanted to make a music player. But i have no idea how to. I dont need it to be cross playform, just as long as it works.</p> <p>Each part is its own question but let me know if i am missing any. I broke it up into simple, unknown and long</p> <h3>Simple</h3> <ul> <li>Selecting Files/Directories using a Dialog</li> <li>Saving playlist and other settings (json i choose you!)</li> <li>Sorting the data in the GUI</li> </ul> <h3>Somewhat difficult</h3> <ul> <li>Global Keys so i dont need to switch to the player window (i know this isnt supported in .NET :()</li> <li>Searching for songs (Allowing artist and album to be mixed with title and getting what is thought to be best results)</li> </ul> <h3>Unknown</h3> <ul> <li>Playing actual music with pause and stop with MP3, AAC and OGG support</li> <li>Song information (artist, album, title, year)</li> </ul> <p>I have a feeling when i start this will take a long time to finish. I plan to do this in C#. Do i have to use an external lib to get song information? Is one of these harder then what some people may think? any warnings about any of the above?</p>
10,713,781
0
<p>I would write all your business logic as classes with those arrays in a <strong>MODEL</strong> file, access those classes from the <strong>CONTROLLER</strong> file. And then once you have all your data, access from the <strong>CONTROLLER</strong> the <strong>VIEW</strong> file to output. Inside the <strong>MODEL</strong> write functions for those arrays so that you can reuse them, if they vary they may need own functions. This is a helpful link: <a href="http://php-html.net/tutorials/model-view-controller-in-php/" rel="nofollow">http://php-html.net/tutorials/model-view-controller-in-php/</a> and those videos give you a taste of the logic behind MVC: <a href="http://www.youtube.com/watch?v=HFQk8WGK1-Q&amp;feature=bf_prev&amp;list=UU9-GXsmQQ-N4h8ZsKI8CSkw" rel="nofollow">http://www.youtube.com/watch?v=HFQk8WGK1-Q&amp;feature=bf_prev&amp;list=UU9-GXsmQQ-N4h8ZsKI8CSkw</a></p>
10,369,677
0
<p>One way to rewrite is to use the <code>switch</code> statement in PHP. You can <a href="http://php.net/manual/en/control-structures.switch.php" rel="nofollow">read more about it here</a>.</p>
3,856,303
0
<p>As Igor says, Apple's fork of gas is ancient and wants:</p> <ul> <li>.global replaced by .globl</li> <li>all instructions in lowercase</li> <li>replace ';' comment separator with '@'</li> <li>stub labels for address imports</li> </ul> <p>I've written a pre-processor awk script for the Tremolo .s files to make them acceptable to Xcode, which I'll contribute back via Robin.</p> <p>Alternatively, you could try <a href="http://github.com/gabriel/ffmpeg-iphone-build/blob/master/gas-preprocessor.pl">this</a>.</p>
25,077,204
0
<p>What you need its called "push notifications". PhoneGap has some plugins for that. </p> <ul> <li><a href="https://build.phonegap.com/plugins/324" rel="nofollow">plugin</a></li> <li><a href="http://apigee.com/docs/app-services/content/tutorial-push-notifications-sample-app" rel="nofollow">sample app</a></li> <li><a href="http://devgirl.org/2013/07/17/tutorial-implement-push-notifications-in-your-phonegap-application/" rel="nofollow">tutorial</a></li> </ul> <p>This might also be helpful:</p> <ul> <li><a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html" rel="nofollow">Android notifications</a></li> <li><a href="http://plugins.cordova.io/#/package/de.appplant.cordova.plugin.local-notification" rel="nofollow">Cordova local notifications plugin with instructions etc</a> -> here you can see how the plugin is installed and used</li> </ul> <p>Be warned, that using proper push notifications you'll have to <a href="http://apigee.com/docs/app-services/content/registering-notification-service" rel="nofollow">register</a> your app first - if your notifications are not only local of course. </p> <blockquote> <p>To send push notifications, you will need to first register your app with the push notification service (Apple APNs or Google GCM) that corresponds to your app's platform.</p> </blockquote>
9,496,617
0
Java error Native Library already loaded in another classloader <p>I'm using the java bonjour library (dns_sd.jar) in a web application running in Jboss web server.</p> <p>When I start the server a Servlet finds every resource on the network with bonjour and returns to the user. The first time everything runs great but when I redeploy the web app I get:</p> <p>java.lang.UnsatisfiedLinkError: Native Library C:\Windows\System32\jdns_sd.dll already loaded in another classloader</p> <p>I already tried deletting the .dll and the samething happens.</p> <p>Why does it even refer the .dll if I have the .jar lib in my web app?</p> <p>Does anyone have any idea on how to fix this?</p>
37,195,467
0
Unable to Access Public Variables - Excel VBA <p>I am working on a rather large Excel application via VBA. I want to place all my public variables in one module. Then I would assign and use those variables in my other modules in the same workbook. Here's what I have.</p> <pre><code>Option Explicit Public wdApp As Word.Application Public wdDoc As Word.Document </code></pre> <p>But when I tried to assign those variables in my other modules, I got the following message. Shouldn't public variables be accessible to all modules? What am I missing?</p> <p><a href="https://i.stack.imgur.com/q1te0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q1te0.png" alt="enter image description here"></a></p>
16,028,380
0
2D NSString array usage inside block method <p>Why am I not able to use this?</p> <pre><code>__block NSString *tableStrings[4][2]; [userValues enumerateObjectsUsingBlock:^(NSNumber *userScore, NSUInteger idx, BOOL *stop) { tableStrings[idx][0] = @"&lt; 5"; tableStrings[idx][1] = @"&gt; 95"; }]; </code></pre> <p>The compiler is yelling at me of <code>"Cannot refer to declaration with an array type inside block"</code>. I was under the impression that denoting <code>__block</code> before the variable would allow this to be done. I can make it work with using <code>NSString[x][x]</code> but I'm curious as to why this is not allowed. </p>
2,930,233
0
<p>FILTER_VALIDATE_FLOAT does not accept a range option. Check the <a href="http://www.php.net/manual/en/filter.filters.validate.php" rel="nofollow noreferrer">doc</a>.</p>
13,821,949
0
Proguard does not obfuscate gui components <p>I would like to use ProGuard to obfuscate my Android app. This works fine. But my gui classes, which extends acitvity, view and sherlockactivity are not obfuscated. Here is the proguard.cfg</p> <pre><code>-injars bin/classes -injars libs -outjars bin/classes-processed.jar -libraryjars C:/Users/android-sdks/platforms/android-17/android.jar -dontpreverify -dontoptimize -repackageclasses '' -allowaccessmodification -optimizationpasses 5 -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -keepattributes *Annotation* -dontwarn sun.misc.Unsafe -dontwarn com.actionbarsherlock.** -dontwarn com.google.common.** -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.view.View -keep public class * extends android.view.ViewGroup -keep public class * extends android.support.v4.app.Fragment -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } -keepclassmembers class android.support.v4.app.Fragment { *** getActivity(); public *** onCreate(); public *** onCreateOptionsMenu(...); } -keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock { public &lt;init&gt;(...); } -keepclasseswithmembers class * { public &lt;init&gt;(android.content.Context, android.util.AttributeSet); } -keepclasseswithmembers class * { public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int); } -keep public class * extends android.view.View { public &lt;init&gt;(android.content.Context); public &lt;init&gt;(android.content.Context, android.util.AttributeSet); public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int); public void set*(...); } -keepclassmembers class * implements android.os.Parcelable { static android.os.Parcelable$Creator CREATOR; } -keepclassmembers class **.R$* { public static &lt;fields&gt;; } -keepclassmembers class com.brainyoo.brainyoo2android.ui.html.BYJavaScriptInterface { public *; } </code></pre> <p>First, I thought activities can´t be obfuscated because of the reflection call</p> <pre><code>myactivity.class </code></pre> <p>I've tried to add:</p> <pre><code>- keep public class mypackege.myactivity.class </code></pre> <p>But it does not solve the problem. Any ideas how to obfuscate the gui elements?</p> <p>Thanks Christine</p>
34,075,001
0
<p>I had the same problem, except my cause was that I was attempting to pass an integer (Int32) as a web service parameter. It looks like web service parameters in SSIS should always be strings.</p>
39,380,697
0
<p>you can use the overloaded method of toArray() .. like this -</p> <pre><code>double[][] remainingStockout = new double[array.length][array.length]; stockout.toArray(remainingStockout); </code></pre>
16,072,877
0
<p>I am not claiming this is how to do it, but it seems to work, and would appreciate any opinions. Thanks</p> <pre><code>DELIMITER $$ CREATE PROCEDURE `createRecord` () BEGIN IF NEW.created_by_user IS NULL OR NEW.created_by_user = '' THEN SET NEW.created_by_user = @users_id; END IF; IF NEW.modified_by_user IS NULL OR NEW.modified_by_user = '' THEN SET NEW.modified_by_user = @users_id; END IF; END$$ CREATE PROCEDURE `modifyRecord` () BEGIN IF NEW.modified_by_user = OLD.modified_by_user THEN SET NEW.modified_by_user = @users_id; END IF; END$$ CREATE TRIGGER tg_notes_upd BEFORE UPDATE ON notes FOR EACH ROW BEGIN CALL createRecord(); END$$ CREATE TRIGGER tg_notes_ins BEFORE INSERT ON notes FOR EACH ROW BEGIN CALL modifyRecord(); END$$ DELIMITER ; </code></pre>
29,189,599
0
<p>It's not clear what you mean by "issues distinguishing between AM and PM". Is it that you enter a time in the afternoon, e.g. 12pm, then add minutes and it becomes am? That's because minutesAdded() is using the number of minutes to determine whether it's the morning or evening. You would be better off calculating the time -- meaning the whole time, hours and minutes, not just minutes -- before printing out the time. You have made a start with</p> <pre><code>nTime = minutes + addedMinutes; </code></pre> <p>but don't stop there. As long as the accumulated minutes value is >= 60, you have to take off 60 minutes and bump the hours up by one. Not just once. If you add 122 minutes, you have to take TWO lots of 60 minutes off. Does that sound like a while loop? No, not unless you want the teacher to laugh at your code! Look up the operators for division and remainder. You're trying to do the calculation and the output in one step. That's difficult. Work out the value first, then print it afterwards.</p> <p>Oh, and by the way, don't forget about what happens if you add 200 minutes to 23:00...</p> <p>When you are working out the time after adding the minutes, why do you not use the hours and minutes variables? If you add some minutes to your time, the time should be changed, meaning the minutes and/or hours members should be updated. </p> <p>You should have a method to add the minutes -- not to read the amount to be added, and then print out the time with the minutes added, just a method to add the minutes.</p> <pre><code>void Time::incrementMinutes(int nMinutes) { ...the code to update hours and minutes variables correctly is left as an exercise... } </code></pre> <p>Then after you have got addedMinutes from cin, call</p> <pre><code>incrementMinutes(addedMinutes); </code></pre> <p>Then you could make a method to print the time, printTime() which sends the time to cout. That would then be used by minutesAdded() and by militaryClock(), so you don't have to worry in BOTH places about all the conditions for whether it's AM or PM. You only have to get that right in printTime().</p> <p>Now, about the structure of your program.</p> <p>First, the constructor should construct the object, set everything in it. It gets called automatically when an instance is constructed, to set up the whole instance. It's not the way to just set one field. Please write a different method to set the minutes to 0 if you are not constructing a Time object. </p> <p>Maybe setMinutes was to have been that method. But setMinutes() is</p> <pre><code>void Time::setMinutes() { this -&gt; minutes = minutes; } </code></pre> <p>That doesn't do anything. Within the method of an object, the member name refers to the member of the object (unless overridden by the same name in a closer scope). So within this function, 'minutes' means the same as 'this->minutes'. </p> <p>Maybe you intended something like this instead?</p> <pre><code>void Time::setMinutes(int newMinutes) { minutes = newMinutes; } </code></pre> <p>That would at least set this->minutes to a certain value. Then, to set minutes to 0, you don't call Time(), you call setMinutes(0).</p> <p>Finally, you can tell cout to use 2 characters for minutes, by piping setw(2) before the number; you can tell it to use the value '0' for the extra character by piping in setfill('0'). You have to #include to get this stuff. So </p> <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; using namespace std; int main() { cout &lt;&lt; setfill('0') &lt;&lt; setw(2) &lt;&lt; 1 &lt;&lt; ":" &lt;&lt; setw(2) &lt;&lt; 2 &lt;&lt; endl; } </code></pre> <p>will output 01:02 The setfill('0') means any padding will be done with '0'; the setw(2) means the single next thing output will be padded to 2 chars.</p> <p>Hope that helps... without doing your homework for you...</p>
10,882,207
0
<p>You can do that :</p> <pre><code>$('#btnDining').css({'cursor':'pointer'}).on('click', function(e){ var src = $(this).attr('src'); src = (src.indexOf('off.png')!=-1)?src.replace("_off","_on"):src.replace("_on","_off"); $(this).attr('src', src); }); </code></pre> <p>And I think, it's a more readable way..</p>
14,770,370
0
Jquery css compare background-colour value <p>I have an <code>img</code>. On click it checks the background color of its parent and toggles the background color to grey if it is white and to white if it is grey. here k have value that is rgb(255,255,255) (white) but the if loop sud be excuted but else part executed... means if is not working... here in my code what happens when i execute it .... it only exectes only if part sometimes and when i change something it only exectes else part .... even if condition do not satisfy... like it should make grey when white and white when it is grey... but it did not.... i want to ask the condition which i have used ... is it correct...</p> <pre><code>function havetotha(it) { var k = $(it).parent().css('background-color'); $('#message').html(k); if (k == 'white') { $(it).parent().css('backgroundcolor','grey'); } else { $(it).parent().css('backgroundcolor','white'); } } </code></pre> <p>i figured it out ...</p> <p>in if in condition i was comparing ($(it).parent().css('background-color')=="rgb(255,255,255)").... where rgb(255,255,255) is string but $(it).parent().css('background-color') it is not string so.... i used a trick i made two divs one with grey backgroun and other with white.... and compared there background with the my elements .... it works just take very long time to get into my mind..</p>
20,890,030
0
MVC5 aspnet.identity + FLASH user authentication <p>I'm looking for example or idea how to manage user authentication in FLASH with MVC5 ASP.NET identity using internal accounts and external logins (facebook etc.).</p> <p>I know that there are examples for simplemembership and that there are problems with FLASH automatic authentications. But i can't find nothing about MVC5 :(.</p> <p>Authentication itself will be made by ASP.NET pages. I want /<em>only</em>/ a FLASH app to be able to use authenticated session when making server reuqests.</p> <p>Flash app is used to edit some data and save to DB on server side (MVC5) so it must be safe and allowed only for certain authenticated user.</p> <p><strong>What is the safest way to authenticate user in FLASH app placed on MVC5 page?</strong> </p>
21,948,559
0
<p>You are inserting a String as parameter to the setOpacity method, which only takes doubles.</p>
17,767,456
0
Array counting Error <p>I am trying to count from the following associative array in two's key->value filter, by Key-gender and Key-rname, Please see below ...</p> <pre><code>&lt;pre&gt; Array ( [0] =&gt; Array ( [fname] =&gt; jone [lname] =&gt; jani [gender] =&gt; m [rname] =&gt; N ) [1] =&gt; Array ( [fname] =&gt; jani [lname] =&gt; jone [gender] =&gt; m [rname] =&gt; N ) [2] =&gt; Array ( [fname] =&gt; sara [lname] =&gt; bulbula [gender] =&gt; w [rname] =&gt; D ) [3] =&gt; Array ( [fname] =&gt; hani [lname] =&gt; hanu [gender] =&gt; w [rname] =&gt; P ) [4] =&gt; Array ( [fname] =&gt; ttttttt [lname] =&gt; sssssss [gender] =&gt; m [rname] =&gt; C ) ) &lt;/pre&gt; </code></pre> <p>What i want the result is as follows..</p> <pre> rname gender m w N 2 0 D 0 1 P 0 1 C 1 0 total 3 2 </pre> <p>Some help please? </p>
33,491,879
0
<p>Firstly, I think there might be some misunderstanding in the term 'inject'.</p> <p>Inject means this:</p> <pre><code>public class UserService { MyContext _db; public UserService(MyContext db) { _db = db; } public void GetUserById(string id) { _db.Users.First(x =&gt; x.Id = id); } } </code></pre> <p>Instead of this:</p> <pre><code>public class UserService { MyContext _db = new MyContext(); public UserService() { } public void GetUserById(string id) { _db.Users.First(x =&gt; x.Id = id); } } </code></pre> <p>Notice how in the first example <code>MyContext</code> is 'injected' into the constructor. In the second example, <code>UserService</code> itself creates a new instance of <code>MyContext</code>.</p> <p>Now, should you? I believe you should, and in fact, it is an accepted good practice. Before you do, make sure to read and try it on a few sample projects to find out the benefits it brings you. <a href="https://en.wikipedia.org/wiki/Dependency_injection#Advantages" rel="nofollow">Wikipidia: Dependency Injection Advantages</a></p>
27,154,522
0
<p>Basically JAXRS is just an API, there are several implementation of this API, the most commonly used is Jersey, RESTEasy, CXF, <a href="http://www.infoq.com/news/2008/10/jaxrs-comparison" rel="nofollow">[comparison]</a>, check <a href="http://programmers.stackexchange.com/questions/155467/selecting-a-jax-rs-implementation-for-a-new-project">this</a> </p> <p>Add the end you need to consider declare a servlet like this.</p> <pre><code>&lt;web-app&gt; &lt;servlet&gt; &lt;servlet-name&gt;MyApplication&lt;/servlet-name&gt; &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt; &lt;init-param&gt; ... &lt;/init-param&gt; &lt;/servlet&gt; ... &lt;servlet-mapping&gt; &lt;servlet-name&gt;MyApplication&lt;/servlet-name&gt; &lt;url-pattern&gt;/myApp/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; ... &lt;/web-app&gt; </code></pre> <p>This will start loading the Jersey implementation and its components. Consider read this <a href="https://jersey.java.net/documentation/latest/user-guide.html#deployment.servlet" rel="nofollow">section</a>, depending the version of Servlet that you are using it could be little bit different.</p>
32,508,759
0
<p>It appears this is a JDK bug and it looks like this could be fixed by updating your JDK, what version are you currently on?</p> <p>It looks like <a href="https://issues.apache.org/jira/browse/CASSANDRA-8220" rel="nofollow">CASSANDRA-8220</a> (C* 2.2.1+, and 3.0.0-alpha1) was introduced to work around the problem, but I think upgrading your JDK should fix this as well.</p>
13,167,610
0
<p>I think you can iterate through the character check if that is vowel or not as below:</p> <pre><code> define a new string for(each character in input string) //("aeiou".indexOf(character) &lt;0) id one way to check if character is consonant if "aeiou" doesn't contain the character append the character in the new string </code></pre>
29,570,248
0
Change page styles Android WebView <p>I'm currently working on a small application that simply loads one webpage into webview and I want to be able to make this webpage look different while browsing using this application..</p> <p>This page uses one .css and I want to use my own version of that .css instead of the original one or just replace part of the original with mine (by using the original and then overwriting it with my version)..</p> <p>Is it possible to modify source code of the page (optionaly before it even loads) so I can change some styles to make the webpage look different?</p> <p>Just to explain: I want change <code> &lt;link rel="stylesheet" type="text/css" href="original.css"&gt; </code> to <code> &lt;link rel="stylesheet" type="text/css" href="original.css"&gt; &lt;link rel="stylesheet" type="text/css" href="http://www.something.com/edited.css"&gt;</code></p> <p>I'm using Xamarin Studio, C# Android WebView project, by the way.. Also, this is very likely going to be called duplicate of this: <a href="http://stackoverflow.com/questions/23770023/override-web-page-style-in-android-webview">Override web page style in Android WebView</a> but it was never answered so it's not very helpful for me..</p>
30,466,358
0
<p>I ended up recreating the affected views after swapping two items. A class variable would tell the getView() function when the views should be recreated</p>
10,950,023
0
<p>LeadTools and VisioForge SDKs are just wrappers for DirectShow + some custom filters from them! There is no real alternativ to DirectShow for capturing on a Windows PC. Maybe on Win8 with MediaFoundation? Some Hardware Vendors have there own capture programms, but most of them just use DirectShow.</p> <p>I think your problem is not DirectShow. How long is your callback working? Because if your doing some analysis on the image, then you need to do this fast. Not the time in your callback is importent, but the presentation time in the mediasample you get! This should be +33ms from the previews sample.</p>
20,721,988
0
background is gone when <p>I want my application will be more smoothly and I read that <code>hardware_acceleraton</code> could be a solution.</p> <p>So I turn on <code>hardware_acceleraton = true</code> and my background image just gone and only appearing black background.</p> <p>Do I have to do another thing or what is wrong here? </p>
12,406,232
0
Fancybox iframe type return value on close <p>I'm using fancxbox,it is possible to pass back a variable from fancybox child to parent.</p> <p>In the child page there is text field called <code>banner_width1</code> (<code>&lt;input name="banner_width" id="banner_width1" type="text" size="5" value="1000"/&gt;</code>)</p> <pre><code>'onClosed':function() { alert($("#banner_width1").val()); var x = $("#fancybox-frame").contentWindow.targetFunction(); alert(x.val()); } </code></pre>
21,798,931
0
<p>By default, WordPress filters the title and body of all posts through <a href="http://codex.wordpress.org/Function_Reference/wptexturize" rel="nofollow"><code>wptexturize</code></a>. Among other typographical niceties, this transforms various sequences of standard ASCII hyphens into appropriate dashes, e.g. " -- " is transformed into an <a href="https://en.wikipedia.org/wiki/Dash#Em_dash" rel="nofollow">em-dash</a>.</p> <p><code>wptexturize</code> is run by WordPress through the filters <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference/the_title" rel="nofollow"><code>the_title</code></a> and <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content" rel="nofollow"><code>the_content</code></a>. You can remove it -- code adapted from <a href="http://wordpress.stackexchange.com/questions/60379/how-to-prevent-automatic-conversion-of-dashes-to-ndash">this answer</a> -- by, for example:</p> <pre><code>remove_filter( 'the_title', 'wptexturize' ); </code></pre> <p>...in your theme's <code>functions.php</code>, say, or from within plugin code.</p> <p>However, I'd suggest that this will (a) make your titles not look as nice (you'll lose smart quotes, nice dashes, etc.), and (b) not be very future-proof. If something else starts filtering your titles -- a new plugin, a different theme -- then you'll be back with database mismatches.</p> <p>My approach would therefore be to adjust your existing code to use the post ID rather than the title. That's an integer, will never change, is never filtered, and will be faster to look up in the database (not just because it's an integer, but also because there's a unique index on it.) </p>
14,704,883
0
<p>AdSupport.framework available only in iOS6+, so you won't be able to find it in XCode version prior to 4.5</p> <p><strong>UPD:</strong></p> <p>According to AdMob 6.2.0 changelog:</p> <ul> <li>Required to use Xcode 4.5 and build against iOS 6. The minimum deployment is iOS 4.3.</li> </ul>
40,685,916
0
<p>You have to use a Graph operation:</p> <pre><code>a = tf.placeholder(tf.float32, shape=(None, 3072)) b = tf.shape(a)[0] </code></pre> <p>returns</p> <pre><code>&lt;tf.Tensor 'strided_slice:0' shape=() dtype=int32&gt; </code></pre> <p>while <code>b = a.get_shape()[0]</code> returns</p> <pre><code>Dimension(None) </code></pre>
11,774,258
0
Is there a shortcut way that I can set up fields of an object with javascript or jQuery? <p>I have the following code:</p> <pre><code>obj = new Object(); obj.close = close; obj.$form = $form; obj.action = $form.attr('data-action') obj.entity = $form.attr('data-entity') obj.href = $form.attr('data-href'); obj.rownum = $link.attr('data-row'); obj.$row = $('#row_' + obj.rownum); obj.$submitBt = $('.block-footer button:contains("Submit")'); </code></pre> <p>Is there some way that I could combine this into one assignment with jQuery? </p>
18,616,083
0
Why does my MVC 4 Project Partially Run on Production IIS 7 Server <p>We have a ASP.NET MVC 4 project containing a number of controllers, models and views. </p> <p>On our development server a Windows Standard 2008 (x64) the project is deployed/published and it runs fine. </p> <p>However, when we try to publish the project to our live production server running a Windows Web 2008 x64 the MVC pages appear to partially load, but when we try to make calls to the controller it appears that it is failing. </p> <p>It is very difficult for me to give more information, since I don't know where to trap the error or how to diagnose the problem.</p> <p>Any help would be greatly received.</p>
11,596,360
0
Troubleshooting: Extending the jQuery Sortable With Ajax & MYSQL <p>I'm trying to implement an ajax tutorial I found at <a href="http://linssen.me/entry/extending-the-jquery-sortable-with-ajax-mysql/" rel="nofollow">http://linssen.me/entry/extending-the-jquery-sortable-with-ajax-mysql/</a></p> <p>The tutorial allows for click-and-drag sortable bullet lists...where each item's position is updated in the database. </p> <p>There's an info box that shows what changes have supposedly been made, but there are no changes made to the database. </p> <p>I've gone over the tutorial a hundred times and I have no idea what could be the problem.</p> <p>I could use a second pair of eyes.</p> <p>process-sortable.php</p> <pre><code>&lt;?php foreach ($_GET['listItem'] as $position =&gt; $item) : $sql[] = "UPDATE `user_feeds` SET `feed_order` = $position WHERE `feed_id` = $item"; endforeach; print_r ($sql); ?&gt; </code></pre> <p>index.php</p> <pre><code>&lt;?php require_once('../php/includes/simplepie.inc'); require_once('../php/includes/newsblocks.inc'); include "../base.php"; $userid = $_SESSION['UserID']; ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;jQuery Sortable With AJAX &amp;amp; MYSQL&lt;/title&gt; &lt;script type="text/javascript" src="jquery-1.3.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery-ui-1.7.1.custom.min.js"&gt;&lt;/script&gt; &lt;link rel='stylesheet' href='styles.css' type='text/css' media='all' /&gt; &lt;script type="text/javascript"&gt; // When the document is ready set up our sortable with it's inherant function(s) $(document).ready(function() { $("#test-list").sortable({ handle : '.handle', update : function () { var order = $('#test-list').sortable('serialize'); $("#info").load("process-sortable.php?"+order); } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;pre&gt; &lt;div id="info"&gt;Waiting for update&lt;/div&gt; &lt;/pre&gt; &lt;ul class="tabs userfeeds" id="test-list"&gt; &lt;?php $feed_results = mysql_query("SELECT feed_id, feed_title, feed_order, feed_page_id FROM user_feeds WHERE ((feed_owner = '" . $_SESSION['UserId'] . "') AND (feed_page_id = '" . $pageid . "')) ORDER BY feed_order ASC;"); $tabcounter = 1; while($row = mysql_fetch_array($feed_results)) { echo "&lt;li id='listItem_"; echo $row[feed_id]; echo "' &gt;"; echo $row[feed_title]; echo "&lt;img src='arrow.png' alt='move' width='16' height='16' class='handle' /&gt;&lt;/li&gt;"; $tabcounter++; } ?&gt; &lt;/ul&gt; &lt;form action="process-sortable.php" method="get" name="sortables"&gt; &lt;input type="hidden" name="test-log" id="test-log" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
12,457,346
0
<p>You will not be able to retrieve a plain text password from wordpress.</p> <p>Wordpress use a 1 way encryption to store the passwords using a variation of md5. There is no way to reverse this.</p> <p>See this article for more info <a href="http://wordpress.org/support/topic/how-is-the-user-password-encrypted-wp_hash_password">http://wordpress.org/support/topic/how-is-the-user-password-encrypted-wp_hash_password</a></p>
7,556,724
0
<p>Have you tried removing the ContentType header and adding it after : </p> <p><a href="http://i2.iis.net/ConfigReference/system.webServer/httpProtocol/customHeaders" rel="nofollow">http://i2.iis.net/ConfigReference/system.webServer/httpProtocol/customHeaders</a></p> <p>I have never done that with app_offline.htm but might work.</p>
32,223,076
0
<p>You really should not be calling asynchronous functions inside a synchronous loop. What you need is something that repects the callback on completion of the loop cycle and will alert when the update is complete. This makes incrementing counters externally safe.</p> <p>Use something like <a href="https://github.com/caolan/async#whilsttest-fn-callback" rel="nofollow">async.whilst</a> for this:</p> <pre><code>var i = 0; async.whilst( function() { return i &lt; req.body.app_events.length; }, function(callback) { console.log(req.body.app_events[i].event_key); //delete upsertData._id; Appusers.findOneAndUpdate( { app_key: req.body.app_key, e_key:req.body.app_events[i].event_key}, { $set : { app_key:req.body.app_key, e_key: req.body.app_events[i].event_key, e_name: req.body.app_events[i].event_name } }, { upsert: true}, function(err,data) { if (err) callback(err); console.log(data); i++; callback(); } ); }, function(err) { if (err) console.log(err); else // done; } ); </code></pre> <p>Now the loop is wrapped with a "callback" which is called in itself within the callback to the update method. Also if you expect a "document" back then you should be using <code>.findOneAndUpdate()</code> as <code>.update()</code> just modifies the content and returns the number affected.</p> <p>When the loop is complete or when an error is passed to the callback, then handling is moved to the last function block, where you complete your call or call other callbacks as required.</p> <hr> <p>Better than above. Dig into the native driver methods for <a href="http://docs.mongodb.org/manual/reference/method/Bulk/" rel="nofollow">Bulk</a> operations. You need to be careful that you have an open connection to the database already established. If unsure about this, then try to always wrap application logic in:</p> <pre><code>mongoose.connection('once',function(err) { // app logic here }); </code></pre> <p>Which makes sure the connections have been made. The mongoose methods themselves "hide" this away, but the native driver methods have no knowledge.</p> <p>But this is the fastest possible listing to update the data:</p> <pre><code>var i = 0; var bulk = Appusers.collection.initializeOrderedBulkOp(); async.whilst( function() { return i &lt; req.body.app_events.length; }, function(callback) { console.log(req.body.app_events[i].event_key); bulk.find( { app_key: req.body.app_key, e_key:req.body.app_events[i].event_key}, ).upsert().updateOne({ $set : { app_key:req.body.app_key, e_key: req.body.app_events[i].event_key, e_name: req.body.app_events[i].event_name } }); i++; if ( i % 1000 == 0) { bulk.execute(function(err,response) { if (err) callback(err); console.log(response); bulk = Appusers.collection.initializeOrderedBulkOp(); callback(); }) } else { callback(); } }, function(err) { if (err) console.log(err); else { if ( i % 1000 != 0 ) bulk.execute(function(err,response) { if (err) console.log(err) console.log(response); // done }); else // done } } ); </code></pre> <p>The Bulk methods build up "batches" of results ( in this case 1000 at a time ) and send all to the server in one request with one response ( per batch ). This is a lot more efficient than contacting the database once per every write.</p>
35,497,226
0
Class 'PhpOffice\PhpWord\Settings' not found in app/code/core/Mage/Core/Model/Config.php on line 1348 <p>After upgraded to PHP 7, my website magento print order using PhpWord library not working.</p> <p>I have this error: </p> <p>Cannot use PhpOffice\PhpWord\Shared\String as String because 'String' is a special class name in /home/.../vendor/phpoffice/phpword/src/PhpWord/Style/Paragraph.php</p> <p>Then I using lastest PhpOffice/PhpWord and PhpOffice/Common but it's showing next error: </p> <p>Fatal error: Class 'PhpOffice\PhpWord\Settings' not found in /app/code/core/Mage/Core/Model/Config.php on line 1348</p> <p>Can you help me solve this error?</p> <p>Thanks.</p>
20,507,239
0
Having problems replacing data in array <p>For a project I have to do, I have to list a set of classes, have the user select which class to use, and print out a weekly schedule for them for the semester. (Same program as the first question I asked.) However, I seem to run into a problem when I try to print out a weekly schedule. (The program is pretty lengthy, at least with the experience I have in C.)</p> <pre><code>struct course { int index; char name[7]; char day[4]; int hours,houre,mins,mine; char ap[3]; int credit; }; struct course whcl[]={ {0,"MATH1","MWF",7,8,30,50,"AM",5}, {1,"MATH2","MWF",9,10,00,20,"AM",5}, {2,"CHEM1","MW ",2,6,30,50,"PM",5}, {3,"PHYS4","TTH",4,6,00,45,"PM",4}, {4,"ENGR1","M ",9,10,30,20,"AM",1}, {5,"ENGR2","TTH",10,12,00,15,"PM",3}, {6,"ENGR3","MW ",11,12,00,15,"PM",3}}; int choice[15],i,j,k,num,z,s; void printout(int z); //(To be put in when I fix the function) int main(void) { char l[8][3]={{"st"},{"nd"},{"rd"},{"th"},{"th"},{"th"},{"th"},{"th"}}; printf(" Fall Schedule\n"); printf("Index Course Day Time Credit\n"); printf("-------------------------------------------\n"); for(i=0;i&lt;7;i++) { printf(" %i %s %s %i%i:%i%i-%i%i:%i%i%s %i\n", whcl[i].index,whcl[i].name,whcl[i].day, whcl[i].hours/10,whcl[i].hours%10, whcl[i].mins/10,whcl[i].mins%10, whcl[i].houre/10,whcl[i].houre%10, whcl[i].mine/10,whcl[i].mine%10, whcl[i].ap,whcl[i].credit); } printf("How many classes would you like to take?: "); scanf("%i",&amp;num); for(i=0;i&lt;num;i++) { printf("Select the %i%s class using the index: ",i+1,l[i]); scanf("%i",&amp;choice[i]); } printf("The classes you have selected are:\n"); printf("Index Course Day Time Credit\n"); printf("-------------------------------------------\n"); for(i=0;i&lt;num;i++) { s=choice[i]; printf(" %i %s %s %i%i:%i%i-%i%i:%i%i%s %i\n", whcl[s].index,whcl[s].name,whcl[s].day, whcl[s].hours/10,whcl[s].hours%10, whcl[s].mins/10,whcl[s].mins%10, whcl[s].houre/10,whcl[s].houre%10, whcl[s].mine/10,whcl[s].mine%10, whcl[s].ap,whcl[s].credit); } printf("Your weekly schedule for Fall is:\n"); printf(" Time Monday Tuesday Wednesday Thursday Friday\n"); printout(z); return 0; } void printout(int z) { int start,starti,end,endi,num; int slot[25][6]; for(i=0;i&lt;24;i++) for(j=0;j&lt;5;j++) slot[i][j]=99; for(i=0;i&lt;num;i++) { if ((whcl[choice[i]].day)=="MWF")//I think the problem is here. { start=whcl[choice[i]].hours*60+whcl[choice[i]].mins; end=whcl[choice[i]].houre*60+whcl[choice[i]].mine; starti=(start-450)/30; endi=(end-450)/30; for(j=starti;j&lt;=endi;j++) slot[j][1]=slot[j][3]=slot[j][6]=whcl[choice[i]].index; } } for(i=0;i&lt;24;i++) { printf("%i%i:%i%i-%i%i:%i%i ", (450+(i-1)*30)/60/10,(450+(i-1)*30)/60%10, (450+(i-1)*30)%60/10,(450+(i-1)*30)%60%10, (450+(i-1)*30+30)/60/10,(450+(i-1)*30+30)/60%10, (450+(i-1)*30+30)%60/10,(450+(i-1)*30+30)%60%10); for(j=0;j&lt;4;j++) { if (slot[i][j]!=99) //Use Note here printf(" %s ",whcl[choice[i]].name); else printf(""); } printf("\n"); } return; } </code></pre> <p>When I print out the schedule, the only thing that comes up is the time. Everything else is blank. I think it's due to my trying to replace the slot array with something other than 99. If you plan on running this program, please use 2 the amount of classes you want to take, and use 0 and 1 for the index on the class choice. (I don't have any if statements and whatnot to take into account the other classes the user might have chosen.) Here's a photo of what I'm trying to do for my program. <a href="http://postimg.org/image/3tlgtwu9h/" rel="nofollow">http://postimg.org/image/3tlgtwu9h/</a> I used paint to put in the boxes on the schedule to visually see the different arrays as I was coding.</p> <p>Note: If you change the if statement to [i][j]==99 You can see the "Class" being printed on the table, however it fills up the entire array slot, which confirms my thought that I messed up on trying to replace data in the array. Also, I filled it up with 99 to make 99 associated with blank spaces.</p>
1,911,805
0
Search email inbox using javax.mail <p>I was trying to see if there was a way to search an email inbox from javax.mail. Say I wanted to send a query and have the it return emails to us. Can we parse returned HTML and extract data. Also, if the above is possible how would I "translate" those messages returned by that server to POP3 messages? E.g. we have extracted:</p> <pre><code>Subject: Foo Body: Bar </code></pre> <p>but to open same message using POP3 I need to know it's POP3 uid, or number. I don't think we'll be able to get UID but perhaps we can figure out the number.</p> <p>I guess the question is:</p> <p>Can I send a query to email server (such as Hotmail or Yahoo) and get returned emails?</p>
31,957,052
0
<p>put this theme in your manifest file in application Tag</p> <p>android:theme="@android:style/Theme.Black.NoTitleBar"</p>
12,853,626
0
<p>Place your <code>.htaccess</code> in <code>/rs</code> folder and try</p> <pre><code>RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]*)/?$ index.php?page=$1 [L] </code></pre> <p>Hope this will help</p>
610,501
0
<p>If you are looking for a gallery application I recommend the open source project '<a href="http://gallery.menalto.com/" rel="nofollow noreferrer">Gallery2</a>'.</p>
26,218,850
0
<p>It sounds like the projects exists on the file system in the workspace directory, but the actual project got deleted or never imported in the eclipse workspace. Take a look at the workspace directory, all three projects should be there. You can delete the "missing" project from the file system and reimport it again.</p>
22,021,311
0
<pre><code>$s = get-content YourFileName | Out-String $a = $s.ToCharArray() $a[0..103] # will return an array of first 104 chars </code></pre> <p>You can get your string back the following way, the replace removes space char( which is what array element separators turn into)</p> <pre><code>$ns = ([string]$a[0..103]).replace(" ","") </code></pre>
30,817,100
0
<p>All the problems boil down to the fact that the following declaration</p> <pre><code>slist&lt;int&gt; L; </code></pre> <p>throwed the error that</p> <p><code>slist</code> was not declared in this scope</p> <p>You need to make sure <code>slist</code> is declared in your scope. <code>include</code> the necessary headers.</p>
20,634,387
0
<p>You should change this to before_save, that way you can change the model's attributes, and then they will be saved to the database as normal. </p> <pre><code>class Slot include Mongoid::Document before_save :calculate_period def calculate_period if condition #do something end end end </code></pre>
32,425,006
0
<p>That's because when the <code>JTextField</code> is shown, the <code>mouseExited()</code> method is immediately called. Then of course the <code>JLabel</code> is shown again and this loops while you keep moving the mouse.</p> <p>The following works:</p> <pre><code> jl.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent evt) { cl.show(jp, "2"); } }); jtf.addMouseListener(new MouseAdapter() { public void mouseExited(MouseEvent evt) { cl.show(jp, "1"); } }); </code></pre>
27,225,755
1
Converting list of strings to floats and add 1 <p>I have parsed my input to this list:</p> <pre><code>lst = ['6,3', '3,2', '9,6', '4,3'] </code></pre> <p>How to change this list of strings to a list of floats? While the numbers that are nw strings are not seperated by a . but by a ,</p> <p>After that i would like to add 1 to every float. So that the ouput becomes:</p> <pre><code>lst = [7.3, 4.2, 10.6, 5.4] </code></pre>
25,763,592
0
Symmetric Encryption isn't working <p>I am trying to generate cipher text and decrypted data. I already have assigned my incrypted value and key. But when I run the program in netbeans it shows error in the execution area, but no cipher text and decrypted data is produced.</p> <p>Encryption.java:</p> <pre><code>package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Encryption { private static byte[] message; public static void main(String[] args) throws Exception { byte[] message = {0, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 2, 3, 8, 9}; byte[] key = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4}; byte[] ciphertext; byte[] decrypted; Sender s = new Sender(); s.send(message); Receiver r = new Receiver(); r.receive(message); // TODO code application logic here } } </code></pre> <p>Sender.java:</p> <pre><code>package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Sender { private Cipher encoder; private SecretKeySpec myKey; public Sender() throws Exception { encoder = Cipher.getInstance("AES"); } public void setKey(byte[] key) throws Exception { myKey = new SecretKeySpec(key, "AES"); encoder.init(Cipher.ENCRYPT_MODE, myKey); } public byte[] send(byte[] message) throws Exception { return encoder.doFinal(message); } } </code></pre> <p>Receiver.java:</p> <pre><code>package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Receiver { private Cipher decoder; private SecretKeySpec myKey; public Receiver()throws Exception{ decoder=Cipher.getInstance("AES"); } public void setKey(byte[] key) throws Exception{ myKey= new SecretKeySpec(key ,"AES"); decoder.init(Cipher.DECRYPT_MODE, myKey); } public byte[] receive(byte[] message) throws Exception{ return decoder.doFinal(message); } } </code></pre>
37,655,373
0
<p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort"><code>Array#sort</code></a> with <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs"><code>Math.abs()</code></a>.</p> <pre><code>arr.sort((a, b) =&gt; Math.abs(a - num) - Math.abs(b - num)); </code></pre> <p>Using ES5 Syntax for older browsers</p> <pre><code>arr.sort(function(a, b) { return Math.abs(a - num) - Math.abs(b - num); }); </code></pre> <p>To consider negative numbers too, don't use <code>Math.abs()</code>.</p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var arr = [10, 45, 69, 72, 80]; var num = 73; var result = arr.sort((a, b) =&gt; Math.abs(a - num) - Math.abs(b - num));; console.log(result);</code></pre> </div> </div> </p>
29,073,150
0
<p>These subprograms (functions and procedures) are probably not what you want them to be: they are declared within the <code>Polynomials</code> package, but do not reference the type <code>Polynomial</code> at all.</p> <p>Apart from that, your question is easily answered: <code>POLYNOMIO</code> is not a tagged type, so object.function notation does not work. You should call type.function instead, i.e. <code>Polynomials.times (q)</code>.</p> <p>I would guess that you are using experience (or some pre-written code) from a language like C++ or Java. There, the functions (methods) belong to the class/type and take an implicit parameter to an instance of that class. This is not the case in Ada: the functions belong to the <em>package</em>, and you have to add a parameter yourself, e.g. </p> <pre><code>function times (p: Polynomial; b: Integer) return Integer; </code></pre> <p>(Shouldn't it return a Polynomial?)</p> <p>A question: why do you declare two similar types, <code>Polynomials.Polynomial</code> and <code>Polynomials_Test.POLYNOMIO</code>?</p>
6,855,829
0
<p>As you've noticed, system() waits for the other process. Internally, it forks() another process, that calls exec() to run your batch file and the original process waits. If you can't use CPAN then you can call fork() and exec() yourself and just not wait for the child process to finish.</p> <p>Read these first:</p> <ul> <li><a href="http://perldoc.perl.org/perlipc.html" rel="nofollow">http://perldoc.perl.org/perlipc.html</a></li> <li>perldoc -f fork</li> <li>perldoc -f exec</li> </ul> <p>Pay attention to the bit about signals and zombie processes. Once you've understood how it works it's simple enough.</p> <p>If your batch file generates output you need to process in your perl then you can use open() to create a pipe to it (perldoc -f open).</p> <p>Similar questions have been asked before:</p> <p><a href="http://stackoverflow.com/questions/799968/whats-the-difference-between-perls-backticks-system-and-exec">What&#39;s the difference between Perl&#39;s backticks, system, and exec?</a></p>
31,296,079
0
<p>Try <code>&lt;script src="/resources/js/controller.js"&gt;&lt;/script&gt;</code></p>
40,261,298
0
<p>If you only need the title try:</p> <pre><code>try { final Document document = Jsoup.connect("www...").get(); for (Element row : document.select("div#si-title")) { System.out.println(row.text()); } } catch (IOException e) { e.printStackTrace(); } </code></pre> <p>If you need more values of the <code>stat-item</code> try this:</p> <pre><code>try { final Document document = Jsoup.connect("www...").get(); for (Element statItem : document.select("div#stat-item")) { for (Element child : statItem.children()) { System.out.println(child.attr("class") +" = " +child.text()); } } } catch (IOException e) { e.printStackTrace(); } </code></pre>
38,063,055
0
fibers install not possible on ubuntu 14.04 <p>When I try to install fibers, I get this errormessage.</p> <p>I have Node version 0.10.45 for the use Meteor 1.3.2 on Ubuntu 14.04 64 Bits on a Strato VPS.</p> <p>When I do a <code>meteor build</code> I need to run <code>npm install fibers</code> inside of <code>programs/server</code> of the build output. But I have no chance installing fibers as I get this output. I have not found anything yet about that problem on the web.</p> <pre><code>sudo npm install -g fibers &gt; [email protected] install /usr/local/lib/node_modules/fibers &gt; node build.js || nodejs build.js (...) make: Entering directory `/usr/local/lib/node_modules/fibers/build' CXX(target) Release/obj.target/fibers/src/fibers.o g++: internal compiler error: Bus error (program as) (...) make: *** [Release/obj.target/fibers/src/fibers.o] Error 4 make: Leaving directory `/usr/local/lib/node_modules/fibers/build' (...) gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12) gyp ERR! System Linux 3.13.0-042stab111.12 gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" gyp ERR! cwd /usr/local/lib/node_modules/fibers (...) Ubuntu users please run: `sudo apt-get install g++` Alpine users please run: `sudo apk add python make g++` npm ERR! Linux 3.13.0-042stab111.12 npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "fibers" npm ERR! node v0.10.45 npm ERR! npm v3.10.2 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! [email protected] install: `node build.js || nodejs build.js` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the [email protected] install script 'node build.js || nodejs build.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the fibers package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node build.js || nodejs build.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs fibers npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls fibers npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /home/keller/repos/rmt-app/npm-debug.log </code></pre>
857,042
0
<p>I'd be very wary of published software protection mechanisms, as they are much more likely to have published hacks. You are probably better off using some of the techniques to get a unique persistent ID and use this to roll your own protection mechanism. I also think that it is a poor idea to simple check the license whenever you run the program, as this leads the hacker to the location of your proection mechanism. IMO, your are better checking the license in a more random fashion, and more than once per session.</p> <p>FWIW, I use hardware locks (hasp) for my high end desktop software, and device ID based licensing on mobile solutions. If you are selling small quantities of high cost software in a vertical market, IMHO, a good license protection mechanism makes sense, and hardware dongles work well. My experience has been that people will use more licenses than they purchase if this is not in place. For high volume, low cost software, I'd tend to live with the piracy based on increasing the size of the user base and product visibility.</p>
245,297
0
<p>Subversion is like `a better CVS'. It handles moving files AND directories well. It has branching support, although that is inferior to Distributed VCSs.</p> <p>You may also consider using a distributed VCS one like git, bazaar or mercurial.</p> <p>Edit: Here is a <a href="http://stackoverflow.com/questions/1261/what-are-the-advantages-of-using-svn-over-cvs">link to a similar question</a></p>