Daily Archives

Articles indexed Thursday May 6 2010

Page 16/118 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • system() copy fails, while cmd copy works

    - by Mike
    In cmd.exe, I can execute the command "copy c:\hello.txt c:\hello2.txt" and it worked fine. But in my C program, I ran this piece of code and got the following error: #include <iostream> using namespace std; int main() { system("copy c:\hello.txt c:\hello2.txt"); system("pause"); return 0; } Output: The system cannot find the file specified. Anybody know what is going on here?

    Read the article

  • Array in Bash Not Found

    - by Waffle
    I am trying to declare an array in bash, but when the code is run it says it cannot find the array. I have tried to write out the declaration of the array in several different ways, but it seems no matter how I try to declare it I cannot get it to work. I originally tried to declare it as such: candidate[1]= 0 candidate[2]= 0 candidate[3]= 0 The error messages that are returned are: votecalculation.sh: 13: candidate[1]=: not found votecalculation.sh: 14: candidate[2]=: not found votecalculation.sh: 15: candidate[3]=: not found After this I tried another solution I found online: ARRAY=( 'can1' 'can2' 'can3' ) When that is used it returns this error: votecalculation.sh: 12: Syntax error: "(" unexpected I am new to Bash and am getting really confused about arrays. Is there some specific way I need to declare an array or am I just going about it completely wrong?

    Read the article

  • Jquery Countup Timer

    - by knightrider
    Hello, I was trying to achieve count up timer with this jquery plugin. As I am newbie on this, I really don't understand their documentation. What I want to display is. I want to display counter which counts from 1st January 2005 till current date. Example of output display is 5 years 5months 5hours 5seconds (seconds will be keep counting) Please kindly help me by posting snippets to achieve. Thanks for your time and greatly appreciated.

    Read the article

  • Url routing suggestion in asp.net mvc.....

    - by Pandiya Chendur
    I have an action link in one of my view page <%=Html.ActionLink("Details", "Details", new { id = Model.Id })%> and redirects me to page which has a url like this http://localhost:1985/Materials/Details/2 instead of this i would like to have my url as http://localhost:1985/Materials/Details/steel material name instead of Id... Is this possible...... This is my controller action method, public ActionResult Details(int id) { var material = consRepository.GetMaterial(id); return View("Details", material); }

    Read the article

  • Shakin' things up

    - by j-t-s
    Hi All I have a little app here, and I would love to be able to do my own stuff in Vista/Win7 when I shake the form. Currently, when a form is shaken, it will restore/minimize everything else. But I want to change that behavior in my app only. So when my form is shaken, I could, for example, shuffle the playlist, or Clear the contents of a Canvas etc... Is this possible? Thank you

    Read the article

  • Java string too long?

    - by wrongusername
    I have the following code in Java (which worked just fine in C++ for some reason) which produces an error: int a; System.out.println("String length: " + input.length()); for(a = 0; ((a + 1) * 97) < input.length(); a++) { System.out.print("Substring at " + a + ": "); System.out.println(input.substring(a * 97, 97)); //other code here... } Output: String length: 340 Substring at 0: HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHe Substring at 1: Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: -97 //long list of "at ..." stuff Substring at 2: Using a string of length 200, however, the following output is produced: String length: 200 Substring at 0: HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHe Substring at 1: That is it; no exceptions raised, just... nothing. What is happening here?

    Read the article

  • Is there any kind of standard for 8086 multiprocessing?

    - by Earlz
    Back when I made an 8086 emulator I noticed that there was the LOCK prefix intended for synchonization in a multiprocessor environment. Yet the only multitasking I know of for the x86 arch. involves use of the APIC which didn't come around until either the Pentiums or 486s. Was there any kind of standard for 8086 multitasking or was it done by some manufacturer specific extensions to the instruction set and/or special ports? By standard, I mean things like: How do you separate the 2 processors if they both use the same memory? This is impossible without some kind of way to make each processor execute a different piece of code. (or cause an interrupt on only one processor)

    Read the article

  • Python TypeError: an integer is required

    - by kartiku
    import scipy,array def try_read_file(): def line_reader(lines): for l in lines: i = l.find('#') if i != -1: l = l[:i] l = l.strip() if l: yield l def column_counter(): inputer = (line.split() for line in line_reader(file('/home/kartik/Downloads/yahoo_dataset/set1.train.txt'.strip()))) loopexit = 0 for line in inputer: feature_tokens = (token.split(':') for token in line[6:]) feature_ids = array.array('I') for t in feature_tokens: feature_ids.append(int (t[0])) tmpLength = feature_ids[-1] print feature_ids loopexit = loopexit + 1 if loopexit > 0: break return tmpLength def line_counter(): inputer = (line.split() for line in line_reader(file('/home/kartik/Downloads/yahoo_dataset/set1.train.txt'.strip()))) noOfRows = 0 for line in inputer: noOfRows = noOfRows + 1 return noOfRows inputer = (line.split() for line in line_reader(file('/home/kartik/Downloads/yahoo_dataset/set1.train.txt'.strip()))) feature_id_list = [] feature_value_list = [] relevance_list = [] noOfRows = line_counter() noOfCols = column_counter() print noOfRows print noOfCols # line 52 #Create the feature array feature_array = scipy.zeros((noOfRows,noOfCols), float) rowCounter = 1; for line in inputer: feature_tokens = (token.split(':') for token in line[6:]) feature_ids = array.array('I') feature_values = array.array('f') for t in feature_tokens: feature_ids.append(int(t[0])) if (t[0]!=colCounter): feature_array[rowCounter,colCounter] = 0 else: feature_array[rowCounter,colCounter] = t[1] feature_values.append(float(t[1])) colCounter = colCounter + 1; label = float(line[0]) assert(line[1].startswith('qid:')) query_id = int(line[1][4:]) feature_id_list.append(feature_ids) feature_value_list.append(feature_values) relevance_list.append(label) rowCounter = rowCounter + 1; return feature_array Error: Traceback (most recent call last): File "<pyshell#97>", line 1, in <module> try_read_file() File "/home/kartik/Python/prelim_read.py", line 52, in try_read_file print noOfCols TypeError: an integer is required What is the problem, i couldn't figure it out? I tried to debug it, but it doesnt really go inside those methods. It gives me an address in place of those variables.

    Read the article

  • Thresholding in Matlab

    - by 3babala
    How do I threshold an image to find the local maxes in a robust way? I know I can just look at the data, visually guess at some appropriate h value, and do imextendedmax(I,h) where h is the threshold... but I'm looking for a more robust way to do it in Matlab. I'm pretty new to Matlab and coding so this is all foreign...

    Read the article

  • Windows Phone 7 development: Using isolated storage

    - by DigiMortal
    In my previous posting about Windows Phone 7 development I showed how to use WebBrowser control in Windows Phone 7. In this posting I make some other improvements to my blog reader application and I will show you how to use isolated storage to store information to phone. Why isolated storage? Isolated storage is place where your application can save its data and settings. The image on right (that I stole from MSDN library) shows you how application data store is organized. You have no other options to keep your files besides isolated storage because Windows Phone 7 does not allow you to save data directly to other file system locations. From MSDN: “Isolated storage enables managed applications to create and maintain local storage. The mobile architecture is similar to the Silverlight-based applications on Windows. All I/O operations are restricted to isolated storage and do not have direct access to the underlying operating system file system. Ultimately, this helps to provide security and prevents unauthorized access and data corruption.” Saving files from web to isolated storage I updated my RSS-reader so it reads RSS from web only if there in no local file with RSS. User can update RSS-file by clicking a button. Also file is created when application starts and there is no RSS-file. Why I am doing this? I want my application to be able to work also offline. As my code needs some more refactoring I provide it with some next postings about Windows Phone 7. If you want it sooner then please leave me a comment here. Here is the code for my RSS-downloader that downloads RSS-feed and saves it to isolated storage file calles rss.xml. public class RssDownloader {     private string _url;     private string _fileName;       public delegate void DownloadCompleteDelegate();     public event DownloadCompleteDelegate DownloadComplete;       public RssDownloader(string url, string fileName)     {         _url = url;         _fileName = fileName;     }       public void Download()     {         var request = (HttpWebRequest)WebRequest.Create(_url);         var result = (IAsyncResult)request.BeginGetResponse(ResponseCallback, request);            }       private void ResponseCallback(IAsyncResult result)     {         var request = (HttpWebRequest)result.AsyncState;         var response = request.EndGetResponse(result);           using(var stream = response.GetResponseStream())         using(var reader = new StreamReader(stream))         using(var appStorage = IsolatedStorageFile.GetUserStoreForApplication())         using(var file = appStorage.OpenFile("rss.xml", FileMode.OpenOrCreate))         using(var writer = new StreamWriter(file))         {             writer.Write(reader.ReadToEnd());         }           if (DownloadComplete != null)             DownloadComplete();     } } Of course I modified RSS-source for my application to use rss.xml file from isolated storage. As isolated storage files also base on streams we can use them everywhere where streams are expected. Reading isolated storage files As isolated storage files are opened as streams you can read them like usual files in your usual applications. The next code fragment shows you how to open file from isolated storage and how to read it using XmlReader. Previously I used response stream in same place. using(var appStorage = IsolatedStorageFile.GetUserStoreForApplication()) using(var file = appStorage.OpenFile("rss.xml", FileMode.Open)) {     var reader = XmlReader.Create(file);                      // more code } As you can see there is nothing complex. If you have worked with System.IO namespace objects then you will find isolated storage classes and methods to be very similar to these. Also mention that application storage and isolated storage files must be disposed after you are not using them anymore.

    Read the article

  • Multiple OS on a single machine

    - by Veejay
    I have a new harddrive. I want to install XP, Vista and Windows 7 on it Is it possible and what should be the order. I have heard there is some MBR rewriting issue? Any 'simple' article/tutorials are welcome

    Read the article

  • Android & SQLite: "Table audios has no column named downloaded"

    - by Erik
    I get this weird exception when i run my app on both the emulator and a USB connected device. i can see the table inside the shell, but when I try to insert a record from the Activity acton I get this exception: android.database.sqlite.SQLiteException: table audios has no column named downloaded I am mostly running on an emulator with Android 1.5. The predominant part of my code is linked to this tutorial - http://www.devx.com/wireless/Article/40842/1954. This is the create statement I use: private static final String DATABASE_CREATE = "create table audios ( _id integer primary key autoincrement, " + "user_name text not null, title text not null, file_path text not null, download integer not null, " + "created_at integer not null, downloaded_at integer not null );"; This is the insert code I use: //--- insert a title into the database --- public long insertTitle(String user_name, String title, String file_path, Integer downloaded, long created_at, String downloaded_at ) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_USER_NAME, user_name); initialValues.put(KEY_TITLE, title); initialValues.put(KEY_FILE, file_path); initialValues.put(KEY_DOWNLOADED, downloaded); initialValues.put(KEY_CREATED_AT, created_at); initialValues.put(KEY_DOWNLOADED_AT, downloaded_at); return db.insert(DATABASE_TABLE, null, initialValues); }

    Read the article

  • How do I append Word templates to a new document in VB.NET?

    - by Tom
    I'm poking around to see if this app can be done. Basically the end user needs to create a bunch of export documents that are populated from a database. There will be numerous document templates (.dot) and the end result will be the user choosing templates x y and z to include for documentation, click a button and have the app create a new Word document, append the templates, and then populate the templates with the appropriate data. The reason it needs to be done in Word as opposed to something like Crystal Reports is that the user may customize some fields before printing the documents as it can vary from export to export. Is this possible to do through VB.NET (VS 2010)? I assume it is but I'm having difficulty tracking down a solution. Or alternatively is there a better solution? Here's what I have so far (not much I know) Import Microsoft.Office.Interop Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oWord As Word.Application Dim oDoc As Word.Document oWord = CreateObject("Word.Application") oWord.Visible = False oDoc = oWord.Documents.Add 'Open templates x.dot, y.dot, z.dot 'Append above templates to new document created 'Populate new document oWord.Visible = True End Sub End Class Thanks.

    Read the article

  • Is there a perfect algorithm for chess?

    - by Overflown
    Dear Stack Overflow community, I was recently in a discussion with a non-coder person on the possibilities of chess computers. I'm not well versed in theory, but think I know enough. I argued that there could not exist a deterministic Turing machine that always won or stalemated at chess. I think that, even if you search the entire space of all combinations of player1/2 moves, the single move that the computer decides upon at each step is based on a heuristic. Being based on a heuristic, it does not necessarily beat ALL of the moves that the opponent could do. My friend thought, to the contrary, that a computer would always win or tie if it never made a "mistake" move (however do you define that?). However, being a programmer who has taken CS, I know that even your good choices - given a wise opponent - can force you to make "mistake" moves in the end. Even if you know everything, your next move is greedy in matching a heuristic. Most chess computers try to match a possible end game to the game in progress, which is essentially a dynamic programming traceback. Again, the endgame in question is avoidable though. -- thanks, Allan Edit: Hmm... looks like I ruffled some feathers here. That's good. Thinking about it again, it seems like there is no theoretical problem with solving a finite game like chess. I would argue that chess is a bit more complicated than checkers in that a win is not necessarily by numerical exhaustion of pieces, but by a mate. My original assertion is probably wrong, but then again I think I've pointed out something that is not yet satisfactorily proven (formally). I guess my thought experiment was that whenever a branch in the tree is taken, then the algorithm (or memorized paths) must find a path to a mate (without getting mated) for any possible branch on the opponent moves. After the discussion, I will buy that given more memory than we can possibly dream of, all these paths could be found.

    Read the article

  • wmd editor, why does it keep showing html instead of just going straight to markup

    - by Ke
    hi, im wondering how wmd is supposed to work, when i type in the textarea the text doesnt have html, but once the text is stored in db it turns to html. wmd also shows all this html when reloading the content? is it supposed to work like this? Do I have to sanitize the text before its put into the db? if so how? I thought wmd doesnt deal with html? except in code blocks. Also there are p tags being added Using the beneath html it gets added directly. I guess this could cause xss attacks? - (1) <a onmouseover="alert(1)" href="#">read this!</a> - (2) <p <script>alert(1)</script>hello - (3) </td <script>alert(1)</script>hello I wonder how is wmd supposed to work? I thought it was supposed to enter everything in its own mark up, store its on mark up and retrieve it etc. instead of storing plain html Chees Ke

    Read the article

  • Google map "zoomend" event issue

    - by ebae
    On my html page, I have a google map with a few markers. I want all the markers to be cleared once the zoom is changed on the map with the following code. GEvent.addListener(map, "zoomend", function() { map.clearOverlays(); } But what happens is actually the markers are removed by the "clearOverlays()" function, but then they appear again. Any idea why? Where is it going after the event is handled?

    Read the article

  • Silly Objective-C inheritance problem when using property

    - by Ben Packard
    I've been scratching my head with this for a couple of hours - I haven't used inheritance much. Here I have set up a simple Test B class that inherits from Test A, where an ivar is declared. But I get the compilation error that the variable is undeclared. This only happens when I add the property and synthesize declarations - works fine without them. TestA Header: #import <Cocoa/Cocoa.h> @interface TestA : NSObject { NSString *testString; } @end TestA Implementation is empty: #import "TestA.h" @implementation TestA @end TestB Header: #import <Cocoa/Cocoa.h> #import "TestA.h" @interface TestB : TestA { } @property NSString *testProp; @end TestB Implementation (Error - 'testString' is undeclared) #import "TestB.h" @implementation TestB @synthesize testProp; - (void)testing{ NSLog(@"test ivar is %@", testString); } @end

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >