Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
35,473,145
Parsing an editText value as a double on Android?
So I'm working on an app to calculate forces for me. It works fine until I try to parse the editText boxes as doubles. Here's the code (the button click for calculating is 'calc_Click'): package com.hoodeddeath.myapplication; import android.animation.TypeConverter; import android.provider.SyncStateContract; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class GravityActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gravity); } public void calc_Click (View v){ double G = 6.67*(Math.pow(10,-11)); double TWO = 2; double mOne = Double.parseDouble(findViewById(R.id.finalForceLabel).toString()); double aOne = Double.parseDouble(findViewById(R.id.ampOne).toString()); double mTwo = Double.parseDouble(findViewById(R.id.massTwo).toString()); double aTwo = Double.parseDouble(findViewById(R.id.ampTwo).toString()); double dist = Double.parseDouble(findViewById(R.id.distance).toString()); double aThree = Double.parseDouble(findViewById(R.id.ampThree).toString()); mOne = mOne * aOne; mTwo = mTwo * aTwo; dist = dist * aThree; dist = Math.pow(dist, TWO); double total = (G * mOne * mTwo) / dist; TextView a = (TextView)findViewById(R.id.finalForceLabel); a.setText(total.toString()); } public double main(String args) { double aDouble = Double.parseDouble(args); return aDouble; } } Sorry that I'm such a beginner.
<java><android><android-edittext>
2016-02-18 04:54:57
LQ_EDIT
35,473,194
how to find out whether a number is equal to any element of a vector
<p>I am trying to write a if with two conditions. The first condition is k > h, and the second condition is k not equal to any element in m[1,]. Can anyone tell me how to do it? Thank you a lot!</p>
<r>
2016-02-18 04:59:27
LQ_CLOSE
35,473,980
I want to scrape content or data from dynamic web page using php?
<p>Is it possible to scrape content or data from dynamic web page? If it is possible please attach PHP code. Thanks in Advance. </p>
<php>
2016-02-18 06:01:49
LQ_CLOSE
35,474,575
how to get check a proper data type has been given by the user
<p>suppose I have a variable of integer type 'a'</p> <p>now ill ask user to enter an input after he gave an input i want to check weather he entered an integer type or anything else</p> <p>for the above question what should i have to do</p>
<c++><c><type-conversion>
2016-02-18 06:42:10
LQ_CLOSE
35,475,187
Admin Pannel Url For Magento,Php Website?
[This is the website][1] I have to fix some problems in this website through backend. I have user name and password for admin but not login url for Admin Pannel... Any help would be great... Thanks... [1]: https://www.garamloha.com/
<php><magento>
2016-02-18 07:22:13
LQ_EDIT
35,475,751
NOt able to check empty string
#include<cstdio> #include<cstring> using namespace std; int main() { int t,l; char a[22]; a[0]='0'; for(t=1;t<=20;t++) { l=1; scanf("%s",a+1); if(strlen(a)>1) l=strlen(a); printf("%d\n",l-1); } return 0; } When I am inputting any string with length >=1 then I get the correct answer for the length of string but when just use the keystroke enter or space then it does not print 0. Since the string is empty(containing only zero) it should print 0(l-1=0) because if condition gets false.
<c++>
2016-02-18 07:53:57
LQ_EDIT
35,476,487
How to match single Image with multiple images using MATLAB?
<p>For example I have a 100 images in my directory of which 'x' images are same and I would like to know the value of x. </p>
<matlab><image-processing><video-processing><matlab-cvst>
2016-02-18 08:39:27
LQ_CLOSE
35,477,091
Spark services in Data Lake
I am trying to use spark sql to query a csv file placed in Data Lake Store. when I query i am getting "java.lang.ClassNotFoundException: Class com.microsoft.azure.datalake.store.AdlFileSystem not found". How can I use spark sql to query a file placed in Data Lake Store? Please help me with a sample. Example csv: Id Name Designation 1 aaa bbb 2 ccc ddd 3 eee fff Thanks in advance, Sowandharya
<java><azure><apache-spark><cortana-intelligence><azure-data-lake>
2016-02-18 09:10:03
LQ_EDIT
35,478,362
what is the difference between the 2 cases; in java strings?
<p>why do these statements give different answers?</p> <pre><code>String s1="hello world"; String s2="hello world"; System.out.println(s1.equals(s2));//true System.out.println(s1 == s2);//true </code></pre> <p>2nd case;</p> <pre><code>String s1=new String("hello world"); String s2=new String("hello world"); System.out.println(s1.equals(s2));//true System.out.println(s1 == s2);//false </code></pre>
<java><string>
2016-02-18 10:05:06
LQ_CLOSE
35,480,168
sh: 1: Syntax error: "(" unexpected python
I'm executing an awk which looks like this. `awk '{if(l1){print ($2-l1)/1024" kB/s",($10-l2)/1024" kB/s"} else{l1=$2; l2=$10;}}' <(grep eth0 /proc/net/dev) <(sleep 1; grep eth0 /proc/net/dev)` and I always got the `sh: 1: Syntax error: "(" unexpected` I tried writing it as a .sh file, and tried the different shebang lines. I need to create a script that will execute this. Somebody ? please, thanks
<linux><bash><shell><awk>
2016-02-18 11:26:51
LQ_EDIT
35,480,573
GcmListenerService is not called When Application is in Background
<p>GcmListenerService is not called when application is in background or when phone is locked or in sleep mode but notification is fired. How this will be called When App is in foreground its working ideally. Code for GcmListenerService is following </p> <pre><code> public class MyGcmListenerService extends GcmListenerService { private static final String TAG = "MyGcmListenerService"; LocalDataBaseManager mDbManager; String message; Random randomNumber; long ID; /** * Called when message is received. * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { String message ; String title; // ID = Utils.getIDForPush("pushId",this); // if(ID == 0){ // ID = 1; // }else { // ID += 1; // } // Utils.saveIDForPush("pushId",ID,this); Bundle bundle = data.getBundle("notification"); if(bundle!= null){ message = bundle.getString("body"); title = bundle.getString("title"); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + message);} else { message =""; title = "NCMS"; } mDbManager = LocalDataBaseManager.getInstance(this); if (from.startsWith("/topics/")) { Calendar c = Calendar.getInstance(); SimpleDateFormat s = new SimpleDateFormat("ddMMyyyyhhmmss"); String format = s.format(new Date()); ID = Long.parseLong(format); String date = new SimpleDateFormat("dd-MM-yyyy HH:mm", Locale.ENGLISH).format(new Date()); Warnings warnings = new Warnings(); warnings.setWARNING_ID(ID); warnings.setWARNING_EN(message); warnings.setWARNING_AR(message); warnings.setSTART_DATE_TIME(date); warnings.setNotification_type(String.valueOf(Constant.NotificationType.PUSH)); warnings.setSEVERITY(""); warnings.setEND_DATE_TIME(""); warnings.setUPDATE_NO(""); mDbManager.insertNotificationInfo(warnings); // message received from some topic. } else { // normal downstream message. } // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ // KeyguardManager km = (KeyguardManager) this.getSystemService(Context.KEYGUARD_SERVICE); // boolean locked = km.inKeyguardRestrictedInputMode(); // // String release = android.os.Build.VERSION.RELEASE; // // // if (Integer.parseInt(String.valueOf(release.charAt(0))) &lt; 5 &amp;&amp; locked) { // // this.stopService(new Intent(this, NotificationService.class)); // Intent serviceIntent = new Intent(this, NotificationService.class); // this.startService(serviceIntent); // // } sendNotification(title,message); // [END_EXCLUDE] } // [END receive_message] /** * Create and show a simple notification containing the received GCM message. * * @param message GCM message received. */ private void sendNotification(String title,String message) { Intent intent = new Intent(this, MainActivity.class); intent.putExtra("message",message); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ncms_launcher) .setContentTitle(title) .setContentText(message) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); } } </code></pre> <p>Manifest info for this service is following</p> <pre><code> &lt;service android:name=".gcm.MyGcmListenerService" android:exported="false" &gt; &lt;intent-filter&gt; &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt; &lt;/intent-filter&gt; &lt;/service&gt; </code></pre> <p>What I am missing here.</p>
<android><google-cloud-messaging><gcmlistenerservice>
2016-02-18 11:45:07
HQ
35,480,611
C# EWS Managed API: How to access shared mailboxes but not my own inbox
<p>How can I connect to an exchange server and read mail from a shared mailbox (one that is not my own "myname@mycompany.com").</p> <p>Here is my code thus far:</p> <pre><code>//Create a service ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); //Autodiscover end point service.AutodiscoverUrl("someaddress@mycompany.com"); FindFoldersResults folderSearchResults = service.FindFolders(WellKnownFolderName.Inbox, new FolderView(int.MaxValue)); Microsoft.Exchange.WebServices.Data.Folder exchangeMailbox = folderSearchResults.Folders.ToList().Find( f =&gt; f.DisplayName.Equals("NameOfSharedMailboxIwant", StringComparison.CurrentCultureIgnoreCase)); //Set the number of items we can deal with at anyone time. ItemView itemView = new ItemView(int.MaxValue); foreach (Microsoft.Exchange.WebServices.Data.Folder folderFromSearchResults in folderSearchResults.Folders) { if (folderFromSearchResults.DisplayName.Equals("NameOfSharedMailboxIWant", StringComparison.OrdinalIgnoreCase)) { Microsoft.Exchange.WebServices.Data.Folder boundFolder = Microsoft.Exchange.WebServices.Data.Folder.Bind(service, folderFromSearchResults.Id); SearchFilter unreadSearchFilter = new SearchFilter.SearchFilterCollection( LogicalOperator.And, new SearchFilter.IsEqualTo( EmailMessageSchema.IsRead, false)); //Find the unread messages in the email folder. FindItemsResults&lt;Item&gt; unreadMessages = boundFolder.FindItems(unreadSearchFilter, itemView); foreach (EmailMessage message in unreadMessages) { message.Load(); Console.WriteLine(message.Subject); } } </code></pre> <p>When I run this, I get an exception thrown that says that that "The SMTP address has no mailbox associated with it " during:</p> <pre><code> Microsoft.Exchange.WebServices.Data.Folder exchangeMailbox = folderSearchResults.Folders.ToList().Find( f =&gt; f.DisplayName.Equals("BA", StringComparison.CurrentCultureIgnoreCase)); </code></pre> <p>What am I missing? I feel like I am almost there and that this should work according to the EWS Managed API 2.0 documentation, but I</p>
<c#><.net><exchangewebservices>
2016-02-18 11:46:41
HQ
35,480,716
ERR_TOO_MANY_REDIRECTS wordpress Google chrome
I'm having a weird issue, wordpress homepage has a 302 error (redirection loop) on Google Chrome only, however if I access my admin panel first and then go back to homepage, it works... I have WPML installed and Yoast SEO. Installation is in a subfolder. Would somebody have an idea of what is going on? Here is the link: [www.scrybs.com][1] Thanks in advance [1]: http://www.scrybs.com
<php><wordpress><.htaccess><google-chrome><wpml>
2016-02-18 11:52:11
LQ_EDIT
35,482,825
mysql SELECT * FROM product WHERE id_product = relation1,relation2,relation3,
i have 2 table prodcut id_product,price,etc relation id,relation1,relation2,relation3,... i want get any product where id=relation1,... how to write it in sql ? SELECT * FROM product WHERE id_product = relation1,relation2,relation3,...
<php><mysql><sql>
2016-02-18 13:30:12
LQ_EDIT
35,483,934
Variable enters C function as nonzero, turns to zero inside by itself
<p>I'm debugging a piece of code and found that when I print out a variable prior to function execution it is nonzero. The same variable is then used as an input argument for a function, but when printing it out right at the beginning of that function it says it's zero. </p> <p>Outside the function call it looks like this:</p> <pre><code>printf("sigma_b_m: %f \n",sigma_b_m); oprq_init(sigma_b_m, b_m, r_m, x, P); </code></pre> <p>Inside the function call I did the following:</p> <pre><code>void oprq_init(const float sigma_b_m, const float b[3], const float r[3], float K[16], float P[256]) {` printf("sigma_b_m: %f \n",sigma_b_m); } </code></pre> <p>I removed the rest of the function for clarity but the printf line is really at the very start of the function.</p> <p>The output is then:</p> <blockquote> <p>sigma_b_m: 0.001745<br> sigma_b_m: 0.000000</p> </blockquote> <p>Any idea how it now registers as zero rather than the 0.001745 it told me it was prior to going into the function?</p>
<c>
2016-02-18 14:19:08
LQ_CLOSE
35,484,217
android app on kitkat works on lollipop don't
i'm asking to you some help beacause i can't find the solution. i'm doing an android app and i have decided to add in my app the contact list. i have take this from google android developpers http://developer.android.com/training/contacts-provider/retrieve-names.html and i have take the code and add all the features to my app(xml/layout/images/javacode etc) and in my main activity i call the contactlist activity. if i attack my cellular phone with kitkat 4.4.2 via debug on android studio my app comes and in mymain activity when i call the contacts activity it does so well... but if i attack my cellular phone with lollipop 5.1.1 when i call the contacts activity it does so well the titlebar is hide and then when i click one contact the app crashes... it crashes at this instruction if (Utils.hasHoneycomb()) { // Enables action bar "up" navigation getActionBar().setDisplayHomeAsUpEnabled(true); } and it give to me 02-18 13:41:15.304 31435-31435/todonotes.com.todonotes_buildfinale E/AndroidRuntime: FATAL EXCEPTION: main Process: todonotes.com.todonotes_buildfinale, PID: 31435 java.lang.RuntimeException: Unable to start activity ComponentInfo{todonotes.com.todonotes_buildfinale/todonotes.com.todonotes_buildfinale.ContactDetailActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2378) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2440) at android.app.ActivityThread.access$800(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5422) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference at todonotes.com.todonotes_buildfinale.ContactDetailActivity.onCreate(ContactDetailActivity.java:59) at android.app.Activity.performCreate(Activity.java:6057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2331) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2440) at android.app.ActivityThread.access$800(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5422) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707) my manifest is: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="todonotes.com.todonotes_buildfinale"> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_CONTACTS"/> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.AppCompat.NoActionBar"> <activity android:name="todonotes.com.todonotes_buildfinale.SplashScreen" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="todonotes.com.todonotes_buildfinale.LoginActivity" android:theme="@style/AppTheme.Dark" android:label="@string/app_name"> <intent-filter> <action android:name="todonotes.com.todonotes_buildfinale.SIGNUPACTIVITY"/> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name="todonotes.com.todonotes_buildfinale.ContactsListActivity" android:theme="@style/AppTheme" android:label="@string/activity_contacts_list" android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <!-- Add intent-filter for search intent action and specify searchable configuration via meta-data tag. This allows this activity to receive search intents via the system hooks. In this sample this is only used on older OS versions (pre-Honeycomb) via the activity search dialog. See the Search API guide for more information: http://developer.android.com/guide/topics/search/search-dialog.html --> <intent-filter> <action android:name="android.intent.action.SEARCH" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable_contacts" /> </activity> <activity android:name="todonotes.com.todonotes_buildfinale.ContactDetailActivity" android:theme="@style/AppTheme" android:label="@string/activity_contact_detail" android:parentActivityName="todonotes.com.todonotes_buildfinale.ContactDetailActivity"> <!-- Define hierarchical parent of this activity, both via the system parentActivityName attribute (added in API Level 16) and via meta-data annotation. This allows use of the support library NavUtils class in a way that works over all Android versions. See the "Tasks and Back Stack" guide for more information: http://developer.android.com/guide/components/tasks-and-back-stack.html --> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="todonotes.com.todonotes_buildfinale.ContactDetailActivity" /> </activity> <activity android:name="todonotes.com.todonotes_buildfinale.SignupActivity" android:theme="@style/AppTheme.Dark"></activity> <activity android:name="todonotes.com.todonotes_buildfinale.ConfirmActivity" android:theme="@style/AppTheme.Dark"></activity> <activity android:name="todonotes.com.todonotes_buildfinale.ListNoteActivity" android:theme="@style/AppTheme.Dark"></activity> </application> </manifest> how can i resolve this?? is urgent
<android><android-manifest><android-5.0-lollipop><android-4.4-kitkat>
2016-02-18 14:30:36
LQ_EDIT
35,484,560
How to set Australia Sydney Time Zone in My app programatically
<p>I need it in my app. I searched some of the results but I could not get the correct Result. Whenever I am setting the Time Zone to Australia/Sydney it always returns the Current Location Time Zone. </p>
<java><android>
2016-02-18 14:45:11
LQ_CLOSE
35,484,794
Match anything between special characters in c#
<p>I have a string like this [test]][test][test]</p> <p>I would like with a regex to obtain a collection of elements where each element will be a value between the brackets [] :</p> <p>test<br> test<br> test<br></p> <p>With this code:</p> <pre><code>var pattern = @"\[(.*?)\]"; var results = Regex.Matches("[test]][test][test]", pattern); </code></pre> <p>I managed to get the values but they include the brackets [] :</p> <p>[test]<br> [test]<br> [test]<br></p>
<c#><regex>
2016-02-18 14:55:00
LQ_CLOSE
35,484,863
The code,following the line " new ClassReader(classfileBuffer)" is unreachable
I want to add monitor code into some class,so i use the java agent and asm4 to manipulate the byte code. The core code as followed: public class MyClassFileTransformer implements ClassFileTransformer { @Override public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException { if (className.startsWith("com/dgl/asm/SleepClass")) { ClassReader reader = new ClassReader(classfileBuffer); System.out.println("1231231231312"); ClassWriter cw = new ClassWriter(reader,0); ClassVisitor adpter = new AddTimerClassAdpter(Opcodes.ASM4, cw); reader.accept(adpter, 0); return cw.toByteArray(); } return classfileBuffer; } } However,the code ,after "ClassReader reader = new ClassReader(classfileBuffer)",is always unreachable.After the "new ClassReader(classfileBuffer)" be executed,the program jumps to the main method directly without any exception! what should I do? Any idea?
<java><bytecode>
2016-02-18 14:57:43
LQ_EDIT
35,484,983
Printf with unfixed length
<p>I need to </p> <blockquote> <p>printf(%?d)</p> </blockquote> <p>Where '?' is some int. How can I do it? I'm using pure c. I've tried to work with const char* array. But there was no result.</p>
<c><printf>
2016-02-18 15:02:03
LQ_CLOSE
35,485,024
updating Dictonary code with ConcurrentDictonary
I'm trying to update the following code to use a ConcurrentDictionary. I appreciate any help. <pre><code> private Dictionary (string, SymbolOrderBook) books = new Dictionary(string, SymbolOrderBook)(); SymbolOrderBook book; lock (books) { if (!books.TryGetValue(symbol, out book)) { book = new SymbolOrderBook(symbol); books.Add(symbol, book); } } </code></pre> Thank you!
<c#><.net><multithreading><concurrency><concurrentdictionary>
2016-02-18 15:03:43
LQ_EDIT
35,485,157
how to get the form name dynamically
I have many forms that are dynamically created and each form is ends with a number which is incremental. Each form has a submit button which also has a dynamically assigned name. I am using the following code to call a function but its limited to only one form. Is there anyway to customize it so it dynamically uses the form name assigned? **THE JQUERY** <!-- begin snippet: js hide: false --> <!-- language: lang-none --> $("myform0").submit(function (e) { //Stops the submit request e.preventDefault(); }); //checks for the button click event $("#submit0").click(function (e) { callfunction(); }); <!-- end snippet --> **The HTML** <!-- begin snippet: js hide: false --> <!-- language: lang-none --> <form name="myform0"> <input type="hidden" name="caseid" value="5008000000oYdXIAA0"> <input type="submit" name="submit0" value="submit"> </form> <!-- end snippet -->
<jquery><form-submit>
2016-02-18 15:09:15
LQ_EDIT
35,486,995
Window batch / DOS script to remove duplicate words in a string
<p>Can anyone help me with window batch / DOS script to remove in a string. </p> <p>If the string is -</p> <p>test1 test2 test1 test3 test2 test3</p> <p>I need a script to display as </p> <p>test1 test2 test3</p>
<windows><batch-file><dos>
2016-02-18 16:26:17
LQ_CLOSE
35,487,091
How to create web app using Python
<p>I am just starting to learn Python.</p> <p>In the past I have embedded PHP in HTML to create web apps to: - Read user supplied input values, - Write the input values to a file, - Call a Fortran executable with command line arguments for the input and output file names, - Read and display on another tab page the output file created by the Fortran executable.</p> <p>I use VS.Php in VS 2013. When debugging, VS.Php starts a local web server to display my web page and allows me to step through the PHP code.</p> <p>I would like to have a road map telling me how I can achieve the same results using Python in VS to accomplish the same results. I have Python Tools installed in VS, and am using it to run through Python tutorial examples.</p> <p>The calculations I am doing are not extensive, so the Fortran code could easily be replaced with Python code.</p>
<php><python>
2016-02-18 16:30:12
LQ_CLOSE
35,487,418
logical python comparison, evaluates False when it should be true
<p>Why does the following evaluates to False in Python?</p> <pre><code>6==(5 or 6) False 'b'==('a' or 'b') False </code></pre>
<python>
2016-02-18 16:43:37
LQ_CLOSE
35,487,608
passing hex command to c function
<p>In the function declaration below for uart write on a mcu, can I pass a hex command?</p> <pre><code>uart_write(const uart_t uart, const uint8_t data); uart_write(uart_1, 0x56); </code></pre>
<c><hex><uart>
2016-02-18 16:52:28
LQ_CLOSE
35,488,105
textbox user control not displaying date in DD/mm/yyyy format
<p>Aspx Webpage accepting value in DD/mm/yyyy format but while retrieving value from database using datetime object get method it is showing correctly in dd/mm/yyyy but assigning in mm/DD/yyyy format to datebox Instead it should show DD/mm/yyyy format?please suggest tried parsetext n all but not working</p>
<c#><asp.net><datetime><textbox>
2016-02-18 17:14:15
LQ_CLOSE
35,490,260
Array of "Object" class
<p>Despite the fact that you lose the typing security, is it bad to use primitive Object class arrays to be able to have a multi-typed array?</p> <p>Code to understand:</p> <pre><code>public class testobject { public static void main (String[] args){ Object[] obj = new Object[5]; obj[0] = "Cat"; obj[1] = 7; obj[2] = new Object(); for(int i = 0; i &lt; obj.length; i++){ System.out.println(obj[i]); } } } </code></pre>
<java><arrays><object>
2016-02-18 19:04:57
LQ_CLOSE
35,490,470
Radix Sorting Algorithm in c
<p>I have been tried to write radix sort in c.when i run my code with the static array it works well. but when i am trying to take random inputs from file it gives me an "Segmentation fault" at run time.help Please just help to modify this code here is my code:</p> <pre><code> #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include&lt;math.h&gt; #include&lt;string.h&gt; int getMax(int arr[], int n) { int mx = arr[0]; int i; for (i = 1; i &lt; n; i++) if (arr[i] &gt; mx) mx = arr[i]; return mx; } void countSort(int arr[], int n, int exp,int base) { int output[n]; int i; int count[base]; memset(count, 0, sizeof count); for (i = 0; i &lt; n; i++) count[ (arr[i]/exp)%base]++; for (i = 1; i &lt; base; i++) count[i] += count[i - 1]; for (i = n - 1; i &gt;= 0; i--) { output[count[ (arr[i]/exp)%base ] - 1] = arr[i]; count[ (arr[i]/exp)%base ]--; } for (i = 0; i &lt; n; i++) arr[i] = output[i]; } void radixsort(int arr[], int n,int base) { int m = getMax(arr, n); int exp; for (exp = 1; m/exp &gt; 0; exp *= 10) countSort(arr, n, exp , base); } void print(int arr[], int n) { int i; for (i = 0; i &lt; n; i++) printf("%d ",arr[i]); } int main(int argc,int argv[]) { int base=atoi(argv[1]); int num,i; FILE *fp1=fopen("myFile1.txt","r"); int arr[50]; while(fscanf(fp1,"%d",&amp;num)==1) { arr[i]=num; i++; } int n = sizeof(arr)/sizeof(arr[0]); radixsort(arr, n ,base); print(arr, n); fclose(fp1); return 0; } </code></pre>
<c><radix-sort>
2016-02-18 19:16:15
LQ_CLOSE
35,491,070
Windows Calculator returns wrong result
<p>if I enter 4*12+2*14 in the built-in Windows Calculator, the result is 700. Why is that?</p> <p>Sorry if the question's already been asked, it's my first post. Thank you!</p>
<windows><calculator>
2016-02-18 19:49:20
LQ_CLOSE
35,491,121
How do i write this assemly lang.program so that it can double any number passed to it
;DOUBLE This program prompt the user to enter ;a number <5, ;doubles the number, and outputs the result name double .model small .stack .data prompt db oah,odh,"Enter a number <5:$" msg db Oah,Odh,"Double your number is :" result db?,Oah,Odh,"$" .code start: mov ax,@data move ds,ax lea dx,prompt mov ah,9;dos fnto outputstring up to $ int 21h mov ab,1;dos fn toinput byte into al int 21h sub al,30h;Convert from ascii to integer add al,al add al,30h;Convert back to ascii mov result,al lea dx,msg mov ah,9 int 21h mo ax,4c00h;4c in ah is dos exit int 21h end start
<assembly><x86><dos>
2016-02-17 15:47:44
LQ_EDIT
35,492,443
Changing link to pop up link
<p>Hello trying change this link ;</p> <pre><code> &lt;a href="@String.Format("http://www.koltukcubey.com/chat/index.php?project={0}&amp;member={1}", item.Id, item.Member)" class="theme-btn btn-style-one hvr-bounce-to-right"&gt;&lt;span style="float:right;min-width:210px;"&gt;&lt;/span&gt;GİRİŞ&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; </code></pre> <p>To This ;</p> <pre><code>&lt;a href="#" onclick="javascript: window.open('http://www.koltukcubey.com/chat/index.php?project=24&amp;member=2', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1046,height=520'); return false" &gt;Chat sistemine git&lt;/a&gt; </code></pre>
<javascript><jquery><asp.net-mvc><razor>
2016-02-18 21:08:41
LQ_CLOSE
35,494,093
Should I use logging in a C++ library
<p>So I am asking about a general advise on the topic. I'm developing a C++ library for numerical computation, however trough development I found it useful for debugging when there is an issue to have a flag which to enables some form of logging done so that I can inspect what is going wrong. My question is what are the acceptable standards on this? Should I define some macro for DEBUG so that if its not define no DEBUGs happen? Should I use a logging library and log stuff.</p>
<c++><debugging><logging>
2016-02-18 22:52:39
LQ_CLOSE
35,494,221
Error 404 Pages
<p>I want to set up a broken link reporting in my custom 404 page. I want to make the document a php page, so I can capture and send the url that was requested, to my email. I have some very basic php code in it so far to send the email, so I got that. The problem is, how to I make the 404 page apear on the actual broken link page, not redirect it to the 404 page. E.g. You see Google's website has it to where if you find a broken link like this (<a href="https://www.google.com/asdfasdfasdfasdfasdf" rel="nofollow">https://www.google.com/asdfasdfasdfasdfasdf</a>) then it stays on that same page and echos the requested uri. How do they do that? I just use the .htaccess method like </p> <blockquote> <p><code>ErrorDocument 404 http://mydomain.domain/404</code></p> </blockquote> <p>But this redirects the 404 page to there. How do I make the 404 apear on the actual broken link page (non-existing page)?</p>
<php><.htaccess><http-status-code-404><url-redirection>
2016-02-18 23:01:30
LQ_CLOSE
35,495,330
Understanding pointers in C/C++
<p>I'm trying to understand how pointers work and I'm stuck at this line</p> <pre><code>for (p = s + strlen(s) - 1; s &lt; p; s++, p--) </code></pre> <p>I don't understand p what it's equated to. can anyone help me?</p> <p>here's the full code.</p> <pre><code>void Reverse(char *s){ char c, *p; for (p = s + strlen(s) - 1; s &lt; p; s++, p--){ c = *s; *s = *p; *p = c; } } int main(){ char ch[] = "!dlroW olleH"; Reverse(ch); printf("%s", ch); return 0; } </code></pre>
<c++><c><pointers>
2016-02-19 00:45:20
LQ_CLOSE
35,495,438
How do I create JTextFileds on a popup when I select JRadioButton in Java swings
I am new to Java swings...when I select a JRadioButton it should popup with JTextFiels.. where user enter details like name,age etc please let me know if anything is wrong Can anyone help me out for the below sample code import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; public class DialogTest extends JDialog implements ActionListener { private static final String TITLE = "Season Test"; private enum Season { WINTER("Winter"), SPRING("Spring"); private JRadioButton button; private Season(String title) { this.button = new JRadioButton(title); } } private DialogTest(JFrame frame, String title) { super(frame, title); JPanel radioPanel = new JPanel(); radioPanel.setSize(800,800); radioPanel.setLayout(new GridLayout(3, 1)); ButtonGroup group = new ButtonGroup(); for (Season s : Season.values()) { group.add(s.button); radioPanel.add(s.button); s.button.addActionListener(this); } Season.SPRING.button.setSelected(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.add(radioPanel); this.pack(); this.setLocationRelativeTo(frame); this.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { JRadioButton b = (JRadioButton) e.getSource(); JOptionPane.showMessageDialog(null, "You chose: " + b.getText()); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new DialogTest(null, TITLE); } }); } }
<java><swing>
2016-02-19 00:57:20
LQ_EDIT
35,496,323
webcam LED, hardware or software?
<p>To my knowledge most webcams are equipped with a LED which will turn ON if the webcam is being used.</p> <p>I was wondering if a software can avoid the LED behing activated or if it's built-in electronic.</p> <p>In other terms : If my webcam LED is off does it means 100% nobody is using it ? Remote or local.</p>
<hardware><webcam>
2016-02-19 02:35:59
LQ_CLOSE
35,496,977
Does the details of login will be stored in database by php?
<p>As an example,in gmail the total data regarding login page i.e email and password are stored in DB and when we enter our email and password,it will be compared with the data in database and ours will get logged.This complete process of extraction of data from sql will be done by php.I am i right? </p>
<php><mysql><sql><sql-server><database>
2016-02-19 03:50:22
LQ_CLOSE
35,497,867
compile a java program in serverside and display the output in client side
<p>I have a website,my problem is how to run and compile a java program in server side and display the output or error in client side</p>
<java><jsp>
2016-02-19 05:22:44
LQ_CLOSE
35,498,457
count equal strings in a list of string and make them unique
I have a list of words which are bi-gram as an example: welcome guys guys and and ladies ladies repeat repeat welcome welcome guys now i want to count the equal strings and return get this output: welcome guys, 2 guys and, 1 and ladies, 1 ladies repeat, 1 repeat welcome, 1 how can i do this in c#? thanks for your corporation.
<c#><string><count><word>
2016-02-19 06:09:47
LQ_EDIT
35,498,550
how to change bullet color of jquery slider
I want to change the default bullet(li) color of jquery slider into orange color. If not selected then circle border orange. If selected then circle fill with orange color. Please help.
<jquery><css>
2016-02-19 06:17:20
LQ_EDIT
35,498,891
difference between button button = (button) v and button button = (button)findviewbyid(r.id.button1)
could somebody tell me what is the difference between Button button = (Button)v and Button button = (Button)findviewbyid(R.id.button)
<android><button><android-studio>
2016-02-19 06:41:28
LQ_EDIT
35,499,552
how to write .json file in codeignitor using angular.js
I am new to codeignitor and i want to create todo app.anyone suggest me how to write code for fetch data from database and display using json using angular.js.
<php><angularjs><json><codeigniter><codeigniter-3>
2016-02-19 07:18:56
LQ_EDIT
35,499,798
MySQL Cannot Generate dynamic order number
i cannot generate order numbers using sub query. here i give sample code which has few tables join. here i add only main concept others i skipped. so i need to get order number from this query only. i got correct result but some of the other join tables got Recline(order) is got null after changing the BookHeadId. select @rhBookHeadId :=rh.BookHeadId ,rd.BookDetailId,@inrec:=0,(select RecLine from (SELECT spodno.BookDetailId, @inrec:= ifnull(@inrec,0)+1, @inrec as RecLine FROM tblBookDetail spodno where spodno.BookHeadId=@rhBookHeadId and spodno.isActive=1 order by spodno.BookDetailId asc ) temp where temp.BookDetailId=rd.BookDetailId) as RecLine from tblBookHead rh inner join tblBookDetail rh on rh.BookHeadId=rd.BookHeadId inner join ......;
<mysql>
2016-02-19 07:32:06
LQ_EDIT
35,499,852
sql server Same City and same Salary record Finding
This is my Qurey for finding matching Record But Same Salary Condition Not Working i i want Multiple Same City And Multiple Same Salary Record select distinct t1.Name,t1.Salary,t1.City from Test t1 , test t2 where t1.City=t2.City and t1.Salary<>t2.Salary
<sql><sql-server><sql-server-2014>
2016-02-19 07:35:40
LQ_EDIT
35,500,143
C++ hour calculations
<p>how can i write a source code for the calculations of time? For example,the user enter at 2.45 pm and check out at 3.15 . If we use simple mathematics , 3.15-2.45=0.7 . But if we use hour calculations 3.15-2.45=0.3(30minutes) . please help me .</p>
<c++><time.h>
2016-02-19 07:54:54
LQ_CLOSE
35,501,410
MSQL: Inserting row with default values
I have a table with something like 100 columns and now I would like to insert a row with some columns equal to some values and default values for all other columns. Is it possible?
<mysql><sql>
2016-02-19 09:10:51
LQ_EDIT
35,504,107
searching example for data loss by multiple access via threads (in C)
<p>I am searching an example for data loss by a concurrent access from two or more threads. Have anyone an idea, how I could do that? (in C)</p> <p>In the second step I want to fix the problem with mutex or smth like that.</p> <p>But it would help just to have an idea how to do the data loss!</p> <p>greetings</p>
<c><multithreading><mutex>
2016-02-19 11:22:13
LQ_CLOSE
35,504,830
Input user defined variables in select statement
<p>I want to store user defined variables in sql select statement and use that variable in sub query like the following:</p> <pre><code>select user_id, @user_gender:=user_gender where user_id in (select user_id from post where post_gender=@user_gender); </code></pre> <p>So what I want to do here is I want to store the user_gender value into a variable and use it in a subquery. I know what I am tryinig to do here can be achieved by joins, but what I am posting this example, because I want to know how to actually store value from a row into a user defined variable. </p> <p>Also, I am having hard time finding good resources that explains how to use user defined variables. Any recommendations?</p>
<mysql><sql>
2016-02-19 11:59:56
LQ_CLOSE
35,504,914
Saving the text entered in page to a server
<p>I am creating a journal website, i am going to have a text box in it. I need to store the text entered in the website by the user to my file. I have an online free server.please help me to store it in a simple way</p>
<javascript><php><html>
2016-02-19 12:04:26
LQ_CLOSE
35,505,410
PHP SQL query wont work
I want to get the last time my database was updated, so i use this query in my PHP code: $query = mysqli_query($mysqli, "SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'map_db' AND TABLE_NAME = ".$objects_tab.""); $lastUpdateTime = mysqli_fetch_array($query); echo "<div id ='lastUpdate'>".$lastUpdateTime."</div>"; For some reason the query wont work, does anyone know whats the problem? It works when i do other queries so its not the $mysqli connect variable or the table name variable thats wrong. Thanks in advance! :)
<php><mysql><sql><mysqli>
2016-02-19 12:29:19
LQ_EDIT
35,505,435
Regex for to validate only US and India retail number
I am trying to get a regex which serves belwo Requirements. 1) validates US,India Retail phone no 2) exclude special purpose/Business purpose phone nos in both countries. i.e. starting from 800, 888, 877, and 866,900,at least 10 digits for US, there can be more guidelines but above is just for example. 3) It should validate special chars if any like (,),+,1,0 if included but satisfies all this points than should be a valid phone no. 4) If preceded by STD,ISD consider it as valid. 5) Landline,Mobile both should be valid. I tried alot on google to get some clue if some one came across same requirements but solutions I am getting serving diff requirements and not exact one I am looking for. This is last hope. Thank you very much for your help. Thanks.
<regex>
2016-02-19 12:30:53
LQ_EDIT
35,506,084
Does lodash have a one-line method for calling a function if it exists?
<p>Given I have this code:</p> <pre><code>if (_.isFunction(this.doSomething)) { this.doSomething(); } </code></pre> <p>Whereby loadingComplete is a directive attribute passed in from a parent controller that may not always be provided, is there a cleaner one-line way to call the method if it exists, without repeating the method name?</p> <p>Something like:</p> <pre><code>_.call(this, 'doSomething'); </code></pre>
<javascript><lodash>
2016-02-19 13:06:12
HQ
35,506,381
AngularJS ui-route exit page
<p>I need a possibility to ask the user if he/she is leaving a page. I read that his would be a possibility but the event is fired when I enter the page and not when I leave the page. <strong>onExit</strong> would work but this event I have to defined at the ... .routes.js and I need access to properties and functions at the controller. Is there an event that is fired by exit of page?</p> <pre><code>$scope.$on('$locationChangeStart', function( event ) { var answer = confirm("Are you sure you want to leave this page?") if (!answer) { event.preventDefault(); } }); </code></pre>
<angularjs>
2016-02-19 13:22:08
HQ
35,506,533
Is it possible to register a Flutter app as an Android Intent Filter and to handle Incoming Intents?
<p>One can launch another Activity using an Intent from a Flutter app: <a href="https://github.com/flutter/flutter/blob/master/examples/widgets/launch_url.dart">https://github.com/flutter/flutter/blob/master/examples/widgets/launch_url.dart</a></p> <pre><code>import 'package:flutter/widgets.dart'; import 'package:flutter/services.dart'; void main() { runApp(new GestureDetector( onTap: () { Intent intent = new Intent() ..action = 'android.intent.action.VIEW' ..url = 'http://flutter.io/'; activity.startActivity(intent); }, child: new Container( decoration: const BoxDecoration( backgroundColor: const Color(0xFF006600) ), child: new Center( child: new Text('Tap to launch a URL!') ) ) )); } </code></pre> <p>But can one do the following with the Flutter Activity Intent services when an Intent is passed to the app? <a href="http://developer.android.com/training/sharing/receive.html">http://developer.android.com/training/sharing/receive.html</a></p> <pre><code>. . . void onCreate (Bundle savedInstanceState) { ... // Get intent, action and MIME type Intent intent = getIntent(); . . . </code></pre>
<dart><flutter>
2016-02-19 13:29:44
HQ
35,506,935
what is the URL for JetBrains IDE plug-in repository?
<p>I thought this was a simple question, and still nothing works.</p> <p>My first use-case is that the IDEA 15 (<em>Community</em>) appears to NOT have a repository configured. The *Plugins" tab in the <strong><em>Settings</em></strong> window / dialogue supports three operation aside from clicking on a plugin.:</p> <ul> <li><p>A button for [<code>Install JetBrains plugins</code>] ... This seems to be things downloaded with the installer or updates;</p></li> <li><p>A [<code>Browse repositories plugins</code>] button ... which contains an "<em>empty</em>" list <br/>Further this dialogue contains two buttons for:</p> <ul> <li>A [<code>Manage repositories</code>] </li> <li>[<code>HTTP proxy settings</code>] - Proxy configuration / setup</li> </ul></li> <li>An [<code>Install plugins from disk</code>] button ... which does what it says ;-)</li> </ul> <p>This question to ask is, what URL do I need to put into that: * The [<code>Manage repositories</code>] </p> <p>... list because the clean install had "<em>nada</em>" in that list.</p> <p>The list of JetBrains plugins isn't the same as the list on the plugins repository web page:</p> <ul> <li><a href="https://plugins.jetbrains.com/" rel="noreferrer">https://plugins.jetbrains.com/</a></li> </ul> <p>In fact IDEA help pages recommend using the JetBrains repository... They do not seem to want to let one know the URL.</p> <p>Also, what is the "Community" plugins URL? At the very least I'd like to verify that/<em>IF</em> the JetBrains plugin-list is updating (as there's no "update list" option to be seen).</p> <p>Weird huh?</p>
<plugins><intellij-idea><repository>
2016-02-19 13:50:04
HQ
35,507,336
Calling another class method with local variable as parameter - Ruby
Hi I have this scenario: File a.rb class a def methodA variable = secureRandom.hex(4) #do some things b(variable) end end File b.rb class b def methodB(parameter) puts parameter end end I avoid details about includes but suppose that everything is ok. "variable" its a simple string and I just want to pass that string in a variable to a method from another class. Just the value, but things goes wrong! This code generates the following error: "Undefined local variable or method `randomName' " I am a newbie in Ruby, what am I doing wrong? I have read a lot about variable scopes I have a huge confusion.
<ruby>
2016-02-19 14:11:25
LQ_EDIT
35,508,225
Javascript - how to use variables to replace the existing code at run time
<p>I have the below code and i want to replace the code at run time depending on a variable value, how do i achieve this using javascript. Also please ignore the FormA , animate etc as they are used by kony mobile. </p> <pre><code>//desired out put inside the run time code. FormA.ItemFlexContainer0.animate //index has a value of 0 for now. var index = 0; var ItemFlexContainerString = "ItemFlexContainer"+index; FormA.ItemFlexContainerString.animate Error :- Type Error null is not an object </code></pre> <p>Since ItemFlexContainerString doesnt exist it will throw the error. </p>
<javascript>
2016-02-19 14:56:45
LQ_CLOSE
35,508,635
AllowOverride not allowed here
<p>I have setup a virtualhost like following</p> <pre><code>&lt;VirtualHost *:80&gt; DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Options Includes AllowOverride All &lt;/VirtualHost&gt; </code></pre> <p>But always throws me</p> <pre><code>AH00526: Syntax error on line 6 of /etc/apache2/sites-enabled/000-my-site.conf: AllowOverride not allowed here </code></pre> <p>I'm a bit confused because I understand that is the right place to do it</p>
<apache>
2016-02-19 15:16:17
HQ
35,508,647
Swift NSURL error while creating
<p>This is my code. Error: <code>fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)</code> I have no idea where;s the problem</p> <pre><code>res = "https://www.example.com/range.php?arr1=48.15&amp;arr2=48.15&amp;API_KEY=&gt;code" let url = NSURL(string: res)! // error line print("url craeted" + res) return url </code></pre>
<ios><iphone><swift>
2016-02-19 15:16:42
LQ_CLOSE
35,508,783
Error while compiling a C++ program with G++
<p>v This is <code>main.cpp</code>:</p> <pre><code>#include &lt;stdio.h&gt; using namespace std; int main() { cout &lt;&lt; "Hello, World!" &lt;&lt; endl; return 0; } </code></pre> <p>To compile it, I go into cmd and type <code>g++ main.cpp</code> but it gives me 2 errors, saying that both <code>cout</code> and <code>endl</code> aren't declared. I can only imagine that it's because it can't find the namespace <code>std</code> or can't include <code>&lt;stdio.h&gt;</code>. How would I make this work?</p>
<c++><gcc><compiler-errors><g++>
2016-02-19 15:23:05
LQ_CLOSE
35,508,866
Tensorflow Different ways to Export and Run graph in C++
<p>For importing your trained network to the C++ you need to export your network to be able to do so. After searching a lot and finding almost no information about it, it was clarified that we should use <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py" rel="noreferrer">freeze_graph()</a> to be able to do it.</p> <p>Thanks to the new 0.7 version of Tensorflow, they added <a href="https://www.tensorflow.org/versions/r0.7/api_docs/python/train.html#export_meta_graph" rel="noreferrer">documentation</a> of it. </p> <p>After looking into documentations, I found that there are few similar methods, can you tell what is the difference between <code>freeze_graph()</code> and: <code>tf.train.export_meta_graph</code> as it has similar parameters, but it seems it can also be used for importing models to C++ (I just guess the difference is that for using the file output by this method you can only use <code>import_graph_def()</code> or it's something else?)</p> <p>Also one question about how to use <code>write_graph()</code>: In documentations the <code>graph_def</code> is given by <code>sess.graph_def</code> but in examples in <code>freeze_graph()</code> it is <code>sess.graph.as_graph_def()</code>. What is the difference between these two? </p> <p>This question is related to <a href="https://github.com/tensorflow/tensorflow/issues/615" rel="noreferrer">this issue.</a></p> <p>Thank you!</p>
<python><c++><tensorflow>
2016-02-19 15:26:39
HQ
35,509,409
How to create website with 100% reliability?
<p>I have PHP aplication with MySQL database. I want to use something to provide 100% access to website. How to do that when one server fall down another will take over whole traffic?</p> <p>I was thinking about cloning serwer, add load balancer and set up master-master replication in MySQL. Is it correct? Is there a simpler solution?</p>
<php><mysql><load-balancing><database-replication>
2016-02-19 15:54:17
LQ_CLOSE
35,509,695
Need to convert information from textarea to table
<p>I would like know, is it possible to convert this type of information</p> <blockquote> <p>1 AA 146O 07JUL BOSCDG SS1 645P 740A+* TH/FR E<br> 2 AA 147O 18JUL CDGBOS SS1 1040A 1245P * MO E<br> ></p> </blockquote> <p>to this kind table <a href="https://i.stack.imgur.com/RAe6i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RAe6i.png" alt="enter image description here"></a></p> <p>This is a flight ticket which is building in program Galileo, i would like to convert this info to understandable flight quote. How it's can be done. I know how to make it if i will enter everything separately, but is it possible to split and convert in one click?</p> <p>Any ideas how it can be done?</p>
<javascript>
2016-02-19 16:08:42
LQ_CLOSE
35,509,771
URL Blocked: This redirect failed because the redirect URI is not whitelisted....(Localhost web application)
<p>URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.</p> <p>I've installed the laravel/socialite and I'm trying to link my application with facebook ! after installing the package ,creating my facebook application , I try to acces to the login page with facebook on my application but it keeps telling me that ther's some kind of URL errors ... ??? any ideas.?</p>
<facebook><laravel-5.2><laravel-socialite><socialize-sdk>
2016-02-19 16:11:47
HQ
35,510,031
Please i need a solution regarding python 2.7
I am new to coding, this is my script I run on python 2.7 binme=binascii.b2a_hex(url) file=('e1xydGYxbnNpbnNpY3BnMTI1MlxkZWZmMFxkZWZsYW5nMTAzM3sNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb250dGJsew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXNzDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyc2V0MCBBcmlhbDt9fXtcKlxnZW5lcmF0b3IgTXNmdGVkaXQgNS40MS4xNS4xNTA3O30NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlld2tpbmQ0XHVjMVxwYXJkDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMyMCBwYXJkXGYwXGZzXHBhci90YWJccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhclxwYXJ7XHNocHtcc3B9fXtcc2hwe1xzcH19e1xzaHB7XHNwfX17XHNocHtcKlxzaHBpbnN0XHNocGZoZHIwXHNocGJ4Y29sdW1uXHNocGJ5cGFyYVxzaCBwd3IyfXtcc3B7XHNue317fXtcc259e1xzbn17XCpcKn1wRnJhZ21lbnRzfXtcKlwqXCp9e1wqXCpcc3Z7XCp9OTsyO2ZmZmZmZmZmZmYjMDUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwZTBiOTJjM2ZBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBNWMxMTEwM2ZhNTljMzgzZmNmYWYzOTNmMTAwMTA0MDEwMTAxMDEwMTAxMDEwMTAxZTBiOTJjM2YwMDgwMDAwMDQ2Y2IzOTNmZGVhZGJlZWZlMGI5MmMzZmMwM2QzYjNmY2MzMzIyM2ZkZjU5MmQzZmM0M2QzYjNmY2MxODJmM2ZjNDNkM2IzZjVlNzQyYjNmNWU3OTM5M2YyNDAwMDAwMDQ0Y2IzOTNmc2x1dGZ1Y2s2NzgyMzkzZmRlMTYzYTNmNjc4MjM5M2ZlMGI5MmMzZmMwM2QzYjNmYTU5YzM4M2Y3YzBhMmIzZmUwYjkyYzNmNTU2Njc3ODhjMDNkM2IzZmE1OWMzODNmZmJiZTM4M2ZlMGI5MmMzZjgwMDAwMDAwYjQ0MTM0M2Y1NTU1NTU1NTY2NjY2NjY2Y2ZhZjM5M2Y0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxZWI3NzMxYzk2NDhiNzEzMDhiNzYwYzhiNzYxYzhiNWUwODhiN2UyMDhiMzY2NjM5NGYxODc1ZjJjMzYwOGI2YzI0MjQ4YjQ1M2M4YjU0MDU3ODAxZWE4YjRhMTg4YjVhMjAwMWViZTMzNDQ5OGIzNDhiMDFlZTMxZmYzMWMwZmNhYzg0YzA3NDA3YzFjZjBkMDFjN2ViZjQzYjdjMjQyODc1ZTE4YjVhMjQwMWViNjY4YjBjNGI4YjVhMWMwMWViOGIwNDhiMDFlODg5NDQyNDFjNjFjM2U4OTJmZmZmZmY1ZjgxZWY5OGZmZmZmZmViMDVlOGVkZmZmZmZmNjg4ZTRlMGVlYzUzZTg5NGZmZmZmZjMxYzk2NmI5NmY2ZTUxNjg3NTcyNmM2ZDU0ZmZkMDY4MzYxYTJmNzA1MGU4N2FmZmZmZmYzMWM5NTE1MThkMzc4MWM2ZWVmZmZmZmY4ZDU2MGM1MjU3NTFmZmQwNjg5OGZlOGEwZTUzZTg1YmZmZmZmZjQxNTE1NmZmZDA2ODdlZDhlMjczNTNlODRiZmZmZmZmZmZkMDYzNmQ2NDJlNjU3ODY1MjAyZjYzMjAyMDYxMmU2NTc4NjUwMA==\n') textfile = open(filename , 'w') textfile.write(file.decode('base64')+binme+close) But I get this error when I try to run it: Traceback (most recent call last): File "<string>", line 420, in run_nodebug File "<module1>", line 32, in <module> TypeError: 'str' does not support the buffer interface Please what is wrong?
<python><typeerror>
2016-02-19 16:25:18
LQ_EDIT
35,510,410
How to use both google+ and facebook login in same appdelegate.swift
<p>My app use google+ signin and in my appdelegate.swift i have:</p> <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool { // Override point for customization after application launch. var configureError: NSError? GGLContext.sharedInstance().configureWithError(&amp;configureError) assert(configureError == nil, "Error configuring Google services: \(configureError)") GIDSignIn.sharedInstance().delegate = self return true } func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -&gt; Bool { return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation) } </code></pre> <p>Now i would like to insert also facebook login, but i have to add in appdelegate.swift this code:</p> <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool { // Override point for customization after application launch. return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) } func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -&gt; Bool { return FBSDKApplicationDelegate.sharedInstance().application( application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) } </code></pre> <p>But this return error because the functions 'application' already exist, how can I perform both google+ and facebook same appdelegate.swift Thank you.</p>
<ios><iphone><facebook><swift2><google-plus>
2016-02-19 16:45:03
HQ
35,510,634
How to use Thymeleaf th:text in reactJS
<p>I am running a springboot application with Thymeleaf and reactJS. All the HTML text are read from message.properties by using th:text in the pages, but when I have th:text in reactJS HTML block, reactJS seems angry about it. </p> <pre><code>render() { return ( &lt;input type="text" th:text="#{home.welcome}"&gt; ) } </code></pre> <p>The error is:</p> <pre><code>Namespace tags are not supported. ReactJSX is not XML. </code></pre> <p>Is there a walkaround besides using dangerouslySetInnerHTML?</p> <p>Thank you!</p>
<html><spring><reactjs><spring-boot><thymeleaf>
2016-02-19 16:57:37
HQ
35,510,938
Bad initialisation of std::vector ?
<p>This is how I declare my vector : </p> <pre><code> std::vector &lt;Link *&gt; _components; </code></pre> <p>Link is this structure : </p> <pre><code> struct Link { size_t targetPin; nts::IComponent *component; }; </code></pre> <p>First to initialise it I do </p> <pre><code> this-&gt;_components.reserve(2); </code></pre> <p>Then, when this instruction happen, it segfault </p> <pre><code> this-&gt;_components[0]-&gt;component = this; </code></pre> <p>Got an idea ? </p>
<c++>
2016-02-19 17:11:26
LQ_CLOSE
35,511,584
CSS Background Image overlay
<p>I was wondering. How do I make it to where when you scroll down the page on a website, the background kind of follows it. Example here, <a href="https://alexcican.com/post/455k-users/" rel="nofollow">https://alexcican.com/post/455k-users/</a> . I want something like the very top of the page to happen, can anyone point me in the right directional?s</p>
<css>
2016-02-19 17:47:06
LQ_CLOSE
35,511,860
How do I get my Eclipse-Maven project to automatically update its classpath when I change a dependency in my pom.xml file?
<p>I’m using Eclipse Mars with Maven (v 3.3). When I update a dependency in my pom (change the version), my Eclipse-Maven project doesn’t pick it up, even when I right click my project, and select “Maven” -> “Update Project.” I know this because I do not see compilation errors in the Eclipse Java editor that I see when I build the project on the command line using</p> <pre><code>mvn clean install </code></pre> <p>When I remove the project from the workspace and re-import it, then things get back to normal. However this is a cumbersome process. How do I get my Maven-Eclipse project to automatically detect changes in my pom and update the project libraries appropriately?</p> <p>And yes, in the “Project” menu, “Build Automatically” is checked.</p>
<eclipse><maven><dependencies><classpath><maven-eclipse-plugin>
2016-02-19 18:02:12
HQ
35,511,993
remote execute script on Linux
Wondering if it is possible to write a shell script like this, and if possible, any reference/sample implementation I can refer to? Thanks. Step 1, scp a local file on a local box to a remote box ABC, may need input password or we can hard code password into script possible? Step 2, remote execute a script on box ABC, and leverage the file uploaded in Step 1 Step 3, the output of Step 2 (which is on console/stdout) is redirected to local box. regards, Lin
<linux><shell>
2016-02-19 18:09:34
LQ_EDIT
35,512,362
Azure: Pricing of deployment slots for an Azure App Service
<p>Azure: Pricing of deployment slots for an Azure App Service.</p> <p>Using an S1 App Service Plan, my web site has up to 5 slots for web app staging. How are those slots charged? Are they billed only if used? Included in the S1 fee? or something else.</p>
<azure><azure-deployment-slots>
2016-02-19 18:29:21
HQ
35,512,711
C# Winform: Inline datagridview edit
<p>initially my <code>datagridview</code> would look like below </p> <pre><code>ID Name City Action ------ ------ ---- ------ 1 Mitch Kolkata Edit 2 Simon Delhi Edit 3 Poly Madras Edit </code></pre> <p>all data will be in read only format. so user can not change but when user click on edit button then a textbox will be placed in name column and a city <code>dropdown</code> will be placed on city column on a row whose edit button will be clicked by user.</p> <p>when user click on edit button then edit button text will be change to Save and when user click on Save button then save button text will be change to Edit. so guide me how to achieve in line edit functionality when working with <code>datagridview</code>. thanks</p>
<c#><winforms><datagridview>
2016-02-19 18:47:44
LQ_CLOSE
35,513,064
Can someone please tell me why the following Java code (for comparing two linked lists) is giving NullPointerException? This was in HackerRank
int CompareLists(Node headA, Node headB){<br> // This is a "method-only" submission. // You only need to complete this method int i =1;<br> Node tempA = new Node();<br> Node tempB = new Node();<br> tempA = headA; tempB = headB; if(tempA == null || tempB == null){ return 0; } while(i==1){ if(tempA.data==tempB.data){ i=1; } else if(tempA == null && tempB == null) return i; else{ i=0; } tempA = tempA.next; tempB = tempB.next; } return i; }
<java><nullpointerexception>
2016-02-19 19:07:51
LQ_EDIT
35,513,551
What is the function of ||= operator/s in ruby?
<p>I recently saw a code which looks something like this</p> <pre><code> @a ||= if x x/2 else 2 * x </code></pre> <p>What is the use of ||=</p>
<ruby>
2016-02-19 19:37:05
LQ_CLOSE
35,513,554
Git pull but never push file
<p>I couldn't find anything specific to this but if I missed it please let me know.</p> <p>I have a file in git which needs to be there. Once pulled down each individual will need to edit it to add their own credentials to it. When edited by the individual I do not want it to show up as having been changed or anything because we want to keep the generic file without credentials in our repo. Is there an option to have a file set up as "Pull this file but never push it"? Currently the setup we have is the file is named Upload.bat_COPY_EDIT_RENAME, which hopefully makes it obvious what to do, and I have Upload.bat in the .gitignore. I'd like something more idiot proof.</p> <p>I know there are options like --assume-unchanged but I don't want to have to run that every time and it seems kind of like a bandaid fix which could potentially cause problems later.</p> <p>Thanks for your help!</p>
<git>
2016-02-19 19:37:24
HQ
35,513,636
Multiple variable let in Kotlin
<p>Is there any way to chain multiple lets for multiple nullable variables in kotlin?</p> <pre><code>fun example(first: String?, second: String?) { first?.let { second?.let { // Do something just if both are != null } } } </code></pre> <p>I mean, something like this:</p> <pre><code>fun example(first: String?, second: String?) { first?.let &amp;&amp; second?.let { // Do something just if both are != null } } </code></pre>
<kotlin>
2016-02-19 19:42:23
HQ
35,513,954
how big does an integer have to be that you need the big integer class to use a math function
<p>how big does an integer have to be that you need the big integer class to use a math function. Is there a specific rule that needs to be followed</p>
<java><int><biginteger>
2016-02-19 20:02:15
LQ_CLOSE
35,514,369
Can someone explain Google Chrome in-memory cache?
<p>According to <a href="https://developer.chrome.com/extensions/webRequest#Caching">this</a> API doc, which is the only source I've found which describes the in-memory cache:</p> <blockquote> <p>Chrome employs two caches — an on-disk cache and a very fast in-memory cache. The lifetime of an in-memory cache is attached to the lifetime of a render process, which roughly corresponds to a tab. Requests that are answered from the in-memory cache are invisible to the web request API. If a request handler changes its behavior (for example, the behavior according to which requests are blocked), a simple page refresh might not respect this changed behavior. To make sure the behavior change goes through, call handlerBehaviorChanged() to flush the in-memory cache. But don't do it often; flushing the cache is a very expensive operation. You don't need to call handlerBehaviorChanged() after registering or unregistering an event listener.</p> </blockquote> <p>I need a better understanding of the in-memory cache. Specifically, I need Chrome to generate the full webRequest / resource waterfall every time I visit a site, including refreshing a page. Obviously, this can't be true if it's using an in-memory cache.</p> <p>Is the memory cache a clean-slate for a new tab when I create a new tab? </p> <p>What does "very expensive operation" mean quantitatively?</p> <p>If I call handlerBehaviorChanged() every time a page is reloaded in the same tab, will that guarantee a full waterfall? In that case, a limit of 20 times over 10 minutes seems fairly low.</p> <p>Any help is highly appreciated, thanks!</p>
<google-chrome><google-chrome-extension>
2016-02-19 20:26:16
HQ
35,514,633
HTML PHP get select value in same page
<p>I have a question about HTML select form.</p> <p>I have 5 select forms something like following picture. <a href="https://i.stack.imgur.com/uNHHB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uNHHB.png" alt="pic 1"></a></p> <p>You have to select from the first select form, and then the second select form will display the lists by value select from the previous select form.</p> <p>The lists are getting from MYSQL.</p> <p>How should I perform above function?</p>
<php><html><mysql>
2016-02-19 20:42:40
LQ_CLOSE
35,514,769
Taking pictures secretly in the background with Phonegap
<p>Creating an app with PhoneGap and using the plugin camera of cordova, is there a way to take an automatic photo without opening the camera's view, and use the front camera (the one for selfies)?</p>
<angularjs><cordova><android-camera><phonegap-plugins>
2016-02-19 20:50:59
LQ_CLOSE
35,514,802
NSDictionary with swift
<p><strong>Test dictionary declaration:</strong></p> <pre><code>var data = [ "A": [["userid":"1","username":"AAA","usergroupid":"2"], ["userid":"33","username":"ABB","usergroupid":"8"]], "B": [["userid":"2","username":"BBB","usergroupid":"8"], ["userid":"43","username":"ABC","usergroupid":"8"]] ] </code></pre> <p>How do I get the following output ?</p> <p><strong>For example:</strong> <br/> A -> username AAA , ABB<br/> B -> username BBB , ABC</p>
<ios><swift>
2016-02-19 20:52:38
LQ_CLOSE
35,515,120
Why does SparkContext randomly close, and how do you restart it from Zeppelin?
<p>I am working in Zeppelin writing spark-sql queries and sometimes I suddenly start getting this error (after not changing code):</p> <pre><code>Cannot call methods on a stopped SparkContext. </code></pre> <p>Then the output says further down:</p> <pre><code>The currently active SparkContext was created at: (No active SparkContext.) </code></pre> <p>This obviously doesn't make sense. Is this a bug in Zeppelin? Or am I doing something wrong? How can I restart the SparkContext?</p> <p>Thank you</p>
<apache-spark><pyspark><apache-spark-sql><apache-zeppelin>
2016-02-19 21:12:10
HQ
35,515,254
What is a dehydrated detector and how am I using one here?
<p>I'm using a simple directive to focus a text input when the element is active using <code>*ngIf</code>. This is contained within a <code>*ngFor</code> loop.</p> <p>When the first <code>*ngIf</code> is activated, the input focuses as expected. When another input is activated I get the error:</p> <p><code>EXCEPTION: Attempt to use a dehydrated detector.</code></p> <p>I don't understand what this means and how I can prevent the error. The functionality still works even with the error.</p> <pre><code>@Directive({ selector: '[myAutoFocus]' }) export class AutoFocusDirective { constructor(private elem: ElementRef) { window.setTimeout(function() { elem.nativeElement.querySelector('input').focus(); }); } } </code></pre> <p>```</p>
<angular>
2016-02-19 21:21:28
HQ
35,515,378
Assembly code fsqrt and fmul function
Im trying to compute 1.34 *sqrt(lght) in this function using assembly code, but Im getting errors like '_asm' undeclared (first use in this function) each undeclared identifier is reported only once for each func tion it appears in expected ';' before '{' token ****************************************************************************** I have been researching how to solve this problem but cant find much to continue can you guys help me fix it please ?? double hullSpeed(double lgth) { _asm{ global _start fld lght; //load lght fld st(0); //duplicate lght on Top of stack fsqrt ; square root of lght fld st(0);//load square result on top of stack fld 1.34;//load 1.34 on top of stack fld st(i); duplicate 1.34 on TOS fmulp st(0), st(i);//multiply them fst z; save result in z } return z;// return result of [ 1.34 *sqrt(lght) ] }
<c><gcc><assembly><x86><inline-assembly>
2016-02-19 21:28:59
LQ_EDIT
35,516,509
else statement always runs after if and if else
#include <stdio.h> int main(int argc, const char * argv[]) { //run... printf("----------------CALC--------------\n"); printf("(1) Type in a letter to get a secret message: "); int validSecret = 0; char secretLetter; while(validSecret == 0){ scanf("%c",&secretLetter); if(secretLetter == 'b'){ printf("B\n"); } else if (secretLetter == 'r'){ printf("R\n"); } else if (secretLetter == 'k'){ printf("K\n"); } else { printf("Game over\n"); validSecret = 1; } } return 0; } If I enter a b the if statement executes correctly and prints a B and a new line but also prints game over. Its running the if and the else... This makes no sense.
<c>
2016-02-19 22:47:41
LQ_EDIT
35,517,116
Cannot implicitly convert typre 'string' to 'short'
protected void btnAdd_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(Request.QueryString["id"])) { string kundeID = "-1"; int id = Convert.ToInt32(Request.QueryString["id"]); int totalsum = Convert.ToInt32(ddlAmount.SelectedValue); Handlevogn handlevogn = new Handlevogn { TotalSum = totalsum, KundeID = kundeID, Dato = DateTime.Now, ErIHandlevogn = true, ProduktID = id }; HandlevognModell modell = new HandlevognModell(); lblResult.Text = modell.InsertHandlevogn(handlevogn); } Keep getting the error > Cannot implicitly convert typre 'string' to 'short' for the local variable kundeID.
<c#>
2016-02-19 23:43:15
LQ_EDIT
35,517,239
SharedPreferences are not being cleared when I uninstall
<p>OK, this is a strange one that I didn't think was even possible.</p> <p>So, ever since I've been using a Nexus 5X, the SharedPreferences are not getting wiped when I uninstall my app.</p> <p>I install the app through Android Studio and test things. I then uninstall the app. I then resintall the app through Android Studio and all the SharedPreferences values are still there.</p> <p>I've tried clearing the data/cache in addition to uninstalling. The SharedPreferences are persistent through all those attempts.</p> <p>I am using stock Android 6.0 on a Nexus 5X. My device is not rooted. I am not using a custom ROM. I do not have this issue with my Nexus 4. </p> <p>Any ideas what might be causing this?</p>
<android>
2016-02-19 23:55:14
HQ
35,517,348
Why are my calculations are off? 1 work day is supposed to equal 8 hours.
<p>I think my math isn't done right in the setter function(s). I've been staring at it too long. Thanks in advance programmers! </p> <pre><code>#include &lt;iostream&gt; using namespace std; class numDays { int hours; int days; public: numDays(int hrs); //constructor prototype void setHours(int); void setDays(int); int getHours(); int getDays(); double operator+ (const numDays Object1) //overloading the + operator to return the sum of two objects' hours members { return hours + Object1.hours; } double operator-(const numDays Object1) //overloading the + operator to return the difference of two objects' hours members { return hours - Object1.hours; } numDays operator++() //prefix increment operator to increment # of hours stored in object. Days are recalculated. { ++hours; days = hours/8; return *this; } numDays operator++(int) //postfix increment operator to increment # of hours stored in object. Days are recalculated. { numDays temp(hours); hours++; days = hours/8; return temp; } numDays operator--() //prefix decrement operator to decrement # of hours stored in object. Days are recalculated. { --hours; days = hours/8; return *this; } numDays operator-- (int) //prefix decrement operator to decrement # of hours stored in object. Days are recalculated. { numDays temp(hours); hours--; days = hours/8; return temp; } }; numDays::numDays(int hrs) //constructor that accepts a number of hours {hours = hrs;} </code></pre> <p>I expect the problem is here in either the setHours function or the setDays function.</p> <pre><code>void numDays::setHours(int hrs) //mutator function to store the amount of hours { hours = hrs; days = hrs/8; } void numDays::setDays(int d) //mutator function to store the amount of days { hours = d; days = hours % 8; } int numDays::getHours() //accessor function to get the amount of hours { return hours; } int numDays::getDays() //accessor function to get the amount of days { return days; } int main() { int workHours; numDays object2(0); cout &lt;&lt; "Please type in a certain amount of hours to see how much work in days it is: "; cin &gt;&gt; workHours; object2.setHours(workHours); object2.setDays(workHours); cout &lt;&lt; "The number of hours you put in is " &lt;&lt; object2.getHours() &lt;&lt; endl; cout &lt;&lt; "That means you worked " &lt;&lt;object2.getDays() &lt;&lt; " days " &lt;&lt; endl; return 0; } </code></pre>
<c++><class><c++11><object><operator-overloading>
2016-02-20 00:06:15
LQ_CLOSE
35,517,537
Cordova: Cannot find plugin.xml
<p>I am trying to remove this plugin from my coordova file and I am getting this issues</p> <pre><code>Error: Cannot find plugin.xml for plugin 'org.apache.cordova.file-transfer'. Please try adding it again. </code></pre> <p>This is the cordova command to remove the plugin</p> <pre><code>cordova plugin rm cordova-plugin-file-transfer </code></pre> <p>Please assist on why I cannot be able to remove this plugin. Thank you</p>
<cordova><ionic-framework>
2016-02-20 00:28:47
HQ
35,517,995
Why doesn't this ruby code do anything?
<p>I am running the following ruby code in my local environment:</p> <pre><code>def multiples(max) array = [] (0...max).each do |n| if (n % 3 == 0) || (n % 5 == 0) array &lt;&lt; n end end array.inject(:+) end multiples(1000) </code></pre> <p>and nothing happens at all. My code looks good to me. What's the issue here?</p>
<ruby>
2016-02-20 01:23:17
LQ_CLOSE
35,518,688
Git LFS refused to track my large files properly, until I did the following
<h1>Problem</h1> <p>I had troubles trying to use <a href="https://git-lfs.github.com/" rel="noreferrer">git LFS</a>, despite the many suggestions here on SO, on Git and GitHub's documentation, and on some Gists I'd run across.</p> <p>My problem was as follows:</p> <p>After performing the necessary steps:</p> <pre><code>git lfs install git lfs track "&lt;file of interest&gt;" git commit </code></pre> <p>I would still not have any files being tracked. If I performed</p> <pre><code>git lfs ls-files </code></pre> <p>it would be blank. If I went ahead &amp; performed the push, the transaction would fail, saying that the files are too large. (As expected, but I was desperate.)</p>
<git><github><git-lfs>
2016-02-20 03:15:19
HQ
35,518,986
what's the difference between yield from and yield in python 3.3.2+
<p>After python 3.3.2+ python support a new syntax for create generator function </p> <pre><code>yield from &lt;expression&gt; </code></pre> <p>I have made a quick try for this by </p> <pre><code>&gt;&gt;&gt; def g(): ... yield from [1,2,3,4] ... &gt;&gt;&gt; for i in g(): ... print(i) ... 1 2 3 4 &gt;&gt;&gt; </code></pre> <p>It seems simple to use but the <a href="https://www.python.org/dev/peps/pep-0380/" rel="noreferrer">PEP</a> document is complex. My question is that is there any other difference compare to the previous yield statement? Thanks.</p>
<python><yield>
2016-02-20 04:07:12
HQ
35,519,008
Counting number of integers in text file (undeclared identifier using fin>>x)
<p>I have a text file with an unknown number of integers. I created a dynamic array without trouble, but the numbers have varied spacing and digits. I would normally go through each position to count the number of spaces used, subtracting space from it, but that won't work in this case.</p> <p>I thought to use something like this: (which similar questions would suggest)</p> <pre><code> do { if (!file.is_open()) { file.open(donation); } fin &gt;&gt; temp; charCount++; } while (file.peek() != EOF); cout &lt;&lt; charCount; </code></pre> <p>Now, I have fstream included, and I am using namespace std, and I have no problem opening and reading the text file, but visual studio 2015 tells me:</p> <p>Error C2065 'fin': undeclared identifier</p> <p>I don't understand what I am doing that is triggering that type of response from the IDE.</p>
<c++><file><loops><fstream><undeclared-identifier>
2016-02-20 04:10:40
LQ_CLOSE
35,519,398
What is the little white gap for my css?
<!-- begin snippet: js hide: false --> <!-- language: lang-css --> body{ margin:0px; padding:0px;} div{ border:1px solid black; box-sizing:border-box; font-size:30px;} #wrapper{ width:900px; margin:0px auto;} #header{ width:100%; height:100px; background:red;} #container{ width:100%; height:100px; background:black;} #mainBox{ width:75%; height:150px; background:blue; float:left; } #sideBox{ width:25%; height:100px; background:yellow; float:left; } #footer{ clear:both; width:100%; height:50px; background:white; } <!-- language: lang-html --> <body> <div id="wrapper"> <div id="header">this is the header </div> <div id="container"> <div id="mainBox">main box </div> <div id="sideBox">side box </div> </div> <div id="footer">this is the footer </div> </div> <!-- end snippet --> [![enter image description here][1]][1] There is a little white gap on the downside of mainBox,what is it and which cause it? [1]: http://i.stack.imgur.com/jeFP4.png
<html><css>
2016-02-20 05:12:28
LQ_EDIT
35,519,810
Custom attribute gives parsing error when using with an angular 2.0.0-beta.0
<p>I'm trying to use custom attribute with angular2 as following</p> <pre><code> &lt;a href="javascript:void(0)" title="{{inst.title}}" data-loc="{{inst.actionval}}"&gt; </code></pre> <p>which gives me following error</p> <blockquote> <p>EXCEPTION: Template parse errors: Can't bind to 'loc' since it isn't a known native property</p> </blockquote>
<angular><angular2-template>
2016-02-20 06:03:42
HQ
35,519,889
write to dynamic array
I created a dynamic array using pointers and successfully opened a text file to read the number of integers into an int pointer. Now I am trying to store the items from the text file sequentially into the array. *x = 0; do { file >> *temp; intArray[*x] = *temp; *x = *x + 1; cout << donationsArray[*x]; } while (*x < *arraySize); The above uses cout to show me test output, which only produces a memory address. (the same memory address repeatedly for all the array positions) -842150451 What am I doing wrong here?
<c++><pointers><dynamic-arrays>
2016-02-20 06:14:55
LQ_EDIT
35,520,160
python logging performance comparison and options
<p>I am researching high performance logging in Python and so far have been disappointed by the performance of the python standard logging module - but there seem to be no alternatives. Below is a piece of code to performance test 4 different ways of logging:</p> <pre><code>import logging import timeit import time import datetime from logutils.queue import QueueListener, QueueHandler import Queue import threading tmpq = Queue.Queue() def std_manual_threading(): start = datetime.datetime.now() logger = logging.getLogger() hdlr = logging.FileHandler('std_manual.out', 'w') logger.addHandler(hdlr) logger.setLevel(logging.DEBUG) def logger_thread(f): while True: item = tmpq.get(0.1) if item == None: break logging.info(item) f = open('manual.out', 'w') lt = threading.Thread(target=logger_thread, args=(f,)) lt.start() for i in range(100000): tmpq.put("msg:%d" % i) tmpq.put(None) lt.join() print datetime.datetime.now() - start def nonstd_manual_threading(): start = datetime.datetime.now() def logger_thread(f): while True: item = tmpq.get(0.1) if item == None: break f.write(item+"\n") f = open('manual.out', 'w') lt = threading.Thread(target=logger_thread, args=(f,)) lt.start() for i in range(100000): tmpq.put("msg:%d" % i) tmpq.put(None) lt.join() print datetime.datetime.now() - start def std_logging_queue_handler(): start = datetime.datetime.now() q = Queue.Queue(-1) logger = logging.getLogger() hdlr = logging.FileHandler('qtest.out', 'w') ql = QueueListener(q, hdlr) # Create log and set handler to queue handle root = logging.getLogger() root.setLevel(logging.DEBUG) # Log level = DEBUG qh = QueueHandler(q) root.addHandler(qh) ql.start() for i in range(100000): logging.info("msg:%d" % i) ql.stop() print datetime.datetime.now() - start def std_logging_single_thread(): start = datetime.datetime.now() logger = logging.getLogger() hdlr = logging.FileHandler('test.out', 'w') logger.addHandler(hdlr) logger.setLevel(logging.DEBUG) for i in range(100000): logging.info("msg:%d" % i) print datetime.datetime.now() - start if __name__ == "__main__": """ Conclusion: std logging about 3 times slower so for 100K lines simple file write is ~1 sec while std logging ~3. If threads are introduced some overhead causes to go to ~4 and if QueueListener and events are used with enhancement for thread sleeping that goes to ~5 (probably because log records are being inserted into queue). """ print "Testing" #std_logging_single_thread() # 3.4 std_logging_queue_handler() # 7, 6, 7 (5 seconds with sleep optimization) #nonstd_manual_threading() # 1.08 #std_manual_threading() # 4.3 </code></pre> <ol> <li>The nonstd_manual_threading option works best since there is no overhead of the logging module but obviously you miss out on a lot of features such as formatters, filters and the nice interface</li> <li>The std_logging in a single thread is the next best thing but still about 3 times slower than nonstd manual threading. </li> <li>The std_manual_threading option dumps messages into a threadsafe queue and in a separate thread uses the standard logging module. That comes out to be about 25% higher than option 2, probably due to context switching costs.</li> <li>Finally, the option using "logutils"'s QueueHandler comes out to be the most expensive. I tweaked the code of logutils/queue.py's _monitor method to sleep for 10 millis after processing 500 messages as long as there are less than 100K messages in the queue. That brings the runtime down from 7 seconds to 5 seconds (probably due to avoiding context switching costs).</li> </ol> <p>My question is, why is there so much performance overhead with the logging module and are there any alternatives? Being a performance sensitive app does it even make sense to use the logging module?</p> <p>p.s.: I have profiled the different scenarios and seems like LogRecord creation is expensive.</p>
<python><multithreading><performance><logging><python-multithreading>
2016-02-20 06:53:56
HQ
35,521,390
Gradle console - get more log output
<p>I am using Android studio. In the gradle console getting the below error message</p> <blockquote> <p>Compilation error. See log for more details</p> <ul> <li>Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.</li> </ul> <p>BUILD FAILED</p> </blockquote> <p>But where to run <strong>--info option</strong> to see the more log ?</p>
<android-studio><android-gradle-plugin>
2016-02-20 09:31:08
HQ