-

2011年8月4日星期四

How to calculate average rainfall for 6 months in java?

-that is what i done so far but i am lost now





import javax.swing.*;

class practice

{



public static void main(String[] args)

{



// declare array

//fill array with data for a week

int averagerainfall[]= new int[6];

String months[] = {"jan","feb","mar","apr","may","jun","ju鈥?br>


int s=0;

int x=0;



for (int i=0; i <averagerainfall.length; i++)



{

// input data and convert it to an Integer

s = Integer.parseInt(JOptionPane.showInputDi鈥?enter the average rainfall per month" +(i+1)));

averagerainfall[i] =s;

}



Displaydata (averagerainfall,months);

}// main



public static void Displaydata(int averagerainfall[],String months[] )

{

// declare variable

int max=0;

String x="";



for (int i=0; i<6; i++)



{

if (averagerainfall[i] >max)



{



max=averagerainfall[i];

x=months[i];



}



System.out.print(" The amount of rainfall is " + averagerainfall[i]+ ", on ");

System.out.println(months[i]

double x = "";

System.out.println("Average rainfall: " + (x/3) ;



} // end of method DisplayData





System.out.println( "The average rainfall is, " + max + " and that is on " + x );



// Display Results

} // end of main



} // end of class



and this is what the program should be like...



This program must contain at least two methods (main and one or more other method(s)). Write a method that inputs the length of rainfall in centimetres for each of the six months January to July into an array.



This array should be passed to another method averageRainfall which calculates the average rainfall for the six months. This method should return the average rainfall to the calling method where it is output to the screen..



help please need it ASAP.. thank you

How can I make webpages fit my browser?

-I didn't change anything (no screen resolution or zooming in) and now facebook and some other webpages (not all) seem to be too wide for my screen. I have to scroll the bar sideways!



Where does the problem come from and how can I solve it?



Again, I didn't zoom in and I didn't change the screen resolution. I'm using Firefox 5.0 on Windows Vista. Screen res. 1366x768 (it has always been like that, didn't touch anything).



Thanks! :)just do CTRL plus + (hold ctrl as you hold +)
hit CTRL and 0 at the same time.

Or go to View->Zoom->Reset

Is OX Lion worth getting?

-Yeah are these new features worth getting?In my opinion MAC in its whole is somewhat inadequate. But of course the ease of use does come into account here. In your case (considering you like extreme user-friendliness, actually having asked the question) OX Lion provides multiple more restricted features then the more cheaper models. If you want what they offer, get it, else do not.

It is but a simple question of if you need/want what is being offered.

How to learn to hack?

-i wanna learn it all how to program make apps whats the best wayyour going to need to learn programing and coding first their are schools for it so take them and you will be able to hack
First learn a low level programming language such as ASM or C, then you'll be half way through.

Game Programming question.?

-I am looking to go to College for Programming (for video games). I am looking for someone who can provide me with a link and some information to find a program and a language I can learn in order to start practicing the programming language.



If it helps I am trying to get a job with Sony, or Microsoft. So if you can provide the common programming programs / languages for both of them it would be great.



Please do not just give me a language like C++, I need to know which programs to use in order to actually learn C++ if that makes sense.



Please provide links if you can to websites you know.



I am also looking for tutorial websites if you know any that can help me work on learning the programming language. Thanks!Visual C++ Express is the free edition of the Visual C++ IDE from Microsoft.

You can download it from Microsoft.com:

http://microsoft.com/visualstudio/en-us/鈥?/a>



To learn the language just Google "learn c++ game programming".

Here are some places to start:

http://cppgameprogramming.com/

http://toymaker.info/Games/html/beginner鈥?/a>

http://gameprogrammingstarttofinish.wazo鈥?/a>

How do i alter this image? (printmaster)?

-I have printmaster platinum installed on a macbook, and i would like to alter this image...(move the position of the arm). I thought i could freeform crop around it and cut it and paste it in a different spot, but turns out that i can only do rectangular cropping, not freeform. is their any other way i could do this? or do i just have to purchase a new program? PLEASE HELPIt might be possible to do with printmaster (I don't own it, so I don't know its particular capabilities), but it most likely is really only designed to do basic editing like cropping and applying color effects. You'd probably be better off using Photoshop or the GIMP (which is free):



http://www.gimp.org/
Search it in Google or in spanish at www.aulafacil.com and go to Informatica-

Computer Help...please? 2 questions :)?

-Skip to bottom for the main questions*

My laptop broke and my sister had her older one still (a few years old) she gave it to me. Her being her forgot the password, it was a few years ago so you cant really blame her. Me and my mom tried to guess a whooooole lot of things but we couldnt get in. She also got rid of the admin user account so that wasnt an option. Then we tried ophcrack, we had no clue what we were doing and failed completely..... My mom ended up uninstalling windows which, as far as I know, cleaned it out along with restarting the enttiiire computer? Since I live with my dad (divorced) and my mom doesnt have internet she kinda just gave it to me and told me to do what ever updates it needs/tells me to do and ill be set.... I KNOW ALMOST NOTHING ABOUT ACTUAL COMPUTERS THEMSELFS (only the stuff a normal teenagers knowledge expands to games, etc.) I dont know what this computer needs. Sooo if you know what I would need....Oh and the other problem im having is I have a router and it works/ed fine with my old laptop, sisters new laptop, ipodtouch, all that wirelessly (automatically)but when I press connect to a network it doesnt give me the option to connect to my wireless thing. The only way I can get internet with this laptop is if I have it connected to the router with one of those cords that look like the ones phones use and plug into the wall.



Question #1 - If windows was uninstalled and reinstalled what do I need to update/install?



Question #2 How do I setup wireless conection to an older version that I guess does not come with whats needed to do it and be able to not use a cord connected directly to the router?1 --



Software you might need to update are Microsoft Office and your web browsers. Usually when you reinstall your OS or use a ghost disk, you need to update those because those might not have been on the disk you use to reformat your computer. Your computer will update most other necessary files upon reboot.



2 --



Your computer needs to have installed a wireless internet card. You can find these at phone or computer stores. Also, there might be some drivers for your version of Windows that you would also need to download in order to access the internet wirelessly.A better place for questions like this might be in a forum where you can have some back and forth with people on the subject, yahoo answers is useless for technical questions, especially if we require clarification.



Be sure to say what operating system you're using if you want help.

DVD Cover Slip Template?

-i use Word2010 but i also have photoshop i just need a cover slip template

Where can I learn to program?

-I live in Rhode Island. I am not old enough to attend college yet, and I want to know if there is anywhere I can go to take programming courses. It is extremely hard to teach yourself and I have tried before and failed. I do not want to wait to go to college to learn to program and advanced computer sciences. If there is any course anyone knows of that I can take during this year please help me out.There plenty of online classes, but finding a good instructor to start with is likely to make becoming a good programmer easier.



For beginners most classes teach Visual basic, C++, or Java. Java is alot like c++, Visual Basic is a bit easier for most beginners.



If your high school doesn't offer it, look for college classes, or sometime they offer summer classes for middle or high schoolers.



If possible, the RI community college would be a great place. check out this course.



http://goo.gl/f7yki



They even allow high school students...

http://ccri.edu/oes/admissions/admn_info鈥?/a>
Try These programs, they are for making your own video game, you can start of basic and try getting more advanced as you go along, I have learned a lot about scripting and programing after using this ;)



------ http://www.rpgmakerweb.com/product/rpg-maker-xp

Look at both RPG maker VX and XP, and try finding things that are like this that involve making games with scripting. There are many guides and websites that you can use to learn more about RPG maker, I mean I have seen people make their own pokemon games and Harvest moon games from Scratch!





------ http://www.renpy.org/ This is another program where you make games but you start from scratch with only scripting!! It takes a bit to learn but you soon get the hang of it ;)



Don't Give up! Ask your Tech Teachers and try and attend clubs that involve technology. And Keep good Grades!
No need to wait.
Buy an O'Reilly programming book, but make sure it is updated, atleast 2009+
Buy a good programming book.

How you create a c program without semicolon?

-include<stdio.h>

void main()

{

if(printf("hai"))

{}

}Hi,



That is a rather odd question you have there. Get's you thinking.



There are a few ways to assign special characters in the Shell commands, for example:

聽聽聽gcc -Wall -W -pedantic -DSPECIAL=; main.c -o main



聽聽聽cl -DSPECIAL=; main.c



However, while these are legitimate, they use a semicolon LoL ~ so thinking you won't be allowed to do that.



However, while its in my opinion bad coding there are in fact three simple ways to write a C program without using a semicolon. Examples, below:



void main() {

聽聽if(printf("Hello world")) {

聽聽}

}





void main() {

聽聽while(!printf("Hello world")) {

聽聽}

}







void main() {

聽聽switch(printf("Hello world")) {

聽聽}

}





Actually you could even do this:



#include <iostream>



int main() {

聽聽if (std::cout << "Hello world!" << std::endl) {

聽聽}

}



You can get away with that 4th choice because Compilers default to a return 0 when no return in main(), plus I did not use namespace std because then you would need a semicolon.



The other three ways above work also, but all I can saw is gross LoL. I wouldn't use any of these four methods but for the challenge of answering your question.



Thanks for the challenge though.



Regards,



Javalad
This is impossible, because the ';' tells the compiler that the statement is complete.

A ; must be placed after each primary expression, prototype or definition.

A possible way to do this is to set a macro (not sure it will work tho)

Add something like

#define STATEMENT_END ;

in the beginning, and use that instead, it WILL look ugly tho:

priintf("hello!")STATEMENT_END

How would i type the conditional 'or' in Java?

-i need help writing out the 'or' function in java.

For example AND is && and or is the 2 parralel ll. But how would i be able to write it in my program on the computer.



thanksHuh?



You seem to already know the answer: ||



if ( this_is_true || that_is_true )

{ do_something(); }
||

What will happen when i assign a value the #define function in C++?

-The #define directive identifies identifier as a MACRO

=

#define identifier replacement-list

- whenever identifier is encountered as a token, it is replaced by replacement-list#define is a preprocessor directive that's used to help programmers save time and make clearer code by not having to write the same code over and over.

For example, if you have the following:

#define MAX 100

that means all occurrences of "MAX" (case sensitive) will be replaced with 100.

That line is equal to:

const MAX = 100;



To learn more, see:

http://cplusplus.com/doc/tutorial/prepro鈥?/a>

http://wikipedia.org/wiki/C_preprocessor
If you used for example "#define SIZE 10", that means that wherever you write "SIZE" in the program this will be seen by the compiler as the value 10.

HTML: How to add image to the heading of the table?

-I add it and it come up small and if I define its width and height than the whole table (<td>) mess up in size too.First, tables are not for placement of images. Yeah, I know all the WYSIWYG HTML creators use tables because the program cannot be written to do it properly. Now, the size of the image, I would bet 10 to 1 that you are using a small image and that is the reason the image is small. Guess what you need to do.

.

.

.

..

Use a larger image.I am not exactly sure if I understand you correctly. But one option would be to add the background attribute to the cell.

<td background='images/bg1.jpg> BLA BLA </td>



or you can do so with css via:

#divID td {

background: url(image/th_stripe.gif);

}

Does that answer your question?

How can I make this C++ code read from a .dat file?

-This program total ups how much money someone makes before taxes.

I just need it to read the values from a file and save them in a file

This assignment is due tonight and i'm not sure how to do it, any help would be great



I know I need to use <fstream> but I don't really know how.

How does the program know which part of the file is the hours worked and which part is the paid rate?



Here is my code:

#include <iostream>

#include <iomanip>



using std::cout;

using std::cin;

using std::endl;

using std::fixed;

using std::setprecision;



int main()



{



double hours = 40.0;

double rate = 10.0;

double gross = 0.0;

double overtime = 1.5;





cout << "Enter the ammount of hours worked: ";

cin >> hours;

cout << "Enter the ammount paid per hour: ";

cin >> rate;



if (hours<0 || rate<0)



cout << "ERROR pick a different number" << endl;



else



if(hours > 40){ //calculate gross pay

overtime = (hours-40) * rate * 1.5;

gross = 40 * rate + overtime;



}



else

{

gross = rate * hours;

}



cout << "Overtime: " << overtime << endl;

cout << "Gross pay: " << gross << endl;



system ("pause");



return 0;



}the correct program for the above description is-



#include <iostream.h>

#include <iomanip.h>

#include <fstream.h>

#include <conio.h>

#include <stdlib.h>



int main()



{

ifstream inf("c:\\input.dat");

ofstream outf("c:\\out.dat");

if(!inf)

{

cout<<"File inf.dat couldnt be opened";

_getch();

exit(1);



}



if(!outf)

{

cout<<"File out.dat couldnt be opened";

_getch();

exit(1);



}



double hours ;

double rate ;

double gross ;

double overtime=0;



cout<<"\n\nReading values of hours and rate from input.dat....\n";

inf>> hours;

inf >> rate;



cout<<"\nValues are :\nhours : "<<hours<<"\trate : "<<rate;

if(hours > 40)

{ //calculate gross pay

overtime = (hours-40) * rate * 1.5;

gross = 40 * rate + overtime;

}



else

{

gross = rate * hours;

}

cout<<"\n\nvalues calculated : \n";

cout<<"overtime : "<<overtime<<"\tgross : "<<gross;



cout<<"\nwriting values of overtime and gross in out.dat....\n";

outf<<overtime<<endl<<gross;



return 0;



}







in order to run this program, first make a file "input.dat" in the c drive.

put values in this file like that-

30

10



or like-

50

5



first value indicates the number of hours and the second value indicates rate.

u need not create out.dat. it will be created automatically.

now run the program and see ur desired output.Daryl...you have posted this same question with the same code 3 times in the last 2 hours.



First time, Blackcompe gave you an answer that should have at least gotten you started. It should have solved at least half of the problem, and gotten you to think about the other half.



But you haven't updated your code to reflect his answer, or anything else you might have learned in the last couple hours. Are you working on this problem, or just posting questions and hoping someone else is bored this Friday night?



Take a stab at doing it yourself, post YOUR code if you get stuck, maybe someone will help. Most of us don't want to do homework on Friday nights ;-)

How to sanitize some php code?

-I'm having trouble sanitizing this code so that shell commands such as ; ls create an injection issue in a site I am working on.



<form action="process.php" method="post">

<select name="tool">

<option>SuperInSec</option>

<option>CrazilyInSec </option>



<option>TotalInSec</option>

<option> </option>

</select>

<input name="filename" type="text" />

<mysql_real_escape_string()>

<input type="submit" />

</form>

Do I have too many MySQL queries?

-I am creating a website where people can post and upload different things and each user has their own profile picture so things can get a little difficult. If a user posts something, the table stores their name but not the picture so I have to use a query within the loop that I use to get all the posts so this means that if there are 10 user posts than one page loads 11 queries (including the one to get the posts) plus any others that are already on the page for other purposes. I was just a little worried about this and I was also wondering what are the consequences of having too many queries. I would assume sites like Facebook a lot of queries on a single page but I can't be sure. Thanks for all your help!Do you know how to do joins? It sounds like you don't.



This should be a single query. You want to do a join on "the table" with the table that contains the users picture. Hopefully you have a primary key for each user? userid or something?



So, without knowing your table structure, this is just a wild guess, but you want something like this:



SELECT posts.text,users.photo

FROM posts

JOIN users ON posts.userid = users.userid

WHERE posts.id = $some_post_id;There is no such thing as too many mySQL queries!

A forum, for example, will have about 6 query types, with over 9000 of them running at the same time. Don't even get me started with facebook, consider every single feed, a query, so no, 11 isn't that much. The consequences of having too much (example, ur searching for a 10mb string 10000 times every second) would be a mass of network bill increase and general lag.

What are some good books for game development?

-I am completely new to all of this so please recommend a book for beginners.

I got a kobo today? I am wondering what are some good website for free ebooks?

-I believe kobo has some of the best free ebooks, but websites like

http://www.gutenberg.org/

and

http://www.manybooks.net/

offer book too that you may enjoy.

Have a nice day!

How can I make ,my page smaller?

-On my computer, on the bottom of the right hand side there used to be an adjust level. ranging from 100 to 400, for the size of the page. Well it's gone now and it's stuck on big, so how can I bring the page back to size 150? I'm trying to get on Netflix and the page is like too big, to type in a selection. please help someone, I keep asking My daughter, and she just can't hop skip and jump in to my room to help me.If you want to make your page smaller or bigger you could press CTRL and either the - or + key depending if you want to zoom out or in.How to Change the Browser Text Size (All Browsers - Win/Mac): http://www.uchsc.edu/atp/howToChangeText鈥?/a>

How to Change Text Size or Colors: http://www.w3.org/WAI/changedesign

How to Change Font Size in Internet Explorer 9: http://microsoftfeed.com/2011/how-to-cha鈥?/a>

How to Change Font Size in Internet Explorer 9 or Older IE: http://www.computertipsfree.com/how-to-c鈥?/a>



Ron
On your menu bar at the top of your browser, click View and go down to Zoom. Select 100%.

C Programming help (please see description)?

-Uuhhh,, im having a problem. my goal is to generate a number that is non-repeating or doesnt repeat...Ive used srand(time(null)) and rand(); SOMETIMES it generates like this 1 2 4 2 .(4 choices only) As you can see, it generates the number 2 twice. How can I avoid that?Make an array with the numbers that you want to use and scramble that array.



use rand() to pick two positions in the array and swap those two values.

Repeat 10 times more than the number of elements in your array.

It will be well shuffled that way and have no repeats.



something like this (untested)



int j,k,t,n;

int arr[12];

for(j=0;j<12;j++)

arr[j]=j;

for (k=0;k<120;k++){

j=rand()%12;

n=rand()%12;

t=arr[j];

arr[j]=arr[n]

arr[n]=t;

}
may be.........

u can store the number in a array and when the new number is generated compare with the array list.

if no match found store it in array and if found then discard the number



Hope this helps!!!

WHAT ARE THE ADVANTAGES OF MANUAL DATA PROCESSING.?

-Eliminates computer error (which is to say it eliminates human programming error).Advantages over ... WHAT ... , in particular?



When you compare something, you need at least two things before you can make a comparison. Advantages and disadvantages of A when contrasted with something else (B?)

How can i make a website for free?

-You can use Blogger, Wordpress, etc. Blogger and Wordpress are the two main ones (I think). I have personally only used Blogger.



With Blogger if you have a gmail account you can start right away:

http://www.blogger.com/



Blogger allows you to edit the html, which means you can customise the look of a default layout to one that suits you.



Wordpress:

http://wordpress.com/



There is also a fairly new one that I discovered through a Youtube. Its called wix

http://www.wix.com/



If you don't like coding then Wix is the best bet for you, as you just drag and drop. This kind of limits creativeness, but it is ultimately easier to customise when compared to a Wordpress or Blogger website.Creating a website (REAL website, not like wordpress) will involve multiple steps:



1. getting a domain name: what the user types in to go to the website, example: http://yahoo.com

free ones are available at http://co.cc



2. getting a host: this is what will store the website files. Without this nothing exists. an example of a free host is byethost: http://byethost.com



3. linking the domain name to the host using DNS. the way to do this is to add a "parked domain" to the host (input domain name) and putting the host's DNS servers as settings for the domain name



4. learning web programming: learn HTML, JavaScript, CSS and PHP, (also get some information on APACHE .htaccess) this in my opinion is the minimal pack. this can be done at http://w3schools.com



5. creating the website using the knowledge gained in step 4.



6. publishing it all through the ftp server provided by the host.



All the links in sources are there to help you
Go on to www.blogspot.com and create a free blog slash web. If you do not have a Gmail account you need to get one to create a blog on blogspot. You can also add games to your blog and videos of all sorts.
Go to webs.com and sign up and when you choose the package for the web site choose basic it is free and if you want to upgrade later on when you have the money you can always change the package type
buy the book, "Creating Webpages for Dummies".... You will create one, but may have to pay to get it on the internet.

For Final Draft Screenplay program, do you have to indent?

-Or is it already indented enough for you when you start?

Is there an iPad app like google sketchup?

-I need to make 3d designs on my iPad is there any app like google sketch up pleeeeeeeeeeeeezzzzzzz help meNOT YET. IM WAIT FOR ONE TOO. IF U FIND ONE I WOULD LIKE TO KNOW. THANKS

Java what kind database should i choice?

-Which databases may work with java programming language?which is the ideal for java?MySQL - Works best with Netbeans IDE/Eclipse IDE

DerbyDB - Works best with Netbeans IDE







I suggest using those two as they are open source and well supported.

More questions about coding?

-A very basic form of what I'm doing:

===

<html>

<head>

<script type="text/javascript">

<!--

function onlyAllowNumbers(evt){

var charCode = (evt.which) ? evt.which : event.keyCode

if(charCode === 13){ adoptIt(); }

if(charCode > 31 && (charCode < 48 || charCode > 57)){ return false; }else{ return true; }

}

function adoptIt(){

var min = 5; var max = 2700; var link = "http://www.dragonopia.com/levelup?id="

var dragonNum = parseInt(document.getElementById("dragon鈥?br>
if(!isNaN(dragonNum)){

if(dragonNum<min){ alert("Dragon 5 is the lowest!"); }

else if(dragonNum>max){ alert("Sorry, that Dragon has yet to be born!"); }

else{ window.location = link+dragonNum; }

}

}

//-->

</script>

</head>

<body>

<div id="dragonLinks">

Dragon: <input type="text" id="dragonNumber" value="5" size="5" onkeypress="return onlyAllowNumbers(event)">

<input type="button" value="Click this dragon!" OnClick='adoptIt()'>

</div>

</body>

</html>

===

I want to change two things on this. 1) I want to be able to put '100-150' or '5-200' (or whatever) and have it open all tabs between those numbers, inclusive. 2) I would like to change it so that when the button is pressed, that the page is opened in a new tab, not the same page.

===

This may be a bit confusing, so basically, what the coding up there is- is a script allowing one to input a number and take you to a page with that adoptable who's birth URL number it matches, because I'm lazy and I don't want to spend hours clicking 2700+ adoptables when I can just use a program to help me instead~

And if you only 'answer' this question to call it cheating, then you're just as bad as me, because we all know you're 1) just trying to troll and 2) trying to earn points.

How do you copy gif.s?

-I tried "save image as" but it doesn't work it becomes still. Or tell me how to make a gif.

Can somebody help me with my Java code please? I'm really close!?

-I am trying to write a program that reads in text files and plays them as music notes. I have a folder that contains the text files named 'music' and when I run my program I have a JFileChooser that asks me which text file I would like to play. I select the file from the music folder, but regardless of which one I choose it only plays the first file: Ascale.txt. I know I have it hard coded in the main method but when I change that file name to one of the other files, my program only plays the Ascale.txt over and over. Here is my code:



import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

import javax.swing.JFileChooser;



public class PlayThatTune {



public static double[] tone(double hz, double t) {

int sps = 44100;

int N = (int) (sps * t);

double[] a = new double[N+1];

for (int i = 0; i <= N; i++)

a[i] = Math.sin(2 * Math.PI * i * hz / sps);

return a;

}



public static double[] note(int p, double t) {

double hz = 440 * Math.pow(2, p / 12.0);

double[] a = tone(hz, t);

double[] hi = tone(2*hz, t);

double[] lo = tone(hz/2, t);

double[] h = sum(hi, lo, .5, .5);

return sum(a, h, .5, .5);

}



public static double[] sum(double[] a, double[] b, double awt, double bwt) {

//superpose a and b, weighted

double[]c = new double[a.length];

for(int i = 0; i < a.length; i++)

c[i] = a[i] * awt + b[i] * bwt;

return c;

}



public static void main(String[] args) throws FileNotFoundException {



//Create a file chooser

final JFileChooser fc = new JFileChooser(".");

fc.showOpenDialog(null);

getSelectedFile();



Scanner in = new Scanner(new File("music/Ascale.txt"));

// repeat as long as there are more tokens to read in

while (in.hasNext()) {

// read in the pitch, where 0 = concert A (above middle C)

int pitch = in.nextInt();

// read in duration in seconds

double duration = in.nextDouble();



// build sine wave with desired frequency

double hz = 440 * Math.pow(2, pitch / 12.0);

int N = (int) (StdAudioOut.SAMPLE_RATE * duration);

double[] a = new double[N+1];

for (int i = 0; i <= N; i++) {

a[i] = Math.sin(2 * Math.PI * i * hz / StdAudioOut.SAMPLE_RATE);

}



// play it using standard audio

StdAudioOut.play(a);

}

}



private static void getSelectedFile() {



}

}



I would appreciate any help!

How do I implement a while loop with a counter in assembly code?

-I'm working with assembly code on a Linux machine and I want to repeat a while loop a number of times. I think I get the logic behind using a while loop with a counter in assembly but it just isn't working right.



Here's my code:



.section .data



msg: .ascii "A"

len: .int 1



.section .text

.global _start

_start:



movl $0, %eax



loop_begin:

cmpb $10, %al

jge loop_end





mov len, %edx

mov $msg, %ecx

mov $4, %eax

mov $1, %ebx

int $0x80

incb %al



jmp loop_begin



loop_end:



mov $0, %ebx

mov $1, %eax

int $0x80



Even if I change the incb %al to incb %bl, I keep getting an infinite loop of printing "A". I have even toyed with the jge loop_end to do jl or jle but the results never make sense in a way that shows the counter incrementing properly, but I just can't figure out what I'm missing.

Please help!Hi,



The problem is that AL is the low-order byte of EAX. Hence, when you do "mov $4, %eax" you also screw up your loop counter. You should use a different register for the counter, such as ESI or EDI.



Cheers,

Bogdanits so Simple...... write a while loop in a c program and compile using gcc wit -s option which generates .s file which contains assembly code for that c program... and you enjoy the code:)

for more info see man page of gcc

Hello help me to do a source code u see below, using C++ language,?

-1. Union-the union of the sets A&B is the smallest set consisting of the members/elements of both set A & B.



AUB={x|x is in A or X is in B}



2. Intersection- the intersection of sets A & B is the smallest set consisting of the elements common in both set A & B.



A B={x|x is in A and x is B}



3. Complement the complement of set B with respect to A is denoted as:

A-B={x|x is in A and x is not in B }



Facts: AUB=BUA

A B=B A

A-B B-A

A-A=empty set



4. Symmetric-the symmetric difference of A and B is denoted as A+B



A+B={x|x is in A but not in B or x is in B but not in A}



A+B=(A-B)U(B-A)



For example:



A={1,5,7,9}



B={3,1,7,4,2}



1. Union

AUB={1,5,7,9,3,4,2}



2. Intersection

A B={1,7}



3. complement

A-B={5,9}

B-A{3,4,2}



4. symmetric

A+B={5,9,3,4,2}Homework is not to be done by others:)

it should be done by yourself:)

good luck!!

How do I perform a while loop in assembly code?

-I'm just learning assembly code and I am not understanding how loops work very well.

I made the following program to print a few letters in the alphabet and it just keeps printing everything in the ASCII table over and over again until I terminate it with ctrl+c, but I'm not sure why. when I switch the values 'a' and 'b' it doesn't loop at all:



.section .data



msg: .ascii "A"

len: .int 1

a: .int 1

b: .int 5



.section .text

.global _start

_start:



mov len, %edx

mov $msg, %ecx

mov $4, %eax

mov $1, %ebx

int $0x80



loop_begin:

mov a, %eax

mov b, %ebx

cmp %ebx, %eax

jge loop_end

movb (msg), %al

incb %al

movb %al, (msg)

mov $4, %eax

mov $1, %ebx

int $0x80

inc %eax

jmp loop_begin



loop_end:



mov $0, %ebx

mov $1, %eax

int $0x80Hi,



The bug can be resolved by moving the label after the loop initialization code, as such:



mov a, %eax

mov b, %ebx

loop_begin:

cmp %ebx, %eax

jge loop_end



There's another bug there as well. You are writing over your counter register when you try to set up the INT 80h call. This can be fixed the following way:



push %eax

mov $4, %eax

mov $1, %ebx

int $0x80

pop %eax



Cheers,

BogdanYou keep comparing 1 to 5, rather than comparing something that changes inside the loop.



Update: These two lines are the problem:

mov a, %eax

mov b, %ebx

Those overwrite the value you are incrementing.
Assembly for what computer? x86? Sparc? Vax? PDP-11?



In any case, in all cases they will be:



top_of_loop:

If_some_condition_skip

jump_to_end_of_loop

(body of loop)

jump_to_top_of_loop

end_of_loop:

What does this mean when i access certain websites?

-application has generated an exception that could not be handled



processID=0xd60 (3424)



What does this mean? It comes up when i click certain websites, these sites are safe

Can .DOCX file be read by MS Word?

-Yes, .docx is a newer file format used by words 2007 and upwards.It depends on what version of Word you have. .docx is the default format for Microsoft Word 2007 and above. If you want your file to be readable by all version of Word since 2003 save it as a .doc file instead of a .docx.
.docx IS word's default format, so yes word is meant to use that format.

How do I create a successful free website?

-I want to create a website about synthesizers and electronic music for free, any tipsWix.com is a Flash web design creation site funded by Benchmark Capital, Bessemer Venture Partners, and Mangrove Capital Partners.

http://en.wikipedia.org/wiki/Wix.com
Q: How do I create a successful free website?

A: A good looking page and features, + tonnes of publicity
Try wix.com

Can someone make me HTML for this, PLEASE!!?

-http://tinypic.com/r/27y63om/7



Thanks in advance,

Kathy xYour question is a tad bit confusing. I think this stems from your lack of design knowledge when it comes to computers. Try to research your question a little more. Nobody can just make create a HTML script and PRESTO it's on the internet. Sorry, but it doesn't work like that.

How do you get a link to work on here?

-none of my links workLinks don't work until you are a level 2.

~

Intended to prevent the spammers.

What does the symbol ;/ mean in a text?

-45 degree angle mouth face = discontentment. awkwardness. unsureness.45 degree angle mouth face = discontentment. awkwardness. unsureness.Logically, it would be a winking confused look. In reality, when you try to pull that face, it might look like you've been drugged up.
This is the programming section not the drugged up emoticon section. ;/ is the start of a comment line
It could mean "I don't know" or "unsure"
It's an emote for "not sure"

How do I make a C++ program input data from a file?

-I have a working payroll program but I need to add code to make it calculate the pay rate from a .dat file.

I tried to add <fstream> but I didn't know how to combine it with my code, where do I put it, and how does it know which part of the file to read?



Here is my code:

#include <iostream>

#include <iomanip>



using std::cout;

using std::cin;

using std::endl;

using std::fixed;

using std::setprecision;



int main()



{



double hours = 40.0;

double rate = 10.0;

double gross = 0.0;

double overtime = 1.5;





cout << "Enter the ammount of hours worked: ";

cin >> hours;

cout << "Enter the ammount paid per hour: ";

cin >> rate;



if (hours<0 || rate<0)



cout << "ERROR pick a different number" << endl;



else



if(hours > 40){ //calculate gross pay

overtime = (hours-40) * rate * 1.5;

gross = 40 * rate + overtime;



}



else

{

gross = rate * hours;

}



cout << "Overtime: " << overtime << endl;

cout << "Gross pay: " << gross << endl;



system ("pause");



return 0;



}i have posted its answer in one of ur previous questions.-

http://answers.yahoo.com/question/index;鈥?/a>First of all, add #include <fstream> in the beginnng

Second of all, so that the program knows what part of a file to read, you must get a line, then tokenizer it.

An example here:

ifstream file;

file.open("filename.dat"); // if you want to use STD::string, add .c_str() after the filename var

string line;

getline(file, line);



Now tokenize the string.

Tokenizing is a whole different world though. I've recently made a tokenizer class extention to the standard library (as in for my own use), but I'm still in final-testing phase. If you have large tokenization problems you can email me, and I'll see if I can help.
Same answer as before....

Why does abode flash player keep crashing?

-When i try to watch a movie or video...my shockwave player or flash player crashes. It was working fine a few days ago. I've uninstalled and reinstalled flash player, but I can't get it to work. What do I need to do?Your Flash Player is not functioning well. Follow this Adobe Flash Tutorial:



* Run RegInOut scan for active-x, file associations and other registry errors largely behind such crashes.

http://software.intel.com/swfinder/produ鈥?/a>



* Try to uninstall the current flash player version. Read this official guide to uninstall flash plug-in:

http://kb2.adobe.com/cps/141/tn_14157.ht鈥?/a>



* Use official uninstaller tool to remove all flash elements from your computer.



* After completing the above task download flash player 9 instead of the latest version. Sometimes there are intricate browser flash conflicts and changing the versions is often helpful.



* Update your sound drivers if possible since the videos may simply crash because of the corrupted or missing drivers.



1) Open Device Manager



2) Find the sound-card device



3) Remember the name of the device



4) Uninstall it.



5) After doing this restart your system.

Does anyone know how to turn separate gif or jps into ONE animated banner without Photoshop?

-I made a few banners... all the same size... and want to "merge" them into ONE banner so that they act like a standard animated banner where it shows one "frame"... then the next "frame" (or rotation, if you will) shows, etc. (I don't have Photoshop, and none of the online banner generators are any good.) Is there a way do easily do this? Thank you!Random Banner Rotator Script:



http://javascript.internet.com/miscellan鈥?/a>

http://www.brettb.com/js_banner_ad_rotat鈥?/a>

http://www.aspwebpro.com/aspscripts/cont鈥?/a>

http://javascript.internet.com/image-eff鈥?/a>

http://javascript.internet.com/miscellan鈥?/a>



Could use a JavaScript slideshow that shows one image at a time:



http://www.scriptsearch.com/cgi-bin/jump鈥?/a>

http://www.dynamicdrive.com/dynamicindex鈥?/a>

http://www.dynamicdrive.com/dynamicindex鈥?/a>

http://www.dynamicdrive.com/dynamicindex鈥?/a>

http://www.dynamicdrive.com/dynamicindex鈥?/a>





More...Well if you don't mind getting your hands dirty and using a command line interface, GIFSicle is quite powerful, and it's free.



Or you could upload the images to a site and let me do it! If you want to send me a PM to do it I won't mind.

How do I fix this bad image error?

-Every time I turn on my computer right before I log into windows I get four bad image errors, then it lets me log in. After I log in I get spammed with them atleast 30+. Every time I click to open a program I get the same error message.

"The application or DLL C:\WINDOWS\SYSTEM32\HNETWIZ32.DLL is not a valid Windows image. Please check this against your installation diskette."

I don't have a CD/DVD drive or floppy disk slot in my little laptop, so I don't know what to do.You're infected. Well, your computer is, anyway.

Removal instructions: http://forums.techguy.org/virus-other-ma鈥?/a>

How do I see if a certain value occurs at any point in an array in Java?

-I'm doing a little bit of Java programming :L And I want to see if a variable is in an array at any point.

So for example, I have this:



int[] anArray = new int[3];

anArray[0] = 200;

anArray[1] = 400;

anArray[2] = 600;

int variable1 = 400;



How do I make it so that I can code something to the effect of



If 'variable1' appears in any of the values at 'anArray'

{

Do something

}

else

{

do another thing

}



Thanks in advanceSet a boolean variable to false. Loop through the array comparing each value to the value you are looking for, if it matches, set the boolean variable to true. Then do an 'if' on that boolean variable.

How do I print only 1 page with the window.print() method?

-I have a web page that has table for users to fill out, and I have a print button at the bottom, and it continuously prints two pages when it only needs one. the second page just prints blank. I'm wondering if there is a piece of html code that will only print the one page.

Will there be a jailbreakme 4.0 coming out for the iOS 4.3.4?

-There is an untethered one, aka a beta version.

This is a test version and may cause your ios platform to crash.

There will be a new jailbreak version coming out later this year.

So if i were you i would just wait till the proper version comes out.

Hope this helps.

Put pictures on a page on Tumblr?

-I was trying to create a page for just my personal photos on Tumblr. I did the thing where you make the page redirect and tag it with a certain tag and well i did that and it didnt work. So please tell me what to do! Because i have no idea<a href="http://_______.tumblr.com/tagged/_鈥?



So put that into your description box under info, then replace the underlines with _____: 1) your url address; 2) the name of the tag and; 3) the title of the redircted page.

A light bulb is used to demonstrate the binary concept used for computer storage and communication.?

-A light bulb is used to demonstrate the binary concept used for computer storage and communication. Give an example in everyday life to explain this binary concept.Like a binary bit, a light switch has two possible states, on and off. In this sense, a light switch is binary.

Need help shifting pointers in c++?

-I'm supposed to make a 12 character long word, store it in a char*, and shift it by a user inserted integer.



For example,



Hello World

3

rldHello Wo



i'm not exactly sure how to do this. So far, i've got:



#include <iostream>

#include <string>

using namespace std;



int main ()

{

int h;

char* string;



cout << "\nEnter a 12 letter word: ";

cin >> string;



cout << "\nEnter an integer: ";

cin >> h;



cout << "\nYour shifted Word is" << string << endl << endl;



system("pause");

return 0;



I don't know how to first create a char* if you are dealing with 2 words as it only took the first word when i tried it.



Also, i don't know how to control the shift of the letters



I do not expect you to write this for me, but some guidance in the correct direction would be appreciated



Thank you

I wrote a code for something in CMD and i want to put a password in it how do i do it?

-i want to make it so if the password is incorrect it will exit but if the password is correct then it will go to whatever is in the :correct section



the code so far is:



@echo off

color 0c

title hi

echo please enter password

set /p input=

if %input%=={here is where the password will go} goto correct

if %input%=={i guess anything but the password would go here} goto incorrect

:correct

cls

title correct

echo hello

pause

:incorrect

cls

title incorrect

echo bye

pause

exitYou could use "IF NOT", but all you really need is one IF statement.But couldn't anyone just open up your .bat file, rem out the test for a password and get around it?

Security by 'my users are too stupid to figure this out' never really works.

How do you make a picture in line with more than one line of text with html?

-Code examples:



http://paynelessdesigns.com/dsns/dsn_tex鈥?/a>

http://paynelessdesigns.com/dsns/dsn_ima鈥?/a>



RonYou should float the image to the left or the right of the parent container. The text should naturally wrap around the image.

Why is yantoo layers runtime constantly popping up asking to run? is there a way to make it stop?

-Tt

2011年8月3日星期三

Does java still create a default constructor even in this case?

-MyClass m=new MyClass();//java provide a default constructor for this

MyClass m=new MyClass(3,2);//how about for this code?does java still provide a default constructor?I answered the same way to a question on stackoverflow and got smacked down pretty hard.



The actual situation is slightly more complicated. From the documentation linked below:



You don't have to provide any constructors for your class, but you must be careful when doing this. The compiler automatically provides a no-argument, default constructor for any class without constructors. This default constructor will call the no-argument constructor of the superclass. In this situation, the compiler will complain if the superclass doesn't have a no-argument constructor so you must verify that it does. If your class has no explicit superclass, then it has an implicit superclass of Object, which does have a no-argument constructor.



** back to me:

Since most user classes don't have an explicit superclass, thus being implicitly subclass of the Object class, then you do not have to provide a not argument constructor. After the aforementioned 'smack down' I wrote some code to test it and found out that it's true. If you write a little code to do your own test then you'll have confidence in the answer.

C# or C++ as my next language?

-I've got to a decent level in vb.net and now I want to try either C# or C++, what are the pros and cons of each of them?I think C# is a better choice for developing windows application or simple games.

You'll pick it up quickly because of your experience with .NET.

If you learn C++, it may be a bit difficult, every time you'll look at C++ code you'll feel lost, C++ is very different from VB.



C++ code runs faster than C# code which faster than VB code, C++ code also runs hundreds of times faster than some languages such as Python and PHP.

So I would suggest you learn C#, which is similar in syntax to C++, and once you think you can move on to the next level, try C++.
C# is a programming language introduced with the introduction of the Dot Net Platform by Microsoft. It is used to create both Web-Based and GUI-Based applications on Windows (and now to some degree on Linux).



C++ is mostly used in:

Numerical computations: physics, graphical games, finance, statistics;



Bit fiddling: drivers, operating systems, networking, embedded devices;



Anywhere you need exact control of allocation of memory.
you should learn C# first because C++ is much harder to learn and so knowing C# would give you a better understanding so C++ wont be so hard to learn

Tumblr Background code?

-Hi I want to put a background wallpaper for my tumblr blog, but my theme doesn't have an Upload image to background thing, and I really like my theme, but I want to ad a background image, what is the code for it? I found a code but when I use it my background image is really zoomed in I want it to position the image to be stretched not centered so it can fit perfectly... thanks! if there is a way.ybe...



How to put a background image in your Tumblr theme: http://tumblring.net/how-to-put-a-backgr鈥?/a>



Ron

If A1="X" and if any of (D1,E1, or F1)="Y" then Display C2?

-If A1="X" and if any of (D1,E1, or F1)="Y" then Display C2?

How would I right this formula in Excel 2010? I'm trying to track how many hours each staff is with a client. So if my client is "X" and anyone of up to three staff is "Y" then display the amount of hours in C2.

Category

Wheres the easiest site to learn programming c++?

-the easiest way?There is no easy way to learn C++. It is a difficult language to master with many pitfalls. Having gone the route of learning off of websites and reading books, my best advice to you would be to save up and buy a good book on C++ if you are serious about learning it.



And even after you have "learned" C++ and written code with it, it takes years to be truly proficient.
Try:

http://learncpp.com/

http://cplusplus.com/doc/tutorial/



Or Google "c++ for dummies":

http://www.google.com/search?q=c%2B%2B+f鈥?/a>

How can I make this C++ code read from a .dat file?

-This program total ups how much money someone makes before taxes.

I just need it to read the values from a file and save them in a file

This assignment is due tonight and i'm not sure how to do it, any help would be great





Here is my code:

#include <iostream>

#include <iomanip>



using std::cout;

using std::cin;

using std::endl;

using std::fixed;

using std::setprecision;



int main()



{



double hours = 40.0;

double rate = 10.0;

double gross = 0.0;

double overtime = 1.5;





cout << "Enter the ammount of hours worked: ";

cin >> hours;

cout << "Enter the ammount paid per hour: ";

cin >> rate;



if (hours<0 || rate<0)



cout << "ERROR pick a different number" << endl;



else



if(hours > 40){ //calculate gross pay

overtime = (hours-40) * rate * 1.5;

gross = 40 * rate + overtime;



}



else

{

gross = rate * hours;

}



cout << "Overtime: " << overtime << endl;

cout << "Gross pay: " << gross << endl;



system ("pause");



return 0;



}The include file <fstream> has classes for streams for reading from and/or writing to named files. In particular ifstream and ofstream are specifically input and output streams, respectively. Here's a trivial example:



#include <iostream>

#include <fstream>



using namespace std;



int main()

{

ifstream fin("input.txt");

float a,b;

fin >> a >> b;

ofstream fout("output.txt");

fout << a << " + " << b << " = " << (a+b) << endl;

fout.close();

}



Given a text file "input.txt" with "23 19" in it, this produces an output file with "23 + 19 = 42" as its only line.



Your logic will have to change some. After all, you can't really prompt a disk file, or tell it to retry on badly-formatted input. It contains usable data or it doesn't. So, if there's a problem you simply write an error message to cout or cerr, and then exit...usually with a nonzero return value from main().



The only reason to do a close explicitly, by the way, is to test for errors. Even with "endl" forcing buffer writes--in principle at least--there is some final writing to the file system that happens on an output file when it is closed. It's only when this returns good status that you are assured the the entire file did, in fact, get correctly written. I obviously left out error checking. I'd use exceptions and try/catch...but I suspect you haven't studied those yet.



Even if you're not checking for I/O errors yet, try to get in the habit of closing output files. Closing input files is also a good thing to do if your program is going to run for any length of time after you finish reading, but before the ifstream object gets destroyed. That frees up resources for other uses.

Where can I license a database of spanish words?

-I would like an electronic text database of spanish words. I don't need definitions. Just the words like a thesaurus.

Whats a good website i could design to make money?

-I am good at making sites...





I was wondering if i built a site what can the site be about to make money???If you can give much time, then make a website to sell your web design services. In that case you will have to design websites for your clients which requires much of your time and it is a big competing field as there are millions of people doing that job already.



The best way to earn money is to make an information website which provides great information on the topic you love and know about. Market your website to attract visitors through social media, relevant forums and other ways. That requires less time and you can earn handsome amount through affiliate programs like amazon stores, commission junction, shareasale and advertising networks like google adsense.
Nowadays's a lot of options are available to make money through online business.If you are good to make web design you can sell it through your website also you can apply for Google adsence.
make website for forex traders and refer them to a broker
Adult entertainment make the movies free and allow donations.

Well, i was wondering if anyone knew of a good, free Photo Editor?

-My mom just got married and in one of her wedding pictures she wants her ring to appear its shinning. So i was thinking of adding like a sparkle to it so it appears to shine, but i can't find any Photo editor that provides that option. Thanks everyone!All of the following are FREE, my friend, though some of them may a bit difficult, initially, to get into.



The 'better' ones start in the box below, marked Source(s), but I've had to list some in this box as you can only list 10 sources below.



TwistedBrush Open Studio - http://www.pixarra.com/download.html

ImagJ - http://rsbweb.nih.gov/ij/

Photoscape - http://www.photoscape.org/ps/main/downlo鈥?/a>

mtPaint - http://mtpaint.sourceforge.net/

HeliosPaint v1.4.3 - http://www.heliospaint.com/

VCW VicMan's Photo Editor - http://www.vicman.net/vcwphoto/index.htm

Lightbox v2.0 Free - http://www.sagelighteditor.com/downloadf鈥?/a>
Short and crisp

picasa and photoscape are the best ones.
try pixlr - it has a full featured photo editor as well as vintage photo effects



plus a good web page screen grabber



http://pixlr.com/
http://www.fotoflexer.com/

Troubleshooting: Static Home page on WordPress?

-I'm setting up a new WP-powered site using the Intrepidity WP Theme. I followed this guide to setup a static front/home page (http://codex.wordpress.org/Creating_a_St鈥?/a> As this guide predicts, I now have 2 "home" links on my navigation bar.



Although the guide outlines the remedy, I am unable to follow as I am not familiar with PHP.



Can anyone please help me with a step-by step guide on how to troubleshoot this issue, please?



REF: (http://codex.wordpress.org/Creating_a_St鈥?/a> (See section on Navigation Bars))

Is this possible in any way?

-If you knew someone's gmail password but they ended up changing it and you didnt know what it was but you end up changing it again just to check something, but you dont want that person to know that you did that.



Is there some kind of way you can go back and change their password back to what they had it without changing the password again because you dont know what it was when they changed ityes it's possible.
I think it is possible. Look it up on Google.

Html coding help please?

-My school has chosen me to make a social website for the school. Kinda like facebook or myspace but just for my school. But i am having some trouble. I need to know how to make recent post by the members show up on the home page? And how do I make it where you can click on the persons name who posted the status you go to their profile. Thank youi very much. PICKING BEST ANSWER. 10 POINTS!!If you use Blogger as your blog host then you can use recent post widget. But if you use wordpress I guess there's no HTML code. In fact you have to do it with plug-in.

Whatever, here's the process how you'll set up a recent post widget. Use the HTML code below.



<div id="mtrpwa">

<script style="text/javascript" src="https://sites.google.com/site/proje鈥?br>
<script style="text/javascript">var numposts = 5;var showpostdate = false;var showpostsummary = true;var numchars = 100;var standardstyling = true;</script>

<script src="http://YourOwnB1og.blogspot.com/fee鈥?br>
<div style="font-family: arial, sans-serif; font-size: 9px;" id="rpdr"><a href="http://www.madtomatoe.com/recent-p鈥?title="Grab this Recent Posts Widget" target="_blank">Recent Posts Widget</a> by <a href="http://www.madtomatoe.com" title="Recent Posts Widget">Blogger Widgets</a></div><noscript>Your browser does not support JavaScript!</noscript>

<style type=text/css>

#rpdr {background: url(http://3.bp.blogspot.com/-wsIqUGbMUyk/Tc鈥?/a> 0px 0px no-repeat; padding: 1px 0px 0px 19px; height:14px; margin: 5px 0px 0px 0px;line-height:14px;}

#rpdr, #rpdr a {color:#808080;}

#mtrpwa { border-bottom:1px #cccccc dotted; margin-top:-10px; padding-bottom:10px;}

.mtrpw a {font-weight:bold; }

.mtrpwsumm {}

</style>



If you're using blogger then Go to Design -> Page element -> Add a Gadget -> HTML/Javascript

paste the code above and click Save.



Well, to make a clickable poster name you can use the code below.



<a href="Author's Profile URL ">Author Name</a>



Hey, If you are new, then you can try out the following link to know more.

http://www.w3schools.com/html/default.as鈥?/a>



I hope your problem will solve. :)Use PHP and mySQL to read and write data to a database.
Did you code the forum yourself, or is it the school's forum or a forum from an outside source?

Why I cant a php file on textwrangler?

-Every time i try to save a file as (world.php for example), this pops up:



This operation couldn't be completed, because an error occurred.

An attempt to write to this volume failed(MacOS Error Code: -61)

I'm having trouble reading a txt file into an array of structs using dynamic memory allocation. Help please?

-I'm trying to do a simple program that will read data from a text file into an array of structures using dynamic memory allocation and then printing it. Here is the text file exactly as it was given to me:



Fred Flintstone 38 Male

Barney Rubble 36 Male

Wilma Flintstone 37 Female

Betty Rubble 36 Female

Pebbles Flintstone 4 Female

Bam-Bam Rubble 3 Male

Dino Flintstone 2 Male



IMPORTANT: There are 3 tabs (not spaces) before the numbers and 2 tabs after the numbers. I'm getting no errors or warnings, but my output box crashes. I'm sure my while loop is where the problem is. Any tips would be helpful. Thank you. Here is my code:



#include <stdio.h>

#include <stdlib.h>

#include <string.h>



int main(void)

{

typedef struct

{

char* name;

int* age;

char* gender;

}CHARACTER;



CHARACTER* pChar;

int charIndex;

char temp[61];



FILE* pData;



if ((pData = fopen("lab4data.txt", "r"))==NULL)

{

printf("Error opening file.\n");

return 100;

}



pChar = (CHARACTER*) calloc(7, sizeof(CHARACTER));



charIndex = 0;

while (charIndex<7)

{

fgets(temp, 20, pData);

pChar[charIndex].name = (char*)calloc(strlen(pChar[charIndex].na鈥?+ 1, sizeof(char));

strcpy(pChar[charIndex].name, temp);



pChar[charIndex].age = (int*)malloc(sizeof(int));

fscanf(pData, "%d", pChar[charIndex].age);



fgets(temp, 15, pData);

pChar[charIndex].gender = (char*)calloc(strlen(pChar[charIndex].ge鈥?+ 1, sizeof(char));

strcpy(pChar[charIndex].gender, temp);



charIndex++;

}



for (charIndex=0; charIndex<7; charIndex++)

{

printf("%s %d %s", *pChar[charIndex].name, *pChar[charIndex].age, *pChar[charIndex].gender);

}



if (fclose(pData) == EOF )

{

printf("Error closing lab3data.txt\n");

return 200;

}



return 0;

}This:

pChar[charIndex].name = (char*)calloc(strlen(pChar[charIndex].na鈥?+ 1, sizeof(char));

I assume is:

pChar[charIndex].name = (char*)calloc( strlen(pChar[charIndex].name) + 1, sizeof(char));



But what is in pChar[charIndex].name when you call that? It's all 0's, right? You haven't put anything into it yet. calloc set it to 0's. So...it's a NULL pointer, right?



You need to compute the size you need to allocate from the data you read in.

A good site to make movies?

-I want to make a short video with pictures. But, I can't find any sites...any good Ideas?Windows Live Movie Maker (program comes free with every computer)

iMovie

One True Media (this is the one every one uses for a short video with pictures, i reccomend this one)I agree with iMovie. I've used iMovie a lot on Macs (which I don't own but that's the time that I used them) and iMovie works pretty great. It's really user friendly.

How to make a border in HTML that does not add to the width of the element?

-For example, if I made a "container" "menu" and "content" div and wanted the menu to be vertically aligned instead of horizontal how could I say #menu {width:20%;border:1px solid;} but in the end have the total width be 20% instead of 20% + 1px? Answers in HTML or CSS should be fine.Can't be done. The border will always be added to the width and there is nothing you can do about it. You need to study the HTML box model. Google on those three words and you will get lots of explanations.

Why does this java code not work?

-This code runs, however when the drop down menu options are selected they give no output, how can I make it give the desired output!

import java.awt.*;

import java.applet.*;

import java.awt.event.*;



public class DropDOWN extends Applet implements ActionListener {



Choice chosen;

int declaration;



public void init()

{



chosen = new Choice();

chosen.addItem("Tom");

chosen.addItem("Sam");

chosen.addItem("Jim");



add(chosen);



}



public void actionPerformed(ActionEvent e)

{

switch (chosen.getSelectedIndex())

{

case 0:

{

declaration = 1;

repaint();

}

break;



case 1:

{

declaration = 2;

repaint();

}

break;



case 2:

{

declaration = 3;

repaint();

}

break;



}

repaint();

}



public void paint(Graphics g)

{

if (declaration == 1){

g.drawString("My name is Tom", 380,380); //desired output

}



if (declaration == 2){

g.drawString("My name is Jim", 380, 380); //desired output

}



if (declaration == 3){

g.drawString("My name is Sam", 380,380); //desired output

}



}

}There are two things that come to mind. First, I think you want an ItemListener with the Choice object instead of trying to handle action events. Your approach might be workable, but I believe it was designed around using an ItemListener, looking at the documentation:



http://download.oracle.com/javase/1.4.2/鈥?/a>



Second, it sound silly, but make sure that your String objects are actually being drawn in a viewable portion of the screen (i.e. make sure your applet actually is big enough to display the text where you are putting it.

How to repaint a Jlabel after certain gap of time again and again in java netbeans ide?

-i am making a clock in java that displays current time in a jlabel but that event fire up only with mousemotion and the label keeps on updating if the mouse is kept moving.how do i automatically update time in the label after a gap of 1sec each.

am using loop,sleep,repaint to do it but it is still not working.

Does this site work? https://signup.grabswag.com/index_v2.php?affiliate_id=1014?

-its my brothers birthday and he wants an ipad and for 20$ that seems like a really good deal, is this a scam?

Are there any Tutorial videos for Blender?

-Tutorial videos on youtube that covers every aspect of Blender for a beginnerhttp://www.willitblend.com

What's wrong with this HTML / CSS?

-I'm new to CSS and am trying to figure out why its not formating my simple page as I want. First i've tried linking to an outside document (in the same folder!!) see below, which is now commented out. Then I tried just adding simple CSS into the HTML doc and its not working either. Yes, the document is saved as an HTML and the other is a .CSS, they're in the correct folder, etc. Am i doing this correct and maybe its a browser issue?





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-鈥?br>
<html xmlns="http://www.w3.org/1999/xhtml">



<head>

<title>Kyle's site</ title>

<!--<link rel="stylesheet" type="text/css" href="MainStyleSheet.css" />-->

body {font-family:helvetica, arial, verdana, sans-serif;}

h1{georgia, times, serif;}

p{font-size:12;}

</head>



<h1>Kyle's Site</ h1>

<h3>A site designed by Kyle BB</ h3>



<body>

<p>

Currently under construction. Please check back soon!

</p>

</body>

</html>



I tried the commented-out section first, which did not seem to work at all. After that I commented out that link and then added the css directly into it but that just displayed it right on the page as if it weren't code. Help! thanks!You shouldn't have the <! in front or back.

Just keep it like this:

<link href="MainStyleSheet.css" rel="stylesheet" type="text/css" media="screen">

That should work for you, that links to an external style sheet.

And remove the internal CSS, put it in the external CSS sheet...and make sure you keep the css document in the root folder, I suppose you are though.
I don't necessarily see anything wrong with your <link> tag, but I always put the <link> tag before the <title> tag in the header and it works fine, you might try that.



I also noticed in your terminating </title> tag, you had a space between the / and the word "title". Not sure that that would affect anything though.



To get the inline CSS to work in your header, you need to put it in a <style> tag, e.g.:



<head>

<style type="text/css">

body {font-family:helvetica, arial, verdana, sans-serif;}

h1{georgia, times, serif;}

p{font-size:12;}

</style>

<title>Kyle's site</title>

</head>

Help with to much content?

-hey guys ... so i have a lot of content like 10 pages :)) (i know it make no sens)



anyway ... i want to make a page but not to put all the content in the same page ....



so i have index.html and i could write like a veryyyyyyyyy huge file but i want instead to have more documents but to open them in index.html.



i have 10 lessons and i want to take lesson1.doc or html and place it in index.html when click on a link and so on ... any help??The only way I can think to do this without using iframes is to use AJAX.

The link to each html document would execute Javascript, which would load the the document behind the scenes and place the contents in a <div>.

Load another document, and it would replace the contents of the <div> with the new document.



Why do you want to open these in the index.html anyway?

____

If you use Google's jquery API, you can have code like this:



<script src="https://ajax.googleapis.com/ajax/li鈥?br>
<script type="text/javascript">

function getLesson(lesson_url) {

$.get(lesson_url, null,

function(data) {

var d = document.getElementById("lessondiv");

d.innerHTML = data;

}

);

}

</script>





and in the HTML:



<a href="getLesson('lesson1.html');">View lesson1</a>


<a href="getLesson('lesson2.html');">View lesson2</a>


...

...

<div id="lessondiv"></div>





Using this, you wouldn't have to put all 10 lessons in one page. Just 10 links in one page.If my understanding is correct...



You would have something like this:



<a href="FILEPATH_OF_LESSON_ONE">Lesson 1</a>

<a href="FILEPATH_OF_LESSON_TWO">Lesson 2</a>



etc.



example:



<a href="C:/Users/Michael/My Documents/Lesson1.doc">Lesson 1</a>



Michael is just a random name.



Or do you mean something else?

How do I print only 1 page with the window.print() method?

-I have a web page that has table for users to fill out, and I have a print button at the bottom, and it continuously prints two pages when it only needs one. the second page just prints blank. I'm wondering if there is a piece of html code that will only print the one page.

What would be a good computer for the use for web design classes and for personal use ?

-i will be going to college soon for web design classes and i need a new computer one that will work for my demands for school. cant be to high i can go up to 1000 since im getting a grant . please help thank you

SQL Update Statement and ADO.Net?

-What's wrong in that SQL update statement?



using c# and ADO.Net

database : Access





--------------------------------------鈥?br>
I am using an access data base called HotelDataBase.MDB with a table called Register in which 14-columns that are respectively

First Name [Text], Sure Name [Text], Age [Int], ID [Int], Tel [Int], Gender [Text], Country [Text], Room Number [Int], Room Type [Text], Room Class [Text], Number of Nights [Int], Start Date Month [Text], Start Date Day [Int], Start Date Year [Int]



and I've a Form in which a text box called "updateIDTextBox" and Search Button to search for the specified id in that Text Box.



if the id exists, all data will be displayed in their editable places in the form as

First Name : Name------------Last Name : MyName

Age : 22 ------------ID : 1320065 and So On...





Then any of these data can be changed then the user clicks on the Save Button to Update data of the specified id in the search text box



the update statement is





Collapse



string updateQuery = "Update Register Set First Name = '" + firstNameTextBox.Text + "',Sure Name = '" + sureNameTextBox.Text + "',Age = " + ageTextBox.Text + ",ID = " + idTextBox.Text + ",Tel = " + telTextBox.Text + ",Gender = '" + genderComboBox.Text + "',Country = '" + countryComboBox.Text + "',Room Number = " + roomNumberTextBox.Text + ",Room Type = '" + roomTypeComboBox.Text + "',Room Class = '" + roomClassComboBox.Text + "',Number of Nights = " + noOfNightsTextBox.Text + ",Sart Date Month = '" + monthComboBox.Text) + "',Start Date Day = " + dayComboBox.Text + ",Start Date Year = " + yearComboBox.Text + " Where ID = " + updateIDTextBox.Text + ";";





Unfortunately i received a syntax error in the update statement



this is the code of Save Button

Collapse



/*

* all recored are checked

* all inputs are valid

* now update data to the database

* open connection to database

* build commands, send it to database

* save updated data to database

* close connection of database

*/

//the connection

DataBaseOperations.CON = new OleDbConnection(DataBaseOperations.CONNE鈥?br>


string updateQuery = "Update Register Set FirstName = '" + firstNameTextBox.Text + "',SureName = '" + sureNameTextBox.Text + "',Age = " + ageTextBox.Text + ",ID = " + idTextBox.Text + ",Tel = " + telTextBox.Text + ",Gender = '" + genderComboBox.Text + "',Country = '" + countryComboBox.Text + "',RoomNumber = " + roomNumberTextBox.Text + ",RoomType = '" + roomTypeComboBox.Text + "',RoomClass = '" + roomClassComboBox.Text + "',NumberofNights = " + noOfNightsTextBox.Text + ",SartDateMonth = '" + monthComboBox.Text + "',StartDateDay = " + dayComboBox.Text + ",StartDateYear = " + yearComboBox.Text + ", Where ID = " + updateIDTextBox.Text + ";";





// MessageBox.Show(updateQuery, "Update Query");



DataBaseOperations.COM = new OleDbCommand(updateQuery, DataBaseOperations.CON);



DataBaseOperations.CON.Open();

DataBaseOperations.COM.ExecuteNonQuery()鈥?br>
DataBaseOperations.CON.Close();

clearAllFieldsButton.Enabled = true;

MessageBox.Show("Update Process of Habitant : " + firstNameTextBox.Text.ToString() + " " + sureNameTextBox.Text.ToString() + "\nHas Been Done Successfully", "Successful Update");Are you sure about the field name: SartDateMonth? Shouldn't it be StartDateMonth?

What font is used on this banner?

-I seen this banner on a blog, and I really want to know what font it is.



http://i55.tinypic.com/2vnovn9.jpg



Thank you! :)Font Finders:



WhatFont: Easily & Quickly Identify Fonts Used On Any Website: http://chengyinliu.com/whatfont.html

IdentiFont : Identify Font Type: http://www.identifont.com/identify.html

IdentifyFonts.net: Easily Identify Fonts From a Sample: http://www.whatfontis.com/



RonTimes New Roman or Arial?

Is stackoverflow.com still active?

-well I tried them pretty much all, I don't like forums.digitalpoint.com that much, i don't get many answers there, i get excellent answers on ozzu.com but it's not so active, google forum does not address programming questions unless it's related to google, yahooanswers.com is so active but when i ask a very hard question i get no answer most of the times, and what i don't like about it is that you can't discuss the answer because the person who answer leave and you can't ask him like we do in forums unless you want to pm him (i like this but sometimes you really need to get in touch with the person who give the answer especially if you have only 1 answer)



with that said, I want to ask about stackoverflow, i like the site and the kind of questions i find there and the kind of answers, they answer the hardest questions with quality....like just jr, i don't know if u know him, but when i came to yahoo i was a beginner in php and he was the only one to answer my questions and every time i ask a harder question, he give a better answer, but i can't find many of him here lol, i asked 2 questions on stackoverflow and on YA as well but i don't find anyone who answers, i think stackoverflow is dead, isn't? because all the good discussions happened between 09 and 2010 so what you think? Is there any active alternative which has the quality of programmers that stackoverflow has?

no disrespect to anyone but when I have a simple question, i can google it, or if i post it here i have like 6 or 7 answers, but these days i have a very technical questions that have to do with paypal api and flash video player scrubber and i have no answer and i posted the q 3 times...and paypal forum is inactive so i can't ask there, google is empty on that subject, only an experienced flash and paypal developer can answer my questionI think Stackoverflow is the best resource available for programmers. If you can't find an answer there or in the documentation for the API your working with, your pretty much on your own. Stackoverflow isn't hardly dead. At least not in Java.Appears to be quite active. A quick look shows lots of questions being asked and answered, and lots of views on many of the questions.



As your questions get harder and harder, it gets harder to find people who can answer them. And the few people who can answer them tend to be fussy about what questions they do answer. A professional is more likely to invest time in answering a question they perceive as coming from another professional than a question coming from some kid playing in a sandbox.



Look at the question you posted here. It's 3 paragraphs long, not a single word is capitalized, and there isn't a single period. Your first sentence is a 7 line long paragraph. When I read that, I think kid playing in a sandbox.



You can get away with that on YA!. You can't on stackoverflow. Look at the questions that are getting answered there. They tend to be short, to the point, and well written. Invest some time in asking your question, and someone might invest the time to answer it.

Is it possible to have a function that returns arrays?

-In C/C++, no, you must return a pointer to the array. In Java, yes.It is quite common for a function to return a pointer to an array.



In C and C++ you can wrap the array in a structure and return that.
What language?



With Java, yes it's easy.



With C++ you can use call by reference and so, if effect, yes. You can also return a pointer to an array.
Yes, some programming languages support that.

What programming language do you use?
In C#, you can
Yes, but it varies from language to language.

Help compilers and IDEs?

-im a starting hobbyest, and i have no problem with the programming languages, but the compilers and ides are a nightmare, either they dont work or are not what i wanted, i need on for python and one for c++.Eclipse has plugins for Python and C++ which is convenient. I used Eclipse for C++ development for awhile and I have to say Code::Blocks is way better. The plugins for Code::Blocks are awesome. It's better in every aspect than Eclipse except for a few insignificant things.

Well, i was wondering if anyone knew of a good, free Photo Editor?

-My mom just got married and in one of her wedding pictures she wants her ring to appear its shinning. So i was thinking of adding like a sparkle to it so it appears to shine, but i can't find any Photo editor that provides that option. Thanks everyone!All of the following are FREE, my friend, though some of them may a bit difficult, initially, to get into.



The 'better' ones start in the box below, marked Source(s), but I've had to list some in this box as you can only list 10 sources below.



TwistedBrush Open Studio - http://www.pixarra.com/download.html

ImagJ - http://rsbweb.nih.gov/ij/

Photoscape - http://www.photoscape.org/ps/main/downlo鈥?/a>

mtPaint - http://mtpaint.sourceforge.net/

HeliosPaint v1.4.3 - http://www.heliospaint.com/

VCW VicMan's Photo Editor - http://www.vicman.net/vcwphoto/index.htm

Lightbox v2.0 Free - http://www.sagelighteditor.com/downloadf鈥?/a>
Short and crisp

picasa and photoscape are the best ones.
try pixlr - it has a full featured photo editor as well as vintage photo effects



plus a good web page screen grabber



http://pixlr.com/
http://www.fotoflexer.com/

How do you validate a HTML form using JS and display the error message next to the text fields?

-I think I have to use JS. But how can you make the message appear on the side of the text field, right after you type and press submit? If anyone knows how to do this, it would be great. Thanks.You can place a label to the side of each form element, but leave the label blank. When the person clicks Submit and forgot to fill out one of those elements, you can change the label's text.



For example, if you have a label



<label id='label1'></label>



your javascript would be



document.getElementById('label1') . innerHTML = 'Please fill in this field.';



We use innerHTML instead of value because labels don't have a value attribute. If you're going to copy the code, make sure you remove the spaces around the second period.

Visual Basic FontDialog?

-I am creating a Notepad in Visual 2010 Ultimate but I cant get the FontDialog to work. I tried:

Button coding: Fontdialog1.show

Textbox1.Text = Fontdialog1.Font

But I had an error. Anyone know how to work this?This is how to do what I think you're after:



FontDialog1.ShowDialog()

TextBox1.Text = FontDialog1.Font.Name.ToString



It'll send the name of the font chosen to the box.



Took me a bit of tinkering to find.





And some full working code for a font dialog that I jsut did if you want it:



FontDialog1.ShowColor = True





FontDialog1.ShowDialog()



TextBox1.ForeColor = FontDialog1.Color

TextBox1.Font = FontDialog1.Font

TextBox1.Text = FontDialog1.Font.Name.ToString



Keep in mind that this could will run even if you exit from changing fonts, you'll have to fix that if you implement it.How the hell did you get Visual Studio 2010 Ultimate?

Anyway, you can't convert from font to text, but you can use that font as the font of the text box, or display some of the fonts properties.

HTML/PHP contact form for my website?

-I have a contact form on my website. the site isnt on a server yet or have a domain as im just making it. when i fill in the form and click send, all that happens is it says internet explorer cannot display the webpage. Is this normal, i just want to test it. Will it defiantly work when its on a server?? This is my HTML an PHP



PHP:

<?php

if(isset($_POST['email']))

{



// CHANGE THE TWO LINES BELOW





$email_to = "carl_bowles92@hotmail.co.uk";





$email_subject = "Bowles Farm Website";







function died($error)

{

// your error code can go here



echo "We are very sorry, but there were error(s) found with the form you submitted. ";



echo "These errors appear below.



";



echo $error."







";



echo "Please go back and fix these errors.







";



die();

}



// validation expected data exists



if(!isset($_POST['first_name']) ||



!isset($_POST['last_name']) ||



!isset($_POST['email']) ||



!isset($_POST['telephone']) ||



!isset($_POST['comments']))

{

died('We are sorry, but there appears to be a problem with the form you submitted.');



}





$first_name = $_POST['first_name']; // required



$last_name = $_POST['last_name']; // required



$email_from = $_POST['email']; // required



$telephone = $_POST['telephone']; // not required



$comments = $_POST['comments']; // required





$error_message = "";



$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Z鈥?br>


if(!preg_match($email_exp,$email_from)鈥?#

{



$error_message .= 'The Email Address you entered does not appear to be valid.

';



}



$string_exp = "/^[A-Za-z .'-]+$/";



if(!preg_match($string_exp,$first_name鈥?

{



$error_message .= 'The First Name you entered does not appear to be valid.

';



}



if(!preg_match($string_exp,$last_name)鈥?

{



$error_message .= 'The Last Name you entered does not appear to be valid.

';



}



if(strlen($comments) < 2)

{



$error_message .= 'The Comments you entered do not appear to be valid.

';



}



if(strlen($error_message) > 0)

{

died($error_message);



}



$email_message = "Form details below.\n\n";





function clean_string($string)

{



$bad = array("content-type","bcc:","to:","cc:",鈥?br>


return str_replace($bad,"",$string);



}





$email_message .= "First Name: ".clean_string($first_name)."\n";



$email_message .= "Last Name: ".clean_string($last_name)."\n";



$email_message .= "Email: ".clean_string($email_from)."\n";



$email_message .= "Telephone: ".clean_string($telephone)."\n";



$email_message .= "Comments: ".clean_string($comments)."\n";









// create email headers

$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' .

phpversion();

@mail($email_to, $email_subject, $email_message, $headers);



?>



<!-- place your own success html below -->



Thank you for contacting us. We will be in touch with you very soon.





<?php

}

die();

?>



HTML:



<form id="contactform" name="htmlform" method="post" action="html_form_send.php">

<table width="450px">

</tr>

<tr>

<td valign="top">

<label for="first_name">First Name *</label>

</td>

<td valign="top">

<input type="text" name="first_name" maxlength="50" size="30">

</td>

</tr>

<tr>

<td valign="top"">

<label for="last_name">Last Name *</label>

</td>

<td valign="top">

<input type="text" name="last_name" maxlength="50" size="30">

</td>

</tr>

<tr>

<td valign="top">

<label for="email">Email Address *</label>

</td>

<td valign="top">

<input type="text" name="email" maxlength="80" size="30">

</td>

</tr>

<tr&The code looks without mistakes. Maybe it's a problem that you haven't installed php? How are you testing it, on virtual server? Does it support php? You can also make a contact form with php forms http://phpforms.net/