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.

2401.

Solve : hi, im wondering if theres something wrong with python?

Answer»

This is a first attempt at using a programming language. Ok okay here goes...

I downloaded the python installer on my desktop COMPUTER and then copied that installer to usb and installed it onto my laptop computer.

I then OPEN "python (command line)" via windows search

Heres the thing, am I missing files or something?

Because if I type this:
print "hello world"

or if I type:
print 1+1

it tells me this:
>> print "hello world"
File "", line 1
print "hello world"

thanks
how did you execute it ? Open cmd.exe, then type "python". then do it again. If you installed, and do it properly, you won't have a problem

Code: [SELECT]C:\test>python
ActivePython 2.6.4.8 (ActiveState Software Inc.) based on
Python 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)] on wi
Type "help", "copyright", "credits" or "LICENSE" for more information.
>>> print "hello world"
hello world
>>>

2402.

Solve : DOS Command %?

Answer»

How is this command used?The percent sign (%) is not a "command".
Is it used in DOS as a modifier?I think they go around variables, LIKE this:

Code: [Select]@echo off
set %lol% = 1337
echo %lol%
I do not care if I did the set wrong.Quote from: Fleexy on September 11, 2010, 06:31:39 PM

I do not care if I did the set wrong.

Then you are a fool.

Percent signs are used to indicate EXPANDABLE tokens to the command interpreter such as..

Variables

set var=rasputin
echo %var%

Metavariables used by FOR

FOR %%A in (A B C D) DO echo %%A

Passed parameters

@echo off
echo parameter 1 is %1
echo parameter 2 is %2
echo all parameters %*

The name of a batch script

echo this batch file is %0
2403.

Solve : covert a text file into csv using awk?

Answer»

hi...... thanks for allowing me to start a discussion

i am collecting usb usage details of all users and convert it into csv files so that i can EXPORT it into some database..

the input text file is as follows:-


USB History DUMP
by nabiy (c)2008

(1) --- Kingston DataTraveler 130 USB Device

instanceID: 0018F3D974B4A9C0E1760896&0
ParentIdPrefix: 7&b62e00e&2
Last Mounted As: \DosDevices\I:
Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0033
Disk Stamp: 09/07/2010 15:07
Volume Stamp: 09/07/2010 15:07

(2) --- Kingston DataTraveler 2.0 USB Device

instanceID: 001D0F1E35B25B8C1201011B&0
ParentIdPrefix: 7&1f5848f3&0
Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0035
Disk Stamp: 09/06/2010 15:18
Volume Stamp: 09/06/2010 15:18

(3) --- Maxtor OneTouch III USB Device

instanceID: 044303E5&0
ParentIdPrefix:
Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0032
Disk Stamp: 09/10/2010 10:09
Volume Stamp: 03/12/2010 10:42

how can i parse this file so that i can get in following format

hostname Devic_name instanceID ParentPrefix LastMountedAsDriver Disk_Stamp
pcname kingston 001xxxx 7&869 xxxxxx 09/07/2
pcname maxtor 040xxx xxxxx xxxxxx xxxxxx
pcname kingston 033333 55555 xxxxx xxxxxx

inserted device NAME column to insert kingston entries
and the second paragraph act as second raw.....


the output desirable is in csv format for database with some batch or awk script........
any suggestion in this regard is greatly appreciated
thanks in advance/.........

2404.

Solve : I have an assignment?

Answer»

Quote from: ghostdog74 on September 13, 2010, 10:00:00 AM

"how did you do" will be printed, since nothing in the if/else match 100.



I appear to have missed that.

Quote from: Salmon Trout on September 13, 2010, 10:19:25 AM
It might be a kind of "educational pseudocode".


my first thought was C++, but with macros that change things- macros for and to be &&, endif = }, cin >> = input, cout << = input, etc. Sadly, you see that type of thing all the time, and it doesn't make a whole lot of sense. If you want to teach a language that uses, for example, endif, then use such a language, don't just hodgepodge a bunch of C++ macros to do it that way.

Oh well.

The only problem is that there is no starting brace for the if blocks if that was the case.

I'd definitely have to say it's some sort of psuedocode as well.


Quote from: Salmon Trout on September 13, 2010, 10:19:25 AM
A Google search showed that very same assignment was posted on justanswer.com's "Ask a Homework Question, Get an Answer ASAP!" service, "790 DAYS and 19 hours ago.". (You have to pay to see the answer - 3 UK pounds)

I would have suspected as much. It's not like it's particularly difficult- it involves more math concepts then it does programming concepts. Although it's a lot better then the trivia-related questions both in classes as well as as interview question. Stupid, retarded questions that essentially test ones knowledge of a few language corner cases, like "Is it possible for a function to RETURN more often than it is called?" or how does the XXX keyword WORK, or other nonsense. It's pointless to ask such questions- you're trying to make/find programmers, not people who read and memorize language references. You want to find somebody who won't sit around testing out a certain programming construct or modifier to see what it does and will instead actually defer to the language reference to find out; a question like:

Quote
what is the output from
2["hello"]
and why?
Is a completely stupid question. First off, is it really that important that they know how to deal with such trivial corner cases? Sure, it proves they have a handle on pointers, but it also proves that they are willing to make "clever" code when it's not necessary, and their code is probably strewn with ternary conditionals. "clever" code is bad and difficult to read. Clever interview questions are bad because they encourage clever code.

Do you think Big is Billrich? And MichelleCarrothers?
Quote from: Salmon Trout on September 13, 2010, 10:25:32 AM
I don't think Big should have posted what he did, but then he seems to do what he likes, even after being told what forum policy is.

Don't like the competition, eh?Quote
-1 wouldn't be an operand, since the - is a unary minus operator
I GUESS One's Complement doesn't count here (signed bit)? Quote from: Big on September 15, 2010, 06:31:22 AM
I guess One's Complement doesn't count here (signed bit)?

No, because even if that was the case, it would be in the form of an operator (such as C's ~)

Although I imagine there are languages out there that may actually not represent NEGATIVE numbers via unary operators. Don't know any off the top of my head though.Quote from: CBMatt on September 15, 2010, 06:23:58 AM
Don't like the competition, eh?

I resent that. What a stupid remark. Idiotic even. I don't do people's homework for them.
Locked
2405.

Solve : programmer plzz help!!!?

Answer»

PLEASE WRITE A PROGRAM TO PRINT TRIANGLE AS SHOWN BELOW IN PROGRAM OF C++ LANGUAGE
*
* * *
* * * *
* * * * *
* * * * * *You can do that yourself. It is so easy.
(SNIFF, sniff)..............HOMEWORK!!We don't help with homework here.How much do you pay ? )2 pence per post to GET my two CENTS in...

2406.

Solve : Visual C++ .NET 2005 Bitmap Problem?

Answer»

I'm trying to learn how to modify Bitmaps programatically.

As a first attempt, I'm trying to simply create a blank bitmap, programatically change it to all red, and display it in a pictureBox.

The following code builds without error and, under "Start Without DEBUGGING" runs without error except the blank pictureBox remains blank - no red bitmap is displayed in it. Any suggestions?

private: System::Void button1_Click(System::Object^ sender,
System::EVENTARGS^ e)
{
Bitmap^ TempBitmap;
TempBitmap = gcnew Bitmap(33,33);
COLOR TempColor;
unsigned char cArg;
unsigned char cRed;
unsigned char cGreen;
unsigned char cBlue;
for (int i=0; i&LT;33; i++)
{
for (int j=0; j<33; j++)
{
cArg = 255;
cRed = 255;
cGreen = 0;
cBlue = 0;
TempColor.FromArgb(cArg,cRed,cGreen,cBlue);
TempBitmap->SetPixel(i,j,TempColor);
}
}
pictureBox1->Image = TempBitmap;
label4->Text = "DONE";
}

Yes, I know it's inefficient to put the color assignments inside the loop because they never change. But, since that's where I'll eventually put color modifications coding, they make good placeholders.

M. David JOHNSON
[emailprotected]
Thanks to Viorel at social_dot_msdn_dot_microsoft_dot_com, the solution is to replace the TempColor assignment line with:

TempColor = Color::FromArgb(cArg,cRed,cGreen,cBlue);

I’ve tested this and it works.

M. David Johnson
[emailprotected]

2407.

Solve : Create variable whose name is stored in a variable - VB.NET?

Answer»

Hi,

I'm working on a program where I need to declare a variable but the name for this variable is stored in another variable (strange I know) but I have no idea how to do this. I'm using VB.NET 2010. I'm sorry if that's not very clear, I'm not very good at describing things .

Thanks in advanceI don't believe that is possible; sounds more like what you are trying to do could be facilitated using other means (my first thought would be a Dictionary- then you could use the string "name" to lookup the appropriate value. I believe in VB.NET A Generic Dictionary is created using:

Code: [Select]Dim DictVar As Dictionary(Of String,Object)
where Object can of course be whatever type you intend to be using.

If you can provide more details on what exactly you are trying to do with the program, I'm sure me or somebody else could suggest something that could work for you.The part of the program that this is for occurs when the user selects a menu item they are prompted by means of an input box to ENTER a name for a button control, the button is then added to the form with that specific name.

This is the code i'm using to create the button - "CONTROL_NAME" is where I'd want the name from the variable to be added.
Code: [Select]Dim CONTROL_NAME As New Button

CONTROL_NAME.Text = TempButtonName
CONTROL_NAME.Size = New Size(100, 50)
CONTROL_NAME.Location = New Point(100, 100)
Me.Controls.Add(CONTROL_NAME)
All I want is to be able to add a control such as a button to the form that has a name specified by the user.Ahh, I see what you are trying to do.

Well, it looks more like you would want to use an array- or, more precisely (and as I noted earlier) a dictionary. After all, it would be utterly pointless to have the variable name not known until run-time, because the code that is supposed to use and manipulate that variable are written far earlier.

Here is one approach to dynamically adding Buttons; I use a dictionary.

-Create a Form (just stick with Form1) in a new test app; Create a textbox and a button (use the default names), ideally laid out near the top, with some vertical space underneath.
-Paste the following into the Declarations Section:

Code: [Select]Dim CurrentYPos As Integer
Dim LoadedButtons As Dictionary(Of String, Button) = New Dictionary(Of String, Button)()

The "CurrentYPos" variable is used for purely aesthetic purposes; LoadedButtons is used to keep track of all the buttons loaded so far. Note that it is "indexed" using the name the user specified.

In the Button1 Click event, paste this:

Code: [Select] 'get the name to use from the string.

Dim newbuttonname As String = TextBox1.Text
If newbuttonname = "" Then
MessageBox.Show("You must specify a Name.")

ElseIf LoadedButtons.Contains(newbuttonname) Then
MessageBox.Show("Name Already Exists.")
Else

'Create the button
Dim createdButton = New Button()
createdButton.Name = newbuttonname
createdButton.Text = "Button named " + newbuttonname
createdButton.Location = New Point(TextBox1.Left, CurrentYPos)
createdButton.Size = Button1.Size
createdButton.WIDTH = TextWidth(createdButton.Text, createdButton.Font) * 2
CurrentYPos += createdButton.Height
'use "CreatedClick" for it's event handler
AddHandler createdButton.Click, AddressOf CreatedClick
Controls.Add(createdButton)
LoadedButtons.Add(newbuttonname, createdButton)
End If



Code: [Select]Control

the Load event of the Form requires this, otherwise it starts the buttons at the top of the form:

[code]
CurrentYPos = TextBox1.Bottom + 5

And lastly, paste this at the bottom of the code listing:

Code: [Select] Private FUNCTION TextWidth(ByVal measurestring As String, ByVal useFont As Font) As Integer
Dim usebitmap As Bitmap = New Bitmap(1, 1)
Dim Useg As Graphics = Graphics.FromImage(usebitmap)
Return Useg.MeasureString(measurestring, useFont).Width

End Function
Private Sub CreatedClick(ByVal Sender As Object, ByVal Args As EventArgs)
Dim gotcontrol As Control = Sender
MessageBox.Show("You clicked on " + gotcontrol.Name)
End Sub

One notable portion is the use of "AddHandler" to link of the buttons to the same Event procedure. I feel that this may in many ways be the sort of THING you need (I'm guessing you want to handle the events of controls you add but the only way you were aware of was the use of the Handles clause on the end of a Sub definition, but that needs a control name, thus the requirement to have "user-defined" control names, etc).

After that, it's added to the Controls collection of the form, and then to the LoadedButtons Dictionary. The latter is purely for Access purposes- without it, it would be difficult to reference the controls outside their event procedures (the AddClick routine) since they wouldn't really have any Form-level reference. (note that controls that you add to a form aren't made implicitly available by the form as "properties" like those you add at design time; the Form DESIGNER creates boilerplate code that adds properties for the controls you add at design time, but no such addition is done at run-time, so you have to do that management yourself.

Using this method, you can also access a specific control using the "name": that the user gave it, via the dictionary:

Code: [Select]String choosebuttonname="Whatever"
If LoadedButtons.ContainsKey(choosebuttonname) Then
Button chosenbutton = LoadedButtons[choosebuttonname].Value
Else
MessageBox.Show("Control name not found.")
End If


I hope this helps.



That's great - Thanks!

2408.

Solve : Questions need solving please ??

Answer» 1. Design a class to represent a geometric rectangle with a given length and width, such that it
is capable of calculating the AREA and the perimeter of the rectangle.


2. Define a class that represents a TEMPERATURE object. It should store the CURRENT temperature
in an instance variable of type double, and it should have two public methods,
setTemp(double t), which assigns t to the instance variable, and getTemp(), which returns the
value of the instance variable.


3. Define a class named TaxWhiz that computes the sales TAX for a purchase. It should store
the current tax RATE as an instance variable. You can initialize the rate using a TaxWhiz()
method. This class should have one public method, calcTax(double purchase), which returns
a double, whose value is purchases times the tax rate. For example, if the tax rate is 4
percent, 0.04, and the purchase is $100, the calcTax() should return 4.0



Many thanks to all of you.





Figure 1.8.
Sorry, we don't do homework.
2409.

Solve : log in bot??

Answer»

i hope i do this right XD

I want to make a script that will can log into my account and then logout/close IE, then make a loop so it will repeat itself :3
But i'm pretty new with this, and i can only make a script that will open IE and log me into the account :3

set a = createobject("wscript.shell")
a.run "inset URL here"
wscript.sleep (5000)
a.sendkeys ("inset username")
a.sendkeys chr(9)
wscript.sleep (2000)
a.sendkeys ("inset Password")
a.sendkeys "{Enter}"
call msgbox("all done :3")
wscript.quit
This may help. Sendkeys can be useful in limited circumstances, but sometime it's easier to create an object (Internet Explorer) and use it's built-in properties and methods.

Code: [Select]Set a = createobject("wscript.shell")
Set IE = CreateObject("InternetExplorer.Application")

For i = 1 To 3
IE.Navigate "inset URL here"
Do Until IE.ReadyState = 4
WScript.Sleep 1000
Loop
IE.Visible = True

WScript.sleep (5000)
a.sendkeys ("inset username")
a.sendkeys chr(9)
WScript.sleep (2000)
a.sendkeys ("inset Password")
a.sendkeys "{Enter}"
WScript.Sleep 2000
a.SendKeys "%{F4}"
Call msgbox("all done : " &AMP; i)
WScript.Sleep 2000
Next

IE.Quit
wscript.quit

Good luck. use a tool like wget/curl to do internet automation, like getting web pages and doing basic authentication etc... you don't have to worry about which browser to use and other dependencies (eg slow IE opening etc ).thanks but there seems to be an ERROR in the script >>
my plan was to make an logincounter raise but it seems harder than i thoughtQuote from: cookiemonster on September 20, 2010, 02:46:05 AM

thanks but there seems to be an error in the script >>
my plan was to make an logincounter raise but it seems harder than i thought

Could you be more specific. What is the exact error message you're getting? If it's a logic error please EXPLAIN. The logincounter is the i variable which iterates sequentially from ONE to three and controls how may TIMES the loop is executed (3). It is also displayed in the msgbox while the loop is active.

I cannot reproduce any errors, but perhaps if we knew the URL, it would help determine how the site is navigated. There is a VBScript object alternative to using IE.

Let us know.
2410.

Solve : PHP - how to send/receive multiple select boxes??

Answer» HEY guys,

I'm in NEED of URGENT PHP help.

I have a table displaying hockey players from a database (no fixed number of players) and the last column allows the user to change/update player's status. There are three choices in each select box, the user can select only one for each player displayed in the table.

I added a hidden field with player's id to know who to update, I'm stuck as to how to setup select boxes. Will they all have the same name? is there some kind of array I should be using? How do I receive this data on another page to process and update the database.

Thanks to all in advance.

ultimatum.Nvm, just figured it out.

For those interested here is how you set it up:

Hidden field:
Code: [Select]&LT;input type='hidden' name='playerId[]' value='someValue' />
Select boxes:
Code: [Select]<select name='rStatus[]'>
<option value='xyz'>xyz</option>
<option value='xyz'>xyz</option>
<option value='xyz'>xyz</option>
<option value='xyz'>xyz</option></td>
</select>
This is just to check if SELECT BOXes work because actual processing is a little different but you can use your imagination:
Code: [Select]foreach($_POST['rStatus'] as $new_status)
{
//$query = "UPDATE players SET status= '$new_status' WHERE id = $new_id";
echo $new_status."<br />";
}
Same applies to the hidden values, just change the name in $_POST['here'] area.

Cheers.
Thanks for posting the code.

You may want to htmlentities() and strip_tags() before adding to the database THOUGH, to prevent XSS.Very good point. I excluded that mainly because the project is kind of small (20 users) and log-in to the page is already secure.

Thanks for the tip kpac.
2411.

Solve : MSN Client in java - MSNP18 help.?

Answer»

Hello all!
I really can't find any guides as to connecting to msn server ETC using MSN protocol 18, i managed to connect using protocol8/12 FINE, but i wanted to use the newer protocol.
Its the ACTUAL msnp commands im having trouble with. im following [http://msnpiki.msnfanatic.com/index.php/MSNP18:Example_Session] as a guide.
Code: [Select]>> VER 1 MSNP18 MSNP17 CVR0

<< VER 1 MSNP18

>> CVR 2 0x0409 winnt 5.1 i386 MSNMSGR 14.0.8089.0726 msmsgs [emailprotected]

<< CVR 2 14.0.8089 14.0.8089 14.0.8089 http://msgruser.dlservice.microsoft.com/download/0/9/7/0974F7CD-D082-46FE-922D-806670345793/en/wlsetup-cvr.exe http://download.live.com/?sku=messenger

>> USR 3 SSO I [emailprotected]

<< GCF 0 4698
<Policies>...</Policies>

<< USR 3 SSO S MBI_KEY_OLD 3n/+CVePUqAMCoYWgC4WSGHkYaIJckjgBL6XRM/OpmPXa (not real)

>> USR 4 SSO S t=EwB4AswbAQAUHk1FhNEXbmKm1vLQXxw= {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (not real)

<< USR 4 OK [emailprotected] 1 0\r\n

These are the commands sent/received back and foward.
Now, i can get up to this part:
Code: [Select]<< USR 3 SSO S MBI_KEY_OLD 3n/+CVePUqAMCoYWgC4WSGHkYaIJckjgBL6XRM/OpmPXa (not real)
But i have no idea as to what they do with the string to produce:
Code: [Select]"=EwB4AswbAQAUHk1FhNEXbmKm1vLQXxw= {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
which they then foward back to the NS(notification server).
I've opened msn up with WPE and logged the packets and it just comes up as the above. The " USR 3 SSO S MBI_KEY_OLD 3n/+CVePUqAMCoYWgC4WSGHkYaIJckjgBL6XRM/OpmPXa" is sent to my address, then msn fowards "USR 4 SSO S t=EwB4AswbAQAUHk1FhNEXbmKm1vLQXxw= {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (not real)" back to its NS. So im assuming its turning the string into some kind of digest on my pc? Any help would be appreciated, im trying to recreate my own MSN client in java and well i've posted on multiple forums but nobody seems to be able to help me,
anyhelp would be great! cheers!bump

2412.

Solve : Corrupt MSWSOCK.dll?

Answer»

In trying to learn Winsock2 programming with Visual C++ 2005 Pro on Windows XP Pro SP3, I've run into a problem with an apparently corrupt MSWSOCK.dll.

Here's what I've tried so far:

// This is my second attempt at Winsock2 programming
// A console PROGRAM built from the code given at
// http://www.tenouk.com/Winsock/visualstudio2008ncnwinsock2.html
// MDJ 2010/09/22

// Run on Windows XP Pro machine, version 2002, SP 2
// C++ from Visual Studio 2008 Pro Edition
#include
#include

// MDJ added the include below to further implement Winsock2

// Also added WS2_32.LIB and MSWSOCK.DLL under
// Project|Windock2Test002 Properties|
// Configuration Properties|Linker|Input|
// Additional Dependencies

// Also set Project|Windock2Test002 Properties|
// Configuration Properties|C/C++|Advanced|Compile As
// to Compile as C Code (/TC).

// Got error message:
// 1>LINK : fatal error LNK1104: cannot open file 'MSWSOCK.DLL'
// Therefore: commented out the following include and
// removed the MSWSOCK.DLL from the Additional
// Dependencies list.

// [BUILD] succeded.
// [Debug|Start Without Debugging] worked.

// Searched system to find MSWSOCK.DLL - 2/6/2010 at:
// C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL.
// Added complete path to Additional Dependencies list.
// Uncommented the following include. Got:
// 1>C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2A8
// Tried earlier 8/4/2004 version at:
// C:\WINDOWS\system32\MSWSOCK.DLL.
// Got same result. Tried 2/6/2010 version at:
// C:\WINDOWS\$NtServicePackUninstall$\MSWSOCK.DLL.
// Got same result.

// Renamed MSWSOCK.DLL to MSWSOCKOld.DLL at:
// C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL and at:
// C:\WINDOWS\system32\MSWSOCK.DLL.
// Downloaded new MSWSOCK.dll from:
// http://www.dll-files.com/dllindex/dll-files.shtml?mswsock
// to C:\downloadsHold\DLLs\mswsock then unzipped.
// Version 11/18/2004 - copied to:
// C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL and
// C:\WINDOWS\system32\MSWSOCK.DLL.
// Changed Additional Dependencies list to:
// C:\WINDOWS\system32\MSWSOCK.DLL. Got:
// 1>C:\WINDOWS\system32\MSWSOCK.DLL : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2A8

#include

int main()
{
WORD wVersionRequested;
WSADATA wsaData;
int wsaerr;

// Using MAKEWORD macro, Winsock version request 2.2
wVersionRequested = MAKEWORD(2, 2);
wsaerr = WSAStartup(wVersionRequested, &wsaData);

if (wsaerr != 0)
{
/* Tell the USER that we could not find a usable */
/* WinSock DLL.*/
printf("The Winsock dll not FOUND!\n");
return 0;
}
else
{
printf("The Winsock dll found!\n");
printf("The STATUS: %s.\n", wsaData.szSystemStatus);
}

/* Confirm that the WinSock DLL supports 2.2. */
/* Note that if the DLL supports versions greater */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */

if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2 )
{
/* Tell the user that we could not find a usable */
/* WinSock DLL.*/
printf("The dll do not support the Winsock version %u.%u!\n", LOBYTE(wsaData.wVersion),HIBYTE(wsaData.wVersion));
WSACleanup();
return 0;
}
else
{
printf("The dll supports the Winsock version %u.%u!\n", LOBYTE(wsaData.wVersion),HIBYTE(wsaData.wVersion));
printf("The highest version this dll can support: %u.%u\n", LOBYTE(wsaData.wHighVersion), HIBYTE(wsaData.wHighVersion));
}

/* More task... */
return 0;
}

I've also searched the forum here and at codeguru.com and at bytes.com and at GeekPolice and at the SocialMSDNVisualC++Forum and found no help on this issue.

Any suggestions would be appreciated.

M. David Johnson

Banfa at bytes.com and S_M_A at codeguru.com both wrote that I should link on mswsock.lib instead of mswsock.dll.

I tried that and it worked.

M. David Johnson

2413.

Solve : QUESTION PAPER u give me a answer of one day?

Answer»

Mr. Yuganda is an astrologer. To impress people, he asks people their
birth date & immediately tells them the day when they were born and number of
Sundays in that year. For e g, he asked me my birth date i.e., 23rd July 1989.
And he said me that it was Sunday, which was correct and number of Sundays
are 53. Your task is to write a program which will prove that it is simple work to
calculate day and number of days in that year when user enters any date. Your
program should ask for date, month, year separated by “/”. If it is VALID then it
should print the day.
e.g.
Input:
Enter the date : 23/07/1989
Output:
Entered date is 23rd April 1989
Leap year : NO
Day is Sunday
No. of days : 265
No. of Sundays : 53
Code Frenzy Page 2 of 9
Question 2 :
Write a program to print following pattern
11234
54322
33456
76544
55678
(Note there is no gap between two rows and numbers).
Question 3 :
I am always interested in interchanging the digits in the number. One day
I noticed that when I interchanged the position of the digits in the prime no., the
new number is also the prime number, but this is not possible for all prime
numbers. Then I came to the conclusion that some prime numbers are circularly
prime numbers.( A circular prime is a prime number that remains prime on any
cyclic rotation of its digits.)Find all such prime numbers up to the limit entered
and total count of the numbers.
Input
Enter the limit: 100
Output:
The numbers are: 2, 3, 5, 7, 13, 17, 37, 79
Total numbers are: 8
Code Frenzy Page 3 of 9
Question 4 :
Everyone is having interest in the rearrangement. Find all such
rearrangements possible with 0-9 digits without repetition of digits in the
number and count them. The number should CONTAIN distinct digits. The number
should not start from digit 0.
e.g.
Output
8547963120,1509784632.
Total numbers:
------------------------------------------------------------------------------------------------
Question 5 :
Mr.Gaikwad always like to find the numbers which are Palindrome (A
palindrome is a word or sentence that reads the same forward as it does
backward e.g.121) in radix 10 (decimal numbers) and in given radix. Find all
such numbers and count them.Your program should take radix as input and
count all numbers upto 1000000.
Note : - Radix means base of that number.10-decimal,2-binary,8-octal,etc
Radix must be greater than 0 and less than 10.
e.g.
Input : -
Enter radix : - 2
Code Frenzy Page 4 of 9
Output : -
Decimal Radix -2
5 101
Total number : - ...
------------------------------------------------------------------------------------------------
Question 6 :
Write a program which prints the following pattern :
1 2 3 4 5 4 3 2 1
2 3 4 5 5 4 3 2
3 4 5 5 4 3
4 5 5 4
5 5
------------------------------------------------------------------------------------------------
Question 7:
File Handling is always very interesting part of C/C++ language. But the
information stored in the file might be understandable to other users, hence
some sort of cryptography is required. I think that reversing of the words in the
statement of the file is the better cryptography. Write a program to take input
file name which contain well indented matter, and your program should create
a new file which contains the line-wise reverse words but KEEPING the paragraph
same and display the contents of the new file.
Code Frenzy Page 5 of 9
e.g.
Suppose Code.txt contains the following data
C language was developed by Dennis Ritchie. It was developed in AT&T
Bell Labs.C language is the higher level language.
Input :-
Enter file name : Code.txt
Output : -
File name :-Crypt_code.txt
Contents: -
Ritchie Dennis by developed was language C. Labs Bell AT&T in
developed was It. Language level higher the is language C.
Questions 8.
I am a strong supporter of C language. I believe that any database can be
designed with using C-programming language. Support me by writing an
application that will perform following operations on the employee database
1.Insertion of record in the file
Note: - Employee database contains attributes Emp_no,
Name,Salary,Address,Pin_code,Phone_no.
2.Display the coloumn according to given ATTRIBUTE.
Code Frenzy Page 6 of 9
If you enter Name and Salary,then the output should be Name and
respective salary and it should be properly arranged in two columns. Your
program should take attributes as input from the user.
Sample Output:
Name Salary
Sunil Gaikwad 35000
Saurabh Atkari 30000
3. Sorting of the records According to the given attribute.
Your program should take input attribute from user and according that
attribute your program should sort the records in the file. Sorting must in
ascending order.
e.g.
Input : Name
Output :
Contents of the file
Name Salary
Saurabh Atkari 30000
Sunil Gaikwad 35000
Your whole program should go like this.
Code Frenzy Page 7 of 9
Menu
1. Insert a record in the file.
2. Display the records
3. Sort the records
4.Exit
Enter your choice :
------------------------------------------------------------------------------------------------
Question 9:
Write a program which has a function which will execute before main()
and another function which will execute after main() function. And then prints
the following output , when in the respective blocks:
“Before main()”
“In main()”
“After main()”
------------------------------------------------------------------------------------------------
Code Frenzy Page 8 of 9
Questions 10:
Write a program which prints screen full of blinking smiley and continue
printing until any key is not pressed.
Output:
------------------------------------------------------------------------------------------------
Thank You
&
Best of Luck
------------------------------------------------------------------------------------------------I told you yesterday you have to do your own homework.

2414.

Solve : Help with Flowchart...?

Answer»

I'm new to this. And my tutor at my college was no help. I'm lost....I'm hoping I can get some assistance....I'm trying to draw a flowchart that WOULD provide a workable solution to the following problem...

management wants a printed report that lists a worker's NAME and the number of hours of overtime the PERSON worked that week. At the end of the report there must be a total of all the overtime worked that week...

1. the data is in a file on a disk.
2. each record contains the required fields and may include fields that are not needed for this problem.
3. the end of the file record will contain**.* in the hours worked field.
4. if a person did not work overtime there name should not appear on the list. It will be in the file if they worked at all.
5. assume that the file will be read one record at a time(read one record, process that record, print the report line if the person worked overtime, then get the next record.
6. a standard work week is 40 hours; any time over 40 hours is overtime.
7. assume that the file has been verified and there will be no ERRORSAND what you have done so far? I believe many would help by pointing out where you have done mistakes or what you have missed, but none would do all the work for you from scratch.Visio is very simple flowcharting software and easy to learn. You could also do it in powerpoint if you're good with that. Or there's the old fashioned way of getting out your template (I still have mine), a sharp pencil and a piece of paper. And I AGREE with Luthfi - what have you done so far?

2415.

Solve : how can I change label and change it to the textbox in C Sharp???

Answer»

Sir thank you for, as a one computer beginner to ask a question here in C Sharp !!

I WANT to asked a question in C Sharp.Net, because I have a minor program that I get in to study for my profession.And I studied in ebook in C Sharp and I do the exercises there and doing also a program and I got a problem from there in my form.

It`s because I click already the label control from toolbox.And I double clicked it and to do some CODES for it.And I didn`t mean it that I had a wrong control that I clicked.It is the textbox that I mean to click but I mistaken to look it correctly and I done the wrong control label.

And now I got some difficulties to CHANGE it into textbox.Because I done also the the coding there in it. Sir did you get what I mean??
HELLO Dave,

I'm trying to understand what you mean.
Do you mean that you accidentally created an Event Handler for a label control and now
when you do something in the text box, nothing happens?
If that's the case, in Design View, click on the control on your form (the label),
look at your Solution Explorer on the right, then look at the properties window.
There should be a lightning sign. Click on the lightning sign and look in that list
for something like Label1_Click. If it's there, you may remove it.

It's just a guess of your problem.
Can you please explain your problem in other words?

Quote from: dave_trodeau2000 on September 24, 2010, 03:28:12 AM

Sir thank you for, as a one computer beginner to ask a question here in C Sharp !!

I want to asked a question in C Sharp.Net, because I have a minor program that I get in to study for my profession.And I studied in ebook in C Sharp and I do the exercises there and doing also a program and I got a problem from there in my form.

It`s because I click already the label control from toolbox.And I double clicked it and to do some codes for it.And I didn`t mean it that I had a wrong control that I clicked.It is the textbox that I mean to click but I mistaken to look it correctly and I done the wrong control label.

And now I got some difficulties to change it into textbox.Because I done also the the coding there in it. Sir did you get what I mean??

Copy the code you mistakenly placed in the Label's event, and place it in the textbox event.
2416.

Solve : give me a answer of this ques?

Answer»

Mr. Yuganda is an ASTROLOGER. To impress PEOPLE, he asks people their
birth date & immediately tells them the day when they were born and number of
Sundays in that year. For e g, he asked me my birth date i.e., 23rd July 1989.
And he said me that it was Sunday, which was correct and number of Sundays
are 53. Your TASK is to write a program which will prove that it is simple work to
calculate day and number of days in that year when user enters any date. Your
program should ask for date, MONTH, year SEPARATED by “/”. If it is valid then it
should print the day.
e.g.
Input:
Enter the date : 23/07/1989
Output:
Entered date is 23rd April 1989
Leap year : NO
Day is Sunday
No. of days : 265
No. of Sundays : 53We don't do homework.

2417.

Solve : Batch file for remote desktop?

Answer» HELLO dear users,

I have Windows XP. And every morning i need to connect to 63 PC's via RDC. I just need to know, if connections OK i'll close it.

Maybe you have some batch file, where i can put with delay all my ip's ? Batch file need to check if connection (ip respond) that all ok. Without any users names and pwd. Or maybe i need some batch file which will ping all ip's and make a report ?

Best Regards, MikeI don't fully understand what your trying to do


But there is a way to ping the COMPUTERS using a batch file, like this one:

CODE: [Select]@echo off
ping 192.168.24.56
pause
exitBut can i add there several IPs with name ? And after this action view some result ?

for example:

159.152.152.152 Boss-1
159.125.124.478 Boss-2

and so on. And after all i can SEE that Boss-1 didn't reply. Couse it is very hard to connect at one time to 60 PC-s every day.

Thanks, Mike
2418.

Solve : Is there a way to read Ajax return results on a page??

Answer» HEY guys,

Does anyone know if there is a WAY to read these OPTIONS from a pop-up which uses Ajax?

Site: http://www.cisco-servicefinder.com/

Try inputting this model into By Product SKU: ASR1000 (you'll see a pop-up which will set the VALUE of the product based on your selection). My QUESTION, is there a way to select a choice programatically using PHP or C#?

Thank you in advance,



ultimatum
2419.

Solve : File path in Visual Studio?

Answer»

I been storing my image and other files in "bin" folder ever since, because is easy to write file path.
The problem with that is when publishing the application, you will lose those path making the program not recognising my files and throwing errors.
How can i solve this problem without using my resource folder because you can not access files using string.
Where should i create my new folder and what directory path should i use so when publish, it will not cause an errors?

Thank you Personally When I start a new program I have it load resources (images, sounds) from the Application directory- using AppDomain.CurrentDomain.BaseDirectory. (this is the directory the executable is RUNNING from). Most of the loading of images/sounds is done by a set of classes I made explicitly for this purpose- SoundManager and ImageManager. The former uses a Library I found online, the latter loads Images and caches them. I GENERALLY make them static properties of a ubiquitous class, so that there is only one instance. I then either use a variable initializer to create them (their constructors accept a file path) or a static constructor. the latter is what I eventually settle on, since it allows the image and sound folders to be moved via an INI file that also get's loaded.

As a general rule Program resources should be STORED and ACCESSED from %APPDATA%\Program name. Optionally, you can use %APPDATA%\Company Name\Program name. One would build a path like this using Path.Combine, something like this:

Code: [Select]String ImageFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),"MyGame\Images");

Then you could, for example, use the .NET File access classes to loop through all the files and FIND applicable image files, or you could directory load specific images from those folders, depending on your use case.Thanks you
I let you know!

2420.

Solve : gawk help?

Answer»

Someone help PLEASE. I tried to do it with FINDSTR but I couldn't, so now I'm trying to OUTPUT the following numbers from this text file with gawk (what I need is in bold down below):


Analyzing pool.ntp.org (1 of 1)...
delayoffset from local clock
Stratum: 2

Warning:
Reverse name resolution is BEST EFFORT. It may not be
correct since RefID field in time packets differs across
NTP implementations and may not be using IP addresses.



pool.ntp.org[155.101.3.115:123]:
ICMP: 73ms
NTP: +0.0162516s RefID: 127-67-113-92.pool.ukrtel.net [92.113.67.127]


What I want to output is in bold. How can I do this with Gawk? With my limited knowledge I can only output:
Code: [Select]+0.0162516s RefID
But I would like to just have Code: [Select]0.0162516
Is this possible?
Code: [Select]C:\test>gawk "/NTP:/{print $2}" file
+0.0162516s

2421.

Solve : Delphi/pascal transparent TImages or objects?

Answer»

Hi,

I want to know how to make a TImage in DELPHI/pascal transparent. I do know that there is a property that allow you todo this but thats not what im after. I want to beable to make the transparancy have levels e.g level 0 is fully visable, level 5 is half visable and level 10 is transparent/invisable.

Just if you want to know i use delphi 7 or dev-pascal

Thx,
Tan_ZaQuote from: Tan_Za on September 28, 2010, 12:42:43 AM

Hi,

I want to know how to make a TImage in delphi/pascal transparent. I do know that there is a property that allow you todo this but thats not what im after. I want to beable to make the transparancy have levels e.g level 0 is fully visable, level 5 is half visable and level 10 is transparent/invisable.

Just if you want to know i use delphi 7 or dev-pascal

Thx,
Tan_Za
The word you are looking for is Translucency, (transparent=fully see through, translucent means it's partially see-through, as you want).

Word semantics aside, a google turned up this thread:

http://stackoverflow.com/questions/2998069/delphi-image-with-alpha-blending-capabilities

Quote
The basic TImage is capable of displaying a PNG image and alpha-blend-it to whatever is BEHIND it. You just need to add the "pngimage" unit to the uses clause of your form. You didn't mention the version of Delphi you're on: Delphi 2010 has this unit, but I have no idea with what version of Delphi they started shipping it. For Delphi 7 I know for sure you'll need to FIND the open source "pngimage".

If you need to do this when the user moves in and out of your control, CONSIDER caching the state images in bitmaps: it will be faster at runtime and you can use a single TImage that shows the current image, you don't need two overlapping TIMage controls.

I believe they are referring to PNGDelphi.

The information that you gave me was GOOD but it was more based around making forms alpha blend not images or objects, if you have anymore ideas it would be greatly welcomed..

Regards,
Tan_ZaQuote from: Tan_Za on September 28, 2010, 01:53:24 AM
The information that you gave me was good but it was more based around making forms alpha blend not images or objects


No it wasn't. Both links discuss Alpha-blendable Images, not forms. Although some of the responses on the stackoverflow thread are incorrect and offer such assistance re: forms.
2422.

Solve : C++ linked list HELP!!!?

Answer»

Hi. I'm having trouble understanding how to write a linked list in c++. I have to create one for a school assignment but I cannot figure out how to access certain nodes from the list. I know how a linked list WORKS, but I just get so confused over all the pointer usage and stuff. If someone, anyone, can provide a simple, clear, and easy to understand example of how to implement a linked list, it will be GREATLY appreciated. Thank you
Quote

I know how a linked list works, but I just get so confused over all the pointer usage and stuff.
I also don't understand everything about linked lists, but I can give a good example of how to use them. Probably better than most of the things you may have searched up on google.

Quote
I cannot figure out how to access certain nodes
A linked list is designed to be accessed sequentially, not randomly. If you need to be accessing specific nodes, then an array would be best.

Quote
If someone, anyone, can provide a simple, clear, and easy to understand example
I am designing a programming language and it uses a linked list to store the tokens (words/commands). Here is how I implemented it:

This part creates a structure called program to hold the commands. It has two pointers so that the list can be read forwards and backwards.
Code: [Select]//Double linked list for program
typedef struct program
{
struct program* prev;
struct program* next;
char* data; //CHANGE THIS TO DATA TYPE REQUIRED
};
program *node, *head = 0, *tail = 0;

This part opens a text file and stores the "words" into the linked list.
Code: [Select]//Remove newline char
void choppy(char *s)
{
s[strcspn(s,"\n")] = '\0';
}

int main(int argc, char *argv[])
{
char iobuf[255];
char* ptr;
FILE* fp = fopen(argv[1],"r");
if(fp != NULL)
{
while(fgets(iobuf,sizeof(iobuf),fp) != NULL)
{
choppy(iobuf);
ptr = strtok(iobuf,STR_TAB_SPACE);
while(ptr != NULL)
{
node = (program*)malloc(sizeof(program));
node->next = NULL;
node->prev = NULL;
node->data = (char*)malloc(strlen(ptr)+1);
strcpy(node->data,ptr);
if(head == NULL)
{
head = tail = node;
}
else
{
tail->next = node;
node->prev = tail;
tail = node;
}
ptr = strtok(NULL,STR_TAB_SPACE);
}
}
fclose(fp);
node = head;
//displaylogo();
//interpret();
}
}

Now the following methods can be used to TRAVERSE the linked list. You will have to change the data type from char to whatever the datatype of your linked list is.
Code: [Select]//Movement functions
char* str_forward()
{
if(node)
{
node = node->next;
return node->data;
}
else
return NULL;
}

char* str_backward()
{
if(node)
{
node = node->prev;
return node->data;
}
else
return NULL;
}

char* str_stationary()
{
return node->data;
}

I just realized that aparently returning NULL is bad, you probably should use return 0;A few mistakes I just noticed:

In the method str_forward:
if(node) should be if(node != tail)

In the method str_backward:
if(node) should be if(node != head)

In the main method:
The constant STR_TAB_SPACE should be INITIALIZED like so...
const char STR_TAB_SPACE[3] = {32, 9, 0};the big "mistake" being that your code is pure C, and he wanted C++. Not hugely different aside from the fact that a C++ solution would probably use a class.

That being said, rather the critique I think I will try my hand.

The most common method to create a LinkedList via C++ (or any class-oriented approach, really) is to make a "main" LinkedList class, and then have it hold a reference to a single "Node" class, which acts as the list "head". The Node classes hold references to their Next (and in the case of a doubly-linked-list, Previous) items, and would provide all manner if methods to manipulate and access the contents.

First, the header files:

LinkedListNode.h:
Code: [Select]#pragma once


class LinkedListNode
{
private:
LinkedListNode* Next;
LinkedListNode* Prev;
void* Value;

public:
LinkedListNode(LinkedListNode* pPrev,LinkedListNode* pNext,void* pValue);
~LinkedListNode();
LinkedListNode* getNext();
LinkedListNode* getPrev();
void setNext(LinkedListNode* newnext);
void setPrev(LinkedListNode* newprev);
void* getValue();
void setValue(void* value);


};


BCLinkedList.h
Code: [Select]#pragma once
#include "LinkedListNode.h"
class BCLinkedList
{


private:
LinkedListNode* listhead;
public:
BCLinkedList(void);
~BCLinkedList(void);
void setHead(LinkedListNode* newhead);
LinkedListNode* getHead();
LinkedListNode* getItem(int index);
};

Now, to flesh out the definitions with some actual code!

LinkedListNode.cpp:
Code: [Select]#include "StdAfx.h"
#include "LinkedListNode.h"


LinkedListNode::LinkedListNode(LinkedListNode* pPrev,LinkedListNode* pNext,void* pValue)
{
Next=pNext;
Prev=pPrev;
Value=pValue;


}
void LinkedListNode::setValue(void *value)
{
Value=value;


}
void* LinkedListNode::getValue()
{
return Value;


}
LinkedListNode* LinkedListNode::getNext()
{

return Next;


}
LinkedListNode* LinkedListNode::getPrev()
{
return Prev;


}
void LinkedListNode::setNext(LinkedListNode *newnext)
{

Next = newnext;


}
void LinkedListNode::setPrev(LinkedListNode *newprev)
{
Prev = newprev;



}


and the linkedList class itself:

Code: [Select]#include "StdAfx.h"
#include "BCLinkedList.h"

BCLinkedList::BCLinkedList(void)
{





}



BCLinkedList::~BCLinkedList(void)
{
}
// void setHead(LinkedListNode* newhead);
//LinkedListNode* getHead();
LinkedListNode* BCLinkedList::getHead()
{
return listhead;


}
void BCLinkedList::setHead(LinkedListNode *newhead)
{

listhead = newhead;

}

LinkedListNode* BCLinkedList::getItem(int index)
{
LinkedListNode* usenode = this->listhead;
for(int i=0;i<index;i++)
{
if(usenode!=NULL)
{
usenode=usenode->getNext();
}
else
{
return NULL;

}



}
return usenode;



}








And finally, the main routine that is going to run the above.

Code: [Select]
#include "stdafx.h"

#include "BCLinkedList.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
BCLinkedList ll;
int i=1;
LinkedListNode* firstnode= new LinkedListNode(NULL,NULL,(void*)i);
LinkedListNode* currnode = firstnode;
for(int i=1;i<10;i++)
{
currnode->setNext(new LinkedListNode(currnode,NULL,(void*)i));


currnode=currnode->getNext();

}

ll.setHead(firstnode);

currnode = ll.getHead();
while(currnode!=NULL)
{

cout << ((int)currnode->getValue()) << endl;


currnode=currnode->getNext();




}

LinkedListNode* indexednode = ll.getItem(3);
cout << ((int)indexednode->getValue());


int p=0;
cin >> p;
return 0;
}



First and foremost: do not use this code! I just created it in around 15 minutes. I say don't use it, because I'm ALMOST positive that I should be performing some sort of deallocation- but I'm not. For this short test it's not that important, but if you were to use any of this in an assignment you would probably lose marks. The original question of course was how to access a particular node of the list. this is somewhat vague, but I assume that you mean something like the "getItem()" method I created in my example:



Code: [Select]LinkedListNode* BCLinkedList::getItem(int index)
{
LinkedListNode* usenode = this->listhead;
for(int i=0;i<index;i++)
{
if(usenode!=NULL)
{
usenode=usenode->getNext();
}
else
{
return NULL;

}



}
return usenode;



}
The basic idea is simply to iterate from 0 to the passed index, and in each iteration MOVE forward in the list. There is of course a null check (in case somebody tries to access element 40 of a 10 item list or something). I don't believe it's insulated from corner cases (passing in 1 would probably give the same results as 0, I think, I didn't test it extensively).

The main point here is to show the method used- basically, you use the passed index as an upper bound on a loop you use to go through each item. Note that an optimization method used by double-headed lists (that is, the LinkedList has references to the head tail nodes) is to iterate from the closer side, but that's a special case scenario (also, my implementation is not a two-headed list).


I imagine this same little "indexer" could be used on Linux711's C code. Also I didn't feel like toying with mine to make it an actual indexer (so that one could say linkedlistvalue[3] and get back a LinkedListNode*, this was because to be frank I don't really like C++.

Also the name "BCLinkedList" was chosen because I didn't want to see if LinkedList would conflict with an existing stl class or something.
2423.

Solve : findstr vs. For /f?

Answer»

What should i use to strip a text file like:

X-Secure-ID:XXXXXXXXXXXXXXXXX
X-Secure-Country-Code: US - UNITED STATES
X-Secure-TLS-SUITE-INCOMING: XXXXXXXXXXXXXXXXXXXXXXX
X-Secure-RFC2821-MAIL-FROM: XXXXXXXXXXXXXXXXXXX
X-Secure-RFC2821-RCPT-TO:XXXXXXXXXXXXXXXXX
X-Secure-REMOTE-HOST: XXXXXXXXXXXXXXXXXXXX
X-Secure-REMOTE-ADDR: XXXXXXXXXXXXXXXXXXXXX
X-Secure-pp1t: X
X-Secure-trat: XX
X-Secure-omc: X
X-Secure-tsist: XXX
X-Secure-urt: XXX
X-Secure-art: X
X-Secure-drt: XXX
X-Secure-AS2-Class: XXXXXXXX
X-Secure-AS2-RefID: XXXXXXXXXXXXXXXXXXXXXXXXX
X-Spam-Status: Yes
X-Secure-Spam-Reason: XXXXXXXXXXXXXXXXXXXXXXXX


all i need it the ID at the top and the reason at the bottom. but heres the catch...........
This is a sample of !1! set in a txt file of thousands. so findstr or for /F??You can try this. Enter your file name after the search arguments:

Code: [Select]findstr /c:"X-Secure-Spam-Reason:" /c:"X-Secure-ID:" <replace with your file LABEL>

You can run this from the command line.

Good LUCK. Quote from: The_Valkyrie on July 06, 2010, 09:37:20 PM

What should I use to strip a text file?



C:\test>findstr "Secure-ID Secure-Spam-Reason" val.txt
X-Secure-ID:XXXXXXXXXXXXXXXXX
X-Secure-Spam-Reason: XXXXXXXXXXXXXXXXXXXXXXXX

C:\test>Quote from: marvinengland on July 07, 2010, 12:20:24 PM

C:\test>findstr "Secure-ID Secure-Spam-Reason" val.txt
X-Secure-ID:XXXXXXXXXXXXXXXXX
X-Secure-Spam-Reason: XXXXXXXXXXXXXXXXXXXXXXXX

C:\test>

that you sir. you are a master mind.
This just made my job a *censored* of a lot easier when i put it in a batch.
Quote from: The_Valkyrie on July 06, 2010, 09:37:20 PM
What should i use to strip a text file like:
you use a good text PROCESSING tool, or a language that does this job well for you.
For example, you can use gawk for Windows (or Perl/Python/Vbscript etc).

Code: [Select]C:\test>gawk -F":" "/X-Secure-ID|X-Secure-Spam-Reason/{print $2}" file
XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX

Note, the one liner above gets you the actual ID and reason, excluding X-Secure-ID and X-Secure-Spam-Reason. If you
need the words "X-Secure-ID" and "X-Secure-Spam-Reason",

Code: [Select]C:\test>gawk -F":" "/X-Secure-ID|X-Secure-Spam-Reason/" file
X-Secure-ID:XXXXXXXXXXXXXXXXX
X-Secure-Spam-Reason: XXXXXXXXXXXXXXXXXXXXXXXX
ghostdog74, thanks for the brilliant reference to Gawk.

I was wondering if you or anyone could help with this issue, I'm trying to output the following numbers from this text file:


Analyzing pool.ntp.org (1 of 1)...
delayoffset from local clock
Stratum: 2

Warning:
Reverse name resolution is best effort. It may not be
correct since RefID field in time packets differs across
NTP implementations and may not be using IP addresses.



pool.ntp.org[155.101.3.115:123]:
ICMP: 73ms
NTP: +0.0162516s RefID: 127-67-113-92.pool.ukrtel.net [92.113.67.127]


What I want is in bold. How can I do this with Gawk? With my limited knowledge I can only output:
+0.0162516s RefID

But I would like to have just the numbers after +

Please and thanks in advance..
2424.

Solve : Extracting simple BAT code from EXE??

Answer»

Hi, all...

I know this may seem stupid, but I'd LIKE to ask.

A few months ago, I got around to playing with a U3 drive and I wanted to get the drive to load PStart anytime it was inserted. Unfortunately, where I work, the computers (and the IT people) are crap, and we have viruses which overwrite any autorun.inf files on our drives. Thankfully, I am aware of this and am skilled in getting rid of these things before I take it home to work in my own computer.

Anyway, I figured that I could use the Read-Only partition of the U3 drive to disallow any alterations by viruses, and it worked. I used a HTTP file server to load an autorun.inf and an executable to the R/O partition.

Often, when I insert the drive in a computer at work, different letters may be assigned to the two drives. On one system, it may be E and G. Another, F and G. E and F, etc.

The executable on the R/O partition was compiled using a bat2exe utility, and the batch file was written so that, when the autorun file ran upon insertion, it would SEEK OUT the PStart.exe on any of the other drives, and if it found it, it would run it. This is how I could always get it to run PStart on insertion, no matter where and no matter what viruses.

Problem for me is that I lost the original scripting in that batch file, and all I have is the EXE.

Are there any simple things that could be done to "DECOMPILE" it back to BAT so that I could be smart and save that script?

Help!

Thanks!open it with a text editor, and search through the file for the batch code. Usually it's in plain text.

if that doesn't work this might
Code: [Select]@echo off
start /min %1
dir /s C:\%~n1.bat | FIND "Directory of" > dir.txt
for /f "tokens=1-2*" %%a in (dir.txt) do (
CD /d "%%c"
start notepad %~n1.bat
)it will close itself so don't close it it may take awileYou could try to open the exe with hex-editor and see if there are some FAMILIAR strings inside.

2425.

Solve : help with batch pls?

Answer»

this is PART of a long-*censored* batch file tht im making:
Code: [Select]:test_madness5
cls
echo.
start 4.vbs
timeout 30
if %madness%==5 goto stopmadness
goto menu
and it just KEEPS on crashing on the 'if' command line...
but if i have the thingy just saying goto it works... LIKE this:
Code: [Select]:test_madness5
cls
echo.
start 4.vbs
timeout 30
goto stopmadnessand it only works when madness is set to 5... otherwise it just crashes
which just DOESNT make sence...
or must madness must be set to anything for it to work?
pls helpyes it does need to be set to anything...
lol solved it myself xD

2426.

Solve : Move mouse to active button or push it?

Answer»

I am trying to find code to allow me to move the mouse to the next button on an external program..

(like tab.. but not with sending keys) by TELLING the mouse to move to the next ACTIVE button. or simply push the specified active button for me

There is settings in some programs for example audigy 4 sound driver software from creative labs lets your mouse crop to the next button on EVERY page automatically.

simply push the specified active button for me would be much better...( except doing it with specified pixel locations wont help because I need this to work on all resolutions for different computers.

thanks


[recovering disk space - old attachment deleted by admin]If the BUTTONS are tab ordered, then you could simulate a tab, detect the LOCATION of newly active button/control, and move the mouse over it. If you want to "click" it, just send a couple mouse windows messages.

2427.

Solve : how can I extract data and put it into a weblink using a batch file.?

Answer»

Hello all,
I would like to extract DATA like pcname, serial number then have it placed into a weblink so my PHP code can use it to put it into a form.
I think I'm close. I just need some help.

example:
start iexplore "http://www.mysite.com/index.php?serial_number=(GOTO serial)&computer_name=%computername%"
:serial
wmic bios get serialnumber

Any help would be GREAT. Thank youI'm fairly certain you cannot place NT commands in a parameter list and expect them to be executed. More likely the GOTO will be SEEN by the interpreter as a series of four alpha characters and simply pass them on to IE. Even if it did work, you'd more likely need to use Call in this situation.

An alternative would be to extract the serial number using WMIC prior to starting IE and then use VARIABLE substitution (much like you did with %computername%) to resolve the parameters to IE.

Code: [Select]@echo off
for /f %%i in ('wmic bios get serialnumber') do set serial=%%i
start iexplore "http://www.mysite.com/index.php?serial_number=%serial%&computer_name=%computername%"

The for statement is generic. You may need to tweak it for parsing depending on the actual output of WMIC. If you run into problems, please run wmic bios get serialnumber from the command line and post the complete output including any blank lines.

Good luck. The closest thing to extraction of info from a batch would be to >> it to a *.dat file at which another program would read in that file contents and use the contents to operate. Many languages have the ability to do this without the need for batch, but if you want to use batch this is a start. Another program other than batch would assemble this information into a usable URL and you would put the URL within the " " like the batch below. You could also have the other language assemble the batch dynamically by writing out to a *.bat file and then execute it.

cd\.
cd program files\internet explorer\
iexplore.exe "www.hak5.org"

Normally iexplorer.exe cant be executed from your default prompt, but by pointing your prompt to start in the root of the internet explorer you can then launch IE and URL pointer tagged on within " "

Quote from: skofer on October 03, 2010, 12:29:37 PM

Hello all,
I would like to extract data like pcname, serial number then have it placed into a weblink so my PHP code can use it to put it into a form.
I think I'm close. I just need some help.

example:
start iexplore "http://www.mysite.com/index.php?serial_number=(GOTO serial)&computer_name=%computername%"
:serial
wmic bios get serialnumber

Any help would be great. Thank you

First, I have no idea how to parse something with eols using for/f (as wmic does for it's output), so, I created a small VBS script that makes that parsing easier:

getserial.vbs
Code: [Select]Dim objWMI : Set objWMI = GetObject("winmgmts:")
Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem")
Dim colSettingsBios : Set colSettingsBios = objWMI.ExecQuery("Select * from Win32_BIOS")
Dim objComputer, strModel, strSerial
For Each objComputer in colSettings
strModel = objComputer.Model
Next
For Each objComputer in colSettingsBios
strSerial = objComputer.SerialNumber
Next
wscript.echo strSerial

batch file that uses the above and shells iexplore:

Code: [Select]for /f "tokens=*" %%P in ('cscript /nologo getserial.vbs') do set Serial=%%P
start iexplore "http://www.mysite.com/index.php?serial_number=%Serial%&computer_name=%computername%"



and then of course in the PHP you would access them via the $_GET array:

Code: [Select]$Serial=$_GET["serial_number"];
$compname=$_GET["computer_name"];


you would place the batch and the VBSCRIPT in the same folder, and run the batch to execute this.
2428.

Solve : votes program?

Answer»

can any ONE post me a program for votes where you find four PEOPLE TOBE voted and if you SELECT 5 the program read as defauld
Sounds like homework.it is not a homework

2429.

Solve : What can't batch files do??

Answer» PARSING is a PREREQUISITE for LANGUAGE FEATURES...



2430.

Solve : Importance Of Assembler?

Answer»

Quote

someone needs Assembler to create base for others to use.

That's part of why so many other programming languages exist. They are the "higher-level" languages which are easier for people to understand. Once the CODE is written, it's then "compiled" into a language easier for the hardware to understand.need to know how will i start to canvas the tools that i will use to a student computer plz give me TIPS
Need to know how to start to canvas the tools for a student computer.

What does that mean?

Aizen, please start a NEW TOPIC. Explain your question clearly and give as much information as possible.
2431.

Solve : Buffer Overflow help?

Answer»

Hi all, here is some c++ code that has 3 or 4 overflow issues. Could you help me identify them??
I am currently studing architecture and security. Programing is not my forte. Any help would be greatly appreciated!


/* Buffer overflow demo */
/* Last edited on 2002-11-05 14:24:23 by stolfi */


#INCLUDE
#include
#include
#include
#include

/* Error in command line: prints `msg', `usage', and halts the program. */
void arg_error(char *msg);

/* Error in banner file: prints `msg' and halts the program. */
void file_error(char *msg);

/* Reads compressed banner from `filename' and displays it to `stdout': */
void show_file(char *filename, char compression, char *buf);

/* Prints current date: */
void show_date(char *msg);

/* Maximum banner name length */
#define MAXNAMELENGTH 8

/* Maximum banner dimensions */
#define MAXROWS 600
#define MAXCOLS 800
/* Banner buffer size (= MAXCOLS + 1) */
#define IMGBUFSIZE 80l

/* Maximum repeat count */
#define MAXREPEAT 10

static char *usage = "demo [ -z | -r | -n COUNT | BANNERNAME ]...";

int main(int argn, char **argc)
{
int i;
char filename[MAXNAMELENGTH];
unsigned int repeat = 1;
char compression = 'z';
char buf[IMGBUFSIZE];
int j;

/* Parse command line arguments */
for (i = 1; i < argn; i++)
{
if (strcmp(argc,"-z") == 0)
{ compression = 'z'; }
else if (strcmp(argc,"-r") == 0)
{ compression = 'r'; }
else if (strcmp(argc,"-n") == 0)
{ char *rest; double rep;
i++;
if (i >= argn) { arg_error("no repeat count"); }
rep = strtod(argc, &rest);
if ((*rest != '\0') || (rep < 0) || (rep > MAXREPEAT) || (rep != (int)rep))
{ arg_error("invalid repeat count"); }
repeat = (int)rep;
}
else
{
/* Check name length (including final '\0'): */
if (strlen(argc) > MAXNAMELENGTH+1)
{ arg_error("banner name too long"); }
else
{
strcpy(filename, argc);
strcat(filename, ".img");
if (compression == 'z') { strcat(filename, ".z"); }
for (j = 0; j < repeat; j++)
{
printf("\033[H\033[2J\n"); /* Clear screen */
printf("%s (%s)\n", argc, filename);
usleep(300000);
show_file(filename, compression, &(buf[0]));
usleep(500000);
}
}
}
}
show_date("demo finished on ");
return(0);
}

void show_file(char *filename, char compression, char *buf)
{
/*
Read a pictorial text (banner, ascii-art image, etc.)
from the given `filename' and prints it to standard out.

If the `compression' argument is `r' ("raw"), the file is printed
as is. Otherwise, the file is assumed to be in a compressed
format, and is UNCOMPRESSED before being printed.

Currently, the only compression method supported is a VARIANT of
run-length encoding (`compression = 'z''). In this encoding, each
line of the file consists of a series of "groups". Each group
consists of one "control" byte, possibly followed by a data
byte. The control byte consists of a `type' bit and a seven-bit
`val' field. If `type == 1', then the byte `val + 32'is
inserted as the next banner pixel. If `type == 0', then the
FOLLOWING byte is taken to be a banner pixel which is
to be replicated `val + 1' times.

The caller must provide a pixel buffer `buf', with at least
MAXCOLS+1 characters (MAXCOLS pixels plus a final `\0'). */

int c, d, type, count;
int col;
FILE *f;
f = fopen(filename, "r");
if (f == NULL) { file_error("file not found"); }
while((c = fgetc(f)) != EOF)
{ col = 0;
while(c != '\n')
{ switch(compression)
{
case 'r':
/* Raw format: */
if (col >= MAXCOLS)
{ file_error("too many pixels in row"); }
else
{ buf[col] = c; col++; }
break;
case 'z':
/* Compressed format: */
type = (c >> 7);
if (type == 1)
{ /* Verbatim pixel: */
if (col >= MAXCOLS)
{ file_error("too many pixels in row"); }
else
{ buf[col] = (c & 127) + 32; col++; }
}
else
{ /* Replication group: */
if (((d = fgetc(f)) == EOF) || ( d == '\n'))
{ file_error("premature EOF/EOL in replicated group"); }
count = (c & 127) + 1;
while(count > 0)
{ if (col >= MAXCOLS)
{ file_error("too many pixels in row"); }
else
{ buf[col] = d; col++; count--; }
}
}
break;
default:
fprintf(stderr, "compression = `%c'\n", compression);
file_error("invalid compression code");
}
c = fgetc(f);
if (c == EOF) { file_error("missing end-of-line"); }
}
buf[col] = '\000';
printf("%s\n", buf);
}
}

void show_date(char *msg)
{
time_t *now = (time_t *)malloc(sizeof(time_t));
(void)time(now);
printf("%s%s\n", msg, ctime(now));
}

void arg_error(char *msg)
{
fprintf(stderr, "** %s\n", msg);
fprintf(stderr, "usage: %s\n", usage);
exit(1);
}

void file_error(char *msg)
{
fprintf(stderr, "** %s\n", msg);
exit(1);
}

2432.

Solve : question about programming in genral?

Answer» QUOTE from: mat123 on February 12, 2011, 03:48:17 PM
the point is that the if is REDUNDANT i get annoyed when people do that when the result of the CONDITIONAL statement is determined at compile time rather then RUN time.

Agreed, but most code LIKE that is only used for tutorials, rather than real life applications.
2433.

Solve : Please explain the class,delegate,enum and interface or struct in C Sharp..???

Answer»

Sir can you explain to me in details what is class,delegate,enum and interface or struct and please can you give me the examples??

It is because I doing now a study for my job purposes someday.And I do calculator program now in C sharp.And here is the error
Error1The name 'TOTAL1' does not exist in the current context

Error 2The name 'total1' does not exist in the current context

Error 3The name 'total1' does not exist in the current context

Error 4 The name 'total1'does not exist in the current context

Error 5Expected class, delegate, enum, interface, or struct

Error 6 Expected class, delegate, enum, interface, or struct


And that`s the all errors..


And the code was?using SYSTEM;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}


private void txtDisplay_TextChanged(object sender, EventArgs e)
{

}

private void btnOne_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text+btnOne.Text;
}

private void btnTwo_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnTwo.Text;
}

private void btnThree_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnThree.Text;
}

private void btnFour_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnFour.Text;
}

private void btnFive_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnFive.Text;
}

private void btnSix_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnSix.Text;
}

private void btnSeven_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnSeven.Text;
}

private void btnEight_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnEight.Text;
}

private void btnNine_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnNine.Text;
}

private void btnZero_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btnZero.Text;
}

private void btnClear_Click(object sender, EventArgs e)
{
txtDisplay.Clear();
}

double total2=0;

private void btnPlus_Click(object sender, EventArgs e)
{
total1 = total1 + double.Parse(txtDisplay.Text);
txtDisplay.Clear();

plusButtonClicked = true;
minusButtonClicked= false;


}
}

private void btnEquals_Click(object sender, EventArgs e)
{
if(plusButtonClicked==true)
{

total2=total1+double.Parse(txtDisplay.Text);

}
else if (minusButtonClicked==true)
{
total2=total1+double.Parse(txtDisplay.Text);
}
txtDisplay.Text=total2.ToString();
total1=0;
}

BOOL plusButtonClicked = false;
bool minusButtonClicked = false;

private void btnMinus_Click(object sender, EventArgs e)
{
total1 = total1 + double.Parse(txtDisplay.Text);
txtDisplay.Clear();

plusButtonClicked = true;
minusButtonClicked = false;

}

}the formatting there is awful... which is probably why you missed this:

Code: [Select]private void btnClear_Click(object sender, EventArgs e)
{
txtDisplay.Clear();
}

double total2=0;

private void btnPlus_Click(object sender, EventArgs e)
{
total1 = total1 + double.Parse(txtDisplay.Text);
txtDisplay.Clear();

plusButtonClicked = true;
minusButtonClicked= false;


}
}
you have the braces that end that function, and then you are declaring a class-level variable (form-level). This could be on purpose... however, the btnPlus_Click ending with two brackets isn't- the second brace ends the class. Therefore I assume your errors are starting right after that second curly brace.

Sir, in first place I am a beginner in C Sharp.And can you explain please further your suggestions about it.

First Can you explain further about my error is on details?
And can you point out there in your outlined program or in my program where is the function is,where is the class and everything about that program and the SENTENCES you had at the bottom part of my program??So that I can understand more to it.Sir I am WAITING from then that my asked question in the date of Oct.04,2010, 4:26A.M.About my C# questions.And hoping to be answered.So now it is no replied messages in my inbox.So how it is Sir like that??and hoping to you sir more power!!
Quote from: dave_trodeau2000 on October 12, 2010, 12:45:11 AM

now it is no replied messages in my inbox.So how it is Sir like that?

Contents of this post deleted by Allan
2434.

Solve : Visual C++ 2010 Express - Force Logoff?

Answer»

Would someone please tell me how to force the current user to logoff? I'm using VISUAL C++ 2010.The ExitWindowsEx() function should do it. MAKE sure you include windows.h

For dwReason, you need to enter a SYSTEM Shutdown Reason code. The full list is over here. So, for example, this should log off the user with "Application Issue" as the reason. (WARNING: UNTESTED)
Code: [Select]#include &LT;windows.h>

int main() {
ExitWindowsEx(EWX_LOGOFF, SHTDN_REASON_MAJOR_APPLICATION);
}

2435.

Solve : run as in VBS?

Answer»

I am trying to make a VBS that will prompt for a password and use the run-as command for a specific exe. so far I have this but it keeps giving me issues.

Code: [Select]Option explicit
Dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")

oShell.Run "runas /noprofile /user:[domain\user] ""[program]"""

WScript.Sleep 1000

objShell.SendKeys "PASSWORD"

objShell.SendKeys "{enter}"

Wscript.Quit

I am new to vbs but trying to learn. any help would be awesome.

thanks,
WayneDon't know your OS, but if you have XP Pro or above you can use the ScriptPW object:

Code: [Select]Set objPassword = CreateObject("ScriptPW.Password")
WScript.StdOut.Write "Please enter your password:"

strPassword = objPassword.GetPassword()
Wscript.Echo
Wscript.Echo "Your password is: " & strPassword

If you have ACCESS to a XP Pro machine, you can borrow a copy. It will work on any NT OS. File name is ScriptPW.dll. Put in a directory and register: regsvr32 ScriptPW.dll. Note: script must be run with cscript not wscript

Code: [Select]Set oShell= Wscript.CreateObject("WScript.Shell")
Set objPassword = CreateObject("ScriptPW.Password")
WScript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()

oShell.Run "runas /noprofile /user:[domain\user] ""[program]"""WScript.Sleep 1000
oShell.SendKeys strPassword
oShell.SendKeys "{enter}"

Wscript.Quit

The code will not work. The sendkeys does not get EXECUTED until the runas is complete. Too LATE to be of any use. Runas REQUESTS the password in a new window, by moving the sendkeys prior to the runas, the results are keystrokes sent to a non-existent window.

You might try this workaround

Good luck. Try with next code:


strComputer = "."
Set oShell = WScript.CreateObject ("WSCript.shell")
usuario = "[emailprotected]"
clave = "somepasswd"


' ejecuta modificacion Zona en Registro
WScript.echo "modificando reg"
netsh1="regedit /s \\prestored.cl\NETLOGON\TZupdate_inv.reg"
txtDNS1 = "runas /noprofile /user:"& usuario &" """& netsh1 &""""
oShell.run txtDNS1, 2
WScript.sleep 1000
oShell.AppActivate "C:\Windows\system32\runas.exe"
oShell.SendKeys clave & "{ENTER}"
WScript.sleep 5000

' ejecuta carga de zona en pc
WScript.echo "refrescando cambios"
netsh1="cscript \\prestored.cl\NETLOGON\refreshTZinfo.vbs"
txtDNS1 = "runas /noprofile /user:"& usuario &" """& netsh1 &""""
oShell.run txtDNS1, 2
WScript.sleep 1000
oShell.AppActivate "C:\Windows\system32\runas.exe"
oShell.SendKeys clave & "{ENTER}"
WScript.sleep 5000

WScript.Quit

2436.

Solve : What software to use to start a forum??

Answer»

I am going to start a forum so my friends and family have a place to talk online. Is there any recommendations for a free html software that can be used to build a good forum. I have always heard to have full control of your website you have to design using html progaming and not web creation software. I havent messed with html very much but I am extremely persistent when it come to stuff I cant figure out, so maybe it will be ok. Thank for any tipsThee are many options.
Do you want something that is free?
How much time do you want to spend?
Do you know what your friends and family like?

If you have not tried anything, here are some SUGGESTIONS. To make other people happy with your work, you need to know what they like. This is more important that the tools that you use. The HTML code is like nails and the content is like wood.What would prole think if you made something out of ugly wood held together by beautiful nails?

The best websites give people something that hey enjoy. Of course, it has to well organized and careful made. But above all, it has to me interesting. Learning HTML may take you three weeks, learning how to please other people can take much longer.

At the PRESENT time, people are interested in 'Social Networking' and thee is a new movie out called 'The Social Network'. It is a dramatized account of some things that really did happen. The principals involved made a lot of money. But what they did is more significant that just the money.

Take a look st this:
http://www.ebizmba.com/articles/social-networking-websites

Why not take some time to visit these sires and see what it is that draws people? Come back here and another member will give you some information about how to do the HTML or PHP code.
What's the point of all that? The guy (or gal?) just wants a personal forum for friends and family. Like many people probably would, I suggest SMF:
http://www.simplemachines.org/

If you don't have a site and host lined up for yourself and don't feel like going through the trouble, Lefora may be a viable solution:
http://www.lefora.comTrying to be helpful. He can learn HTML quickly. The rest takes longer.
The point was that the code is already available. As you also noted.
The link I gave also has free web sites and tools in the list.
Somebody has led him to believe that you have to know HTML to control the website. I wanted to stress that having content is now the important thing.

Or, to incorporate a metaphor. Think of the automobile. In 1904 you could by an automobile. The issue was no only how to drive it but how to repair it. By 1920 ypeople could drive an automobile and have others repair it.

Now cars come with power steering and built-in diagnostics. You no longer have to be a mechanical. But you have to learn how to drive in traffic. Driving in traffic means you have to know people better that knowing about the car.

The argument that being able to build a car makes you a better driver is way out-of-date. The same is not true about web sites. Be a driver, not a mechanic.

With the internet the way it is today, you have to think about what people want.
That was my point

He might look a something like this:
http://bestwebsitebuildingsoftwareinfo.com/
But that is about tools only. I still think he needs to visit about 10 or more top social sites to see what is going on now on the internet. Stuart with FACEBOOK and Twitter and MySpace and so on.Quote from: Geek-9pm on February 16, 2011, 12:24:20 PM

Somebody has led him to believe that you have to know HTML to control the website.

Actually, it seems more like he's confusing HTML with PHP. HTML isn't programming at all, it's just a markup language. PHP is the actual programming used for forums, blogs, login systems, etc.

Programming your own forum software out of PHP doesn't give you full control. It gives you understanding, allowing you to fix your own bugs and problems WITHOUT having to wait for the premade forum's maintainers to do it for you.

In the past, I've had trouble trying to get premade CMS's to behave exactly as I wanted it to, and ended up writing my own CMS (Content Management System). However, in this CASE, I had experienced knowledge of HTML, CSS, and PHP before hand. Even thought it worked out well for me, I would strongly recommend using a premade forum for a person trying to set up a simple forum, just for simplicity and ease of use.
2437.

Solve : WEb Guestbook - Taking my next steps into web Programming?

Answer»

Hey all I have a site here jimbo8098.agilityhoster.com . As you can see I have TAKES some steps into web design and programming but now I really want to go further. For my next stps I want to make a guestbook. People give a name and a short message and it is recorded. Late i will be adding more funtions.

I have already LOOKED at this and found that I could do it with PHP scripting successfully . HOWEVER I have been told there are less complex and QUICKER ways to do it. using ASP.net , this said from someone in my WORKPLACE (I am technical support mwahahahaha )

So can anyone back me up on this and if it is true where is the best place i can LEARN for myself?I don't know ASP or .NET so I don't know which is easier. But then again, because I don't know ASP, PHP is easier for me.

Link

2438.

Solve : WHY WONT THIS BATCH FILE WORK!!!!!!!!!?

Answer»
Why wont this BATCH FILE work???

The point of it is to convert png FILES to jpg in a certain directory.
It finds files in the directory that are named like this:
1.png
2.png
3.png
ect...

It EXITS as soon as you input the directory!!!!!

Code: [Select]@ECHO off
:d
cd C:/Users/%USERNAME%
pause
set /p start=Starting Number:
set /a start2=%start% - 1

set /p dir=Directory
if not exist %dir% (
echo %dir% has not been found!
pause
cls
goto :d
)
if exist %dir% (
goto a
)
:a
set /a next=start2 + 1
if exist %dir%/%next% (
ren %dir%/%next% %next%.jpg
set /a per=100/%next%
cls
echo %per%%
cls
goto a
echo.
echo.
echo Done!
pause
cls
goto dWelcome to CH. Please do not shout.
May I assume you are a beginner?
Suggestions.
1. do not use echo off until you got it right.
2. beak you code into little parts and stubs.
3. avoid indirection until you have it right.
Like
Code: [Select]cd C:/Users/%USERNAME%Is not needed until you have tested the thing. You start in the test directory manually. Less likely to mess things up.It appears that you are simply renaming from png to jpg. Do you understand that you need to actually CONVERT the file format, not just change the extension?goto :d should just be goto d. No need for the semicolon.
2439.

Solve : oracle?

Answer»

hi
could U please tell me when we create a table in oracle and if table is already exists then what type of error should it displayed,? actualy i want exactly error message..Usually, if we refer to tables, we mean heap tables, although there are other types as well.
A heap table is created like this:
create table t (
a number,
b VARCHAR2(10)
)

It is possible to create the constraints together with the create statement. As a foreign key references a known type, it is not necessary to specify the foreign key's column type.
create table orders (
order_id number primary key
order_dt date,
cust_id references customers
)




PA health plans | Health Insurance Pittsburgh PA

I am not sure if my computer drivers are up to date. I am having issues with yahoo game rooms/ games. When in a card game or DOMINOES when I click on a card or domino - my screen flickers/ FLASHES or goes to the BOTTOM of my screen. I constantly get kicked out of the game rooms several times while in a game. Anybody know why this is happening and what I can do to fix it? I have cc cleaner and have ran it. Also I have ad-aware and avg.

2440.

Solve : A backup batch, to save as time and date.?

Answer»

Hello all,

I am currently trying to make a batch file that will backup a folder every 2 hrs and save that folder with the time and date in the name. This way we can have multiple backups, each with a timestamp. My problem is that EITHER my code says CRASHES just before the backup/copy or it says The syntax of the command is incorrect where it should rename the folder. Here is what I have so far, any help would be greatly appreciated.

Code: [Select]-snip-Okay i found the problem. I needed to use quotes with my environment variables when renaming. Sorry for WASTING your time if you read this.

2441.

Solve : Java program issues?

Answer»

I made this program for a class. Its purpose is to convert sequences of numbers from the keyboard to text strings based on the usual multi-tap coding used with cell phones. For EXAMPLE, 4433555 555666 = "hello".

My strategy was to create a method (convertToLetter) which takes the number entered and number of times the number is entered and to SPIT it out into a String variable then print it out. I organized the input by splitting the input into arrays, splitting it at the space.

My code compiles fine so far but when I enter input I get this message.

java.lang.ArrayIndexOutOfBoundsExceptio n: 1
at Pay.main(Pay.java:124)
at sun.reflect.NativeMethodAccessorImpl.in voke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.in voke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImp l.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at edu.rice.cs.drjava.model.compiler.Javac Compiler.runCommand(JavacCompiler.java:271)

Here's my code:


import java.util.Scanner;

class Pay {

static char convertToLetter(int num, int numTimes) {

if (num == 2) {
numTimes = numTimes % 3;
switch (numTimes) {
case 1:
return 'a';
case 2:
return 'b';
case 3:
return 'c';
default:
System.out.println("num2");
}
} else if (num == 3) {
numTimes = numTimes % 3;
switch (numTimes) {
case 1:
return 'd';
case 2:
return 'e';
case 3:
return 'f';
default:
System.out.println("num3");
}
} else if (num == 4) {
numTimes = numTimes % 3;
switch (numTimes) {
case 1:
return 'g';
case 2:
return 'h';
case 3:
return 'i';
default:
System.out.println("num4");
}
} else if (num == 5) {
numTimes = numTimes % 3;
switch (numTimes) {
case 1:
return 'j';
case 2:
return 'k';
case 3:
return 'l';
default:
System.out.println("num5");
}
} else if (num == 6) {
numTimes = numTimes % 3;
switch (numTimes) {
case 1:
return 'm';
case 2:
return 'n';
case 3:
return 'o';
default:
System.out.println("num6");
}
} else if (num == 7) {
numTimes = numTimes % 4;
switch (numTimes) {
case 1:
return 'p';
case 2:
return 'q';
case 3:
return 'r';
case 4:
return 's';
default:
System.out.println("num7");
}
} else if (num == {
numTimes = numTimes % 3;
switch (numTimes) {
case 1:
return 't';
case 2:
return 'u';
case 3:
return 'v';
default:
System.out.println("num8");
}
} else if (num == 9) {
numTimes = numTimes % 4;
switch (numTimes) {
case 1:
return 'w';
case 2:
return 'X';
case 3:
return 'y';
case 4:
return 'Z';
default:
System.out.println("num9");
}
}
return 'a';
}

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

Scanner sc = new Scanner(System.in);
String in = sc.nextLine();
String[] splitString = in.split(" "); // splits input into array of
// strings
String toOutput = "";
char currChar;
int numTimes = 1;


for (int index = 0; index <= splitString.length; index++) {
currChar = splitString[index].charAt(0);

for (int i = 1; i < splitString[index].length(); i++) {
if (splitString[index].charAt(i) != currChar) {
String numString = Character.toString(currChar);
int num = Integer.parseInt(numString);
toOutput += convertToLetter(num, numTimes);
currChar = splitString[index].charAt(i);
numTimes = 1;
} else {
numTimes++;
}
}
}

System.out.println(toOutput);
}

}




If anyone could help me with this it would be MUCH appreciated

2442.

Solve : Visual Basic Express 2010?

Answer»

I am taking a class in VB. When I build a form and code the BUTTONS, etc, then do a save all, I am missing files in
the Project/Debug Folder. Seems like it is not Saving All. Help???what files are missing?

The source files themselves are in the Project folder.If you don't RUN the debug the run file in the debug folder will not be there and some other files as well. Run the debug and SEE if they are there then.When creating a project in visual basic first of all save it in correct directory, it’s a BEST practice when creating a project. I think in your case you saved the project in different directories, that’s why there was some files missing.

2443.

Solve : change a code set up?

Answer»

is it possible to change a code from script to html




http://www.widgeo.net/geocompteur/geocity.php?c=geocity_blue2&id=1590014&adult=0&cat=maison">

widgeo.net
http://www.widgeo.net/img/logopm.png">

Nope.Quote from: kpac on October 24, 2010, 04:07:17 PM
Nope.

oh right , you seem to be very sure on that point anyway , i just have to think of something else then Yes I am.

BTW, http://www.mywot.com/en/scorecard/widgeo.net

Actually, there is a way with this script, as it only outputs plain HTML.

Code: [Select]<table><tr><td>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="157" HEIGHT="203">
<PARAM NAME="movie" VALUE="http://www.widgeo.net/geocompteur/swf/geocity_blue2.swf?idm=1590014&jour=4&online=2&total=5">
<PARAM NAME="quality" VALUE="high">
<PARAM NAME="wmode" VALUE="transparent">
<embed wmode="transparent" width="157" height="203" src="http://www.widgeo.net/geocompteur/swf/geocity_blue2.swf?idm=1590014&jour=4&online=2&total=5" pluginspage="http://www.macromedia.com/shockwave/download/" type="application/x-shockwave-flash" quality="high"></embed>
</OBJECT>
</td></tr></table>

If you're using that on wordpress I'm not sure if it will work because they strip a lot of HTML tags.you see , i knew you would know something from your memory banks , thanks patio i'll let you know and then you can store that information as well Quote from: HARRY 48 on October 24, 2010, 04:36:56 PM
thanks patio

wha?Quote from: BC_Programmer on October 25, 2010, 11:06:44 AM
wha?


oh dear me , we oldies thank you kpac Quote from: BC_Programmer on October 25, 2010, 11:06:44 AM
wha?
I was wondering that too. hi kpac , it did not work , so this is what an expert told me on the forum , i think i may just give up



===================================================================
@harry

[java]script and shockwave flash are stripped out by the software.

See here > http://en.support.wordpress.com/code/

Long story short - you cannot use that widget on a wordpress.com blog. It's a shockwave Flash widget and the software will strip the code out.
===================================================================
WordPress.com is a type of shared environment, where all users are running off of the same software. This is great because it allows us at Automattic to update millions of blogs at the same time with a single click. It means we can fix bugs or offer new features very quickly, which is a WIN for you as users. Having all users running on the same software can also be dangerous. If we aren’t careful, one user has the potential to take down the entire site. So this is why we need to limit some of the things you post on your blog.

If you wrote some code or PASTED it in from another web site and then it disappeared after publishing the post, the code is likely being stripped out. If you feel it’s being stripped out improperly or if you would like to suggest additional types of code we should allow, please contact support.

HTML Tags
WordPress.com allows the following HTML code in your posts, pages, and widgets:

address, a, abbr, acronym, area, b, big, blockquote, br, caption, cite, CLASS, code, col, del, dd, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, ins, kbd, li, map, ol, p, pre, q, s, span, strike, strong, sub, sup, table, tbody, td, tfoot, tr, tt, ul, var

Check out W3 Schools for more information about what each of these HTML codes are used for.

If you are familiar with HTML, you’ll notice that codes such as embed, frame, iframe, form, input, object, textarea and others are missing from the above list. Those codes are not allowed on WordPress.com for security reasons.


Javascript
Users are not allowed to post JavaScript on WordPress.com blogs. JavaScript can be used for malicious purposes. As an example, JavaScript has taken down sites such as MySpace.com and LiveJournal offline in the past. The security of all the blogs is a top priority and until we can guarantee scripting languages will not be harmful they will not be permitted.

JavaScript from trusted partners, such as YouTube and Google Video, is converted into a WordPress shortcode when a post is saved.


Flash and Other Embeds
Flash and all other embeds are not allowed in WordPress.com posts, pages, or text widgets. For security reasons, we remove the tags needed for these to work. Your intentions may be innocent, but someone somewhere would try to damage the site, affecting all of our users.

There are several safe ways to post Videos, Audio, and other items to your WordPress.com blog.

a bit more information from the wordpress forum



Well, the shortcode version of this code is the one I pasted above.

But as you can see, the code says "jour=4&online=2&total=5" (5 total visitors, 4 today, 2 online):

if you put the shortcode in a text widget, the widget will keep showing the same NUMBERS day in day out.

So, as I already pointed out, this is not a counter: you need to find a flash equivalent of this widget, this is just the output for one particular site on one particular day.
2444.

Solve : Problem in Duplication of data and onenter key?

Answer»

Good day!


I have 2 problems with my code 1st is in the last operation name or the 04 Oper it was duplicate but the duplicate was only the operation name and the REST data was blank . I tried to debug it but I ca'n find where is wrong in my syntax. And the 2nd problem is for the enter key function or array, because my textbox I used array, and to move on the next textbox i used enter key, the problem is on the last date when i press enter key instead of move the cursor on the shift textbox it was save. I want to happen is after the last date and I press enter key the cursor was on the shift textbox then after i input data in shift and i press enter key it will save.


Here is my code:


Code: [Select]<?php
if($rexist==0)
{
$query="SELECTt.operation_name,t.input_unit,t.output_unitFROMtrace_operationstWHEREt.plt_typeno='".$_POST["plt_typeno"]."'ANDt.operation_nameIN('02Oper','03Oper','04Oper')ORDERBYt.operation_name";

$last_operation_name="";
$result=mysql_query($query);
if($result){
$totalrows=mysql_num_rows($result);
$TROWS=$totalrows-1;
for($ctr=0;$ctr<$trows;$ctr++)
{
$row=mysql_fetch_array($result);
$tctr=$ctr+1;
echo"\n\t<tr>";
echo"\n\t\t<tdwidth='800'>";
if($last_operation_name!=$row["operation_name"])echo$row["operation_name"];
$last_operation_name=$row["operation_name"];
echo"<inputtype='hidden'width='400'name='opname[]'value='".$row["operation_name"]."'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='timein[]'id='timein".$ctr."'onkeypress='returnhandleEnter(event,\"timeout".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='timeout[]'id='timeout".$ctr."'onkeypress='returnhandleEnter(event,\"inqty".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='inqty[]'id='inqty".$ctr."'onkeypress='returnhandleEnter(event,\"outqty".$ctr."\");'/></td>";
echo"\n\t\t<td>".$row["input_unit"];
echo"<inputtype='hidden'name='iun[]'value='".$row["input_unit"]."'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='outqty[]'id='outqty".$ctr."'onkeypress='returnhandleEnter(event,\"idno".$ctr."\");'/></td>";
echo"\n\t\t<td>".$row["output_unit"];
echo"<inputtype='hidden'name='oun[]'value='".$row["output_unit"]."'></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='idno[]'id='idno".$ctr."'onkeypress='returnhandleEnter(event,\"mcno".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='mcno[]'id='mcno".$ctr."'onkeypress='returnhandleEnter(event,\"varqty".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='varqty[]'id='varqty".$ctr."'onkeypress='returnhandleEnter(event,\"varplt".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='varplt[]'id='varplt".$ctr."'onkeypress='returnhandleEnter(event,\"dateshift".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='dateshift[]'id='dateshift".$ctr."'onkeypress='returnhandleEnter(event,\"shift".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='shift[]'id='shift".$ctr."'onkeypress='returnhandleEnter(event,\"timein".$tctr."\");'/></td>";
echo"\n\t</tr>";
}
if($totalrows>1);
{
$row=mysql_fetch_array($result);
echo"\n\t<tr>";
echo"\n\t\t<tdwidth='800'>";
if($last_operation_name!=$row["operation_name"])echo$row["operation_name"];
$last_operation_name=$row["operation_name"];
echo"<inputtype='hidden'width='400'name='opname[]'value='".$row["operation_name"]."'/></td>";
echo"<inputtype='hidden'name='opname[]'value='".$row["operation_name"]."'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='timein[]'id='timein".$ctr."'onkeypress='returnhandleEnter(event,\"timeout".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='timeout[]'id='timeout".$ctr."'onkeypress='returnhandleEnter(event,\"inqty".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='inqty[]'id='inqty".$ctr."'onkeypress='returnhandleEnter(event,\"outqty".$ctr."\");'/></td>";
echo"\n\t\t<td>".$row["input_unit"];
echo"<inputtype='hidden'name='iun[]'value='".$row["input_unit"]."'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='outqty[]'id='outqty".$ctr."'onkeypress='returnhandleEnter(event,\"idno".$ctr."\");'/></td>";
echo"\n\t\t<td>".$row["output_unit"];
echo"<inputtype='hidden'name='oun[]'value='".$row["output_unit"]."'></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='idno[]'id='idno".$ctr."'onkeypress='returnhandleEnter(event,\"mcno".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='mcno[]'id='mcno".$ctr."'onkeypress='returnhandleEnter(event,\"varqty".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='varqty[]'id='varqty".$ctr."'onkeypress='returnhandleEnter(event,\"varplt".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='varplt[]'id='varplt".$ctr."'onkeypress='returnhandleEnter(event,\"dateshift".$ctr."\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='dateshift[]'id='dateshift".$ctr."'onkeypress='returnhandleEnter(event,\"shift\");'/></td>";
echo"\n\t\t<td><inputsize='6'type='text'name='shift[]'id='shift".$ctr."'onkeypress='returnhandleEnter(event,\"saveform\");'/></td>";
echo"\n\t</tr>";
}
echo"</table>";
echo"<p><inputtype='submit'value='Save'id='saveform'/></p>";
echo"<inputtype='hidden'name='plt_typeno'value='".$_POST["plt_typeno"]."'/>";
}
}
?>


Any help is highly appreciated..

Thank you very much.. Ask me a question if my problem did not clear with you.:confused:


Again, Thank you so muchNice run-on sentences you got there, I have no idea what you said. Maybe you could describe what you are trying to do a bit clearer.

Been awhile since Ive done php, I am not sure if any of this will produce an error but:

First off, you don't need the semicolons, and if you use apostrophes rather than quotes around the html text (e.g. size='6'; onkeypress='something()'), you don't have to use \ .

Code: [Select]echo "<input type='hidden' width='400' name='opname[]' value='" . $row['operation_name'] . "' /></td>";
echo "<input type='hidden' name='opname[]' value='" . $row['operation_name'] . "' /></td>";
echo "\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" . $ctr . "' onkeypress='return handleEnter(event, 'timeout" . $ctr . "')' /></td>";

Also, since it is PRETTY much the same code repeated: I would do something like this:

Code: [Select]function input($name, $id, $keypress)
{
echo "\n\t\t<td><input size='6' type='text' name='" . $name . "' id='" . $id . "' onkeypress='" . $keypress . "' /></td>";
}

input("timein[]", "timein", "return handleEnter(event, 'timeout" . $ctr . "')");
etc...
etc...
I tried the first code that you suggested and the output is after i insert data in time in and i pressed enter key it save ???

Can you explain me the second code that you suggested..

Thank youLet me pull out xampp. I still don't understand exactly what you are trying to do. I'll give you a better explanation.Quote from: guss on February 14, 2011, 01:45:13 PM

Let me pull out xampp. I still don't understand exactly what you are trying to do. I'll give you a better explanation.

I echo this query
Code: [Select] $query = "SELECT t.operation_name, t.input_unit, t.output_unit FROM trace_operations t WHERE t.plt_typeno = '" . $_POST["plt_typeno"] . "' AND t.operation_name IN('02 Oper','03 Oper','04 Oper') ORDER BY t.operation_name";
And the output is:
RESOURCE id #9

What is the meaning of that?it's a MySQL resultset. you need to use something like mysql_fetch_array() to get at the rows in the resultset.
2445.

Solve : Simple batch file question?

Answer» HI,

I am EXTREMELY new to batch files but need to create one for a class. I have had success with it and it does what it is supposed to do...with one problem. It needs to run from ANY directory on the system but I can only get it to go from the one I created it under.
Can anyone please explain? My brain is fried!

Thanks!

Any program, including a batch file, can be run two or three waysways.
A fully qualified path and file name.
- OR-
The directory of the program must be in the PATH variable.
But if you are already in the directory the the file name is enough.

For example, I am Jack, I have a batch file NAMED MyBatch.BAT and it is in the directory named D:\JACK\BATCH
this would work:
D:\JACK\BATCH\MyBatch.BAT
Now if the PATH variable CONTAINS D:\JACK\BATCH I would only need the file name
MyBatch
And yes, you can even leave off the BAT part of the name.

Are you asking us to do your homework? Did you read you materiel over well? Do you know what happens to people who get others to do their work? Do you want to end up LIKE them?

Thanks for the guidance. And no, I don't expect others to do my work...I have been working on this thing since monday and just got stuck. But thanks for the CONCERN lol
2446.

Solve : Having issues with Java...?

Answer»

I am not sure if my computer drivers are up to date. I am having issues with yahoo game rooms/ games. When in a card game or dominoes when I click on a card or domino - my screen flickers/ FLASHES or GOES to the bottom of my screen. I constantly get kicked out of the game rooms SEVERAL times while in a game. Anybody know why this is happening and what I can do to fix it? I have cc cleaner and have ran it. Also I have ad-aware and avg. Someone please help. I have not had my computer but LIKE 3 months now. It's a toshiba laptop.
It would be nice to check your flash PLAYER if it is updated.

http://www.adobe.com/go/getflash/

2447.

Solve : Java programming help?

Answer»

I used to teach the Data Processing Class at the local Community College. Part of the curriculum was How to write java programs. We started with a blank page, wrote every line, compiled it, and tested the program. My question is what do I need to download in order to be able to waste a little time writing programs to REVERSE the order of a sentence and such. I used to spend a lot of free time playing with java. also where do I get it I think I have already downloaded a bunch of stuff from sun java but the blank page with a compiler button at the side just don't come up, I get a bunch of HTTP stuff that I don't understand and have no desire to work with. Maybe I need an old Java program. Any help will be appreciated, thanks.you could try netbeans IDE; or eclipse.

At it's core java has always simply been javac- the command line java compiler. I am not aware of any built-in tool with a "compiler button", so that was probably some other piece of software.

P.S: Java is now owned by Oracle. Somehow I don't feel that BODES well for the language.

In any case, you could always simply use notepad/ a text editor and the command-line, just like in the beginning days

create a quick test program in notepad; for example, "javatest.java":

Code: [Select]public class javatest{
public static void main(String[] ARGS)
{

System.out.println("Java test.");

}
}
And, if you installed the JDK properly, java (the VM) and javac (the compiler) should both be readily available at the command line:

Code: [Select]C:\>javac javatest.java

which, I don't doubt you already know, creates the class file:

Code: [Select]C:\>java javatest
Java test.

BC_Programmer pretty much has it covered.

Just one quick point though - if you'll be developing (/writing test programs), you'll need the Java JDK release (http://www.oracle.com/technetwork/java/javase/downloads/index.html) not the standard runtime one. This can be a common mistake since people download 'Java' (the runtime one, not the JDK) but then can't write and run programs.I just downloaded the jdk, will see what happens, thank you.Can U plaese give me some programming codes for java? Quote from: Kemcykelly on October 21, 2010, 08:20:01 AM

Can u plaese give me some programming codes for java?
You need to start your own thread to get help. Before you do start a thread though, try to consider what you want to ACCOMPLISH. We can't help you with something that vague.Java programming very simple to write when you use netbeans IDE. It is made by japnies people and the java language used for this. It contain all the functions and many applications which is used to make the software. Quote from: wilbert99eaton on November 03, 2010, 12:21:03 AM
Quote removed

japnies? Isn't that a kind of pepper?
2448.

Solve : can you remove "white" from this code?

Answer»

is it possible to remove the transparent ( which turns out to be a white box) in the code below , but leave the clock intect , you can see the clock on my site



quote expert ;

Most widgets you can find provide an embed code only, which isn’t allowed in wp.com blogs, but I was able to transform it into an allowed gigya shortcode. The shortcode for this particular clock is this:

[gigya src="http://www.widgipedia.com/widgets/martinkorner/Time–Date-Widget-776-8192_134217728.widget" width="110" height="30" flashvars="digitalTime=1&colourScheme=1&UTCtime=local& autoChange=user" quality="high" allowScriptAccess="always" wmode="transparent"]



another quote i found since the post



To make the shortcode show up, you need to write the html for the opening bracket instead of the bracket itself ( & # 9 1 ; minus the spaces).







best you can hope for is trying to change the "ColourScheme" item to different numbers.thank you bcp , i was going to try that but would that be the back ground for the clock maybe

and also where would i GET colour code numbers/lettersQuote from: harry 48 on November 03, 2010, 01:34:45 PM

thank you bcp , i was going to try that but would that be the back ground for the clock maybe

and also where would i get colour code numbers/letters

the meaning of the number is only known to whoever made the widget, probably. you'd have to experiment. It probably changes all the colours.
i'll have a try , thank youi CHANGED it all and also one at a time nothing worked i'll just leave it as is

the quote also said; it is EXPLORER not understanding transparent that is the reason it turns out white
2449.

Solve : Unable to use message forum?

Answer»

I have a message FORUM that everyone is able to respond or POST on and I have nothing to CLICK on to do so. I did something recently and have no IDEA what it is. Any suggestions appreciated.

2450.

Solve : Return array from ActiveX exe?

Answer»

I have an activex exe written in vb6 that I am accessing using vbscript. I have a sub in this activex exe with a parameter that needs to return an array. I tried using a function to return a variant type array, but it would not allow access to the array in vbscript. Basically, I just need to figure out a way to pass an array or a collection from my vb6 exe to my vbscript. I have seen examples, but none of them will work for me probably because most of them are talking about ASP.

After reading this code I know you are going to tell me there is already a way to enumerate registry keys in vbscript. I know that. I don't have WMI enabled on this system and I need another way to enumerate registry in vbscript, so I am writing my own code.


The error occurs on the line that reads "reg.EnumKeys "HKEY_LOCAL_MACHINE", "SYSTEM\CurrentControlSet\Services", keys"
Type mismatch EnumKeys

That does not make any sense because EnumKeys is a sub in my vb6 exe.

Here is part of the code in the activex exe:
Code: [Select]Public Sub EnumKeys(strSection As String, keyName As String, retKeyNames() As Variant)
Dim hKey As Long
Dim keyNames() As Variant
Dim section As Long
Dim i As Long

' Convert from string to the section code
section = GetSection(strSection)

' Open the key.
If RegOpenKeyEx(section, keyName, 0, KEY_ALL_ACCESS, hKey) <> ERROR_SUCCESS Then
MsgBox "Error opening key."
Exit Sub
End If

' Enumerate
keyName = Space(KEY_LENGTH)
While RegEnumKey(hKey, i, keyName, KEY_LENGTH) = ERROR_SUCCESS
ReDim Preserve keyNames(i)
keyNames(i) = keyName
keyName = Space(KEY_LENGTH)
i = i + 1
Wend

' Close the key.
If RegCloseKey(hKey) <> ERROR_SUCCESS Then
MsgBox "Error closing key."
End If

retKeyNames = keyNames
End Sub

Here is the vbscript to enumerate registry:
Code: [Select]Option Explicit
Dim reg
Dim keys
Dim i
Dim io
SET io = CreateObject("wshshell.io")
Set reg = CreateObject("wshshell.registry")

reg.EnumKeys "HKEY_LOCAL_MACHINE", "SYSTEM\CurrentControlSet\Services", keys

For i = 0 to ubound(keys)
msgbox keys(i)
Next

wscript.stdout.write "Press any key to continue. . ."

While io.GetKeysASCII = vbNull
wscript.sleep 50
Wend

Set io = Nothing
Set reg = Nothing
VB6 ActiveX EXE Project name "TestEXE", Class "TestClass":

Code: [Select]Option Explicit

Public Function ReturnArray(ByVal Argument As String, ByVal totalsize As Integer) As Variant

Dim returnme As Variant, I As Integer
ReDim returnme(0 To totalsize - 1)
For I = 0 To totalsize - 1
returnme(I) = Argument & Str(I)
Next


ReturnArray = returnme


End Function

After compiling I ran this VBScript:

Code: [Select]Dim objaccess,returnedvalue
Dim I
set objaccess = CreateObject("TestEXE.TestClass")
returnvalue = objaccess.ReturnArray("String",15)
for I = 0 to Ubound(returnvalue)
WScript.Echo(I)
Next


And this was the result, as expected:
Code: [Select]D:\>C:\windows\syswow64\cscript.exe testacx.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14

So, the question is, what's different? Well, there are a few differences. For example your code is using a Sub() procedure, and returning the value via a ByRef (implied) Array argument; Mine is returning that value directly as a Variant array, which brings up the other difference- note that the function, as well as the local variable used to hold the array, are declared as Variant Array (Dim X as Variant) rather then an array of Variants (Dim X() as Variant).

Additionally, the Type Mismatch error MAKES perfect sense; in your VB6 Executable, the ByRef argument is of Type Variant() (an array of variants), whereas the variable that VBScript is passing it is Variant . I think it is impossible to even create a Array of variants in VBScript, all arrays in VBScript are Variant arrays. The terminology can get confusing. Here's a quick once-over:

As you know, a Variant Variable can store any number of different types; One of these types is in fact, an array. So, a normal Variant Variable can in fact hold an entire array of values. It's important to note that a Variant Variable HOLDING an Array is quite different from a Array of Variant Variables, I don't remember a lot of the differences ATM but I believe they are marshalled quite differently (being that one is a Variant variable, and the other is a first-class Array).

Anyway, long story short, the best option would probably be to either try declaring "keys" as an array:

Code: [Select]Dim keys() 'instead of Dim keys

Which might work (I'm not sure though, since I think VBScript might internally just create a Variant Array (and not the desired Array of Variants). The other option is to simply use a normal Variant Variable for the ByRef argument, and use Redim() to turn it into an array in the routine. (Wether you use a function instead is entirely optional, of course)

Quote

and use Redim() to turn it into an array in the routine.

That fixed it ReDim Preserve aparently doesn't work the first time. I had to start it out by using ReDim keyNames(0) to make the variant into an array. I also decided to make it into a function instead of a sub. I removed the msgboxes because they don't ever display, I even made a new sub with a msgbox in it and it didn't work. There's only one small problem left with the "keyName = Space(KEY_LENGTH)". In the console, it shows all the extra spaces after the key name. I figure that's because there is no null termination CHARACTER, but it's weird because it displays fine in a msgbox (no extra spaces).

So I have two final questions. Why won't msgboxes display from the activex exe? And how do I get rid of the trailing spaces in the console?

Thanks so much for your help I was at this for three hours.

Code: [Select]Public Function EnumKeys(strSection As String, keyName As String) As Variant
Dim hKey As Long
Dim keyNames As Variant
Dim section As Long
Dim i As Long

'FORCE IT TO TURN VARIANT INTO ARRAY
ReDim keyNames(0)

' Convert from string to the section code
section = GetSection(strSection)

' Open the key.
If RegOpenKeyEx(section, keyName, 0, KEY_ALL_ACCESS, hKey) <> ERROR_SUCCESS Then
Exit Function
End If

' Enumerate
keyName = Space(KEY_LENGTH)
While RegEnumKey(hKey, i, keyName, KEY_LENGTH) = ERROR_SUCCESS
ReDim Preserve keyNames(i) '<---- NOT GOOD ENOUGH. WON'T FORCE IT TO BE ARRAY FIRST TIME
keyNames(i) = keyName
keyName = Space(KEY_LENGTH)
i = i + 1
Wend

' Close the key.
RegCloseKey (hKey)

EnumKeys = keyNames
End Function

Here is the vbscript:
Code: [Select]Option Explicit
Dim reg
Dim keys
Dim values
Dim i
Dim io
Set io = CreateObject("wshshell.IO")
Set reg = CreateObject("wshshell.Registry")

keys = reg.EnumKeys("HKLM", "SYSTEM\CurrentControlSet\Services")
values = reg.EnumValues("HKLM", "SYSTEM\CurrentControlSet\Services\Tcpip")

For i = 0 to Ubound(keys)
wscript.stdout.writeline keys(i)
Next
AnyKey
For i = 0 to Ubound(values)
wscript.stdout.writeline values(i)
Next
AnyKey

Set io = Nothing
Set reg = Nothing

Sub AnyKey()
wscript.stdout.writeline "Press any key to continue. . ."
wscript.sleep 200
While io.GetKeysASCII = 0
wscript.sleep 50
Wend
End Sub
Quote from: Linux711 on November 04, 2010, 08:01:45 AM
There's only one small problem left with the "keyName = Space(KEY_LENGTH)". In the console, it shows all the extra spaces after the key name. I figure that's because there is no null termination character, but it's weird because it displays fine in a msgbox (no extra spaces).
The MsgBox() Function Calls MessageBoxA(), As I'm sure you are aware.

When VB passes the String to MessageBoxA, it (converts it to ASCII from the native VB Unicode) and then tacks a null character on the end. Since your string probably have a null character (as returned from the Registry function) Messagebox only displays up to that first null character.

The Console, However, does not work this way. The Console is written to using WriteFile(), which basically takes a data block, a size, and then writes it to the handle. In this case, WScript.Echo() passes in the string, and the string length; so ALL of the string gets written. (Note that null characters usually just appear as spaces in the console). The solution? Use something like:

Code: [Select]Struse = Left$(struse,instr(struse,vbnullchar)-1)
before returning it from the EXE.


Quote
Why won't msgboxes display from the activex exe?
Don't know. It works fine for me. Make sure "unattended Execution" isn't checked in the Project properties, Msgbox is ignored if that option is set on compilation.
[/quote]

Quote
Thanks so much for your help I was at this for three hours.
You're Welcome

EDIT:
Actually, now that I think about it, you may find this class useful. As you can see from the comments, I wasn't the original author; however, It is heavily modified from the original version, I fixed several bugs, made it independent of a Module that was originally required, and probably most interesting, I switched the APIs from using the ANSI version (RegReadKeyExA, for example) to using the Wide (Unicode) versions (RegReadKeyExW) when it detects it's running on a NT platform.

Essentially, it wraps almost all the Registry manipulation functions. I've found it quite useful. That being said, I'm not sure how well it would work with VBScript, since there is a lot of strong typing and ByRef Arguments as well in the various public methods. It might make creating your versions easier I guess.


Example-
Code: [Select]'Declarations:
Private mReg as cRegistry
'-------------------------------------------------------------------
'Class Initialize should have this:
Private Sub Class_Initialize()
Set mReg = new cRegistry
End Sub

'and then your EnumKeys Function could be changed as well:
Public Function EnumKeys(strSection As String, keyName As String) As Variant
Dim returnvar as Variant

Dim sCount as Long,sKeys() as String
if mReg.EnumerateSections(sKeys, sCount) Then
Redim returnvar(0 to sCount-1)
'only problem is the fact that it now has to be "CONVERTED" to the variant array...
For I = 1 to sCount
returnvar(I-1) = sKeys(I)

Next I

End If
EnumKeys = returnvar
End Function



It's far from perfect; the strong typing of byRef Arguments means it wouldn't work directly with VBScript, at least not without helper functions, and 1 based arrays? what was I thinking.... Actually, no, I'll just blame the original author for that . But it might be helpful.