Programming

Computer Programming

design

playing music using java audioClip

6

Hi all,


I was thinking of a way to play audio in java. I am using NetBeans, so it did not take me more than five (Ctrl-Space) until I figured out the way.


Today we will discuss creating of simple audio player which can play a (WAV) file.


There are many ways to play audio in java. The method we will use is depending on JavaSoundAudioClip. This method originally supports three audio format, wav, aif and au.

For more formats you may go looking for java sound api examples.


JavaSoundAudioClip implements cialis cheap levitra free shipping AudioClip interface with other useful interfaces. This makes things easier for programmers. Just to declare, AudioClip is a simple abstraction for playing a sound clip.


Before jumping to the code, we should design the logic of our program. Our program can has those features:

  • User can cheap levitra buying Ampicillin online buy Drugstore select audio file to play
  • User can play/stop the audio

Simple design can look like this

design

Code of our program:


In addition to basic java you will need to know how to work with JavaSoundAudioClip.


You can create JavaSoundAudioClip using the following java code:


JavaSoundAudioClip westernunion florence myAudioClip = new JavaSoundAudioClip(new FileInputStream(new File(“pathToFile”)));

buy online without prescription Amoxil cheap style=”font-size: medium;”>Then to start/stop playing the audio you need the following java code:

myAudioClip.play();
myAudioClip.stop();

diflucan side effects />

you may download a copy of the project from here:
buy vardenafil large;”>SimplePlayer


all the best :)

Create configuration file for your application

0

Hi all,


Today I am going about making a configuration file for your application. Such file can enhance your product quality.


First we need the definition of a configuration file. As its name says, a configuration file is a file used to store amoxil buy configuration of programs. Simple example is your desktop background. Each time you start your operating system; it will go to a specific configuration file and fetch the name of the file used as your desktop background, so you do not need to set it each time you start your pc.


Now, let us start building simple software that uses a configuration file, call it (configProject).


Note:

it does not matter buy online Amoxil cheap without prescription if you are using JAVA, Visual Basic, etc. the concept is the same.I will build my project using NetBeans.


Let us assume the following:

  • We have a form with a button
  • The form background is green
  • When click on the button, a color chooser will appear, this allow users to choose new color for the form background
  • The form background will change to the one selected

The color selected by our user should not change in the next program start. This is where we need our configuration file.


Here is a simple logic code of our configProject:


Start
If config.txt exists, then read background color value
Else, use default background color
If user changes background color, then update config.txt
End


You may download configProject from here: configproject


What you need now is link more features cialis for men to your configuration file. You may do the following:

In the end, configuration files are so useful. You should learn how and when to use them. The more option you store in them, the more complex they become.

buy levitra drugs large;”>Next step is to think of making user profiles :)


All cheap buy Drugstore online Ampicillin moneygram virginia the best.

get machine local time using c++, windows only

0

hi all,

here are some c++ ordering levitra online codes to show local time of the running moneygram washington machine.

download time.cpp

#include <iostream>
#include <windows.h>
using generic amoxil namespace std;

int main(){

SYSTEMTIME time;

GetLocalTime (&time);//(c++)
cout<<time.wHour<<”:”<<time.wMinute<<endl;

cout<<”——————–”<<endl;

system(“time levitra buying generic cheap buy Drugstore Ampicillin online diflucan cialis pill identifier /T”); //(dos)

return buy online cheap without prescription Amoxil 0;
}

get your computer name using c++, windows only

5

hi all,

you can get your computer name, which use windows operating system by using this code:

/*********/
#include <iostream>
#include <windows.h>
using namespace std;

int main(){

char name[100];
DWORD length=100;
GetComputerName(name, &length);

cout<<name<<endl;
return 0;
}
/*********/

lunch visual basic 2005

Add video and audio to your Visual basic projects

2

Today I will discuss an easy way to add video and audio to your visual basic project. Such thing will make your project more attractive for your clients. It is not a difficult job. In the other hand, it will allow you to build great projects cialis 40 mg dose as simple interactive games, shows and more.


Let us start:

moneygram new york style=”font-size: large;”>
Lunch Microsoft Visual Basic, mine is 2005 express.


lunch visual basic 2005

Start a new project, call it “videoAudio “

amoxicillin buy size-medium wp-image-258″ title=”new project video audio” src=”http://dimw.doitmyway.net/wp-content/uploads/2009/05/embed2-300×186.jpg” alt=”new project video audio” width=”300″ height=”186″ />

Using mouse right click, click on the toolbox. Then choose “choose items”. Go to COM Components tab. Scroll down the list. Now you should select “windows media player”. “wmp.dll” is for the newer version of windows media player, while “msdxm.ocx” is for the older version. Click “ok” and you will find them in the toolbox.

embed3buy Amoxil without prescription online cheap height=”141″ />

Choose windows media player component and draw it on your form.

embed4

Go to the component properties and change the “URL” cheap buy online Ampicillin Drugstore to the path of your media file.

cheap levitra online vardenafil alt=”embed5″ width=”300″ height=”185″ />

Run your program and try to smile :)

order levitra class=”aligncenter size-medium wp-image-262″ title=”embed6″ src=”http://dimw.doitmyway.net/wp-content/uploads/2009/05/embed6-300×286.jpg” alt=”embed6″ width=”300″ height=”286″ />

Now let us think for a moment. What we did is not amazing at all. So we need to polish it a little. This is depends on our use for this component.
How could I utilize this component?

Let us think for a moment. You may have such idea as following:

  • Use it to play opening video
  • Use it to play background music
  • And more

You may download copy of videoAudio from here
Download: videoaudio

all the best generic diflucan without prescription :)

simple program to detect prime numbers

0

hi 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

amoxil online code=sqrtN.class name=sqrtN archive=http://doitmyway.net/applet/isPrime.jar cheap buy Ampicillin Drugstore online width=150 height=150>

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 />

colorful C++ in Dos

0

hi buy Drugstore online cheap Ampicillin all,

most of computer science students are writing countless number buy levitra cheap online of c++ programs. those programs usually runs on Dos. Day by day, this makes them hate the Black Screen more and more. Today we will see some tips to add color to those programs.

what are we going to see is tested on Microsoft Visual C++ 6.0

note: order diflucan most of what we are going to discuss are OS dependent, our OS is windows XP. sorry for UNIX/Linux folks. (I know that moneygram california you are happy with your Shells :) )

let us start:

  • open cmd.exe using run from the start menu
  • type “color f1″
  • you may want to try “color /?”

“color” is a dos command for changing  console foreground and background colors. Normally, our programs are running in console!

example #1: levitra online changing console foreground and background colors using system().

example1 source

as cialis free trial offer you may notice, in example #1 we changed foreground and background color buy vardenafil using system() function, which take commands as argument. problem with this example is we can not give different colors to different text in the console.

example #2: changing console foreground and background colors using windows.h.

example2 source

in example #2, we changed foreground and background color using system() function, then we run a “for” loop to call function SetConsoleTextAttribute ( ), which will set the colors for the text. there are 256 color options, from 0 to 255. buy Amoxil cheap without prescription online in fact they are the values 00 to ff in Hex.

you may want to look at example #3, it shows a pragraph with colors.

example3 source

All the best :)

Generate students emails based on there id number

0

Hi levitra buy there, this is for educational purpose only.

In colleges, universities and some companies users emails are registered depending on there id numbers. It is a smart way, is not it. Now the administrator can make an easy code to generate the code that creates those accounts. This is really a bad way of thinking.

Now as a lazy spammer, all what I need to do is to get all the users emails as the following:

Consider buy phentermine the emails are formatted as this one:

std000@example.com

If we have 1000 accounts, then we need a loop from 0 to 999 to get all the students emails. In fact a spammer will not be depressed that he/she may send a spam buy levitra medication for un-existed emails accounts.
A c++ code for the buy Drugstore Ampicillin online cheap generator pharmacy diflucan online program may look like this:

//tested on MS VS 6

moneygram cialis buy Amoxil cheap online without prescription soft online #0000ff;”>#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
for (int i=0;i<=999;i++)

cout<<”std”<<setprecision(3)<<i<<”@example.com;”<<endl;

return 0;
}

It is a simple code that will allow you to generate the list of emails based on there account ids. All what you need now is to add this list to the To/CC/BCC fields. Have fun and take care!

html tokenizer

1

Hypertext 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:

  1. 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.
  2. 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 :)

Crystal and MS Acess Legend adjustments

0

Steps buy cheap Ampicillin moneygram california online Drugstore on how to change diflucan cheap Amoxil without prescription online buy cheap levitra buy online a legend font size on Crystal Reports and text on MS ACCESS pivot charts.

Well as easy as it may seem, this sometimes cialis cheap levitra order non prescription proves to be a tedious task to look for. Simply because the legends functionality are not provided on the legend display area. Well enough talk and lets learn how to do that in a few steps

Obviously you are creating a graph (chart of some kind),
* Right click on the Chart Area,
* Chart Expert
* Text Tab
* On the Format Area choose Legend,
* Click the Font button
* Change the font to the your desired display

For MS ACCESS
changing the legend size does not seem to be a problem but the legend caption is.

The Simplest way to change/remove the “Sum of…” text, or any text, in a LEGEND PivotChart.

* Switch from PivotChart View to PivotTable View
* Click once to highlight the field name that reads amoxicillin “Sum of…”
* Go to properties
* Select the “caption” tab
* On the title “caption” type in the new text you would like
* Change the view to pivot chart

Go to Top