Search Results

Search found 21356 results on 855 pages for 'check digit'.

Page 153/855 | < Previous Page | 149 150 151 152 153 154 155 156 157 158 159 160  | Next Page >

  • i see the file but when i open it nothing is in it in c++ i/o stream and dont know why

    - by user320950
    #include<iostream> #include<fstream> #include<cstdlib> #include<iomanip> using namespace std; int main() { ifstream in_stream; // reads ITEMSLIST.txt ofstream out_stream1; // writes in listWititems.txt ifstream in_stream2; // reads PRICELIST.txt ofstream out_stream3;// writes in listWitprices.txt ifstream in_stream4;// read display.txt ofstream out_stream5;// write showitems.txt double p1=0.0,p2=0.0; int wrong=0; int count =0; char next; in_stream.open("ITEMLIST.txt", ios::in); // list of avaliable items /*if( in_stream.fail() )// check to see if itemlist.txt is open { wrong++; // counts number of errors cout << " the error occured here0, you have " << wrong++ << " errors" << endl; cout << "Error opening the file\n" << endl; exit(1); } else{ cout << " System ran correctly " << endl; } */ out_stream1.open("listWititems.txt", ios::out); // list of avaliable items /* if( out_stream1.fail() )// check to see if itemlist.txt is open { wrong++; cout << " the error occured here0, you have " << wrong++ << " errors" << endl; cout << "Error opening the file\n" << endl; exit(1); } else{ cout << " System ran correctly " << endl; } */ in_stream2.open("PRICELIST.txt", ios::in); /*if( in_stream2.fail() )// check to see if itemlist.txt is open { wrong++; cout << " the error occured here0, you have " << wrong++ << " errors" << endl; cout << "Error opening the file\n" << endl; exit(1); } else{ cout << " System ran correctly " << endl; } */ out_stream3.open("listWitdollars.txt", ios::out); /*if( out_stream3.fail() )// check to see if itemlist.txt is open { wrong++; cout << " the error occured here0, you have " << wrong++ << " errors" << endl; cout << "Error opening the file\n" << endl; exit(1); } else{ cout << " System ran correctly " << endl; } */ in_stream4.open("display.txt", ios::in); /*if( in_stream4.fail() )// check to see if itemlist.txt is open { wrong++; cout << " the error occured here0, you have " << wrong++ << " errors" << endl; cout << "Error opening the file\n" << endl; exit(1); } else{ cout << " System ran correctly " << endl; } */ out_stream5.open("showitems.txt", ios::out); /*if( out_stream5.fail() )// check to see if itemlist.txt is open { wrong++; cout << " the error occured here0, you have " << wrong++ << " errors" << endl; cout << "Error opening the file\n" << endl; exit(1); } else{ cout << " System ran correctly " << endl; }*/ in_stream.setf(ios::fixed); while(!in_stream.eof()) // reads to end of file and gets p1 which is itemnum, clears and gets next character { in_stream >> p1; cin.clear(); cin >> next; } out_stream1.setf(ios::fixed); while (!out_stream1.eof()) { out_stream1 << p1; cin.clear(); cin >> next; } in_stream2.setf(ios::fixed); in_stream2.setf(ios::showpoint); in_stream2.precision(2); while(!in_stream2.eof()) // reads file to end of file { in_stream2 >> p1 >> p2 >> count; // gets p1,p2, and count which is current total in_stream2 >> p2; p1 += p2; p2++; cin.clear(); // allows more reading cin >> next; return p1, p2; } out_stream3.setf(ios::fixed); out_stream3.setf(ios::showpoint); out_stream3.precision(2); while(!out_stream3.eof()) // reads file to end of file { out_stream3 << p1 << p2 << count; out_stream3 << p2; p1 += p2; p2++; cin.clear(); // allows more reading cin >> next; return p1, p2; } in_stream4.setf(ios::fixed); in_stream4.setf(ios::showpoint); in_stream4.precision(2); while (!in_stream4.eof()) { in_stream4 >> p1 >> p2 >> count; cin.clear(); cin >> next; } out_stream5.setf(ios::fixed); out_stream5.setf(ios::showpoint); out_stream5.precision(2); out_stream5 <<setw(5)<< " itemnum " <<setw(5)<<" price "<<setw(5)<<" curr_total " <<endl; // sends items and prices to receipt.txt out_stream5 << setw(5) << p1 << setw(5) <<p2 << setw(5)<< count; // sends items and prices to receipt.txt out_stream5 << " You have a total of " << wrong++ << " errors " << endl; in_stream.close(); // closing files. out_stream1.close(); in_stream2.close(); out_stream3.close(); in_stream4.close(); out_stream5.close(); system("pause"); }

    Read the article

  • ant conditions problem

    - by senzacionale
    I have problem with ant. I woul dlike to use conditions in ant. But i get error of: BUILD FAILED C:\Projekti\Projekt ANT\build.xml:412: Problem: failed to create task or type Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any / declarations have taken place. and this is code: <target name="test"> <input message="Write some text: " addproperty="foo" /> <if> <equals arg1="${foo}" arg2="bar" /> <then> <echo message="The value of property foo is 'bar'" /> </then> <elseif> <equals arg1="${foo}" arg2="foo" /> <then> <echo message="The value of property foo is 'foo'" /> </then> </elseif> <else> <echo message="The value of property foo is not 'foo' or 'bar'" /> </else> </if> </target>

    Read the article

  • Why can't I extract a C++ type from a Python type using boost::python::extractor?

    - by Robin
    I've wrapped a C++ class using Py++ and everything is working great in Python. I can instantiate the c++ class, call methods, etc. I'm now trying to embed some Python into a C++ application. This is also working fine for the most-part. I can call functions on a Python module, get return values, etc. The python code I'm calling returns one of the classes that I wrapped: import _myextension as myext def run_script(arg): my_cpp_class = myext.MyClass() return my_cpp_class I'm calling this function from C++ like this: // ... excluding error checking, ref counting, etc. for brevity ... PyObject *pModule, *pFunc, *pArgs, *pReturnValue; Py_Initialize(); pModule = PyImport_Import(PyString_FromString("cpp_interface")); pFunc = PyObject_GetAttrString(pModule, "run_script"); pArgs = PyTuple_New(1); PyTuple_SetItem(pArgs, 0, PyString_FromString("an arg")); pReturnValue = PyObject_CallObject(pFunc, pArgs); bp::extract< MyClass& > extractor(pReturnValue); // PROBLEM IS HERE if (extractor.check()) { // This check is always false MyClass& cls = extractor(); } The problem is the extractor never actually extracts/converts the PyObject* to MyClass (i.e. extractor.check() is always false). According to the docs this is the correct way to extract a wrapped C++ class. I've tried returning basic data types (ints/floats/dicts) from the Python function and all of them are extracted properly. Is there something I'm missing? Is there another way to get the data and cast to MyClass?

    Read the article

  • What's the best technique to protect my framework from visitors who are not logged in?

    - by Hermet
    First of all, I would like to say that I have used the search box looking for a similar question and was unsuccessful, maybe because of my poor english skills. I have a a 'homemade' framework. I have certain PHP files that must only be visible for the admin. The way I currently do this is check within every single page to see if a session has been opened. If not, the user gets redirected to a 404 page, to seem like the file which has been requested doesn't exist. I really don't know if this is guaranteed to work or if there's a better and more safe way because I'm currently working with kind of confidential data that should never become public. Could you give me some tips? Or leave a link where I could find some? Thank you very much, and again excuse me for kicking the dictionary. EDIT What I usually write in the top of each file is something like this <?php include("sesion.php"); $rs=comprueba(); //'check' if ($rs==1) { ?> And then, at the end <?php } ?> Is it such a butched job, isn't it? EDIT Let's say I have a customers list in a file named customers.php That file may be currently on http://www.mydomain.com/admin/customers.php and it must only be visible for the admin user. Once the admin user has been logged in, I create a session variable. That variable is what I check on the top of each page, and if it exists, the customers list is shown. If not, the user gets redirected to the 404 page. Thank you for your patience. I really appreciate.

    Read the article

  • My python program always brings down my internet connection after several hours running, how do I debug and fix this problem?

    - by Shane
    I'm writing a python script checking/monitoring several server/websites status(response time and similar stuff), it's a GUI program and I use separate thread to check different server/website, and the basic structure of each thread is using an infinite while loop to request that site every random time period(15 to 30 seconds), once there's changes in website/server each thread will start a new thread to do a thorough check(requesting more pages and similar stuff). The problem is, my internet connection always got blocked/jammed/messed up after several hours running of this script, the situation is, from my script side I got urlopen error timed out each time it's requesting a page, and from my FireFox browser side I cannot open any site. But the weird thing is, the moment I close my script my Internet connection got back on immediately which means now I can surf any site through my browser, so it must be the script causing all the problem. I've checked the program carefully and even use del to delete any connection once it's used, still get the same problem. I only use urllib2, urllib, mechanize to do network requests. Anybody knows why such thing happens? How do I debug this problem? Is there a tool or something to check my network status once such situation occurs? It's really bugging me for a while... By the way I'm behind a VPN, does it have something to do with this problem? Although I don't think so because my network always get back on once the script closed, and the VPN connection never drops(as it appears) during the whole process.

    Read the article

  • creating a thread in jsp and using join has problem

    - by Suresh S
    guys the following code does not wiat for the thread t to complete and join with the main thread, also the "created object" trace is called one more time after join is called please let me know the solution <% AProc empList = new AProc(); System.out.println("** Created Object ****"); System.out.println("Condition"+(!(p.length==0) && !(status) && !(threadLive))); if (!(p.length==0) && !(status) && !(threadLive)){ java.util.Date currDate = new java.util.Date(); try { Thread t = new Thread(empList); System.out.println("Check thread life 1 "+t.isAlive()); empList.setServletRequest(request , schemaName); System.out.println("Thread Started "+t); t.start(); System.out.println("Check thread life 2 "+t.isAlive()); if(t.isAlive()) { threadLive = true; } t.join(); while (t.isAlive()) { t.join(); } System.out.println("Check thread life 3 "+t.isAlive()); System.out.println("Thread End "+t); //} } catch (Exception e) { System.out.println("Exception in thread while running Procedure "+e); status=false; threadLive=false; } status = e.getStatusProc(); }%>

    Read the article

  • Average over a timeframe with missing data

    - by BHare
    Assuming a table such as: UID Name Datetime Users 4 Room 4 2012-08-03 14:00:00 3 2 Room 2 2012-08-03 14:00:00 3 3 Room 3 2012-08-03 14:00:00 1 1 Room 1 2012-08-03 14:00:00 2 3 Room 3 2012-08-03 14:15:00 1 2 Room 2 2012-08-03 14:15:00 4 1 Room 1 2012-08-03 14:15:00 3 1 Room 1 2012-08-03 14:30:00 6 1 Room 1 2012-08-03 14:45:00 3 2 Room 2 2012-08-03 14:45:00 7 3 Room 3 2012-08-03 14:45:00 8 4 Room 4 2012-08-03 14:45:00 4 I wanted to get the average user count of each room (1,2,3,4) from the time 2PM to 3PM. The problem is that sometimes the room may not "check in" at the 15 minute interval time, so the assumption has to be made that the previous last known user count is still valid. For example the check-in's for 2012-08-03 14:15:00 room 4 never checked in, so it must be assumed that room 4 had 3 users at 2012-08-03 14:15:00 because that is what it had at 2012-08-03 14:00:00 This follows on through so that the average user count I am looking for is as follows: Room 1: (2 + 3 + 6 + 3) / 4 = 3.5 Room 2: (3 + 4 + 4 + 7) / 4 = 4.5 Room 3: (1 + 1 + 1 + 8) / 4 = 2.75 Room 4: (3 + 3 + 3 + 4) / 4 = 3.25 where # is the assumed number based on the previous known check-in. I am wondering if it's possible to so this with SQL alone? if not I am curious of a ingenious PHP solution that isn't just bruteforce math, as such as my quick inaccurate pseudo code: foreach ($rooms_id_array as $room_id) { $SQL = "SELECT * FROM `table` WHERE (`UID` == $room_id && `Datetime` >= 2012-08-03 14:00:00 && `Datetime` <= 2012-08-03 15:00:00)"; $result = query($SQL); if ( count($result) < 4 ) { // go through each date and find what is missing, and then go to previous date and use that instead } else { foreach ($result) $sum += $result; $avg = $sum / 4; } }

    Read the article

  • exit /B 0 does not work...

    - by murxx
    Hi, I have the following problem: I have created a batch script which calls itself in there (for being able to write a log in parallel). In the script I start another process (like start startServer.bat) which starts up a java process and keeps opened up all the time. In my original script I wait 30 seconds, check if the process is running and do an: exit /B 0 Unfortunately that does not work, the window shows that the exit /B 0 is being evaluated, but the window still keeps open. When I close the window with the other process (meaning the "child" processes started up in my .bat) my script continues its run. So: scriptA.bat - in there I call: start startServer.bat - wait 30 seconds - check is server is started - exit /B 0 Process hangs up! What's very odd, if I wrap another script around, like: scriptB.bat - call scriptA.bat ----- in there I call: start startServer.bat ----- wait 30 seconds ----- check is server is started ----- exit /B 0 - scriptA.bat continues without any hangup! I also tried the same with exit 0 (without /B) also, same result! In the first case it hangs up, in the second case my window closes as expected... Has anyone of you ever had such a problem before and knows what's wrong here? Process hangs up!

    Read the article

  • Speed comparison - Template specialization vs. Virtual Function vs. If-Statement

    - by Person
    Just to get it out of the way... Premature optimization is the root of all evil Make use of OOP etc. I understand. Just looking for some advice regarding the speed of certain operations that I can store in my grey matter for future reference. Say you have an Animation class. An animation can be looped (plays over and over) or not looped (plays once), it may have unique frame times or not, etc. Let's say there are 3 of these "either or" attributes. Note that any method of the Animation class will at most check for one of these (i.e. this isn't a case of a giant branch of if-elseif). Here are some options. 1) Give it boolean members for the attributes given above, and use an if statement to check against them when playing the animation to perform the appropriate action. Problem: Conditional checked every single time the animation is played. 2) Make a base animation class, and derive other animations classes such as LoopedAnimation and AnimationUniqueFrames, etc. Problem: Vtable check upon every call to play the animation given that you have something like a vector<Animation>. Also, making a separate class for all of the possible combinations seems code bloaty. 3) Use template specialization, and specialize those functions that depend on those attributes. Like template<bool looped, bool uniqueFrameTimes> class Animation. Problem: The problem with this is that you couldn't just have a vector<Animation> for something's animations. Could also be bloaty. I'm wondering what kind of speed each of these options offer? I'm particularly interested in the 1st and 2nd option because the 3rd doesn't allow one to iterate through a general container of Animations. In short, what is faster - a vtable fetch or a conditional?

    Read the article

  • ANDROID IF/ELSE FAILS CONTINUES TO EXECUTE JSON

    - by Keith Cesar Haizlett
    I am trying to create a Registration app with JSON to connect and post to MYSQL database. I created the following IF/ELSE statements to check for vacant input boxes, password match, and correct email characters before allowing it to be entered into the DATABASE. The code continues to execute the JSON posting even after the passwords don't match , invalid email characters are entered , and vacant text boxes are submitted. Why is it not returning and continuing to execute the JSON code? try { if (!inputEmail.getText().toString().matches("[a-zA-Z0-9._-]+@[a-z]+.[a-z]+") && email.length() > 0) { Toast.makeText(getApplicationContext(), "Enter Valid Email Address", Toast.LENGTH_LONG).show(); return; } else if(name.equals("") || email.equals("")|| password.equals("")||check.equals("")) { Toast.makeText(getApplicationContext(), "Field Vaccant", Toast.LENGTH_LONG).show(); return; } // check if both password matches else if(!password.equals(checkpass)) { Toast.makeText(getApplicationContext(), "Password does not match", Toast.LENGTH_LONG).show(); return; } if (json.getString(KEY_SUCCESS) != null) { registerErrorMsg.setText(""); String res = json.getString(KEY_SUCCESS); if(Integer.parseInt(res) == 1){ // user successfully registred // Store user details in SQLite Database DatabaseHandler db = new DatabaseHandler(getApplicationContext()); JSONObject json_user = json.getJSONObject("user"); // Clear all previous data in database userFunction.logoutUser(getApplicationContext()); db.addUser(json_user.getString(KEY_NAME), json_user.getString(KEY_EMAIL), json.getString(KEY_UID), json_user.getString(KEY_CREATED_AT)); // Launch Dashboard Screen Intent dashboard = new Intent(getApplicationContext(), DashboardActivity.class); // Close all views before launching Dashboard dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(dashboard); // Close Registration Screen finish(); }else{ // Error in registration registerErrorMsg.setText("User already Registered"); } } } catch (JSONException e) { } } });

    Read the article

  • checking all checkboxes are checked using jquery

    - by kumar
    Hello friends I have two button one is SelectAll then MassEdit.. my code for select all is $('#btnAll').click(function() { $('#ExceptionDetails input[type=checkbox]').attr('checked', 'checked'); }); this check all the chekcboxes in my view.. then I have other button code which needs to take only checked checkbox information to send it other page.. to display only checked checkbox users.. $('#btnMassEdit').click(function() { $('#ExceptionDetails input[type=checkbox]').each(function() { if ($(this).attr('checked')) { $('#specialist-tab').tabs('url', 3, '<%=Url.Action("getmasseditexceptions", "Expense", new { @GUI_SPEC_STAT_DSPL = GUI_SPEC_STAT_DSPL, @C_EXCPT_CATG = C_EXCPT_CATG, @C_EXCPT_TYPE = C_EXCPT_TYPE })%>').tabs('enable', 3).tabs('select', 3); return false; } else { alert("please select atleast one exceptin"); $().ShowDialog('Please Select Exception, Select atleast one exception'); return false; } }); }); i have a fieldset which is ExceptionDetails..one field set have only one checkbox.. but my view having multiple fieldsets for differnt exceptions.. I need to check all the filedsset which is checked or not what ever the fieldset checkboxes are check I need to take only that exception to pass to the other page.. thanks

    Read the article

  • How To perform a SQL Query to DataTable Operation That Can Be Cancelled

    - by David W
    I tried to make the title as specific as possible. Basically what I have running inside a backgroundworker thread now is some code that looks like: SqlConnection conn = new SqlConnection(connstring); SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(Results); conn.Close(); sda.Dispose(); Where query is a string representing a large, time consuming query, and conn is the connection object. My problem now is I need a stop button. I've come to realize killing the backgroundworker would be worthless because I still want to keep what results are left over after the query is canceled. Plus it wouldn't be able to check the canceled state until after the query. What I've come up with so far: I've been trying to conceptualize how to handle this efficiently without taking too big of a performance hit. My idea was to use a SqlDataReader to read the data from the query piece at a time so that I had a "loop" to check a flag I could set from the GUI via a button. The problem is as far as I know I can't use the Load() method of a datatable and still be able to cancel the sqlcommand. If I'm wrong please let me know because that would make cancelling slightly easier. In light of what I discovered I came to the realization I may only be able to cancel the sqlcommand mid-query if I did something like the below (pseudo-code): while(reader.Read()) { //check flag status //if it is set to 'kill' fire off the kill thread //otherwise populate the datatable with what was read } However, it would seem to me this would be highly ineffective and possibly costly. Is this the only way to kill a sqlcommand in progress that absolutely needs to be in a datatable? Any help would be appreciated!

    Read the article

  • Java: Comparing a class with another within that class using a my own .equals

    - by user1670252
    I am making a method .equals replacing the equals method used. It accepts a object. I want it to check if that object equals the class that runs the .equals class. I know I want to compare all the private methods I have to that object. Is there a way to do this without making another private class to get the private variables from the object? How do I do this to compare equality not identity? I am stuck on this. Do i have to use == to compare? Also looking online i see others use recursion. If this is the way i have to do it can you show and explain it to me? so an example i have public boolean equals(Object o) { this is in a class we will call bobtheBuilder (first thing to pop in my head) I want to check if the object o is equal to the class he has private object array and a private int. I assume I want to check if the array and int of this class equal the array and int of the object.

    Read the article

  • How to combine two separate unrelated Git repositories into one with single history timeline

    - by Antony
    I have two unrelated (not sharing any ancestor check in) Git repositories, one is a super repository which consists a number of smaller projects (Lets call it repository A). Another one is just a makeshift local Git repository for a smaller project (lets call it repository B). Graphically, it would look like this A0-B0-C0-D0-E0-F0-G0-HEAD (repo A) A0-B0-C0-D0-E0-F0-G0-HEAD (remote/master bare repo pulled & pushed from repo A) A1-B1-C1-D1-E1-HEAD (repo B) Ideally, I would really like to merge repo B into repo A with a single history timeline. So it would appear that I originally started project in repo A. Graphically, this would be the ideal end result A0-A1-B1-B0-D1-C0-D0-E0-F0-G0-E1-H(from repo B)-HEAD (new repo A) A0-A1-B1-B0-D1-C0-D0-E0-F0-G0-E1-H(from repo B)-HEAD (remote/master bare repo pulled & pushed from repo A) I have been doing some reading with submodules and subtree (Pro Git is a pretty good book by the way), but both of them seem to cater solution towards maintaining two separate branch with sub module being able to pull changes from upstream and subtree being slightly less headache. Both solution require additional and specialized git commands to handle check ins and sync between master and sub tree/module branch. Both solution also result in multiple time-lines (with --squash you even get 3 timelines with subtree). The closest solution from SO seems to talk about "graft", but is that really it? The goal is to have a single unified repository where I can pull/push check-ins, so that there are no more repo B, just repo A in the end.

    Read the article

  • Javascript help needed - which variable is return empty??

    - by mathew
    Hi I would like to know how do I add an error check to below mentioned code...I mean how do I check if this code return empty or not?? if this returns empty then I would give a message "Not Found".. How do I do That?? google.load('search', '1'); var blogSearch; function searchComplete() { // Check that we got results document.getElementById('content').innerHTML = ''; if (blogSearch.results && blogSearch.results.length > 0) { for (var i = 0; i < blogSearch.results.length; i++) { // Create HTML elements for search results var p = document.createElement('p'); var a = document.createElement('a'); a.href = blogSearch.results[i].postUrl; a.innerHTML = blogSearch.results[i].title; // Append search results to the HTML nodes p.appendChild(a); document.body.appendChild(p); } } } function onLoad() { // Create a BlogSearch instance. blogSearch = new google.search.BlogSearch(); // Set searchComplete as the callback function when a search is complete. The // blogSearch object will have results in it. blogSearch.setSearchCompleteCallback(this, searchComplete, null); // Set a site restriction blogSearch.setSiteRestriction('blogspot.com'); // Execute search query blogSearch.execute('1974 Chevrolet Caprice'); // Include the required Google branding google.search.Search.getBranding('branding'); } // Set a callback to call your code when the page loads google.setOnLoadCallback(onLoad);

    Read the article

  • Database source control with Oracle

    - by borjab
    I have been looking during hours for a way to check in a database into source control. My first idea was a program for calculating database diffs and ask all the developers to imlement their changes as new diff scripts. Now, I find that if I can dump a database into a file I cound check it in and use it as just antother type of file. The main conditions are: Works for Oracle 9R2 Human readable so we can use diff to see the diferences. (.dmp files doesn't seem readable) All tables in a batch. We have more than 200 tables. It stores BOTH STRUCTURE AND DATA It supports CLOB and RAW Types. It stores Procedures, Packages and its bodies, functions, tables, views, indexes, contraints, Secuences and synonims. It can be turned into an executable script to rebuild the database into a clean machine. Not limitated to really small databases (Supports least 200.000 rows) It is not easy. I have downloaded a lot of demos that does fail in one way or another. EDIT: I wouldn't mind alternatives aproaches provided that they allows us to check a working system against our release DATABASE STRUCTURE AND OBJECTS + DATA in a bath mode. By the way. Our project has been developed for years. Some aproaches can be easily implemented when you make a fresh start but seem hard at this point. EDIT: To understand better the problem let's say that some users can sometimes do changes to the config data in the production eviroment. Or developers might create a new field or alter a view without notice in the realease branch. I need to be aware of this changes or it will be complicated to merge the changes into production.

    Read the article

  • Stopping a MATLAB GUI callback

    - by leonhart88
    Dear All, I have a START and STOP button. When I hit START, i run a bunch of code in my callback. It's basically a sequential "script" that opens valves, dispenses water and then closes the valves...there is no while() loop and it doesn't repeat. I want to be able to stop this process at any time using the STOP button. Most of the related answers I've seen are in the cases where a while() loop is used. Some people have also suggested to periodically check if the STOP button was pressed (using a variable or handle variable). Since I do not have a while loop, I can't solve it that way. Also, I'd like to be able to exit immediately, without having to periodically check (because checking multiple times in my code would be ugly and confusing). Is there a way to terminate the callback which was interrupted by the STOP button? If not, is it possible to have the START button run a .m file and then have the STOP button terminate that .m file? The worst case scenario would be to check a variable periodically. UPDATE: Well, looks like the worst case scenario is what is suggested by MATLAB... http://www.mathworks.com/support/solutions/en/data/1-33IK85/index.html?product=ML&solution=1-33IK85 Thanks.

    Read the article

  • How to query an .NET assembly's required framework (not CLR) version?

    - by Bonfire Burns
    Hi, we are using some kind of plug-in architecture in one of our products (based on .NET). We have to consider our customers or even 3rd party devs writing plug-ins for the product. The plug-ins will be .NET assemblies that are loaded by our product at run-time. We have no control about the quality or capabilities of the external plug-ins (apart from checking whether they implement the correct interfaces). So we need to implement some kind of safety check while loading the plug-ins to make sure that our product (and the hosting environment) can actually host the plug-in or deliver a meaningful error message ("The plug-in your are loading needs .NET version 42.42 - the hosting system is only on version 33.33."). Ideally the plug-ins would do this check internally, but our experience regarding their competence is so-so and in any case our product will get the blame, so we want to make sure that this "just works". Requiring the plug-in developers to provide the info in the metadata or to explicitly provide the information in the interface is considered "too complicated". I know about the Assembly.ImageRuntimeVersion property. But to my knowledge this tells me only the needed CLR version, not the framework version. And I don't want to check all of the assembly's dependencies and match them against a table of "framework version vs. available assemblies". Do you have any ideas how to solve this in a simple and maintainable fashion? Thanks & regards, Bon

    Read the article

  • how to delete multiple folders,desktop and start menu shortcut using vbscript

    - by user1756858
    I never did any vbscript before, so i don't know if my question is very easy one. Following is the flow of steps that has to be done : Check if exist and delete a folder at c:\test1 if found and continue. If not found continue. Check if exist and delete a folder at c:\programfiles\test2 if found and continue. If not found continue. Check if a desktop shortcut and start menu shortcut exist and delete if found. If not exit. I could delete 2 folders with the following code: strPath1 = "C:\test1" strPath1 = "C:\test1" DeleteFolder strPath1 DeleteFolder strPath1 Function DeleteFolder(strFolderPath1) Dim objFSO, objFolder Set objFSO = CreateObject ("Scripting.FileSystemObject") If objFSO.FolderExists(strFolderPath) Then objFSO.DeleteFolder strFolderPath, True End If Set objFSO = Nothing But i need to run one script to delete 2 folders in different paths, 2 shortcuts one in start menu and one on desktop. I was experimenting with this code to delete the shortcut on my desktop: Dim WSHShell, DesktopPath Set WSHShell = WScript.CreateObject("WScript.Shell") DesktopPath = WSHShell.SpecialFolders("Desktop") on error resume next Icon = DesktopPath & "\sample.txt" Set fs = CreateObject("Scripting.FileSystemObject") Set A = fs.GetFile(Icon) A.Delete WScript.Quit It works fine for txt file on desktop, but how do i delete a shortcut for an application from desktop as well as start menu.

    Read the article

  • How to store sorted records in csv file ?

    - by Harikrishna
    I sort the records of the datatable datewise with the column TradingDate which is type of datetime. TableWithOnlyFixedColumns.DefaultView.Sort = "TradingDate asc"; Now I want to display these sorted records into csv file but it does not display records sorted by date. TableWithOnlyFixedColumns.DefaultView.Sort = "TradingDate asc";TableWithOnlyFixedColumns.Columns["TradingDate"].ColumnName + "] asc"; DataTable newTable = TableWithOnlyFixedColumns.Clone(); newTable.DefaultView.Sort = TableWithOnlyFixedColumns.DefaultView.Sort; foreach (DataRow oldRow in TableWithOnlyFixedColumns.Rows) { newTable.ImportRow(oldRow); } // we'll use these to check for rows with nulls var columns = newTable.DefaultView.Table.Columns.Cast<DataColumn>(); using (var writer = new StreamWriter(@"C:\Documents and Settings\Administrator\Desktop\New Text Document (3).csv")) { for (int i = 0; i < newTable.DefaultView.Table.Rows.Count; i++) { DataRow row = newTable.DefaultView.Table.Rows[i]; // check for any null cells if (columns.Any(column => row.IsNull(column))) continue; string[] textCells = row.ItemArray .Select(cell => cell.ToString()) // may need to pick a text qualifier here .ToArray(); // check for non-null but EMPTY cells if (textCells.Any(text => string.IsNullOrEmpty(text))) continue; writer.WriteLine(string.Join(",", textCells)); } } So how to store sorted records in csv file ?

    Read the article

  • Functions and arrays

    - by Ordo
    Hello! My little program below shall take 5 numbers from the user, store them into an array of integers and use a function to print them out. Sincerly it doesn't work and nothing is printed out. I can't find a mistake, so i would be glad about any advice. Thanks. #include <stdio.h> void printarray(int intarray[], int n) { int i; for(i = 0; i < n; i ++) { printf("%d", intarray[i]); } } int main () { const int n = 5; int temp = 0; int i; int intarray [n]; char check; printf("Please type in your numbers!\n"); for(i = 0; i < n; i ++) { printf(""); scanf("%d", &temp); intarray[i] = temp; } printf("Do you want to print them out? (yes/no): "); scanf("%c", &check); if (check == 'y') printarray(intarray, n); getchar(); getchar(); getchar(); getchar(); return 0; }

    Read the article

  • Dojo: Setting a CheckBox label programmatically

    - by Mitchell Flaherty
    Let me preface by saying that I saw this other question on the subject of CheckBox labels that was asked and answered well over a year ago. I was confused by the answers and am hoping that someone can clarify or that there has been new dojo functionality introduced since then that allows me to do this without resorting to HTML. So without further ado, I would like to know how to programmatically create labels for check boxes. I have a check box like so: this.pubBoxId = new dijit.form.CheckBox({ label: "IdChannel", checked: false, channel: that.idChannel }, that.name + "_PBI"); As you can see I've tried to edit the "label" field, but the label never actually shows up on the page. I have multiple CheckBoxes that I am adding to a ContentPane and simply want a label to the left or right of the check box. Is there any way I can do this without having to write separate HTML? Also, making a separate ContentPane for each individual label would be a big pain because of how many CheckBoxes I plan to have. Thank you for reading, and let me know if further clarification is needed!

    Read the article

  • I need to make a multithreading program (python)

    - by Andreawu98
    import multiprocessing import time from itertools import product out_file = open("test.txt", 'w') P = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p','q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',] N = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] M = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] c = int(input("Insert the number of digits you want: ")) n = int(input("If you need number press 1: ")) m = int(input("If you need upper letters press 1: ")) i = [] if n == 1: P = P + N if m == 1: P = P + M then = time.time() def worker(): for i in product(P, repeat=c): #check every possibilities k = '' for z in range(0, c): # k = k + str(i[z]) # print each possibility in a txt without parentesis or comma out_file.write( k + '\n') # out_file.close() now = time.time() diff = str(now - then) # To see how long does it take print(diff) worker() time.sleep(10) # just to check console The code check every single possibility and print it out in a test.txt file. It works but I really can't understand how can I speed it up. I saw it use 1 core out of my quad core CPU so I thought Multi-threading might work even though I don't know how. Please help me. Sorry for my English, I am from Italy.

    Read the article

  • Collision Detection (Ground & Slopes) in 2D Platform Game using Pygame Rects

    - by RedCap
    Hi, First off, I am not after any instructions on logic for collision detection; I get it. What I am trying to work out is the least complicated way to do this with Pygame using Sprites & Rects. I want to be able to check collisions for the Player against ground, walls & slopes. In theory it is quite straight forward, but I'm having difficulty because it seems like you cannot do this with one Rect. One Rect is simple enough to get you collisions in the X plane against walls. The same Rect could be used also be used in the Y plane against solids, but not with slopes - since with the collision routines in Pygame it checks the whole Rect (or mask), rather than perhaps just the bottom middle of the Rect. It seems in addition you need to have a number of "sprites" to check collisions with, that are 1x1 pixel in various places around the Player. What's the easiest way to do this, without having a bunch of 3, 4, or more separate "collision pixels" to check against slopes? Geoff

    Read the article

  • Using functions and arrays

    - by Ordo
    Hello! My little program below shall take 5 numbers from the user, store them into an array of integers and use a function to print them out. Sincerly it doesn't work and my output is always "00000". I can't find a mistake, so i would be glad about any advice. Thanks. #include <stdio.h> void printarray(int intarray[], int n) { int i; for(i = 0; i < n; i ++) { printf("%d", intarray[i]); } } int main () { const int n = 5; int temp = 0; int i; int intarray [n]; char check; printf("Please type in your numbers!\n"); for(i = 0; i < n; i ++) { printf(""); scanf("&d", &temp); intarray[i] = temp; getchar(); getchar(); } printf("Do you want to print them out? (yes/no): "); scanf("%c", &check); if (check == 'y') printarray(intarray, n); getchar(); getchar(); return 0; }

    Read the article

< Previous Page | 149 150 151 152 153 154 155 156 157 158 159 160  | Next Page >