I can't read back what I wrote (to a file)
I wrote a very large file (over several hundred hours) in textual form; each line is a long, output using toHexString() like this:
2092cc0ca723ec80
2092cc0ce463ec80
2092cc0d14a3ec80
2092cc0d14e3ec00
2092cc0d1523ec80
2092cc0d1563ec80
2092cc0d15a3ec80
2092cc0d15a3ed00
2092cc0d16e3ec80
... etc ...
I then tried to read the numbers back into another Java program using Long.parseLong(str, 16), but I get a NumberFormatException when I get about 1million lines in. This is where the lines begin with an _8_ (in hex):
8219250d16e3ec80
8219250d16e3ed00
8219250d56a3ec80
8219250d56e3ec80
8219250d56e3ed00
...etc...
Is there another way for me to use Java to read back in what I wrote using Java?
ozweepay wrote:
>
You're absolutely right. I think this is the reason that Java will never become widely used, ...
Did you actually just claim that Java's popularity implies that it cannot contain design flaws?Sure, why not. I mean we all know that Java is perfect. God forbid, I've never seen anything wrong with Java in the past 10 years.
Wow indeed! Why didn't they put it to the standard API. Businesses all around the world are parsing 64-bit hex values from files!!!
Did you actually just insinuate that Java's principle purpose is to support business applications? I guess that's why the standard library doesn't support things like graphics, sound, networking, etc.And yet you're only reading hex Strings from a file. All those sweet graphics and sound classes for nothing...
Do you spend a lot of your time insulting people who complain that the lack of unsigned longs makes it hard to parse network addresses? It's not like anyone ever does that on a computer, right?Do you spend a lot of your time rewriting things in C when a programming language fails you in the parsing department?
Similar Messages
-
Downloaded ios5 one week ago, last nigth synced itunes and lost most apps, even folders and modified backup. How can I get back what I had before last synced?
Try resetting your home screen layout, go to your setting>general>reset home screen layout.
-
Can we Read/Display the content of Word/PDF file in Flex 3/4 ?
Hello All,
Can we read/display the content of Word/PDF file in Flex 3 or Flex 4?. I have one word file containing Arabic and English content with some settings like Bold, Color, Align etc. I want to display the content of this word file as it is in the flex web application.
Awaiting for prompt reply.
Thanks and Regardsthank you for your immediate reply, but,
sorry, this does not work.
With this code:
<cfpdf action = "read" source = "dok_1.pdf" name =
"mypdf">
<cfdump var="#mypdf#"/>
I get this result:
Everything, but no text of the document.
PDFDocument
Application name of application
Author bimbam Verlag GmbH
CenterWindowOnScreen [empty string]
ChangingDocument Allowed
Commenting Allowed
ContentExtraction Allowed
CopyContent Allowed
Created D:20080710
DocumentAssembly Allowed
Encryption No Security
FilePath [empty string]
FillingForm Allowed
FitToWindow [empty string]
HideMenubar [empty string]
HideToolbar [empty string]
HideWindowUI [empty string]
Keywords [empty string]
Language [empty string]
Modified [empty string]
PageLayout SinglePage
Printing Allowed
Producer [empty string]
Properties [empty string]
Secure Allowed
ShowDocumentsOption [empty string]
ShowWindowsOption [empty string]
Signing Allowed
Subject [empty string]
Title Rheinische Angler-Zeitschrift
TotalPages 1
Trapped [empty string]
Version 1.3
Maybe i do not understand the cfpdf tag the right way.
What i want is a kind of pdf-to-text conversion.
Do I have to use the processddx action? I do not think so.
But there is a property DocumentText .. ? -
HOW CAN I GO BACK AND EDIT A PDF OR FILE .. ON LINE
How can I go back and open file and edit?
[Locking this thread. Please see answer in the duplicate post at HOW CAN I GO BACK AND EDIT A PDF OR FILE .. ON LINE]
-
Can't read back saved raw PCM file
I used Audition 1.5 to do a 48kHz 32bit 2 channel recording and then I saved the file as raw PCM and now I can't read it back into Audition. When I enter the values it was recorded with I get an empty recording (but the right length of it). Anyone have an idea?
jbz2105 wrote:
Have my past few hours just been a total waste?
Yep, pretty much unless you know the exact size and can correctly fill out the required dialogs required to open a Photoshop "raw" file. The "raw" format is not, as you've found out related at ALL to Camera Raw. It's really a holder over format from the early years used back when there weren't some file formats available on some computer systems...and yes, you SHOULD have used TIFF. -
I don't understand apple computer. I am writing a formal piece for english and one page of it gets deleted without me knowing. I save this file. Is there any way I can get it back?
Are you running Mountain Lion (Mac OSX 10.8.x)? If so, and you are using Pages, you should be aware that Apple has implemented a new auto-save feature for its software (and other software that has been written to comply). The very good news is that you can retrieve prior states of your document. The bad news is that the feature makes it easy to modify your work inadvertently by saving your changes without your knowledge. I don't think Apple has it quite right yet. In any event, research OS 10.8 auto-save and see if this might be your problem.
-
How can I read a line of numbers in a file?
Hello everybody,
I have a ziped.file organized in this way:
number1 number 2 number3 name1, name2, name3
number_of points information_about_number_of_point
number4 number4 number4 number4
number4 number4 number4 number4
number4 number4
number5 number5 number5 number5 number5 number5
number5 number5 number5 number5 number5 number5
number5 number5 number6 number6 number6 number6
number6 number6 number6 number6 number6 number6
number6 number6
My problem is to save number1 number 2 number3 and in number_of points in 3 different variable, and number4 number5 and number 6 in 3 different array. How can I do this?
The beginning of my file is:
10000 3.50000 0.00000 Teff, logg, [M/H]
52790 number of wavelength points
1.000000000000000e+01 1.200000000000000e+01 1.400000000000000e+01 1.600000000000000e+01 (end of3th line)
1.800000000000000e+01 2.000000000000000e+01 2.200000000000000e+01 2.400000000000000e+01 (end of 4th line)
The number 52790 is the same for number4, number 5 and number6.
Number4 are organized in 4 columns, number5 and 6 in 6 coloums and the spacing is always the same.
Could you help me please?Thank you and sorry for my terrible english!I'm not sure if I understand completely, but basically you just need to read & parse your files.
Use a lexer/parser tool like JavaCC if it's advanced parsing, or if it's something very simple (like assigning variables) then you can just use the String.split() method to break up your file into tokens. See below for examples of the "simple way"...
If you have any questions, don't hesitate to ask!
I need to save my informazioni in this way:
var1=number1
var2=number2
var3=number3If you wish to access these variables in a Java program, you could split up your file into tokens and then place the values in a map (variable/value pairs). I don't know how efficient this is, but it works nicely. You can change this for arrays, objects, etc.. right now it's only set up for ints.
Here's a very simple example with some code. Below is the text file...
my_var = 123
my_age = 16
x_pos = 2
err=2 //syntax error. must separate tokens with whitespaceTo get your variables from the text file:
Map<String, Integer> map;
//read text file and put it into string
//then use tokenExample to get a Map for that string
map = tokenExample(textfileString); //see below
//and finally assign your variables
int my_var = map.get("my_var");
int my_age = map.get("my_age");
int x_pos = map.get("x_pos");
The tokenExample(String) method
This method breaks the speified string into tokens, and returns a Map with all of the variable name/value pairs in the string.
public static Map<String, Integer> tokenExample(String text) {
//Sets up our tokens.
final String ASSIGN = "=";
final String NUMBER = "\\d+";
final String VARIABLE = "[a-zA-Z]([a-zA-Z]|_|[0-9])*";
//Map for our variable/value pairs
Map<String, Integer> variables = new Hashtable<String, Integer>();
String[] splitText = text.split("\\s+"); //Splits by whitespace
String varName = null;
boolean assigning = false;
//cycles through each token and decides what to do
for(String value : splitText) {
//if it's a variable, we set up it's name for later
if (value.matches(VARIABLE)) {
varName = value;
//if it's an assignment operator, we get ready to assign the variable
else if (value.matches(ASSIGN)) {
assigning = true;
//if it's a number, we put it into our hashmap
else if (value.matches(NUMBER)) {
//if there's no problem with the last two tokens
if (varName!=null & assigning==true) {
variables.put(varName, Integer.parseInt(value));
assigning=false; //reset for next time
varName=null;
//some sort of syntax error
else {
assigning=false;
varName=null;
System.err.println("Syntax error: cannot find token "+value);
}//end loop
return variables;
}See also:
http://mindprod.com/jgloss/regex.html
http://java.sun.com/docs/books/tutorial/extra/regex/
http://www.javaregex.com/tutorial.html -
I can't read in a date from a txt file
Im not sure of the code needed to read in a date from the text file, this is an example of the text file:
1
2
2003
ie,
day
month year
I have to read in this date, this is the set method for the date:
public void setPurchaseDate (int d, int m, int y)
new Date(d,m,y);
And this is the code that I have tried using to readin the date:
PurchaseDate=(Integer.parseInt(line),Integer.parseInt(line),Integer.parseInt(line));now i know its wrong, I just dont know what the code should be!!
Cheersok, I am going to go through it and see what values I can and cant read in, here is the code i am trying to use:
private void addx()
FileReader fin;
int noBooks;
int itemNum;
String title;
String subject;
double costNew;
double costPaid;
String isbn;
double sellingPrice = 0;
int noAuthors;
int day;
int month;
int year;
String seperator = "#";
Book[] book = new Book[9];
try
fin = new FileReader("Books.txt");
BufferedReader buff = new BufferedReader(fin);
String line = buff.readLine();
int count= 0;
//read in Number of books
noBooks=Integer.parseInt(line);
while( line != null)
//Read in item number
itemNum = Integer.parseInt(line);
//Read in title
title = buff.readLine();
//Read in number of authors
noAuthors=Integer.parseInt(line);
//Read each line in as an author until number of authors reached
ArrayList authors = new ArrayList();
for(int i=0; i < noAuthors ; i++)
authors.add(buff.readLine());
//Read in cost new
costNew = Double.parseDouble(line);
//Read in subject
subject = buff.readLine();
//Read in ISBN
isbn = buff.readLine();
//Read in purchase day
day = Integer.parseInt(line);
//Read in purchase month
month=Integer.parseInt (line);
//Read in purchase year
year = Integer.parseInt (line);
//Read in cost paid
costPaid = Double.parseDouble(line);
line = buff.readLine();
//Pass date, month and year values to array
Date purchaseDate =new Date(day,month,year);
//Pass values to constructor
if (line.equals(seperator))
book[count++] = new Book(itemNum, title, authors, subject, purchaseDate,costNew,costPaid,isbn, sellingPrice,noAuthors);
// line = buff.readLine();
System.out.println(book.toString());
catch(Exception ex)
System.out.println(ex.toString());
} -
AL11 can't read DIR_TRANS though it has permissions at file level
I've just completed a system copy of our DEV system and am trying to do transports, but in the QA system AL11 can't read DIR_TRANS even though EVERYONE has FULL_CONTROL over the sapmnt directory. Specifically, I added FULL_CONTROL to SAPSERVICERQ2. Any thoughts?
I figured out what happened. Though the folder \usr\sap had all the correct permissions on it, the share sapmnt and saploc did not. In windows you can specify security for specific shares, and that's what I had to do.
Thanks all for yor input!
-- Jackie -
How can I read a PC created disc of dbx files on a Mac
I have a backup of my old e-mails on disc which I created on a PC (as .dbx files).
I now need to refer to the e-mails, but I no longer have a PC.
All guidance I have read appears to require the use of a PC to convert the .dbx files to .mbx before they can be read on the Mac.
Does anyone know of a way of directly reading the disc on a Mac and accessing these files please.
Many thanks. BigtrevOnly Pages, Preview, Pages for iCloud beta, and Pages v2 or later on IOS 7 can open native Pages v5.2.2 (.pages) documents. Sending a Pages v5.2.2 document to someone without Pages v5.2.2 is futile.
If you are using Gmail or Dropbox, you will need to right-click on that Pages document, and then choose compress from the contextual menu. You can then attach filename.pages.zip, because it appears as a single document, and not a folder.
Pages v5.2.2 has a Share button on the Toolbar. Providing your document is already in iCloud storage, you can Send a Link to iCloud via the following:
The Share toolbar icon also allows you to Send a Copy to Email, Messages, and AirDrop. This will present you with the document export sheet, the same one you get if you chose to File > Export To menu item, as the alternative.
If you are sharing document content with an MS Office user, then the document you want to send them is either a Word .docx, or .doc. If they want just a read-only view of your content, send a PDF, for improved cross-platform exchange. -
How can I read a specific character from a text file?
Hi All!
I would like to read a specific character from a text file, e.g. the 2012th character in a text file with 7034 characters.
How can I do this?
Thanks
Johannesjust use the skip(long) method of the input stream that reads the text file and skip over the desired number of bytes
-
I get a blank box. When I type and hit enter (or send), I still have a blank box. People can type back to me, but I get nothing. I have no problems logging on to iChat from either my husband's Mac or my iPad, only having problems on this Mac. Using iChat 4.0.9. Mac OS.X 10.5.8. It's been this way for about a year now, and the Mac store can't seem to be able to solve it.
Does anyone else have this problem?
I've tried downloading AOL Instant Messenger directly (that's the screen name I am using) and it doesn't work. Do I need to uninstall iChat and reload it? How would I get it once I delete it?
I'll take any suggestions.
Thanks much
Sheepish72Hi,
If your AIM valid Screen Name happens to be an Apple ID then it is likely that only if it is one Ending in @mac.com will it work in Leopard and iChat 4.
This is because when Apple went to iCloud they also changed the way iChat 6 and later Mesages logs in.
Both these version also contact Apple and this then allows the AIM Servers to "read" the password.
This Dual Login does not happing in earlier versions which means the Apple Servers are not contacted and then the AIM servers are blocked from checking the password.
It also means you cannot use an @me.com or @icloud.com ending name in the AIM for Mac App, the AIM Settings login page or login to AIM express on any Browser on any device.
For the Text not showing try this test change first.
Open iChat.
Go to the View Menu
Select the Style option and change it from Balloons to anything else.
Actually Quit iChat and restart the app.
Does iChat see the text when not using Balloons ?
If so you need to reinstall the whole App. The Balloons Style is actually run from a Plugin but you can only get it by reinstalling the whole app.
See the Users Tips tab at the top of the Discussions list.
EDIT Direct link
Basically tick in your Original Install DIsk.
Select the Option Installs foldder and launch the OptionalInstals.mpkg
Pick out iChat only and Install
Download and Install (over what you have) the COMBO Installer for OS X 10.5.8 (THIS is needed to update iChat to the corerect version of OS X 10.5.8)
9:58 PM Monday; August 19, 2013
 iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.4)
 G4/1GhzDual MDD (Leopard 10.5.8)
 MacBookPro 2Gb (Snow Leopard 10.6.8)
 Mac OS X (10.6.8),
 Couple of iPhones and an iPad
"Limit the Logs to the Bits above Binary Images."  No, Seriously
Message was edited by: Ralph Johns (UK) -
How can I read backed up Contacts on my computer? 9300 3G
Hi
Can anyone tell me how I can read the list of Contacts which I have backed up on my computer using the Blackberry desktop software. I expect the contacts are under Organiser, but I cannot find a way to check them, either with, or without my Blackberry plugged in.
Many thanksTouchCopy is frequently recommended for archiving SMSs. Much easier to view them through software like that than by messing around in the backup files (not for the faint of heart).
-
Can not read back error description in VB
I am using: flex_get_error_description Lib "FlexMotion32.dll" (ByVal descriptionType%, ByVal errorCode&, ByVal commandID%, ByVal resourceID%, charArray%, sizeOfArray&) As Long. The definition for "charArray" is short, while VB does not provide such type. (In your old version, it is string type.). As such, how could I retrieve the error description?
This issue will be fixed in the next release of the NI-Motion driver. In the meantime, you basically need to change charArray% to ByVal charArray As String. Therefore, the correct prototype is as follows:
flex_get_error_description Lib "FlexMotion32.dll" (ByVal descriptionType%, ByVal errorCode&, ByVal commandID%, ByVal resourceID%, ByVal charArray As String, sizeOfArray&) As Long
I hope this helps!
Best regards,
Dawna P.
Applications Engineer
National Instruments -
How can i read all the lines from a text file in specific places and use the data ?
string[] lines = File.ReadAllLines(@"c:\wmiclasses\wmiclasses1.txt");
for (int i = 0; i < lines.Length; i++)
if (lines[i].StartsWith("ComboBox"))
And this is how the text file content look like:
ComboBox Name cmbxOption
Classes Win32_1394Controller
Classes Win32_1394ControllerDevice
ComboBox Name cmbxStorage
Classes Win32_LogicalFileSecuritySetting
Classes Win32_TapeDrive
What i need to do is some things:
1. Each time the line start with ComboBox then to get only the ComboBox name from the line for example cmbxOption.
Since i have already this ComboBoxes in my form1 designer i need to identify where the cmbxOption start and end and when the next ComboBox start cmbxStorage.
2. To get all the lines of the current ComboBox for example this lines belong to cmbxOption:
Classes Win32_1394Controller
Classes Win32_1394ControllerDevice
3. To create from each line a Key and Value for example from the line:
Classes Win32_1394Controller
Then the key will be Win32_1394Controller and the value will be only 1394Controller
Then the second line key Win32_1394ControllerDevice and value only 1394ControllerDevice
4. To add to the correct belonging ComboBox only the value 1394Controller.
5. To make that when i select in the ComboBox for example in cmbxOption the item 1394Controller it will act like i selected Win32_1394Controller.
For example in this event:
private void cmbxOption_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxOption.SelectedItem.ToString(), ref lstDisplayHardware, chkHardware.Checked);
In need that the SelectedItem will be Win32_1394Controller but the user will see in the cmbxOption only 1394Controller without the Win32_
This is the start of the method InsertInfo
private void InsertInfo(string Key, ref ListView lst, bool DontInsertNull)
That's why i need that the Key will be Win32_1394Controller but i want that the user will see in the ComboBox only 1394Controller without the Win32_Hello,
Here is a running start on getting specific lines in the case lines starting with ComboBox. I took your data and placed it into a text file named TextFile1.txt in the bin\debug folder. Code below was done in
a console app.
using System;
using System.IO;
using System.Linq;
namespace ConsoleApplication1
internal class Program
private static void Main(string[] args)
var result =
from T in File.ReadAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TextFile1.txt"))
.Select((line, index) => new { Line = line, Index = index })
.Where((s) => s.Line.StartsWith("ComboBox"))
select T
).ToList();
if (result.Count > 0)
foreach (var item in result)
Console.WriteLine("Line: {0} Data: {1}", item.Index, item.Line);
Console.ReadLine();
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.
Maybe you are looking for
-
How can I sync only checked items and not the whole album?
I only want say three songs out of an album but it syncs the whole thing. How do I change that?
-
DisAssembling a PDF based on a text string on the page
I am looking for some guidance (and an example if at all possible) on how to disassemble a multipage pdf based on text like "Tax ID" contained on certain pages. The result is that I am looking to break up a document that contains 1000 pages, 100 of t
-
Hi, Can you please tell me in which table the email id field will be existing. Regards, Chandu.
-
High, I have made work the BasicEmailer script on Bridge CS5 but: I had to modify the script to get a prompt at startup in a way to input a new recipient email address each time: this.recipient = prompt("Destinataire", 100); How can I do this while
-
the error reading is: lightroom-opening catalogue. Temporary import data.d.h.Ircat. This message appears every time I try to access lightroom. It tells me that a shortcut has stopped working.