Search Results

Search found 2601 results on 105 pages for 'condition'.

Page 50/105 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Creating Auto Incrementing column in Google Appengine

    - by demos
    What is the easiest and most efficient way to create an auto-increment counter for every data row in google appengine? basically I want to give every row a unique row_number so that I can overcome the issue of only being able to get the first 1000 results in a select query. I can thus add a counter lies between condition and mine all the entires in the table.

    Read the article

  • get index name within specific table name

    - by AmRoSH
    I need to check if this index not exist in specific table name not in all tables because this select statement select all indexes under this condition. IF NOT EXISTS (SELECT name from sysindexes WHERE name = 'IDX_InsuranceID') CREATE NONCLUSTERED INDEX [IDX_InsuranceID] ON [dbo].[QuoteInsurances] ( [InsuranceID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY] GO Thanks,

    Read the article

  • PHP Simplify a ternary operation

    - by Obay
    In PHP, is there a way to simplify this even more, without using an if()? $foo = $bar!==0 ? $foo : ''; I was wondering if there was a way to not reassign $foo to itself if the condition is satisfied. I understand there is a way to do this in Javascript (using &&, right?), but was wondering if there was a way to do this in PHP.

    Read the article

  • Multithreaded ActiveRecord requests in rspec

    - by jeem
    I'm trying to recreate a race condition in a test, so I can try out some solutions. I find that in the threads I create in my test, ActiveRecord always returns 0 for counts and nil for finds. For example, with 3 rows in the table "foos": it "whatever" do puts Foo.count 5.times do Thread.new do puts Foo.count end end end will print 3 0 0 0 0 0 test.log shows the expected query, the expected 6 times: SELECT count(*) AS count_all FROM `active_agents` Any idea what's going on here?

    Read the article

  • Can this statement ever evaluate to FALSE?

    - by BojanG
    I stumbled upon this while doing a review and the author is not available: int n = Convert.ToInt32(text); if (((n > 0) || (n < 0)) || (n == 0)) { return 1; } The code in general looks solid and it's hard for me to believe that the only purpose of this snippet is to confuse reviewers, but I don't see a way for this condition to fail. Am I missing something?

    Read the article

  • INSERT ... ON DUPLICATE KEY UPDATE with WHERE?

    - by Raven
    Hi! I'm doing a INSERT ... ON DUPLICATE KEY UPDATE but I need the update part to be conditional, only doing the update if some extra condition has changed. However, WHERE is not allowed on this UPDATE. Is there any workaround for this? I can't do combinations of INSERT/UPDATE/SELECT since this needs to work over a replication.

    Read the article

  • How expensive is synchronization?

    - by someguy
    I am writing a networking application using the java.nio api. My plan is to perform I/O on one thread, and handle events on another. To do this though, I need to synchronize reading/writing so that a race condition is never met. Bearing in mind that I need to handle thousands of connections concurrently, is synchronization worth it, or should I use a single thread for I/O and event handling?

    Read the article

  • Comparing arrays with sql

    - by Nissim
    I want to perform a 'SELECT' statement with a byte array (binary) parameter as a condition. I tried to google it, but didn't find anything useful. In general, I keep information of files in the database. one of the properties is the file's hash (binary). I want to give a hash to the SELECT statement, and get all rows with the same hash value.

    Read the article

  • nonparametric regression method using R

    - by user1782652
    I need to find the certain driver variables for unit sales & their impact on sales. My data is such data the error does not follow normal distribution & the unit sales is also not following any particular statistical distribution. Given such condition, it is difficult for me to use simple liner regression or GLM. Can any of you please suggest me some non parametric regression technique which I can use in R to model the relationship? Thanks,

    Read the article

  • Updating table from async task android

    - by CantChooseUsernames
    I'm following this tutorial: http://huuah.com/android-progress-bar-and-thread-updating/ to learn how to make progress bars. I'm trying to show the progress bar on top of my activity and have it update the activity's table view in the background. So I created an async task for the dialog that takes a callback: package com.lib.bookworm; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; public class UIThreadProgress extends AsyncTask<Void, Void, Void> { private UIThreadCallback callback = null; private ProgressDialog dialog = null; private int maxValue = 100, incAmount = 1; private Context context = null; public UIThreadProgress(Context context, UIThreadCallback callback) { this.context = context; this.callback = callback; } @Override protected Void doInBackground(Void... args) { while(this.callback.condition()) { this.callback.run(); this.publishProgress(); } return null; } @Override protected void onProgressUpdate(Void... values) { super.onProgressUpdate(values); dialog.incrementProgressBy(incAmount); }; @Override protected void onPreExecute() { super.onPreExecute(); dialog = new ProgressDialog(context); dialog.setCancelable(true); dialog.setMessage("Loading..."); dialog.setProgress(0); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setMax(maxValue); dialog.show(); } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); if (this.dialog.isShowing()) { this.dialog.dismiss(); } this.callback.onThreadFinish(); } } And in my activity, I do: final String page = htmlPage.substring(start, end).trim(); //Create new instance of the AsyncTask.. new UIThreadProgress(this, new UIThreadCallback() { @Override public void run() { row_id = makeTableRow(row_id, layout, params, matcher); //ADD a row to the table layout. } @Override public void onThreadFinish() { System.out.println("FINISHED!!"); } @Override public boolean condition() { return matcher.find(); } }).execute(); So the above creates an async task to run to update a table layout activity while showing the progress bar that displays how much work has been done.. However, I get an error saying that only the thread that started the activity can update its views. I tried doing: MainActivity.this.runOnUiThread(new Runnable() { @Override public void run() { row_id = makeTableRow(row_id, layout, params, matcher); //ADD a row to the table layout. } } But this gives me synchronization errors.. Any ideas how I can display progress and at the same time update my table in the background? Currently my UI looks like:

    Read the article

  • unprotected access to member in property get

    - by Lenik
    I have a property public ObservableCollection<string> Name { get { return _nameCache; } } _nameCache is updated by multiple threads in other class methods. The updates are guarded by a lock. The question is: should I use the same lock around my return statement? Will not using a lock lead to a race condition?

    Read the article

  • An IE7 toolbar button, with 2 different *.rc files

    - by karikari
    I have a IE 7 button toolbar project on Visual C++. My question is, can my button have 2 *.rc files. Means, by default it will use the 1st *.rc file, and when certain condition achieve inside my *.cpp, the button will be using the 2nd *.rc file. Is this allowed in visual studio or IE7? edit: Both rc files has different information for icon image.

    Read the article

  • Comparing char for validation in C++

    - by Corey Starbird
    /* PROGRAM: Ch6_14.cpp Written by Corey Starbird This program calculates the balance owed to a hospital for a patient. Last modified: 10/28/13 */ #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; // Prototypes for In-patient and Out-patient functions. double stayTotal (int, double, double, double); // For In-patients double stayTotal (double, double); // For Out-patients int main() { char patientType; // In-patient (I or i) or Out-patient (O or o) double rate, // Daily rate for the In-patient stay servCharge, // Service charge for the stay medCharge, // Medication charge for the stay inTotal, // Total for the In-patient stay outTotal; // Total for the Out-patient stay int days; // Number of days for the In-patient stay // Find out if they were an In-patient or an Out-patient cout << "Welcome, please enter (I) for an In-patient or (O) for an Out-patient:" << endl; cin >> patientType; while (patientType != 'I' || 'i' || 'O' || 'o') { cout << "Invalid entry. Please enter either (I) for an In-patient or (O) for an Out-patient:" << endl; cin >> patientType; } cout << "FIN"; return 0; } Hey, brand new to C++ here. I am working on a project and I'm having trouble figuring out why my validation for patientTypeisn't working properly. I first had double quotes, but realized that would denote strings. I changed them to single quotes, my program will compile and run now, but the while loop runs no matter what I enter, I, i, O, o, or anything else. I don't know why the while loop isn't checking the condition, seeing that I did enter one of the characters in the condition, and move on to cout. Probably a simple mistake, but I thank you in advance.

    Read the article

  • Not really a quaestion...but i need help

    - by Dan F.
    I have to make a process in Oracle/PLSQL.....i have to verify that the interval of time between start_date and end_date from a new row that i create must not intersect other start_dates and end_dates from other rows. Now I need to check each row for that condition and if it doesn't correspond the repetitive instruction should stop and after that to display a message such as "The interval of time given is not correct". I don't know how to make repetitive instructions in Oracle/PLSQL and I would appreciate if you would help me.

    Read the article

  • equal insread of distinct

    - by MirooEgypt
    SELECT DISTINCT IncreasmentAmount, Name, regionid FROM Pricing.GroupOfRegions where regionid in (6,7) i have this result 12.80 AB 6 13.00 ABC 6 15.00 AC 6 12.80 AB 7 13.00 ABC 7 i wanna add more condition where IncreasmentAmount are equals which means i got the rows where regionid in (6,7) and have the same IncreasmentAmount so i got finally 12.80 AB 6 12.80 AB 7

    Read the article

  • Two if conditions or one if with OR

    - by Ram
    I have a small doubt I have following code bool res= false; if(cond1) { res = true; } if(cond2) { res = true; } Instead of this if I put following code if(cond1 || cond2) { res = true; } Which code snippet will be more optimized? I believe it would be second one as I have avoided an If condition.

    Read the article

  • Odd PHP Error Message

    - by John
    When I run some php code I've written, I get the following message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition, price, name, email) VALUES('Fake Title', 'Fake Subhead', 'Fake Author' at line 1 I do not see anything wrong with my syntax, however, which is like: mysql_query("INSERT INTO table (x1, x2, x3) VALUES('$y1', '$y2', '$y3')"); Any ideas?

    Read the article

  • Why is one query consistently ~25ms faster than another in postgres?

    - by Emory
    A friend wrote a query with the following condition: AND ( SELECT count(1) FROM users_alerts_status uas WHERE uas.alert_id = context_alert.alert_id AND uas.user_id = 18309 AND uas.status = 'read' ) = 0 Seeing this, I suggested we change it to: AND NOT EXISTS ( SELECT 1 FROM users_alerts_status uas WHERE uas.alert_id = context_alert.alert_id AND uas.user_id = 18309 AND uas.status = 'read' ) But in testing, the first version of the query is consistently between 20 and 30ms faster (we tested after restarting the server). Conceptually, what am I missing?

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >