simple

Can someone explain to me why my output is this? And how would I correct my output?

In this slice of code I get an output of bbb 55 66 77 88 aaa the output I expect and want is bbb 55 66 77 88 bbb because I reassign ss from log[0] to log[1]. So my question is why is the output different from what I expect and how do I change it to what I want? int w,x,y,z; stringstream ss (stringstream::in | stringst...

How do I check if a C++ string is an int?

When I use getline, I would input a bunch of strings or numbers, but I only want the while loop to output the "word" if it is not a number. So is there any way to check if "word" is a number or not? I know I could use atoi() for C-strings but how about for strings of the string class? int main () { stringstream ss (stringstream::in | ...

How can I know whether my C++ string variable is a number or not

I have a string of class string string str; how can I check if it is a number or not, str can only have 3 possible types described below like abcd or a number like 123.4 or a number with a parenthesis attach to the end it for example 456) note the parenthesis at the end of "str" is the only possible combination of number and ...

Is there a better way to check if a value is bigger than of type double?

double x; cin>>x; if( x > 1.7976931348623157e+308 || x < -1.7976931348623157e+308 ) { cout<<"value not in range"<<endl; exit(1); } Is there like a DOUBLE_MAX or DOUBLE_MIN and would I need to include any header files? ...

Am I thinking too complicated? How can I simplify this piece of code?

Well sometimes, I believe am thinking toooooo complicated or just got tired of thinking too much or something else that you could point. I am trying to copy the pager found in YouTube for a Windows Forms application of mine. And here is what I have done so far: Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As S...

Java slick command line app?

Hello Guys, I want to make a slick java commandline app which doesnt include all the nasty "java -jar some.jar arguments" instead, I would have it work just like program -option argument like any other commandline app. I use ubuntu linux, and it would be fine if it included a bit of .sh script or anything. I know I can just create a...

How do I return a value from a javascript function

Say I have a function function myFunction(myValue) { // do something } How would I return a value from this, say a string type after the method is executed? ...

VB.net Simple IRC Client

How would I go about making a simple IRC client with these things What I am using: Nickname TextBox Connect Button Message TextBox Send Message Button Refresh Button ListBox Restrictions: No commands at all just being able to send messages I am using a listbox for recieving messages ...

Best way to simplify this code, more efficient

My question is, is there a way to make this code more efficient or write it in a simple way? javascript by the way. switch (tempvar1) { case 1: currentSlide = 'slide1'; showaslide('ppslide1'); break; case 2: currentSlide = 'slide2'; showaslide('ppslide2'); break; case 3: currentSlide = 'slide3'; sho...

simple ways to create rdf/xml using php?

what's the best/simplest/easiest way to create rdf/xml with php? ideally i would like to use simpleXML - but i believe it doesn't support namespaces? failing that maybe simpleDOM? id rather not use DOM since it tends to confuse me a lot! perhaps there is some other way? thanks for your help! :) nb: i tried to post an example but co...

Android question. Is there a link to a simple example of changing the screen brightness for an activity?

There are apparently at least three different techniques for changing screen brightness in the Android OS. Two of them no longer work post-cupcake and the third accepted technique evidently has a bug. I would like to increase screen brightness at the start of a one-view activity then turn the brightness back to the user setting at the e...

Why is this c++ string concatenation missing a space?

I am working with c++ strings, and am a beginner at programming. I am expecting: 99 Red Balloons But I am receiving: 99 RedBalloons Why is that? #include <string> #include <iostream> using namespace std; int main() { string text = "9"; string term( "9 "); string info = "Toys"; string color; char hue[4] = {'R','e...

Help with PHP and associative arrays

Hello. I have to do a simple calculator in php based on user's input and choice from select field, something like this: <?php $a = $_GET['a']; $b = $_GET['b']; $array = array( "option1" => 0.1, "option2" => 0.15, "option3" => 0.3, "option4" => 3, "option5" ...

Simple program logic to Call method continuously

Hi everybody, I am in a situation, in which my program needs to do processing and then wait for some interval, let's say 5 seconds and the do the same processing again. I don't know how to implement the logic. I have developed a logic, the code is below: private void ProcessEmail() { PprocessEmail:; //Do whatever ...

Simple VM That allows booting from folder or disk

I was wondering if there was a very simple and free virtual machine that would allow you to boot from a folder or disk image that couldn't damage my hard disk. I am using a MacBook and am looking into operating system programming. I found a tutorial on the internet that looked promising (http://www.viralpatel.net/taj/tutorial/hello_world...

Are there any open source FLV players with minimal player controls?

Can anyone please suggest an open source FLV player which has a minimal set of player controls? I have a client requirement to overlay FLV videos with DIV contents. When the div overlays the FLV then most of the FLV players end up having their player controls obscured by the div content. I basically need an FLV player which has a play...

Jabber-net client configuration for multple domains

What parameters should i pass if i use multiple domains on same jabber server. my current jaberclient configuration is: jabberClient1.Server = "localhost"; jabberClient1.Port = 5222; my domain name is "deni" where should i pass this parameter ? ...

How to clean up my code

Being new to this I really am trying to learn how to keep code as simple as possible, whilst doing the job it's supposed to. The question I have done is from Project Euler, it says Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: ...

Simple HTTP Framework and time issue

I'm using Simple Framework for my recent project, and there is a problem with the date headers generated by the system. I can get my local time from Date class correctly, but setDate method of Simple's Response class sets date in milliseconds and when i do that by calling System.currentTimeInMillis, dates in response headers are incorrec...

Trying to manually recreate a simple generate/scaffolding script

I'm trying to understand Rails from the ground up. I want to learn how to manually create basic show-all/show-single/CRUD functionality in the framework. I currently am working on the display-all functionality, but am stopped by an error when I try to request all items in the Products db Here are the steps I've taken so far: script/g...