pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
13,872,904
0
Javascript alert box and confirmation after <p>I want to create a javascript for checking value of textbox so if the textbox blank, it won't proceed to next page. AND after checking (if all condition is true) it will return the result of textbox.</p> <p>I've created this javascript:</p> <pre><code>function cekdata(myform) { var id = document.myform.clientid.value; var nama = document.myform.nama.value; var divisi = document.myform.divisi.value; var way = document.getElementById('twoway').value; var ori = document.myform.lokasi.value; var desti = document.myform.tujuan.value; var ket = document.myform.keterangan.value; var tpergi = document.myform.tglb.value; var jpergi = document.myform.jamb.value; var mpergi = document.myform.menitb.value; var pegi = tpergi+', '+jpergi+':'+mpergi; var tplg = document.myform.tglp.value; var jplg = document.myform.jamp.value; var mplg = document.myform.menitp.value; var plg = tplg+', '+jplg+':'+mplg; if (document.myform.clientid.value == "") { alert("Please Fill Your ID"); myform.clientid.focus(); return false; } else if (document.myform.nama.value == "") { alert("Please Fill Passenger Name"); myform.nama.focus(); return false; } else if (document.myform.lokasi.value == "") { alert("Please Fill Origin Location"); myform.lokasi.focus(); return false; } else if (document.myform.tujuan.value == "") { alert("Please Fill Your Destination"); myform.tujuan.focus(); return false; } else if (document.myform.tglb.value == "") { alert("Please Fill Departure Date"); myform.tglb.focus(); return false; } else if (document.myform.novehicle.value == "") { alert("Please Fill Vehicle Number"); myform.novehicle.focus(); return false; } else if (document.myform.driverid.value == "") { alert("Please Fill Driver ID"); myform.driverid.focus(); return false; } else if(document.getElementById('twoway').checked) { if (document.myform.tglp.value == "") { alert("Please Fill Return Date"); myform.tglp.focus(); return false; } else if (document.myform.tglb.value &gt; document.myform.tglp.value) { alert("Return date must bigger than departure date"); myform.tglp.focus(); return false; } } else { var a = window.confirm("CONFIRMATION :\nID : " +id+"\nName : "+nama+"\nDivision : "+divisi+"\nOne Way : "+way+"\nOrigin : "+ori+"\nDestination : "+desti+"\nNotes : "+ket+"\nDeparture : "+pegi+"\nArrived :"+plg); if (a==true) { return true; } else { return false; } } } </code></pre> <p>And I called this function like this:</p> <pre><code>&lt;form name="myform" onsubmit="return cekdata(this);" method="POST" action="&lt;?php $_SERVER["PHP_SELF"]; ?&gt;"&gt; </code></pre> <p>But what I got is the confirm box never show up, and it returns true (and go to next page). So, how to change this condition so my confirmation box showed up first, then after click OK, it go to next page, and if CANCEL, do nothing?</p>
15,074,358
0
<p>Stretch's answer appears to be a great workaround, but it uses deprecated APIs. So, I thought it might be worthy of an upgrade to the code.</p> <p>For this code sample, I added the routines to the ViewController which contains my UIWebView. I made my UIViewController a UIWebViewDelegate and a NSURLConnectionDataDelegate. Then I added 2 data members: _Authenticated and _FailedRequest. With that, the code looks like this:</p> <pre><code>-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { BOOL result = _Authenticated; if (!_Authenticated) { _FailedRequest = request; [[NSURLConnection alloc] initWithRequest:request delegate:self]; } return result; } -(void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { NSURL* baseURL = [NSURL URLWithString:_BaseRequest]; if ([challenge.protectionSpace.host isEqualToString:baseURL.host]) { NSLog(@"trusting connection to host %@", challenge.protectionSpace.host); [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; } else NSLog(@"Not trusting connection to host %@", challenge.protectionSpace.host); } [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)pResponse { _Authenticated = YES; [connection cancel]; [_WebView loadRequest:_FailedRequest]; } </code></pre> <p>I set _Authenticated to NO when I load the view and don't reset it. This seems to allow the UIWebView to make multiple requests to the same site. I did not try switching sites and trying to come back. That may cause the need for resetting _Authenticated. Also, if you are switching sites, you should keep a dictionary (one entry for each host) for _Authenticated instead of a BOOL.</p>
39,601,609
0
Angular 2 - cant load demo libraries (Visual Studio 2015) <p>OK I am stumped: Is there a basic, minimal, working Angular 2 tutorial for Visual Studio 2015 <a href="https://i.stack.imgur.com/TguJv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TguJv.png" alt="enter image description here"></a>that actually works?</p> <p>I've attempted numerous tutorials including the official one: <a href="https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html" rel="nofollow noreferrer">https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html</a></p> <p>Believe it or not, at the time of writing this post this example does not work - throws a 404 for numerous dependencies referenced in the NPM package.json file (as for the others tuts, well they reference a lot of beta removed or non-existing references).</p> <p>I mean, where do you actually download Angular 2 Typings from? They are certainly not listed with the rest of the library on the official site: <a href="https://code.angularjs.org/" rel="nofollow noreferrer">https://code.angularjs.org/</a></p> <p>It actually seems to be impossibly complicated to create an Angular 2 application in Visual Studio that does not require a mass of dependencies and actually works.</p> <p>Is it just me or are other members of the VS dev community experiencing the same?</p> <p>output for NPM package.json:</p> <pre><code>npm WARN package.json [email protected] No README data npm http GET https://registry.npmjs.org/core-js npm http GET https://registry.npmjs.org/bootstrap npm http GET https://registry.npmjs.org/reflect-metadata npm http GET https://registry.npmjs.org/zone.js npm http GET https://registry.npmjs.org/systemjs npm http GET https://registry.npmjs.org/angular2-in-memory-web-api npm http GET https://registry.npmjs.org/http-server npm http GET https://registry.npmjs.org/lite-server npm http GET https://registry.npmjs.org/canonical-path npm http GET https://registry.npmjs.org/jasmine-core npm http GET https://registry.npmjs.org/karma-chrome-launcher npm http GET https://registry.npmjs.org/karma-htmlfile-reporter npm http GET https://registry.npmjs.org/angular/core npm http GET https://registry.npmjs.org/angular/compiler npm http GET https://registry.npmjs.org/angular/common npm http GET https://registry.npmjs.org/angular/platform-browser npm http GET https://registry.npmjs.org/angular/platform-browser-dynamic npm http GET https://registry.npmjs.org/angular/http npm http GET https://registry.npmjs.org/angular/forms npm http GET https://registry.npmjs.org/angular/router npm http GET https://registry.npmjs.org/angular/upgrade npm http GET https://registry.npmjs.org/karma-cli npm http GET https://registry.npmjs.org/karma-jasmine npm http GET https://registry.npmjs.org/rxjs npm http GET https://registry.npmjs.org/lodash npm http GET https://registry.npmjs.org/typescript npm http GET https://registry.npmjs.org/tslint npm http GET https://registry.npmjs.org/typings npm http GET https://registry.npmjs.org/karma npm http GET https://registry.npmjs.org/protractor npm http GET https://registry.npmjs.org/rimraf npm http GET https://registry.npmjs.org/concurrently npm http 304 https://registry.npmjs.org/systemjs npm http 304 https://registry.npmjs.org/zone.js npm http 304 https://registry.npmjs.org/core-js npm http 304 https://registry.npmjs.org/reflect-metadata npm http 304 https://registry.npmjs.org/angular2-in-memory-web-api npm http 200 https://registry.npmjs.org/http-server npm http 304 https://registry.npmjs.org/lite-server npm http 304 https://registry.npmjs.org/jasmine-core npm http 304 https://registry.npmjs.org/karma-chrome-launcher npm http 304 https://registry.npmjs.org/bootstrap npm http 304 https://registry.npmjs.org/karma-htmlfile-reporter npm http 304 https://registry.npmjs.org/canonical-path npm http 404 https://registry.npmjs.org/angular/core npm ERR! 404 Not Found npm ERR! 404 npm ERR! 404 'angular/core' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 It was specified as a dependency of 'angular-quickstart' npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, or http url, or git url. npm ERR! System Windows_NT 6.2.9200 npm ERR! command "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\Microsoft\\Web Tools\\External\\\\node\\node" "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\Microsoft\\Web Tools\\External\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! cwd D:\www\WebApplication1\WebApplication1 npm ERR! node -v v0.10.31 npm ERR! npm -v 1.4.9 npm ERR! code E404 npm http 404 https://registry.npmjs.org/angular/platform-browser npm http 404 https://registry.npmjs.org/angular/platform-browser-dynamic npm http 404 https://registry.npmjs.org/angular/http npm http 404 https://registry.npmjs.org/angular/compiler npm http 404 https://registry.npmjs.org/angular/router npm http 404 https://registry.npmjs.org/angular/upgrade npm http 404 https://registry.npmjs.org/angular/common npm http 304 https://registry.npmjs.org/karma-cli npm http 304 https://registry.npmjs.org/karma-jasmine npm http 304 https://registry.npmjs.org/rxjs npm http 304 https://registry.npmjs.org/typescript npm http 304 https://registry.npmjs.org/tslint npm http 404 https://registry.npmjs.org/angular/forms npm http 304 https://registry.npmjs.org/karma npm http 304 https://registry.npmjs.org/protractor npm http 200 https://registry.npmjs.org/lodash npm http 304 https://registry.npmjs.org/typings npm http 304 https://registry.npmjs.org/concurrently npm http 200 https://registry.npmjs.org/rimraf npm ====npm command completed with exit code 1==== </code></pre>
2,007,621
0
<p>Don't use the Swing timer; that's a kluge from early Swing days.</p> <p>The ScheduledExecutorService is the more general and configurable of the two remaining contenders. It accepts nanosecond precision, but of course cannot provide any better than milisecond accuracy depending on platform. You'd need a real-time JVM for nanosecond accuracy.</p>
38,661,019
0
<p>Try <a href="https://api.jquery.com/nextUntil/" rel="nofollow"><code>.nextUntil()</code></a>:</p> <pre><code>$(".lev1").click(function(){ $(this).nextUntil(".lev1").toggle(); }); </code></pre> <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(".lev1").click(function(){ $(this).nextUntil(".lev1").toggle(); });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;div class='folder lev1'&gt;323&lt;/div&gt; &lt;div class='folder lev2'&gt;525&lt;/div&gt; &lt;div class='file lev3'&gt;727&lt;/div&gt; &lt;div class='file lev4'&gt;1625&lt;/div&gt; &lt;div class='folder lev1'&gt;new&lt;/div&gt;</code></pre> </div> </div> </p>
21,812,594
0
How to add (" ") to all the words i have in my String Array in eclipse? <p>How to add (<code>" "</code>) to all the words i have in my <code>String</code> Array in eclipse?</p> <p>Suppose, If i have like 100 countries name as data is it possible that i copy paste them to my </p> <pre><code>private static String[] countries = {}; </code></pre> <p>and then any technique to add (<code>" "</code>) to all of the words inside the array?</p>
38,125,495
0
tryin to remove repeated classes in CSS with node js purge <p>I am trying to use remove the repeated classes declared in css file using css purge of node js but after installing purge package i am getting error as shown in screenshot please help error : cannot find module /lib/css_purge</p>
29,540,256
0
<p>I wrote a blog post about using SQL with PowerShell, so you can <a href="http://foxdeploy.com/2014/09/08/working-with-sql-using-powershell/" rel="nofollow">read more about it here</a>.</p> <p>We can do this easily if you have the SQL-PS module available. Simply provide values for your database name, server name, and table, then run the following:</p> <pre><code>$database = 'foxdeploy' $server = '.' $table = 'dbo.powershell_test' Import-CSV .\yourcsv.csv | ForEach-Object {Invoke-Sqlcmd ` -Database $database -ServerInstance $server ` -Query "insert into $table VALUES ('$_.Column1','$_.Column2')" } </code></pre> <p><em>To be clear, replace Column1, Column2 with the names of the columns in your CSV.</em></p> <p>Be sure that your CSV has the values in the same format as your SQL DB though, or you can run into errors. </p> <p>When this is run, you will not see any output to the console. I would recommend querying afterwards to be certain that your values are accepted.</p>
6,025,821
0
<p>As eluded to by @Space_C0wb0y, you need to either build Boost.System or use its correct name for linking (e.g. -lboost_system-mt).</p>
8,464,254
0
<p>You can use <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html#exec%28java.lang.String%29%20%22java.lang.Runtime.exec%28String%20command%29" rel="nofollow">java.lang.Runtime.exec(String command)</a> to execute a shell script from Java.</p>
40,232,797
0
Ext.Viewport.add is not a function In Ext js <p>I am very new to Ext js . I am trying to implement Grid in application in that once user will click on data new msg window will open with current data and user can edit that and this will saved in model. I am using Classic toolkit</p> <p>I tried like this:</p> <pre><code>Ext.define('MyApp.view.main.MainController', { extend: 'Ext.app.ViewController', alias: 'controller.main', require:['Ext.plugin.Viewport'], itemtap: function (view,index,item,record) { Ext.Viewport.add({ xtype:'formpanel', title:'update', width:300, centered: true, modal: true, viewModel : { data: { employee: record } }, items: [{ xtype: 'textfield', name: 'firstname', label: 'First Name', bind: '{employee.name}' }, { xtype: 'toolbar', docked: 'bottom', items: ['-&gt;', { xtype: 'button', text: 'Submit', iconCls: 'x-fa fa-check', handler: function() { this.up('formpanel').destroy(); } }, { xtype: 'button', text: 'Cancel', iconCls: 'x-fa fa-close', handler: function() { this.up('formpanel').destroy(); } }] }] }) </code></pre> <p>and In my other file i am calling this function like</p> <pre><code>listeners: { select: 'itemtap' } </code></pre> <p>But i am getting error like Ext.Viewport.add is not a function</p> <p>Kindly suggest me how can i make it possible .</p> <p>Any suggestions are welcome .</p>
40,940,303
0
<p>I found the problem for my case. Jenkins has a global Git timeout of 10 minutes, but my repository takes more than 10 minutes to clone. <a href="https://issues.jenkins-ci.org/browse/JENKINS-20387" rel="nofollow noreferrer">JENKINS-20387</a> has instructions for changing the timeout. You set <code>JAVA_OPTS=-Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60</code>. In my case, I had to also change it for the pod configuration for the slaves.</p>
11,715,834
0
Binding jqplot with dynamic data in asp.net c# <p>I am using jqplot to plot the graph in my project.I was able to draw it with static data.But i need to bind the chart with dynamic data from code behind with some datasource.</p> <p>I am new to jqplot and also in jquery. So, I am stuck on this. I will be very thankful for any solution to it.It will be grateful if you can provide example solution</p>
11,060,210
0
<p>Do you mean that it generates a <code>@property</code> declaration like this?</p> <pre><code>@property (nonatomic, retain) MyObject *object; </code></pre> <p>The <code>retain</code> property attribute means <code>strong</code> under ARC.</p> <p><a href="http://clang.llvm.org/docs/AutomaticReferenceCounting.html#ownership.spelling.property" rel="nofollow">4.1.1. Property declarations</a></p>
6,613,644
0
<p>Code + Unit test which will tell you whether a boxed or unboxed object is its default value. Also included generic version.</p> <pre><code> [Test] public void BoxedIntIsDefault() { Assert.That(IsDefault((object)0), Is.True); Assert.That(IsDefault((object)1), Is.False); Assert.That(IsDefault&lt;object&gt;(0), Is.True); Assert.That(IsDefault&lt;object&gt;(1), Is.False); } bool IsDefault(object obj) { return Equals(obj, GetDefault(obj.GetType())); } bool IsDefault&lt;T&gt;(T input) { return Equals(input, GetDefault(input.GetType())); } public static object GetDefault(Type type) { if (type.IsValueType) { return Activator.CreateInstance(type); } return null; } </code></pre>
5,089,719
0
from facebook, i want to fetch Hometown details . from it i want to saparate city,state, country <p>From facebook, i want to fetch Hometown details . from it i want to separate city,state, country. These fields are separated by comma. so i can split them by comma.</p> <p>my problem is: as soon i enter city name in hometown field of facebook, it is giving combination of city,state and country. but sometime it is giving combination of city and country so, when i split this string by comma, how to i know that second element is state or country.</p> <p>I can do one thing, i can check the length of array, if it has three filed then it has city/state/county. else city/county.</p> <p>Is this ture? can it have more files.</p>
19,444,591
0
<p>The cross section is just a line graph (or two) overlayed on your original chart.</p> <p>Here's an example of overlayed charts:</p> <p><a href="http://www.sqljason.com/2012/03/overlapping-charts-in-ssrs-using-range.html" rel="nofollow">http://www.sqljason.com/2012/03/overlapping-charts-in-ssrs-using-range.html</a></p>
32,663,299
0
<p>I am not sure if I understand you correctly but if you want to deploy applications on different ports, when launching your application, you can pass the port on the command line and do</p> <pre><code>./activator start -Dhttp.port=yourDynamicPort </code></pre> <p>as Kris suggests you can do </p> <pre><code>-Dhttp.address=yourIP </code></pre> <p>to assign address</p>
22,720,120
0
<p>You start with <code>num = 0</code>. You then set <code>temp = num</code>, so <code>temp</code> is zero. Thus your <code>while temp &gt; 0</code> loop never runs, and so nothing is ever added to <code>rev</code>. So when you try to use <code>join</code>, it just joins an empty list and produces an empty string.</p> <p>How to fix this is unclear, since you don't say what you want the code to do.</p>
11,068,331
0
<pre><code>unsigned long i = mybits.to_ulong(); unsigned char c = static_cast&lt;unsigned char&gt;( i ); // simplest -- no checks for 8 bit bitsets </code></pre> <p>Something along the lines of the above should work. Note that the bit field may contain a value that cannot be represented using a plain <code>char</code> (it is implementation defined whether it is signed or not) -- so you should always check before casting.</p> <pre><code>char c; if (i &lt;= CHAR_MAX) c = static_cast&lt;char&gt;( i ); </code></pre>
671,136
0
Wrap NSButton title <p>Any way to have a NSButton title to wrap when it's width is longer than the button width, instead of getting clipped? </p> <p>I'm trying to have a radio button with a text that can be long and have multiple lines. One way I thought about having it work is to have an NSButton of type NSRadioButton but can't get multiple lines of text to work.</p> <p>Maybe my best alternative is to have an NSButton followed by an NSTextView with the mouseDown delegate function on it triggering the NSButton state?</p>
7,832,362
0
Google Maps Marker bug in Firefox 7.0.1? <pre><code>var map; var infoWindow; var markersArray = []; var newMarkersArray = []; var pickup_marker; $(document).ready(function() { initialize(); }); function setMarkers() { var row_length = $('#hidden_coords tr').size(); // Values of the markers are hidden within the cells of this table var marker = []; for (var z = 0; z &lt; row_length; z++) { var lng = $('#coords_lng'+z).val().trim(); var lat = $('#coords_lat'+z).val().trim(); var coord = parseFloat(lng); var coord2 = parseFloat(lat); var pos = new google.maps.LatLng(coord,coord2); marker[z] = new google.maps.Marker({ position: pos, map: map }); markersArray.push(marker[z]); } if (markersArray) { for (i in markersArray) { markersArray[i].setMap(map); } } } function initialize() { var myLatLng = new google.maps.LatLng(14.640808,121.097224); var myOptions = { maxZoom: 22, minZoom: 1, zoom: 12, center: myLatLng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); infowindow = new google.maps.InfoWindow(); setMarkers(); google.maps.event.addListener(map, 'click', showInfoWindow); google.maps.event.addListener(map, 'click', function(event) { addMarker(event.latLng); }); } function addMarker(location) { //alert(location); var lat = location.lat(); var lng = location.lng(); $('#just_clicked_lat').val(lat); $('#just_clicked_lon').val(lng); marker = new google.maps.Marker({ position: location, map: map, icon: markerIcon }); if (newMarkersArray) { for (i in newMarkersArray) { newMarkersArray[i].setMap(null); } newMarkersArray.length = 0; } newMarkersArray.push(marker); } </code></pre> <p>This is my code. Function initialize() is called whenever the browser refreshes. Function setMarkers() makes the markers visible on the map. Function addMarker()adds a marker whenever I click on the map.</p> <p>I created two arrays, first the markersArray[], where the values of the stored lnglat that was retrieved from the database are placed. On the other hand, the newMarkersArray[] is where the new markers are placed (clicking on the map results into a marker being created).</p> <p>When creating a new marker, I make sure that only one new marker is displayed at a time. What happens if you create a marker is that an infowindow will popup which prompts the user to enter the name and address of the location. Once finished, the user should click the button which triggers an ajax function which calls a php method to save the values of the newly created marker to the sql database. Once its successfully saved, it is returned to the ajax function and the browser is reloaded using window.location.reload().</p> <p>Take note that this code works, on ALL OTHER BROWSERS except Firefox. The latest version I'm using is FF7.0.1. Please help! :(</p>
24,553,339
0
paste column values to another column <p>I have a simple questions that possibly can be solved with <code>paste</code> My data frame looks like this:</p> <pre><code>x&lt;-c(3,6,7) y&lt;-c(0.25,0.35,0.62) dta1&lt;-data.frame(x,y) x y 1 3 0.25 2 6 0.35 3 7 0.62 </code></pre> <p>I want to paste these values together in one column. And add or remove some characters at the same time. it will looks like this :</p> <pre><code> x 1 3(.25) 2 6(.35) 3 7(.62) </code></pre>
29,326,209
0
How would I get edit function with Json to redirect to another page with Angular js <p>I am having an issue were when i click edit the data only shows up on the same page not sure how to get it to redirect and show up on another page.</p> <p>controller partial code just the edit and update function </p> <pre><code>/** function to edit product details from list of product referencing php **/ $scope.prod_edit = function(index) { $scope.update_prod = true; $scope.add_prod = false; $http.post('db.php?action=edit_product', { 'prod_index' : index } ) .success(function (data, status, headers, config) { //alert(data[0]["prod_name"]); $scope.prod_id = data[0]["id"]; $scope.prod_name = data[0]["prod_name"]; $scope.prod_desc = data[0]["prod_desc"]; $scope.prod_price = data[0]["prod_price"]; $scope.prod_quantity = data[0]["prod_quantity"]; }) .error(function(data, status, headers, config){ }); } /** function to update product details after edit from list of products referencing php **/ $scope.update_product = function() { $http.post('db.php?action=update_product', { 'id' : $scope.prod_id, 'prod_name' : $scope.prod_name, 'prod_desc' : $scope.prod_desc, 'prod_price' : $scope.prod_price, 'prod_quantity' : $scope.prod_quantity } ) .success(function (data, status, headers, config) { $scope.get_product(); alert("Product has been Updated Successfully"); }) .error(function(data, status, headers, config){ }); } }); </code></pre> <p>db.php </p> <pre><code>/** Function to Edit Product **/ function edit_product() { $data = json_decode(file_get_contents("php://input")); $index = $data-&gt;prod_index; $qry = mysql_query('SELECT * from product WHERE id='.$index); $data = array(); while($rows = mysql_fetch_array($qry)) { $data[] = array( "id" =&gt; $rows['id'], "prod_name" =&gt; $rows['prod_name'], "prod_desc" =&gt; $rows['prod_desc'], "prod_price" =&gt; $rows['prod_price'], "prod_quantity" =&gt; $rows['prod_quantity'] ); } print_r(json_encode($data)); return json_encode($data); } /** Function to Update Product **/ function update_product() { $data = json_decode(file_get_contents("php://input")); $id = $data-&gt;id; $prod_name = $data-&gt;prod_name; $prod_desc = $data-&gt;prod_desc; $prod_price = $data-&gt;prod_price; $prod_quantity = $data-&gt;prod_quantity; // print_r($data); $qry = "UPDATE product set prod_name='".$prod_name."' , prod_desc='".$prod_desc."',prod_price='.$prod_price.',prod_quantity='.$prod_quantity.' WHERE id=".$id; $qry_res = mysql_query($qry); if ($qry_res) { $arr = array('msg' =&gt; "Product Updated Successfully!!!", 'error' =&gt; ''); $jsn = json_encode($arr); // print_r($jsn); } else { $arr = array('msg' =&gt; "", 'error' =&gt; 'Error In Updating record'); $jsn = json_encode($arr); // print_r($jsn); } } ?&gt; </code></pre> <p>The page i need it to redirect is <a href="http://localhost/angular_php/create_update.php" rel="nofollow">http://localhost/angular_php/create_update.php</a></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html ng-app="listpp" ng-app lang="en"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;link href="assets/css/bootstrap.min.css" rel="stylesheet"&gt; &lt;style type="text/css"&gt; ul&gt;li, a{cursor: pointer;} &lt;/style&gt; &lt;title&gt;Angular With PHP&lt;/title&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"&gt; &lt;/script&gt; &lt;script src="controller.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php include "templates/header.php";?&gt; &lt;br&gt;&lt;br&gt; &lt;div ng-controller="maincontroller"&gt; &lt;div class="wrapper"&gt; &lt;div class="container col-sm-8 col-sm-offset-2"&gt; &lt;div class="page-header"&gt; &lt;h4&gt;Add/Update Product&lt;/h4&gt; &lt;/div&gt; &lt;form class="form-horizontal" name="add_product" &gt; &lt;input type="hidden" name="prod_id" ng-model="prod_id"&gt; &lt;div class="form-group"&gt; &lt;label for="firstname" class="col-sm-2 control-label"&gt;Prod Name&lt;/label&gt; &lt;div class="col-sm-3"&gt; &lt;input type="text" class="form-control" name="prod_name" ng-model="prod_name" placeholder="Enter Product Name"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="lastname" class="col-sm-2 control-label"&gt;Prod Desc&lt;/label&gt; &lt;div class="col-sm-3"&gt; &lt;input type="text" class="form-control" name="prod_desc" ng-model="prod_desc" placeholder="Enter Product Description"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="lastname" class="col-sm-2 control-label"&gt;Prod Price&lt;/label&gt; &lt;div class="col-sm-3"&gt; &lt;input type="text" class="form-control" name="prod_price" ng-model="prod_price" placeholder="Enter Product Price"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="lastname" class="col-sm-2 control-label"&gt;Prod Quantity&lt;/label&gt; &lt;div class="col-sm-3"&gt; &lt;input type="text" class="form-control" name="prod_quantity" ng-model="prod_quantity" placeholder="Enter Product Quantity"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;div class="col-sm-offset-2 col-sm-10"&gt; &lt;button type="submit" class="btn btn-default" name="submit_product" ng-show='add_prod' value="Submit" ng-click="product_submit()"&gt;Submit&lt;/button&gt; &lt;button type="submit" class="btn btn-default" name="update_product" ng-show='update_prod' value="Update" ng-click="update_product()"&gt;Update&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;script src="assets/js/ui-bootstrap-tpls-0.10.0.min.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
13,610,489
1
Matplotlib Legend Subtitles <p>I would like to have subtitles in my graph legend using matplotlib. Is there any alternative to do this ?</p> <p>Thx,</p> <p>Best,</p>
13,077,996
0
<p>In order to evalutate a file you have to load into memory. However, you might be able to figure out how to read only parts of a file, depending on the file format. For example the PNG file specifies a header of size of 8 bytes. However, because of compression the chunks are variable. But if you would store all the pixels in a raw format, you can directly access each pixel, because you can calculate the adress of the file and the appropriate offset. What PNG, JPEG is going to do with the raw data is impossible to predict.</p> <p>Depending on the structure of the files you might be able to compute efficient hashes. I suppose there is loads of research, if you want to really get into this, for example: <a href="http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;arnumber=899541" rel="nofollow">http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;arnumber=899541</a></p> <p>"This paper introduces a novel image indexing technique that may be called an image hash function. The algorithm uses randomized signal processing strategies for a non-reversible compression of images into random binary strings, and is shown to be robust against image changes due to compression, geometric distortions, and other attacks"</p>
2,401,596
0
<p>Please see this <a href="http://forums.sun.com/thread.jspa?threadID=5127507" rel="nofollow noreferrer">link</a>.</p> <blockquote> <p>I just solved it actually by setting in the &lt;Applet .... tag the Name= property ...Now the Applet name is consistent across browsers.</p> </blockquote> <p>Otherwise try repeatedly calling:</p> <pre><code>getAppletContext().showStatus(""); </code></pre> <p>As described on <a href="http://www.jguru.com/faq/view.jsp?EID=487929" rel="nofollow noreferrer">jGuru</a>.</p>
506,534
0
<p>Yes, though you need to get familiar with the Team Foundation Server command line tf.exe.</p> <p>See the post I did about this a while ago here <a href="http://www.woodwardweb.com/vsts/unlocking_files.html" rel="nofollow noreferrer">http://www.woodwardweb.com/vsts/unlocking_files.html</a></p> <p>Since I wrote that post (in October 2005) some alternatives have come about for people who don't want the hassle of learning a new command line. </p> <p>You could install the <a href="http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx" rel="nofollow noreferrer">TFS 2008 Power Tools</a> on top of Visual Studio 2008 SP1 and you are able to do some of this from the UI in Visual Studio (Right click on the Developer in the Team Members node installed by the power tools and select "Show Pending Changes" and then "Undo..."</p> <p>Alternatively, install the excellent (and free) <a href="http://www.attrice.info/cm/tfs/" rel="nofollow noreferrer">TFS Sidekicks</a> from Attrice.</p> <p>Good luck.</p>
18,501,135
0
<p>Try this:</p> <pre><code>&lt;div class="buttons"&gt; &lt;a href="#" class="btn" index="0"&gt;Button 1&lt;/a&gt; &lt;a href="#" class="btn" index="1"&gt;Button 2&lt;/a&gt; &lt;a href="#" class="btn" index="2"&gt;Button 3&lt;/a&gt; &lt;/div&gt; &lt;div class="text"&gt;&lt;/text&gt; var arr = ['First', 'Second', 'Third.']; $(".btn").on('click', function (e) { var index = $(this).attr("index"); $(".text").text(arr[index]); }); </code></pre>
39,126,959
0
<p>In v8.0, the client is able to retrieve information from the backend system because it passed the challenge presented to it, and in return received an access token that enables it to access resources that are protected by a scope, which you define. This is how OAuth works more or less.</p> <p>Have you read the Authentication Concepts tutorial? <a href="https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/authentication-and-security/" rel="nofollow">https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/authentication-and-security/</a></p>
9,365,243
0
<p>SQLite doesn't have any built in boolean type. You need to handle it yourself. I typically use and integer value instead and set it equal to 1 or 0 for true or false. Then if you want to check if it is true in the DB you check if the value is 1, etc.</p>
19,227,641
0
store each string in sentence in reverse way <p>i try with buffered string.reverse(); but i want reverse each word of sentence. so i try with this..</p> <pre><code> for(int a = 0;a &lt;= msgLength; a++){ temp += msg.charAt(a); if((msg.charAt(a) == '')||(a == msgLength)){ for(int b = temp.length()-1; b &gt;= 0; b--){ encrypt_msg += temp.charAt(a); if((b == 0) &amp;&amp; (a != msgLength)) encrypt_msg += ""; } temp = ""; } } </code></pre> <p>plz help me to simplify this logic. string is user defined. i wanted to print reversed string in jtextfields. </p>
31,614,397
0
<p>U could look at </p> <p><a href="http://martyjs.org/" rel="nofollow">http://martyjs.org/</a> which is an implementation of the Flux Application Architecture. </p> <p>(es6 support/React native support/ Higher order components (containers: <a href="https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750" rel="nofollow">https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750</a>))</p>
33,759,346
0
<p>Solution is to ditch the join table and have a direct reference between Test &lt;> Team. </p> <p>The SQL you are seeing makes sense as Hibernate cannot know that TestTeam will be the same entity referenced by Test and Team.</p> <pre><code>Test test = .../ test.getTestTeam();//triggers load **where test_id = test.id** Team team = test.getTestTeam().getTeam(); team.getTestTeam();// triggers load **where team_id = team.id** </code></pre>
20,824,408
0
How server respond for html, ajax, xml and json for rails app <p>In my rails app I send request in html, ajax, xml and json. For xml and json I do it by writing :format => 'json/xml', for ajax we write :remote => true. </p> <p>But how server know that it has to respond with ajax, xml or json? One thing I noticed when I send json or xml request it show in the url like below</p> <pre><code>http://localhost:3000/en/line_items.json </code></pre> <p>Though Im not sure, this is how server know if he has to give json response. But for html and ajax something like this is don't add in the url. So how server know whether it is ajax or html request?</p>
40,470,966
0
Unable to create envelope from given source because the root element is not named Envelope <p>I have a SOAP request that I've tested in SoapUI. I successfully get the desired response.</p> <p>The problem in my code occurs when I'm testing whether or not the response was successful at <code>if (isSuccessResponse(soapResponse)) {</code> below:</p> <pre><code>public static void main(String[] args) throws Exception { // Establish SOAP connection SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); SOAPConnection soapConnection = soapConnectionFactory.createConnection(); // Generate SOAP request SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), namespaceURI); // Test to see if SOAP response is available System.out.print("SOAP Response:"); System.out.println(); soapResponse.writeTo(System.out); // Close connection soapConnection.close(); if (isSuccessResponse(soapResponse)) { System.out.println("Success!"); } else { System.out.println("Fault!"); } } </code></pre> <p><strong>Success?</strong></p> <pre><code>private static boolean isSuccessResponse(SOAPMessage soapResponse) throws Exception { NodeList responseNodes = soapResponse.getSOAPBody().getElementsByTagNameNS("*", "HelpDesk_QueryList_Service"); if (responseNodes.getLength() == 1) return true; else return false; } </code></pre> <p><strong>Request:</strong> This code does in fact print out the correct request as it is identical to the working request in SoapUI. So why can't I get the related relevant information from the actual response? The printed response is the blank default response with all the of requisite headers but none of the desired information from my request:</p> <pre><code>private static SOAPMessage createSOAPRequest() throws Exception { MessageFactory messageFactory = MessageFactory.newInstance(); // Create SOAP Message SOAPMessage soapMessage = messageFactory.createMessage(); // Add request envelope, headers, and nodes from SOAP request SOAPPart soapPart = soapMessage.getSOAPPart(); // I used ? here for privacy reasons String xmlns = "?"; String username = "?"; String password = "?"; String qualification = "'?"; SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("urn", xmlns); SOAPHeader soapHeader = envelope.getHeader(); SOAPElement authInfoElem = soapHeader.addChildElement("AuthenticationInfo", "urn"); createElementAndSetText(authInfoElem, "userName", username); createElementAndSetText(authInfoElem, "password", password); SOAPBody soapBody = envelope.getBody(); SOAPElement bodyElem = soapBody.addChildElement("HelpDesk_QueryList_Service", "urn"); createElementAndSetText(bodyElem, "Qualification", qualification); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("SOAPAction", xmlns + "/HelpDesk_QueryList_Service"); // Save request soapMessage.saveChanges(); // Print the request message System.out.print("SOAP Request:"); System.out.println(); soapMessage.writeTo(System.out); System.out.println(); System.out.println(); return soapMessage; } </code></pre> <p><strong>Error:</strong> I get the following error but I'm not sure why.</p> <pre><code>Lis 07, 2016 6:10:34 ODP. com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl lookForEnvelope SEVERE: SAAJ0514: Unable to create envelope from given source because the root element is not named Envelope Lis 07, 2016 6:10:34 ODP. com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory createEnvelope SEVERE: SAAJ0511: Unable to create envelope from given source Exception in thread "main" com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source: at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:117) at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:69) at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:128) at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.java:1351) at com.xxxx.automation.remedy.RemedySOAPService.isSuccessResponse(RemedySOAPService.java:135) at com.xxxx.automation.remedy.RemedySOAPService.main(RemedySOAPService.java:52) Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source because the root element is not named "Envelope" at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:154) at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:121) at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:110) ... 5 more CAUSE: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source because the root element is not named "Envelope" at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:154) at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:121) at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:110) at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:69) at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:128) at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.java:1351) at com.xxxx.automation.remedy.RemedySOAPService.isSuccessResponse(RemedySOAPService.java:135) at com.xxxx.automation.remedy.RemedySOAPService.main(RemedySOAPService.java :52) </code></pre> <p><strong>SOAP Response:</strong></p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;ns0:HelpDesk_QueryList_ServiceResponse xmlns:ns0="urn:XX:XXXX:HPD_IncidentInterface_WS"&gt; &lt;ns0:getListValues&gt; &lt;ns0:Assigned_Group&gt;XXXX&lt;/ns0:Assigned_Group&gt; &lt;ns0:Assigned_Group_Shift_Name/&gt; &lt;ns0:Assigned_Support_Company&gt;XXXX&lt;/ns0:Assigned_Support_Company&gt; &lt;ns0:Assigned_Support_Organization&gt;XXXX&lt;/ns0:Assigned_Support_Organization&gt; &lt;ns0:Assignee/&gt; &lt;ns0:Categorization_Tier_1/&gt; &lt;ns0:Categorization_Tier_2/&gt; &lt;ns0:Categorization_Tier_3/&gt; &lt;ns0:City/&gt; &lt;ns0:Closure_Manufacturer/&gt; &lt;ns0:Closure_Product_Category_Tier1&gt;XXXX&lt;/ns0:Closure_Product_Category_Tier1&gt; &lt;ns0:Closure_Product_Category_Tier2&gt;XXXX&lt;/ns0:Closure_Product_Category_Tier2&gt; &lt;ns0:Closure_Product_Category_Tier3/&gt; &lt;ns0:Closure_Product_Model_Version/&gt; &lt;ns0:Closure_Product_Name/&gt; &lt;ns0:Company&gt;XXXX&lt;/ns0:Company&gt; &lt;ns0:Contact_Company&gt;XXXX&lt;/ns0:Contact_Company&gt; &lt;ns0:Contact_Sensitivity&gt;Standard&lt;/ns0:Contact_Sensitivity&gt; &lt;ns0:Country/&gt; &lt;ns0:Department&gt;XXXX&lt;/ns0:Department&gt; &lt;ns0:Summary&gt;XXXX&lt;/ns0:Summary&gt; &lt;ns0:Notes/&gt; &lt;ns0:First_Name&gt;XXXX&lt;/ns0:First_Name&gt; &lt;ns0:Impact&gt;4-Minor/Localized&lt;/ns0:Impact&gt; &lt;ns0:Incident_Number&gt;XXXX&lt;/ns0:Incident_Number&gt; &lt;ns0:Internet_E-mail&gt;XXXX&lt;/ns0:Internet_E-mail&gt; &lt;ns0:Last_Name&gt;XXXX&lt;/ns0:Last_Name&gt; &lt;ns0:Manufacturer/&gt; &lt;ns0:Organization&gt;XXXX&lt;/ns0:Organization&gt; &lt;ns0:Phone_Number&gt;XXXX&lt;/ns0:Phone_Number&gt; &lt;ns0:Priority&gt;Low&lt;/ns0:Priority&gt; &lt;ns0:Priority_Weight&gt;0&lt;/ns0:Priority_Weight&gt; &lt;ns0:Product_Categorization_Tier_1&gt;XXXX&lt;/ns0:Product_Categorization_Tier_1&gt; &lt;ns0:Product_Categorization_Tier_2&gt;XXXX&lt;/ns0:Product_Categorization_Tier_2&gt; &lt;ns0:Product_Categorization_Tier_3/&gt; &lt;ns0:Product_Model_Version/&gt; &lt;ns0:Product_Name/&gt; &lt;ns0:Region/&gt; &lt;ns0:Reported_Source xsi:nil="true"/&gt; &lt;ns0:Resolution/&gt; &lt;ns0:Resolution_Category/&gt; &lt;ns0:Resolution_Category_Tier_2/&gt; &lt;ns0:Resolution_Category_Tier_3/&gt; &lt;ns0:Service_Type&gt;User Service Restoration&lt;/ns0:Service_Type&gt; &lt;ns0:Site&gt;XXXX&lt;/ns0:Site&gt; &lt;ns0:Site_Group&gt;XXXX&lt;/ns0:Site_Group&gt; &lt;ns0:Status&gt;Cancelled&lt;/ns0:Status&gt; &lt;ns0:Status_Reason xsi:nil="true"/&gt; &lt;ns0:Urgency&gt;4-Low&lt;/ns0:Urgency&gt; &lt;ns0:VIP&gt;No&lt;/ns0:VIP&gt; &lt;ns0:ServiceCI/&gt; &lt;ns0:ServiceCI_ReconID/&gt; &lt;ns0:HPD_CI/&gt; &lt;ns0:HPD_CI_ReconID/&gt; &lt;ns0:HPD_CI_FormName/&gt; &lt;ns0:z1D_CI_FormName/&gt; &lt;ns0:Vendor_Ticket_Number xsi:nil="true"/&gt; &lt;ns0:Corporate_ID&gt;XXXX&lt;/ns0:Corporate_ID&gt; &lt;ns0:Submitter&gt;XXXX&lt;/ns0:Submitter&gt; &lt;ns0:Pending_Date xsi:nil="true"/&gt; &lt;/ns0:getListValues&gt; &lt;/ns0:HelpDesk_QueryList_ServiceResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre>
30,867,134
0
<p>Just want to jump in here. I've written a blog post <a href="http://drekka.ghost.io/objective-c-generics/" rel="nofollow">over here</a> about Generics. </p> <p>The thing I want to contribute is that <strong>Generics can be added to any class</strong>, not just the collection classes as Apple indicates. </p> <p>I've successfully added then to a variety of classes as they work exactly the same as Apple's collections do. ie. compile time checking, code completion, enabling the removal of casts, etc.</p> <p>Enjoy.</p>
37,312,954
0
<p><code>runtime.Stack()</code> puts a formatted stack trace into a supplied <code>[]byte</code>. You can then convert that to a string.</p> <p>You can also use <code>debug.Stack()</code>, which allocates a large enough buffer to hold the entire stack trace, puts the trace in it using <code>runtime.Stack</code>, and returns the buffer (<code>[]byte</code>).</p>
29,610,654
0
<p>What you are suggesting does not make a lot of sense so there must be something outside the query that is causing this. </p> <p>My guess is that the types of the columns are:</p> <ul> <li>Act_Run_Hrs integer </li> <li>Act_Run_Labor_Hrs float</li> </ul> <p>In this case sql sever will do an implicit cast (like the following) from float to integer for Act_Run_Hrs which would give you the result you have seen.</p> <pre><code>UPDATE Job_Op_Time SET Act_Run_Qty = Act_Run_Qty + 1, Act_Run_Hrs = CAST(ROUND(CAST(((Act_Run_Qty + 1) * @Cycle) AS FLOAT)/3600,2) as int), Act_Run_Labor_Hrs = ROUND(CAST(((Act_Run_Qty + 1) * @Cycle) AS FLOAT)/3600,2) WHERE Job_Operation = @Op AND Work_Date = DATEADD(dd,0,DATEDIFF(dd,0,@L)) </code></pre> <p>Another possibility is that another transactions is getting in and altering the data between this update running and you looking at the result.</p>
39,655,068
0
php alert message upload successful <p>I have this code:</p> <pre><code>&lt;?php if (isset ($_FILES['UploadFileField'])){ $UploadName = $_FILES['UploadFileField'] ['name']; $UploadName = mt_rand (100000, 999999).$UploadName; $UploadTmp = $_FILES['UploadFileField'] ['tmp_name']; $UploadType = $_FILES['UploadFileField'] ['type']; $FileSize = $_FILES['UploadFileField'] ['size']; $UploadName = preg_replace("#[^a-z0-9.]#i", "", $UploadName); if(($FileSize &gt; 1250000)){ die ("Error - File to Big"); } if(!$UploadTmp) { die ("No File Selected"); } else { move_uploaded_file($UploadTmp, "Upload/$UploadName"); } header('Location: /index.php'); exit; } ?&gt; </code></pre> <p>This code works, but I need insert a message of successful after that is done Upload file. Thank you!</p>
21,109,375
0
<p>You can use class wildcards if you want to be able to assign variables of multiple types to a var:</p> <pre><code>public var One:*; </code></pre> <p>Alternatively if both of your classes extend the same class you can use that as the base class for your var:</p> <pre><code>public class Words{ ... } public class Poem extends Words{ ... } public class Prose extends Words{ ... } public var Soliloquy:Words; </code></pre>
31,814,487
0
<p>The only odd thing in your pointcut is the rogue '\' I see ahead of the * in the cflow pointcut component. I'd also suggest using execution() if you can rather than call() (there are typically lots of call sites to instrument but only one execution site).</p> <pre><code>cflow(execution(* ext.demo.Report.*(..))) &amp;&amp; execution(* ext.demo.QueryUtil.*(..)) </code></pre> <p>If it isn't behaving for you then break it down to work out which piece is at fault. Does <code>execution(* ext.demo.QueryUtil.*(..))</code> match everything you expect? Does <code>execution(* ext.demo.Report.*(..))</code> match everything you expect? (I'd use <code>-showWeaveInfo</code> to check)</p>
26,198,858
0
LINQ and converting int? to int <p>Following gives me a cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?) error:</p> <pre><code>public class JobStructure { public JobStructure() { } public JobStructure(int? jobId, int? parentJobId) { var js = from r in dbc.fnJobStructure(someParameter_to_database_function) select new JobStructure { JobID = r.JobID //&lt;-------------ERROR: cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?) }; } public int JobID { get; set; } } </code></pre> <p>JobID is of type Int, and r.JobId that's coming from my database is nullable (it shouldn't be but it is). That's beyond the point; </p> <p>I just wanna know how to deal with this problem int? to int problem in general</p> <p>thanks</p> <hr> <h2>EDIT</h2> <p>Actually, Never mind; I don't have a way of verifying the answers; the problem here is a fundamental one; I'm creating a whole new instance of my class inside the linq expression which will have its own JobId; so when I'm actually calling the JobStructure constructor, I am never assigning a proper jobId (a new instance in the linq gets created and once we're out of the constructor, that instance with the proper jobId is dead.) Anyways thought I'd let everyone know (I tried to delete my question, but it warned against it... so I'm leaving it here with the Edited note) cheers</p>
35,618,210
0
<p>Why are you putting <code>ref.a</code> inside <code>{}</code>? You were essentially trying to create a object with no key value. Here's the fix:</p> <pre><code>var ref = [{"a":"x","b":"y"]; var someArrayOfObject = [{t1:ref.a},{t1:ref.b}]; </code></pre>
10,618,822
0
JavaScript doesn't append script <p>I'm using "PHP Form Builder Class" to generate form and submit it with ajax, but i dont think problem is related to "PHP Form Builder Class".</p> <p>I`m loading form and "PHP Form Builder Class" is generating javascript that binds some events to submit action, and jquery-ui button etc.</p> <p>When i submit form and get response from server (html+javascript) then i empty container and load new data - with the same form (to show errors or submit new one). </p> <p>Problem is that second time it wont bind any events to my form.</p> <p>I have removed all events from previous html code, before deleting it and adding new one.</p> <p>So now to the weird part - when i insert new html and js into my container it wont show that particular javascript code that is intended for form. I cant see it in html DOM anywhere when inspecting. I added simple alert(1) in it to check if it will run, and it does, although rest of the code doesnt - and i dont get any errors. So how can this alert run when it doesn't show in dom. I'm appending code with jquery.html()</p> <p>I know its not easy to understand my problem, but i hope someone will</p>
13,634,008
0
<p>That method does work, though if you can, you would be better off setting these values in the code-behind; it will help keep your ASPX clean.</p> <p>You can add meta data like:</p> <pre><code>HtmlMeta meta = new HtmlMeta(); meta.Name = "keywords"; meta.Content = srKeywords; this.Header.Controls.Add(meta); meta = new HtmlMeta(); meta.Name = "Description"; meta.Content = srDescription; this.Header.Controls.Add(meta); </code></pre> <p>And page title:</p> <pre><code>Page.Title = stTitle; </code></pre>
9,016,749
0
HTML/CSS: Content Div slips down <p>i have a simple markup with a navigation <code>div</code>, a content <code>div</code> and a footer <code>div</code>. If I open my "page", everything seems okay. But if I open the page and then resize the browser window to e.g. 30%, then the <strong>content</strong> <code>div</code> slides down.</p> <p>It seems only to occur in internet explorer.</p> <p>The test markup:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;div id="navi" style="float:left;width:197px;background-color:blue;"&gt; NaviContent &lt;br /&gt;&lt;br /&gt; more NaviContent &lt;/div&gt; &lt;div id="content" style="width:820px;background-color:yellow"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Content &lt;br /&gt;&lt;br /&gt; more ContentContent &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; more ContentContent &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; more ContentContent &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;div id="footer" style="clear:both;"&gt; Footer Content &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Images of the problem:</p> <p>browser in 100% view: <a href="http://www.suckmypic.net/25729/1.png" rel="nofollow">http://www.suckmypic.net/25729/1.png</a></p> <p>browser window resized: <a href="http://www.suckmypic.net/25730/2.png" rel="nofollow">http://www.suckmypic.net/25730/2.png</a></p> <p><em>Please help</em></p>
13,616,939
0
<p>The only thing that sticks out is "<code>&amp;</code>" which is <code>+</code> in SQL Server. However, <code>&amp;</code> in access also treats NULL values as the empty string, which needs further processing with <code>ISNULL</code> in SQL Server:</p> <pre><code>SELECT table1.* FROM table1 INNER JOIN (table2 INNER JOIN table3 ON ( table2.custkey = table3.custkey ) AND ( table2.sequence = table3.sequence )) ON table1.account = table2.account WHERE (( LEFT(table2.keyid, 1) = 'B' )) ORDER BY isnull(table3.lastname,'') + isnull(table3.firstname,''), table1.account; </code></pre> <p>If I were to write the query in SQL Server from scratch, I would probably do the joins serially rather than do the t2-t3 in a bracket before joining back to t1. The test for the first character would also be expressed as LIKE (a personal preference).</p> <pre><code> SELECT table1.* FROM table1 JOIN table2 ON table1.account = table2.account JOIN table3 ON table2.custkey = table3.custkey AND table2.sequence = table3.sequence WHERE table2.keyid LIKE 'B%' ORDER BY isnull(table3.lastname,'') + isnull(table3.firstname,''), table1.account; </code></pre>
13,096,455
0
<p>You can call a PHP file from JavaScript and pass the variables you want via POST or GET. Or simply set a COOKIE.</p> <p>Cookie would be sent to PHP at the very first next page request and PHP can act on it.</p>
11,041,183
0
<p>You can protect both your password and your salt.</p> <ol> <li><p>Use SHA256 or higher (2012) and in years to come it must be higher.</p></li> <li><p>Use a different salt for every user. </p></li> <li><p>Use a calculated salt.</p></li> <li><p>Create a 16 to 32 byte Salt and store it in the database, called 'DBSalt'.</p></li> <li><p>Create any old algorithm to manipulate the salt but keep the algorithm only in code. Even something as simple as DBSalt + 1 is useful because if someone gets your database, they don't actually have the correct salt because the correct salt is calculated.</p></li> <li><p>Calculate your password as follows:</p> <p>CreateHash(saltAlgorithm(dbSalt), password);</p></li> <li><p>You can add security by having a list of algorithms that manipulate the DBSalt in different ways. Every time a user changes their password you also use a different calculation against the DBSalt</p></li> <li><p>You can add more security by having these algorithms be stored on web servers external to your system so if your DB and code both get hacked, they still don't have your salt.</p> <ol> <li>You can also increase security by having a before, and after, or both salt and the database alone doesn't provide this information.</li> </ol></li> </ol> <p>There is no end to the "You can increase security by..." comments. Just remember, every time you add security, you add complexity, cost, etc...</p> <p><a href="http://www.rhyous.com/2012/06/18/how-to-effectively-salt-a-password-stored-as-a-hash-in-a-database/" rel="nofollow">How to effectively salt a password stored as a hash in a database</a> </p>
4,544,859
0
How to display something from array with another name in PHP? <p>I have one array that returns one element $name, and I want to display it with another name, For example:</p> <p>$name = 'PC' and I want to display it as 'PC COMPUTER', first array displays element wich is true, how to compare this elements with another array to display it with that other names?</p>
8,168,946
0
<p>Many ASP.NET controls contain a settable <code>ToolTip</code> property</p>
27,624,621
0
<p>You don't have to wait! If you look at the javadocs for resolveService(NsdServiceInfo serviceInfo, NsdManager.ResolveListener listener) <a href="http://developer.android.com/reference/android/net/nsd/NsdManager.html#resolveService(android.net.nsd.NsdServiceInfo,%20android.net.nsd.NsdManager.ResolveListener)">here</a> you'll notice that for the parameter listener it say's "to receive callback upon success or failure. Cannot be null. Cannot be in use for an active service resolution."</p> <p>Therefore in order for this to work just do the following:</p> <pre><code>mNsdManager.resolveService(service, new MyResolveListener()); </code></pre> <p>Where MyResolveListener is:</p> <pre><code>private class MyResolveListener implements NsdManager.ResolveListener { @Override public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) { //your code } @Override public void onServiceResolved(NsdServiceInfo serviceInfo) { //your code } } </code></pre> <p>hope this helps :)</p>
20,808,358
0
<p>You are missing a "return":</p> <pre><code>return RedirectToAction(...); </code></pre> <p>If you want to reuse the method multiple times you should look into writing a filter.</p>
11,270,987
0
<p>Very simple fix:</p> <pre><code>string User = Environment.UserName; toolStripStatusLabel1.Text = "This Software is Licensed to: " + User; // Add a space after 'to:' </code></pre> <p>Hope this helps!</p>
5,144,373
0
Can't seem to read UITextField value correctly <p>I am trying to verify that my uitextfield, which only allows numbers isn't 0 (zero). This check fails every time? When debugging resultingString = '0'( I type in zero ) as I am trying to make it fail, but it doesn't fail. </p> <p><code>NSString *resultingString = budgetField.text;</p> <pre><code>if(resultingString == @"0" || [resultingString length] == 0){ [AppHelpers showAlert:@"Dude!" withMessage:@"Don't be cheap I know you have more than a $1"]; //never gets in here. return; } </code></pre> <p></code></p>
18,589,405
0
<p>After the click on day it is not adding the class, so see if this helps</p> <pre><code>$(".ui-datepicker-current-day").click(function(){ $(this).parent().addClass('current-week'); }); </code></pre>
27,309,554
0
Publish asmx web service to FTP server given parser error <p>I create web service name <strong>Webservice.asmx</strong> into Web application name <strong>Publish_test</strong> using VS2013 every thing is work find,but when i publisher it my host i get this error :</p> <pre><code>Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not create type 'Publish_test.MyWebService.WebService'. Source Error: Line 1: &lt;%@ WebService Language="C#" CodeBehind="~/WebService.asmx.cs" Class="Publish_test.MyWebService.WebService" %&gt; Source File: /test/test/MyWebService/WebService.asmx Line: 1 Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5483 </code></pre> <p>My web Service Code :</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace Publish_test.MyWebService { /// &lt;summary&gt; /// Summary description for WebService1 /// &lt;/summary&gt; [WebService(Namespace = "http://src-services.com/test/test/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class WebService : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } } } </code></pre>
29,242,028
0
<p>because your <code>.column</code> divs are <code>float:left;</code> you need a container with <code>clear:both;</code> after the columns:</p> <pre><code>&lt;section&gt; &lt;h4&gt;WHAT WE DO&lt;/h4&gt; &lt;h2&gt;HEADING&lt;/h2&gt; &lt;div class="column"&gt; &lt;div class="item"&gt;&lt;/div&gt; &lt;h3&gt;ITEM1&lt;/h3&gt; &lt;p&gt;Necessitatibus ipsa ex hic sunt maxime.&lt;/p&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div class="item"&gt;&lt;/div&gt; &lt;h3&gt;ITEM2&lt;/h3&gt; &lt;p&gt;Molestias ipsum ex deleniti illo qui obcaecati repellat.&lt;/p&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div class="item"&gt;&lt;/div&gt; &lt;h3&gt;ITEM3&lt;/h3&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit.&lt;/p&gt; &lt;/div&gt; &lt;div class="clearer"&gt;&lt;/div&gt; &lt;/section&gt; </code></pre> <p>CSS</p> <pre><code>.clearer { clear:both; } </code></pre> <p><a href="http://codepen.io/anon/pen/myvwNY" rel="nofollow">http://codepen.io/anon/pen/myvwNY</a></p> <p>Without the <code>clear</code> the container the floating divs are in has no height.</p>
30,476,496
0
<p>Jesse Gallagher's Scaffolding framework also accesses Java objects rather than dominoDocument datasources. I've used (and modified) Tim Tripcony's Java objects in his "Using Java in XPages series" from NotesIn9 (the first is <a href="http://www.notesin9.com/2013/12/17/notesin9-132-using-java-in-xpages-part-1/" rel="nofollow">episode 132</a>. The source code for what he does is on <a href="https://bitbucket.org/timtripcony/howyabean" rel="nofollow">BitBucket</a>. This basically converts the dominoDocument to a Map. It doesn't cover MIME (Rich Text) or attachments. If it's useful, I can share the amendments I made (e.g. making field names all the same case, to ensure it still works for existing documents, where fields may have been created with LotusScript).</p>
18,803,313
0
<p>Have you looked at the instructions in this site <a href="http://rubyinstaller.org/" rel="nofollow">http://rubyinstaller.org/</a> it really helped me when i try to do that.</p> <p>Here is another site to help you out <a href="https://www.ruby-lang.org/en/downloads/" rel="nofollow">https://www.ruby-lang.org/en/downloads/</a></p>
24,918,970
0
Git GUI push button does not work <p>I was copying my repository to github from my local computer using the command - git push origin master, after cd-ing into my repo directory. </p> <p>When, I tried this using Git gui, I can scan for changes to the repo and commit them. But I cannot push them to my remote repository. How do I find out the reason for this error and how do I fix it ?</p>
20,002,139
0
Trying to read a serverside file with GWT <p>I am new to the whole GWT thing and for a project I need to read a serverside file via an asynchronous call and return an array of data to the client. So far I followed an RPC tutorial and implemented the server and client side code as well as the web.xml file but when I try to RPC the DataExtraction method on my client, it will result in the following error:</p> <blockquote> <p>javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract int[] ch.uzh.ifi.se.swela.client.DataExtractorService.extract(java.lang.String) throws java.io.IOException' threw an unexpected exception: java.security.AccessControlException: access denied ("java.io.FilePermission" "/SE Swiss Election App/war/tables/Ferien_K.csv" "read")</p> </blockquote> <p>This is the call:</p> <pre><code>DataExtractorServiceClientImpl clientImpl = new DataExtractorServiceClientImpl(GWT.getModuleBaseURL() + "dataExtractor"); clientImpl.extract("/SE Swiss Election App/war/tables/Ferien_K.csv"); </code></pre> <p>For me it seems like, that the server does not have the permission to open the file, but how would I fix that? Thank you in advance.</p>
9,735,989
0
MVC 3 - Only display/use certain model properties <p>Being fairly new to MVC 3 I am not sure of the best approach for this. Let's say I have a simple class like this...</p> <pre><code>Public Class PDetail &lt;Required&gt; Public Property FirstName As String &lt;Required&gt; Public Property LastName As String &lt;Required&gt; Public Property CellNo As String &lt;Required&gt; Public Property PassportNo As String &lt;Required&gt; Public Property Nationality As String Public Property ExtraRequirements As String End Class </code></pre> <p>This is used to create my model. During a booking process I may prompt for these values on a view. However depending on the type of booking I may not wish to ask some of these questions. For example I may not require the PassportNo and Nationality if the booking does not involve going to a foreign country.</p> <p>What's the best way to deal with this? The easy way seems to be to have a separate property that determines which fields are shown as EditorFor and the others use HiddenFor. But is this sensible? Also when it comes to server side validation the hidden fields are still validated.</p> <p>The class above is a simplified version of what I actually do. I have up to 10 fields that can be shown or hidden independently depending on the type of booking, so creating a separate model for each combination would be a nightmare.</p>
16,027,233
0
<p>When doing your comparison, <code>&lt;= size</code> means you're iterating 1 past the end of the array. It's most likely picking up some really huge garbage value and that becomes the minimum.</p> <p>Use <code>for (int i = 1; i &lt; size; ++i) { /* ... */ }</code> to get what you need.</p>
1,991,315
0
<p>There are two ways to add items to the context menu. </p> <p><strong>Registry</strong></p> <p>This method is easy since it comes down to adding some registry keys. The downside is that you can't put any logic in it. You can read about it <a href="http://msdn.microsoft.com/en-us/library/bb776820%28VS.85%29.aspx" rel="nofollow noreferrer">here</a> and <a href="http://www.delphi3000.com/articles/article_4119.asp?SK=" rel="nofollow noreferrer">here</a> a simple example in Delphi. You get a bit more control if you are using DDE to execute the menu items. See <a href="http://cc.embarcadero.com/Item/17787" rel="nofollow noreferrer">here</a> for a Delphi example. If DDE doesn't solve your 'already running' problem you could try and have your applications communicate with each other trough some way of IPC.</p> <p><strong>Shell Extension</strong></p> <p>This method is a bit more work, but you can completely control the context menu from code. You would have to write a DLL, implement <a href="http://msdn.microsoft.com/en-us/library/bb776095%28VS.85%29.aspx" rel="nofollow noreferrer">IContextMenu</a> (or others) and register the dll with Windows Explorer. You can read about it <a href="http://msdn.microsoft.com/en-us/library/bb776881%28VS.85%29.aspx" rel="nofollow noreferrer">here</a>. You could also check out <a href="http://www.shellplus.com/examples/shortcut-menu-example.html" rel="nofollow noreferrer">Shell+</a>.</p>
6,891,285
0
<p>It's a bit of a pain, to be honest. Even more so, in my opinion, if you're using Federated Identity, such as Windows Identity Foundation and/or Azure AppFabric Access Control Service.</p> <p>Your Ajax calls can't handle the redirect. </p> <p>My solution/suggestion is not to mark your Ajax-invoked controller action methods with [Authorize], but instead rely on the presence of some value that you insert into Session State from a controller action that does have an [Authorize] (typically the controller action method that was called to display the view). You know that the value can't have got into Session State unless the user was authenticated (and the session hasn't timed out). Fail the call to your Ajax method if this value isn't present, returning a specific JSON result that you can handle gracefully in your client-side code.</p> <p>Using [Authorize] on an Ajax controller method causes weird, often hidden, errors (such as updates disappearing).</p>
16,058,599
0
<p>If you want to extract pdf text into a astring, try to use <code>PdfTextExtractor.GetTextFromPage</code>, a sampe code:</p> <pre><code>public string ReadPdfFile(string fileName) { var text = new StringBuilder(); if (File.Exists(fileName)) { var pdfReader = new PdfReader(fileName); for (int page = 1; page &lt;= pdfReader.NumberOfPages; page++) { var strategy = new SimpleTextExtractionStrategy(); string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy); currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText))); text.Append(currentText); } pdfReader.Close(); } return text.ToString(); } </code></pre>
19,122,094
0
HTTP_HOST strlen wrong length <p>I'm trying to compare the <code>HTTP_HOST</code> with my domain name which failed. Struggling to find out what causes this, I tried to print the length of it. To my surprise it outputs the length of my actual domain name (although I am using a web proxy).</p> <p>Using <code>strlen</code> I would receive the same length as in this <code>var_dump()</code> output (showing only what's necessary):</p> <pre><code>["HTTP_HOST"]=&gt; string(12) "mydomain.com.s48.wbprx.com" ["SERVER_NAME"]=&gt; string(12) "mydomain.com.s48.wbprx.com" </code></pre> <p>My original domain was replaced with mydomain.com including the length of the string.</p> <p>I am very stunned, how come I can print the string using echo and see it in its whole, but not get the string length? Even when I did <code>str_replace('.','', $str)</code> it would return me <code>"mydomaincom"</code></p> <p>If it is to any help my website also uses the following htaccess code:</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / # Removes .php RewriteCond $1 !\.(gif|jpe?g|png|bmp)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L] &lt;/IfModule&gt; </code></pre> <p>I've tried with both .php and without. Same result.</p> <p>This result was produced using: <a href="https://incloak.com/" rel="nofollow">https://incloak.com/</a></p> <p>My PHP version is <code>5.3.14</code> if that would make any difference.</p>
337,465
0
<p>Unwind has it right, except you should use 'sendto'</p> <p>Here is an example, that assumes you already have a socket. It was taken from <a href="http://www.blushingpenguin.com/svn/vendor/clamav/0.94.2/clamav-milter/clamav-milter.c" rel="nofollow noreferrer">clamav</a></p> <pre><code>static void broadcast(const char *mess) { struct sockaddr_in s; if(broadcastSock &lt; 0) return; memset(&amp;s, '\0', sizeof(struct sockaddr_in)); s.sin_family = AF_INET; s.sin_port = (in_port_t)htons(tcpSocket ? tcpSocket : 3310); s.sin_addr.s_addr = htonl(INADDR_BROADCAST); cli_dbgmsg("broadcast %s to %d\n", mess, broadcastSock); if(sendto(broadcastSock, mess, strlen(mess), 0, (struct sockaddr *)&amp;s, sizeof(struct sockaddr_in)) &lt; 0) perror("sendto"); } </code></pre>
34,414,277
0
odoo: create multiple lines MTO in picking <p>after an order has been confirmed,</p> <ul> <li>Odoo create a stock picking out with origin='<code>SO-2015-00:WH: Stock -&gt; Customers MTO</code>' with multiple lines location_id and location_dest_id = <code>Customer Location</code>, the description of lines=<code>WH: Stock -&gt; Customers MTO</code></li> <li>in some Orders the <code>lines</code> above are in the <code>picking out</code></li> </ul> <p>any idea what is all about !!</p>
5,934,706
0
CSS: Floated element after the content in code <p>I need to have a floated element after the content/text that's supposed to flow around it in my code for SEO reasons. Usually floats are done like so:</p> <p>CSS:</p> <pre><code>#menu { float: right; width: 180px; padding: 10px; background: #fcc; margin: 0 0 15px 15px; } </code></pre> <p>HTML:</p> <pre><code>&lt;div id="menu"&gt;This is a right float. The long text flows around it.&lt;/div&gt; &lt;div id="content"&gt;&lt;p&gt;This is a long text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent nec risus. Praesent adipiscing aliquet magna. Proin bibendum velit vitae tortor. Vestibulum a dui quis urna feugiat viverra. Vestinbulum diam dui, ullamcorper in, rhoncus at, facilisis at, lorem. Phasellus turpis metus, sodales sit amet, laoreet nec, aliquet sit amet, tortor. Vivamus massa orci, gravida sit amet, dictum quis, euismod a, est. Aenean pretium facilisis nunc.&lt;/p&gt; &lt;p&gt;Nulla eros mauris, egestas eget, ullamcorper sed, aliquam ut, nulla. Phasellus facilisis eros vel quam. Etiam rutrum turpis a nibh. Integer ipsum. Vestibulum lacus diam, varius in, blandit non, viverra sit amet, sapien. Sed porta sollicitudin nibh. Nam eget metus nec arcu ultricies dapibus.&lt;/p&gt;&lt;/div&gt; </code></pre> <p>But I need to have the HTML like this:</p> <pre><code>&lt;div id="content"&gt;&lt;p&gt;This is a long text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent nec risus. Praesent adipiscing aliquet magna. Proin bibendum velit vitae tortor. Vestibulum a dui quis urna feugiat viverra. Vestinbulum diam dui, ullamcorper in, rhoncus at, facilisis at, lorem. Phasellus turpis metus, sodales sit amet, laoreet nec, aliquet sit amet, tortor. Vivamus massa orci, gravida sit amet, dictum quis, euismod a, est. Aenean pretium facilisis nunc.&lt;/p&gt; &lt;p&gt;Nulla eros mauris, egestas eget, ullamcorper sed, aliquam ut, nulla. Phasellus facilisis eros vel quam. Etiam rutrum turpis a nibh. Integer ipsum. Vestibulum lacus diam, varius in, blandit non, viverra sit amet, sapien. Sed porta sollicitudin nibh. Nam eget metus nec arcu ultricies dapibus.&lt;/p&gt;&lt;/div&gt; &lt;p id="menu"&gt;This is a right float. Because it's placed below the text in code, it also appears that way.&lt;/p&gt; </code></pre> <p>Basically, I need this HTML to look like the previous example (HTML and CSS). How can I do this?</p> <p>The width of the floated element is constant, but the height can change. The content has to flow around it. The reason I need to have it this way is because the floated element is the menu, which doesn't contain any important text and is usually the same for many pages, so the content should be topmost in the code.</p>
19,708,591
0
How do add Styles to JCE editor in Joomla 2.5? <p>I am using Joomla 2.5 with the JCE editor. I want to add my own styles but the problem is they don't appear in the Styles selection of the editor. I have the JCE configuration pointing to the editor.css, and while it does recognize the other classes in the editor.css file it doesn't recognize the ones I've added. I've cleared cache in the browser and cleared cache in Joomla, have logged out and back in, and they still don't appear.</p> <p>What am I doing wrong that these Styles don't appear? Does JCE read them directly from the editor.css files each time the page loads or does it store them in some intermediary place or even in a MySQL table? </p> <p>I was looking at this article: <a href="http://www.joomlacontenteditor.net/support/tutorials/editor/item/create-a-custom-editor-stylesheet" rel="nofollow">http://www.joomlacontenteditor.net/support/tutorials/editor/item/create-a-custom-editor-stylesheet</a></p> <p>I'm not clear on this, the class has to be present in the editor.css AND the template.css, not just the editor.css? Thanks!</p>
3,882,575
0
<p>Have you tried <a href="http://github.com/ghewgill/pyqver" rel="nofollow">pyqver</a>? It will tell you which is the minimum version of Python required by your code</p> <p>I hope it helps</p>
5,919,624
0
<p>Google have a <a href="http://i18napis.appspot.com/address" rel="nofollow">JSON-based API</a> that they use for their <a href="http://code.google.com/p/libaddressinput/" rel="nofollow">Android address input field library</a> that contains this kind of formatting information.</p> <p>The field you'd be interested in is <code>fmt</code>. There doesn't seem to be any formal documentation on the format they use, but a <a href="http://unicode.org/review/pri180/" rel="nofollow">proposal to include this information</a> as part of the Unicode CLDR has matching fields (scroll down to "Detailed Breakdown of elements"); there are also some clues in <a href="http://code.google.com/p/libaddressinput/source/browse/trunk/src/com/android/i18n/addressinput/AddressField.java?r=111" rel="nofollow">Google's libaddressinput source code</a>.</p>
33,405,349
0
<p>We <strong>can do</strong> better by translating number-theoretic properties into the language of constraints!</p> <blockquote> <p>All terms are of the form 87...12 = 4*21...78 or 98...01 = 9*10...89.</p> </blockquote> <p>We implement <code>a031877_ndigitsNEWER_/3</code> based on <code>a031877_ndigitsNEW_/3</code> and directly add above property as two finite-domain constraints:</p> <pre> a031877_ndigitsNEWER_(Z_big,N_digits,[K|D_big]) :- <b>K in {4}\/{9}</b>, % (new) length(D_big,N_digits), <b>D_big ins (0..2)\/(7..9)</b>, % (new) reverse(D_small,D_big), digits_number(D_big,Z_big), digits_number(D_small,Z_small), Z_big #= Z_small * K. </pre> <p>Let's re-run the benchmarks we used before!</p> <pre><code>?- time((a031877_ndigitsNEWER_(Z,5,Zs),labeling([ff],Zs),false)). % 73,011 inferences, 0.006 CPU in 0.006 seconds (100% CPU, 11602554 Lips) false. ?- time((a031877_ndigitsNEWER_(Z,6,Zs),labeling([ff],Zs),false)). % 179,424 inferences, 0.028 CPU in 0.028 seconds (100% CPU, 6399871 Lips) false. ?- time((a031877_ndigitsNEWER_(Z,7,Zs),labeling([ff],Zs),false)). % 348,525 inferences, 0.037 CPU in 0.037 seconds (100% CPU, 9490920 Lips) false. </code></pre> <p>Summary: For the three queries, we consistently observed a significant reduction of search required. Just consider how much the inference counts shrank: 1.45M -> 73k, 5M -> 179k, 15.1M -> 348k.</p> <p>Can we do even better (while preserving declarativity of the code)? I don't know, I guess so...</p>
38,674,591
0
<p><code>enter code here</code>Demo:<br> <a href="http://jsfiddle.net/subhash9/fRUUd/1511/" rel="nofollow">http://jsfiddle.net/subhash9/fRUUd/1511/</a> Code $(".scrollbar").animate({ scrollTop: 1000 }, 2000);</p>
4,322,394
0
<p>use <code>echo</code> command.</p> <p>For delaying:</p> <p>failed to test but try to use <code>sleep</code> command.</p>
14,318,854
0
Native and Java Debugging(Simultaneously )with ADT 2.0 and above <p>I used sequoyah plug-in until now to debug both Java &amp; native code simultaneously. It worked However I am using ADT Build v21.0.0.1 - 543035, and I followed <a href="http://tools.android.com/recent/usingthendkplugin" rel="nofollow">http://tools.android.com/recent/usingthendkplugin</a></p> <p>As usual Google seems to be ignoring native developers, and provide very little information how to debug both Java and Native code simultaneously seamlessly, if any one has insights please provide the information.</p>
15,115,077
0
Adding the Image in bundle to the UIImageView using GPU Image? <p>I am very new to the user of GPU Image Framework. In my application I use the following code to get the filter effect of the Image in bundle(knee.png) , But I get only Black ImageView . I get the code from this <a href="http://stackoverflow.com/questions/12935166/gpuimage-imagebyfilteringimage-and-imagefromcurrentlyprocessedoutputwithorienta">link</a> </p> <p>show me where I went wrong </p> <pre><code>UIImage *inputImage = [UIImage imageNamed:@"knee.png"]; GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:inputImage]; GPUImageSepiaFilter *stillImageFilter = [[GPUImageSepiaFilter alloc] init]; [stillImageSource addTarget:stillImageFilter]; [stillImageSource processImage]; UIImage *quickFilteredImage = [stillImageFilter imageByFilteringImage:inputImage]; [self.imgView setImage:quickFilteredImage]; </code></pre>
18,710,175
0
<p>what i understand is </p> <p>you want to calculate the combination for any value of n and k in nCk,</p> <p>define a factorial() function outside and define a combi() function ... which calculates Combination value of n and k variables</p> <p>both function before defining the main() function... that way you can avoid declaration and then defining (i mean avoid extra lines of code).</p> <p>here is the code for combi() function</p> <pre><code>function combi(int n , int k){ int nFact, kFact, n_kFact, p; int comb; nFact=factorial(n); kFact=factorial(k); p=n-k; n_kFact=factorial(p); comb= nFact / ((n_kFact) * kFact); return comb; } </code></pre> <p>you can call this function in your main function .... use for loop to store the combination value for relative n and k .... thus you will get what you need .... also pass pointer or </p> <pre><code>&amp;array[0][0] </code></pre> <p>i.e. starting address for the array... so that you can access that array anywhere in the program.</p> <p>hope this may help you. thanks</p>
9,404,365
0
<p>this goes in head (ajax request)</p> <pre><code>&lt;script type="text/javascript"&gt; function clickLog(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","click-log.php?url="+str,true); xmlhttp.send(); } &lt;/script&gt; </code></pre> <p>this opens 'click-log.php' with url parameter 'str' &lt;&lt;&lt; 'str' is defined as 'this.href' in the onclick function brackets</p> <pre><code>&lt;a href=" { url } / file .swf " onClick="clickLog(this.href)"&gt;Click Me&lt;/a&gt; </code></pre> <p>when the link is clicked it opens and processes the php file, with the link href (this.href) as the parameter url=</p> <p>the script even came with this.....</p> <pre><code>&lt;div id="txtHint"&gt;&lt;/div&gt; </code></pre> <p>if you place this div below the link to be clicked, it will echo whatever the click-log.php outputs......</p> <p>this will be explained below....</p> <p>this is my php file</p> <pre><code>&lt;?php $url = $_GET['url']; $time = date('U'); $ip = $_SERVER['REMOTE_ADDR']; $fp = fopen('click-log.txt', 'a'); $fwrite = fwrite($fp, $time.' , '.$ip.' , '.$url.' '); // --- echo 'Log Written'; --- // ?&gt; </code></pre> <p>this writes to end of text file 'click-log.txt' with the timestamp, ip, and href of link clicked</p> <p>the echo line that is commented out, will insert the text "Log Written" into the "txtHint" div once the link has been clicked and the ajax request processed</p> <p>all files used are in the base directory however anyone who would like to implement this script on their site would probably already know how to change file locations etc</p> <p>....</p> <p>..... thanks for the info guys.... another successful script :)</p> <p>ps, now to write the script to show me the logfile in pretty graphs and pie charts :lmao:</p>
2,531,709
0
adding UIImageView to UIScrollView throws exception cocoa touch for iPad <p>I am a noob at OBJ-C :)</p> <p>I am trying to add a UIImageView to a UIScrollView to display a large image in my iPhone app. </p> <p>I have followed the tutorial here exactly: </p> <p><a href="http://howtomakeiphoneapps.com/2009/12/how-to-use-uiscrollview-in-your-iphone-app/" rel="nofollow noreferrer">http://howtomakeiphoneapps.com/2009/12/how-to-use-uiscrollview-in-your-iphone-app/</a></p> <p>The only difference is that in my App the View is in a seperate tab and I am using a different image.</p> <p>here is my code:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Cheyenne81"]]; self.imageView = tempImageView; [tempImageView release]; scrollView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height); scrollView.maximumZoomScale = 4.0; scrollView.minimumZoomScale = 0.75; scrollView.clipsToBounds = YES; scrollView.delegate = self; [scrollView addSubview:imageView]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{ return imageView; } </code></pre> <p>and:</p> <pre><code>@interface UseScrollViewViewController : UIViewController&lt;UIScrollViewDelegate&gt;{ IBOutlet UIScrollView *scrollView; UIImageView *imageView; } @property (nonatomic, retain) UIScrollView *scrollView; @property (nonatomic, retain) UIImageView *imageView; @end </code></pre> <p>I then create a UIScrollView in Interface Builder and link it to the scrollView outlet. Thats when I get the problem. When I run the program it crashes instantly. If I run it without linking the scrollView to the outlet, it will run (allbeit with a blnk screen).</p> <p>The following is the error I get in the console:</p> <blockquote> <p>2010-03-27 20:18:13.467 UseScrollViewViewController[7421:207] <code>*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[&lt;UIViewController 0x4a179b0&gt; setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key scrollView.'</code></p> </blockquote>
40,463,680
0
<p>Resolution: </p> <p>SC can not determine the <code>.env</code> or <code>phpunit.xml</code> in this case, so i have to specify it in my web Test Case <code>setup</code> method: </p> <pre><code> putenv('DB_DATABASE=db_name'); putenv('DB_USERNAME=postgres'); putenv('DB_PASSWORD=postgres'); putenv('DB_CONNECTION=pgsql'); putenv('DB_PORT=5432'); </code></pre> <p>the most important variable is <code>DB_CONNECTION</code>.</p>
3,762,519
0
Using base tags in Mercurial <p>We just started using hg and we're using base tags for common modules in our system. I have a few questions about how tags work. </p> <ul> <li><p>(#1) When I add a tag using the following command, does it automatically check in the .hgtags file for me?</p> <p>hg tag MY_TAG</p></li> <li><p>When I add a tag for the first time, it adds a line to the the .hgtags file. When I do a -f (force) on the tag command, it adds another entry to the file. Then, when I remove it, it adds <strong>2 more</strong> lines to the .hgtags file. Ultimately my file ends up looking like this:</p></li> </ul> <blockquote> <pre><code>af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //from initial tag af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //from delete (1/2) 0000000000000000000000000000000000000000 MY_TAG //from delete (2/2) 4611114976f02dd0d4f8ec9e84266dcea161cd3f MY_TAG //from tag after pull 0426c9e6e0ccf01e6d18d85420466d1edd1bff1f MY_TAG //from forced tag </code></pre> </blockquote> <ul> <li><p>(#2) Why does it keep adding lines to the .hgtags file? When I'm doing a base tag, I only really care to have a single entry in the file. Should I care about this bloat? Do I have to manually manage the .hgtags file to work in this way?</p></li> <li><p>(#3) Also, do the delete lines have to remain contiguous in the file? </p></li> <li><p>(#4) Is the file read from top to bottom, or does Mercurial actually find the latest changeset and use that one when I move to a tag?</p></li> </ul>
13,960,046
0
<p>It's needed in this case because C# does not support return type co-variance for interfaces, so your function</p> <pre><code>public Foo Bar() { //... } </code></pre> <p>does not satisfy the <code>IFoo</code> interface since the return type of the <code>Bar</code> method is different.</p> <p>Since you want to also implement the interface, your only choice is to do so explicitly since you already have a <code>Bar()</code> method defined on the class.</p>
16,220,346
0
<p>You may be able to do something with <code>ROUND</code> and a negative rounding value, which will round to the left of the decimal rather than the right. For example, the dates in your results will look like this if you use <code>ROUND(date, -1)</code>:</p> <pre><code>date round(date, -1) ---------- --------------- 1318763642 1318763640 1318763643 1318763640 1318763639 1318763640 1318763641 1318763640 1318763637 1318763640 1318763640 1318763640 1366200434 1366200430 </code></pre>
31,790,545
0
Add badge when push received in Swift <p>I have iOS app written in Swift. I use Parse SDK for push notifications. I want to add badge to app icon when push is received. <strong>There is problem - I can't add badge from push directly</strong> because there are a lot of users that use previous version of my app. And if I add badge from push - this badge will not disappear because previous app versions don't hide badge after it opened. So badge will be always on icon. </p> <p>So what I want is to handle push by my app. No matter is it running or not. If push arrives - my app adds badge. So I can I handle push by my app if it is not running?</p> <p>I know how to add badge with Swift</p> <pre><code>application.applicationIconBadgeNumber = 5 </code></pre> <p>But how can i do it without opening the app - just when push is received? </p>
12,710,512
0
Create dummy file using dd on android via monkeyrunner script <p>I am writing a script to automate a test: fill the internal memory of an Android device. The script is written in python and I am using monkeyrunner to connect to the device and issue commands.<br> I need to create dummy files to do this. If I use this command:</p> <pre><code>subprocess.call('adb shell dd if=/dev/zero of=/storage/sdcard0/dummy/dummy_file bs=1000000000 count=1', shell = True) </code></pre> <p>It works. The dummy file is created. But I would like to use the following:</p> <pre><code>device.shell('dd if=/dev/zero of=/storage/sdcard0/dummy/dummy_file bs=1000000000 count=1') </code></pre> <p>Which should do the same thing. But the latter does not work and generates this:</p> <pre><code>Importing modules Waiting for connection 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] Error executing command: dd if=/dev/zero of=/storage/sdcard0/dummy/dummy2 bs=1000000000 count=1 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnresponsiveException 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:408) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.Device.executeShellCommand(Device.java:453) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.chimpchat.adb.AdbChimpDevice.shell(AdbChimpDevice.java:269) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.MonkeyDevice.shell(MonkeyDevice.java:217) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at java.lang.reflect.Method.invoke(Method.java:597) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyObject.__call__(PyObject.java:355) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyMethod.__call__(PyMethod.java:215) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyMethod.__call__(PyMethod.java:206) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyObject.__call__(PyObject.java:397) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyObject.__call__(PyObject.java:401) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.pycode._pyx0.f$0(/home/gabriel/android/git/androidqa/prebuilt/monkeyrunner/InternalStorage/int_storage_fill.py:57) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.pycode._pyx0.call_function(/home/gabriel/android/git/androidqa/prebuilt/monkeyrunner/InternalStorage/int_storage_fill.py) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyTableCode.call(PyTableCode.java:165) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.PyCode.call(PyCode.java:18) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.Py.runCode(Py.java:1197) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.core.__builtin__.execfile_flags(__builtin__.java:538) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:156) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77) 121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189) </code></pre> <p>Does anybody know why this error occurs?</p>
23,602,463
0
<p>You should try this simple solution :</p> <pre><code>jQuery(function($) { $('form input').on('change',function() { isDisabled = !(($('#txtusername').val().length &gt; 0 &amp;&amp; $('#txtpassword').val().length &gt; 0) || $('input[type="checkbox"]:checked').length &gt; 0); $('#signin').attr('disabled', isDisabled); }); }); </code></pre> <p>It does its job. </p>
34,427,474
0
Centering image in columns (liquid layout) <p>My goal is to make each of these images be centered in their respective columns while maintaining the liquid layout. Each of the images should be centered in each column (e.g. one flag per column centered). Any help would be appreciated as this is an assignment. Thanks</p> <p>HTML and CSS Code</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.two { -moz-column-count: 2; -webkit-column-count: 2; column-count: 2; } .column1 { width:33%; float:left; } .column2 { width:33%; display: inline-block; } .column3 { width:33%; float:right; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p class="two"&gt; Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eosle et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.&lt;/p&gt; &lt;p class="column1"&gt; &lt;img src="australia_flag.jpg" height="200" width="300" /&gt; &lt;br&gt;Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eosle et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. &lt;/p&gt; &lt;p class="column2"&gt; &lt;img src="brazil_flag.jpg" height="200" width="300" /&gt; &lt;br&gt;Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eosle et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. &lt;/p&gt; &lt;p class="column3"&gt; &lt;img src="china_flag.jpg" height="200" width="300" /&gt; &lt;br&gt;Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eosle et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. &lt;/p&gt; </code></pre> </div> </div> </p> <p>Thanks!</p>
8,326,335
0
<p><code>@m_UserIdList</code> is a <code>VARCHAR(500)</code>, not a list of values, so this will not work. You can try and parse the passed in string into a table (and there are plenty of ways of doing so - just search this site).</p> <p>However, since you are using SQL Server 2008, you should take a look at <a href="http://msdn.microsoft.com/en-us/library/bb510489.aspx" rel="nofollow">table valued parameters</a> - these allow you to pass a table of values to a stored procedure.</p>
34,778,693
0
<p>As JPA1123 already mentioned you will probably really just need to recompile your project/solution via right click on your solution and 'Rebuild Solution'. Also check if the 'Build' checkbox is checked for all relevant projects in the 'Configuration Manager'.</p>
30,389,384
0
<p>I finally did it by making a module :).</p> <p>Credits to: <a href="https://developer.jboss.org/thread/219956?tstart=0" rel="nofollow">https://developer.jboss.org/thread/219956?tstart=0</a></p>
19,791,954
0
<p>I experienced the same thing. An alternative would be to add a Label control and set the properties on that instead.</p> <p>Rather than using a BoundField, use a TemplateField. Assuming that your data is returning an indexable item:</p> <pre><code>&lt;asp:GridViewControl runat="server" ID="GridView2" AutoGenerateColumns="false"&gt; &lt;asp:BoundField HeaderText="Field0" DataField="[0]" /&gt; &lt;asp:BoundField HeaderText="Field1" DataField="[1]" /&gt; &lt;asp:TemplateField HeaderText="Monkey1" /&gt; &lt;asp:TemplateField HeaderText="Monkey2" /&gt; &lt;/asp:GridViewControl&gt; </code></pre> <p>Then in the code-behind:</p> <pre><code>protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var data_item = e.Row.DataItem; // Can use "as &lt;type&gt;;" if you know the type. if (data_item != null) { for (int i = 2; i &lt;= 3; i++) { var cell_content = new Label(); e.Row.Cells[i].Controls.Add(cell_content); cell_content.Text = data_item[i]; if (data_item[i].Contains("monkey")) { cell_content.Attributes.Add("class", "monkey bold"); } else { cell_content.Attributes.Add("class", "nomonkey bold"); } } } </code></pre> <p>Of course an alternative would be to add the Label in the TemplateField -> ItemTemplate declaration with an ID and use "Cells[i].FindControl("label_id")".</p>
19,624,559
0
<p>do you want to get how many times a CD was borrowed? or who borrowed how many times? to check how many times the CD was borrowed in your</p> <pre><code>public void borrower(String nameOfBorrower) { borrower = nameOfBorrower; borrowed = true; inStock = false; times++; } public int GetTimes() { return times; } </code></pre>
25,656,611
0
<p>You need to start <code>app.MainLoop()</code> before the frames will show. In your code all the frames are created before <code>MainLoop()</code> is run, that's why the frames are all displayed at once. Rather than creating multiple frames, create multiple panels, just hide the previous ones.</p> <p>Also to control the creation of frames, try returning something, in the event handlers before <code>destroy()</code> function call. And in the main frame check for the return to create the next panel.</p>
2,036,205
0
<p>I'd strongly recommend using the C99 <code>&lt;stdint.h&gt;</code> header. It declares <code>int32_t</code>, <code>int64_t</code>, <code>uint32_t</code>, and <code>uint64_t</code>, which look like what you really want to use.</p> <p>EDIT: As Alok points out, <code>int_fast32_t</code>, <code>int_fast64_t</code>, etc. are probably what you want to use. The number of bits you specify should be the minimum you need for the math to work, i.e. for the calculation to not "roll over".</p> <p>The optimization comes from the fact that the CPU doesn't have to waste cycles realigning data, padding the leading bits on a read, and doing a read-modify-write on a write. Truth is, a lot of processors (such as recent x86s) have hardware in the CPU that optimizes these access pretty well (at least the padding and read-modify-write parts), since they're so common and usually only involve transfers between the processor and cache.</p> <p>So the only thing left for you to do is make sure the accesses are aligned: take <code>sizeof(int_fast32_t)</code> or whatever and use it to make sure your buffer pointers are aligned to that.</p> <p>Truth is, this may not amount to that much improvement (due to the hardware optimizing transfers at runtime anyway), so writing something and timing it may be the only way to be sure. Also, if you're really crazy about performance, you may need to look at SSE or AltiVec or whatever vectorization tech your processor has, since that will outperform anything you can write that is portable when doing vectored math.</p>
23,675,292
0
How can I achieve fast frame rate of a JPG image display on iOS? <p>I've been able to get nearly 10 FPS on iPhone 3GS of solid JPG switching, but I've seen faster is possible with GPU and CALayer. Can you help me determine how to achieve this? I’ve tried some various stuff below.</p> <p>Here’s what I’ve been using…</p> <pre><code>#define FPS 12.0 [NSTimer scheduledTimerWithTimeInterval:(1.0 / FPS) target:self selector:@selector(animateMethod:) userInfo:nil repeats:YES]; </code></pre> <p>Please note the method baseImagePath returns different paths for each invocation.</p> <pre><code>- (void)animateMethod:(NSTimer *)timer { self.imageView.image = [UIImage imageWithContentsOfFile:[self baseImagePath]]; } </code></pre> <p>Here’s what I’ve tried…</p> <pre><code>- (void)animateMethod:(NSTimer *)timer { self.layerView.layer.contents = [(__bridge id)([[UIImage imageWithContentsOfFile:[self baseImagePath]] CGImage]); } </code></pre>
19,977,505
0
<p>In the past, when we had to do something like this, we just used apply (<a href="http://jsfiddle.net/85TeD/1/" rel="nofollow">http://jsfiddle.net/85TeD/1/</a>):</p> <pre><code>function UsersListViewModel() { var self = this; ListViewModel.apply(self); self.OtherProp = ko.observable("other"); } </code></pre> <p>If you want to implement full classical inheritance, this is a start: <a href="http://www.crockford.com/javascript/inheritance.html" rel="nofollow">http://www.crockford.com/javascript/inheritance.html</a> </p>