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.

2151.

Solve : Redisplaying a JList in Java?

Answer»

I have JList filled with names and a JButton which when clicked deletes the selected item in the JList. The item is now longer in the array that fills the JList because the array is written out and the item is missing but the missing item is still on the screen. How do I GET the item to disappear from the screen?

Thank you COULD you paste the source code of what you have now, so that we may take a look?
Also, now this isn't for a HOMEWORK assignment now is it?/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package updateillegalnames;

/**
*
* @author mittlemanmini
*/
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

public class UpdateIllegalNames extends JFrame implements ActionListener
{
private JList illegalNameJList;
// private ArrayList< String> illegalNames = new ArrayList();
// private final String illegalNames[] = {"SYSTEMS", "PROGRAMS"};
private String [] illegalNames = new String[2000];
public static int illegalNameIndex;
private static int numberIllegalNames = 0;
private JTextField illegalNameTextBox = new JTextField("Enter new illegal nane", 20);
private JButton buttonAdd = new JButton("Add Illegal Name");
private JButton buttonDelete = new JButton("Delete Illegal Name");
public UpdateIllegalNames()
{
super("Add a Name");
setLayout ( new FlowLayout());
illegalNames[0] = "SYSTEMS";
illegalNames[1] = "PROGRAMS";
numberIllegalNames = 2;
illegalNameJList = new JList(illegalNames);
illegalNameJList.setVisibleRowCount(10);
illegalNameJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
buttonAdd.addActionListener(this);
buttonDelete.addActionListener(this);
add(new JScrollPane(illegalNameJList));
add(new JScrollPane(illegalNameTextBox));
add(new JScrollPane(buttonAdd));
add(new JScrollPane(buttonDelete));
illegalNameJList.addListSelectionListen er
(
new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent event)
{
illegalNameIndex = illegalNameJList.getSelectedIndex() ;
System.out.println(numberIllegalNames);
}
}
);
}
public void actionPerformed(ActionEvent e)
{

Object source = e.getSource();
if (source == buttonAdd)
{
illegalNames[numberIllegalNames] = "BLA";
numberIllegalNames++;
repaint();
}
else
{
if (source == buttonDelete)
{// Go rerun the New Hire
System.out.println("EOJ Rerun of state " );
// System.exit(0);

}
}
}


public static void main(String[] args)
{
UpdateIllegalNames updateIllegalNamesJList = new UpdateIllegalNames();
updateIllegalNamesJList.setDefaultClose Operation(JFrame.EXIT_ON_CLOSE);
updateIllegalNamesJList.setSize(300,350);
updateIllegalNamesJList.setVisible(true);



}

}

2152.

Solve : Choosing a programing language?

Answer»

I NEED something to make a GUI program but that doesn't require any downloads on USER's computers and that can access files (modifying and displaying contents).

What I'm trying to acomplish is a program with 3 textboxes, a timer and 2 buttons (or command buttons). Each has it's own function, and I will explain in detail exactly what each does.

Textbox 2 and 3, and Button 2 are invisible.
Textbox 1: User input "username"
Button 1: Makes Textbox 1 and Button 1 invisible, and Textbox 2 and 3 and Button 2 visible.
Textbox 3: Locked (or programming language equivilent), multi-line with a scrollbar.
Textbox 2: User input "text"
Button 2: Appends "Textbox1.Text: TextBox2.Text" (or programming language equivilent) to I:\_Common\file.txt
Timer 1: Every second, clear the contents of TextBox 3 and display the current contents of I:\_Common\file.txt

What programming language can do this WITHOUT anything downloaded on the other computer (.NET for example)?I think all the current Microsoft Visual Studio stuff requires the dot NET. There has been a public statement the NET has security flaws, so you request is very reasonable.
It seems that Visual Basic 5 can create a stand-alone program for most or all of what you want. The program will be larger that need be if you ship it without the run time library. But the run time library is much larger that the program anyhow.
What I mean is the program might be about 4000 bytes, but requires a huger library. Or the program could be about 30,000 bytes and not need anything else.
Quote from: Geek-9pm on April 22, 2009, 02:51:42 PM

I think all the current Microsoft Visual Studio stuff requires the dot NET. There has been a public statement the NET has security flaws, so you request is very reasonable.
It seems that Visual Basic 5 can create a stand-alone program for most or all of what you want. The program will be larger that need be if you ship it without the run time library. But the run time library is much larger that the program anyhow.
What I mean is the program might be about 4000 bytes, but requires a huger library. Or the program could be about 30,000 bytes and not need anything else.

Visual Basic 6 has stopped being made, so I think the same goes for VB5 (and I'm not pirating anything!)

But size isn't an EXTREME issue...although the smaller the better.VB6 you probably still can buy a copy of it on Ebay.

But .NET apps always require .NET framework.Quote from: macdad- on April 22, 2009, 03:05:53 PM
VB6 you probably still can buy a copy of it on Ebay.

But .NET apps always require .NET framework.

I'm sorta looking for something that doesn't require payment (free versions are ok though, not demos please).


A while ago Dias was talking about FreeBasic and QBasic...do these require .NET and where can I get them if they don't?if you have excel, you can use VBAQuote from: Helpmeh on April 22, 2009, 03:08:48 PM
I'm sorta looking for something that doesn't require payment (free versions are ok though, not demos please).


A while ago Dias was talking about FreeBasic and QBasic...do these require .NET and where can I get them if they don't?

FreeBasic and QBasic(plus JustBasic, use it myself) don't require .NET, they're completely seperate. All three are free:

FreeBasic Download\
Just Basic DLoad
And QBasic you can get free with MS-DOS 6.22, I believe on MS's website.not to go off topic too much but I'm wondering, is python a useful language? I found a book in my garage that details how to program in python but probably it's something my dad left there.... Quote from: x2543 on April 25, 2009, 06:42:43 PM
is python a useful language?
of course. Quote from: gh0std0g74 on April 25, 2009, 07:22:33 PM
of course.

Thought so, but where is it being used? Quote from: x2543 on April 25, 2009, 10:38:50 PM
Thought so, but where is it being used?
Its a general purpose programming language. you can do a lot of stuffs with it.
1) system administration task eg copy/move files, rename files, etc
2) string manipulation and text processing.
3) With libraries/modules written for it, you can do stuffs like creating PDFs , reading Word/excel documents, crawling the web etc
4) Creating GUIs and many more

you might want to read the Python wiki on where its being used.Quote
Thought so, but where is it being used?

In the places where people use it.

Network administrators, system integrator, software engineers, department managers and anybody who needs to get a JOB DONE with information and a computer on a network or off.

But python is not used for basket-weaving. But you already knew that after you finished basket-weaving 101.HTAs are quite interesting
2153.

Solve : memory map and address values?

Answer»

Could anyone tell me how I could find out all about my memory within my motherboard and hard drive so that I can use the pointers I learned about in C++? Also, could you tell me, besides the ASCII values, what the other values in the memory addresses mean, especially how I can access graphics and sound? Thanks. You have some interesting observations.
ASCII is a definition. he value 20 in memory represent the ASCII char @ and 21 is the letter A. But they are not self-identified objects. I once had a student ask me how to you tell the difference between code and data. I did not quite know how to answer him. There are no built-in feature that do that, except by position. Having CODE in one part of memory and DATA in another part SEPARATES them only by position.

With C++ you should have a Development Environment that helps you visualize how things are done internally by the computer. But this does not mean you should lean all the POSSIBLE codes to improve your skills. A common ERROR for ome is to think that the literal form of a symbol is better that just using the symbol.
Consider this:
20
64
@
These can all be references to the same bye value in memory. Is it ASCII? Maybe, maybe not. Is it DATA? Yes, it is DATA. But is it Code? Again, that would depend on how and where it is being used.Many model tools, such as C++, requires us to MAKE a meaningful expression of an idea that will be correctly put into suitable binary codes.

The sequence 2021 could be a special form of the AND instruction. Maybe not. Perhaps it was MEANT to be the just @A but not the AND instruction.
I do hope this was of some help.

2154.

Solve : Function Call argument list parsing...?

Answer»

Over the course of it's development, my Expression evaluator has consistently had issues with it's "ParseArguments" routine, shown below. The idea is, given a string such as "X,14,Sin(12)*56/i,12", which has already been ripped out of a function call parameter list elsewhere in my code, to parse it and return a array of strings representing each argument. In this case, the return would be an array:

0= "X"
1= "14"
2= "Sin(12)*56/i"
3= "12"


The issue here is that I am constantly, running into subtle bugs in the edge cases (single argument items, for example) and throughout it's existence I have added kludges to get it working each time. So my question is- is there not an easier way to do this? It works- but is there something I'm doing that causes me to require all these kludges?


ALSO: ARGSEP is a constant that is set to ","
Code: [Select]Public Function ParseArguments(ByVal FromString As String, Optional ByVal BracketStart As String = DefaultBracketStart, _
Optional ByVal Bracketend As String = DefaultBracketEnd, Optional ByVal ARGUMENTSEP As String = ARGSEP, Optional ByRef startpos As Long = 1) As String()

'NOTE: this routine REALLY needs to be rewritten!
'full of hacks and kludges...

'ParseArguments Function:
'assumes the given string is a parameter lists.
'keeping track of parentheses and quotes, it finds the next ARGSEP that is not part of some other token.



Dim CurrPos As Long
Dim SplMake() As String
Dim CurrArgument As Long, Char As String
Dim inquote As Boolean, BracketCount As Long
Dim ArgStart As Long
'If there isn't even a separator in the string, at all, return the string as the single argument
If InStr(FromString, ARGUMENTSEP) = 0 Then
ReDim SplMake(0)
SplMake(0) = FromString
ParseArguments = SplMake
Exit Function

End If


If Len(FromString) <= 0 Then
Erase SplMake()

ParseArguments = SplMake
Exit Function
End If



CurrArgument = 0
CurrPos = startpos
ArgStart = CurrPos
Do
Char = Mid$(FromString, CurrPos, 1)
Select Case True
Case Char = """"
inquote = Not inquote

Case inquote And CurrPos < Len(FromString)
'ignore as long as we are in a string.

Case InStr(BracketStart, Char) <> 0 And Char <> ""
BracketCount = BracketCount + 1
Case InStr(Bracketend, Char) <> 0 And Char <> ""

BracketCount = BracketCount - 1
If BracketCount < 0 Then
'Sigh.
BracketCount = 0

End If


Case InStr(CurrPos, FromString, ARGUMENTSEP) = 0
ReDim Preserve SplMake(CurrArgument)
SplMake(CurrArgument) = Mid$(FromString, CurrPos)
Exit Do
Case Char = ARGUMENTSEP, (CurrPos >= Len(FromString))
'Stop
'If ((Not Inquote) Or _
(CurrPos >= Len(FromString))) And BracketCount = 0 Then
If ((Not inquote) And BracketCount = 0) Or (CurrPos >= Len(FromString)) Then
'wow, that is very strange, heh?
'This will only be true when inquote=false (0) and bracketcount=0 as well.
ReDim Preserve SplMake(CurrArgument)
SplMake(CurrArgument) = Mid$(FromString, ArgStart, Abs(CurrPos - ArgStart))
If right$(SplMake(CurrArgument), 1) = ARGUMENTSEP Then
SplMake(CurrArgument) = Mid$(SplMake(CurrArgument), 1, Len(SplMake(CurrArgument)) - 1)
End If
CurrArgument = CurrArgument + 1
ArgStart = CurrPos + 1

If CurrPos >= Len(FromString) Then
' If InStr(1, Bracketend, right$(SplMake(CurrArgument - 1), 1), vbTextCompare) <> 0 And BracketCount <= 0 Then
' SplMake(CurrArgument - 1) = Mid$(SplMake(CurrArgument - 1), 1, Len(SplMake(CurrArgument - 1)) - 1)
' End If


Exit Do

End If
End If

End Select

CurrPos = CurrPos + 1
Loop
If UBound(SplMake) = 0 Then
If SplMake(0) = "" Then
'there weren't any arguments- return an actual "Empty" array to denote this to the caller.
Erase SplMake
End If
End If
startpos = CurrPos
ParseArguments = SplMake
End Function
As usual, I have no idea of what you are doing. I do better with 'top down' programming. Perhaps you are USING queue/stack solution.
This item: "Sin(12)*56/i"
would suggest that yup need an expression evaluator and maybe a floating pint match kit. I will comment on the expression evaluator. This KIND of expression is often called a left to right evaluation, but with FORTRAN rules. Which means that he parser is cgoing to to do some look ahead or even read the thing right to left.
But going going left to right, we parse SIM and DETERMINE that is a function we know, will put a token, perhaps a pointer, into a queue (read stack) to identify that item. Next we look inside the left _( and find a constant and next find the right_) Now can call SIM with the value. Next find an atom the denotes multiply, so will queue that with the value return by SIM. We find a constant and an atom for divide, lower precedence, so perform what we now have in the queue. Note that divide is coming. Queue it. Next is looks like a variable, go get its value... and so one.

Anyway. I would use an expression evaluator made by somebody else But this is not new stuff. Was that not done bu Egyptians on clay tablets?
Sorry.. I can not take anymore... I need a Tylenol.



why dont you use split function?

Code: [Select]msg = "SPLIT" & vbCrLf
s = "X,14,Sin(12)*56/i,12"
s = Split(s, ",")
For i = 0 To UBound(s)
msg = msg & "s(" & i & ") = " & s(i) & vbCrLf
Next

msg = msg & vbCrLf & "ParseArguments()" & vbCrLf
s = "X,14,Sin(12)*56/i,12"
s = ParseArguments(s)
For i = 0 To UBound(s)
msg = msg & "s(" & i & ") = " & s(i) & vbCrLf
Next

MsgBox msg
i tested out and both return same result, or is it you are writing an optimized version of microsoft split?Quote from: Reno on April 23, 2009, 04:51:45 AM



why dont you use split function?

Code: [Select]msg = "SPLIT" & vbCrLf
s = "X,14,Sin(12)*56/i,12"
s = Split(s, ",")
For i = 0 To UBound(s)
msg = msg & "s(" & i & ") = " & s(i) & vbCrLf
Next

msg = msg & vbCrLf & "ParseArguments()" & vbCrLf
s = "X,14,Sin(12)*56/i,12"
s = ParseArguments(s)
For i = 0 To UBound(s)
msg = msg & "s(" & i & ") = " & s(i) & vbCrLf
Next

MsgBox msg
i tested out and both return same result, or is it you are writing an optimized version of microsoft split?


I'm not using split because it doesn't work.


tell me what the string "34,Sin(1),RANDOM(1,4)" returns.

the desired output is {"34","Sin(1)","RANDOM(1,4)"}, but split decides otherwise.

the reason is of course that it cares not for brackets, so I keep track of the number of open brackets as I proceed through, and also the number of quotes (again- Split cares not for quotes)


Quote from: Geek-9pm on April 22, 2009, 03:39:20 PM
As usual, I have no idea of what you are doing. I do better with 'top down' programming. Perhaps you are using queue/stack solution.
This item: "Sin(12)*56/i"
would suggest that yup need an expression evaluator and maybe a floating pint match kit. I will comment on the expression evaluator. This kind of expression is often called a left to right evaluation, but with FORTRAN rules. Which means that he parser is cgoing to to do some look ahead or even read the thing right to left.
But going going left to right, we parse SIM and determine that is a function we know, will put a token, perhaps a pointer, into a queue (read stack) to identify that item. Next we look inside the left _( and find a constant and next find the right_) Now can call SIM with the value. Next find an atom the denotes multiply, so will queue that with the value return by SIM. We find a constant and an atom for divide, lower precedence, so perform what we now have in the queue. Note that divide is coming. Queue it. Next is looks like a variable, go get its value... and so one.

Anyway. I would use an expression evaluator made by somebody else But this is not new stuff. Was that not done bu Egyptians on clay tablets?
Sorry.. I can not take anymore... I need a Tylenol.




My parser was originally a Stack-based solution but upon reflection it really ends up as a recursive descent parser.

Support for complex numbers and a number of interfaces one can implements plugins through (Ioperable objects that support operations/functions on their instances), and "IEvalEvents" implementors that can add new Functions/Operators to the evaluator as well. The Stack created initially to store the parsed expression is really just a list of tokens (functions, operators, literals) which have all the data they need. The Function and SubExpression types (IT_FUNCTION and IT_SUBEXPRESSION) are most interesting, because they perform no real parsing of the arguments/contents themselves. The SUBEXPRESSION type (with parentheses) simply creates another parser object, setting it's expression to the contents of the paretheses. Same for the Function parameters (Except the function parameters store a number of "CParser" objects in the Linked List that "RipFormula" creates.


Because of this, it can Optimize far better. The parser stores each Stack created into a global collection, keyed by the expression used to build it. It consults this collection to determine wether another parser object hasn't already parsed it. If it has, it simply retrieves the stack as stored; otherwise, it rips the formula itself, and then stores the resulting stack.


executing, for example:

Code: [Select]"Sin(RANDOM(1,10*STORE(X,5))*{1,2,3}"

will end up in a grand total of 9 stacks being CACHED. This means that if, for example, a later execution of:

[code]
10*STORE(X,5)
is performed, anywhere- there will be no need to perform the expensive task of ripping the stack from the string, instead it will just grab it from the stack.

Of course, storing all these stacks can me hard on RAM with longer runs, so each "configuration set" (a name given to a set of Plugins and settings; useful for applications that always want to have the parser load plugins specific to the app) each one can specify the maximum number of Cached Parse Stacks. the Purges are performed by deleting old entries from the collection until the count is acceptable.

Additionally, it has intrinsic support for method calls on object-type variables. For example, the following would start word and display it, if it's installed:

Code: [Select]STORE(Word,CREATEOBJECT("Word.Application");
[emailprotected](True);
STORE(Word,Nothing);


the @ operator implements eventually) a set of queries to the objects type information and then performs InvokeHook with the appropriate parameters, after inspecting wether the member is a method or property.

In any case, I had to fix a few subtle issues with the previous incarnation:


Code: [Select]Public Function ParseArguments(ByVal FromString As String, Optional ByVal BracketStart As String = DefaultBracketStart, _
Optional ByVal Bracketend As String = DefaultBracketEnd, Optional ByVal ARGUMENTSEP As String = ARGSEP, Optional ByRef startpos As Long = 1) As String()

'NOTE: this routine REALLY needs to be rewritten!
'full of hacks and kludges...

'ParseArguments Function:
'assumes the given string is a parameter lists.
'keeping track of parentheses and quotes, it finds the next ARGSEP that is not part of some other token.

'Added May 06 2008 10:50 PM:

'recognize the use of a "To" keyword between two arguments.

Dim CurrPos As Long
Dim SplMake() As String
Dim CurrArgument As Long, Char As String
Dim inquote As Boolean, BracketCount As Long
Dim ArgStart As Long
'If there isn't even a separator in the string, at all, return the string as the single argument
If InStr(FromString, ARGUMENTSEP) = 0 Then
ReDim SplMake(0)
SplMake(0) = FromString
ParseArguments = SplMake
Exit Function

End If


If Len(FromString) <= 0 Then
Erase SplMake()

ParseArguments = SplMake
Exit Function
End If



CurrArgument = 0
CurrPos = startpos
ArgStart = CurrPos
Do
Char = Mid$(FromString, CurrPos, 1)

Select Case True
Case Char = """"
inquote = Not inquote

Case inquote And CurrPos < Len(FromString)
'IGNORE!>
'ignore as long as we are in a string.

Case InStr(BracketStart, Char) <> 0 And Char <> ""
BracketCount = BracketCount + 1
Case InStr(Bracketend, Char) <> 0 And Char <> ""

BracketCount = BracketCount - 1
If BracketCount < 0 Then
'Sigh.
BracketCount = 0

End If


Case InStr(CurrPos, FromString, ARGUMENTSEP) = 0 And BracketCount = 0 And Trim$(Mid$(FromString, CurrPos)) <> ""

ReDim Preserve SplMake(CurrArgument)
SplMake(CurrArgument) = Mid$(FromString, CurrPos)
Exit Do
Case Char = ARGUMENTSEP, (CurrPos >= Len(FromString))
'Stop
'If ((Not Inquote) Or _
(CurrPos >= Len(FromString))) And BracketCount = 0 Then
If ((Not inquote) And BracketCount = 0) Or (CurrPos >= Len(FromString)) Then
'wow, that is very strange, heh?
'This will only be true when inquote=false (0) and bracketcount=0 as well.
ReDim Preserve SplMake(CurrArgument)
SplMake(CurrArgument) = Mid$(FromString, ArgStart, Abs(CurrPos - ArgStart))
If right$(SplMake(CurrArgument), 1) = ARGUMENTSEP Then
SplMake(CurrArgument) = Mid$(SplMake(CurrArgument), 1, Len(SplMake(CurrArgument)) - 1)
End If
CurrArgument = CurrArgument + 1
ArgStart = CurrPos + 1

If CurrPos >= Len(FromString) Then
' If InStr(1, Bracketend, right$(SplMake(CurrArgument - 1), 1), vbTextCompare) <> 0 And BracketCount <= 0 Then
' SplMake(CurrArgument - 1) = Mid$(SplMake(CurrArgument - 1), 1, Len(SplMake(CurrArgument - 1)) - 1)
' End If


Exit Do

End If
End If

End Select

CurrPos = CurrPos + 1
Loop
If UBound(SplMake) = 0 Then
If SplMake(0) = "" Then
'there weren't any arguments- return an actual "Empty" array to denote this to the caller.
Erase SplMake
End If
End If
startpos = CurrPos
ParseArguments = SplMake
End Function

The core itself implements support for Complex arithmetic, (heh, all I had to do was create an "IOperable" implementing object for Complex numbers, handle the appropriate interface functions and add a variable "i" to a complex number with it's imaginary part set to 1 and the realpart set to 0, and then set that variable as read-only.),Arrays (for example, {1,2,3}*{5,6,7} will work fine).


quite an interesting library.
[/code]Quote
from BC programmer
The core itself implements support for Complex arithmetic, (heh, all I had to do was create an "IOperable" implementing object for Complex numbers, handle the appropriate interface functions and add a variable "i" to a complex number with it's imaginary part set to 1 and the realpart set to 0, and then set that variable as read-only.),Arrays (for example, {1,2,3}*{5,6,7} will work fine).

Did you really do that on stone tablets?
So, complex numbers is not a FORTRAN thing?
NO, IT WAS JUST NOW INVENTED BY INTEL l!
http://software.intel.com/en-us/articles/using-sse3-technology-in-algorithms-with-complex-arithmetic-1/

AAahh. The Tylenol was not enough,
and I just ran out of Advil.


I realize fortran implemented complex numbers as part of the core.


Name one Expression evaluator, that I can get for FREE that can do half of what Mine is capable of and you get- well, nothing, I guess. It's the thought that counts.


Also, Complex numbers existed in mathematics long before fortran or any computers existed.BC programmer, you need some FORTRAN. Now every day, but once a month may be enough. Just this year the FREE source code for FORTRAN 77 was released.
http://www.thefreecountry.com/compilers/fortran.shtml
It this is of any value, let me know. I am curios to see how they did the parser way back then. The say there was a FORTRAN interpreter. Huh? I was taught the FORTRAN is NEVER done that way. Did they deceive me?
2155.

Solve : C++ programing?

Answer»

I can't FIGURE out how to write this program.

Write a program that prompts the user to enter four integers and reads all four values with a single scanf statement. Write statements to find the square of each value. Print the values and their squares in a labeled aligned as in the example shown below:
Number Square
5 25
10 100
15 225
20 400Couldn't you just store those numbers in variables? Then use those variables in the MATH operation? It seems a beginners homework??Still that seems what he should do, even from a point of view from a person that has no real SOLD codeing experince. Not that I havent just things LIKE this an such. But I'm working at it.This is C# INSTEAD of C++ but the logic is the same, just substitute the syntax for whatever C++ uses.

static void Main(string[] args)
{
int[] square = new int[4];
int[] total = new int[4];

for (int i = 0; i < square.Length; i++)
{
Console.Write("Enter an integer: ");
square = Convert.ToInt32(Console.ReadLine());
}

for (int j = 0; j < square.Length; j++)
{
total[j] = square[j] * square[j];
}

Console.WriteLine("Number\t Square");

for (int k = 0; k < square.Length; k++)
{
Console.WriteLine(" {0}\t {1}", square[k], total[k]);
}

}
Did you succeed in converting the C# code to C++?
#include
#include
using namespace std;
int main()
{
int num[4];
for(int n=0;n<4;n++)
{
cout<<"enter a number\n";
cin>>num[n];
}
for(int z=0;z<4;z++)
{
cout<)<<endl;
}

this should work
I think your missing a } but not sure I did java so I could be wrong here.yes, there is a missing }I thought so not sure if it was throwing him off or not havent done java in a while.

2156.

Solve : How to: I have a file whose filename contains blanks...?

Answer»

I have a file whose filename contains blanks... I am ATTEMPTING to CHECK for the existance of this file using a DOS script... and have not been ABLE to find the proper delimiters so that I can test for the existance of the file. Sample would be:
====================
IF EXIST Some File Name.xld
GOTO FOUNDFILE
====================
How can I prioperly DELIMIT the filename Some FIle Name.xld ? I have tried "Some FIle Name.xld" without success.quotes.
Where are you looking for the file? if you don't change the directory or include the directory spec, it might not find it.If the filename contains spaces it MUST be contained within quotes

i.e. IF EXIST "looking for this file.doc"
GOTO FOUNDFILE

2157.

Solve : java JOptionPane?

Answer»

Hello guys,
I have started learning Java programming and as I learn I write some small programs to test what I have learned. I wrote a program that will open a small window and ask the user to INPUT a string of characters. Then the program counts the characters and displays the total number. It all works good.But this is my question, I would LIKE to improve the program so that it shows the count in a window instead of my IDE(I use Netbeans 6.5) .Below is the source code:

import javax.swing.JOptionPane;

public class WORDLENGTH {

public static VOID main ( String args[] ){

String name = JOptionPane.showInputDialog("What is the word?");
System.out.println(name);
int n = name.LENGTH();
System.out.printf("The length of the word is %d\n", n);
System.exit(0);
}
}

Thank you in advance!

2158.

Solve : Find path in the Win Registery?

Answer»

Yes, but if we look at your code:
Quote from: Reno on April 18, 2009, 03:28:04 AM

Code: [Select]@echo off & setlocal & set sim=

set q="HKLM\software\maxis\the sims" /v installpath
for /f "skip=4 tokens=2*" %%a in ('reg query %q%') do set sim=%%b

if defined sim echo COPY *.iff "%sim%"
Nothing tells it to USE "The Sims\GameData\Userobjects\filename\filename.iff"

When I read your code, something tells me the path "The Sims\filename\filename.iff" would be used, which I don't get why isn't

I mean, Where does it get "GameData\UserObjects\" from?
It's not even in the script, or defined in the win registeryQuote from: Ryder17z on April 18, 2009, 11:14:38 AM
Yes, but if we look at your code:Nothing tells it to use "The Sims\GameData\Userobjects\filename\filename.iff"

I mean, Where does it get "GameData\UserObjects\" from?
It's not even in the script, or defined in the win registery
how would i know where it get the value, why dont you tell me. i am not the one who makes the sim. and i even never play the sims.
i only post code based on your description, assuming %installpath%\gamedata\userobjects\filename\ is the default folder for iff files. ( see below )
Quote from: Ryder17z on April 18, 2009, 05:03:34 AM
It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder
How can I tell you if I don't know the answear?


The path in the script is different than the actual path used
/\ /\
| |
| |
"The Sims\filename.iff" |
||
||
"The Sims\GameData\Userobjects\filename\filename.iff"


I feel confused change the path in the script to be the actual path used. No need to do since it works already, but it works like MAGIC, nobody knows how, they just know it works Code: [Select]set q="HKLM\software\maxis\the sims" /v installpath


this takes it from the registry.
2159.

Solve : Hardware and ASM?

Answer»

Due to some reasons, I had to LEARN Assembly urgently.

So I would like to know the way to:

  • Open/Close the CD drive.
  • Turn/Reboot the router connected to the Ethernet port.

with ASM.

I would like to have example code.

Thanks in advance.
Sure looks like school work. Why USE ASM?
How do I MAKE you guys believe that it is not school work. If it was school work, why would I take the PITA to get here, was it not simpler to refer the textbook? (AND.. AND.. WE ARE JUST TAUGHT S**KING QBASIC IN SCHOOL)

I went forward to C/C++, and Assembly just because of my interest.

Have I made it sure that it iS NO SCHOOLWORK??



If you display such an attitude, you will get very little help.
a school that teaches QBASIC?

the Open/CloseCD can be done through MCI commands. of course you'll need to set up the parameters and so forth and call the procedure itself in mmsystem or whatever the dll is.

the second one is impossible in any language as far as I know. I imagine being able to disable a router remotely would be a fairly big security flaw even if it only COULD occur from within the local LAN.Sorry for getting late.

Dias De Verano: Sorry, I was too irritated (due to some other people around in here) while making that post.

BC_Programmer:
Thanks for help.

I can reboot the router from its configuration page. So I thought that it should be possible to do so with Assembly as well.


Quote from: Ashutosh32 on February 27, 2009, 07:57:10 AM
I can reboot the router from its configuration page. So I thought that it should be possible to do so with Assembly as well.


well you can, but it won't be easy.

you'll literally need to send the router specific packets that would mirror those sent by a PC- this includes keeping track of a open TCP/IP connection, and usually a security layer to boot.

So you would need to be able to program the network card to send those packets and parse any replies back from the router as well in order to determine the current state of the router.

Really by "impossible" I meant "prohibitively time consuming", it would take a long time to perfect- and that portion of the program would only work with a specific model of router, and maybe even only a specific firmware revision.
2160.

Solve : Logging in failing (batch)?

Answer»

I am TRYING to make get a user to log in, to use the batch script, but the login is failing in the second FOR loop...

Here is my code. List.txt is a file with about 30 lines, each different. The first word is a possible username, the second a possible password. No usernames are the same.

Code: [Select]@echo off
setlocal enabledelayedexpansion
set fname=list.txt
:looplog
set num1=0
set num2=0
echo ENTER your username.
set /p USR=Username^:
Echo Enter your password.
set /p PASS=Password^:
pause
for /f "delims=" %%z in ('type %fname%') do (
set /a num1+=1
)
echo Lines^: %num1%
pause
for /f "tokens=1-2 delims= " %%a in ('type %fname%') do (
if "%%a"=="%usr" if "%%b"=="%pass%" goto cont
set /a num2+=1
if %num2%==%num1% CLS & echo Username and/or password don't match. & goto looplog
)
:cont
echo HI!
pause
For some reason, the second FOR loop is not LOOPING...so it just keeps on going as if it didn't exist...

if "%%a"=="%usr" if "%%b"=="%pass%" goto contQuote from: Geek-9pm on April 19, 2009, 07:43:35 PM


if "%%a"=="%usr" if "%%b"=="%pass%" goto cont
I did not see that...
2161.

Solve : Need Visual c# help?

Answer»

Hello, i'm new to this forum and I have a question. USING Microsoft visual c# how do I make a new window POP up.

IE: An INSTANT messenger, when you click on the message button a window POPS up showing the conversation.

I'm not sure my question is very clear, so if you have any questions to ask me then please FEEL free to go ahead.

2162.

Solve : Batch script to check files?

Answer»

Experts

I am new to batch programming and NEED some help here. I am looking for a batch script for following
task.

a) Say in folder A, i have 10 files which are updated daily. i need to check these files and if the files are
updated with latest timestamp then copy to destination folder. The no of files in folder A may vary.
b) if among 10 files, any file is not updated then display error, saying this file is not updated.
b) On destination, before copying i need to archive existing files.



Thanks in advance.what is "latest timestamp"? Is it today's date? What is your LOCAL date format?

How will you "archive"?


Dias de verano,

Yes it's today's date and date format is mm/dd/yyyy format. IF you know Perl and can use it, here's an alternative SOLUTION.
Code: [Select]use strict;
use warnings;
use File::Find;
use File::Copy;
use Archive::Tar;
use Cwd;

my $dir="c:/test";
my $destination="c:/destination";
my $archive_destination="c:/archive_destination";
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$year+=1900; $mon+=1;
my $archive="$year-$mon-$mday-$hour-$min-$sec.tar"; #set archive filename


sub archive {
my $cwd = getcwd();
chdir($destination);
my @filelist;
while(<*>){ -f && push(@filelist,$_); } #get files to archive
my $tar = Archive::Tar->new;
$tar->add_files(@filelist);
$tar->write($archive);
move($archive,$archive_destination); #move archived file to destination
foreach(@filelist){
unlink $_ ; # remove files after archive.
}
chdir($cwd);
}

sub wanted {
if ( lstat($_) && -f _ && (int(-M _) == 0) ) {
my $filename = $File::Find::name;
print "moving $filename to $destination\n";
move("$filename","$destination") or warn "Cannot move $filename to $destination; $!\n";
} elsif ( -f _ ) {
print "File not updated: $filename\n";
}
}

archive;
find({wanted => \&wanted}, "$dir");
If I may say so, ghostdog, an excellent solution! Thanks Ghostdog, but i need script which needs to be scheduled and hence looking for some batch script
Quote from: satya85 on April 21, 2009, 07:52:59 AM

Thanks Ghostdog, but i need script which needs to be scheduled and hence looking for some batch script

open your editor, type in

perl myscript.pl

save as mybatch.bat. Use the task scheduler to run it periodically.

Otherwise, wait for other solutions to come by.i tried to save the perl script to mybatch.bat and ran that script, didnt work. No- he means you save the perl file as a perl file (.pl) and then create a small batch file that invokes the perl interpreter with t hat perl code. you can then set up an automated task using the batch just as you would have given a pure batch solution.ok got it , i installed active perl to run this. Anyways i need a batch script that does the same. Thanks ghostdog for the perl script.

can i have text file that has list of file names and then pass each file name as parameter to check for timestamp and move to destination folder.Quote from: satya85 on April 21, 2009, 10:08:20 AM
ok got it , i installed active perl to run this. Anyways i need a batch script that does the same. Thanks ghostdog for the perl script.

can i have text file that has list of file names and then pass each file name as parameter to check for timestamp and move to destination folder.
sure
Code: [Select]use File::stat;
use Time::localtime;
use File::Copy;
my $destination = "some path";
open(FH,"<", "file") or die "Cannot open file:$!";
while (<FH>){
CHOMP; #get rid of newline
my $st = stat($_) or die "No $_: $!";
my $timestamp = $st->mtime; #get file modified time in SECS since epoch
# depending on how you want to check time stamp ..code here
move($_,$destination);

}
close(FH);

please read up the documentation to get started. perldoc perl.

2163.

Solve : Run multiple files sequentially using Batch file commands?

Answer»

I have problem regarding autorun.
My question is:
How can I run MULTIPLE files sequentially?

currently i tried with
autorun.inf
[autorun]
open=open.bat

open.bat
start \file1.exe
start \file2.exe

using this my files are running simultaneously which is not as per my requirement.

I want, only after COMPLETING EXECUTION of file1.exe, my second file file2.exe should get start.

So plz give me suggetion for running multiple files sequentially in autorun.
What commands I have to write in batch file for executing multiple files sequentially?

anivij
devdutta.... spdch... whatever your name is.


your not fooling anybody.


Obviously you intend to make something malicious- otherwise you would have found a veritable method of doing so legitimately.


have you yet tried "START /?"



Thanx for giving such name to me.
If you r so intelligent then give me solution for this....no, it cannot be done in batch. PERIOD.

so cut the crap, stop creating multiple accounts, and stop spamming. Quote from: anivij on April 15, 2009, 04:57:53 AM

Thanx for giving such name to me.
If you r so intelligent then give me solution for this....

if you r get it ur SELF dickw33d. This is not script kiddy help site. Quote from: Reno on April 15, 2009, 05:05:43 AM
no, it cannot be done in batch. PERIOD.

so cut the crap, stop creating multiple accounts, and stop spamming.
Actually it can...but the maliciousness that would befall if I said it here would get it removed if I did say it.It's easy. I already gave them a hint. But chances are they won't follow it anyway.Quote from: BC_Programmer on April 19, 2009, 10:58:03 AM
It's easy. I already gave them a hint. But chances are they won't follow it anyway.
Even then it doesn't always work...my computer requires you to start something else then CALL the batch file.
2164.

Solve : C# Help, How do I find the amount of letters in a string??

Answer»

I would like to know how I can know how MANY letters are in the string with out KNOWING the word?

EXAMPLE code:

using System;

public CLASS word
{
public static void Main()
{
string EW = Console.ReadLine();
char o = EW[0];
//I would like to know how many letters are in EW so I can do this.
if (Amount of Letters in EW == 2)
char t =EW[1];
}
}

Can I get some help? if you want to know how long it is, there is a method for that. If you literally need to count the letters A-Z as they appear in the string, then you'll need to loop through the characters in the string, and each one that is A-Z increments the count..Quote from: BC_Programmer on February 27, 2009, 08:16:23 PM

if you want to know how long it is, there is a method for that. If you literally need to count the letters A-Z as they appear in the string, then you'll need to loop through the characters in the string, and each one that is A-Z increments the count..
I'm not interested in the letters A - Z just how long the word is...
How do I use the method you suggest?
BTW thanks for the quick reply!Quote from: hibyy on February 27, 2009, 08:22:58 PM
Quote from: BC_Programmer on February 27, 2009, 08:16:23 PM
if you want to know how long it is, there is a method for that. If you literally need to count the letters A-Z as they appear in the string, then you'll need to loop through the characters in the string, and each one that is A-Z increments the count..
I'm not interested in the letters A - Z just how long the word is...
How do I use the method you suggest?
BTW thanks for the quick reply!

In VB6 it is the "LEN" function- for .NET it is the string method, "length".

For example; if your variable was strval, the length would be "strval.Length()"


Thanks this will help me a lot!

ERROR?
Fixed

public class word
{
public static void Main()
{
string EW = Console.ReadLine();
char o = EW[0];
string L = EW.Length();
if ( EW.Length == 2)
char t =EW[1];
}
}

I got an error!

(7,15): error CS0118: 'string.Length' denotes a 'property' where a 'method' was expected

How do I fix this?
2165.

Solve : how can i do paging in vb6 using msaccess2003??

Answer»

good day guys!,

i'm a noob in vb and i have this skul project. i' trying to retrieve data from my MSACCESS db to display in a form and i NEED to page them, like for example, if there are 20 items stored then my page limit is 10 so i would have 2 pages.. does anybody out there who knows about this please kindly help me? even just provide me a simple example of this paging in visual basic?do you mean you want to use the same set of controls to store different portions of the data based on the selected "page" number?yeah i guess so.. i have this 50 records and i want to display 10 records in each form ..One possible solution is to create a UserControl that will show each record- and then use the DataRepeater control to "multiply" your usercontrol.

The datarepeater control will handle the "paging" of your controls- in that the user will be able to scroll through all of them dynamically, even though the DR control only LOADS as many of your controls as necessary.

reference:

http://msdn.microsoft.com/en-us/library/aa231248(VS.60).aspx


If that isn't the effect your looking for, another solution is to use one of the data bound controls- all of these solutions eliminate the need for "paging", but of course this might be a REQUIREMENT...

If your accessing the database "raw" via ADO or DAO, then you can simply change the offset where you start loading data into controls- for example, upon loading the DB determine the number of pages by getting the number of records and dividing by the number of items per page, and then determining the starting location when loading data by multiplying the page number by the number of items per page to arrive at the starting offset to use in a call to the DB record pointer movement methods. Then just loop through for each item on the page and populate as appropriate.

2166.

Solve : Intel 8086 Processor for external hardware?

Answer»

I'm working on kinda robotics with no A-B-Cs of it.

So the question is: Can we control external stepper motor with the 8086 processor?

Any advice is highly appreciated.

Thanks.
-Ralphyour going all the way back to a 8086???

but yes you can do this. just CONNECT for outside transitors to it(power BIPOLAR transistors) and tell it to TURN on each pin the transitor is connected to it in a stepping pattern. and then you can connect the transitors to the stepper.

but i need more specifics for better advice.Thanks for reply.

Then lets get to something modern..
It'd better if you could advice the best Processor to use.

Specifics? Like?


- RalphYou would not use a real 8086 unless you wanted to design all the INTERFACE stuff - you would use a microcontroller such as the AMD Am188ES which uses 8086 code.

You need to learn the basics yourself from books or classes.

Yeah, I accept that I haven't read at all.

Well, how about using the processor right in the cabinet? I mean can I use it my motor as external hardware which can be controlled (I can write programs to do so) from Windows?

RalphI expect so, sounds pretty *censored* likely, look at all those usb missile launchers, must be a big hobby thing, find out how to Google, get a book from the library, subscribe to a robot magazine, join your local town's robot CLUB, etc.

http://www.botmag.com/

http://www.google.com/search?source=ig&hl=en&rlz=&=&q=robot+hobby&btnG=Google+Search&meta=lr%3D
or try using a LPT port and cut the printer cord to control each motor with the transistor setup i told you about.

i've done this before and its really good: trying to remember the link.

2167.

Solve : Masking user input. (Batch+VBS)?

Answer»

I posted this in the MS-DOS section, but this STRAYS from batch, and I need more help. I need to mask the user's input, with an asterisk or a dot thing. I TRIED the other solutions, which accept 1 letter at a time, but that can't work because there can be over 30 possible passwords, listed in a file. Here is what I am trying to do, but hiding the password from prying eyes.

Code: [Select]@echo off
title School Chat
set num1=0
set num2=0
set fname=I:\Common\t3hwin\name
:looplog
cls
echo Enter your username.
set /p usr=Username^:
Echo Enter your password.
set /p pass=Password^:
for /f "delims= " %%l in ("%fname%") do set /a num1+=1
for /f "tokens=1-2 delims= " %%a in ("%fname%") do (
if "%%a"=="%usr" if "%%b"=="%pass%" goto cont
set /a num2+=1
if %num2%==%num1% echo Username and^/or password don't match.&pause &GT; nul&goto looplog
)
:looplog
echo Logged in!
pause
The actual logging in might not work successfully (I'm working on it), but I need to mask the password input, so in other words, I need your help.

see here for something similar. As an alternative, why not start LEARNING some other languages and using already made modules. eg Perl
Code: [Select]use Term::READKEY;
print "Enter password: ";
ReadMode('noecho');
$password = ReadLine(0);
ReadMode 0;
Quote from: gh0std0g74 on April 19, 2009, 01:51:45 AM

why not start learning some other languages and using already made modules. eg Perl

Ghostdog, you have to pay to see a solution on Experts Exchange! Even for the "free 7 day trial" you need a credit card, and I wouldn't bother. Unless you remember to cancel, they'll hit you for $12.95 per month. Googling for scripts and "solutions" , and passing them off as your own work, is all very well, if you do it with more care.

Anyhow, I didn't get this via Googling, I wrote it myself, it shows the general principles.

This sort of thing is, you may as well say, impossible in either batch or VBS.

Qbasic / FreeBasic

The calling batch could read the entered password from the text file, and then delete the file at once.

Code: [Select]' password collector
password$ = ""
mask$ = "*"
PRINT "Enter password : ";
DO
DO
k$ = INKEY$
LOOP UNTIL k$ <> ""
kval = ASC(k$)
IF kval = 13 THEN
PRINT
EXIT DO
ELSE
PRINT mask$;
password$ = password$ + k$
END IF
LOOP
OPEN "Password.txt" FOR OUTPUT AS #1
PRINT #1, password$
CLOSE #1
SYSTEMQuote from: Dias de verano on April 19, 2009, 02:42:58 AM
Ghostdog, you have to pay to see a solution on Experts Exchange!
don't think you need to pay. long ago i created a user with a valid email address without paying anything. however if the paying scheme is just recently implemented, then too bad.

Quote
Googling for scripts and "solutions" , and passing them off as your own work, is all very well, if you do it with more care.
wow, I didn't say its my own work, did i? I am only helping providing him a link, just like everyone else is doing.

Quote from: gh0std0g74 on April 19, 2009, 02:52:24 AM
don't think you need to pay.

You need to pay. Standard is $12.95 a month.

Quote
long ago i created a user with a valid email address without paying anything. however if the paying scheme is just recently implemented, then too bad.

Yeah right. Like I really believe that! I've been aware of EE for at least 5 years, they are usually high up in Google searches for scripting solutions, and it has always been a pay site.

Quote
wow, I didn't say its my own work, did i?

You didn't say otherwise.

Quote
I am only helping providing him a link, just like everyone else is doing.

Not "everyone".

Quote from: Dias de verano on April 19, 2009, 03:03:20 AM
You need to pay. Standard is $12.95 a month.
too bad. maybe the scheme for solution provider(free) is different than the one asking for solution.

Quote
Yeah right. Like I really believe that! I've been aware of EE for at least 5 years, they are usually high up in Google searches for scripting solutions, and it has always been a pay site.
i am not paying. Period.

2168.

Solve : tcl bot help please??

Answer»

Hey everyone. I'm VERY new to programming, and my first little project is playing AROUND with a bot i have on aMSN. I'm trying to get it to respond to specific phrases rather than single keywords, but I'm not sure exactly what I have to do.

I'd also like to know if it's possible for me to have it respond to numerous wrds in any combination with any other words, just as long as they are in the same message. For example, if I could get it to say "my favourite country is australia" in response to "my least favourite country is australia", "the country i'd most like to go to is australia" And "I've been everywhere - Britain, America, Italy... the only country I really want to go to but havent yet is australia" because they all have australia and country in them... I hope I've explained that well enough.

Anyway. Here is the code:

Code: [Select]namespace eval ::amsnEliza {

global mydir
global first

proc amsnElizaStart { dir } {
global mydir
global first
set mydir $dir
set first 1
::plugins::RegisterPlugin amsnEliza
::plugins::RegisterEvent amsnEliza chat_msg_received answer
::plugins::RegisterEvent amsnEliza ChangeMyState online
::plugins::RegisterEvent amsnEliza user_leaves_chat leaves
array set ::amsnEliza::config {
useperl {0}
botname {Eliza}
mystate {1}
helptxt {I'm... a bot. Hear me roar. RAWR.}
}
set ::amsnEliza::configlist [list \
[list label "\"Use Perl\" needs Chatbot::Eliza Perl module.\nCheck CPAN"] \
[list bool "Use Perl" useperl] \
[list bool "active" mystate] \
[list str "Name" botname] \
[list str "Message for !help" helptxt] \
]
}

proc answer {event epvar} {
global mydir
global first
upvar 2 $epvar args
upvar 2 $args(msg) msg
upvar 2 $args(chatid) chatid
upvar 2 $args(USER) user
set me [::abook::getPersonal login]
set win_name [::ChatWindow::For $chatid]
set mystate $::amsnEliza::config(mystate)
set useperl $::amsnEliza::config(useperl)
set mynick $::amsnEliza::config(botname)

# Commands for Eliza
# !on, switch her on. Only owner is allowed to do that
# !off, switch her off. Again only the owner can do that
# !state, everybody can ask her

if { $user==$me && $msg == "!on" } {
set ::amsnEliza::config(mystate) 1
plugins_log amsnEliza "amsnEliza activated"
set first 1
::amsn::MessageSend $win_name 0 "$mynick: Awwwwww h**l yeah."
} elseif { $user==$me && $msg == "!off" } {
set ::amsnEliza::config(mystate) 0
plugins_log amsnEliza "amsnEliza deactivated"
::amsn::MessageSend $win_name 0 "$mynick: Fine, arsehole."
} elseif { $user!=$me && ($msg == "!off" || $msg == "!on") } {
::amsn::MessageSend $win_name 0 "$mynick: Don\'t TOUCH me!"
} elseif { $msg == "!state" } {
if { $mystate == 0 } {
::amsn::MessageSend $win_name 0 "$mynick: Just listening"
} else {
::amsn::MessageSend $win_name 0 "$mynick: I'm allowed to talk"
}
} elseif { $mystate == 1 } {
if { $user==$me } {

} elseif { $first == 1 } {
::amsn::MessageSend $win_name 0 "$mynick: Hi, I\'m $mynick. [::abook::getPersonal MFN] has buggered off leaving me in charge. You can try typing \"!help\", but it wont do much."
set first 0
} elseif { $msg == "!help" } {
::amsn::MessageSend $win_name 0 "$mynick: $::amsnEliza::config(helptxt)"
} elseif { $useperl == 0 } {
::amsn::MessageSend $win_name 0 "$mynick: [::TclEliza::replyto $msg]"
} else {
::amsn::MessageSend $win_name 0 "$mynick: [exec [file join $mydir "perleliza.pl"] \"$msg\"]"
}
}
}


proc online {event epvar} {
upvar 2 $epvar args
set status $args(idx)
plugins_log "amsnEliza" "Changed State to $status"
if { $status == "AWY" } {
plugins_log "amsnEliza" "Activating amsnEliza"
set ::amsnEliza::config(mystate) 1
}
if { $status == "NLN" } {
plugins_log "amsnEliza" "Deactivating amsnEliza"
set ::amsnEliza::config(mystate) 0
}
}

proc leaves {event epvar} {
global first
set first 1
return
}
}

namespace eval ::TclEliza {
variable keywords [list]
variable phrases [list]
variable dummies [list]

# Based on http://wiki.tcl.tk/9235 by Arjen Markus
# response --
# Link a response to a keyword (group multiple responses to
# the same keyword)
#
# Arguments:
# keyword Keyword to respond to
# phrase The phrase to print
# Result:
# None
# Side effects:
# Update of the lists keywords and phrases
#
proc response { "keyword" "phrase" } {
variable keywords
variable phrases

set keyword [string tolower $keyword]
set idx [lsearch $keywords $keyword]

#
# The keyword is new, then add it.
# Otherwise only extend the list of responses
#
if { $idx == -1 } {
lappend keywords $keyword
lappend phrases [list $phrase]
} else {
set prev_phrases [lindex $phrases $idx]
set new_phrases [concat $prev_phrases [list $phrase]]
set phrases [lreplace $phrases $idx $idx $new_phrases]
}
}

# dummy --
# Register dummy phrases (used when no response is suitable)
#
# Arguments:
# phrase The phrase to print
# Result:
# None
# Side effects:
# Update of the list dummies
#
proc dummy { phrase } {
variable dummies

lappend dummies $phrase
}

# replyto --
# Reply to the user (based on the given phrase)
#
# Arguments:
# phrase The phrase the user typed in
# Result:
# None
# Side effects:
# Update of the lists keywords and phrases
#
proc replyto { phrase } {
variable keywords
variable phrases
variable dummies

regsub -all {[^A-Za-z]} $phrase " " phrase
set idx -1
set phrase [string tolower $phrase]
foreach word $phrase {
set idx [lsearch $keywords $word]
if { $idx > -1 } {
set responses [lindex $phrases $idx]
set which [EXPR {int([llength $responses]*rand())}]
set answer [lindex $responses $which]
break
}
}
if { $idx == -1 } {
set which [expr {int([llength $dummies]*rand())}]
set answer [lindex $dummies $which]
}

return $answer
}

# main code --
# Get the script going:
# - Create a little database of responses
#

response abcdefg "I'm okay."
dummy "So ... ?"
dummy "Shall we continue?"
dummy "What do you want to talk about?"
dummy "Anything specific?"
dummy "Talk about something more interesting?"

}
Down the bottom here, i want to have "how are you" in place of abcdefg, but no form of grouping seems to work, and I'm not sure what to do. Probably a very simple problem, but as I said, I'm fairly new to all this.

Any help is much appreciated Sorry, A little late and bumping topic, but just in case somebody else would like to see how you can improve on amsneliza..
But as always, you can do better than this by learning to code yourself.
But here's what I did to make it work.
Below the "proc answer" section. Just search for "!state", it should be just a scroll AWAY from the first time you search for it.

Code: [Select] ::amsn::MessageSend $win_name 0 "$mynick: I'm allowed to talk"
}
here>>>
} elseif { $mystate == 1 } {
if { $user==$me } {I placed this.
Code: [Select]#Example more words blabla.
} elseif { $user!=$me && [string match -nocase "*country*australia" $msg]} {
::amsn::MessageSend $win_name 0 "my favourite country is australia"
#An example containing a question.
} elseif { $user!=$me && [string match -nocase "*how*you*doing\?" $msg]} {
::amsn::MessageSend $win_name 0 "I'm doing fine, how are you doing?"

2169.

Solve : For a newbie, C++ or Java or what??

Answer»

meh. I'm in no position to judge it anymore; heck I discarded my first project. My second project, I still have. a Spaceship game called "blackspace"... except it's mostly programmed in VB2 and a few things won't load properly... I seem to get a "Statement too complex" error when trying to load almost all of my old projects. (64 projects in my VBPROJ directory- and 165 within a "OLDSTUFF" folder beneath that. my "gravgame", a few projects I made for printing passwords on labels for the start of a school year... which fell through because the goofs higher up in the school district didn't send the excel spreadsheet on time.

Anyway, good memories mostly... although when I look at the code I almost barf, it makes me realize how much farther I can still go- I thought I was pretty good when I wrote, for example, a "Schedule" app for booking the non-dedicated computer labs at my old school, but I could practically rewrite the whole thing in a day now, and still it would be better.


This is all very interesting. And it could illustrate why a Microsoft language is not a good place for a newbie to start out.
At first, the Microsoft Basic implementations were quite attractive. But then as the operating system changed, Microsoft decided to make even more changes to Visual Basic. More than perhaps needed to be a Basic language..
A student language has a strong structure and can do what it needs to do without the need to implement something different or deviant from the original design of that language.
Besides, there is usually some type of trapdoor available in most implementations to break out from the structure and do something in another language. In the older versions of BASIC you could peek and poke and then call machine code and outperform some oddball thing.
Thank you all for your input. Quote from: Geek-9pm on March 02, 2009, 09:33:50 AM

This is all very interesting. And it could illustrate why a Microsoft language is not a good place for a newbie to start out.
At first, the Microsoft Basic implementations were quite attractive. But then as the operating system changed, Microsoft decided to make even more changes to Visual Basic. More than perhaps needed to be a Basic language..
A student language has a strong structure and can do what it needs to do without the need to implement something different or deviant from the original design of that language.
Besides, there is usually some type of trapdoor available in most implementations to break out from the structure and do something in another language. In the older versions of BASIC you could peek and poke and then call machine code and outperform some oddball thing.
Thank you all for your input.

you can still use ASM with VB6-

in fact I use it to subclass windows without crashing.

The trick is in the API call- you are "supposed" to pass in a pointer to a procedure that windows will call- but if you instead point it to a string VARIABLE with assembled ASM then it will actually execute the machine code that is present in the string variable.

But why the slimy hack? VB has an "AddressOf" operator, after all. The idea is to make it possible for CLASS instances to subclass window MESSAGES, rather then require a Module to contain the WindowProc() and route the message to the proper Class instance based on the hwnd or something. Additionally it prevents the VB6 IDE from crashing during testing, since the ASM code remains in memory and is thus a valid JMP location throughout; before this "hack" the addressOf method was unstable during debugging, since pushing the stop button would mean that the module containing the windowproc is unloaded- but windows still calls it for messages on the window, such as the WM_CLOSE message; it calls nonexistent code and crashes. HARD...


As far as "outperforming" the standard routines- this is generally quite easy via API routines. For example, instead of using DIR$, one can use the FindFirstFile(),FindNextFile() and FindClose() functions. This has the benefit of allowing recursive calls which aren't directly possible with DIR$() without cacheing folder names and recursing on them at the end of the procedure.

After dabbling with ASM for the subclassing code... well I THINK any future ASM work will avoid the windows platform...Visual basic just seems to have added alot more that it's ancestor and smaller dialects of it.
2170.

Solve : programe for keypressing in keyboard?

Answer»

can any ONE tell me the coding for automatically press key in keyboard Tell us more about what you're trying to accomplish, please.i am now trying to install more than one software on a single CLICK by clicking one batch file, usually we need to click next and next for installing software through keyboard, if i know the coding for key pressing its very useful for me thats whyBatch files cannot do these magical things.ok guide me how to do those things. bcos i am working as a system engg this is HELPFUL for me if i know. pls help meBy the time you write this PROGRAM according to all the software you need to install (right amounts of Enters, Tabs, ect), you would have already installed them.
Trust me, it is MUCH more simpler just to install them manually.Quote from: Carbon Dudeoxide on April 09, 2009, 08:22:13 AM

Batch files cannot do these magical things.
Did the OP specify batch?

You can do this with Sendkeys.

http://lmgtfy.com/?q=Sendkeys+MSDNI wonder if the old escape codes for ASCII characters still work?
2171.

Solve : help with php string please.?

Answer»

Hi,
I have a string which contains lots words with SPACES. I WANT to read a part of the string identified between two words in the STRINGS. Is there any drupal function to do that or any function in php? I know in php SUBSTR() does something similar, but it takes the int as the starting reference, but I want the starting reference to be a string.
Any help will be appreciated.

thanks,
jet ved.
I'm not a PHP user, but substrings are pretty much the same in any language.

Quote

know in php substr() does something similar, but it takes the int as the starting reference, but I want the starting reference to be a string.

Find the substring (word) to be used as the starting reference. Add the length of the word to the integer location of the word. Add 1 for the space. The result should be the integer starting point of the identified string.

On the back end, find the starting location of the word used as the ending reference. Subtract 1 for the space. The result should be the ending point of the identified string.

Good luck. Can you post the strings you have?Thanks SIDEWINDER for the reply.
sorry for being out for some time.
Actually the reference word keeps changing. But I can identify it easily using the '_xx' where xx is any two chars.
For example, I want to read the below string. So I need to store the sub string from '_ab' to '_ti' into one variable and from '_ti' to '_li' into another variable and so on...

example string: "_ab One-year-ahead forecasts _ti national institutes of GDP growth _li European _ab Secondary information _ti exponential forecasting _ab"...

This is just one example of the kind of strings I will be using.
Thanks kpac for help in advance.
2172.

Solve : C program is not working?

Answer» RECENTLY, I have downloaded C PROGRAM from www.bestsoftware4download.com/software/t-free-c-free-download-bonbwrdh.html. AND i WROTE the program as instructed but program is not working . Is it a problem with C or C COMPILER? Do i have to download C Compiler too? Please help.You downloaded an C 'IDE' and not a C 'Program'.

Assuming that you have installed it right, and are able to atleast run it, and are getting errors when trying to compile a program, it would be better to list the errors or look up the help section (most IDEs have it) for the error.
2173.

Solve : pls check it out?

Answer»

#include
#include
using namespace std;
class calc
{
private :

public :
double add(double ,double );
}



double calc:: add(double x ,double y)
{
double sum=0;
sum=a+b;
return sum;
}

int main()
{
calc c1;
int x;
double a,b;
do
{
cout<<"1. add";

cout<<"enter ur choice ::::;";
CIN>>x;
switch(x)
{
case 1:

double sum=0;
cout<<"enter 1ST value::::";
cin>>a;
cout<<"enter the 2nd no.:::;";
cin>>b;
sum=( c1.add(a,b));
cout<<"value of sum is ::::"< }

}
while(1);

}
PLS REPLY ..............
WATS MY FAULT .................Well I'm no expert at programming, but you haven't said what the problem is, what error you got, how you know it doesn't work etc.Not a C++ programmer but I compiled your code with DEV-CPP which flagged:

Code: [Select]double calc:: add(double x ,double y)
{
double sum=0;
sum=a+b;
return sum;
}

15 new types may not be defined in a return type
15 two or more data types in DECLARATION of `add'
15 prototype for `calc calc::add(double, double)' does not match any in class `calc'

There were other errors, but sometimes fixing one, will clear up the others. As mentioned, what error did you get and what compiler are you using? Programming can be very technical so the more details the better.

Few things (errors) caught my eye...

  • In the declaration of Calc::Add(double x, double y) the add function receives x and y but you assign the sum of a and b (which are not declared) to the variable sum.
  • There should be a ; at the end of the class (i.e. after the }).
  • Since the Switch-Case statement supports multiple cases, you need to use a 'break;' after each case.

I might not have listed all the errors..
but I have put up the corrected code which runs...

Code: [Select]#include<iostream>
#include<math.h>

using namespace std;

class calc
{
private:

public :
double add(double ,double );
};

double calc::add(double x ,double y)
{
double sum=0;
sum=x+y;
return sum;
}

int main()
{
calc c1;
int x;
double a,b;
do
{
cout<<"1. add";

cout<<"enter ur choice ::::;";
cin>>x;
switch(x)
{
case 1:

double sum=0;
cout<<"enter 1st value::::";
cin>>a;
cout<<"enter the 2nd no.:::;";
cin>>b;
sum=( c1.add(a,b));
cout<<"value of sum is ::::"<<sum<<endl;
}

}
while(1);

}



There should be a way to exit the do-while loop.

Looking at the code, it SEEMS that you have JUMPED too fast to understand the basic concepts correctly and this is not good.
2174.

Solve : Script writing in Macromedia Flash?

Answer»

Dear

I WANT to LEARN script WRITING in Macromedia FLASH 8 professional.

Please anybody help.


Regards
talorababuYou mean ActionScript?

Adobe
GooooooooogleDear Friend

Yes. That will help me to learn to do programming.

Regards
talorababu

2175.

Solve : Batch script how to check a variable if all letters and/or numbers?

Answer»

I need to check a variable in my dos batch script if it contains all letter and/or all numbers.

If it's all letters, then PERFORM
If it's all numbers, then perform
If it's letters and numbers, then perform
OTHERWISE, error

Your help is greatly appreciated.
Thanks.Nothing is idiot proof in batch code and regular expressions are no exception. This little snippet demonstrates method.

Code: [Select]@echo off
setlocal
set /p var=Enter var:
echo %var%|findstr /r "[^0-9]" &GT; nul
if ERRORLEVEL 1 actionX & goto tag
echo %var%|findstr /r "[^a-zA-Z]" > nul
if errorlevel 1 actionY & goto tag
echo %var%|findstr /r "[^0-9a-zA-Z]" > nul
if errorlevel 1 (actionZ) else echo error
:tag

The snippet requests a STRING entered at the console. You should be able to modify the logic and incorporate into your own script.

Good luck.

If any of the NT batch special characters exist in the string, the code will break.
Great! That worked.
Thanks.

2176.

Solve : Message show in network user's PC?

Answer»

Dear

I want to make a program in Visual Basic 6.0 by which a SPECIFIC message would be sent to the user's PC in a specific time and that will popup on their screen.

Please help by providing the CODE in detail.

I don't know VB.net


Regards
Pervezpls ANYBODY of my query.Quote from: talorababu on April 16, 2009, 12:55:24 AM

pls anybody of my query.
Please don't bump your own thread, we'll get to you soon...

You COULD use net send...but I have no idea how to use net send in VB6.
2177.

Solve : permutation of a string in c++?

Answer»

formulate an algorithm(pseudocode) that PERMUTES and displays the permutations of a string of consisting of up to 20 words.Write a program that implements your algorithm.use your program to investigate the number of acceptable phrases that may be generated from the phrase;The good COLLEGE is worth BELONGING to and so we will be part of it.Homework?heh, your SIGNATURE reads great as part of that post. He could have atleast REPHRASED it so that it would be harder to understand that it is homework.
help her plizQuote from: wamuyu on January 19, 2009, 10:53:48 AM

help her pliz

2178.

Solve : excel programming macro on web change event?

Answer»

I need to write a macro to capture the data from one SHEET, and write to another sheet with time stamp.
Next refreshed data to be written in the next row.
The data is changing dynamically using WEB refresh

please help capture data from one sheet:
- range OBJECT
- for each c in activesheet.usedrange

write to another sheet:
- range.copy method

timestamp:
- now(), date(), time() function

look it up by hitting F1 on VBA IDE

2179.

Solve : stuck in Start up DOS?

Answer»

I don not know if this is the right place but I gotta start somewhere

I find the full story is the best approach
OK. This is the story: I will tell it as I did it (as best as I can remember as it is a couple of days already)and you pick out where I went wrong.
I got a "Compaq" PC which I am working with right now 320Mhz PENTIUM 2 Windows XP with working "Compaq?" CDROM player. This machine is not in the equation and still functions on the net so I can communicate this story.

I picked up from a friend - an "Azura" PC Data Server 1.2Ghz Pentium 2 Windows XP with a working "Creative" CDROM player and it all worked.

I also picked up from my brother - a "Dell" PC 550Mhz Pentium 3 Windows 98se with a working Benq CD burner/player and everything worked.

It was suggested:
that I swap out the "Benq" with the "Creative" then I would have a burner on a faster computer.

Sounded simple enough.
I unscrewed and did the physical part of it, carefully pulling the ribbon out of the CDROM and the other cables and reconnecting the other CDROM in the same way.

That is as far as I took it. I then powered on the "Azura pc" and surfed the net - not testing the CDROM out. "I will when I need it now and worry about it later"(I thought).
I found the pc acting a little slower while surfing(but did not attribute it to the CDROM) I just thought that maybe I got some spyware . >> I run antivirus 24/7 so I knew it was not a virus<<.
So, I downloaded SuperAntiSpyware, installed it and let it run. It found nothing except 3 tracking cookies from sites I trusted so I left them alone. Speed did not improve. I am thinking maybe the "pc brains" are scrambled with the CD swap and needs a reset. So I "switched off or powered down" the PC for a couple of hours completely.
When I powered up later, I get the first DOS screen(when it starts up, and it stays there). Will not go farther.
>>>> Be aware that while I am doing the physical swap, I pull the power out of the wall. I do not know how long CMOS batteries last but these PC's are years old (so the batteries may be dead). <<<<
Sidenote >>>I know I had a 486 with a dead Cmos battery and ran the computer(powering it on and off each night for years (with Win98 staying intact) after the battery died with no problems)<<< but I never swapped out hardware either.

Printed on the "Azura" DOS screen:-
==============================================================================
Main Processor : AMD Athlon Processor Base Memory Size : 640KB
_______________________________________ ______________________________________
Math Processor : built-In Ext. Memory Size : 511MB
Floppy Drive A : 1.44MB 3 1/2" Serial Port(s) : 3F8,2F8
Floppy Drive B : None PARALLEL Port(s) : 378
Display type : VGA/EGA Processor Clock : 1050MHz
AMIBIOS Date : 04/29/2002 Power Management : Enabled
External Cache : 384KB,Enabled SDR at DIMM(s) : 0 1
DDR at DIMM(s) :
_______________________________________ _______________________________________ __
Hard Disk(s) Cyl Head Sector Size LBA 32Bit Block P10 ATA
Mode Mode Mode Mode Mode
Primary Master : 39838 16 63 20560MB LBA On 16Sec 4 100
Secondary Master: CDROM 4 N/A
================================================================================
PCI Devices:
Onboard Multimedia Device, IRQ11 Onboard IDE, IRQ14, 15
Onboard USB Controller, IRQ12 Onboard USB Controller, IRQ11
Onboard Ethernet, IRQ11 Slot 3 USB Controller, IRQ11
Slot 3 USB Controller, IRQ11 AGP VGA, IRQ5
================================================================================
Searching for BOOT Record from IDE-0..OK

And the cursor is flashing fairly quick on the bottom waiting.

Hmmm. Okay. So I, first pulled the power plug out of the wall l then took out the BENQ burner and PUT back the CREATIVE CDROM as it was before hoping that things will right themselves when I turned on the power again. Was careful about unplugging and plugging it in carefully and the STATIC thing.

No change. The cd light goes on but does not spin the disk.

that is where I am. What do I do next and how do I do it?
/////////////////////////////////////////////////////////////////////////////////
What I have at my disposal is a win98se legitamite CD, a WinXp cd, a Nero cd(which is for the Benq CDROM) and a 3 1/2" systems disk for Win98

Also a pc on the net with a 3 1/2" floppy and CD reader.
None of the computers are connected together and they all have flash drives(I don't know if they work at this moment - as the computers may be blind to them too)
///////////////////////////////////////////////////////////////////////////////
I realize I am going to lose stuff...but I have most of it backed up on a removeable Flash drive so if we got to start again, I can do that.

Just how to do it.Double post - please continue here..

2180.

Solve : VB.Net string analysis? (search for keyword in string)?

Answer» SAY:
(This code is imperfect, writing it in the message BOX =D)
Code: [Select]Dim str as string = "The apple fell from the apple tree"
How do I, under x-event, to search the string 'str' for the WORD apple and return how many occurances were found?

Can't you USE system.IO.Streamreader? I remember something about that from a while back, but I'm not sure.

TIA,
:Liami think you can use BCProgrammer logic, he posted it somewhere

pseudocode:
n = (str.length - Replace(str,"apple","").length) / 5
2181.

Solve : Need to create a simple batch. Any help??

Answer»

Hi,

I am running a programme at work and it requires me to press the F6 key followed by the F10 key over and over again. There is a delay of 5 seconds between each press. I was WONDERING if anyone knows a way that i could automate this. I'd imagine it would be quite easy using a batch file. I have no experience with batches. All my programming experience is with C#, VB etc.

Any help would be MUCH appreciated.

DonalActually, it would be impossible with a Batch file.
Batch Files cannot SEND keystrokes.

You can do this THOUGH. Go to Notepad and paste the following:
Code: [Select]Set objShell = CreateObject("WScript.Shell")
Wscript.Sleep 2000
For i = 1 to 5
objShell.SendKeys "{F6}"
Wscript.Sleep 100
objShell.SendKeys "{F10}"
Wscript.Sleep 5000
nextGo to File --> Save As... --> file.vbs and press Enter.

Note:
For i = 1 to 5 means this script will repeat 5 times.

2182.

Solve : Splash Screen on Loading VB08?

Answer»

In VB 2008
OK I am having issues with my Splash Screen actually showing when I debug my program. I get a glimpse of it and then my mainform loads.

1) Under Project PROPERTIES>Application> I SELECTED SplashScreen1 from drop down list

2) Private SUB SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) HANDLES Me.Load
'Hold the form on the screen approximately 7 seconds while the mainform loads


System.Threading.Thread.Sleep(7000)


I think I may have overlooked something somewhere?

Thanks! Tour

2183.

Solve : Stupid Noob in C++ be me, help me out??

Answer»

I am new to C++ having switched over from batch. I am trying to make a number counter to, but dont seem to be having much luck. Every time i try to compile it says i have an EXPRESSION syntax error. Dont give me a new program, just tell me what is wrong with mine.

#include

using namespace std;

int main()
{
int tminus;

cout&LT;< "Please ENTER number to count to";
cin>> tminus;
cin.ignore();
for ( int x = 0; x <= << tminus <<; x++ ) {
cout<< x < }
cin.get();
}

thanks in advance.
Again, please dont harass couse its something obvious. Im new okay? Quote from: dirt1996 on March 01, 2009, 06:12:01 PM

the loop:
Code: [Select] for ( int x = 0; x >= tminus ; x++ ) {
cout<< x <<endl;
}


too many << operators... I would guess you picked those up from batch lol thank you so much! Quote from: BC_Programmer on March 01, 2009, 09:37:28 PM
Quote from: dirt1996 on March 01, 2009, 06:12:01 PM
the loop:
Code: [Select] for ( int x = 0; x >= tminus ; x++ ) {
cout<< x <<endl;
}


too many << operators... I would guess you picked those up from batch lol
but how do i fix this? Code: [Select]count << x << endl;
Can you put it in the code for me. So the loop part isnt necessary is what ur saying? Again I am so sorry for being DIFFICULT that would just be the one line- I believe the reason it isn't working is the lack of spaces

Even with that one line I typo'd


Code: [Select]#include <IOSTREAM>

using namespace std;

int main(int argc, char* argv[])
{
int tminus;

cout << "Please enter number to count to:";
cin >> tminus;
cin.ignore();
for ( int x = 0; x <= tminus ; x++ ) {
cout << x <<endl;
}
cin.get();
}

that code compiles and runs with Microsoft Visual C++ 6.Sorry for being stupid, thank you so much!
2184.

Solve : Type mismatch error VB8?

Answer»

This is my code

Private Sub Check1_Click()
Dim a1
a1 = Check1.Value
Text5 = ""
Text5.text = a1

End Sub

When I click on the check1 a "1" is placed in text5. However when I rerun the program the "1" is gone, it's not written to the DATA field assigned to text5. If I manualy type a "1" in text5 I get a type mismatch error when exiting the program. What am I doing wrong. I have also tried writing it like this.

Private Sub Check3_Click()
Text7 = ""
Text7.SelText = Check3
End Sub

I get the same problems

Never mind I found it ( couldn't delete message )Quote from: Honsolo on March 01, 2009, 03:04:28 PM

Never mind I found it ( couldn't delete message )

Do share.
wow, such intuitive control names... Check1, text5, text7...

If text5 was bound to a data SOURCE then the recordset would need to be commited to see a CHANGE in the resulting file.

And if it wasn't bound at all then controls revert to their design time state when the program is run.What do you mean? I always call my variables Variable1 Variable2 Variable3 etc. Once I got up to Variable2377. That was a real big program.
pah, numbers? what about
Code: [Select]variabletwothousandthreehundredseventyseven +=variabletoaddtovariabletwothousandthreehundredseventyseven;
Now that's what I call programming. By the way, do you agree that arrays are for wimps?
pah, Arrays. Arrays are for wimps, definitely. Why, these kids today, with their fancy "arrays" and their Silly "objects" and "Frameworks". Fiddlesticks, I say why, they cheat at Quicksort by using these "arrays", real quicksort means to iteratively sort properly named variables, none of this arySort() business. no sir, real sorting algorithms look like this:

Code: [Select]Public Sub SortValues(A as Integer, B as Integer, C as Integer, _
E as Integer, F as Integer, G as Integer, _
H as Integer, I as Integer,J as Integer, K as Integer, _
L as Integer, M as Integer,N as Integer, O as Integer, P as Integer, _
Q As Integer, R as Integer, S as Integer, T As Integer, U As Integer, V as Integer, _
W as Integer, X as Integer, Y as Integer, Z as Integer)
Which should sort the 26 values passed. Of course wimpy programmers will whine "but what if I want to sort more then 26 values"

Then you are too picky! there is no reason to sort more then 26 letters since there can only be 26. And of course they go on, "and why must it be integer" PAH to you newbies and your fancy "Arrays" and your "Data types" Integer is a mans data type, use LONG and you MUST be compensating for SOMETHING, and if you use a "String" type you may as well lay claim to a wet noodle. No Sir, just Integer, and Byte, for the hardcore.WOW !!!!!! I can't believe how much flame I got for this post. It was an example of what I was doing. I AM NOT A PROGRAMMER. I wrote in VB4 many years ago. Now I need a complex program for the company I work for. I am writing it because no one else offers it. Besides I'm a company man. I have never had any schooling and I am doing my best.

GIVE ME A BREAKwe're not flaming you...
2185.

Solve : Duplicate Folders/Files;?

Answer»

I recently bought a HP 4gb laptop from Best Buy that has been causing me huge problems with duplicate files.

When I go to My Computer/C:Users/Michael there are 13 files LIKE Contacts, Desktop, Docs, Links, etc.

AND, when I click on a "Sullivan" folder that is set up by geek squad, it has the same 13 files as stated above. This is not a shortcut on my desktop and when I right click this folder to see the PROPERTIES, there is not this option.

Do I need to have these duplicate files?

ThanksIt's probably a separate account that the Geek Squad created for their own purposes. Although, I really don't know why. Instead of just deleting the folder, you may want to go into Control Panel>User Accounts and see if you can delete the profile. If you simply delete a profile by deleting the folder, it may cause all sorts of problems.

But, If it's not listed in User Accounts, you could try deleting it manually. HOWEVER, I would suggest setting a restore point in case things go wrong, you can see how to do this here: Setting a Restore Point. If anything happens to go wrong, you can just go back to that restore point in safe mode.

However, what I'd like to know is, how are duplicate files "causing problems"?

Oh, and I don't believe this is a "Computer Programming" issue. My fault on the mislabel computer programming.

The problem is when I try to download/save any type of file, from a simple word doc to downloading itunes, there is a popup saying "error", this is unless I manually select the file folder that geek squad put on my desktop.

I also have Vista, which I cant stand, but thats another topic (and for future). So your suggestion is to back up or create a restore point and then manual delete the name from the user account? I can do this, there are in fact THREE user accounts, Daniel, Default, and Public....

Thank you in advance!If you do get rid of that folder, but it still shows an error when downloading, the My Documents path variable may be pointing to the incorrect place. I unfortunately have to leave, so hopefully someone else who knows how to do that can help you out. If not, I'll see what I can do tomorrow.Quote from: sullivandm1 on April 11, 2009, 07:12:04 PM

When I go to My Computer/C:Users/Michael there are 13 files like Contacts, Desktop, Docs, Links, etc.

AND, when I click on a "Sullivan" folder that is set up by geek squad, it has the same 13 files as stated above. This is not a shortcut on my desktop and when I right click this folder to see the properties, there is not this option.

Do I need to have these duplicate files?

They SOUND more like folders to me.
2186.

Solve : Need a Java Applet to utilize Java Script Functions?

Answer»

I want my applet to use java script funcions and code. I have been researching this forever and can not find an answer. It use to be able to be done in NETSCAPE USING import netscape.javascript.*; or something along this line.

What is the new class file? Is there another WAY to do it?
Can you give more info on what your applet is meant to do and how it works (or is supposed to work)?

2187.

Solve : Date and time in batch file?

Answer»

I have a small PROBLEM: I use a batch file that runs an AUTOMATIC backup of a software and FILLS a log-file of backup process. At the moment I use date /t and time /t commands with a pre-typed strings of text to monitor different sub processes in the backup, but it writes the time and string on SEPARATE row whereas I would like them on the same row, like this:

mon 02.03.2009
21:00 Process started
21:01 Backup 1 finished
21:08 Backup 2 finished
21:10 Backup finished succesfully

The commands that I have been using are obviously the reason:
time /t >> %LogFilePath%\Backup.log
echo Backup finished succesfully >> %LogFilePath%\Backup.log

Is there any command I can make it write the strings on the same row as the time?

-Jussi

You might try something like this:

Code: [SELECT]Echo %time:~0,5% Backup finished successfully >>%LogFilePath%\Backup.log

2188.

Solve : BCStreams- alternate data streams utility?

Answer»

Yet another ADS enumerator tool

displays all the ALTERNATE data streams in a file.

BCStreams.

Right now it doesn't support wildcards, but it does support multiple arguments. /NOLOGO supresses the one-liner displayed when it starts.

Not sure how it GETS on in vista; it might require an ADMINISTRATOR level command prompt.


Written in VB6


Doesn't use any references/components; I was going to use my BCFile component, but it's not quite READY- so I just copy-pasted the code for Alternate Data stream parsing to a new project, and tada!


[attachment deleted by admin]New version...

now supports File masks (IE: *.*)


Includes VB6 SOURCE code.


[attachment deleted by admin]

2189.

Solve : How to send email in visual basic 6?

Answer»

Hello,

I would like send emails without OUTLOOK window, and how possible insert ?subject=Test TEXT"

Private Sub Command1_Click()

Dim msg, style, Title, help, Ctxt, Response, MyString
Dim SW_NORMAL
ShellExecute Me.hwnd, "Open", "mailto:name<[emailprotected]>?subject=Test text"?body=This is demo text", &o0, &o0, SW_NORMAL

End Sub

Thank you for your help
use the Collaboration Data Objects library. (CDO)Ok, but how possible hide sender in the letter, because programme send message not one man?

EXAMPLE:

Set iMsg.Configuration = iConf
iMsg.From = "[emailprotected]"
iMsg.to = "[emailprotected]"
iMsg.Subject = "subject"
iMsg.HTMLBody = "test message"
iMsg.AddAttachment "C:\demo.xls"
iMsg.send
Set iMsg = Nothing: Set iConf = Nothing: Set Flds = Nothing

Thank you

2190.

Solve : help create memory gamein javascript?

Answer»

I need to create a MEMORY game in JAVASCRIPT and have no clue as to where I should beginOkay, start with the BASICS first. HTTP://www.w3schools.com/js/default.asp

There's no point starting something big (which what you want to do could be) until you have the ground work done.

2191.

Solve : file batch?

Answer»

How execute to a client a batch lile who include commands like "attrib" that doesn't work from client in an WINDOWSXP with ADMINISTRATOR and clients. Thanks to all by readybornNot sure what you're looking for. What code do you have now?I edit a file_batch like administrator that, clients can't use. Precisely the command "attrib" (to CHANGE a FILE from hidden mode), don't work for the client so the batch don't run correctly.How come it doesn't work?

What code do you have now?

What OS does the client(s) have?Dos work on MW xp version 5.1.2600
The command line in file batch is:

attrib /S /D -H c:\namefile

this command change the file "nomefile " from hidden to visible.
without do this I can't copy the file
but this command dosen't work on client(s)
The file batch is LAUNCHED from startup
Hierror messages?Noone.
Simply the file doesn't be copied
But when it work under administrator the file(s) will be copied.
(sorry 4 the very bad english language)what does attrib have to do with file copying?

my suspicion is the file also has the system attribute. try changing the line to

Code: [Select]
attrib /S /D -S -H c:\namefile
After the last (BC_Programmer), the output message is:
Access denied

perhaps being used by another proccess. If the file is pagefile.sys, for example- it will cause an access denied error for a large variety of file-access functions, regardless of Administrator/user privileges.

2192.

Solve : DOS Batch File Programming Question?

Answer»

I need to add a command to automatically burn a file on to a dvd, using a program called CommandBurner, to a backup batch file we currently have. Anyway, I just need to know how to fix this IF statement so it does what I need.

This is what the case statement basically has to do:

If the date is either 01-07 AND the DAY is Tuesday, then execute this command.

This is what I have so far:
Code: [SELECT]set day=%date:~3,2%

if /i %day LSS 07 && %dayoftheweek% EQU Tuesday goto burn

:burn
cd d:\Autoback\CommandBurner\
CmdBurn burn /d d:\Autoback\Daily\ /l %today% /ejectQuote

If the date is either 01-07 AND the day is Tuesday, then execute this command.

This is ambigous. Do you know what "either" means? I presume you meant "both".

I also presume you are getting the day of the week from somewhere.

Code: [Select]set day=%date:~3,2%

set num=0
if "%day%"=="07" set /a num=1
if "%dayoftheweek%"=="Tuesday" set /a num=%num%+1

if %num% EQU 2 goto burn
goto noburn

:burn
cd d:\Autoback\CommandBurner\
CmdBurn burn /d d:\Autoback\Daily\ /l %today% /eject
goto end

:noburn
echo not burning

:end

Thanks for the response. In your statement 'if "%day%"=="07" set /a num=1', what I'm trying to do with the numbers 01-07 is make sure it's the first Tuesday of the month. That's why I use the first 7 days of the week. Is your statement covering all 7 days, or is it only covering the 7th? Will it work if I do this:

Code: [Select]if "%day%"<="07" set /a num=1Quote from: Barnicle on January 14, 2009, 07:41:36 AM
Thanks for the response. In your statement 'if "%day%"=="07" set /a num=1', what I'm trying to do with the numbers 01-07 is make sure it's the first Tuesday of the month. That's why I use the first 7 days of the week. Is your statement covering all 7 days, or is it only covering the 7th? Will it work if I do this:

Code: [Select]if "%day%"<="07" set /a num=1

no.
No, it won't work, or no your original statement covers on the 7th day? If so, how can I cover the days from 01, 02, 03...07 You cannot use <= to test for "less than or equal to", is what I meant. That is not correct batch language syntax.Code: [Select]@echo off
REM Clearly, you are using US date format
REM That is mm/dd/yyyy

REM You need to do a numeric test, so use set /a to make the
REM day variable a numeric one BUT...
REM set /a interprets numbers beginning with a 0 as being octal
REM so we have to filter out any leading 0 since 08 and 09 are
REM (obviously!) not valid octal numbers and will cause an error and the
REM batch will halt.

REM test if first digit of day is a zero
REM if yes just use 2nd digit

if "%date:~3,1%"=="0" (
set /a day=%date:~4,1%
) else (
set /a day=%date:~3,2%
)

REM You don't get AND in batch, so we
REM have to simulate it.
REM set num to 0
set /a num=0

REM if day is less than or equal to 7, add 1 to num
if %day% LEQ 7 set /a num=%num%+1

REM if today is Tuesday, add 1 to num
if "%dayoftheweek%"=="Tuesday" set /a num=%num%+1

REM if num now equals 2 then both tests are satisfied
if %num% EQU 2 goto burn
goto noburn

:burn
echo Day is Tuesday and date is 7th or earlier
echo Therefore burning...
echo I sure hope there's a writable disk in that burner!
echo Press a key when ready...
pause > nul
cd d:\Autoback\CommandBurner\
CmdBurn burn /d d:\Autoback\Daily\ /l %today% /eject
goto end

:noburn
echo not burning

:endExcellent. You the man!Code: [Select]echo Day is Tuesday and date is 7th or earlier
Note that I changed this line because I think that <= symbols may screw with the batch execution.

Sorry, but I don't see where "dayoftheweek" is getting set. Can that be extracted from %DATE% somehow?

Thanks.Quote from: swgivens on March 04, 2009, 03:40:04 PM
Sorry, but I don't see where "dayoftheweek" is getting set. Can that be extracted from %DATE% somehow?

Thanks.

It isn't being set in that script. The original poster has some way of getting the day of the week which was not specified.

Visual Basic Script has a method of getting the day of the week name.

to swgivens, here is one of the many methods to get dayoftheweek.

Code: [Select]@goto start
o70 06
i71
o70 07
i71
q

:start
@echo off & setlocal enabledelayedexpansion
for /f "skip=1" %%a in ('debug ^< %~f0^|find /v "-"') do set x=!x!%%a
for /l %%a in (301,1,307) do if 0%%a==%x% goto:burn
echo %x%:no burn for today
goto:eof

:burn
echo %x%:its tuesday and date^<^=07, put burn code here

note: 03 for tuesday, 01 for sat.
maybe someone might find this code useful in the future.
2193.

Solve : AI Layout Codeing.?

Answer»

is there any layout that i can follow to creat an AI i want to make it so that i can use it with windows. Sad isnt it. Doesnt have to be but dont know enough linux.First off, you should create a command Database for all the commands for it.

like a "Config"

then have a String builder take apart the inputed sentence if it doesn't register with one of the commands in the command database.

and take it apart word by word, with a bunch of IF_THEN.thats what I REALLY need a whole lot of if thenOh... you want to parse statements and such?

BCScript could find a use case...I want it to be simple to understand and to get it to like talk back and stuff.Oh I see, much like the CHATBOT, but on a LOCAL machine?In a sense recall bonzi MONKEY thats almost the way that I want to have it. The thing is that I know in order to get it like that I would have to look at the code and run it threw a program to do so and stuff.so you want a real-AI deal that talks back or just does what you say and keeps its trap closed?close but not exatly.

2194.

Solve : VB 2008?

Answer»

I need some help with VB, I am new to programming and feel like I lost too many brain cells as teenager when I try to write my code. /sigh

Yes this is for a class but I am not asking for anyone to write it for me.. I need some clarification.
First I keep getting a SystemFormat Exception ( which I think basically means ERROR hehe)
it is when I am converting quantity to numeric values and using Parse.

I am confused as I wrote it exactly as the example in book ( well not exactly I changed the names to match my application) but I keep getting this error

We did cover Try, Catch As( well somewhat) so am I correct in assuming I should be using that to catch the Format Exceptions I am getting?



I really want to GO into Computer Science as my major( 2nd time around in COLLEGE for me) but yeeeesh I feel like if I can't get through VB I won't be able to do it

Thank you !Can you provide the code that is causing your issue?yes thank you!
QuantitySnowboardsInteger = Integer.Parse(SnowboardsTextBox.Text)
SnowboardsTextBox.Text = QuantitySnowboardsInteger.ToString()
QuantitySnowWBootInteger = Integer.Parse(SnowBootsTextBox.Text)
SnowBootsTextBox.Text = QuantitySnowWBootInteger.ToString()
This is before my calculations are performed.. again I did not add a Try Catch as Exception

The SystemFormat keeps highlighting this LINE. QuantitySnowWBootInteger = Integer.Parse(SnowBootsTextBox.Text)
Code: [Select] QuantitySnowWBootInteger = Integer.Parse(SnowBootsTextBox.Text)




Your issue is caused by the textbox not containing something the Parse() method accepts, so it throws an exception. (which, as you said, is an error)

To avoid the typing overhead of wrapping each Parse() method in a Try...Catch...Finally, you can use the Integer.TryParse() method; the line you have would look like this:

Code: [Select] If (Integer.TryParse(SnowBootsTextBox.Text,QuantitySnowWBootInteger)) Then
'QuantitySnowWBootInteger is now the proper value.
Else
'TryParse failed. (recommend prompt user to enter a valid number?
End If


However- if you are being taught Try...Catch Statements, it may have been an exercise in using Exception handling; if that's the case, you would stick with the Parse() Method, and wrap the Parse() calls in Exception handling, like so:

Code: [Select]Try
QuantitySnowWBootInteger = Integer.Parse(SnowBootsTextBox.Text)
Catch (SystemFormatException e)

'Error occured

End Try

(Not 100% wether that's proper syntax- believe it or not I don't program in .NET )

Hope this helps! Any questions? I gave up last night, watched BSG and went to bed. So I will try the above and see if that helps. It looks like it should.
As a matter of FACT I do have another question in regards to saving applications in VB. Am I doing something wrong? I save it to desktop or flashdrive depending on what I am doing. Yet when I open VB, its not always there? If I open the app from where I saved it I usually get an error that says Microsoft Visual Studio
---------------------------
One or more projects in the solution could not be loaded for the following reason(s):

The project file or web has been moved, renamed or is not on your computer.

These projects will be LABELED as unavailable in Solution Explorer. Expand the project node to show the reason the project could not be loaded.
-------------------------

Please no laughing) I know its probably obvious.. I either moved or renamed the file. But then sometimes when I click OK my app will open but I will be mising Solution Explorer.


I also learned the hard way NOT to open another VB application while working on one, or at least say NO to saving changes... The saving issue is common for people new to the whole "project" idiom- same thing occurs with VB6.

If you are using "Save Project As", for example, it will save a project file, but that project file is simply a list of the forms,modules, classes, and so forth that the project contains.

Instead of using "Save Project As", copy the folder your project is in to your flash drive. I'd recommend working from the flash drive, but I've learned via the loss of almost all of my code that that isn't a feasible solution.Ohhh I get it. That make sense as the ones that I can't open have been the ones I hit Save Project As to my desktop.

Thank you so much for your help. I really appreciate it
Quote from: Tourmaline on March 07, 2009, 05:21:33 PM

Ohhh I get it. That make sense as the ones that I can't open have been the ones I hit Save Project As to my desktop.

Thank you so much for your help. I really appreciate it


You're Welcome! Glad to be of some use!
2195.

Solve : Set up iPhone deving on Linux?

Answer»

How do I set up a Linux-based machine (Running Fedora 10 and have a Linux Mint ISO on my HD somewhere, could VM or burn it) to develop HOMEBREW for Cydia or Installer?

I figured I'd put the QUESTION first, this time =D. Specs:
160G HD -- So no worries b'out space
3GB of ram
and 64 BIT! -- Never worried about that in windows but makes a difference here =0Which 64 bit CPU.
It makes a difference.
In Windows and everything else.
Is it a dual-core?
AMD? Intell?
Moving up to 64 it is not as smooth as the marketing people say.AMD Athlon Dual-Core x64 processorWish I could give you more help on this. You may need to do some looking around for the right answer.
Here is just one place with a problem was reported that might have some relevance to your setup. From Microsoft.

http://social.technet.microsoft.com/forums/en-US/winserverhyperv/thread/fc316b62-edfb-4207-8e21-672a7ee3bccf

Issues with the AMD Dual Core 64 bit have been posted in a number of places.
Not that the Intel chip is better. But rather the Intel and AMD can not share the same software fix. Each is different, as far as I know. THat isn't even my question --

--I just want to know how to get started with (Just figured out CODE type) xcode in Fedora.Fedora xcode. Not much bailable.
Also try Ubuntu
http://ubuntuforums.org/

Doug Diego
http://dougdiego.com/2008/10/09/how-to-rename-an-iphone-xcode-project/

Robert Swain
http://rob.opendot.cl/index.php/2007/11/29/xcode-developer-tools-30/

Of course, Apple.
http://developer.apple.com/TOOLS/xcode/

Sorry I can't help much.
Let us know how far you get with the Xcode. I just said screw it -- My school is distributing Mac's to me as a freshman, I can wait =)

Right now I just installed windows for dual-booting purposes --

-- I need my Visual Studio.

-- And an OS that can RUN ~All~ *.Exe's =D

2196.

Solve : Visual Basic Help?

Answer»

Hello
I'm new to this forum and to visual basic programming. I'm trying compile a DVD for a back up type disc that once I reinstall Windows on my machine, I can insert this DVD and all the programs I use are on it and AVAILABLE for install. I have a program that I am using to make a MENU that uses "buttons" that point to the setup files in the different folders on the DVD. I also have files that I want to keep that I modified while using these programs, basically config files, but when a new install OCCURS, the programs install generic files.

What I would like to accomplish (this is the preferred WAY) is to have one of the buttons on my menu run a program that opens a window that asks you what drive letter your cd-rom is and the directory to which you want to copy the files.

Is this possible with visual basic? I've seen where a simple batch file can copy files from one folder to another, but how do you tell it to pick the DVD drive letter and how do you tell it to select the proper directory if it's not known?

Thank you for any help.There is a box that lets the user pick a directory. But if you only want a drive letter maybe you have to make you own box. What version of Visual Basic? The newer versions are just too over loaded with stuff. An early version, like Visual Basic 5 is better as a learning tool.
Quote from: Geek-9pm on January 20, 2009, 11:37:37 AM

like Visual Basic 5 is better as a learning tool.

Agree completely. Visual Basic 5 has a free "Control creation" edition, and VB6 has a "Learning edition".


There are ways to compile the programs as WELL, since- strangely enough, they use the very same C/C++ compiler that VIsual C++ uses(which also has a free version... probably hard to find now, though)!
2197.

Solve : graphics in dos??

Answer»

Is there any way to use 2d GRAPHICS in a dos console?Real BIT map graphics? DOS itself does not provide it. But programmers would have to WRITE their own or use a library from a third-party software frim.additionally, the Windows NT platform adds additional "gotchas" for full-screen DOS APPLICATIONS.

2198.

Solve : Visual FoxPro9 - Variable Declaring...?

Answer»

Greetings EveryOne (Or Should I Say AnyOne?___)!
Please help me with VFP. Here's my question:
How do I declare a variable to make it Global WITHIN the Form?
Thank You very much.I personally haven't used foxpro very much- but, if MEMORY serves, a FoxPro form is simply a class, and all classes can have variables declared in the "declarations" section (before procedures). I don't know the syntax, HOWEVER. (I assume you know how to declare a variable though, of course.)hello, I use fox pro to write all my commercial projects and programs. And i am happy to find someone who uses it.

To declare a global variable, u can do that by TYPING: PUBLIC variableName either in the INI Event of the for or module or control init or any where, but for easy sake, u can do that in the LOAD event and INIT event.

Pls, mail me if u have any problem, i am an expert in FoxPro. [email removed to prevent spam] I like to be UR friend byeee. Guten MORGEN, Handsomee.
Sorry I couldn't E-Mail you, your address is hidden for me.
As for your answer, I can declare the global variable. I cant make it global for all, for example, methods of ONE single form without throwing it to ALL forms, progs etc of my project. Or maybe I do not understand something?

2199.

Solve : Batch to Run only on XP machines?

Answer»

I'm looking for batch file command have it run only on XP machines. I'm a bit new to Win management and have looked all over but have not found a line that WORKS. Much thanks!What other operating systems might it run on? Are Windows 95/98/ME a possibility? is NT 3.51 or 4? or are we talking about just 2000 / XP / Vista?

It is a trivial matter to capture the output of the VER command, and see if it contains the string "MICROSOFT Windows XP" or not, but some ways of doing this won't work on 95/98/ME.
Quote from: Dias de verano on January 29, 2009, 01:35:28 PM

What other operating systems might it run on? Are Windows 95/98/ME a possibility? is NT 3.51 or 4? or are we talking about just 2000 / XP / Vista?


Just XP and Vista only. I've gotten this far:

Quote
Ver | Find "XP" > Nul
If not ErrorLevel 1 COPY \\SERVER\SHARE\FWOFF.VBS C:\
Ver | Find "VISTA" > Nul
If not ErrorLevel 1 COPY \\SERVER\SHARE\FWOFF.VBS c:\
CALL "c:\fwoff.vbs"
DEL c:\fwoff.vbs

Which works on XP but not Vista. So I think I'm close enough to get it now.@echo off
ver | find "Microsoft Windows XP">nul || (
echo This script should only be run on Windows XP
pause
goto END
)

Your code here

:end
Thanks!!
2200.

Solve : Programming environments?

Answer»

Just thought I'd make something like the "Show your desktop" threads we see all the time... but for those of us that are programmers... how about development environment?

Obviously some of us may be using Notepad or a text editor, but- it's STILL a programming environment.

Basically- open a project, your workin on, and TAKE a picture! Easy as pie.

Anyway- here's mine.




yes... VB6.Just had to attach this one... Only excuse is that it's to run on a 486... Dos 7.1... Sunrace 3000 notebook (who remembers that model?)...

Yes, QBasic 4.5!!



[attachment deleted by admin]I have QBASIC 7.1 on my Thinkpad,(pentium 75) which is running PC-DOS 2K. Never really use it though- mostly for old games, if I do fire it up.

I've never been fond of the "white on blue" look, so I ALWAYS change the colour schemes of EDIT and QBASIC, and- any program that displays in the same manner- to a black background and bright COLOURED elements in the foreground.FBIDE for FreeBasic plus the current program running in a console window

Batch programming in notepad....

FB

[attachment deleted by admin]What's all that set add=&& business? It resets the variables to nothing. It's the code i posted in the batch programs section not long ago. If there is a better way of doing it, please tell me

FBQuote from: fireballs on January 21, 2009, 02:48:28 PM

It resets the variables to nothing. It's the code i posted in the batch programs section not long ago. If there is a better way of doing it, please tell me

FB

It looks FINE. I just wondered why you were using && and not &. They do different things.

action1 & action2 means "do action1 and then do action2"

action1 && action2 means "do action1 and if the errorlevel is 0 [i.e. if action1 succeeds] then do action2"

I know that && means something different in some other languages.

&& has a companion, ||

action1 || action2 means "do action1 and if the errorlevel is 1 or greater [i.e. if action1 fails] then do action2"
I use && out of habit, because of the error checking. though in this particular case it doesn't make a difference to the code.

FbWhen IBM turned Object REXX over to the open source community, the IDE was discontinued due to 3rd party code considerations. Having had a copy of the IBM IDE, I was able to integrate the old IDE with the new open source code.

There is no code autocomplete and minimal color coding. It does allow execution of the script from within the environment, so I guess it qualifies as an IDE.




I've also written a few things in C++ using Emacs. This particular screenshot was from a while ago i told Carbon dudeoxide I'd write a process called Carbon.exe so he could run it through the process analysing tool here on CH. But Nathan didn't give it the go ahead.

FB

[attachment deleted by admin]Quote from: fireballs on January 22, 2009, 04:17:41 AM
I've also written a few things in C++ using Emacs. This particular screenshot was from a while ago i told Carbon dudeoxide I'd write a process called Carbon.exe so he could run it through the process analysing tool here on CH. But Nathan didn't give it the go ahead.

FB

tssk tssk... look at all those System() calls! You should have used the proper windows API routines to do all those things- mostly the Console Window API routines, which I believe could be used for most of the things you've used "System()" for.


Although it was a quick & dirty type of program, not really meant for distribution- just curious as to the existence of all those system() calls, so I thought, "ahhh, he's probably just avoiding including the windows header!" and then it was there...I never said i was any good at it!

FBWell I just use NetBeans IDE for Java and for some quick editing I use TextPad(not Notepad or Wordpad lol), and I think I have TrueBasic Bronze some were on my PC. Will try to post pics soon!