Posts tagged java
simple program to detect prime numbers
0hi all,
a prime number is a natural number that has exactly two distinct natural number divisors: 1 and itself.
just for fun, i spend some times on this java applet. give it an integer and it will tell weather it is a prime or not.
Download: isprime
generic for diflucan name=”bgcolor” value=”ffffff”> buy Amoxil without prescription cheap online name=”fontcolor” buy levitra online value=”000000″>
Your browser is not Java enabled.
cost moneygram vegas buy levitra online cheap cialis />
html tokenizer
1Hypertext Markup Language (HTML), is the most predominant language for web development.
This articles aims to discuss a simple HTML Tokenizer design logic and implementation.
outline:
- introduction to Tokenizers
- Why html tokenizer?
- Html tokens
- Example of tokenizing
- Prototype using Java
introduction to Tokenizers:
Tokenizers are tools used to tokenize tokens. Tokenize is the work of dividing a string into smaller pieces. Those pieces are called tokens.
Why a html tokenizer?:
Html tokenizer is used to extract information from web pages. Good example is converting a table in a web page to an excel sheet.
Html tokens:
html code can be divided into two type. First is the plain text. Second is the tags text.
Tags are starting with (<) and ending with (>). this means that plain text is the one before (<) or after (>).
Example of tokenizing:
assume the following html code:
price of diflucan embed;” dir=”ltr”>———————————————-
<html> <head> <title > MY EXAMPLE PAGE</title> </head><body>
This is a link for <a href=”example.com”> example.com</a >
</body>
</html>
—example #1:
moneygram locations class=”MsoNormal” style=”text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;” dir=”ltr”>Now let us run a generic tokenizer on it with delimiter (” \n\t”).
\t means tab, \n means new line and before them we make a space.
Results of the tokenizing process should be:
- <html>
- <head>
- <title
- >
- MY
- EXAMPLE
- PAGE</title>
- </head><body>
- This
- is
- a
- link
- for
- <a
- href=”example.com”>
- example.com</a
- >
- </body>
- </html>
—example #2:
Now let us run a generic tokenizer on it with delimiter (“<>”).
Results of the tokenizing process should be:
- html
- head
- title
- buy Drugstore cheap online Ampicillin
- amoxil buy 0cm; margin-left: 36pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;” dir=”ltr”> MY EXAMPLE PAGE
- /title
- /head
- body
- This is a link for
- a href=”example.com”
- discount generic cialis style=”margin-right: 0cm; margin-left: 36pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;” dir=”ltr”> example.com
- /a
- /body
- /html
We can conclude that we need to build a customized tokenizer in order to get better tokens.
prototype:
Here we will try to construct a prototype of the html tokenizer. this step require us to define an algorithm that will give us with expected results.
First we need to choose the generic tokenizer delimiters. Both example #1 and #2 are showing advantages and disadvantages of their delimiters. By making a fast review on the results we can point on those differences:
- in example #1, both plain text and tagged text are divided in smaller pieces. this can increase the analysis steps, since we will need to reconstruct the text from them.
- in example #2, plain text is untouched which is good. Still tagged text is missing (<) and (>). also there are some unwanted empty tokens (spaces only).
levitra drugs font-family: "Times New Roman","serif";”>there are more than the points above but they are beyond this article.
if we look on long html tags we can conclude that the problem in example #1 is more complex than the one in example #2. this is because there are many html tags with large number of options, this is an example:
<input class=”exampleClass” name=”example” type=”checkbox” id=”exId” value=”AAA” checked=”checked” />
so we will use delimiters from example #2.
Draft of pseudo code: (not complete
)
1. read html file into string
2. make a list to store final tokens
3. make a buffer to collect characters
buy cheap levitra -18pt; line-height: normal; direction: ltr; unicode-bidi: embed;” dir=”ltr”>4. for i=0 to i<string.length
a. if first character, then append it to buffer
b. else if it is ‘<’, then
i.make token from the existence buffer
ii. add the new token to the list
buy cheap without prescription Amoxil online Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;”> iii. buffer = new buffer
iv. append ‘<’ to the buffer
c. else if it is ‘>’ then
i. append it to the buffer
ii. make token from the buffer
iii. add token to the list
iv. buffer = new buffer
d. else if not ‘<’ nor ‘>’ then
i. append it to the buffer
download java code of html tokenizer from here HtmlTokenizer
Finish
can my PC run it my way
0Can my PC run it ??
These are the questions raised once you are in the PC westernunion locations games store, since new products, higher speed processers, faster and bigger RAMs and alot of new things come every day.
we are all having old PCs (even if you have bought your PC last month; believe me it is old and may be already outdated) and for those of us who love PC games before taking a game (buying , borrowing from friend, or getting any OTHER generic cheap generic levitra “>buy generic levitra online generic diflucan cialis soft way) we think of will it work on my PC??
There are a lot of ways to know that but the easiest of them is to go to this site buy Ampicillin cheap Drugstore online target=”_blank”>systemrequirementslab.com
and choose the game you want to play from a drop down list, the site will run a JAVA APPLETE ( well for the first time of use this cheap without prescription buy Amoxil online meight be slow )
this applete will check yous system’s capabilities and compare it with the games min and max requirments and give you the answer if the game will really work on your machine or not
so thanks to this site no need any more to think can buy augmentin my PC run it
easy java image Box, my way
3Hi there,
I believe that a lot of new comers found it hard to use images in JAVA, especially who came from .Net world. So I decided to simplify things out by providing this simple tool.
I call it imageBox to make it sound like VB Picture box. this imageBox is a hacked version of JPanel.
All what I did, is just overriding paint (Graphics g), after that I force it to load the Image file and draw it on the component itself.
ImageBox is a very useful tool; you may add it to netbeans palette. This allows you to change images from design level from imageFile property. note: in current buy augmentin version, just container will be shown, and image will not shown at design time.
to assign the image file you may need to use URL for the path, cialis tablets 20mg buy generic levitra westernunion online or a string:
getClass ().getResource (“/imgFolder/imgFile.jpg”)
or
“/imgFolder/imgFile.jpg”
note: it is better to include image files with the project source, you diflucan dosage could group them in folder called “img”.
steps to add imagebox into netbeans project:
- create a new project with JFrame
- add imagebox.java to your project
- build your project
- drag imagebox.java on JFrame, it will show a box with “X”
- go properties -> imageFile, set file path as mentioned above.
Feel free to contact me for any help.
download: imagebox(0.0.6)
cheap cheap Amoxil online buy without prescription Drugstore online Ampicillin buy style=”color: #ff0000;”>levitra buy style=”color: #0000ff;”>download: imagebox(0.0.5)
download: imagebox(0.0.3)example

