Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1251.

Solve : Draw multiple of the same sprite without ton's of strings -- XNA --?

Answer»

How would I use a "for" (or other) loop to draw a bullet sprite in a unique direction from the center point?

--Liam

P.S. Where the PROGRAM checks if the spacebar is pressed is where a new bullet will be created.

Code:
Code: [Select]using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace SupaShota
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Vector2 v = new Vector2(350, 250);//base point
Texture2D bar;//BARREL
Texture2D b;//base
Texture2D bul;//bullet

public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
b = Content.Load<Texture2D>("base");
bar = Content.Load<Texture2D>("barrel");
bul = Content.Load<Texture2D>("bullet");
// TODO: use this.Content to load your game content here
}

MouseState MS;
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();

MS = Mouse.GetState();
KeyboardState ks = Keyboard.GetState();
if (ks.IsKeyDown(Keys.Space))
{

}

base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
spriteBatch.Draw(b, v, Color.White);
double an = Math.Atan2(MS.Y - v.Y, MS.X - v.X);
Rectangle r = new Rectangle((int)v.X + 50, (int)v.Y + 50, bar.Width, bar.Height);
spriteBatch.Draw(bar, r, NULL, Color.White, (FLOAT)an, Vector2.Zero, SpriteEffects.None, 0);
/*
*
* Here is where the "for" statement or such will go.
*
*
*/
spriteBatch.End();
base.Draw(gameTime);
}
}
}

Please tell me if I forgot to mention something.

1252.

Solve : VB 6 .....ASP?

Answer»

Can some please tell me what this function does?

Function SwopIt(tmpDatum)
Dim dd
Dim mm
Dim yyyy
Dim tmpDate
Dim pos1, pos2
tmpDate = FormatDateTime(tmpDatum,2)
pos1 = InStr(1, tmpDate, "/")
pos2 = InStr(pos1 + 1, tmpDate, "/")
mm = Mid(tmpDate, 1, pos1 - 1)
dd = Mid(tmpDate, pos1 + 1, pos2 - pos1 - 1)
yyyy = Right(tmpDate, 4)
SwopIt = dd & "/" & mm & "/" & yyyy
End Function

Private Function MakeDate(aDate)
Dim dpart,mpart,ypart,tmpDate

dpart = DatePart("d", aDate)
If Len(dpart) = 1 Then dpart = "0" & dpart
mpart = DatePart("m", aDate)
Select CASE mpart
Case 1
mpart = "Jan"
Case 2
mpart = "Feb"
Case 3
mpart = "Mar"
Case 4
mpart = "Apr"
Case 5
mpart = "May"
Case 6
mpart = "Jun"
Case 7
mpart = "Jul"
Case 8
mpart = "Aug"
Case 9
mpart = "Sep"
Case 10
mpart = "OCT"
Case 11
mpart = "Nov"
Case 12
mpart = "DEC"
End Select

ypart = DatePart("yyyy", aDate)
MakeDate = dpart & " " & mpart & " " & ypart
End FunctionThere are actually two functions. SwopIt converted my local date (mm/dd/yyyy) to dd/mm/yyyy. MakeDate converted my local date (mm/dd/yyyy) to dd mmm yyyy.

Note: if passing data to the functions, be sure the data is dimmed as date. If you're hardcoding literals to the functions, be sure the enclose the data with # symbols. The results may surprise you if you fail to do so.



Thanks so much.
My suprise is, if i save the date as 05 Feb 2009, what i get on my display page is 02 May 2009.
Its really confusing me. I took over this code from someone and i have to make sure that our clients get the right information as the one that they have saved in the db.Quote

My suprise is, if i save the date as 05 Feb 2009, what i get on my display page is 02 May 2009.

Until I passed a #date# field, I kept getting a 1899 year as xx/xx/xxxx was being computed as a series of arithmetic divisions.

Try modifying the function headers. This will force an error if the data is mistyped.

Code: [Select]Function SwopIt(tmpDatum as Date) as Date

Private Function MakeDate(aDate as Date) as Date

Make sure the database field is ALSO defined as a date.

Thanks so much, i got it right. I removed the function call to SwopIt which was interchanging the date with the month.

Thanks
1253.

Solve : Batch file code problem?

Answer»

I want to run a batch file while I am away from computer and at one time I need to press 'ENTER' on the keyboard (or to click somewhere PRECISE in the screen), is it possible to make the batch file 'press' the enter key or to program a way to click somewhere in the screen?

If not do you know any software where I could program this?You could edit the .bat file and remove the corresponding "pause" line from the code.There are no ''pause'' line in my program.

I want to know if it is possible to code the batch file for it ''press'' enter key.

I make the batch open a software and after it is open I need to press enter key to make it run and after I do a loop to make it run MANY times... I know how to make all the code except that press enter THING (or to make it click somewhere in the screen to run the software)you will need to create a small file- just press enter in notepad, and save the resulting file.


now, assuming you saved that file as "enter.txt":
Code: [Select]type enter.txt | yourprogram.exe

the enter in the text file will be USED by the program as standard input, and so it will act as if the user had pushed enter.

Hope this is what you need.

1254.

Solve : Can someone help me with this .bat file?

Answer»

I'm trying to copy and modify this: authenticate with external SMTP mail server and send SIMPLE email using .bat but I'm doing a bad job here.

C:\>[emailprotected] -FROM [emailprotected] -TO [emailprotected] -TEXT "You have Email" -SUBJECT "You have Email" -SMTP smtp.somewhere.com -AUTH AUTO -USER pete -PASS 123456

But I don't know if I'm writing it correctly or I'm using it wrongly.

Why is there 'C:\>' ?

I think the REST is correct but I'm just guessing.

ThanksQuote

Why is there 'C:\>' ?

That would be your prompt. You are currently logged on to the root directory on the C: drive.

Quote
C:\>[emailprotected] -FROM [emailprotected] -TO [emailprotected] -TEXT "You have Email" -SUBJECT "You have Email" -SMTP smtp.somewhere.com -AUTH AUTO -USER pete -PASS 123456

This string appears to be parameters for some program. Unless you have a program named [emailprotected], this code will not EXECUTE. How did this string arrive on your doorstep?

Quote
I'm trying to copy and modify this: authenticate with external SMTP mail server and send simple email using .bat but I'm doing a bad job here.

Blat is one method, ALTHOUGH on a XP machine I would suggest a VBScript using either the Outlook application or Collaboration Data OBJECTS (CDO). One advantage of a VBScript is you have more control over the final product.

1255.

Solve : Help with Disk Defragmenter?

Answer»

So i've gone aroundto a bunch of different forums and done all kinds of different things....but EVERY time i try to analyze or defragment in Windows Disk Defragmenter it says "Disk Defragmenter could not start." I haven't used any third party defragmenters, and for some reason it just will not work.....HELP!!!Duplicate post - please continue here.boot from the os disk and ENTER first screen REPAIR ...and then do a chkdsk /p till it gives MESSAGE found one or more errors and then finally if it list u the INFO of the HDD ..then simply type fixboot


and then exit ...defragmanter should work /
Oh my gosh!

I just find it so incredible ridiculous that people never even look at the previous post, especially when it says:
Quote from: Dusty on December 28, 2008, 02:10:25 AM

Duplicate post - please continue here.
Understand that Dipesh?

Topic closed.
1256.

Solve : Macro: Beginner needs help?

Answer»

Hello Members,

I do not use Macros but recently I have tried to create a Macro in OUTLOOK 2000, It is a simple "Mail" macro.

I am try to create a Macro that will simply reply to an email message with a few sentences. Can someone help me create an "email macro" that simple automatically types a message in the "body" of the message. I spent most of the day on google, but the only macro I found was the one below. which only adds a message to the "subject" area.
I would like to add a message also to the "body" of the mail message as well, but do not understand to do it. Can someone please explain how to create a "mail" macro in Outlook 2000 for beginners like myself. Here is a Macro I found on google, but it only adds one line in the subject area: Thankyou all for your help., Ric

Sub HelloWorldMessage()
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)
msg.Subject = "Hello World!"
msg.Display
Set msg = Nothing
End SubYou might try using the body property in the mailitem class:

Code: [Select]Sub HelloWorldMessage()
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)
msg.Body = "Hello World!"
msg.Display
Set msg = Nothing
End Sub

Good luck.
Hello and thankyou,

This worked for me, I can't thankyou enough. Could you help me a bit further,

I also wanted to add back the "subject" line, so the macro would contain "both" the subject like and the "body". Could you show me what that code would look like and then I could paste it in.

P.S. The text that I am writing in the body, when I press the macro button, turns out to be "two long lines", is there any way to make the macro format the text as follows instead of two long lines:

Dear Personnel,

Thankyou for the opportunity to respond to your help desk position,
I look forward to meeting with you and your staff to discuss my qualifications.

Sincerely,
Richard (Is there anyway to format the text in the macro to look like this
paragraph, RIGHT now everything is put into just two lines
without any wrapping or FORMATTING. thankyou again ! rickThe key is to do the formatting yourself:

Code: [Select]Sub HelloWorldMessage()
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)
msg.Subject = "Hello World!"

str = "Dear Personnel," & vbCrLf & vbCrLf
str = str & "THANK you for the opportunity to respond to your help desk position," & vbCrLf
str = str & "I look forward to meeting with you and your staff to discuss my qualifications." & vbCrLf & vbCrLf
str = str & "Sincerely," & vbCrLf
str = str & "Richard"
msg.Body = str

msg.Display
Set msg = Nothing
End Sub

Hope this helps.

The code is untested, but this should give you some ideas.Hello,

I tried to run the "code you mentioned" and I received the error
message "Compile error: Argument not optional".

a little yellow arrow was pointing to the very first line where is says:

Sub HelloworldMessage () which was all in "yellow color

Also the first "Str = "Dear Personel," etc

The "str" was blue. on that first line.

I didn't like to bother you, thankyou for your help, if you have time to
get just this one macro working that would be all I need, I would like
make my own macros but do not understand the help file that came with
the VBA, so I will read up on understanding how to create a macro with VBA.

If you would be kind enough to get this one macro working that would be
great, perhaps I am doing something wrong, I just simply pasted everything
into the Project where it said "this outlook session" as you mentioned before.
I then saved it, and then ran the macro, but received error. Thankyou again for your help. Ric
Forgot about declaring variables.

Code: [Select]Sub HelloWorldMessage()
Dim msg As Outlook.MailItem
Dim str as String
Set msg = Application.CreateItem(olMailItem)
msg.Subject = "Hello World!"

str = "Dear Personnel," & vbCrLf & vbCrLf
str = str & "Thank you for the opportunity to respond to your help desk position," & vbCrLf
str = str & "I look forward to meeting with you and your staff to discuss my qualifications." & vbCrLf & vbCrLf
str = str & "Sincerely," & vbCrLf
str = str & "Richard"
msg.Body = str

msg.Display
Set msg = Nothing
End Sub

Not sure about this line: "Str = "Dear Personel,". The posted code shows no leading quote on Str. Quotes should come in pairs.

Basically you're creating a long string with well placed carriage returns/line feeds to make it look formatted.

Thankyou, Thankyou and Thankyou !!

It worked perfectly ! Exactly what I wanted. I appreciate your generous and
patient help, you've helped me more than I can say.

I'll be sending out a lot of resumes, and these macros will automate everything and save me a lot of typing time, macros are really quite incredible.

I tried to "Save the Macro" to a "Button" on the tool bar, by pressing "customize" on the toolbar. And although the "macro" button that I want to use stays there for the first session. Whenever I "reboot" or "close" the Outlook program.
IT COMPLETELY DISAPPEARS. I am using Outlook 2000, iS THIS A "BUG" in the program. I've tried saving the macro shortcut button to the toolbar at least 10 times, and the "button" on the toolbar is completely gone the next time I start up Outllook. Have you heard of anything like this problem.? Now that Ihave this great macro, it would be even faster to press a button on the toolbar to activate it, instead of going to "Tools >Macro>Macro.name Thankyou again. This will work on Outlook 2002, should be the same for 2000:

Create the macro

View==>TOOLBARS==>Customize==>New

Add new toolbar

Click Commands Tab

Click the name of the toolbar you just added

From the right panel, drag the macro name to the newly created toolbar

Note: the new toolbar is not docked. Try moving on to the Outlook toolbar if you prefer.

Good luck. Please try to keep your posts together in one thread. I cannot duplicate your problem with attaching the macro to a toolbar. Perhaps it is unique to Outlook 2000.

However, there are other ways of sending mail. The following script runs external to the Outlook application but still utilizes Outlook's properties and methods. Nice thing is the outgoing mail is preserved in your sent items folder.

Code: [Select]Const olMailItem = 0

Set ol = CreateObject("Outlook.Application")
Set oMail = ol.CreateItem(olMailItem)

With oMail
.To = "[emailprotected]"
.Subject = "Hello World!"

str = "Dear Personnel," & vbCrLf & vbCrLf
str = str & "Thank you for the opportunity to respond to your help desk position," & vbCrLf
str = str & "I look forward to meeting with you and your staff to discuss my qualifications." & vbCrLf & vbCrLf
str = str & "Sincerely," & vbCrLf
str = str & "Richard"

.Body = str
.Attachments.Add("c:\documents\resume.doc")
.Send
End With

ol.Quit

Be sure to fixup the To address and the path to resume.doc. Save script with a vbs extension and run from the command line as wscript scriptname.vbs

Then there is a command line program called blat. Finally, there is a scriptable object called CDO.Message. Neither of these two will automatically create entries in your Outlook send items folder.Thanks, I will keep my posts together in one string, appreciate your help,
I'm sure this will work FINE, and yes it might be just isolated problem with the button on outlook 2000, I would like to upgrade if Ican. Thankyou again for your kind help, RicHi,

Do you know of any good sites where I can download some helpful
Macros for my work. I've found out that "macros" are quite incredible
tools. Is there a site where I can download a variety of sample macros
that can do a variety of different useful tasks . Thanks , RicHi

I have been also studying for my MCP cert,, and have created over 35 separate
Word .docx and .doc study files, a mixture of both, most are word 2007
. I am trying to create a MACRO that will combine or append
all of these or at least most of them into 1 .DOCX OR .DOC FILE.
So I will have one large Ebook, so to speak to study from.

Can I have help to create a Macro that will Append all these files:
I have for example. Doc1, Doc2, Doc3, Doc4, Doc5, etc and I want
to combine OR append them into just one MAIN.DOC . or MAIN.DOCX file

Thankyou all, Ric

1257.

Solve : Outlook 2000: How to Attach a File with Macro?

Answer»

Hello, I am using Outlook 2000

Is it possible to Attach a regular .doc file with a MACRO automatically in an Email.

What I am trying to do is create a macro that will automatically write one or two sentences into the body of my message, and then automatically attach a "file"
which is in my "documents" folder called: resume.doc

Could someone show me a sample code that will do this ? I am sending out letters of job interviews and also must attach my resume, to the email. If a macro
can do all this that would be great.

I still have not figured out how to use VBA to program all this stuff into the macro,
but can someone send a sample macro code to do this.

The name of the macro might be : Job resume
The sentence in the body of the message: Attached is my Resume for review
The name of the resume file to attach is: resume.doc

Can someone help. Thankyou, RicTry using the attachments.add method:

Code: [Select]Sub HelloWorldMessage()
Dim msg As Outlook.MailItem
Dim str as String
Set msg = Application.CreateItem(olMailItem)
msg.Subject = "Hello World!"

str = "Dear Personnel," & vbCrLf & vbCrLf
str = str & "Thank you for the opportunity to respond to your help desk position," & vbCrLf
str = str & "I look forward to meeting with you and your staff to discuss my qualifications." & vbCrLf & vbCrLf
str = str & "Sincerely," & vbCrLf
str = str & "Richard"
msg.Body = str

msg.Attachments.Add("c:\documents\resume.doc")

msg.Display
Set msg = Nothing
End Sub

You can fixup the file path to resume.doc if need be.

Good luck.
Speaking of Outlook, how will I set-up an outlook on my pc? I don't KNOW how to set up. Please help.Hi , The Macro you created to attach Files Worked perfectly, Thankyou again,
This would've taken me weeks to figure out. If you know of a good website where I can learn how to step by step create my own macro in outlook 2000 let me know.

Unfortunately, I still have the other problem, "creating a macro button" I did exactly as you MENTIONED, View, Toolbars, Customize, New toolbar,
Then I added a "macro" to the new tool Bar. I tried in 'Undocked" and also
"Docked" positions. When I closed outlook and started it again, it was gone,
Even the new listing I made in "customize" new toolbar was also gone, that
tool also disappeared. I do not know what I am doing wrong, I READ on google that several people had this problem. Am I doing something wrong here, should
I save the tool Bar setting somehow, I do now know where., but the same
disappearance keeps happening again. Anyother possible solutions to this problem. Thankyou, RicHi,

I just WANTED to add, also that even when I select one of the "default"
tool bars, which are "advanced" and "web" , They also disappear
when I restart outlook the next time. The only tool bar that stays
there when I restart is the "Standard" tool bar.

1258.

Solve : Unrecognized Database Format?

Answer»

I'm unable to create a database application using visual basic 6 enterprise EDITION. When I put the address in the "DatabaseName" property of "Data" control and then want to select the table using "RecordSource" property, it says: Unrecognized Databse FORMAT. I'm using a .mdb Microsoft Access databse. I'd like to know why it is not working.
Thanks.What control are you using to link to the table?

You need to be using the ADO Data Control. The properties and methods are similar to the old DataControl.

Good luck. I used the MS ActiveX Data Object Control but it does not have "DatabaseName" property so where to ENTER the .mdb database name ? It just have recordsource Assuming you're up to date with VB and MDAC service, you need to make a reference to the Microsoft ActiveX Data Objects 2.8 Library.

Both the RecordSource and the Databasename are properties. The Databasename field allows the user to visually find the database on the system. The RecordSource field will bring up a list of the tables and allow you to choose one.

You can also do this by CREATING a ADODB.Connection and a ADODB.Recordset from within the code. I usually do this as it allows more flexibility.

Another thing you might try is to create a DSN through the ODBC Data Source applet in the control panel.

Good luck.

1259.

Solve : VBScript min.max?

Answer»

I have a program that I want it to minimize it SELF then maximize it self 2 times using a loop how can I do this?

Tan_ZaQuote

I have a program that I want it to minimize it self then maximize it self 2 times using a loop how can I do this?

Not sure what you're referring to. VBScript does not have any native support for windows. If you use the cscript engine, the script runs within the cmd shell. If you use the wscript engine, the script runs inside windows without an entry on the taskbar.

If you create an object that SUPPORTS windows, then you'd need to use that object's properties to minimize and maximize the window.

Perhaps if you showed us the script we could be more helpful. he could be referring to full blown VB.

If that's the CASE, one would need to toggle the WindowState property.Well the code is not very important because it is just the very start of a new program right so then what happens next is that it MINIMIZES it self, then it restores it self back into what it was when it started. This I think runs in the command line.

'cscript min_max.vbs' is how I run it.

If you still can't help me with that information I'll show the code.

Tan_ZaQuote from: Tan_Za on January 08, 2009, 04:24:32 PM
Well the code is not very important because it is just the very start of a new program right so then what happens next is that it minimizes it self, then it restores it self back into what it was when it started. This I think runs in the command line.

'cscript min_max.vbs' is how I run it.

If you still can't help me with that information I'll show the code.

Tan_Za

VBScript doesn't handle windows, as Sidewinder stated.

do you want it to minimize the console window?yes that it what I ment...

If it was possible to minimize a msg DIALOG that you create?
e.g.

dim msg
msg = msgbox("Don't click ok, ok...")

just an example,
Tan_ZaMessageboxes are dialog windows- they cannot be minimized.

And minimizing the console window, I don't know if that's possible.hmm, that makes things a little worse meh I'll get used to it...
Perl looks like a better language to learn anyway.

Tan_ZaQuote from: Tan_Za on January 08, 2009, 05:02:52 PM
hmm, that makes things a little worse meh I'll get used to it...
Perl looks like a better language to learn anyway.

Tan_Za

Perl doesn't have window management either, at least not intrinsically. I believe there are some PPM's in development (probably done now) that implement both OLE interop and window creation/management.

problem being they aren't cross-compatible with any Linux Window management systems. But I doubt that was a concern anyway since VBScript isn't on Linux either.Yes I realized that and it doesn't really matter because to do this I just used C to do this via making my own window and messing with it.

Tan_Za
1260.

Solve : Perl random and count?

Answer»

I have decided to START to learn a new programming language, which in this case if perl. I have got 6 numbers that get RANDOMLY printed on the screen and I want to be able to count how many times each number show up/get's randomly picked. My code is below of what I have done so far.

Code:

#!/usr/local/bin/perl

# VARIABLES
@counter = (1 .. 200);
@numbers = (1, 2, 3, 4, 5, 6);


for $i (@counter) {
my @numbers = (1, 2, 3, 4, 5, 6);
PRINT $numbers[int rand scalar @numbers], "\N";

}

Any help would be, well helpfull,
Tan_Za

1261.

Solve : Debugger looking for CRT0.C?

Answer»

I debug the simple file through mcvc6 or msvc2005 but as SOON as i click on RUN it asked me for crt0.c .

Can any one tell me how crtc0.c works?
thanks for help .I found everything from spyware to an ACCESS violation. In this context you may have an access violation in your code.

Is your code handling exceptions? If you're using Visual STUDIO or one of the Express Editions, this fix may help:

Quote

Did you try handling exceptions as they are thrown? (Under Debug | Exceptions ... and then pick access violation under WIN32 Exceptions).
Source: Access Violation

Good luck.
1262.

Solve : Convert wav sound to PC Speaker??

Answer»

How would I write a program to convert a wav file into BEEP Statments for C++? Is this even possible?What EXACTLY do you MEAN?

I have a program made in C++ where, when you press a key on the keyboard, it makes a different beep depending on the key you pressed.

You want to MAKE a .wav file beep?It would be theorectically possible to analyse different frequences in a .wav file and make different beep sounds based on this. However, this would be very complex and i have no idea how you would GO about it.

1263.

Solve : New User??

Answer»

I am trying to learn V script to HELP a friend with a project. What would be some good 'proof-of-concept' programs/ CODE snippets to look up so I can get the basics down?If you're looking to TEACH VBScript (something I have no experience in), there are many tutorials at your DISPOSAL online:

http://www.google.com/search?q=Vbscript+tutorials&btnG=SearchI'm actually looking to learn it

1264.

Solve : VB Text Highlights??

Answer»

Simple QUESTION...
In Visual BASIC 2008...
How would i kill the HIGHLIGHT behind the "CONTINENTAL AIRLINES" label?
[/url]

1265.

Solve : decompile dll?

Answer»

is there anyway to decompile a dll into its original SOURCE code ( not assembly ) ?There are products that can CONVERT binaries to source code, but most likely will not be the source code the original PROGRAMMER wrote.

Also, they lack comments and USE generic names for variables. Making it real fun to TRY ot figure out what is going on.

1266.

Solve : Help! Microsoft Visual Basic!?

Answer»

Im trying to make a fake progress bar ()
That will go up 1 VALUE every second. Can anyone do this for me?


Thanks,
Bailey HerbertQuote

Im trying to make a fake progress bar

Please explain more. VB has a real progress bar control of which you can increase the value based on a count or a TIME INTERVAL or any NUMERICAL value. Any reason you cannot use that?

1267.

Solve : java.lang.NullPointerException?

Answer»

I am a beginner in Java programming, and I am writing my first program. I am really enjoying it, but now I have a problem which I cannot solve. Each time I am building the code I dont get any error, but when I run it the following error is displayed.

Exception in thread "MAIN" java.lang.NullPointerException

The code is the following :

public class MAINCLASS {

public static void main(String args[]) {

Case[] CASES = new Case [2];
INT c_location, s_location, ISBN_no;



for(int counter1 = 0; counter1 < 2; counter1 ++ ){
for(int COUNTER2 = 0; counter2 < 5; counter2 ++ ){
for(int counter3 = 0; counter3 < 20; counter3 ++ ){

cases[counter1].shelf[counter2].book[counter3] = new Book((counter3),(counter3 + 1),(counter3 + 2));

}
}
}

}

}


Any help please ?

1268.

Solve : in display(html)?

Answer»

I want to make a paragraph right, well that is simple just '

put something here


but my problem is that I want few CERTAIN symbols. Below is what I want to do.

access connect:

<--

JDBC Data Source-0



where the ARROWS are is what I want the web site to display the <> stuff(not the

or the
).

In batch there is a WAY to hide operational symbols by putting a '^' infront of the symbol is there a similar way to do that in html?

any thing WELCOME,
Tan_ZaYou'll need to use HTML entities.

< = &AMP;lt;
> = &gt;

See here: http://www.w3schools.com/tags/ref_ascii.aspthanks :-)

Tan_Za

1269.

Solve : The programming song?

Answer»

For your reading entertainment...

(Sung to the TUNE of "100 bottles of Beer on the Wall".)

Oh, 100 lines of bugs in the code,
100 lines of bugs,
You hack and debug, and re-com-pile,
101 lines of bugs in the code!

101 lines of bugs in the code,
101 lines of bugs,
You hack and debug, and re-com-pile,
102 lines of bugs in the code!


Etc, etc... Hmmmmm......Shouldn't the number of bugs go down?Quote from: Carbon Dudeoxide on September 29, 2008, 02:32:15 AM

Hmmmmm......Shouldn't the number of bugs go down?

ha ha Carbon, so naive, so naive...

here, I'll compose one as WELL.


I examined in the debugger
my program which had crashed
without a single warning
it happened in a flash
and then it came before me
the debugger on the line
a pointer has a null value
how very assinine

And so to test my theory
I inserted a lot of checks
in a vain attempt to avoid
becoming a nervous wreck
so I recompile sure of the bugs defeat
I run the program and to my surprise
it's still standing on it's feet.
the program it still crashes
of this I am QUITE sure.
and so for the 5th time
I'm back to debug more.



wow, that isn't so BAD for an on the fly poem!Thunder roared, lightning crashed, TREE fell down and a bug got smashed.

Oh well...poetry ain't my thing...
1270.

Solve : Button Codes Needed!?

Answer»

JavaScript, or HTML works on my website (Only)


I need a button that will SHUTDOWN your computer,
A Button that will close the window you click it in,
A button that will generate a NEW page WHILE copying one page. (Description: I need a dorpdown menu that will have all my pages, (I put them in,) and click the button. It finds the LINK with the page "www..com/???.html", COPIES it, and makes it with a text I typed into a form BESIDE the dropdown.)


Can anyone help? Thanks!1. No JavaScript or HTML can shotdown a PC.

2. Use:
Code: [Select]<a href="javascript:window.close()">Close Window</a>
3. Not sure what you mean by this one...

Is this homework?

1271.

Solve : need help turning .class into .jar?

Answer» OK i had extracted a .jar file to modify the CONTENTS, it made about 10 .class files. i modified what i NEEDED to and now i dont know how to convert them back into .jar files please can SOME1 help me
Franka .jar file is simply a renamed zip file with no compression.

you MIGHT need an actual unzipping program, if you don't have one already.
1272.

Solve : VB path problem... File not found?

Answer»

I made sure the file exists and I'm still getting problems.
Code: [Select]A first chance exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.VisualBasic.dllCode: [Select]Using MyReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser _
("C:\Documents and Settings\Nick\Desktop\readertest.txt")I'm a VB6 Programmer, so forgive me for my ignorance-


If my knowledge of .NET is correct, "using" is used to specify what assemblies and classes you would like to use without qualifying their names fully; for example:
Code: [Select]Using Microsoft.VisualBasic.FileIO.*
the way your using it now, it would seem more appropriate to use the Dim statement, as in:

Code: [Select]Dim MyReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser _
("C:\Documents and Settings\Nick\Desktop\readertest.txt")
yeah, i guess that makes sense. I got my snippet from MSDN so it might not be express 2005 formatted or whatever. but that will make it read the file then?or maybe you can just help with all new code. I want to read text out a text file, and SET it as variables to be used later. the thing is I need like probably about 20 variables in the text file.Quote

I made sure the file exists and I'm still getting problems.

How did you check?

Code: [Select]If My.Computer.FileSystem.FileExists("c://Check.txt")
MsgBox("File found.")
Else
MsgBox("File not found.")
End If

By the way, if your file is delimited, you were on the right track with Using MyReader:

This is the entire snippet from the MSDN help:
Code: [Select]Using MyReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser("C:\Documents and Settings\Nick\Desktop\readertest.txt")
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
Dim currentField As String
For Each currentField In currentRow
MsgBox(currentField)
Next
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message & _
"is not valid and will be skipped.")
End Try
End While
End Using

Good LUCK. Sorry Gamerx365, LOOKS like I sent you down the wrong path.

I never said I was a .NET programmer.Quote from: Sidewinder on September 26, 2008, 02:31:42 PM
Quote
I made sure the file exists and I'm still getting problems.
How did you check?
i made sure it was there, and also I checked the path from the PROPERTIES. I've tried the file in different places also.Quote
i made sure it was there, and also I checked the path from the properties

Please explain. Have you checked the file existence with program code? Is Nick your userid? You may not have permissions for the file.

Only other thing I can think of is the hidden attribute of the file is flipped on.


well i CREATED the file right before trying this. Yes i'm using nick as my userid. I went to the source and it was visible is what i mean when i said i made sure it was there. I probably dont have admissions. my step dad is retarded and changed the password on my admin account.
1273.

Solve : constructor destructor error and sntax error?

Answer»

I have written a code that is surpose to output questions from a file after that the program should input all the answers to an array then afterwards close the file. in implementation program the answers program should re-open to allow me to read the answers from the answers file and check whether they are correct or not.

THE PROBLEM IS THAT THIS KEEPS ON GIVING ME THE SAME ERROR WHICH IS IN LINE 10 ("expected constructor,destructor or some kind of conversion before .")

if anyone has an idea on how I should GO about solving this problem COULD he or she PLZ reply. thanks in advance.

#include
#include
#include
#include
using namespace std;
#include"final.h"


//fstream funda;
//funda.open("answers.txt",ios::in)



/*if(funda.fail())
{
cerr<<"could not open ditails file"<exit(1);
}*/

final::final()
{
}
final::final(string n,string id)
{

setname(n);
setstudnum(id);
getname();
getstudnum();
//setanswers();
//getanswers();



}

/*void final::setanswers()
{ char h;
for(int n=0;n<10;n++)
{
while(h!=' ')
{cin.ignore();
funda>>h;
ans[n]=h;
}
h='a';
}

}*/
int final::getscore()
{
return SCORE;
}

void final::setname(string n)
{
name=n;
}

void final::setstudnum(string id)
{
studnum=id;
}

void final::checkanswer()
{
char correct[10]={'B','B','B','D','C','C','B','A','C','C'};

ans[10];
int score=0;

for(int j=0;j<10;j++)
{
if(correct[j]==ans[j])
{
score+=3;
}
else
{score-=3;}
}
//funda.close();
}
string final::getname()
{
return name;
}
string final::getstudnum()
{
return studnum;
}

this is the implimentation program

1274.

Solve : VB Coding Question?

Answer»

Hello all! I'm trying to make a program to where when a user inputs their name and selects a color of what they want their name to be will display within the program. But my issue is trying to get a image that is supposed to switch from on to off.

For example, I want the user to have to click on a light bulb to turn on and then click it to turn off...

But at the bottom it will state "Turn off the light, Danny." and when the user clicks on the "on light bulb" it will turn off and then the text will display as "Turn on the light, Danny", and then once they click on the image it will go back to the previous statement to turn off the light.

I'm having difficulties trying to figure out how to go about coding that part. I have everything else, but I'm stuck on how to get the text to change along with the image.

Any ideas?

If you need to see what I have coded so far, please let me know and I'll copy and paste it here along with a screen shot of what the program looks like. Do you mean a status bar? It would help to see what you have so far. Also, is this VB6 or VB.Net?It is Visual Studio .NET 2005 but I have it set for Visual Basic for the IDE Settings. I hope that makes sense?

Here's the coding I have so far.

Code: [Select]Public Class MainForm

PRIVATE Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub RedRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedRadioButton.CheckedChanged
' Display the current text color and message.

MessageLabel.Text = "Turn on the light, " & NameTextBox.Text
MessageLabel.ForeColor = Color.Red

End Sub

Private Sub GreenRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GreenRadioButton.CheckedChanged
' Display the current text color and message.

MessageLabel.Text = "Turn on the light, " & NameTextBox.Text
MessageLabel.ForeColor = Color.Green

End Sub

Private Sub BlackRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlackRadioButton.CheckedChanged
' Display the current text color and message.

MessageLabel.Text = "Turn on the light, " & NameTextBox.Text
MessageLabel.ForeColor = Color.Black

End Sub

Private Sub BlueRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlueRadioButton.CheckedChanged
' Display the current text color and message.

MessageLabel.Text = "Turn on the light, " & NameTextBox.Text
MessageLabel.ForeColor = Color.Blue
End Sub

Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
' PRINT the form in the Print PREVIEW window.

PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub

Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
' End the program.

Me.Close()
End Sub

Private Sub LightOffPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LightOffPictureBox.Click

End Sub

Private Sub LightOnPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LightOnPictureBox.Click

End Sub
End Class

I have attached what the program looks like when it first runs, and when you PUT in your name... Now you will only see one image, because the other image is behind the off light bulb but.

[Saving space - attachment deleted by admin]Instead of using two image controls you could use just one and alternate the image that is currently displayed in it. You could then add a click event to the image control. Using a boolean variable you could check to see if the light is on. If it's off display the "light on" image and vice versa.

1275.

Solve : Visual Studio 2008 - VB - Background work?

Answer»

YAY ! Got this done allready

Found this on internet:

Code: [Select]Public Class Form1
Dim accessLock As New Object
Dim endThread As Boolean = FALSE
Dim PlayThread As New System.Threading.Thread(AddressOf CodeInThread)

Private Sub CodeInThread()
Dim keepRunning As Boolean = True

While keepRunning 'keeps thread running forever


'We lock, because that is one WAY of ensuring that no other thread
'is accessing the same variables at the same TIME
SyncLock accessLock
If endThread Then
keepRunning = False
End If
End SyncLock
End While 'loop forever until keepRunning = False

'keepRunning now equals false
'put cleanup code here

'when the sub finishes, the thread ends
End Sub

Public Sub StopThread()
SyncLock accessLock
endThread = True
End SyncLock
End Sub

Private Sub StopBtn_Click(BYVAL sender As System.Object, ByVal e As System.EventArgs) HANDLES StopBtn.Click
StopThread()
End Sub

Private Sub StartBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartBtn.Click
PlayThread.Start()
End Sub
End Class

everythink its working now thanks for helping lol, that's the method I just described lol, didnt know you are talking about that well, it uses a form-level variable to flag when the thread should end. that was what I meant.

good to hear you got it workin.

what is this for? Just curious.Its should be a metronome, that used when you play guitar

1276.

Solve : calendar control?

Answer»

In an Access database, I want the user to select a date using the CALENDAR control and have the selection POPULATE a date field rather than have the user type a date directly into the field. How do I ARRANGE for the calendar to open and how do I bind it to the date field?

Thanks for any assistance.I think i can HELP you, but what version of access do you have?Hi Cohen,

Currently, we're using Access 2003.

1277.

Solve : kernel zip file??

Answer»

Does anybody know of, or would be willing to create me, a SET of software for windows to create a kernel?If you want to play with Kernels I'd play with Linux. As for creating a Kernel with a software for Windows, you will find yourself using a PACKAGE like Borland or MS C++ and if creating from scratch you will need LOTS of help. Its easier to modify the wheel then to reinvent it in the case of kernels, and Linux lets you do that without any worry about legality. Bill Gates doesnt like any competition / clones of his software and operating systems, so trying to reinvent Windows or DOS would be a lost cause and up hill legality battle. Closest Kernel yet to touch on MS territory that I know of is FREEDOS, and the only reason why this is not a major ISSUE for MS is only because they havent created a FREEWINDOWS.

If you want to make your own kernel I would learn C++ and Assembly Language.

As for myself I tweaked Linux Kernels with friends back in college and that was cool, but we were only able to make the slightest of MODIFICATIONS without breaking it. A kernel is a very sensitive object!Thanks for the reply. I was just wondering if there was, like, a kernel IDE or something. By the way, anybody, dosent video memory start at b8000?QUOTE from: helper on January 05, 2009, 11:17:59 AM

a kernel IDE

anything from drivers down isn't possible to debug on the fly, unless you use remote debugging.
1278.

Solve : basic programming?

Answer»

I have a batch file that copies files from a DESIGN file to a computer running an automated cutting machine. At present, we use XCOPY to copy over all existing files and ADD newly created files. I want to be ABLE to only copy to the cutter computer files with a newer date and newly created files. We change drill holes to notches on the cutter and do not want to lose that if the existing files did not change. Help.Welcome to the CH forums.

Have you tried the /D and /U options in XCopy? (XCopy/? at the command prompt to display).

Perhaps we'd be able to assist you further if you post your XCopy command line.Thank you. Yes, I will post the lines that are in the file now. Everything is turned off - I will post in the morning.Ok. here is the batch file.

:cutter 1
deltree /Y C:\ISO\Specials\*.*
XCopy \\Nesterfoam\Specials\*.* /s C:\ISO\Specials\*.*
XCopy \\Nest3\Cutterfiles\*.* /s C:\ISO\*.* /s /d
XCopy \\Nesterfoam\partordernesterfoam\*.* /s C:\ISO\partordernesterfoam\*.*
echo cutter files transfered
:cont
pause


The fourth line down is the issue.
I originally wanted to only copy over files in the cutter if the source file was newer than destination file. I can use the /d without specifying a date to accomplish this. However, the fourth line down is not working. I will VERIFY if Nest3 ans cutterfiles exist, but can anyone tell me if line four is in the correct order.?.
Help.please do not double post.
Merged.Quote

XCopy \\Nest3\Cutterfiles\*.* /s C:\ISO\*.* /s /d

Try it without the double /S

1279.

Solve : Typematic rate delay?

Answer»

In qbasic 1.1, when I use an ON KEY for the arrow keys, for example:
Code: [Select]...
ON KEY(11) GOSUB up
KEY(11) ON
...
DO WHILE INKEY$ <> CHR$(27) 'Esc
LOCATE 1,1: PRINT response
LOCATE y,X: PRINT "*" 'qbasic, with the locate command, uses rows before column thus y,x
LOOP
END
...
up:
y = y - 1
Response = "up"
GOSUB checkxy
RETURN
...
checkxy:
If x > 23 THEN x = 23
IF x < 1 THEN x = 1
IF y > 79 THEN y = 79
IF y < 10 THEN y = 10
RETURN
When I press the up arow, it moves the asterisk up one row, waits for half a SECOND, and then the asterisk moves again, continuously up rows. How MIGHT I CHANGE this so that when I press and hold the up arrow it just moves my asterisk without the delay?

This has been a problem across Qbasic and VB.net for me for a while with different programs, and I've never worked it out...

Thanks,
BonesI found a solution for vb, actually, but not one for qbasic. Here's the vb one, as sourced from experts-exchange, http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_20654594.html?sfQueryTermInfo=1+repeat

Code: [Select]General Declarations:
dim x as integer
dim y as integer



Sub Form_KeyDown (keycode As Integer, Shift As Integer)
Select Case (keycode)

Case 37
keyleft = 1

Case 39
keyup = 1

Case 38
keyright = 1

Case 40
keydown = 1

End Select

End Sub




Sub Form_KeyUp (keycode As Integer, Shift As Integer)
Select Case (keycode)

Case 37
keyleft = 0

Case 39
keyup = 0

Case 38
keyright = 0

Case 40
keydown = 0

End Select

End Sub




Sub Timer1_Timer ()

If keyright=1 then x=x+1
If keyleft=1 then x=x-1
If keyup=1 then y=y+1
If keyright=1 then y=y-1

End Sub

This isn't terribly helpful for use with qbasic.... and incase anyones wondering why i'm using qbasic, its because my palmtop has MS-DOS 5.0 on it,

1280.

Solve : Odd Startup...?

Answer»

In june, I reformatted this computer. When I modified the startup items in MSCONFIG, i restsrted, and now, everytimne it STARTS, it comes up qwith a BLACK screen that says start windows XP, or start windows recovery console. I odn't think this is suposed to happen. It is an hp pavilion a1400e, if that helpes at all.

thx

Tick the box down the bottom to fix it that will prevent it from COMING up on start up again

1281.

Solve : Flash Button?

Answer»

Code: [SELECT]next_btn.on(RELEASE) {
_root.backgrounds.gotoAndPlay(nextFrame);
}

why does it say that the first LINE has an extra character?and is that correct for ACTION Script 3.0?

1282.

Solve : Making a pic?

Answer»

I know this ISNT the right section..or i think so but it ACTUALLY is the right section..

I was wondering how i could attach COMMENTS on a picture, like a flash PIC, FIRST the pic shows hey, then, what up, then whatever....something like that.

If somebody could help me to do that I would be like really happy, the best day of my life happy... ;D Something like a tutorial?

Any examples?

1283.

Solve : Getting response from MessageBox()?

Answer»

I use Borland C++ 3.1 (because its small in size & gives everything a learner needs).I wanted to learn the MESSAGEBOX() so I wrote the following CODE:-

MessageBox(NULL,
"Message Box",
"Continue your ACTION",
"MB_ICONQUESTION | MB_YESNO);

How to find out what it RETURN, better if anyone gives the code.
Thanks in advance

1284.

Solve : * as batch file password characters?

Answer»

I've been searching and searching codes to hide characters for a batch file password. Can anyone help? There are THIRD PARTY programs that can do this. A likely solution would be a C program, however you have the tools to do this yourself with a debug script:

Code: [Select]A
MOV AH,0C ;function flush buffer
INT 21 ;DOS call
MOV AH,0A ;function buffered input
INT 21 ;DOS call
MOV DL,AL ;store user input
MOV AH,4C ;function exit
INT 21 ;DOS call

RCX
14
N PSWDHIDE.COM
W
Q


The last line of the script is intentionally left blank. Save the script with a scr extension and from the command line run debug < scriptname.scr

The resulting file, pswdhide.com, can be incorporated into your batch file to mask input at the console:

Code: [Select]@echo off
set /p userid=Enter UserId:
:retry
set /p password=Enter password: <nul
for /f "tokens=*" %%i in ('pswdhide.com') do set password=%%i
if %password%==password goto next
cls
echo Incorrect password, TRY Again
goto retry

:next
echo. & echo You are logged in!

While all this is very entertaining, the password is hiding in plain sight. This is a definite security breach. Might be better to hide the password in a file, database or even the registry. While still not 100% secure, it should SLOW down all but the most determined hacker.

Note: if you put pswdhide.com in a directory on your path, any of your batch files can use it.

Good luck. thanks for replying to my mail, what am trying to do is to catch out the person who keeps using my laptop, i was told 3 simple batch files can help me, i have set the first but having problems with the password batch tho, i have a time log batch for when my start bar is opened, a program used batch working but the pass word batch is a bother Quote

i was told 3 simple batch files can help me, i have set the first but having problems with the password batch tho, i have a time log batch for when my start bar is opened, a program used batch working but the pass word batch is a bother

Where did the info come from? Vista is a Windows OS and I suspect you can FIND any information you need in the event logs. For instance you can check event code 528 (logins) in the security log which should pinpoint all the users who used your machine (including you).

The batch file above was nothing more than a slick demonstration of how to introduce a password to a batch file. Unfortunately, it does nothing to enhance the security of Windows. As explained in the PM's, any user could bypass the password security by directly starting the application from a shortcut or the run box.

Quote
what am trying to do is to catch out the person who keeps using my laptop

How does this work? Do you leave your PC unattended and another person uses your PC? Does this other person login with your credentials or his own? If you change your password, will this prevent someone else using your machine? I really need for you to layout the scenario on how this other person gets access to your PC.

1285.

Solve : simula 67?

Answer»
can someone give me a compiler fir simula67? i REALLY nid it for my class presentation. i KNOW simula 67 is obsolete nowadays. i can't find some of it..can someone mind if they can elp me..yanks it will be a great help for me.. i am currently using windows XP..with a memory of 256 Mb..i want to know if in what platform is simula 67 running...You MAY want to read here->

http://en.wikipedia.org/wiki/Simula67

and

http://www.iro.umontreal.ca/~simula/tnx a lot....but still i can't find any compiler for it..it gave me information for my REPORT..tnx..in what platform does simula 67 run?After the PM I found another thing if it is of any use->
http://prosjekt.ring.hibu.no/simula/download.htm
1286.

Solve : Solved - "Dissassembling a C++ .LIB or .OBJ"?

Answer»

Does anybody know how to disassemble a C++ .LIB or .OBJ file?you can use the dumpbin program to dissasemble a program.


DUMPBIN FILE.OBJ /DISASM > FILE.ASM
Is it built in(I DONT think so) or where do I find it?
oh... yeah. Not everybody has Visual Studio... DUH!


Here are a few I managed to dig up, Not sure if they'll work with OBJ or LIB.


Say- why do you want to dissassemble it anyway?Sorry, I was late.

Quote from: BC_Programmer on November 26, 2008, 01:18:47 AM

Here are a few I managed to dig up, Not sure if they'll work with OBJ or LIB.
What links?

Quote from: BC_Programmer on November 26, 2008, 01:18:47 AM
Say- why do you want to dissassemble it anyway?
To find the declaration of POW(), and a few other functions.





lol.

oops.


I forget the link I had on my clipboard at that time. But another search found a program called "hackman"

It claims to be able to dissasemble from OBJ and BIN.

http://www.freewareweb.com/cgi-bin/archive.cgi?ID=185

Strictly speaking, "decompile" is the word, surely?
decompile would turn it back into source code.so,
technically, disassembling is a special case of decompiling, just into a particular language, ASM.Thanks, GUYS.
1287.

Solve : GDI+ Slowly??

Answer»

So I have my command for drawing a line in GDI+ for visual basic .net

In this case I am drawing a graph and have a huge set of points through an array of x() and y() and this is one of my code lines -

scr_graphics.DrawLine(mypen, x(0), y(0), x(1), y(1))

The program works cool, but how MIGHT I make it so that it draws the line slowly, RATHER than it being instantly there? So maybe over a period of 3 SECONDS it draws the line?

thanks
BonesYou might try drawing the line in segments and using a LOOP to calculate the start and end points of each segment. By using the thread.sleep method you could introduce a delay between segments.

Good luck.

1288.

Solve : Windows Programming in Visual C++ 2008 Express?

Answer»

I wanted to LEARN Windows Programming in Visual C++ 2008 EXPRESS. Could anybody suggest any book or tutorial.There should be something here for you.

Good luckQuote from: DUSTY on October 05, 2008, 01:10:36 AM

There should be something here for you.

Thanks Dusty ? !
1289.

Solve : Zoom in/out for java graph.?

Answer»

I have generated a GRAPH using java, but WITHOUT using any external packages like jfreechart etc. Now is it possible to add a zoom in/out feature, with or without using external packages? And how? I have GOOGLED a lot but not getting anything.

Simple graph using only java NOTHING special in that. Just how do I add a zoom in/out feature to it.

1290.

Solve : Detecting collision in C?

Answer»

Could anyone help me detect collision between two graphical objects (a BULLET and a SHIP) [ ] in C.
A sample code is welcome.
Thanks
Please don't think this is my homework or something.
It is my personal interest.
2D or 3D

This article may help and even comes with some sample code.

GOOD LUCK. Presently 2D. Hey, thanks for the great link..
this reminds me of the nightmare I had with my kinematics program. Wasn't so much determining wether there was a collision (all objects were circles, so it was a simple distance test to see if they were closer then the sum of their radii, but rather the physics involved...

it was a great exercise, I guess- revisiting it now, I can hardly BELIEVE I spent so much time on it.Was it a nightmare or an animation?
Please explain..no- I meant nightmare as in pain in the @$$, not a dream.

Found out a good way to say PITA without offending the bots...

1291.

Solve : Need to convert a dos batch into c++?

Answer»

Hi,

Recently, DUE to hardware changes, I can't USE my dos batch file anymore.
The only solution is to transcode the batchfile into another platform such as c++ but I don't know that language.
It's a short batch, used to search through a txt file and notify if the entered value is actually in the file.
Is someone willing to translate it or having another solution ?
Thx

++++++++++++++++++++++++++++++++++++++++++++++++++
echo off
cls

:BEGIN
set /P number=Enter Number :
findstr /x %number% serial.txt
if errorlevel 1 goto BEGIN
if errorlevel 0 ECHO Number appears in serial.txt
goto BEGIN
++++++++++++++++++++++++++++++++++++++++++++++++++Hi, without knowing which OS you have it is hard to know which flavor of C++ should be used.

If your are using Linux, you should post on the Linux forum.

If that is all you need, C++ is a BIT of overkill If you have another option I'm listening.
The goal is to make a program similar to the one on top that works on newer hardware (palm / pda / blackberry ... whatever will do the job).
Most of those new gadgets don't work well using dos.OK, now I see whet you mean.
Some of the new hand-held gadgets use embedded Linux, but if there is no shell you can't do much.
So the word on the street is you program in java if at all possible. The is a lot of support for java and it is cross-platform. You can get better performance with C++ at the expensive maybe of less peer support.
And some say try JavaScript.
Then there are those who say write it in C.

1292.

Solve : Program function stuck in the running!!!?

Answer»

Hi I am currently writing a program in C that is like an arithmetic system for kids. The teacher user can add,modify,delete questions from the question bank.so i have writen functions for all of these but the thing is whenever I GET to the delete function it stops running after asking the user the questions they want to delete. Like I press enter and then try one more time but it just gets stuck there no message or anything just stuck.I PERSONALLY think there is something wrong with the file openind and closing.
Below is the function, can ANYBODY pls help me and see what's wrong.

void delexpr(void){
FILE *fp;
int qno,i=0;
struct question buffer;

clrscr();
fflush(stdin);
printf("\n");
printf("%sDeleting an Arithmetic Expression from the Question Bank\n",INDENT);
printf("%s^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",INDENT);
printf("\n");
showexpr();
printf("\n");
fp = fopen("question.dat", "rb");
if (fp==NULL){
printf("File Error!\n");
}
else{
printf("Please enter the number of the expression that you want to delete:");
scanf("%d\n", &qno);

for(i=0;i<numq;i++){
while(i!=qno){
buffer=bank;
}
}
}fclose(fp);
fp = fopen("question.dat", "wb"); //open the binary file q.dat for updating
if (fp==NULL){
printf("File Error!\n");
}
else {
for(i=0;i<numq;i++){
fwrite(&buffer,sizeof(struct question),1,fp);
fclose(fp);
}
}
TAB4;
showexpr();
TAB4;
printf("Expression Deleted!\n");


printf("\n");
}


bank is the array for the question bank and so is buffer but it is only a temporary one
and showexpr() is another function that displays all the questions.
Pls see if anyone can help me...I was thinking that maybe you are missing a #include for the fstream, but if it compiles it cant be that. Also looked at your bracers and all and I dont see any problem. Maybe someone else will point out what we are both missing here.

1293.

Solve : Where Do I Start?

Answer»

Ok I have been takeing a C++ Programming class through school. I am about 3/4 done with this class.

I Have made about 5 Different Text Based RPGs. What i wan to know is where do i start when it comes to makeing a 3d game. it doesn't have to be complex.

I want to know how to...
1. Load a level
2. Load a character
3. make the character MOVE around the level
4. What things i need to include in the code.

I am going to finish my programming class first because i know it will be more helpful to have a better understanding of programming before i start, but i still would like to know what i have to do to begin.

btw- I have tried getting books from the library, searching internet, asking my schools technition, but i haven't had any luck.

Please HELP!!!i did the same thing as you, did some text rpgs then began a 3d one. My advice: learn how to interface with DIRECTX or openGl first - it took me a few hours before i'd even managed to draw a 3d cube using GDI+, and then to interface with it (i tried to make it spin in various ways) i first had to learn about radians, because i know angles in degrees, then I had to learn some advanced trig functions, then the cubes ended up going WONKY, then i had to train myself to think completely differently to how I do at school with graphs because the x and y and z were inverted, and then after a week all i'd made was a cube you could walk through and turn around in.

Its a full time JOB making 3d games...

1294.

Solve : VBS: Can it shut down a PC??

Answer»

Can VBScript shut down a PC?
Can it shut down all PCs on a LAN?Quote

Can VBScript shut down a PC?

Yes. This little snippet will shutdown the local computer.

Code: [Select]strComputer = "."
Set objWMIService = GetObject_
("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(1)
Next

Quote
Can it shut down all PCs on a LAN?

Only if the PC's are part of a domain. This little snippet will shutdown 3 computers on the network.

Code: [Select]arrComputer = Array("Computer1", "Computer2", "Computer3")

For Each strComputer In arrComputer
Set objWMIService = GetObject _
("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(1)
Next
Next

If none of these are helpful, check out PsTools, specifically PsExec. VBScript can launch a new process with the Run method.

Good luck.

Woah, thanks. The only VBS I EVER heard of it .vbs or VBScriptWhat?Quote from: DFND-jimjim1 on December 29, 2008, 07:39:08 AM
The only VBS I ever heard of it .vbs or VBScript

Can the second script above be used to restart the PC instead of shutdown...?I've never used WMI myself, but you might be able to change:
Code: [Select]For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(1)
Next

into:
Code: [Select]For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Restart(1)
Next

Or, it could require simply changing the parameter to Win32Shutdown from 1 to something else...

Yup, I'd imagine it's something like that.

I'm just starting with VBS... I don't think there is a restart method to the Win32_OperatingSystem class. Try using the REBOOT method.

Code: [Select]For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot(2)
Next

Good luck. Thanks again, I'll test it tomorrow...Quote from: Sidewinder on December 31, 2008, 11:59:23 AM
I don't think there is a restart method to the Win32_OperatingSystem class. Try using the reboot method.

Code: [Select]For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot(2)
Next

Good luck.

well, if this darn notepad had intellisense like the vb6 IDE...Quote from: BC_Programmer on December 31, 2008, 01:31:51 PM
well, if this darn notepad had intellisense like the vb6 IDE...

Excuses, excuses.... Quote from: kpac on January 01, 2009, 06:40:18 AM
Quote from: BC_Programmer on December 31, 2008, 01:31:51 PM
well, if this darn notepad had intellisense like the vb6 IDE...

Excuses, excuses....

I'm not sure the VB6 IDE would be helpful here. For the WMI CLASSES I've always used WbemTest which gets installed on systems with WMI.

The program itself is a quagmire, but if you're looking for classes with their methods and properties, this is the place to go.

Before getting involved with this utility, a stop at Don's is suggested. actually, I shouldn't of said Intellisense, but rather the BUILT in object browser. Besides, using WMI to shutdown windows via VB6 would be silly, since it would be far easier to make a simple API call to ShutdownWindowsEx().


1295.

Solve : Asm through packet?

Answer»

I need to know if its possible to send asm through packet small enough but still ABLE to relay information back to a remote server, and execute itself on delivery?Yes, it's called a 'virus'. Please explain why you want to know this. What do you mean by 'asm'?

sure you could send ASM through a packet. Of course the packet would then bounce off any firewall because there was no ACTIVE TCP/IP conversation, and even if there was, the receiving program will likely discard it.

This may come as a surprise, but computers don't unconditionally execute any foreign code that throws itself at any random port.

Quote from: Dias de verano on December 31, 2008, 10:39:20 AM

Yes, it's called a 'virus'.


I'd say a worm, since there doesn't appear to be any duplication ocurring.

although I doubt they're going to go, "Well, now I have control of this persons COMPUTER, I'll fix up these security holes, back up their data, and install a better security solution for them."Quote
I'd say a worm, since there doesn't appear to be any duplication ocurring.

Yes, quite right.

The OP asked about sending "asm". Well, this is what assembler source code looks like: unless the recipient machine has a program already running waiting for some source code, which it will assemble, link and then execute (an extremely unlikely state of affairs) then what would be the POINT? Now, sending machine code, that's another thing.

.model small
.stack
.data
message db "Hello world, I'm learning Assembly !!!", "$"

.code

main proc
mov ax,SEG message
mov ds,ax

mov ah,09
lea dx,message
int 21h

mov ax,4c00h
int 21h
main endp
end main

Quote from: Dias de verano on December 31, 2008, 11:42:07 AM
Now, sending machine code, that's another thing.

somewhat, but we still would have to jump over this hurdle:

Quote from: BC_Programmer on December 31, 2008, 11:13:27 AM
This may come as a surprise, but computers don't unconditionally execute any foreign code that throws itself at any random port.
1296.

Solve : Typedef used in function protype...?

Answer»

I am working on this program to calculate arithmetic questions but I seem to be havin some problem, I used typedefine to define an array and then when I use it as a function prototype it keeps on telling me that it is an illegal expression. I am posting the problematic part only the whole code is tooooooooo long like 600 lines!!!

#define MAXLEN 50

//the typedefinitions
typedef char mystr[MAXLEN];
typedef char exprstr[MAXLEN];

//the function prototypes
int precedence(mystr s); //to return precedence in terms of integers of the operator
void trimspace(char *s); // to remove the space in the input expression
void createinfix (mystr s); //create the infix expression based on the input expression
int isoperator(char c); //to check whether the CHARACTER is an operator
void dumpexpr(expr ); // display the expression for debugging
expr *convert2postfix(expr ); //convert the infix to postfix
void push(expr, int *, mystr); //push an item onto the stack
mystr *pop(expr, int *); // pop and return an item from the stack
void enqueue(expr, int *, int *, mystr); // enqueue an item to the queue
mystr *dequeue(expr, int *, int *); // dequeue and return an item from the queue
void initialexpr(expr); // initial the expression array with null strings
void copyexpr(expr,expr); //copy one expression to the other
float evaluatepostfix(expr);

The problem is with the funtion mystr*pop(expr, int *); in compilation it keeps on telling me that it is an illegal expression I just don't know what is the problem with this thing...would somebody please help me it's really starting to get to me!!!Oh and I am using lcc win32 compiler if that's any help!I have no idea what you are doing! But if I needed an function that I can not defile in the language, I would write it in machine code and put it in a library, or something like that.
Hint: If compilers bug you, don't use compilers. Write in some High Level thing that you can debug line by line. Like maybe Delphi or java or something like that. Why TORMENT yourself with C or whatever you are using unless it has an interactive debugger. Also called Interactive Development Environment. You type something and right away it shows you what is bad and what is good.
And don't do 600 lines and find that it does not work. Crunch it down to maybe 50 lines of code and test it and put it into your own library as a proven function. Number 1 I have to use C because that's the language I learned and I would totally have to rewrite the whole thing if I use another compiler or whatever. And yes I am checking the whole thing bit by bit by breaking the function and it is working just the real thing won't go any further because it is stuck at this error!!!THANKS for the advice anyway Sorry I can not help you. Can you get an Interactive C program that will show you just what is wrong? Or, do you have a 'lint' program that will nag you about your logic and structure?
A general rule is first get it to work, then make it better, faster and smoother.
Using pointers is a real chore. How about writing the program so that you use an index rather than a pointer. Or PASSING value instead of pointers? Yeah pointers are better. But index and value is easier to debug.
Also, you are using #define. That's OK, but you can get by WITHOUT it and ome C compilers can choke on it because it can not do the replacement in some cases. Instead, use a global integer and set its value in the main() part of your code. Yeah, not true blue C, but easier to debug.
What I am saying is make the code so simple and dumb that even your grandma would understand it. You can do it, just keep it simple. An even when done that way it is still smaller and faster than a high level language.
OK,I don't know what I am talking about. I just know that when you try another route, things start to work.
And I still that that you should put as much as you can into a library once it has been validated. And turn on all the debug tools of the compiler. Also, do you have some similar code that compiles perfect? Is it the compiler you always use? Are you one a new version of the OS? Does the compiler require something odd for the OS you are using? Just a thought.
Hope you get it, Maybe somebody else has an idea.

1297.

Solve : VBScript?

Answer»

I think this is in the right section. I used VBScritp before and I was wondering if there is any way to make it so if you hit a BUTTON it can open a batch file or another program?VBScript can run an external APPLICATION through the Script Shell OBJECT:

Code: [Select]Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run(Run COMMAND, Windows STYLE, WaitOnReturn)

Example:

WshShell.Run "C:\Ad-Aware\Ad-Aware.exe",,True

Tying the button to the script is determined by where the button is.

Need more info.

1298.

Solve : ACTIONSCRIPT HELP NEEDED?

Answer»

okay, so the thing is i'm fairly experienced with Macromedia Flash... except for the actionscript. i have only the faintest skills of its syntax and application.

now take for example a PIN number: you need to push a combination of four digits in the correct order to pass. this is almost exactly what i need done with my flash 'game'.
i'm in the midst of creating a flash game type of thing for my website, and to enter the website you first need to click the four buttons in a particular order like its some sort of PIN.

ASSUMING the instance names (and order of clicking) are respectively button1, button2, button3 and button4, what is the actionscript i need to achieve this "PIN number" effect? I've used a password field which COULD be UTILISED as something similar to a PIN format - it just records the digits in one box in a preset order:

var myPassword:String = '1234';

submit_btn.onRelease = function (){
if (password_txt.text == myPassword) {
gotoAndPlay();
} else {
gotoAndStop();
}
}

password_txt is the instance name of the textbox I used. HOPE it helps some.thanks, pcwizard;; studying ur post is giving me a greater understanding of actionscript.. but unless i can enter digits in ur password_txt field by clicking buttons, a password field is no use...
thanks anyway pcwizard

okay, heres my idea:

if you go to my website, all that seems to be there is a brick WALL. the only way to enter the website is to click a select four bricks in the correct order.

that is how i related it to a PIN number;; the clicking four buttons in the right order part. all i need is the actionscript to make that work.

1299.

Solve : c++ winapi - file reading?

Answer»

If i were to PARSE a file multiple times at one TIME, or multiple times THROUGHOUT a SESSION, what would be the most efficient WAY?

1300.

Solve : Visual Basic WaitForExit Problem?

Answer»

..and another hurdle to overcome!

Hi Everyone,

I am using the following code in my VB build:

DIM myProcess As Process
Dim myProcessinfo As New ProcessStartInfo("C:\processname")
myProcessinfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess = Process.Start(myProcessinfo)

myProcess.WaitForExit(360000)
If Not myProcess.HasExited Then
myProcess.Kill()
End If

Everything works ok, the process runs and if it hasn't ended within 6 minutes it's automatically stopped.

Now the problem!

As i'm using the WaitForExit command the whole build does just that - it stops, dead.
I have a progress bar and a flash advert that both stop dead in their tracks until the process is finished - not good!

Is there any WAY I can get VB to wait until the process has finished before the next step commences, RETAIN some control that prevents the process from hanging and also have animations still play?

TIA guys.I've always found the DevX site to be a good source of information. The article is multiple pages so be sure to read the whole thing.

Good luck. Duly noted - and set as homepage!!

Many thanks.