pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
28,591,521
0
<p>Check the following tutorial, it appears to be for the latest version of TinyMCE (and it is updated recently).</p> <p><a href="https://www.gavick.com/blog/wordpress-tinymce-custom-buttons" rel="nofollow noreferrer">https://www.gavick.com/blog/wordpress-tinymce-custom-buttons</a></p> <p>The tutorial you linked is probably for the TinyMCE that was in WordPress prior to 3.9.</p> <p>Edit: Did a quick test. Seems to be working. :)</p> <p><img src="https://i.stack.imgur.com/axm32.jpg" alt=""></p> <hr> <p>A quick guide to get it working:</p> <ol> <li>Open <a href="https://www.gavick.com/blog/wordpress-tinymce-custom-buttons#tmce-section-1" rel="nofollow noreferrer">https://www.gavick.com/blog/wordpress-tinymce-custom-buttons#tmce-section-1</a></li> <li>Paste the four codes of php in your functions.php file</li> <li>Replace <code>plugins_url( '/text-button.js', __FILE__ );</code> with <code>get_bloginfo('stylesheet_directory') . /text-button.js</code> (might need adjusting if the file is in a subdirectory).</li> <li>Paste the javascript code from the fifth block in the javascript file you created.</li> </ol> <p>(note this is just a quick example for implementing it in a <strong>theme</strong> so you can get the main idea, if you are actually building a plugin, you should use the <code>plugins_url( '/text-button.js', __FILE__ )</code> syntax).</p> <p><a href="http://codex.wordpress.org/Function_Reference/plugins_url" rel="nofollow noreferrer">http://codex.wordpress.org/Function_Reference/plugins_url</a></p>
22,457,647
0
<p>WMS draw works fine but you have to implement a Proxy for downloading WMS tiles using AJAX. See the PHP proxy example of html2canvas for the implementation details of the "proxy" (which is not a http proxy".</p>
23,283,640
0
Is my code below secure enough to be used in production? <p>What is the best practice to securely upload an image to a php script based on my code below? I'm using the file transfer cordova plugin to upload the image to a php script.</p> <p>Javascript (file transfer cordova plugin)</p> <pre><code>var options = new FileUploadOptions(); options.fileKey = "file"; options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1); options.mimeType = "image/jpeg"; var params = new Object(); params.imageLink = "test"; options.params = params; options.chunkedMode = false; var ft = new FileTransfer(); ft.upload(imageURI, "http://example.com/upload.php", win, fail, options); alert("Post Uploading"); function win(r) { console.log("Code = " + r.responseCode); console.log("Response = " + r.response); console.log("Sent = " + r.bytesSent); alert(r.response); } function fail(error) { $.mobile.loading('hide'); navigator.notification.alert("An error has occurred: Code = " + error.code, null, 'Alert', 'OK'); } </code></pre> <p>PHP</p> <pre><code>&lt;?php if(isset($_POST['imageLink'])) { $imageLink = $_POST['imageLink']; print_r($_FILES); $new_image_name = $imageLink.".jpg"; move_uploaded_file($_FILES["file"]["tmp_name"], “uploads/“.$new_image_name); } ?&gt; </code></pre> <p>Any suggestions?</p>
38,679,399
0
<p>When you create your documents, you must set the creation date:</p> <pre><code>MyCollection.insert({ text: "abc", createdAt: new Date() }); </code></pre> <p>then, you can filter your data:</p> <ol> <li><p>If you want the documents created in an interval:</p> <p><code>MyCollection.find( {createdAt: { $gte: new Date("Sat Jul 30 2016 8:00:00"), $lt: new Date("Sat Jul 30 2016 9:00:00"), }}, {sort: {createdAt:1}});</code></p></li> <li><p>Or documents created exactly at 8am:</p> <p><code>MyCollection.find({createdAt: new Date("Sat Jul 30 2016 8:00:00")});</code></p></li> </ol> <p>Hope it helps.</p>
10,093,352
0
<p>You can use <code>product</code> from <code>itertools</code> module.</p> <pre><code>itertools.product(range(3), range(2)) </code></pre>
7,097,691
0
<p>the second and fourth query do not have an ending ')' at the end of the values</p>
33,482,444
0
<p>I think this could help you. Defining your values directly as arrays, and representing them with a foreach loop. It's more like the way mysql_fetch_array represents the records obtained from the database.</p> <pre><code>$values = []; $values[] = [1, "A", "red"]; $values[] = [2, "B", "blue"]; $values[] = [3, "C", "yellow"]; $values[] = [4, "D", "orange"]; echo '&lt;table&gt;'; foreach ($values as $value) { echo '&lt;tr&gt;'; echo '&lt;td&gt;'.$value[0].'&lt;/td&gt;'; echo '&lt;td&gt;'.$value[1].'&lt;/td&gt;'; echo '&lt;td&gt;'.$value[2].'&lt;/td&gt;'; echo '&lt;/tr&gt;'; } echo '&lt;/table&gt;'; </code></pre>
36,826,687
0
<p>The problem is you didn't implement <code>getItemId()</code>. You are calling the superclass implementation, which simply returns the same value for all positions.</p> <p>At the very least, you can do this:</p> <pre><code>@Override public long getItemId(int position) { return position; } </code></pre> <p>But if your data items actually have meaningful IDs, you should return the ID of the item instead.</p> <pre><code>@Override public long getItemId(int position) { return rinfoList.get(position).getId(); } </code></pre>
13,231,433
0
gnuplot label not displayed <p>I have lots of files to generate a plot for and therefore wrote a little script for gnuplot. I want to add additional information with a label underneath the graph but my label is not displayed on the generated image. Anyone gut an idea?</p> <p>load.plt:</p> <pre><code># template.gnuplot set terminal png filename = "results-05112012-".i.".dat" plotfile = "results-05112012-".i.".png" print filename." ".plotfile set grid set title "EER"" set output plotfile set label "m = 20" at 0, 3 front tc rgb "#ffffff" plot[0.35:0.75][0:100] filename using 1:6 title "FAR" w lp, filename using 1:7 title "FRR" w lp unset output unset label i=i+1 if(i &lt;= n) reread </code></pre>
13,607,556
0
<p>The problem was a bit tricky but I manage to solve it.</p> <p>The fact is: <em>if a real postback is not executed</em> (responding with a file is not considered so) the value <em>is still considered "changed"</em>.</p> <p>The only way to solve this problem seems to be "resetting" manually the value of the hiddenfield.</p> <p>I came up with this:</p> <pre><code>self.getExcel = function (stringBase64) { $("#hiddenFiedlName").val(stringBase64); __doPostBack(); $("#hiddenFieldName").val(""); } </code></pre> <p>After the postback the value is restored to the initial one (which is always the empty string). By doing this the "ValueChanged" event is not triggered.</p> <p>As stated in the comment of jbl the <code>change()</code> was useless (please refer to his comment in the question).</p>
28,782,331
0
I have a customized form but whatever written on the form is not saved in database <p><img src="https://i.stack.imgur.com/NuemA.png" alt="enter image description here">I have a form that uses styles of twitter/bootstrap however the content of the form is not saved. May I please know what am I missing?</p> <pre><code> &lt;%= form_for @customer_detail, url: { action: "create" } do |f| %&gt; &lt;div class="form-group"&gt; &lt;div class="row"&gt; &lt;div class='col-sm-3'&gt; &lt;label for="Check in"&gt;Check in:&lt;/label&gt;&lt;br&gt; &lt;div class='input-group date' id='datetimepicker1'&gt; &lt;input class="form-control" type='text'&gt; &lt;span class="input-group-addon"&gt;&lt;span class= "glyphicon glyphicon-calendar"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt;&lt;label for="Check out"&gt;Check out:&lt;/label&gt;&lt;br&gt; &lt;div class='col-sm-3'&gt; &lt;div class='input-group date' id='datetimepicker2'&gt; &lt;input class="form-control" type='text'&gt; &lt;span class="input-group-addon"&gt;&lt;span class= "glyphicon glyphicon-calendar"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>
17,705,693
0
Scala - replace xml element with specific text <p>so i have this XMl</p> <pre><code>&lt;a&gt;blah&lt;/a&gt; </code></pre> <p>And i want to change it to </p> <pre><code>&lt;a&gt;someValueIDoNotKnowAtCompileTime&lt;/a&gt; </code></pre> <p>Currently, I am looking at <a href="http://stackoverflow.com/q/970675/1061426">this SO question</a> . However, this just changes the value to "2"</p> <p>What i want is exactly the same thing, but to be able to define the value (so that it can change at runtime - i am reading the values from a file!)</p> <p>I tried passing the value into the overridden methods, but that didn't work - compile errors everywhere (obviously)</p> <p>How can i change static xml with dynamic values?</p> <p><strong>ADDING CODE</strong></p> <pre><code>var splitString = someString.split("/t") //where someString is a line from a file val action = splitString(0) val ref = splitString(1) xmlMap.get(action) match { //maps the "action" string to some XML case Some(entry) =&gt; { val xmlToSend = insertRefIntoXml(ref,entry) //for the different XML, i want to put the string "ref" in an appropriate place } ... </code></pre>
16,201,109
0
<p>There must be trouble with your click event for your links. It might be a good idea to just make a function responsible for doing whatever action (back/forward), then call that whenever you need it.</p>
17,716,880
0
cannot SetBackground Resource image for android buttons <p>I want button with two states:</p> <ol> <li>OFF </li> <li>ON(or click).</li> </ol> <p>I have set normal image in the button background and I am trying to change image(pressed) from <code>onClick</code> method, but it doesn't change.</p> <pre><code>final Button button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { private int flag; @Override public void onClick(View v) { if(flag==1) { button1.setBackgroundResource(R.drawable.on); flag=0; } if(flag==0) { button1.setBackgroundResource(R.drawable.off); flag=1; } } }); </code></pre>
10,949,691
0
<ul> <li>Don't forget the <em>bootstrap-tooltip.js</em>, which is <a href="http://twitter.github.com/bootstrap/javascript.html#popovers" rel="nofollow">required for popover</a>. </li> <li>Only add the <code>data-content</code> attributes to the <em>new</em> <code>&lt;li&gt;</code>. </li> <li>The selector for popover should be for the <code>&lt;li&gt;</code>s and remove parameter <code>options</code>, if you don't initialize it. </li> <li>I would move the icons into <code>&lt;i&gt;</code> like in the <a href="http://twitter.github.com/bootstrap/base-css.html#icons" rel="nofollow">bootstrap description</a>. </li> <li>I've added some styling rules.</li> </ul> <p>The final html could be:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"&gt; &lt;style type='text/css'&gt; ul { list-style: none inside none; margin: 0; } li { display: inline; } &lt;/style&gt; &lt;script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'&gt;&lt;/script&gt; &lt;script type='text/javascript' src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tooltip.js"&gt;&lt;/script&gt; &lt;script type='text/javascript' src="http://twitter.github.com/bootstrap/assets/js/bootstrap-popover.js"&gt;&lt;/script&gt; &lt;script type='text/javascript'&gt; $(document).ready(function() { $('li').popover(); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h3&gt;category_name&lt;/h3&gt; &lt;ul&gt; &lt;li&gt; &lt;i class="icon-minus"&gt;&lt;/i&gt; &lt;a href="newGenView.php?id=1"&gt;name1 - description1&lt;/a&gt;&lt;br /&gt; &lt;/li&gt; &lt;li data-content="This item is new on Corkboard. Check it out!" data-original-title="New Item"&gt; &lt;i class="icon-star"&gt;&lt;/i&gt; &lt;a href="newGenView.php?id=2"&gt;name2 - description2&lt;/a&gt;&lt;br /&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Also see <a href="http://jsfiddle.net/cFzeA/" rel="nofollow">this example</a>.</p>
23,416,410
0
<p>I have found the solution. The problem was that I was trying to use the adapter to get an reference to the views above and below the list item clicked. Instead I could find the appropriate views by using the getChildAt() method on the parent view (the listview itself).</p> <p>It was as easy as writing:</p> <pre><code>View aboveView = parent.getChildAt(position -1) View aboveViewShadow = aboveView.findViewById(R.id.settingsListRowShadowAbove); aboveViewShadow.setVisibility(View.VISIBLE); </code></pre>
20,204,537
0
<p>Ugh. As simple as this:</p> <pre><code>infixl 1 |&gt;= (|&gt;=) = flip fmap findFiles target = getDirectoryContents target |&gt;= filter (not . (=~ "[0-9]{8}\\.txt$")) |&gt;= filter (=~ "\\.txt$") &gt;&gt;= filterM doesFileExist &gt;&gt;= mapM canonicalizePath </code></pre>
27,646,512
0
<p>copy .ssh folder of C:\Users{Administrator}.ssh to git's working directory</p>
39,343,607
0
Better way to handle common headers and root? <p>Is there a better way to set bearer like a global config rather than setting it each time like this:</p> <pre><code>restClient.setBearerAuth(TokenStore.getInstance().getLocalToken()); </code></pre> <p>The same for root url, is there a global config rather than setting it like this:</p> <pre><code>String root= Application.getInstance().getApplicationContext().getResources().getString(R.string.whiteLabelApiBaseHost) restClient.setRootUrl(root); </code></pre> <p>In retrofit, there is something like this:</p> <pre><code>Retrofit retrofit = new Retrofit.Builder() .baseUrl(Application.getInstance().getApplicationContext() .getResources().getString(R.string.whiteLabelApiBaseHost)) </code></pre> <p>Any idea?</p>
19,965,144
0
<p>Your idea is wrong.</p> <p>DocBook is logical markup. Presentation matters are defined in stylesheets.</p>
18,432,005
0
<p>This looks like a bug in <a href="http://search.cpan.org/dist/XML-Schematron/" rel="nofollow">XML::Schematron</a>. The following line in docbook.sch is not taken into account:</p> <pre><code>&lt;s:ns prefix="db" uri="http://docbook.org/ns/docbook"/&gt; </code></pre> <p>The validation is done by turning the schema into an XSLT stylesheet. I was able to make the error go away by adding the DocBook namespace declaration in the XSLTProcessor.pm module:</p> <pre class="lang-pl prettyprint-override"><code>$self-&gt;append_template( qq|&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;xsl:stylesheet $ns version="1.0" xmlns:db="http://docbook.org/ns/docbook"&gt; &lt;xsl:output method="text"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:apply-templates select="/" mode="$mode"/&gt;| ); </code></pre> <p>The above is just a hack. A proper fix (which I haven't attempted) should of course work for any namespace declared in a Schematron schema.</p>
38,390,423
0
<p>Try by giving margins and padding to enlarge view</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="1dp" android:weightSum="1"&gt; &lt;TextView android:id="@+id/itemLabel" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.6" android:background="#00ffff" android:layout_margin="20dp" android:padding="10dp" android:gravity="center_vertical" android:text="Settings Item: " android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@android:color/holo_blue_dark"/&gt; &lt;EditText android:id="@+id/et_item_value" android:layout_margin="20dp" android:layout_width="0dp" android:padding="10dp" android:layout_height="match_parent" android:layout_weight="0.4" android:background="#ffff00" android:textColor="@android:color/holo_blue_dark" android:textColorHint="@android:color/darker_gray"/&gt; &lt;/LinearLayout&gt; </code></pre>
26,012,730
0
Running time of Construction Heuristic in OptaPlanner <p>I am using the OptaPlanner to optimize a chained planning problem which is similar to the VehicleRoutingExample. My planning entities have a planning variable which is another planning entity.</p> <p>Now I am testing a huge dataset with ca. 1500 planning entities. I am using an EasyJavaScoreCalculator to get a HardSoftScore. The Score includes several time and other factors which are calculated in loops. </p> <p>My Problem is that the ConstrucionHeuristic (FIRST_FIT or FIRST_FIT_DECREASING) takes more than ten minutes to initialize a Solution.</p> <p>I have already reduced the number of constraints and the number of loops with which I am calculating the score, but it did not have a real effect on the running duration.</p> <p>Is there a way to make the CH need less time? (I thought that it would take less time than the LocalSearch stuff but it isn’t…)</p>
37,034,208
0
$_request ["request"] in a restful api <p>I am learning to program a restful api and I am confused about some code in this tutorial.</p> <p><a href="http://coreymaynard.com/blog/creating-a-restful-api-with-php/" rel="nofollow">http://coreymaynard.com/blog/creating-a-restful-api-with-php/</a></p> <p>They used </p> <p><code>$_REQUEST["request"]</code> </p> <p>for the request uri. I am trying to understand the reason why I'd do this instead of </p> <p><code>$_SERVER["request_uri"]</code></p>
12,344,038
0
What caused my splitter to move? <p>I've got an issue that's doing my head in. I have a .net usercontrol with a splitcontainer control on it. The .net usercontrol is actually hosted in a control container in much older non .net legacy code (Visual Objects).</p> <p>The problem I'm having is that I'm getting a splitter_moved event firing on the splitcontainer control when the usercontrol is presented to the user, but I'm at a loss to find what's causing it to actually move. I've come across a number of curious behaviours with this interaction between the VO code and .net stuff, but I've got several other usercontrols embedded in VO container controls that work just fine. It's just this particular one that seems to be having a problem.</p> <p>The VO container controls are all identical. So are the .net usercontrols that are embedded in them (they all inherit from the same base class). This is why I'm having so much difficulty in understanding why it's just this one.</p> <p>I guess what I really want to know is how to determine what caused the splitter to move inside the splitcontainer control. The sender and eventargs aren't much help, because they all just refer to the splitcontainer control (obviously).</p> <p>Help??</p> <p>EDIT: The call stack from within the splitter_moved event handler is as follows:</p> <pre><code>00000072 0.26412687 Method: Void splitContainerMain_SplitterMoved(System.Object, System.Windows.Forms.SplitterEventArgs) 00000073 0.26649699 Method: Void OnSplitterMoved(System.Windows.Forms.SplitterEventArgs) 00000074 0.26906940 Method: Void set_SplitterDistance(Int32) 00000075 0.27223459 Method: Void ApplySplitterDistance() 00000076 0.27425244 Method: Void ResizeSplitContainer() 00000077 0.27621472 Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs) 00000078 0.27813032 Method: Void PerformLayout(System.Windows.Forms.LayoutEventArgs) 00000079 0.28007442 Method: Void System.Windows.Forms.Layout.IArrangedElement.PerformLayout(System.Windows.Forms.Layout.IArrangedElement, System.String) 00000080 0.28211826 Method: Void DoLayout(System.Windows.Forms.Layout.IArrangedElement, System.Windows.Forms.Layout.IArrangedElement, System.String) 00000081 0.28451827 Method: Void OnResize(System.EventArgs) 00000082 0.28713536 Method: Void OnSizeChanged(System.EventArgs) 00000083 0.28970191 Method: Void UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32) 00000084 0.29425862 Method: Void UpdateBounds() 00000085 0.29450893 Method: Void WmWindowPosChanged(System.Windows.Forms.Message ByRef) 00000086 0.29477015 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000087 0.29508862 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000088 0.29539761 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000089 0.29568058 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000090 0.29596806 Method: Void OnMessage(System.Windows.Forms.Message ByRef) 00000091 0.29627341 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000092 0.29659048 Method: IntPtr Callback(IntPtr, Int32, IntPtr, IntPtr) 00000093 0.29688439 Method: Boolean SetWindowPos(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32, Int32) 00000094 0.29714754 Method: Void SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified) 00000095 0.29755905 Method: Void SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified) 00000096 0.29781467 Method: Void System.Windows.Forms.Layout.IArrangedElement.SetBounds(System.Drawing.Rectangle, System.Windows.Forms.BoundsSpecified) 00000097 0.29814151 Method: Void xLayoutDockedControl(System.Windows.Forms.Layout.IArrangedElement, System.Drawing.Rectangle, Boolean, System.Drawing.Size ByRef, System.Drawing.Rectangle ByRef) 00000098 0.29844967 Method: System.Drawing.Size LayoutDockedControls(System.Windows.Forms.Layout.IArrangedElement, Boolean) 00000099 0.29872790 Method: Boolean xLayout(System.Windows.Forms.Layout.IArrangedElement, Boolean, System.Drawing.Size ByRef) 00000100 0.29901370 Method: Boolean LayoutCore(System.Windows.Forms.Layout.IArrangedElement, System.Windows.Forms.LayoutEventArgs) 00000101 0.29931039 Method: Boolean Layout(System.Object, System.Windows.Forms.LayoutEventArgs) 00000102 0.29965651 Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs) 00000103 0.29993618 Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs) 00000104 0.30027559 Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs) 00000105 0.30064937 Method: Void PerformLayout(System.Windows.Forms.LayoutEventArgs) 00000106 0.30087790 Method: Void System.Windows.Forms.Layout.IArrangedElement.PerformLayout(System.Windows.Forms.Layout.IArrangedElement, System.String) 00000107 0.30116984 Method: Void DoLayout(System.Windows.Forms.Layout.IArrangedElement, System.Windows.Forms.Layout.IArrangedElement, System.String) 00000108 0.30157101 Method: Void OnResize(System.EventArgs) 00000109 0.30196688 Method: Void OnResize(System.EventArgs) 00000110 0.30212274 Method: Void OnSizeChanged(System.EventArgs) 00000111 0.30244765 Method: Void UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32) 00000112 0.30264741 Method: Void UpdateBounds() 00000113 0.30294549 Method: Void WmWindowPosChanged(System.Windows.Forms.Message ByRef) 00000114 0.30337656 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000115 0.30359614 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000116 0.30389002 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000117 0.30451524 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000118 0.30456889 Method: Void OnMessage(System.Windows.Forms.Message ByRef) 00000119 0.30483985 Method: Void WndProc(System.Windows.Forms.Message ByRef) 00000120 0.30507788 Method: IntPtr Callback(IntPtr, Int32, IntPtr, IntPtr) 00000121 0.30540919 Method: Boolean SetWindowPos(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32, Int32) 00000122 0.30566931 Method: Void SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified) 00000123 0.30598581 Method: Void SetBounds(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified) 00000124 0.30637357 Method: Void set_Height(Int32) 00000125 0.30679765 Method: Void ContainerCtrl.ResizeForm(ContainerCtrl*, WTL.CRect) 00000126 0.30718428 Method: Int32 ContainerCtrl.OnSize(ContainerCtrl*, UInt32, UInt32, Int32, Int32*) 00000127 0.30755892 Method: Int32 ContainerCtrl.ProcessWindowMessage(ContainerCtrl*, HWND__*, UInt32, UInt32, Int32, Int32*, UInt32) 00000128 0.30793831 Method: Int32 ATL.CDialogImplBaseT&lt;ATL::CWindow&gt;.DialogProc(HWND__*, UInt32, UInt32, Int32) 00000129 0.30838418 Method: Int32 ATL.CAxDialogImpl&lt;ContainerCtrl,ATL::CWindow&gt;.DialogProc(HWND__*, UInt32, UInt32, Int32) 00000130 0.30881271 Method: Int32 SetWindowPos(HWND__*, HWND__*, Int32, Int32, Int32, Int32, UInt32) 00000131 0.30922171 Method: Int32 ATL.CComControlBase.IOleInPlaceObject_SetObjectRects(ATL.CComControlBase*, tagRECT*, tagRECT*) 00000132 0.30961114 Method: Int32 ATL.IOleInPlaceObjectWindowlessImpl&lt;ContainerCtrl&gt;.SetObjectRects(ATL.IOleInPlaceObjectWindowlessImpl&lt;ContainerCtrl&gt;*, tagRECT*, tagRECT*) </code></pre> <p>Edit: Ok, it looks like the resize event on the VO container control is firing on this one when it's shown to the user, but not on the others.</p> <p>Confusing much?!?</p>
80,787
0
Active threads in ExecutorService <p>Any ideas how to determine the number of active threads running in ExecutorService?</p>
19,523,981
0
<p>This appears to be basically a duplicate of <a href="http://stackoverflow.com/questions/52964/sql-server-random-sort/52976#52976">SQL Server Random Sort</a> which is basically a duplicate of <a href="http://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql">How to request a random row in SQL?</a>.</p> <p>The latter has a comprehensive answer for multiple RDBMSs referencing this post:</p> <p><a href="http://www.petefreitag.com/item/466.cfm" rel="nofollow">SQL to Select a random row from a database table</a></p> <p>An answer for Microsoft SQL Server would be:</p> <p>SELECT TOP 10 * FROM table ORDER BY NEWID();</p> <p>This will not perform well on large tables. It scans the entire table, generating a unique number (a 16-bit GUID) for each row, and then sorts the results by that unique number.</p> <p>Simply ordering by RAND() in SQL Server will not result in a random list of records. RAND() is evaluated once at the beginning of the statement, so you are effectively ordering by a constant, which isn't really ordering at all. You'll get the same results without the ORDER BY. Indeed, in my instance of SQL Server 2005, the query plans and results were the same with and without the ORDER BY RAND().</p> <p>RAND() in SQL Server takes a seed value, so you might think that you could pass a varying table column value into the RAND function and get random results. In some sense, you can. You could pass an IDENTITY or other unique column into the RAND function and you won't get the same order as without. And the order will be random in the sense that it appears so to a casual observer. But it's repeatable. The RAND() function in SQL Server will always return the same value for the same seed on the same connection:</p> <p>"For one connection, if RAND() is called with a specified seed value, all subsequent calls of RAND() produce results based on the seeded RAND() call."</p> <p><a href="http://technet.microsoft.com/en-us/library/ms177610.aspx" rel="nofollow">http://technet.microsoft.com/en-us/library/ms177610.aspx</a></p> <p>So while you would get what appeared to be a random list, if you executed it multiple times in the same connection, you would get the same list. Depending on your requirements, that might be good enough.</p> <p>Based on my limited tests on a small table, the RAND with a unique column seed had a very slightly lower estimated query cost.</p>
19,979,525
0
<p>You'll need to make the messages in your application use a custom form. That form will need to show the message as well as have the check box. Then you'll want to store that information somewhere. I'm going to say in the application configuration file.</p> <p>So, to save the data in the configuration file, first build a few extension methods to make it easier:</p> <pre><code>public static class Extensions { public static void SetValue(this KeyValueConfigurationCollection o, string key, string val) { if (!o.AllKeys.Contains(key)) { o.Add(key, val); } else { o[key].Value = val; } } public static string GetValue(this NameValueCollection o, string key, object defaultVal = null) { if (!o.AllKeys.Contains(key)) { return Convert.ToString(defaultVal); } return o[key]; } } </code></pre> <p>Then, when you want to read that value to determine if you ought to show the message, do this:</p> <pre><code>var val = (bool)ConfigurationManager.AppSettings.GetValue("ShowTheMessage"); </code></pre> <p>and then when you want to save the value, do this:</p> <pre><code>var config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); var app = config.AppSettings.Settings; app.SetValue("ShowTheMessage", checkBox.Checked); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); </code></pre>
15,371,413
0
How to convert a SPARQL query into an RDF file in Jena? <p>I am trying to output an RDF/XML file directly from an SPARQL query from an Oracle database. The query is working fine as I've verified the results in the ResultSet object.</p> <p>However, I'm not sure how to proceed from there. I think I want to create a Statement for each QuerySolution and then add it to the Model. However I can't figure out a way to do it, because I can't find a way to get the predicate value. </p> <p>Any help would be appreciated, as well as hints whether I am going down the right path.</p> <pre><code>QueryExecution qe = QueryExecutionFactory.create(query, oracleSemModel) ; ResultSet results = qe.execSelect(); Model model = ModelFactory.createDefaultModel(); while (results.hasNext()) { QuerySolution result = results.next(); Resource subject = result.getResource("s"); // get the subject Property predicate = result.getProperty("p"); // &lt;-- THIS FUNCTION DOESN'T EXIST RDFNode object = result.get("o"); // get the object Statement stmt = ResourceFactory.createStatement(subject, predicate, object); model.add(stmt); } model.write(System.out, "RDF/XML-ABBREV"); </code></pre>
28,530,996
0
<p>The short answer is no. Welcome to the the fun and exiting world of 1991:) VBA is a subset of VB6. Inheritance was not supported at that time, and because Microsoft based VBA on VB6 and then abandoned* it when they went to .Net, that means it likely never will be:(</p> <p>*They did update it somewhat to cope w/64 bit API calls, but that was pretty much it.</p>
21,949,630
0
<p>Say you have two versions of the gem <code>foo</code> installed:</p> <pre><code>$ gem list foo *** LOCAL GEMS *** foo (2.0.1, 2.0.0) </code></pre> <hr> <p>If you use only <code>require</code>, the newest version will be loaded by default:</p> <pre><code>require 'foo' # =&gt; true Foo::VERSION # =&gt; "2.0.1" </code></pre> <hr> <p>If you use <code>gem</code> before calling <code>require</code>, you can specify a different version to use:</p> <pre><code>gem 'foo', '2.0.0' # =&gt; true require 'foo' # =&gt; true Foo::VERSION # =&gt; "2.0.0" </code></pre> <hr> <p><strong>Note</strong>: using <code>gem</code> without subsequently calling <code>require</code> does not load the gem.</p> <pre><code>gem 'foo' # =&gt; true Foo::VERSION # =&gt; NameError: uninitialized constant Foo </code></pre>
10,218,609
0
<p>The Android Open Source Project is your friend. You can make your own build of the stock Android Gallery app and implement this feature yourself.</p> <p>Have fun.</p> <p><a href="http://source.android.com/source/downloading.html" rel="nofollow">http://source.android.com/source/downloading.html</a></p>
28,149,552
0
<p>I think with the .tif format you have to use the command </p> <pre><code>[X,map] = imread('imagename.tif') newmap = rgb2gray(map) imshow(X,newmap) </code></pre> <p>Link to online Matlab help where's this exact example: <a href="http://it.mathworks.com/help/matlab/ref/rgb2gray.html" rel="nofollow">RGB to gray</a></p>
21,355,142
0
how to remove index.php?action=show&id=1234 from url on localhost <p>My URL is localhost/merge/Clients/index.php?action=show&amp;id=12 .. all i want to make it like localhost/merge/Clients</p> <pre><code>RewriteEngine on RewriteBase /Clients/ RewriteCond %{THE_REQUEST} ^.*\/index\.php\ HTTP/ RewriteRule ^(.*)index\.php$ /$1 [R=301,NC] </code></pre>
21,548,018
0
Bulk Import Json into Parse.com backend via rest api, almost there <p>Evening all,</p> <p>I just have a quick questions about bulk importing via the rest api. I've tried various methods to automate looping through a file and adding the results to Parse backend without success. One example:</p> <p>curl -X POST \ -H "X-Parse-Application-Id: Removed" \ -H "X-Parse-REST-API-Key: Removed" \ -H "Content-Type: application/json" \ --data '{</p> <pre><code>"requests": [ { "method": "POST", "path": "/1/classes/testnew", "body": { @Posts.json } } ] </code></pre> <p>}' \ <a href="https://api.parse.com/1/batch" rel="nofollow">https://api.parse.com/1/batch</a></p> <p>I've tried many other Curl commands and also checking the network tab in parse when uploading a .json file, it looks like when you click the upload it is using the form multipart command to upload the data in a .json file. Does anyone know of a way to automate uploading of data from a .json file into parse without having to manually execute the batch/individual calls as described in the rest api documentation via cUrl?</p> <p>Any help would be seriously appreciated :-).</p> <p>Thanks,</p> <p>Gerard</p>
1,415,446
0
<p>Is the performance due to network latency rather than the approach you're taking? What kind of volumes are you dealing with etc.</p> <p>I note they won't do replication or log shipping but could you talk them in to do doing some scheduled bulk exports which could be compressed and sent across for an automated routine at the other end to do a bulk insert?</p>
35,844,227
0
While loop in shell <p>I am trying to run while loop in shell </p> <pre><code> NODESTATE="0" LOOPC="1" while [ "$NODESTATE" -ne "UP" ]; do echo "node is up " </code></pre> <p>but it is throwing me an error with [: UP: integer expression expected or shoud i use != instead of -ne </p>
9,213,719
0
How to append a RANDOM string to all occurrences of another string in file <p>I'm trying to write a bash script that would modify all occurrences of a certain string in a file. </p> <p>I have a file with a bunch of text, in which urls occur. All urls are in the following format:<code>http://goo.gl/abc23</code> (that's goo.gl/, followed by 4 OR 5 alphanumeric characters).</p> <p>What I'd like do is append a string to all urls. I managed (with the help of user <a href="http://stackoverflow.com/users/34426/dan-fego">Dan Fego</a>) to get this done with sed, but it only works by appending a static string. </p> <p>What I'm looking for is a way to append a <strong>different string to each occurrence</strong>. Let's say I have a function <code>generatestring</code> that echoes a different string every time. I'd like to append a different generated string to each url. <code>http://goo.gl/abc23</code> would become <code>http://goo.gl/abc23?GeneratedString1</code>, <code>http://goo.gl/JB007</code> would become <code>http://goo.gl/JB007?GeneratedString2</code> and so on. </p> <p>Does anyone know if this can be done? I've been told that perl is the way to go, but I have zero experience with perl. That's why I'm asking here.</p> <p>Thanks in advance for any help.</p>
29,332,179
0
<p>Ok thanks to @David Arenburg for his suggestion. I've modified it slightly to arrive at the following for my preferred solution</p> <pre><code> text &lt;- NULL for(i in 1:length(m.names)){ text &lt;- paste0(text, m.names[i], " = ", m.names[i], " + i.", m.names[i], ", ") } expr &lt;- parse(text = paste0("\":=\"(", substr(text, 1, nchar(text)-2), ")" )) res2 &lt;- DT1[data2, eval(expr)] </code></pre>
2,645,871
0
<p>One goal of Groovy is to have transparent interoperability with Java. Groovy is by design "a Java dependent language with scripting features". However, I don't think that these features are minor - Groovy has many features that are not found in static programming languages (such as Java).</p> <p>To summarize: If you don't care at all about Java, then use a more general-purpose scripting language, such as Python or Perl. If you want to use the Java code-base in a script-ish way, Groovy is a good option.</p>
17,193,805
0
<p>As far as there has always to be a selected element, I think that "unselect" option cannot exist (because might provoke cases where no element is selected). The usual proceeding is just selecting other thing. In this case, I guess that selecting any cell would work for you:</p> <pre><code>Range("A1").Select </code></pre> <p>Regarding the creation of the button, first of all, this code is wrong (and is actually triggering an error on my computer). If you want to use <code>Select</code> you have to remove the <code>Set btn =</code> part. Other than that, you have to pass these arguments but can remove the ActiveSheet part as far as it is implicit (it is recommendable to rely on the actual names of the worksheets; but if the situation is "under control" you can rely on ActiveSheet).</p> <pre><code>Set btn = ActiveSheet.Buttons.Add(Columns(7).Left, Rows(2).Top, Columns(1).Width * 2, Rows(1).Height * 2) ActiveSheet.Buttons.Add(Columns(7).Left, Rows(2).Top, Columns(1).Width * 2, Rows(1).Height * 2).Select </code></pre>
30,594,169
0
<p>You're trying to do this:</p> <pre><code>switch (responsegen) { //... } else //... </code></pre> <p>You can't follow a <code>switch</code> statement with an <code>else</code>. <code>switch</code> uses the <code>default</code> clause within its list of cases as a logical "else". (Which you're using already, so what you're doing doesn't even semantically make sense.)</p> <p>Maybe you meant to attach the <code>else</code> to the preceding <code>if</code> block?:</p> <pre><code>if (answer == (num1 * num2)) { //... switch (responsegen) { //... } // &lt;-- first close the switch block } else // &lt;-- then continue the if block //... </code></pre> <p>As you continue learning about programming, you'll find that using consistent and clean use of whitespace (carriage returns, indentation, etc.) makes things like this <em>a lot</em> easier to find.</p>
27,524,018
0
<pre><code> belongs_to :product, touch: true </code></pre> <p>and</p> <pre><code> after_save { product.touch } </code></pre> <p>do the same thing. However touch won't be called on <code>create</code> so you might need to use an <code>after_create</code> callback:</p> <pre><code>after_create :touch_product def touch_product self.product.touch end </code></pre> <p>for update and destroy <code>belongs_to :product, touch: true</code> should be enough.</p> <p>More on <code>touch</code> below this line:</p> <hr> <p><a href="http://apidock.com/rails/ActiveRecord/Persistence/touch" rel="nofollow">http://apidock.com/rails/ActiveRecord/Persistence/touch</a></p> <blockquote> <p>Please note that no validation is performed and only the after_touch, after_commit and after_rollback callbacks are executed.</p> </blockquote> <p>Also as far as I understand the way <code>touch</code> works, is whenever you update/destroy a record, the one in relation will be <code>touch</code>ed and will only save the record with the updated_at/on attributes set to the current time, nothing more than this. </p> <hr> <p>From <strong>Active Record Callbacks</strong> <a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html" rel="nofollow">http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html</a></p> <blockquote> <p>Additionally, an after_touch callback is triggered whenever an object is touched.</p> </blockquote> <p>so you can use this callback in product model to do whatever you need when an <code>image_product</code> will be destroyed/updated.</p> <hr> <p>From <strong>ActiveRecord::Associations::ClassMethods</strong> <a href="http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html" rel="nofollow">http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html</a></p> <blockquote> <p>:touch If true, the associated object will be touched (the updated_at/on attributes set to now) when this record is either saved or destroyed. If you specify a symbol, that attribute will be updated with the current time in addition to the updated_at/on attribute.</p> </blockquote>
26,816,740
0
<p>This is my answer: the key point is forcing an integer as the index of the <code>seen</code> array by adding <code>0</code> to $1, that by appropriate use of ls and FS is guaranteed to be an integer.</p> <p>About taking track of the maximum value, the input <em>should</em> be sorted, but who knows...</p> <h3><em>Edit</em></h3> <p><del><code>ls [0-9][0-9][0-9][0-9].* | awk -F. '</code></del></p> <p>To faithfully take into account the OP request, I've modified the 1st line of my code</p> <pre><code>ls [0-9][0-9][0-9][0-9].{png,jpg} | awk -F. ' /./ { seen[$1+0] = 1; m = $1&gt;m ? $1 : m } END { for(i=0;i&lt;m;i++) { printf( seen[i]? "" : "No file named %4.4d.{png,jpg} in here\n",i)}}' </code></pre>
12,938,327
0
<p>Setting the container to position:relative and the span to 100% seemed to work.</p> <pre><code>.rw-words{ display: block; position: relative; } .rw-words-1 span{ position: absolute; width: 100%; ... } </code></pre> <p><a href="http://jsfiddle.net/willemvb/9Xubs/" rel="nofollow">http://jsfiddle.net/willemvb/9Xubs/</a></p>
19,717,616
0
<p>The fact that you’re using Wine makes no difference in this particular context, which leaves requirements 1 and 2. Requirement 2 –</p> <blockquote> <p>I do not want the process to crash once it exceeds the limit. I want it to use HDD page swap.</p> </blockquote> <p>– is known as limiting the <em>resident set size</em> or <em>rss</em> of the process, and it’s actually rather nontrivial to do on Linux, as is demonstrated by <a href="http://stackoverflow.com/questions/3043709/resident-set-size-rss-limit-has-no-effect">a question asked in 2010</a>. You’ll need to set up <a href="https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt" rel="nofollow">Linux control groups (cgroups)</a>. Fortunately, <a href="http://stackoverflow.com/questions/3043709/resident-set-size-rss-limit-has-no-effect#6365534">Justin L.’s answer</a> gives a brief rundown on how to do so. Note that</p> <ul> <li>instead of <code>jlebar</code>, you should use your own Unix user name, and</li> <li>instead of <code>your/program</code>, you should use <code>wine /path/to/Windows/program.exe</code>.</li> </ul> <p>Using cgroups will also satisfy your other requirements – you can start as many instances of the program as you wish, but only those which you start with <code>cgexec -g memory:limited</code> will be limited.</p>
7,725,822
0
<p>If it were</p> <pre><code>if (mNotification!=null) { mNotification(this, null); } </code></pre> <p>mNotification could be set to null by another thread between <code>if (mNotification!=null)</code> and <code>mNotification(this, null);</code></p>
22,082,547
0
<p>I can think of two and a half pure CSS solutions.</p> <p>First solution requires to wrap all four div's in a container element with <code>position: relative</code> set to it.</p> <p>Then the blue div can be positioned absolutely and forced to inherit the containers/wrappers height (which comes from the total height of the yellow and green div's) like so:</p> <pre><code>position: absolute; top: 0; right: 0; bottom: 0; </code></pre> <p>The width of the blue div can be set explicitly, or with <code>left</code>, depending on how responsive the layout needs to be. And the horizontal space taken up by the blue div can be compensated on the wrapper with <code>padding-right</code>.</p> <p>But no-one really wants extra DOM elements to achieve proper layout, do they.</p> <p>Another option would be to set <code>position: relative</code> on the green div and place the blue div as a child of the green div in the DOM. Then position the blue div so:</p> <pre><code>position: absolute; left: 100%; top: -x; /* Whatever is the height of the top yellow div and margin between*/ bottom: x; /* Whatever is the height of the bottom yellow div and margin between */ width: x; /* Set explicitly for example */ </code></pre> <p>This is possible due to the fact that yellow div's are of fixed height.</p> <p>And extending it further, the entire blue div can be accomplished by the <code>::after</code> pseudo element on the green div (same CSS applies as for the second solution), but it's suitability depends on what the contents of the blue div need to be.</p>
2,087,275
0
Simple clean CMS for programming project website <p>What is the best yet simple CMS for closed-source programming project hosting? I'd like to keep webpage plain and simple, include screenshot, basic features and blog headlines on main page, then have project blog, screenshots gallery, feature list and downloads on separate pages.</p> <p>My goal is somethong between <a href="http://www.videolan.org/vlc/index.html" rel="nofollow noreferrer">http://www.videolan.org/vlc/index.html</a> , <a href="http://www.7-zip.org/" rel="nofollow noreferrer">http://www.7-zip.org/</a> and <a href="http://winmerge.org/" rel="nofollow noreferrer">http://winmerge.org/</a></p> <p>Suitable themes for general-purpose CMSes are welcome too, but I'm affraid Wordpress or Drupal may too complex for such purposes. Or am I wrong? If I am wrong, please do not post "+1 for WP", but please link theme that meets requirements.</p> <p>I'd like to host webpage on my own, so Google Code and similar does not fit.</p>
32,250,351
0
<p>we faced same problem on Galaxy s4 with 5.0 update, after trying many solutions we finally changed protocol of url from http to rtsp (e.g. "<a href="http://some/file/url" rel="nofollow">http://some/file/url</a>" with "rtsp://some/file/url")and it resolved the issue</p>
32,013,700
0
<p>I highly recommend you to use jQuery or a proper JavaScript validator library for your form. Here is a simple example of how you can validate an input field with jQuery.</p> <p>HTML part:</p> <pre><code>&lt;input type="text" id="username"&gt; &lt;input type="button" id="sendForm" value="send"&gt; &lt;p id="usernameError"&gt;&lt;/p&gt; </code></pre> <p>jQuery part:</p> <pre><code>$(function () { $('#sendForm').on("click", function () { validateUserForm(); }); }); function validateUserForm() { var username = $('#username').val(); if (username == '') { $('#usernameError').html('Please insert your username!'); } else { $('#usernameError').html(''); } } </code></pre> <p>And here is a functional jsFiddle: <a href="https://jsfiddle.net/1bk3ufhd/" rel="nofollow">https://jsfiddle.net/1bk3ufhd/</a></p>
6,582,792
0
<pre><code>document.getElementById("theButton").onclick(); </code></pre> <p>Here is an <a href="http://jsfiddle.net/w2Vzu/" rel="nofollow">example fiddle</a>.</p>
37,248,621
0
<p>Please get the HTTP status from the response as below.</p> <pre><code>URL url = new URL("http://example.com"); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET");//Or POST, depending on your service connection.connect(); int code = connection.getResponseCode(); </code></pre> <p>This should return a 401 if your web service is a Restful service.</p>
13,697,945
0
<p>You Can not disable camera in your regular application.but it is possible to disable using admin setting in ICS and higher versions..check it here <a href="http://developer.android.com/guide/topics/admin/device-admin.html" rel="nofollow">http://developer.android.com/guide/topics/admin/device-admin.html</a></p>
28,825,606
0
<p>There's little interest in storing the <code>directory_service</code> object, because it is created without making calls to external APIs.</p> <p>What you should store is the <code>http_auth</code> object, as this one can be costly to generate.</p> <p>In addition, tokens from service accounts can only be requested a certain number of times per second. I do not think the exact limit is documented somewhere but if you try to generate too many tokens from the same service account at the same time you will get a <code>Rate limit exceeded</code> error.</p> <p>The good practice is to store the tokens in some shared storage service. It can be memcache or the Datastore. The Google API client comes with <a href="https://developers.google.com/api-client-library/python/guide/google_app_engine#Storage" rel="nofollow">an App Engine specific <code>StorageByKeyName</code> class</a> that you should use. It is backed by the Datastore and uses Memcache as an optional cache layer.</p>
30,565,072
0
<p>I am not sure whether it is the solution or not,but my value could get and insert each textbox to each particular row without problem, thanks for the help from Peter Campbell and Mairaj Ahmad.</p> <p>hold my transactionNo as following: Dim lblTransactionNo As Label = DirectCast(row.FindControl("lblTransactionNo"), Label) </p> <pre><code>sqlQuery = "Update WebTpay_Trn set RedeemedQuantity = RedeemedQuantity + '" &amp; amtRedeem &amp; "' " sqlQuery = sqlQuery + " WHERE TransactionNo = '" &amp; lblTransactionNo.Text &amp; "' " 'sqlQuery = String.Format("UPDATE WebTpay_Trn set RedeemededQuantity = {0} WHERE webtPay_trn.TransactionNo = {1}", amtRedeem, lbltransactionNo) Dim cmd As SqlCommand = New SqlCommand(sqlQuery, conn) conn.Open() cmd.ExecuteNonQuery() conn.Close() </code></pre>
17,684,793
0
Stacked shield doesn't have enough power -- dim PWR light <p>I'm stacking a <a href="http://www.seeedstudio.com/depot/bluetooth-shield-p-866.html" rel="nofollow">SeeedStudio Bluetooth Shield</a> on top of a <a href="https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG/resources/SHIELD-EKG-EMG.pdf" rel="nofollow">Olimex EKG/EMG Shield</a>.</p> <p>At first, I stacked the two loading only bluetooth shield demo code and all the LEDs lit up brightly and worked fine.</p> <p>Now (having only taken a shield off and put it back on), the lower shield's (Olimex) power LED appears dim and the upper shield (Bluetooth) is not powered at all. The lower shield's power LED brightens when I remove the top shield.</p> <p>Not sure what happened here -- both shields work perfectly if they are the ONLY shield on top of the Arduino. Is there any way for me to check the output voltage coming from the lower shield (Olimex) to the higher shield (Bluetooth) with a multimeter to see if it's sufficient (3.3V)?</p>
19,573,491
0
<p>From the curl manual:</p> <pre><code> -k, --insecure (SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k, --insecure is used. </code></pre> <p>So running without <code>-k</code> might reveal the problem on curl as well.</p>
40,407,307
0
<p>I know this is a bit late but I had a similar problem and I fixed it by adding an <strong>identity</strong> element to the app.config file for the service's endpoint. Example:</p> <pre><code>&lt;identity&gt; &lt;userPrincipalName value="username@domain" /&gt; &lt;/identity&gt; </code></pre> <p>The for me it worked even with an empty value for <strong>userPrincipalName</strong>:</p> <pre><code>&lt;identity&gt; &lt;userPrincipalName value="" /&gt; &lt;/identity&gt; </code></pre> <p>Full endpoint element:</p> <pre><code>&lt;endpoint address="net.tcp://localhost:9876/my-service/tcp" ... &gt; &lt;identity&gt; &lt;userPrincipalName value="" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; </code></pre>
38,820,503
0
Not able to call a web service hosted in Service Fabric <p>I've published a OWIN hosted web service to my remote cluster. I'm using a custom port 4444 created during the cluster creation. I see the AppPort rule for 4444. I'm also able to remote to one of the VM, and invoke the service locally. However, I'm still not able to call it remotely. It hangs for a while and doesn't return anything.</p>
10,059,311
0
<p>Maybe something like this?</p> <pre><code>public TValue RetryHelper&lt;T, TValue&gt;(Func&lt;ObjectSet&lt;T&gt;, TValue&gt; func) where T : class { using (MyEntities dataModel = new MyEntities()) { var entitySet = dataModel.CreateObjectSet&lt;T&gt;(); return FancyRetryLogic(() =&gt; { return func(entitySet); }); } } public User GetUser(String userEmail) { return RetryHelper&lt;User, User&gt;(u =&gt; u.FirstOrDefault(x =&gt; x.UserEmail == userEmail)); } </code></pre>
34,285,530
0
<p>You can do it using <code>IF/ELSE</code> conditions.</p> <p>Try</p> <pre><code>&lt;?php $query = $connection-&gt;query('SELECT * FROM users'); while($r = $query-&gt;fetch()) { if($r['status'] == 1) $r['status'] = 'yes'; if($r['status'] == 0) $r['status'] = 'no'; echo "&lt;tr&gt; &lt;td class=\"danger\"&gt;$r[id]&lt;/td&gt; &lt;td class=\"success\"&gt;$r[username]&lt;/td&gt; &lt;td class=\"warning\"&gt;$r[email]&lt;/td&gt; &lt;td class=\"info\"&gt;$r[status]&lt;/td&gt; &lt;/tr&gt;"; } ?&gt; </code></pre>
17,670,269
0
<p>Try this tutorial: <a href="http://idevzilla.com/2010/10/04/uiscrollview-and-zoom/" rel="nofollow">http://idevzilla.com/2010/10/04/uiscrollview-and-zoom/</a></p> <p>It addresses simple zooming and centering.</p>
29,268,589
0
<p>Use the .on() function for this type of events. Check it out:</p> <pre><code> $(function() { // Clickable Dropdown $('.click-nav &gt; ul').toggleClass('no-js js'); $('.click-nav .js ul').hide(); $('.click-nav .js').click(function(e) { $('.click-nav .js ul').slideToggle(200); $('.clicker').toggleClass('active'); e.stopPropagation(); }); $(".greybox").on("click", "li", function(){ alert("Item Clicked"); /* if ($('.click-nav .js ul').is(':visible')) { alert('test'); $('.click-nav .js ul', this).slideUp(slow); $('.clicker').removeClass('active'); }*/ }); }); </code></pre>
35,002,830
1
Qpython not working right (beginner) <p>Using qpython on on an asus zenpad 10 z300. After troubleshooting what turned out to be a common raw input problem and learning about console mode i felt encouraged. Tried console mode in the editor and it generated this code:</p> <pre><code>#-*-coding:utf8;-*- #qpy:2 #qpy:console print "This is console module" </code></pre> <p>I ran this with no additional code and got this result:</p> <pre><code>/data/data/com.hipipal.qpyplus/files/bin/qpython-android5.sh "/storage/emulated/0/com.hipipal.qpyplus/projects/.last_tmp.py" &amp;&amp; exit hon-android5.sh "/storage/emulated/0/com.hipipal.qpyplus/projects/.last_tmp.py" &amp;&amp; exit &lt; File "/data/data/com.hipipal.qpyplus/files/bin/python-android5", line 1 ELF ^ SyntaxError: invalid syntax 1|u0_a134@P023_1:/ $ </code></pre> <p>Any ideas?</p>
15,336,748
0
Is there a way to add "Postcode" to Sales_Order_Grid in Magento? <p>I am looking for a way to add Shipping or billing postcode to Sales_Order_Grid in magento 1.7</p> <p>I have tried a few different methods but so far the results have either caused an error or a redirect to the main Dashboard when trying to search the custom column.</p> <p>I've created a module to do this but I get an error when trying to access the page:</p> <p>There has been an error processing your request Exception printing is disabled by default for security reasons.</p> <p>Error log record number: 903668493355</p> <pre><code> a:5:{i:0;s:92:"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shipping_postcode' in 'where clause'";i:1;s:6422:"#0 /var/www/mysite.com/htdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo-&gt;_execute(Array) #1 /var/www/mysite.com/htdocs/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql-&gt;_execute(Array) #2 /var/www/mysite.com/htdocs/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement-&gt;execute(Array) #3 /var/www/mysite.com/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;query('SELECT COUNT(*)...', Array) #4 /var/www/mysite.com/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract-&gt;query('SELECT COUNT(*)...', Array) #5 /var/www/mysite.com/htdocs/lib/Zend/Db/Adapter/Abstract.php(825): Varien_Db_Adapter_Pdo_Mysql-&gt;query(Object(Varien_Db_Select), Array) #6 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract-&gt;fetchOne(Object(Varien_Db_Select), Array) #7 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection.php(225): Varien_Data_Collection_Db-&gt;getSize() #8 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection.php(211): Varien_Data_Collection-&gt;getLastPageNumber() #9 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection/Db.php(516): Varien_Data_Collection-&gt;getCurPage() #10 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection/Db.php(563): Varien_Data_Collection_Db-&gt;_renderLimit() #11 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(533): Varien_Data_Collection_Db-&gt;load() #12 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php(61): Mage_Adminhtml_Block_Widget_Grid-&gt;_prepareCollection() #13 /var/www/mysite.com/htdocs/app/code/local/Thaneuk/CustomGrid/Block/Adminhtml/Sales/Order/Grid.php(25): Mage_Adminhtml_Block_Sales_Order_Grid-&gt;_prepareCollection() #14 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(626): Thaneuk_CustomGrid_Block_Adminhtml_Sales_Order_Grid-&gt;_prepareCollection() #15 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(632): Mage_Adminhtml_Block_Widget_Grid-&gt;_prepareGrid() #16 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(862): Mage_Adminhtml_Block_Widget_Grid-&gt;_beforeToHtml() #17 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract-&gt;toHtml() #18 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract-&gt;_getChildHtml('grid', true) #19 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php(77): Mage_Core_Block_Abstract-&gt;getChildHtml('grid') #20 /var/www/mysite.com/htdocs/app/design/adminhtml/default/default/template/widget/grid/container.phtml(36): Mage_Adminhtml_Block_Widget_Grid_Container-&gt;getGridHtml() #21 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/uk-dev...') #22 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('adminhtml/defau...') #23 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView() #24 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template-&gt;_toHtml() #25 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(308): Mage_Adminhtml_Block_Template-&gt;_toHtml() #26 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Widget_Container-&gt;_toHtml() #27 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract-&gt;toHtml() #28 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List-&gt;_toHtml() #29 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract-&gt;toHtml() #30 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract-&gt;_getChildHtml('content', true) #31 /var/www/mysite.com/htdocs/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract-&gt;getChildHtml('content') #32 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/uk-dev...') #33 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('adminhtml/defau...') #34 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView() #35 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template-&gt;_toHtml() #36 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template-&gt;_toHtml() #37 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract-&gt;toHtml() #38 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout-&gt;getOutput() #39 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(95): Mage_Core_Controller_Varien_Action-&gt;renderLayout() #40 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_Sales_OrderController-&gt;indexAction() #41 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action-&gt;dispatch('index') #42 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard-&gt;match(Object(Mage_Core_Controller_Request_Http)) #43 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front-&gt;dispatch() #44 /var/www/mysite.com/htdocs/app/Mage.php(683): Mage_Core_Model_App-&gt;run(Array) #45 /var/www/mysite.com/htdocs/index.php(87): Mage::run('', 'store') #46 {main}";s:3:"url";s:29:"/index.php/admin/sales_order/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";} </code></pre> <p>I anyone able to assist me please as I also need to be able to search the postcode columns to retrieve the correct order data?!?</p> <pre><code> &lt;?php class Thaneuk_CustomGrid_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid { public function __construct() { parent::__construct(); $this-&gt;setId('sales_order_grid'); $this-&gt;setUseAjax(true); $this-&gt;setDefaultSort('created_at'); $this-&gt;setDefaultDir('DESC'); $this-&gt;setSaveParametersInSession(true); } protected function _getCollectionClass() { return 'sales/order_grid_collection'; } protected function _prepareCollection() { $collection = Mage::getResourceModel($this-&gt;_getCollectionClass()); $collection-&gt;getSelect()-&gt;join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id AND sales_flat_order_address.address_type = shipping',array('postcode')); $this-&gt;setCollection($collection); return parent::_prepareCollection(); } protected function _prepareColumns() { $this-&gt;addColumn('real_order_id', array( 'header'=&gt; Mage::helper('sales')-&gt;__('Order #'), 'width' =&gt; '80px', 'type' =&gt; 'text', 'index' =&gt; 'increment_id', )); if (!Mage::app()-&gt;isSingleStoreMode()) { $this-&gt;addColumn('store_id', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Purchased From (Store)'), 'index' =&gt; 'store_id', 'type' =&gt; 'store', 'store_view'=&gt; true, 'display_deleted' =&gt; true, )); } $this-&gt;addColumn('created_at', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Purchased On'), 'index' =&gt; 'created_at', 'type' =&gt; 'datetime', 'width' =&gt; '100px', )); $this-&gt;addColumn('billing_name', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Bill to Name'), 'index' =&gt; 'billing_name', )); $this-&gt;addColumn('shipping_name', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Ship to Name'), 'index' =&gt; 'shipping_name', )); $this-&gt;addColumnAfter('shipping_postcode', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Shipping Postcode'), 'filter_index'=&gt;'main_table.postcode', 'index' =&gt; 'shipping_postcode', ),'method'); $this-&gt;addColumn('base_grand_total', array( 'header' =&gt; Mage::helper('sales')-&gt;__('G.T. (Base)'), 'index' =&gt; 'base_grand_total', 'type' =&gt; 'currency', 'currency' =&gt; 'base_currency_code', )); $this-&gt;addColumn('grand_total', array( 'header' =&gt; Mage::helper('sales')-&gt;__('G.T. (Purchased)'), 'index' =&gt; 'grand_total', 'type' =&gt; 'currency', 'currency' =&gt; 'order_currency_code', )); $this-&gt;addColumn('status', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Status'), 'index' =&gt; 'status', 'type' =&gt; 'options', 'width' =&gt; '70px', 'options' =&gt; Mage::getSingleton('sales/order_config')-&gt;getStatuses(), )); if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/view')) { $this-&gt;addColumn('action', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Action'), 'width' =&gt; '50px', 'type' =&gt; 'action', 'getter' =&gt; 'getId', 'actions' =&gt; array( array( 'caption' =&gt; Mage::helper('sales')-&gt;__('View'), 'url' =&gt; array('base'=&gt;'*/sales_order/view'), 'field' =&gt; 'order_id' ) ), 'filter' =&gt; false, 'sortable' =&gt; false, 'index' =&gt; 'stores', 'is_system' =&gt; true, )); } $this-&gt;addExportType('*/*/exportCsv', Mage::helper('sales')-&gt;__('CSV')); $this-&gt;addExportType('*/*/exportExcel', Mage::helper('sales')-&gt;__('Excel XML')); return parent::_prepareColumns(); } protected function _prepareMassaction() { $this-&gt;setMassactionIdField('entity_id'); $this-&gt;getMassactionBlock()-&gt;setFormFieldName('order_ids'); $this-&gt;getMassactionBlock()-&gt;setUseSelectAll(false); if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/cancel')) { $this-&gt;getMassactionBlock()-&gt;addItem('cancel_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Cancel'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/massCancel'), )); } if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/hold')) { $this-&gt;getMassactionBlock()-&gt;addItem('hold_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Hold'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/massHold'), )); } if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/unhold')) { $this-&gt;getMassactionBlock()-&gt;addItem('unhold_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Unhold'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/massUnhold'), )); } $this-&gt;getMassactionBlock()-&gt;addItem('pdfinvoices_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Invoices'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfinvoices'), )); $this-&gt;getMassactionBlock()-&gt;addItem('pdfshipments_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Packingslips'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfshipments'), )); $this-&gt;getMassactionBlock()-&gt;addItem('pdfcreditmemos_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Credit Memos'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfcreditmemos'), )); $this-&gt;getMassactionBlock()-&gt;addItem('pdfdocs_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print All'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfdocs'), )); $this-&gt;getMassactionBlock()-&gt;addItem('print_shipping_label', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Shipping Labels'), 'url' =&gt; $this-&gt;getUrl('*/sales_order_shipment/massPrintShippingLabel'), )); return $this; } public function getRowUrl($row) { if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/view')) { return $this-&gt;getUrl('*/sales_order/view', array('order_id' =&gt; $row-&gt;getId())); } return false; } public function getGridUrl() { return $this-&gt;getUrl('*/*/grid', array('_current'=&gt;true)); } } </code></pre> <p>Help is always appreciated. </p>
14,860,081
0
<p>Use integers and divide down:</p> <pre><code>for(int value = -20; value &lt;= 20; value += 2) std::cout &lt;&lt; (value/10.0) &lt;&lt; std::endl; </code></pre>
17,679,290
0
Mountain Lion Secure Transport SSLHandshake returns errDecryptionFail after Change Cipher Spec <p>On Mountain Lion, running some SSL code that works on Leopard - using the native Secure Transport Framework - the server-side SSLHandshake call fails with errDecryptionFail.</p> <p>Looking at a wireshark trace, the handshake proceeds normally until the client sents a Change Cipher Spec and Encrypted Handshake Message. In response the server closes the connection and returns errDecryptionFail.</p> <p>The apple documentation states:</p> <p>"errSSLDecryptionFail –9845<br> Decryption failed. Among other causes, this may be caused by invalid data coming from the remote host, a damaged crypto key, or insufficient permission to use a key that is stored in the keychain."</p> <p>Has anyone seen similar behaviour or could shed some light on what the "other causes" might be?</p> <p>Thanks,</p> <p>Richard.</p>
3,153,279
0
<p>Are you trying to pass args on the command line?</p> <p>If so, $0 will contain the script name, and $1..n will contain command line args.</p> <p>$@ will contain all command line args, space-separated.</p>
9,424,084
0
<p>Change your code to:</p> <pre><code>for (NSDictionary *file in files) { NSString *userNumber = [file objectForKey:@"UserNumber"]; NSLog(@"output: %@", userNumber); } </code></pre> <p>i.e. <code>file objectForKey...</code>, not <code>result objectForKey...</code>. You're iterating through the <code>files</code> array with each entry in it being identified as <code>file</code> for the purposes of the code within the for loop.</p>
22,662,835
0
<p>If using FieldSetText, you have to be careful to format the value in a way that's consistent with the user's preferences and/or the settings of the field (e.g. whether the decimal separator is "," or "."). To avoid this source of error, it's better to use the NotesDocument object for this sort of thing. You need a better reason than "I don't want to," to not do this.</p> <p>You could use the NotesDocument for this one operation and the NotesUIDocument for everything else, e.g. write:</p> <p>uidoc.Document.ReplaceItemValue "fieldname", numbervalue</p> <p>Unless you've deliberately set the option to not reload the UI automatically, this will do what you want. If you have set that option you'll need a second call to do that update.</p>
31,566,473
0
adding hebrew value to sql using PDO <p>I am trying to add a Hebrew value to a database using php's PDO class.</p> <p>After finally succeeding doing that (by using: <code>array(PDO::MYSQL_ATTR_INIT_COMMAND =&gt; "SET NAMES utf8"</code>), I found out that <code>COLLATE HEBREW_CI_AS</code> is added to my value.</p> <p>Is there any way to prevent this addition?</p> <p>thank you, and sorry for my bad English.</p>
16,904,300
0
Disable CSS link for 1 second after it has been clicked <p>I'm trying to have a CSS link disabled for 1 second after it has been clicked. </p> <p>I have tried this without success; </p> <p>In the header:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $("#link").click(function() { $("#link").attr("disabled", "disabled"); setTimeout(function() { $("#link").removeAttr("disabled"); }, 2000); }); }); &lt;/script&gt; </code></pre> <p>Html:</p> <pre><code>&lt;a href="#" class="link"&gt;the link text&lt;/a&gt; </code></pre> <p>CSS:</p> <pre><code>.link:diabled { some values here.. } </code></pre>
21,394,335
0
Does Clojure's core.async work with RoboVM? <p>I've used <a href="https://github.com/oakes/lein-fruit" rel="nofollow">lein-fruit</a> to generate a basic Clojure project that targets iOS through <a href="http://www.robovm.org/" rel="nofollow">RoboVM</a>. I've introduced core.async to pass button taps along a channel, but mutating the button in the <code>go</code> block doesn't seem to have an effect.</p> <p>Is there reason to believe the Java implementation of core.async doesn't work under RoboVM? </p> <p>Here's my code, slightly modified from the basic lein-fruit template.</p> <pre class="lang-lisp prettyprint-override"><code>(ns core-async-demo.core (:require [core-async-demo.core-utils :as u] [clojure.core.async :refer [go chan put! &lt;!]])) (def window (atom nil)) (def taps (chan)) (defn init [] (let [main-screen (u/static-method :uikit.UIScreen :getMainScreen) button-type (u/static-field :uikit.UIButtonType :RoundedRect) button (u/static-method :uikit.UIButton :fromType button-type) normal-state (u/static-field :uikit.UIControlState :Normal) click-count (atom 0)] (doto button (.setFrame (u/init-class :coregraphics.CGRect 115 121 91 37)) (.setTitle "Click me!" normal-state) (.addOnTouchUpInsideListener (proxy [org.robovm.cocoatouch.uikit.UIControl$OnTouchUpInsideListener] [] (onTouchUpInside [control event] (put! taps true))))) (reset! window (u/init-class :uikit.UIWindow (.getBounds main-screen))) (go (loop [_ (&lt;! taps)] (.setTitle button (str "Click #" (swap! click-count inc)) normal-state) (recur (&lt;! taps)))) (doto @window (.setBackgroundColor (u/static-method :uikit.UIColor :lightGrayColor)) (.addSubview button) .makeKeyAndVisible))) </code></pre>
17,236,454
0
<p>This function takes a string argument as input</p> <p>The first thing it does is checks the recursive base case. We'll get back to that</p> <p>If the base case is not satisfied, it then checks to see if the first character matches the last character using this code:</p> <pre><code>if (substr($string,0,1) == substr($string,(strlen($string) - 1),1)) </code></pre> <p>If that does match, then the function recursively calls itself again but this time with the first and last character removed, this is done with this line</p> <pre><code>return Palindrome(substr($string,1,strlen($string) -2)); </code></pre> <p>If ever the first character does not match the last character, the function automatically outputs to html "STRING IS NOT A PALINDROME via <code>echo</code></p> <p>Now back to the base case I mentioned before, if the function successfully matches and removes the first and last character until there are one or no characters left, then the string has been confirmed to be a palindrome and it echos that string.</p> <p>If you need help with recursion let me know, I'll post a tutorial link</p>
23,070,095
0
Better understanding Ajax CORS <p>I have 3 domains that need to work along...<br> My flow basically works like this:</p> <ol> <li>The user goes to A.com</li> <li>A.com sets a cookie and redirect to B.com</li> <li>B.com ajaxs calls need to send the cookie on requests to C.com</li> </ol> <p>How "can I"/"should I" implement this behavior?</p> <p>I set the xhrFields "withCredentials: true" in B.com ajax, but inspecting the request using fiddler, no cookies are sent...</p> <p>Ps: im kinda lost... if extra info needed pls ask!</p>
37,699,304
0
Ionic - Remove Disable spinner on splash screen <p>I'm trying to disable spinner on startup splash screen. I can't find where are the settings for this feature. Which folder/file?</p>
34,463,147
0
<p>You can use OnTap event. It is not a perfect solution because this event don't work on Windows (so you have to use conditional defines to debug on Windows), but on at least on Android OnTap isn't raised when you scroll a box (tested on Seattle).</p>
39,927,552
0
Determining if a node stream is in objectMode <p>Given a node js stream object how do I determine if it is an object stream in objectMode? </p> <p>Say I have a readable stream instance</p> <pre><code> const myReadableStream = new ReadableStreamImplementation({ options: { objectMode : true } }); </code></pre> <p>How can I determine that the myReadableStream is in objectMode. Is there a method or property that can be read? Could not find the answer from skimming through node streams documentation.</p> <p><strong>EDIT</strong> Is there a way to tell without tapping into the stream and given only the stream object itself?</p>
39,622,214
0
Disable certain Android Studio compilation errors <p>I'm extending a hidden java class so I run into the error</p> <pre><code>Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'. &gt; class com.company.class.CustomVersion cannot access its superclass java.class.JavaVersion </code></pre> <p>However, if I don't rely on Android Studio, output a jar, and then add the jar as a dependency to the same project I don't get the above compilation error and the app can launch. Since I'm writing my own library, I'd prefer not to have to create and export a jar every time I want to test some code change. Is there a way of disabling compilations errors like the above for a class?</p> <p>EDIT:</p> <p>For more information I was trying to extend a hidden Android class in the java.net package.</p>
22,787,068
0
javascript: add html to end of <span> (noob) <p>I am sure there must be an easier way that doing this:</p> <pre><code>foo.innerHTML +="&lt;br&gt;"; </code></pre> <p>The above is producing dirty results as there is a textbox in the SPAN and the data from that textbox gets wiped away when using innerHTML.</p> <p>I am trying to "re-learn" JS so forgive me if the question is too noobish.</p>
40,932,309
0
<p>Just add <code>runat="server"</code> in your html code like this:</p> <pre><code>&lt;a id="topicLink" runat="server" href="default.aspx"&gt; New Topic &lt;/a&gt; </code></pre> <p>Then you can use <code>topicLink</code> to change the href value just as you did. :)</p>
26,104,618
0
<p>The li elements are hard coded into your list. To put them into a div you can either hard code them into the preferred div or use javascript to dynamically change the html code. It would probably be easier to just code a short list into the adjacent div, but if this is a list that gets generated in some way, css can change how things are displayed, but the location of you li items are still part of the parent div. Css is for styling and placing on the screen not for changing parent elements.</p>
20,251,155
0
<p>Without a stacktrace it can be hard to tell. From what I can see you have two possible culprites.</p> <p><strong>First</strong></p> <pre><code>Bundle extras = getIntent().getExtras(); public final String ID_CITY = extras.getString("CITY_TH"); </code></pre> <p>In your Search class you are trying to get data from bundle. But in your MainActivity.goMenu() you are not passing in a bundle. This can cause a <code>NULLPOINTEREXCEPTION</code></p> <p><strong>Second</strong></p> <pre><code>setupActionBar(); </code></pre> <p>Please try commenting that out in your Search.class and see what the results are. I can't see what your theme is from the manifest. So you may not even have an Action bar which can cause a crash. So if commenting out the line above works, add the following to your manifest: </p> <p>Change:</p> <pre><code>android:theme="@style/AppTheme" </code></pre> <p>To:</p> <pre><code>android:theme="@android:style/Theme.Holo" </code></pre> <p>and see if that works.</p>
2,757,476
0
Android Cursor size <p>Anyone knows how to change cursor size in Edittext in Android???</p> <p>I'm trying to implement SMS function. I used EditText and tried to put background image. The background image has lines so I need to put extra space between lines so that the background image and the lines fit nicely. But... if I use linespacingextra, it increase cursor as well. That means the fontsize will be smaller than the cursor size.</p> <p>Any idea??</p>
7,691,666
0
<p>You should go with the second approach.</p> <p>One possible solution is a greedy algorithm. Define your set of transformations as a regular expression (used to test the pattern) and a function which is given the regexp match object and returns the transformed string.</p> <p>Regular expressions aren't quite powerful enough to handle what you want directly. Instead you'll have to do something like:</p> <pre><code>m = re.match(r"C\[(\d+)\]H\[(\d+)]\]", formula) if m: C_count, H_count = int(m.group(1)), int(m.group(2)) match_size = len(m.group(0)) if C_count*2+2 == H_count: replacement = alkane_lookup[C_count] elif C_count*2 == H_count: replacement = alkene_lookup[C_count] ... else: replacement = m.group(0) # no replacement available </code></pre> <p>(plus a lot more for the other possibilities)</p> <p>then embed that in a loop which looks like:</p> <pre><code>formula = "...." new_formula = "" while formula: match_size, replacement = find_replacement(formula) new_formula += replacement formula = formula[match_size:] </code></pre> <p>(You'll need to handle the case where nothing matches. One possible way is to include a list of all possible elements at the end of find_replacement(), which only returns the next element and counts.)</p> <p>This is a greedy algorithm, which doesn't guarantee the smallest solution. That's more complicated, but since chemists themselves have different ideas of the right form, I wouldn't worry so much about it.</p>
18,930,069
0
<p>Use The <code>NonActionAttribute</code>. It allows you to mark public methods in a controller as not being available for external requests.</p> <p><a href="http://weblogs.asp.net/gunnarpeipman/archive/2011/04/09/asp-net-mvc-using-nonactionattribute-to-restrict-access-to-public-methods-of-controller.aspx" rel="nofollow">Here's more information.</a></p>
39,698,624
0
<p>I think you need to rethink your design!</p> <p>"Undo" implies that a transaction is open and that specific transaction is rolled back. You can do this for instance by encapsulating your entire GUI in a transaction but that is bad practice. It will give long transactions, locking issues, bi-file growth and potential crashes if somebody leaves their session open. Not a good idea - you want to make your transactions small!</p> <p>You need to look into a more service based approach. For instance:</p> <ul> <li><p>When the interface loads you load the records your interested into a temp-table.</p></li> <li><p>When you click "add," "update", "delete" etc you make changes to these records. "Add" creates a new record in the temp-table, "update" makes changes to a record and delete deletes (or marks for delete) records in the temp-table.</p></li> <li><p>When clicking "save" you first check that no records are changed in the database, if not you save the changes from the temp-tables into the database. If they are changed you might want to alert the user. </p></li> <li><p>When clicking "cancel" you just exit and disregard the changes.</p></li> </ul> <p>You can get support for parts of this way of by working utilizing datasets. Read up on those! </p> <p><a href="https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvpds/preface.html#" rel="nofollow">https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvpds/preface.html#</a></p>
27,157,347
0
<p>The answer is highly situational. In general, you want to handle exceptions elegantly whenever possible. That is, try to resolve / ignore them where you can. An IndexOutOfBoundsException is very often an example of where this is not possible.</p> <p>Hard breaks because of exceptions is a last-resort. Do this only when your program <strong><em>cannot</em></strong> continue.</p> <p>This question's answer has a good post on it. <a href="http://stackoverflow.com/questions/77127/when-to-throw-an-exception">When to throw an exception?</a></p>
31,633,257
0
<p>I think you forget array like this:</p> <pre><code>1 0 0 9 1 1 0 1 0 1 1 1 0 0 0 1 </code></pre> <p>your recursive function will not be finished in the previous example, please check the size of array to finish recursion.</p> <p>Also your algorithm does not use up and right to find cheese</p> <p>EDIT</p> <p>you should handle the 4 directions, and don't repeat the square you visit before, I will add pseudo code here to explain the main idea of solution:</p> <pre><code>public class MAZE { static int x, y; static boolean result = false; public static void main(String[] args) { int [][] matrix =new int[5][];// fill your array // fill x and y // x= cheese x value // y = cheese y value isPath(matrix, x, x); // print result } static void isPath(int[][] matrix, int i, int j) { if (i - 1 &gt; -1 &amp;&amp; matrix[i - 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i-1][j] // checkSPath(subarray1,i-1,j); } if (j - 1 &gt; -1 &amp;&amp; matrix[i][j - 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j-1] // checkLPath(subarray1,i,j-1); } if (i + 1 &lt; x &amp;&amp; matrix[i + 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i+1][j] // checkNPath(subarray1,i+1,j); } if (j + 1 &lt; y &amp;&amp; matrix[i][j + 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j+1] // checkRPath(subarray1,i,j+1); } } static void checkRPath(int[][] matrix, int i, int j) { if (i == 0 &amp;&amp; j == 0) { result = true; } else { if (i - 1 &gt; -1 &amp;&amp; matrix[i - 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i-1][j] // checkSPath(subarray1,i-1,j); } if (i + 1 &lt; x &amp;&amp; matrix[i + 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i+1][j] // checkNPath(subarray1,i+1,j); } if (j + 1 &lt; y &amp;&amp; matrix[i][j + 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j+1] // checkRPath(subarray1,i,j+1); } } } static void checkLPath(int[][] matrix, int i, int j) { if (i == 0 &amp;&amp; j == 0) { result = true; } else { if (i - 1 &gt; -1 &amp;&amp; matrix[i - 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i-1][j] // checkSPath(subarray1,i-1,j); } if (j - 1 &gt; -1 &amp;&amp; matrix[i][j - 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j-1] // checkLPath(subarray1,i,j-1); } if (i + 1 &lt; x &amp;&amp; matrix[i + 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i+1][j] // checkNPath(subarray1,i+1,j); } } } static void checkNPath(int[][] matrix, int i, int j) { if (i == 0 &amp;&amp; j == 0) { result = true; } else { if (j - 1 &gt; -1 &amp;&amp; matrix[i][j - 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j-1] // checkLPath(subarray1,i,j-1); } if (i + 1 &lt; x &amp;&amp; matrix[i + 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i+1][j] // checkNPath(subarray1,i+1,j); } if (j + 1 &lt; y &amp;&amp; matrix[i][j + 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j+1] // checkRPath(subarray1,i,j+1); } } } static void checkSPath(int[][] matrix, int i, int j) { if (i == 0 &amp;&amp; j == 0) { result = true; } else { if (i - 1 &gt; -1 &amp;&amp; matrix[i - 1][j] == 1) { // subarray1 = copy starting from [0][0] to matrix[i-1][j] // checkSPath(subarray1,i-1,j); } if (j - 1 &gt; -1 &amp;&amp; matrix[i][j - 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j-1] // checkLPath(subarray1); } if (j + 1 &lt; y &amp;&amp; matrix[i][j + 1] == 1) { // subarray1 = copy starting from [0][0] to matrix[i][j+1] // checkRPath(subarray1); } } } } </code></pre> <p>You can merge these 5 methods in one. here I am trying to explain the solution not writing optimized code.</p>
34,294,372
0
What are the cases in general which require template argument to be complete? <p>Consider simple code :</p> <pre><code>struct x; template&lt;typename&gt; void func(){} int main() { func&lt;x&gt;(); return 0; } </code></pre> <p>This above code doesn't requires class <code>x</code> to be complete, are there any other cases which don't require <code>x</code> to be complete? . Also in general what are the cases which require template argument to be complete?</p>
30,877,931
0
<p>As per my understanding, you want to filter-out file names with a specific file type/extension (ex: pdf) from the main list <code>uploadedfilenames</code>. This is one of the easiest ways:</p> <pre><code>&lt;cfset lFileNames = "C:\myfiles\proj\icon-img-12.png,C:\myfiles\proj\sample-file.ppt,C:\myfiles\proj\fin-doc1.docx,C:\myfiles\proj\fin-doc2.pdf,C:\myfiles\proj\invoice-temp.docx,C:\myfiles\proj\invoice-final.pdf" /&gt; &lt;cfset lResultList = "" /&gt; &lt;cfset fileExtToExclude = "pdf" /&gt; &lt;cfloop list="#lFileNames#" index="fileItem" delimiters=","&gt; &lt;cfif ListLast(ListLast(fileItem,'\'),'.') NEQ fileExtToExclude&gt; &lt;cfset lResultList = ListAppend(lResultList,"#fileItem#") /&gt; &lt;/cfif&gt; &lt;/cfloop&gt; </code></pre> <p>Using only List Function provided by ColdFusion this is easily done, you can test and try the code <a href="http://trycf.com/gist/5c726ca8c851a4ea072f/acf11?theme=monokai" rel="nofollow">here</a>. I would recommend you to wrap this code around a function for easy handling. Another way to do it would be to use some complex regular expression on the list (if you're looking for a more general solution, outside the context of ColdFusion).</p> <p>Now, applying the solution to your problem:</p> <pre><code>&lt;cfset uploadedfilenames='#myfiles.clientFile#' &gt; &lt;cfset lResultList = "" /&gt; &lt;cfset fileExtToExclude = "pdf" /&gt; &lt;cfloop list="#uploadedfilenames#" index="fileItem" delimiters=","&gt; &lt;cfif ListLast(ListLast(fileItem,'\'),'.') NEQ fileExtToExclude&gt; &lt;cfset lResultList = ListAppend(lResultList,fileItem) /&gt; &lt;/cfif&gt; &lt;/cfloop&gt; &lt;cfset uploadedfilenames = lResultList /&gt; &lt;!--- rest of your code continues ---&gt; </code></pre> <p>The result list <code>lResultList</code> is copied to the original variable <code>uploadedfilenames</code>.</p>
32,432,634
0
<p>Ideally the web service would use one of the HTTP status codes to tell the client there was a problem, then you could use a response descriptor specifically to handle that and an <code>NSError</code>.</p> <p>You can use a dynamic mping which checks the result type and determines how to process the result. Depending on the flag value a different mapping will be applied to create a different result class with the appropriate details for you to use. Exactly how you handle that is up to you, either with a class type check, or perhaps having your model objects return a 'success' flag, perhaps supported by a protocol.</p>
24,870,822
0
<p>As @leppie points out, the accepted solution does not match your text. I would have thought of the following:</p> <pre><code>(define (iterator start step end) (lambda () (if (&gt;= start end) '() (begin0 start (set! start (+ start step)))))) </code></pre> <p>testing:</p> <pre><code>(define i (iterator 0 2 7)) (i) =&gt; 0 (i) =&gt; 2 (i) =&gt; 4 (i) =&gt; 6 (i) =&gt; '() (i) =&gt; '() </code></pre> <p>Note that I use Racket's <code>begin0</code> form. If your Scheme doesn't have it, you can change to the following:</p> <pre><code>(define (iterator start step end) (lambda () (if (&gt;= start end) '() (let ((res start)) (set! start (+ start step)) res)))) </code></pre>
27,364,086
0
<p>Try to save your code at jsfiddle, show it.</p> <p>Start debugging:</p> <ol> <li>response - <code>console.log(xml);</code></li> <li>is true - <code>$('#selectYear option').length == 0</code></li> <li>is largest then 0 - <code>$(xml).find('year').length</code></li> </ol>
10,610,208
0
<p>That's because you are not translating it, when you use CGAffineTransformMakeTranslation you are saying <em>Give me these coordinates</em> not <em>give me this offset</em>. In other words, make translation gives you the translation from the <em>identity</em> matrix. The function you want is CGAffineTransformTranslate. This will apply the translation to the current transform (passed as the first argument).</p>
30,070,051
0
<p>Try to add method atribute for form, like</p> <pre><code>&lt;form action="'+url+'" method="post" target="_blank"&gt;&lt;/form&gt; </code></pre> <p><strong>UPDATED</strong> But you can't store data in your url. Post should send params in body, not in URL. So your url should be like '/index.php'. And your params should be in body, so add all your page, action, etc to form's hidden fields.</p> <pre><code>&lt;form action="/index.php" method="post" target=...&gt; &lt;input type="hidden" name="action" value="InvoicePrint"/&gt; ............ &lt;/form&gt; </code></pre> <p>or use jQuery post</p> <pre><code>$.ajax({ type: "POST", url: '/index.php', data: data, success: success }); </code></pre> <p>Where data is object with all your params</p>
38,659,084
0
<p>You can use Core Data for local storage. You can do the upload functionality whenever the net is connected by using NSNotificationCenter in the Reachability code. Please refer the Reachability class sample code from the apple developer site. <a href="https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html" rel="nofollow">https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html</a></p>
7,619,499
0
getting distinct column name and count when based on another table <p>i have the following query:</p> <pre><code>select cc.category from companies c left join categories cc on c.category_id = cc.category_id where company_title like '%gge%'; </code></pre> <p>which return categories with duplicate rows. what i need is to get distinct categories, with the total count of accurences of that category, something like:</p> <p>CATEGORY NAME | XXX ( where XXX is the count )</p> <p>anyone can help?</p>
23,766,273
0
Where do I calculate my style strings in ember.js? <p>I have an ember.js app</p> <pre><code>var App = Ember.Application.create({ LOG_TRANSITIONS: true }); App.ApplicationAdapter = DS.FixtureAdapter; //==============================ROUTER============================== App.Router.map(function() { this.resource('organisation', {path: '/:org_slug/:org_id'}, function () { this.resource('building', {path: '/:hall_slug/:hall_id'}); this.resource('group', {path: '/:grp_slug/:grp_id'}); }); }); </code></pre> <p>I cannot work out how to neatly calculate stuff from my complex fixtures data. My models include an organisation with buildings and building groups.</p> <pre><code>//==============================MODELS============================== App.Organisation = DS.Model.extend({ name: DS.attr('string'), buildings: DS.hasMany('building', {async: true}), groups: DS.hasMany('group', {async: true}) }); App.Building = DS.Model.extend({ organisation: DS.belongsTo('organisation'), name: DS.attr('string'), value: DS.attr('number'), groups: DS.hasMany('group', {async: true}) }); App.Group = DS.Model.extend({ organisation: DS.belongsTo('organisation'), buildings: DS.hasMany('building', {async: true}), name: DS.attr('string'), start: DS.attr('date'), end: DS.attr('date'), main: DS.attr('boolean'), value_range: function() { var maximum = 0.0; var minimum = 0.0; this.get('buildings').forEach(function(building) { var v = building.get('value'); maximum = Math.max(maximum, v); minimum = Math.min(minimum, v); }); return {'maximum': maximum, 'minimum': minimum}; }.property('[email protected]') }); </code></pre> <p>I need to calculate stuff based on the whole building group as in the value_range function. This seems to work fine.</p> <p>I have these fixtures</p> <pre><code>//==============================FIXTURES============================== App.Organisation.FIXTURES = [ { id: 1, name: 'Organisation 1', buildings: [1,2,3,4,5,6,7,8,9,10], groups: [1, 2, 4]}, { id: 2, name: 'Organisation 2', buildings: [11,12,13,14,15,16], groups: [3]} ]; App.Building.FIXTURES = [ { id: 1, name: 'Building 1', value: -3.2, groups: [1], organisation_id: 1}, { id: 2, name: 'Building 2', value: 23.2, groups: [1,2], organisation_id: 1}, { id: 3, name: 'Building 3', value: 34.2, groups: [1,2], organisation_id: 1}, { id: 4, name: 'Building 4', value: -3.12, groups: [2], organisation_id: 1}, { id: 5, name: 'Building 5', value: 0.12, groups: [3], organisation_id: 2}, { id: 6, name: 'Building 6', value: 0.2, groups: [3], organisation_id: 2} ]; App.Group.FIXTURES = [ {id: 1, organisation_id: 1, name: 'Group 1', buildings: [1,2,3], main: true}, {id: 2, organisation_id: 1, name: 'Group 2', buildings: [2,3,4], main: false}, {id: 3, organisation_id: 2, name: 'Group 3', buildings: [5,6], main: true}, ]; </code></pre> <p>And I have managed to create a route for an organisation and an index route which should show the default ('main') group.</p> <pre><code>//==============================ROUTES============================== App.OrganisationRoute = Ember.Route.extend({ model: function(params) { return this.store.find('organisation', params.org_id); }, serialize: function(model) {//add prefix to slug and id return { org_slug: model.get('slug'), org_id: model.get('id') }; } }); App.OrganisationIndexRoute = Ember.Route.extend({ model: function(params) { //get buildings from the main group return this.modelFor('organisation').get('groups').then(function(grps) { return grps.findBy('main', true).get('buildings'); }); }, setupController: function(controller, model) { this._super(controller, model); controller.set('organisation', this.modelFor('organisation')); var mygroup = this.modelFor('organisation').get('groups').then(function(grps) { controller.set('group', grps.findBy('main', true)); }); } }); </code></pre> <p>I want to present a simple bar styled with calculated values for each building in the group (left/right and width values). The calculation uses the <code>group.value_range</code> data as well as the <code>building.value</code> data. My problem is that I can't work out where to put this function. The controller doesn't seem to have access to individual buildings. </p> <p>Do I use a handlebars helper? I have hacked this together but it smells.</p> <pre><code>Ember.Handlebars.helper('thing', function(building, group) { var range = group.get('value_range'); var value = building.get('value'); var width = Math.abs(value)/(range.maximum - range.minimum) * 100; var zero_position = Math.abs(range.minimum)/(range.maximum - range.minimum) * 100; if (value &gt;= 0) { left_or_right = 'left'; myclass = 'pos'; } else { left_or_right = 'right'; myclass = 'neg'; zero_position = 100 - zero_position; } return new Handlebars.SafeString( '&lt;div class="my-bar ' + myclass + '" style="width: ' + width + '%; ' + left_or_right + ': ' + zero_position + '%;"&gt;-&lt;/div&gt;' ); }); </code></pre> <p>Or do I need a view? The docs say views are mainly for event processing.</p> <p>I'm not quite groking the ember way on this. Can anyone help?</p>