Over 1 million tech questions and answers.

Solved: Java: String defined?

Q: Solved: Java: String defined?

Hey,

I've been a little confused over the past few hours. I'm following a tutorial and everything has gone fine up until the past few steps. Is the String "fname" defined? It's confusing as the program doesn't do anything. Even when I add "fname = "test.txt" or something similar nothing is read.

Any help appreciated.

Heres the code:
Code:
import java.io.*;

public class WordCount1
{
private static void linecount(String fname, BufferedReader in) throws IOException
{
long numChar = 0;
long numLine = 0;
long numWords = 0;
String line;

do
{
line = in.readLine();

if (line != null)
{
numChar += line.length();
numWords += wordcount(line);
numLine++;
}
}

while (line != null);
System.out.println("File name: " +fname);
System.out.println("Number of characters: " + numChar);
System.out.println("Number of lines: " + numLine);
System.out.println("Number of words: " + numWords);
}

public static void linecount(String fileName)
{
BufferedReader in = null;

try
{
FileReader fileReader = new FileReader(fileName);
in = new BufferedReader(fileReader);
linecount(fileName,in);
}

catch(IOException e)
{
e.printStackTrace();
}
}

public static long wordcount(String line)
{
long numWords = 0;
int index = 0;
boolean prevWhiteSpace = true;

while (index < line.length())
{
char c = line.charAt(index++);
boolean currWhiteSpace = Character.isWhitespace(c);

if (prevWhiteSpace && !currWhiteSpace)
{
numWords++;
}

prevWhiteSpace = currWhiteSpace;
}
return numWords;
}

public static void main(String[] args)
{
long numChar = 0;
long numLine = 0;
String line;

try
{
if (args.length == 0)
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
line = in.readLine();
numChar = line.length();

if (numChar != 0)
{
numLine = 1;
}

System.out.println("Number of characters: " + numChar);
System.out.println("Number of words: " + wordcount(line));
System.out.println("Number of lines: " + numLine);
}

else
{
for(int i = 0; i < args.length; i++)
{
linecount(args[i]);
}
}
}

catch(IOException e)
{
e.printStackTrace();
}
}
}

RELEVANCY SCORE 200
Preferred Solution: Solved: Java: String defined?

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: Solved: Java: String defined?

Read other 10 answers
RELEVANCY SCORE 66.4

Rank beginner at Java. Need to pull out the month, day, and year separately from an integer. Here's what I have done. It's compiling now (that's an improvement!), but gives me a "String index out of range" error.

Since the spaces are causing trouble, I believe, the error throws on the indicated line -- as soon as the code runs into the first space. How can I do extract this information? The format of the birthdate, with spaces, cannot change.

//Get the date of birth.
System.out.println("Please enter the renter's date of birth (mm dd yyyy): ");
birthMonth = kb.nextInt();
String birthDateString = Integer.toString(birthMonth);
String birthMonthString = birthDateString.substring(0,1);
String birthDayString = birthDateString.substring(3,4); //error throws on this line
String birthYearString = birthDateString.substring(6,9);
birthMonth = Integer.parseInt(birthMonthString);
birthDay = Integer.parseInt(birthDayString);
birthYear = Integer.parseInt(birthYearString);

Thanks.
 

A:Solved: Java -- how to get substring from a string of numbers with spaces

You've marked this solved, but no responses have been given. Can you please confirm that you've found the solution yourself, or else click "mark unsolved" to alert helpers that assistance may still be needed.

Edit: Or, I suppose I could just look at the next thread in the forum and see for myself.
 

Read other 3 answers
RELEVANCY SCORE 58.4

have tried instr and a few other things without success.

most of what I tried returns the wrong result

like sting = "what the shells is going on"
when using str and other functions to find
`hell' it finds `hell' even tho it is not an exact match but part of another word

I have included example of what i need help with in excel file.

Thanking u in anticipation........
 

A:Solved: find exact string within a string using vba

=IF(ISNUMBER(SEARCH(" "&$B$44&" "," "&thecellthathasasentence)),"yes","no")

by adding spaces before and after the cell B44 that contains the word to be searched for it only
gives a yes answer if it finds the whole word. Leaving out the spaces before and after will find
any given occurence. eg "the rat sat on the matter not what it was" Omitting the spaces
and one searches for 'mat' it will give a yes answer which is wrong if a whole word search was required.
 

Read other 1 answers
RELEVANCY SCORE 58

Hey guys,

I'm slowly but surely learning Java but running into a few problems as expected.

My latest task has been to create a program that can read in a series of sums from a file in the form x (operator) y . Then recognise if it's to add,subtract,multiply or divide them.

I think I can figure out how to do it, but I can seem to be able to convert the string that I read from the file to integers so I can perform the calculations.

I'm trying to use this code

int xyz = Integer.parseInt(sum);

but i'm getting number format exceptions. I'm thinking it could be because that there's a plus,multiply,subtract or divide sign inbetween each integer in the file that it's reading in from? Am I right?

If so how do I go about getting around this issue? Do I need to individually convert each character of the string? So in this case I'd want to convert just the X and Y characters so char 0 and 2?

Or maybe I'm missing out on something?

Hope I explained myself properly
 

A:Java convert string to int

Read other 10 answers
RELEVANCY SCORE 58

Hi.

I'm battling away at a Java application that will find a host's DNS and display it in a JTextField. I wasn't really expecting it to work first time, but I can't get past a compilation error. I get the following error:

DNSfinder.java:42:setText(java.lang.String) in javax.swing.text.JComponent cannot be applied to (java.net.InetAddress)

the line of code identified is:
num.setText(host);

I'm hoping/assuming there is a ".toString" method or something similar. I'm also sure there are millions of programs and utilities that can already do this, but I am trying to learn this wonderfully complicated language.

Application listing below...

Thanks in advance
JoyousMonkey
 

A:Java InetAddress as string

erm... not really sure...

what do you need the .toString for?
 

Read other 3 answers
RELEVANCY SCORE 58

Hello guys i want to reverse a string in java.e.g
"hello how are u"
it should be displayed as
"u era woh olleh"
i have tried this but unable.
Code:

String s="hello how are you";
String temp=s;
int j=0;
for(int i=s.length();i>=0;i--)
{
s.chatAt(i)=temp.charAt(j);
j++;
}
 

A:reverse a string in java

Give this a shot
Code:

public class StringReverse {
public static void main(String[] args) {
String text = "hello how are you";
char reversedText[] = new char[text.length()];
for (int i = 0; i < text.length(); i++)
reversedText[i] = text.charAt(text.length() - i - 1);
String reversedTextString = new String(reversedText);
System.out.print(reversedTextString);
}
}
 

Read other 2 answers
RELEVANCY SCORE 58

Halo!

I have a question about the program I am writing.

I am trying to convert an integer to a string within a loop, but it isn't working. Check out what I have please:

import javax.swing.*;
public class AddNumbers
{
public static void main(String[] args)
{
String s1, outMessage;
int MAXNUMS;

int count;
double num, total;

outMessage = "Please type in the total number of data values to be added ";
JOptionPane.showMessageDialog(null, outMessage, "QuickTest Program 6.6",
JOptionPane.INFORMATION_MESSAGE);
int MAXNUMS = Integer.parseInt(outMessage); //I'm trying to make this the variable that defines how many numbers to do. I cannot successfully change it to an int though. Any ideas?
count = 1;
total = 0;

while (count <= MAXNUMS) //i'm trying to make this user defined.
{
s1 = JOptionPane.showInputDialog("Enter number " + count + ":");
num = Double.parseDouble(s1);

total = total + num;
JOptionPane.showMessageDialog(null, "The total is now "+ total,
"QuickTest Program 6.6",
JOptionPane.INFORMATION_MESSAGE);
count++;
}

JOptionPane.showMessageDialog(null, "The final total is " + total,
"Program 6.6",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
 

A:Java? String to Text

You didn't choose the right method for the first instance of the JOptionPane :
String input = JOptionPane.showInputDialog(null, outMessage, "QuickTest Program 6.6",JOptionPane.INFORMATION_MESSAGE);
MAXNUMS = Integer.parseInt(input);
Also, your coding needs some validation as to check if an input is numeric, example :

Code:

try {
MAXNUMS = Integer.parseInt(input);
} catch(NumberFormatException nfe) {
System.out.println(input + " is not numeric !");
}
 

Read other 3 answers
RELEVANCY SCORE 57.2

Im trying to make a method that removes all the vowels from a string.. and i dont really know whats the way to do it. im thinking use booleans for each one, and

Code:

public void vowelRemover(string b)
{
while(a == true)
{
int aspot = b.indexOf("a");
b = b.delete(a, a,);


but then i dont know hwo to make it stop . this is pretty hard.
 

A:(java) I need to remove all vowels from a string

Read other 12 answers
RELEVANCY SCORE 57.2

Hello people.

I currently have an array of Strings, like so:

Code:
private String catalogue[] = {"Apples", "Bananas", "Oranges", "Bread", "Milk", "Cheese", "Pizza", "Yoghurt", "Carrots", "Cabbage"};
I have to generate a "Shopping List", using a GUI, but I need to assign prices to these array elements also.
I plan to set up and declare the price (such as: double price; ) in a new class. But once I've done this, how do I assign a double value to the Strings as well?

Thanks in advance
 

A:Java: String and Double arrays

Okay...

I'll rephrase a little as I've done some research.

Is there anyway I can create a multi-dimensional array that holds two types of objects? Like what I ideally would need to do is create an array to hold Strings and doubles. But I've tried doing this in my JVM, to no avail:

Code:
private String double catalogue[][] ({"blah blah blah"}, {8.5});

That's just an example
Basically, I need to assign a price (a double) to an item for my shopping list (String).

I'd appreciate any help ASAP, as I have to hand in this work by the end of the week.

Thanks people.
 

Read other 2 answers
RELEVANCY SCORE 57.2

hi,
i'm wondering if it is possible to change a String to an integer value..
for example..
String aString = "12345";
to an integer?
 

A:java-convert a String to an integer?

Read other 6 answers
RELEVANCY SCORE 56

Hey all,

I am just fooling around with some searching algorithms for extra practice but came up to a problem I cannot seem to figure out. I am trying to get the boyer-moore horspool algorithm to work properly, but for some reason it will not tell when a match arrives.

Here is the code...
Code:
import java.util.ArrayList;
import java.util.HashMap;

public class horsepools {

void horse(String text, int textLength, String key, int keyLength)
{
boolean match = false;
char [] keyArray, textArray;

int scan = 0;
int bad_char_skip[]; /* Officially called:*/
int origLen = textLength;

keyArray = key.toCharArray();
textArray = text.toCharArray();

bad_char_skip = new int[256];
//PREPROCESSING
//This loop initializes the search table to the length
//of the pattern being searched
for (scan = 0; scan <= 255; scan = scan + 1)
{
bad_char_skip[scan] = keyLength;
// System.out.println("badchar: " + bad_char_skip[scan]);
}
/* C arrays have the first byte at [0], therefore:
* [nlen - 1] is the last byte of the array. */
int last = keyLength - 1;

/* Then populate it with the analysis of the needle */
for (scan = 0; scan < keyLength; ++scan)
{
bad_char_skip[keyArray[scan]] = last - scan;
System.out.println("last: " + last);
System.out.println("badchar: " + bad_char_skip[key... Read more

A:Boyer Moore Horspools String Searching - JAVA

Hi r3drock3t88,

The Boyer-Moore-Horspool algorithm is one of my favorite - I think I had read about it in the journal Software Practice & Experience (with a pseudo-code example). I once implemented it in C (based on that psuedo-code example) to be able to scan a file system OS release for license compatibility and it worked very well - the size of the key to scan for was the entire size of the license, which was about 1024 characters or in that range. It ran very fast!

I would recommend running your code via a Java debugger to find the problem - if there is such a thing. When coding in C, etc. I always ran my code through a gdb debugger (Gnu C or gcc debugger) during code development - quick turnaround can always be had by integrating the use of the language based debugger for the language you are developing your program into your code development process.

Use watchpoints in the code where the comparison is made which should tell you why the problem is occurring straight away.

-- Tom
 

Read other 1 answers
RELEVANCY SCORE 54.8

Hi guys,
I'm a non-professional java developer who needs a way of taking a .txt file and turning it into a bunch of Strings (one String per line) so I can batch rename a bunch of files with filenames taken from the text file line by line; a kind of custom file renamer, but I'm struggling with the classes and methods needed for the first part of the project (ie getting a .txt file and turning each line into a String so I can rename files with it)

Any thoughts would be super appreciated.
chz
Ben
 

A:Need Java method for converting lines from text file into String objects

Hi mushka,

I know I have the program you need. It was lost among my old pieces of coding.
Finally, I got it.
I test the program and it works.
Remark : the process ignores empty lines and it may be executed on both Windows and Unix based OS.
Also, you must rename the files in attachment with the .java extension.
 

Read other 3 answers
RELEVANCY SCORE 51.6

I am continually getting the error "Run Time error 1004: Application defined or object defined error," each time a user clicks one of the cells within this excel file. It comes up as apparently a visual basic error. I've search other sites and unfortunately do not know enough about macros or excel formulas to know what to do next, so I thought I would post about it here. One user apparently has no trouble opening it while every other user has the same issue. Here is the debug code:

Private Sub Worksheet_Deactivate()

End Sub

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Cells.Interior.ColorIndex = -4142
Target.EntireRow.Interior.ColorIndex = 8
Target.EntireColumn.Interior.ColorIndex = 8
End Sub

The "Cells.Interior.ColorIndex = -4142" portion is highlighted in yellow, so I assume that's where the error is. From there, I'm not sure what to do to change it. Please let me know as soon as possible what direction I should take.

Thanks

A:run time error 1004 application defined or object defined error

To be honest...I would assume that the file is corrupt and try to replace it. All seemingly meaningful links on this error involve VBA coding and things that can go wrong with it...way overhead my head and out of my interest arena .

If it truly is a coding error (as seems implied), I would take it to the originator of that file, since it throws an error.

Very strange that e pluribus unum...manages to use it without problems .

Louis

Read other 1 answers
RELEVANCY SCORE 50.4

sorry guys i posted this in web development by accident... heres my problem:

Ok, I have a vector "v2" containing a bunch of strings.

I have another vector "v1" that contains keywords. I go through this vector v1's values using a simple for loop. On each iteration, I want to perform a binary search through vector "v2" to see how many times that word exists in v2.

My problem is doesnt binary search only return the first position it finds the word in? However there are going to be many instances of each word from "v1" in "v2", and I need to count how many times each word in "v1" occurs in "v2".

I have done this succesfully using nested for loop (put another for loop through v2 inside the for loop through v1, but I will get points off as this is not as efficient as binary search).

Both vectors are sorted.

help! thanks!
 

A:binary string throug ha string array/vector using c++

So, for each keyword (v1) you need to find a count of that word's occurrences in ALL of v2?

Given your existing data structures, the only way to do this is by an exhaustive search through ALL of v2 for each keyword - NOT with a binary search.

For a small amount of data, the nested-loop approach would be okay. But
were I programming this problem for a large volume of data, I would parse all of the strings in v2 and store the words in a binary tree, which would look like:

struct b_tree
{
char *word ;
int count ;
struct b_tree *left, *right ;
} ;

OR, an array of

struct
{ char *word ;
int count ;
} ;

Then a binary search would be appropriate.

In each case, *word can point to the first occurrence of that word in v2.

The b-tree approach would make it easier to store the words, while the array approach would make it simpler to search using the library function bsearch().
 

Read other 1 answers
RELEVANCY SCORE 48.8

I am taking a beginners computer science course in Java, and I am currently learning about methods. There is one question where I have to calculate the ending balance on a deposit at a given rate of interest, and it says I need a user defined procedure-type method (called compound), and a main method that will call it.

I just want to know how to get the program to move to the user-defined method because when I run it, it does not output the last statement which gives the ending balance. It only outputs the main method. This is what I have:
Code:

import java.io.*;

public class CompoundInt {

public static void main (String[] Args) throws IOException {

BufferedReader myInput = new BufferedReader (new InputStreamReader ( System.in));

String inDeposit, inRate;

System.out.print("Enter your bank balance: ");
inDeposit = myInput.readLine ();

System.out.print("Enter the annual compounded interest rate: ");
inRate = myInput.readLine ();

compound ();
}

static public void compound (double deposit, double rate, double endingBalance){

deposit = Double.parseDouble (inDeposit);
rate = Double.parseDouble (inRate);

endingBalance = deposit + ((rate/100) * deposit);

System.out.println("The ending balance of $" + deposit + " at an annual compounded interest rate of " + rate + "% is $" ... Read more

A:Solved: Getting to a user-defined method

This is an example about using a method :
Code:
[SIZE=2][B]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class CompoundInt {

public static void main(String[] Args) {

BufferedReader myInput = new BufferedReader(new InputStreamReader( System.in));
String inDeposit, inRate;
try {
System.out.println("Enter your bank balance: ");
inDeposit = myInput.readLine();
System.out.println("Enter the annual compounded interest rate: ");
inRate = myInput.readLine();
double deposit = Double.parseDouble(inDeposit);
double rate = Double.parseDouble(inRate);
double endingBalance = compound(deposit,rate);
} catch (IOException ioe) { // mandatory
System.out.println(ioe.getMessage());
} catch (NumberFormatException nfe) { // optional : it's a way to check if the entered
System.out.println(nfe.getMessage()); // -------- values are numbers
}
}

static public double compound(double dep, double rt){ // The method returns a double variable
double result = dep + ((rt/100) * rt);
System.out.println("The ending balance of $" + dep + " at an annual compounded interest rate of " + rt + "% is $" + result);
return result;
}
}
[/B][/SIZE]

 

Read other 2 answers
RELEVANCY SCORE 48.4

I have a game I'm trying to run, but I keep on getting an error message saying: " Script Error: Handler not defined " and at the bottom it says: " #EventQ ". Then there are two buttons at the bottom of the dialogue, one is " Quit " and the other one is " Continue " .

How do I fix this Problem??????

Windows XP Pro.
 

A:Solved: Script Error: Handler not defined

Read other 7 answers
RELEVANCY SCORE 47.6

Currently I have an add-in that includes an "Export Worksheet" (menu item option) - this works perfectly.

However, one of my users has a workbook that includes vba code behind the worksheet, which then refers to vba 'module' procedure - however when the export worksheete is exported, it exports the worksheet, but not the macro.

The obvious way around would be just to include the macro code in the Add-in, however, what I need is more of an error handling function, I need the worksheet code to simple IGNORE or error message if the procedure doesn't exist.

Not sure how to do it!?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo HandleError0


Application.ScreenUpdating = False

If Not Intersect(Target, Range("FORM_CHGTYPE")) Is Nothing Then
[COLOR="Red"]projectprogramme[/COLOR]
End If

Application.ScreenUpdating = True

Done:
Exit Sub

HandleError0:
GoTo Done

End Sub

Breaks on the red higlighted section, with:
Compile Error:
Sub or Function noy defined.Click to expand...

And the current error handling doesn't stop the code from executing.
 

A:Solved: Excel VBA Error Handling: Sub or Funcion not defined

Read other 6 answers
RELEVANCY SCORE 47.6

I have a spreadsheet containing a list of Invoices to print. As part of my Macro I need to be able to copy a row of data from the list (columns a to k), however the row will be different every time and is chosen by the user.

So I was looking at putting in a prompt to ask the row number to copy and go from there

Any help welcome.
 

A:Solved: Excel Macro help - copying user defined row

welcome to the board. Dou you already have a macro that does anything special?
all you need is define a variable and an input box, then if the nr is a valid row exceute the copy command

e.a.g
Code:

Sub Sample()
Dim xrow As Integer
xrow = Application.InputBox("enter row nr.", "ROW", 2, , , , , 1)
If cell(xrow, 1).Value = "" Then Exit Sub
Range("A" & xrow & ":K" & xrow).Copy

' and here come the rest of the code to paste or whatever the macro has to do

End Sub


See if this helps you on the way
 

Read other 3 answers
RELEVANCY SCORE 47.6

Hi,I have excel sheet which contains multiple rows for each country.The requirement is to split the file for each country and save with country name.I have got the below macro but when im trying to run it,getting error as label not defined.Please advise:
Sub CopyData()
Dim LMainWB As String
Dim LNewWB As String
Dim LRow As Integer
Dim LContinue As Boolean
Dim LColAMaster As String
Dim LColATest As String
Dim LWBCount As Integer
Dim LMsg As String
Dim LPath As String
Dim LFilename As String
Dim LColAValue As String

On Error GoTo Errorcatch

'Path to save all new workbooks to
LPath = "C:\Users\43693678\Documents\Split"

'Retrieve name of the workbook that contains the data
LMainWB = ActiveWorkbook.Name

'Initialize variables
LContinue = True
LRow = 2
LWBCount = 0

'Start comparing with cell A2
LColAMaster = "A2"

'Loop through all column A values until a blank cell is found
While LContinue = True

LRow = LRow + 1
LColATest = "A" & CStr(LRow)

'Found a blank cell, do not continue
If Len(Range(LColATest).Value) = 0 Then
LContinue = False
End If

'Value in column A
LColAValue = Range(LColAMaster).Value

'Found occurrence that did not match, copy data to new workbook
If LColAValue <> Range(LColATest).Value Then

'Copy headings
Range("A1:C1").Select
Selection.Copy

'Add new workbook and paste headings into new workbook
Workbooks.Add
LNewWB = ActiveWorkbook.Name
ActiveSheet.Paste
Rang... Read more

A:Solved: Macro giving error 'label not defined'

Read other 12 answers
RELEVANCY SCORE 47.6

I'm trying to define a dynamic-range chart, as described in http://peltiertech.com/Excel/Charts/DynamicColumnChart1.html

I've defined the names, but they keep moving! E.g. I defined a name called "dates" as =OFFSET(Daily!K3,0,0,Lastrow-2,1), but the next time I go look at it, it might be based on A1, or K1, or AJ3, or AL1053923523 (that's approximate, but I did have it move to a similar location once!).

It seems to happen as soon as I reference one of the names. I can define the names, exit the defined-name dialog, hit Ctrl-F3 again, and they're still OK. Then I enter "dates" in the Name Box, and it highlights the correct range. But now if I hit Ctrl-F3, the name definitions have changed!?

Probably for this reason, I've been unable to actually define the graph that's supposed to use them. By the time I access them in the chart definition, they point to someplace with bad data.

What causes this??
Running Excel 2007 on Vista Home Premium SP2.

Thanks!
Gary
 

A:Solved: Excel 2007 -- defined names keep moving!?

Read other 6 answers
RELEVANCY SCORE 45.2

bleh, can't figure out what's wrong. I changed a numerical value in a formula to be inserted into a cell into a variable. i had problems figuring out the ampersand & quote placements. i finally got it to stop giving me errors, but it now just gives me a "TRUE" in the cell, when I want the formula.

Originally:
Selection.Offset(3, 0).FormulaR1C1 = "=COUNTIF(R[-2]C, "">=0.5"")" 'Task Weeding

Now:
Selection.Offset(3, 0).FormulaR1C1 = "=COUNTIF(R[-2]C, " & "" >= " & TaskLim & "")" 'Task Weeding
 

A:[Solved] string syntax

anyone?
 

Read other 2 answers
RELEVANCY SCORE 45.2

Alot of computers at the company that I work for are getting a string of BBBBBBBBBBBBBBBBBBBBBBB's on the top left of Internet Explorer and we can not get rid of.

A:[SOLVED] String of B's at the top left of IE

Hello and welcome to TSF ,

Could you please post a screen shot of this?

If you have some problems or dont know how to do this, follow these steps:

To post a screen shot please follow these steps....

How to take a screen shot.
Open up Internet Explore.
Look on your keyboard and there should be a button (usually in the top right corner) that reads PrtSc, press that button.

** Please Note: If you cant find the button, here is a picture of a basic keyboard, and look at the key with the red squares around it. Click
Here (Click on the Blue link) to view the Picture. **
Once the PrtSc button is pressed, Open up Microsoft Paint.
Click Start,
Click Run
Type in MSpaint,
Press Ok.
Once Paint is open, On the Menu bar click on Edit
Then Paste.
Save the file to your computer as a Jpeg image (Mainly so the size is not so big)
On the menu bar click File,
Click Save as..
Next to Save as type click the drop arrow, and choose Jpeg
The click Save.

How to Attach a file to a post

In your nest post click on the little paperclip, as seen in the picture below:


Now you should have a pop up window.Click Browse
Find the file click on it, and press Open.
Press upload. When the upload is complete you can close the Upload Window, and finish typing your reply, then when done just click Submit reply.

Read other 19 answers
RELEVANCY SCORE 45.2

Okay so
Code:
alert(567);
will bring up an alert with 567 in it, but
Code:
alert(0567);
will being up an alert saying 375.

Any idea why??
 

A:Solved: Javascript int to string

It's to to do with how javascript identifies what base numbering system is being used.

3 - would be decimal
03 - would be octal
0x3 would be hexadecimal

this http://javascript.about.com/library/blnumbase.htm explained it too me
 

Read other 1 answers
RELEVANCY SCORE 45.2

Hey all.
No idea what to call this, but is there a program or a built in windows program that you can save typed text in a command prompt window to a txt file
for example

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\windows\>text C:\windows\textsavehere\text.txt "The writing that you want in the file"

I am aware of the "edit" command that executes a dos program, but this is not sutible.
Something along those lines though.
Not sure if this would be called "appending text to a file" or not, but yeah.
Thanks in advance.
Chris
 

A:Solved: DOS string to .txt file

I just looked in the recent forum called THE LIST OF MS-DOS COMMANDS and found
"edlin"
dont know how to use this command so ill ask if any one else does
thanks
 

Read other 3 answers
RELEVANCY SCORE 45.2

I was wondering if there was a method that is similar to the Java (java.util.)StringTokenizer.

I have a string in VB seperated with a colon. I am able to place the first part (before the colon) into a variable. How would I get the second part of it?
 

A:Solved: VB String Parsing

Read other 10 answers
RELEVANCY SCORE 45.2

I need the modem string for a noisy phone line. I did have it but had to reformat my hd and I forgot to writ it down.
 

A:Solved: Modem String

I found it:
S10=50
 

Read other 1 answers
RELEVANCY SCORE 44.8

Afternoon all,

I know that this request is a rather trivial matter, but the difficulty of perfecting the declarations is what seems to be stumping me. I basically have a string which is created (from a COM object) with the string along the lines of:
Code:
ans = -4.3029
The problem is I only need the number (with the decimal and negative sign as well), with the text and blank space removed. The problem is I am struggling to get it right.

I used the Regex.Replace code to remove the text. At first I tried "\D", but ONLY leaves numbers, no mathematical punctuation.

Then I tried "[^0.9 .-]", but now Visual Basic adds an additional 2/3 (depend on the length of the number) blank spaces before each result.

So I would like to know how it would be possible to define the Regex.Replace function to accept only numerical characters, along with standard numerical punctuation.

Thank you for your help!
 

A:Solved: Remove certain characters from string

I'm greeted by the subtle insult by the phrase on the front page "There's no such thing as a stupid question, but they're the easiest to answer!" as I realise that my problem was the fact that I had a space within "[0-9 .-]" That would explain the problem I had. As everything is fine now, this can be closed as solved.
 

Read other 2 answers
RELEVANCY SCORE 44.8

I regularly watch netflix on my laptop, however recently I'm not able to. The only thing I can think of is sandboxie. I think I remember seeing something about spoofing the OS/browser, and selecting that option. I have since uninstalled Sandboxie.

Now, I am unable to watch Netflix. I have tried several things, even editing the key at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent. Before, it read [Default (value not set)]
Now it reads
[(Default) Mozilla/5.0
Compatible compatible
Platform Windows NT 6.1 WOW64
Trident Trident/5.0
Version MSIE 9.0

However my userAgent string shows up as:
Your User Agent: Mozilla/4.0 (compatible; MSIE 999.1; Unknown)

My friend's laptop has the same OS. His userAgent string is not edited.

His userAgent reads as:
Your User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C

He is able to watch netflix on his computer. How am I able to modify my userAgent to allow me to watch netflix?


Tech Support Guy System Info Utility version 1.0.0.1
OS Version: Microsoft Windows 7 Ultimate , Service Pack 1, 64 bit
Processor: AMD Turion(tm) 64 X2 Mobile Technology TL-56, AMD64 Family 15 Model 72 Stepping 2
Processor Count: 2
RAM: 1918 Mb
Graphics Card: NVIDIA GeForce Go 6150, 128 Mb
Hard Drives: C: Total - 61442 MB, Free - 5415 MB; G: Total - 32418 MB, Free - 20948 MB;
Motherboard: ... Read more

A:Solved: Modify userAgent string?

Read other 16 answers
RELEVANCY SCORE 44.8

Hi,

I use MS Access 2003. I want to display how many records are there in my table, and display it in a text box in a form, but I dont know how.

This is the query that I want to use : SELECT count(*) FROM my_data.

I don't know how to put it in the access/vba. I think I have to use recordset and connection string but don't understand at all about that .

Can anybody help? I use Access database in my computer (local). My database name is: pasOrto.mdb.

Thank you very much all..
 

A:Solved: recordset and connection string

Read other 9 answers
RELEVANCY SCORE 44.8

Hi team,

I want to be able to hide a number of controls depending on other selections in my form. This one gets me started but I don't know how to use the resulting string!!

This works:
Code:

Dim Apart As String
Dim BPart As String
Dim StateStr As String

Apart = "Me.InstallQtyExistingLineI2_"
BPart = ".Visible=False"

For i = 1 To 10
StateStr = Apart & i & BPart
MsgBox StateStr
Next i

The strings "Me.InstallQtyExistingLineI2_1.Visible=False" to "Me.InstallQtyExistingLineI2_1o.Visible=False" are messaged up ok.

How do I make these strings useable in VBA to actually hide the 10 controls?

Hope you can help!?

Chris
 

A:Solved: Evaluating a string and using it as VBA code

Read other 16 answers
RELEVANCY SCORE 44.8

Hi
I have a programme that basically looks for an account number and password in an access database and if there is a match it opens a window showing the account number, surname, forename and balance relating to that account.

So lets say for example I have 200 in my account, it will display as 200.0000.I need to convert it to an integer I think so it will display properly.

Now I have to do a withdraw or deposit function to either deduct or add to that 200 but I
keep getting an error when I try it.

Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "200.0000"

Is this down to the same problem?

Do I just need to somehow convert the label the amount is showing in to integer??

really lost on this one

Cheers

Gus
 

A:Solved: Converting string to integer

Read other 7 answers
RELEVANCY SCORE 44.8

Hi,

A1 Cell will be populated with the data (3 different ways) please see an example below
I need to grab the numbers and display them in two different cells.

i.e
A1 = Frozen (-20 to 20C) = Output: B1= -20, C1 = 20C
or
A1 = Refrigerated (15 to 30C) = Output: B1= 15, C1 = 30C
or
A1 = Excessive heat (>10C) = Output: B1= empty, C1 = >10C
what would be a good way to get the numbers.. Some function that can be used in VBA code.

Thank u
 

A:Solved: Excel-VBA-Split string

Read other 16 answers
RELEVANCY SCORE 44.8

Dim qt As QueryTable

sourcefile = "\\NLVNYMAC01MSV02\nlv15946$\Desktop\BGY505.mdb"
sqlstring = "SELECT * FROM `\\NLVNYMAC01MSV02\nlv15946$\Desktop\BGY505`.TestResults TestResults"
connstring = _
"ODBC;DSN=MS Access Database;DBQ=\\NLVNYMAC01MSV02\nlv15946$\Desktop\BGY505.mdb;Driver"

With ActiveSheet.QueryTables.Add(Connection:=connstring, Destination:=Range("c1"), _ Sql:=sqlstring)
-----------------------------------------
then, how can i replace the bold text above with name 'sourcefile'? i mean, how to type it inside the connstring?
 

A:Solved: String inside the variable

Hi there,
Code:
connstring = "ODBC;DSN=MS Access Database;DBQ=" & sourcefile & ";Driver"

 

Read other 1 answers
RELEVANCY SCORE 44.8

Hi,

I am looking for a VBA function, that would lookup a string and if a match found return true/false.
Ie.

String = "USA,Canada,France,Italy"
Find ="France"

I could do it using the below code, but is there away to do it with less code:

Dim country() As String
Dim i As Integer
country= Split(wk.Worksheets("SHEET1").Range("AA3").Value, ",")
For i = 0 To UBound(country)
If UCase(country(i)) = "France" Then
.......
End If
Next i
Thank you
 

A:Solved: Excel VBA Lookup string

Read other 9 answers
RELEVANCY SCORE 44.8

Hello,

The Title pretty much explains it but I need to know how to get the number of characters in a Std::string and ouput it as a integer e.g:
Code:
void main()
{

std::string str = "Cheesecake";
int NumOfChars;

/*
Get Number of characters in str and put the number in NumOfChars...
NumOfChars should then equal 9 (obviouslly starts counting from 0)

*/
(You can Probubly Guess I'm Using C/C++, VC++ to be specific)

Anyone know how to do this? Any Help Would be great...

Thanks

Doctorzeus
 

A:Solved: Get Number of Characters in Std::String

In VB.net a string is a character array so the Length property gives the number of characters. If that's not the case in C (I think it is but haven't used C for quite a few years) then you could parse the string in a loop, one character at a time, counting the number of characters until you reached the end of the string (terminated by a null character, isn't it?).
 

Read other 3 answers
RELEVANCY SCORE 44.8

In the properties of my shortcut icon of rosetta stone, in the start box i am trying to enter the following string:

"C:\Program Files\Rosetta Stone\Rosetta Stone Version 3" but I am getting the following error msg of:

It apps is actually located here "C:\Program Files (86)\Rosetta Stone\Rosetta Stone Version 3" which i tried too but i am getting the same error.

Do you guys know what I am doing wrong?

help
 

A:Solved: error msg on string code

needed to edit shortcut as wll thx
 

Read other 1 answers
RELEVANCY SCORE 44

this does not work properly

IF(ISNUMBER(SEARCH(" "&$A$1&" ",D5)),1,0)

please see xls example of the problem
 

A:Solved: find Exact whole word in a string

Read other 8 answers
RELEVANCY SCORE 44

Im trying to create a text to ASCII binary conversion in Visual C++ and as I don't really work with Windows forms and specifically "System::String" am wondering what would be the quickest way to convert it to binary? I thought about using the bitset header from the std library but it wasn't written for system strings I would have to pass the data through multiple variable types before I got to the right one and was wondering if there was a simpler way?
 

A:Solved: textbox System::String to binary (V C++)

ahh solved it using pointers and a bit of intuition not happy it took me that long to work that out..
 

Read other 1 answers
RELEVANCY SCORE 44

Hello,

I am trying to display a font in my program, but unfortunately one of the characters I need is exactly the same as the " character used in the coding. As I can't use literal coding in VB.NET, I need to know if there is a way to convert the hex character code (0x93) to ASCII so I can display it correctly.

Is there a way to do this, or is there a &xxx number I can use instead? I'm at a bit of a loss.

Thanks
 

A:Solved: VB.NET Converting from a character code to a string.

Read other 12 answers
RELEVANCY SCORE 44

Hello.

I was wondering if it was possible to replace a character with a polygon, in any instance of that character's occurrence in a string?
For example, if I typed-in the word 'Holly' and hit 'enter', the first letter would be replaced by the polygon.
If I then went to type the word 'thistle', the polygon's new position would be in place of the second letter?

This is my code fragment, the character I want to replace is called sl1.
Code:

if(pr_word.indexOf(sl1)!=-1)
{
pr_word = pr_word.replace(sl1, ' ');
g.setColor(Color.red);
g.fillPolygon(xh,yh,5);

g.setColor(Color.white);
g.fillRect(352,40,18,20);
}

Any help/guidance will be greatly appreciated.
 

A:Solved: Is it possible to replace a character in a string with a polygon?

Read other 6 answers
RELEVANCY SCORE 44

Hello.

Programming language I am using: Java (not JavaFX, Swing or anything else of that nature. Just regular Java).

Here's how my program works:
A user is asked to enter some text into a textfield.
The entered text is then read in by the program.
The program checks whether a specific character (in my case 'h' or 'H') is present in the entered text.
If so, the program removes that character from the string and instead, displays it as a drawn polygon (not a Unicode character) and displays the rest of the string using the drawString() method.

Basicially, what I'm stuck on is how I would go about coding step 4 in the above list. ^^

So far, I have managed to remove the character I wish to replace (called 'sl1' )from the string when it occurs in the entered text (code below):
Code:

if(pr_word.indexOf(sl1)!=-1)
{
pr_word = pr_word.replace(sl1, "");
g.setColor(Color.red);
g.drawPolygon(x,y,5);
}

Any help/guidance will be greatly appreciated.
 

Read other answers
RELEVANCY SCORE 44

Is there a way to count the number of times a certain character appears in a string in access?

I have a field in Access containing the following string: "1_2_3_4_5_6".

I want to know how many times "_" appears in the string.

I tried:

count(instr(fieldname, "_"))

but that doesn't work.

Any ideas?
 

A:Solved: Counting # of characters in string in Access

You can use VBA

Code:
vArray = Split(vString, "_")

vCount = UBound(vArray) - LBound(vArray)
where vString is your string variable
Rollin
 

Read other 2 answers
RELEVANCY SCORE 44

I am modifying an interpreter I wrote so that it will also accept string labels. The problem right now is that if I use a CALLL instruction in the code, then the label number will be off. It seems to work for GOTOLs, just not for the CALLL instruction. Here is the code for the loads2() function, where the work for the labels is done:

Code:

if (mem.get(0) != IVERSION)
crash("Version Unknown.");
if (mem.get(reg.ecount - 3) != IEND)
crash("No END Instruction.");
for (unsigned long j = 0, k = 0; j != reg.ecount; ++j)
{
if (mem.get(j) == IVAR && mem.get(j + 1) == TVOID)
{
reg.varcount.put(j + 2, k);
reg.varcount.insert();
++k;
}
}
for (unsigned long j = 0, k = 0; j != reg.ecount; ++j)
{
if (mem.get(j) == ILBL && mem.get(j + 1) == TVOID && mem.get(j + 2) == 0)
{
Label l(j + 3, "");
reg.labels.put(l, k);
reg.labels.insert();
++k;
}
else if (mem.get(j) == ILBL && mem.get(j + 1) == TSTRING)
{
Label l2;
String temp = "";
unsigned long l;
for (l = j + 2; mem.get(l) != 0; ++l)
{
temp += (char)mem.get(l);
}
l2.setString(temp);
unsigned long l2len = l2.getString().length();
unsigned long noffset = 6;
unsigned long noffset2 = 1;
if (l2len == 2)
noffset += 1;
if (l2len == 3)
noffset += 2;
if (l2len > 3)
{
// Increase noffset by 1 for every l2len...
for (unsigned long i = 4; i <= l2len; ++i)
{
n... Read more

A:Solved: PNF: String Labels with CALLL Don't Work

I just tested it by replacing the CALLL instruction with a GOTOL instruction. It still does not work with this program, so the fault is in loads2(). It works with other programs I'd tested it with before, but it is off with this program. The program I'm trying to run is:

Code:

[EMAIL="[email protected]"][email protected][/EMAIL]

0 0 0
6 4 66 101 102 111 114 101 32 115 117 98 114 111 117 116 105 110 101 33 0
45 4 97 0
6 4 65 102 116 101 114 32 115 117 98 114 111 117 116 105 110 101 33 0
3 0 0
57 4 97 0
6 4 73 110 32 115 117 98 114 111 117 116 105 110 101 33 0
55 0 0
60 0 0
 

Read other 2 answers
RELEVANCY SCORE 43.6

I have an Access 2007 database that is currently connected to our company's main database through an ODBC connection. In a week or so, we'll be moving from using the ODBC to ADO. I have figured out how to connect the two using the following ADO connection string:

Private Sub Form_Open(Cancel As Integer)
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=sqloledb;Data Source=SERVERNAME;Initial Catalog=NAME;User Id=ll;Password=LLLLLL;trusted_connection=yes"
conn.ConnectionTimeout = 30
Dim myCommand As ADODB.Command
Set myCommand = New ADODB.Command
myCommand.CommandText = "select * from tblName"
Dim rs As ADODB.Recordset

Where I get stuck is how to connect this to tables and queries in my database? Or better yet how to get the above connection string to build a table that I can use using VBA? What VBA or SQL would I use to link the tables that I previously used ODBC to connect to my Access database?

I've tried using the below but it hasn't worked to far:

Dim fieldCount As Integer
fieldCount = rs.Fields.Count
ListView0.Cols = fieldCount + 1
ListView0.AllowUserResizing = flexResizeColumns
ListView0.Rows = 50
For i = 0 To fieldCount - 1
ListView0.TextMatrix(0, i + 1) = rs.Fields(i).Name
Next
rs.MoveFirst
Count = 1
Do While Not rs.EOF
ListView0.TextMatrix(Count, 0) = Count
For i = 0 To fieldCount - 1
ListView0.TextMatrix(Count, i + 1) = rs.Fields(i)
Next
Count = Count + 1
rs.MoveNext
Loop
rs.Clo... Read more

A:Solved: Need to make a table using ADO Connection String Data

Read other 8 answers
RELEVANCY SCORE 43.6

A predecessor designed a database that stores a text field that the end user fills with a date, like "Monday, August 13, 2007". Now of course the end user wants to sort the output by date (previously events were entered in date order so that retrieving alread had things in order). The web page that hits the database is written in VB Script under ASP. I'm looking for a function that can sort these dates either within the SQL query or afterwards in VB Script. I could kludge something together, but I'd prefer something elegant.

My current SQL query:

strSQL = "SELECT Event, EventDate FROM AcademicCalendar ORDER BY EventID;"

where EventDate is a text field (not a true SQL date field).

Thanks in advance!
 

A:Solved: Sorting text string as date in SQL/VBScript

I solved this one on my own. Probably far from the most elegant, but this is what I did:

The overall strategy is to pull the records from the database into a new array. That array consists of the fields I'm interested in plus an additional column that is a sortable date. That new date column has be be constructed from the text field in my database that contains a date as described in my original post. I use VBScript's regular expressions to extract the date portion of the text field then convert it to a useable date using CDate. Then the whole array is sorted on the new CDate field before showing the results.

First, I query the database and retrieve the recordset into oRS. The recordset has a forward-only cursor so I use the method described here to count the records to set up my array size. Note the need to use the .MoveFirst method to move back to the beginning of the record set.

The key to sorting is the function at the end (QuickSort). That function was "borrowed" from here.
Code:

<%
Dim regEx, strMatchDate, arrResults()
arrTemp = oRS.GetRows()
intRecordCount = UBound(arrTemp,2)
oRS.MoveFirst
ReDim arrResults(intRecordCount,4) ' I have 4 field to display
Set regEx = New RegExp
With regEx
.Global = False
.IgnoreCase = True
.Pattern = "[a-z]+\s[0-9]+,\s[0-9]{4}" ' matches on pattern Month Date, Year
End With
intCount = 0
Do While Not oRS.EOF
strDate = oRS("Dates")
arrResults(intCount,0) = strDate
arr... Read more

Read other 1 answers
RELEVANCY SCORE 43.6

I keep getting this message when trying to access some game buffs off of a page. The error message comes up and I x it out and I still am not able to use the buffs on the page.
 

Read other answers