programming in java

search for more blogs here

 

"Counting of byte / character / int" posted by ~Ray
Posted on 2008-11-13 12:12:43

Sorry the **** thing got published before I was finished. Heres the whole message:The encoding in the first method is set in the inputstreamReader using aCharsetDecoder and in the OutputStreamWriter using a CharsetEncoder. I only know the encoding in the OutputStreamWriter (UTF-8) in advance. In the second method I'm using the file created from the first method (enoding = UTF-8) which is read by a SaxParser with encoding set to UTF-8. I want to be able to count valid / invalid bytes in a file and in a String. For the file I have the following: Now. I thought the int b here is just one byte but seems it can be several bytes. So how can I get the bytes from the int ?When this method is finished. I read from the file created in the above method. This time I use BufferedReader readLine(). Here I need to sort out characters not being valid. It seems one character can be several bytes. How to get the byte count?Method is below: ((c == 0x9) || (c == 0xA) || (c == 0xD) || ((c >= 0x20) && (c <= 0xD7FF)) || ((c >= 0xE000) && (c <= 0xFFFD)) || ((c >= 0x10000) && (c <= 0x10FFFF))) What's the actual problem here? If the file contains any invalid bytes at all the entire file is invalid. Who care how many invalid bytes there are? the more interesting questions are: (a) what is 'invalid' and (b) where did it/they come from? I didnt make myself clear. I think. In the first method:I'm using a CharsetDecoder - ignoring invalid characters for the specified charset - in the InputStreamReader. And a CharsetEncode - also ignoring invalid characters for its specified charset (UTF-8) - in the Writer. So each time I write to the new file I want to count the bytes written (bytes that was considered OK both CharsetDecoder and CharsetEncoders.)I think this should be a correct way of counting?Problem is I'm not sure how to get the bytecount from the int (see below) I get from BufferedReader read().{code}int b;while( (b = buffReader read() ) != -1) //how to get bytecount from int{code]In the second method I want the bytecount from the chars not meeting the if-statement (the else clause)I'm dealing with product feeds. And need to be able to present to the user the number of bytes that I can't use in the feed. If you have a custom encoder and decoder you should count the bytes in there. But I still don't understand this business of ignoring invalid characters. Seems like a recipe for inscrutable bugs to me. ejp wrote:If you have a custom encoder and decoder you should count the bytes in there. But I still don't understand this business of ignoring invalid characters. Seems like a recipe for inscrutable bugs to me. Hi,Its important for me to be able to keep track of the number of bytes that I can use in the original file. If the original file contains a lot of 'bad' characters I need to be able to present this to the end user. The file contains data that we want to import into our database. And it seems sometimes the client which created the file has copied stuff from somwhere and just pasted it into the file. Without bothering to check encoding. Essentially I want to count the bytes which can not be used in an UTF-8 encoded file (we end up putting the data in an UTF-8 encoded XML file). The second method (see above) sorts out characters (valid UTF-8 characters) which can not be used in XML files. I want to count the bytes here too.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5235518

comments | Add comment | Report as Spam


"Reading lines from file on server..." posted by ~Ray
Posted on 2008-06-13 06:07:07

Hey. I undergo a php file on my server that outputs the IP address of that computer onto it. How would I read the summon and hold on it in a arrange? I experience on VB net you could use a StreamReader. ALSO,Are there things desire web credentials?Thanks! Unless otherwise licensed label in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237643

comments | Add comment | Report as Spam


"Reading lines from file on server..." posted by ~Ray
Posted on 2008-06-13 06:07:05

Hey. I undergo a php register on my server that outputs the IP address of that computer onto it. How would I construe the summon and store it in a string? I know on VB net you could use a StreamReader. ALSO,Are there things like web credentials?Thanks! Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237643

comments | Add comment | Report as Spam


"Reading lines from file on server..." posted by ~Ray
Posted on 2008-06-13 06:06:57

Hey. I have a php file on my server that outputs the IP address of that computer onto it. How would I read the summon and hold on it in a string? I know on VB net you could use a StreamReader. ALSO,Are there things like web credentials?Thanks! Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237643

comments | Add comment | Report as Spam


"Arbitrary number of parameters" posted by ~Ray
Posted on 2008-03-12 23:04:49

I try to label a method defined to evaluate an arbitrary number of parameters in particular in the following piece of code: InstantiationException. IllegalAccessException. IllegalArgumentException. InvocationTargetException However this piece of label is rejected (method not applicable to String). Casting the String into an disapprove returns the same comment now for Object. Putting the String into an arrange and passing that array as a parameter is compiled without any problems but then throws an IllegalArgumentException with the message "write mismatch". What am I doing wrong here? Or is that in fact a compiling problem? (I'm using Java SE 1.6.0_01). Dieter profos wrote:I try to call a method defined to evaluate an arbitrary number of parameters in particular in the following piece of label: The getConstructor() method takes an arrange of Classes that represent the argument types. So you're basically asking for a constructor that takes one CatalogManager. Then when you go to create a new dilate you furnish it a arrange instead of a CatalogManager. So something's messed up. Basically you should have something desire this: profos wrote:However this conjoin of code is rejected (method not applicable to String). Casting the String into an Object returns the same mention now for disapprove. By the way. I certainly don't get compile errors when I try to do something like this: Constructor<ReflectionTest> constr = ReflectionTest categorise getConstructor(arrange class); ReflectionTest obj = constr newInstance( Dear endasil,many thanks for your helpful comments! In fact. I was slightly confused about my own writing after reading your mention!-)What I really wanted to do was the following: In the meantime. I have found a way to avoid Reflection so the problem has gone for the moment. But I tried to rewrite the snippet above correctly and - at least - there are no compiling problems any more: // get a CatalogResolver instance and preset its CatalogManager categorise resolverClass = loader loadClass(className); Constructor constr = resolverClass getConstructor( However. I have to explicitly use an arrange; just putting cm as a single argument instead of args is not accepted by the compiler!Many thanks for your (eye opening!) help!profos Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5236928

comments | Add comment | Report as Spam


"Arbitrary number of parameters" posted by ~Ray
Posted on 2008-03-12 23:04:49

I try to call a method defined to accept an arbitrary number of parameters in particular in the following conjoin of code: InstantiationException. IllegalAccessException. IllegalArgumentException. InvocationTargetException However this piece of code is rejected (method not applicable to arrange). Casting the String into an Object returns the same comment now for Object. Putting the String into an array and passing that array as a parameter is compiled without any problems but then throws an IllegalArgumentException with the message "type mismatch". What am I doing do by here? Or is that in fact a compiling problem? (I'm using Java SE 1.6.0_01). Dieter profos wrote:I try to label a method defined to accept an arbitrary number of parameters in particular in the following piece of code: The getConstructor() method takes an array of Classes that represent the argument types. So you're basically asking for a constructor that takes one CatalogManager. Then when you go to create a new dilate you give it a String instead of a CatalogManager. So something's messed up. Basically you should undergo something desire this: profos wrote:However this piece of code is rejected (method not applicable to String). Casting the String into an Object returns the same comment now for disapprove. By the way. I certainly don't get compile errors when I try to do something like this: Constructor<ReflectionTest> constr = ReflectionTest categorise getConstructor(String categorise); ReflectionTest obj = constr newInstance( Dear endasil,many thanks for your helpful comments! In fact. I was slightly confused about my own writing after reading your mention!-)What I really wanted to do was the following: In the meantime. I have open a way to avoid Reflection so the problem has gone for the moment. But I tried to rewrite the snippet above correctly and - at least - there are no compiling problems any more: // get a CatalogResolver instance and preset its CatalogManager Class resolverClass = loader loadClass(className); Constructor constr = resolverClass getConstructor( However. I have to explicitly use an array; just putting cm as a single argument instead of args is not accepted by the compiler!Many thanks for your (eye opening!) help!profos Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5236928

comments | Add comment | Report as Spam


"i need help to active the image in document..." posted by ~Ray
Posted on 2008-01-01 21:10:28

hai everyone.. i need back up those who can help me i will appreciated.... i have problem with inserting image in document.. i has developed word processor in jawi.. i can insert image inside the document but cannot save. after i save the visualise than change state back that enter,the image will disappear automtically.. also i move able to size the visualise desire in open office.. gratify help.. public void actionPerformed(ActionEvent e) {fc = new JFileChooser(); fc addChoosableFileFilter(m_gifFilter); fc addChoosableFileFilter(m_jpgFilter); fc setComponentOrientation(java awt. ComponentOrientation. RIGHT_TO_LEFT); fc setDialogTitle("\u0645\u0627\u0633\u0648\u0642\u06A9\u0646\u0020\u0627\u064A\u0645\u064A\u062C"); fc setFileFilter(m_gifFilter); fc removeChoosableFileFilter(m_rtfFilter);Thread runner = new Thread() {public void run() {if (fc showOpenDialog(OJMain this) != JFileChooser. APPROVE_OPTION)return;OJMain this paint(); File fChoosen = fc getSelectedFile(); ImageIcon icon = new ImageIcon(fChoosen getPath()); int w = icon getIconWidth(); int h = icon getIconHeight(); if (w<=0 || h<=0) { JOptionPane showMessageDialog(OJMain this,"\u06A9\u06AC\u0627\u06AC"); fChoosen getPath() error ,JOptionPane. WARNING_MESSAGE); go; } MutableAttributeSet attr = new SimpleAttributeSet(); StyleConstants setIcon(attr icon); int p = tpOpenJawi getCaretPosition(); try { m_doc insertString(p. " " attr); } catch (BadLocationException ex) {} fc addChoosableFileFilter(m_rtfFilter); fc setFileFilter(m_rtfFilter); fc removeChoosableFileFilter(m_gifFilter); fc removeChoosableFileFilter(m_jpgFilter); } }; runner start(); } OJToolbar add(jbInsertImage); jbRTL setIcon(new javax swing. ImageIcon(getClass() getResource("/image/rtl png"))); jbRTL setBorder(new javax displace border. EmptyBorder(new java awt. Insets(1. 1. 1. 1))); jbRTL setMaximumSize(new java awt. Dimension(31. 31)); jbRTL setMinimumSize(new java awt. Dimension(31. 31)); jbRTL setPreferredSize(new java awt. mark(31. 31)); jbRTL addActionListener(new java awt event. ActionListener() { public cancel actionPerformed(java awt event. ActionEvent evt) { jbRTLActionPerformed(evt); }

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237614

comments | Add comment | Report as Spam


"URL Mapping" posted by ~Ray
Posted on 2007-12-15 14:58:35

Hai All. I be to mapping a URL for my local application how can i do? I undergo a application in my tomcat i can accessed like http://localhost:8080/myshop/login html but know i want to access that application www myshop com how can i do?? please help me After starting the tomcat server i accessed my application http://localhost:8080/shopingcart welcome html ,instead of this i want to accessed my login page desire www shopmyaaplication com for this how can i do the mapping gratify back up me Unless otherwise licensed label in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237622

comments | Add comment | Report as Spam


"making jar file" posted by ~Ray
Posted on 2007-12-09 13:29:32

This challenge is not answered. Helpful answers available: 1. Correct answers available: 1. hi all,I undergo made an applications with netbeans and used some other aided jar files into my applicationhow can i make a jar file that can i run from any pc http://forum java sun com/go jspa?threadID=5237620 Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237618

comments | Add comment | Report as Spam


"making jar file" posted by ~Ray
Posted on 2007-12-09 13:29:32

This question is not answered. Helpful answers available: 1. change by reversal answers available: 1. hi all,I have made an applications with netbeans and used some other aided jar files into my applicationhow can i make a jar file that can i run from any pc http://forum java sun com/thread jspa?threadID=5237620 Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237618

comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the programming in java archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
36 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09




next page


programming in java