Daily Archives

Articles indexed Sunday May 16 2010

Page 1/75 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How do I convert decimal numbers to binary in Perl?

    - by David
    I am trying to make a program that converts decimal numbers or text into binary numbers in perl. The program asks for user input of a character or string , and then prints out the result to the console. How do I do this? My code I have been working on is below, but i cannot seem to fix it. print "Enter a number to convert: "; chomp($decimal = <STDIN>); print "\nConverting $number to binary...\n"; $remainder = $decimal%2; while($decimal > 0) { $decimal/2; print $remainder; }

    Read the article

  • What's the best way to create a Windows Mobile application with multiple screens in C#

    - by Joseph Earl
    I am creating a Windows Mobile Application in C# and Visual Studio 2008. The application will have 5-6 main 'screens'. There will also be bar (/area) with information (e.g. a title, whether the app is busy, etc) above the screens, and a toolbar (or similar control) below the screens with 5-6 buttons (with images) to change the active screen (i.e. the screens will share the top bar and toolbar) What is the best way to implement this? Use multiple forms, and just include the toolbar and top-bar in each Use a single form and something like the Tab control (but customised) to contain the screens Something else? Keeping in mind a) memory usage and b) time to switch screens. Thanks in advance. Any links, pointers etc are much appreciated.

    Read the article

  • sqlite, C#, UPDATE OR REPLACE

    - by acidzombie24
    I do something like UPDATE OR REPLACE someTable SET a=1, b=2 WHERE c=3 I expect if it doesnt exist it will be inserted into the DBs. But nothing happens and i get no errors. How can i insert data, replace it if it already exist and use a where for the condition (instead of replacing BC of a unique ID)

    Read the article

  • Adding an attribute to a class by using properties editor

    - by Fred Yang
    Visual studio allows you to design component visually. For example, you are designing a windows form. You change its property in the properties editor. The IDE will generate the code in a partial class in xx.designer.cs file. We can customize this behavior by changing the UITypeEditor for the properties. The question now is , Can we extend this code generation behavior? for example, we change a setting in property window, and then the IDE will add an .net Attribute to the class? Thanks

    Read the article

  • NSFileManager works fine on simulator but not on device

    - by Jenicek
    Hi, I have problem creating directories and files with NSFileManager on the iPhone device. My code, shown below, works fine on the simulator, but not on the device, could you please help me? Gimme some directions where the problem may be, thanks for every reply.. I'm first creating directories this way: NSFileManager *fileMgr = [NSFileManager defaultManager]; NSArray *arPaths = NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, NSUserDomainMask, YES); NSString *appPath = [[NSString alloc] init]; appPath = [arPaths objectAtIndex:0]; strDownloadsDir = [[NSString alloc] init]; strDownloadsDir = [[appPath stringByAppendingPathComponent:@"/Other"] copy]; if(![fileMgr fileExistsAtPath:strDownloadsDir]) [fileMgr createDirectoryAtPath:strDownloadsDir attributes:nil]; and then I'm trying to create new file in this directory this way: NSString *filePath = [strDownloadsDir stringByAppendingPathComponent:strDlFileName]; //Test whether this file exists, if not, create it NSLog(@"%@", filePath); if(![fileMgr fileExistsAtPath:filePath]) { if([fileMgr createFileAtPath:filePath contents:nil attributes:nil]) NSLog(@"Creating new file at path %@", filePath); else NSLog(@"Failed to create new file."); } It seems that there's something wrong with whole NSFileManager, because when I'm using fileExistAtPath with a path given by this NSArray *arPaths = NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, NSUserDomainMask, YES); NSString *appPath = [[NSString alloc] init]; appPath = [arPaths objectAtIndex:0]; it is not working too, I tried to change directory to NSDocumentsDirectory but it did not help

    Read the article

  • Empty "Groups" in People Picker Navigation Controller

    - by Meltemi
    I'm using the standard People Picker Navigation Controller to let users associate one of their contacts with one of my objects. It presents itself as a long list of ALL contacts. The back button (top left) says "Groups" but when clicked on it shows an empty screen...even when there are many Groups in the user's address book. I've read through the docs and can't seem to find how to populate the Groups area. Here's how I present the people picker. Fairly standard: - (IBAction)showPicker:(id)sender { ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; picker.peoplePickerDelegate = self; [self presentModalViewController:picker animated:YES]; [picker release]; } What am I missing?

    Read the article

  • How to save, retrieve and draw an image using Java and PostgreSQL?

    - by spderosso
    Given an object X; I want this object to have an image. The image must be stored in the database. I can't store the path, the actual image must be in the database. My question can be answered by answering the following subquestions: a). What type of field should I put in the database? (e.g VARCHAR) b) What type of object should I use for storing and manipulating the image (at an object layer)? (e.g java.awt.Image) c) How do I create an object of the type selected (answer of question b) from the data obtained from the database? d) How do I save an object of the type selected (answer of question b) to the database? e) How do I draw the image on a web page? I am using PostgreSQL, Java and it is a web application. Thanks!

    Read the article

  • C# DataView boolean cell

    - by Nilbert
    How would I add a cell to a DataView that was toggleable between True and False like the dataview in the Microsoft Visual C# properties window? I can only find a way to add a text box type cell to it, but I need to add a toggleable one, and also a dropdown list type. Thanks for any help.

    Read the article

  • Streaming live video from WCF service to Silverlight

    - by Yuval Peled
    Hi, I need to stream live captured data (from a screen/web cam) from a WCF service to a Silverlight client. Since it's live data I don't mind losing packets... More important that it will be real-time data. Any suggestions how can I do it? How does the WCF service transfer it? How does the Silverlight client should consume the stream?

    Read the article

  • How can I convert Perl one-liners into complete scripts?

    - by Stefan Lasiewski
    I find a lot of Perl one-liners online. Sometimes I want to convert these one-liners into a script, because otherwise I'll forget the syntax of the one-liner. For example, I'm using the following command (from nagios.com): tail -f /var/log/nagios/nagios.log | perl -pe 's/(\d+)/localtime($1)/e' I'd to replace it with something like this: tail -f /var/log/nagios/nagios.log | ~/bin/nagiostime.pl However, I can't figure out the best way to quickly throw this stuff into a script. Does anyone have a quick way to throw these one-liners into a Bash or Perl script?

    Read the article

  • CSS layout mystery

    - by selfthinker
    Among the many two (or three) column layout techniques I sometimes use the following one: <div class="variant1"> <div class="left1"> <div class="left2"> left main content </div> </div> <div class="right1"> <div class="right2"> right sidebar </div> </div> </div> together with: .variant1 .left1 { float: left; margin-right: -200px; width: 100%; } .variant1 .left1 .left2 { margin-right: 200px; } .variant1 .right1 { float: right; width: 200px; } This works in all major browsers. But for some very strange reason exactly the same technique but reversed doesn't work: <div class="variant2"> <div class="left1"> <div class="left2"> left main content </div> </div> <div class="right1"> <div class="right2"> right sidebar </div> </div> </div> with .variant2 .left1 { float: left; width: 200px; } .variant2 .right1 { float: right; margin-left: -200px; width: 100%; } .variant2 .right1 .right2 { margin-left: 200px; } In the second variant all text in the sidebar cannot be selected and all links cannot be clicked. This is at least true for Firefox and Chrome. In IE7 the links can at least be clicked and Opera seems completely fine. Does anyone know the reason for this strange behaviour? Is it a browser bug? Please note: I am not looking for a working two column CSS layout technique, I know there are loads of them. And I don't necessarily need this technique to work. I only like to understand the reason why the second variant behaves like it does. Here is a link to a small test page which should illustrate the problem: http://selfthinker.org/stuff/css_layout_mystery.html

    Read the article

  • Access Google Chrome Bookmarks with Keyboard Shortcuts

    - by nrhine1
    I've searched around, there don't seem to be any built in shortcuts. Is there a way to customize shortcuts with an extension or an extension that is built specifically for accessing bookmarks? EDIT: I want to be able to press a configuration of buttons on my keyboard, not my mouse, to select bookmarks. Is this possible?

    Read the article

  • Missing partition on a single HDD

    - by r0ca
    Hi all, I reinstalled Windows XP over a windows 7 Ultimate. I have a SATA HDD (320go) and now that I installed Windows XP pro, I only see a C:\ drive with 130go. So basically, my 2 other partitions are gone... where?!?! In my computer I only see the C:\ drive. In Computer Management, I only see Disk0 as my C:\ drive. 130go still. Is there an apps that can recover my 2 "lost" partitions or I would need to perform something else? Thanks! David.

    Read the article

  • Good embedded database solution (like SQLite) for .Net

    - by vfilby
    I am looking for file based storage solutions that I can use with a .Net project. THey need to have a sql-like interface for storing and retrieving data. They need to have relatively little overhead and must not require any additional components installed by the end user. I am hopping for a .dll that I can reference and use. Cool points awarded if it is closely tied to an ORM. My current favourite is SQLite, are there any better ones out there that I should know about? I have a (health?) bias against access because I feel it is overcomplicated for what I need, I am open to being convinced otherwise though. PS: "No, there is nothing better than SQLite" is a perfectly good answer.

    Read the article

  • Which is better: SDL or SFML?

    - by William
    I'm thinking about switching from SDL to SFML, but before I do I want to know which is better. I'm mainly looking for easy sound/music, sprite rotations that are easy on the framerate/cpu, portability, and ease of installation.

    Read the article

  • Fluid iPhone Animation ala Plants vs Zombies

    - by RyJ
    If you've played Plants vs Zombies, you've seen how fluid and remarkable the character animation is. Can anyone assume how they are doing this? They don't seem to simply be animating bitmaps; the animation is too crisp, even as characters rotate and scale. The artwork looks vector, but I can't imagine that everything is drawn out using Core Graphics. Any ideas?

    Read the article

  • DataView boolean cell

    - by Nilbert
    How would I add a cell to a DataView that was toggleable between True and False like the dataview in the Microsoft Visual C# properties window? I can only find a way to add a text box type cell to it, but I need to add a toggleable one, and also a dropdown list type. Thanks for any help.

    Read the article

  • Suitable GUI for sorting rows at database level and/or WYSIWYG level?

    - by Kristoffer
    Consider an Explorer-like list view with a number of columns. The data is fetched from a database, and the rows can be sorted by clicking the column headers. When you click column A, you expect the fetched data to be sorted by A - at the database level ("ORDER BY" at the selected column). However, sometimes it is desirable to sort the data presented in the GUI - the visible data (WYSIWYG). How do you combine these two? E.g. How do you allow the user to sort both the fetched data and the data visible in the GUI? Have you seen a GUI that solves this elegantly?

    Read the article

  • Save gcc compile status to a text file for Java

    - by JohnBore
    I'm making a C Assessment Program through Java, which has a bunch of programming questions for C, and it lets the user input an answer in the form of C code, and then press a "Compile" button, which is linked to a bat file that runs the user input code through gcc. I've got the input and compiling working, but I need to get the output from the compiler and get that to print textarea within the program. I can get a simple "Hello, world" compiling, but I'm having trouble getting programs that require a user input with scanf, for example, to be printed. else if(e.getSource().equals(compile)){ if(questionNumber<1){ JOptionPane.showMessageDialog(programFrame, "Please start the assessment", "Compile Error", JOptionPane.ERROR_MESSAGE); } else{ FileOutputStream fileWrite; try { fileWrite = new FileOutputStream("demo/demo.c"); new PrintStream(fileWrite).println(input.getText());//saves what the user has entered in to a C source file fileWrite.close(); @SuppressWarnings("unused") Process process = Runtime.getRuntime().exec("cmd /c compile.bat");//runs the batch file to compile the source file compileCode(); try{ fileStream = new FileInputStream("demo/output.txt"); inputStream = new DataInputStream(fileStream); bufferRead = new BufferedReader(new InputStreamReader(inputStream)); while((stringLine = bufferRead.readLine())!=null){ compiled.append(stringLine); compiled.append("\n"); } inputStream.close(); } catch(IOException exc){ System.err.println("Unable to read file"); System.exit(-1); } } catch (IOException exc) { JOptionPane.showMessageDialog(programFrame, "Demo file not found", "File Error", JOptionPane.ERROR_MESSAGE); } } This is the actionPerformed method for the "Compile" button, the compileCode() is the JFrame that displays the output and "compiled" is the textArea for the output. My batch file is: C: cd dev-cpp\bin gcc.exe H:\workspace\QuestionProgram\demo\demo.c -o demo > H:\workspace\QuestionProgram\demo\compilestatus.txt demo > H:\workspace\QuestionProgram\demo\output.txt I'm not sure how I can do it, so the frame is created for the output of the code if the code requires a user input as the command prompt doesn't open without adding "START" to .exec(), but then the frame appears before the program has finished running. Also, how would I get the output of the compiler if the compile fails because of an error? The way I've got it in my batch file at the moment doesn't put anything in a text file if it fails.

    Read the article

  • jQuery Cycle pageAnchorBuilder / jQuery Selectors

    - by Wes
    I'm trying to grab the source of an image with jquery. My HTML looks like this: <div class="featuredSlideImage"> <img src="http://apture.s3.amazonaws.com/0000012865c9e9d984b36217007f000000000001.latte%20heart.jpg"/> </div> <!--featuredSlideImage--> My jQuery Selector is: return '<li>' + jQuery(slide).children(".featuredSlideImage").html(); + '</li>'; which reutrns this: <img src="http://apture.s3.amazonaws.com/0000012865c9e9d984b36217007f000000000001.latte%20heart.jpg"/> I was to just return the source of that, sans the HTML. How can I go about this?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >