radhakrishna.p 29 Posting Whiz in Training

first let me get clarity on your project type

i forgot to ask you previously

is your project on web based or swing based?

i am getting little bit confusion on your requirement which is posted above ( ru talking about Jlabel or label which is using in Html)

thats the reason i am asking you

please breifly explain your problem clearly so that we are here to help you

radhakrishna.p 29 Posting Whiz in Training

i think we can't acieve this requirement without javascript support.

what i mean is we cant assign the html button events to iterate arraylist which is placed inside jsp scriptlet.

so you have to wait for better idea from anyone of the experts over here

radhakrishna.p 29 Posting Whiz in Training

steps for setting image for Label:

  1. create a image file as follows

    File image = new File("D:\mysample.jpg");

  2. i think you know how to read image data from database.once you get the resultset object do as follows i mean store image column data into above file

    // after getting resultset 
    
          FileOutputStream fos = new FileOutputStream(image);
    
          byte[] buffer = new byte[1];
           is = resultSet.getBinaryStream("img_clumn_no");
          while (is.read(buffer) > 0) {
            fos.write(buffer);
          }
          fos.close()
          // then close the connection 
    

3.then set the above image file path to label as follows

   // set the above image path to label as follows 

    label.setIcon(new ImageIcon(image.getAbsolutePath()));

     //or you can put directly 

    your_label.setIcon(new ImageIcon("D:\\mysample.jpg"));

check it once it gives the proper output to your problem or not

happy coding

radhakrishna.p 29 Posting Whiz in Training

can you please explain your actual requirement?

so that we try to give a solution to your problem.

radhakrishna.p 29 Posting Whiz in Training

please specify the problem clearly

i could find the variable name 'title' at php file,ajax and html too

where you are getting from?

at line 7 how you get the value of title? that might be the problem i think

happy coding

radhakrishna.p 29 Posting Whiz in Training

have you gone thru this url?

http://www.javascriptkit.com/script/cut142.shtml

you got the data dynamically then the above URL is so helpful please check it once

let me know if you have any doubts

happy coding

radhakrishna.p 29 Posting Whiz in Training

i think 13
i dont know in which aspect you are asking

but its 13

radhakrishna.p 29 Posting Whiz in Training
radhakrishna.p 29 Posting Whiz in Training

in one of the previous post

you said you are using type-4 driver

but in the coding part you got the connection object like as follows

Connection con = DriverManager.getConnection("jdbc:driver:OracleDriver:ff","SYSTEM","monika");

but if you use type_4 driver the connection string should be like as follows

Connection con = DriverManager.getConnection("jdbc:driver:thin","SYSTEM","monika");

no need of OracleDriver:ff simply remove that

and then also you got the ClassNotFoundException

for this you need to set (ojdbc.jar file and ojdbc14.jar ) files to your current classpath

i told you that thing also please hava alook at previous post so that you get the proper reason for the problem you have

happy coding

radhakrishna.p 29 Posting Whiz in Training

hai adikimicky

there is no mistakes in the program except some logical mistakes which is unknown to you

i think you are in initial stages of learning concept. no problem

please change the while loop (in the previous post) as follows

while(rs2.next())
{
String lname=rs2.getString("name");
System.out.println(lname); 
}

so that program will run as you expects

what you have done is you fixed the while loop for running 3 times only thats the reason you got 3 names in the output

all remaining things are good

check it once and let me know the status

happy coding

radhakrishna.p 29 Posting Whiz in Training

AJAX programing is best solution for this kind of requirements

go thru the following link it may helps you

http://www.w3schools.com/php/php_ajax_database.asp

http://www.w3schools.com/ajax/ajax_database.asp

let me know if you have any doubts in my clarification

radhakrishna.p 29 Posting Whiz in Training

this problem comes mainly with if the rt.jar file could not be found by the application

please let me know how r u running this application?

(at command prompt or using any IDE like netbeans ,eclipse)

r u running your application windows or in unix or linux? (pls specify this also )

if you are running at Command Prompt (in windows):

please check whether the java sdk instalation path (JAVA_HOME) path has been set properly or not

guidelines :

go to mycomputer (right click on it )
-> then go to properties
-> then select 'Advanced System Settings'
-> select "Advanced" tab
-> then select "environment Variables" button
then check
under system variables go for path variable then check whether there is an entry for **(java_Instalation_path) ** or not

let me know all the above things

radhakrishna.p 29 Posting Whiz in Training

if you use the bellow statement for connecting to database (in the above given url)

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")

that says you are using type-1 driver which is provided by Microsoft ODBC for Oracle

incase, if you use the bellow statement for connecting to database

Class.forName("oracle.jdbc.driver.OracleDriver") 

that says you are using type-4 driver (ojdbc.jar and ojdbc14.jar files are needed to connect to database) which comes with Oracle10g Express Edition

note : check bin folder of oracle10g installation for those jar files

in java there are 4 ways to connect to database . the following url explains description of all the 4 ways

http://www.roseindia.net/jdbc/jdbc-driver-and-its-types.shtml

let me know if you have any doubts in my clarification

happy coding

radhakrishna.p 29 Posting Whiz in Training

hai all and bhadra.anurag,

check at line no 27 also

for(int h=0;h<=0;h++){

is this correct assignment value for variable 'h'?

(assigning zero and comparing with zero)

please check it once (in case if you dont get answer)

happy coding

radhakrishna.p 29 Posting Whiz in Training

pls post here any error messages if you got or explain your problem briefly

so that we are here to help you

how could we understand the else part the program is running?

radhakrishna.p 29 Posting Whiz in Training

i understood what you are looking for i.e you need a form which sends and receives a data using socket programing

is this right?

we can do this thing by using Socket class (for sending data) and ServerSocket class (for receiving data)

but i have some doubts in your post

its that possible from the inputStream getting the click event

i couldn't understand what you are asking in the above line can you clarify this?

and in the given Mybutton Class you have taken x,y parameters

can you tell me the use of those variables?

radhakrishna.p 29 Posting Whiz in Training

go through the bellow link which gives an idea to build a solution for your problem

http://www.javascriptkit.com/script/cut142.shtml

in that question and answers are taken as static data . if you try to get those data dynamically then your problem will be solved i think

first try it yourself

if you have any doubts we are here to help you

radhakrishna.p 29 Posting Whiz in Training

hai toomutch,

could you tell me the reason for storing the total path of the selected file into database?

radhakrishna.p 29 Posting Whiz in Training

generate 2 random positions as follows or shown above

var min =0 ,max = your_array.length // length of the given array as above
var x = Math.floor(Math.random() * (max - min) + min);

and store those 2 positions into some variables like (pos1,pos2)

then loop thru the array and repalce the values accordingly as shown bellow

for(var i=0;i<your_array.length;i++){
    if(pos1 == i || pos2 == i){
        your_array[i] = 1;
    }else{
        your_array[i] = 0;  
    }
}

thats it

let me know the status

radhakrishna.p 29 Posting Whiz in Training

why don't you try like this (replace your php code with bellow code it works perfectly)

<?php

echo('This is visible, all stuff below is not. So the closing tags are not visible too.');

?>
<embed src="flash/<? echo rand(1, 5);?>.swf" type="application/x-shockwave-flash" width="320" height="240"></embed>


<?
  // remaining your code 
?>
radhakrishna.p 29 Posting Whiz in Training

try like this, it may help you for your requirement

steps :

1 . store your numbers and operators in an array like as

var my_array = [1,2,3,.....]

2 . generate a random number between zero and the array length

var min =0 ,max = my_array.length // length of the given array as above
var x = Math.floor(Math.random() * (max - min) + min);

3 . based on the random number pick the value from the array

alert (my_array[x]);  // here i used alert for shoing the value 

go ahead like this

happy coding

radhakrishna.p 29 Posting Whiz in Training

i think mostly type-4 driver is best to use for connecting to databse

go through the following post (explains everything)

http://www.daniweb.com/software-development/java/threads/352336/java-connection-with-oracle-10g-express

radhakrishna.p 29 Posting Whiz in Training

guidelines to write a program for your 2 question:

  1. take an interger array with size 10 or number whatever you want
  2. i think you know how to read input values so then store those values into that array
  3. iterate through the array elements one by one by checking whether it is positive or negative ( elemnt > 0 then print positive otherwise negative )

first you try it your own

we will help you furtherly in case if you have any doubts

happy coding

radhakrishna.p 29 Posting Whiz in Training

let me know how you are retriving the data

what i mean is are you getting data from databse or somewhere else?

can you describe the structure of your data?

so that we will try to give the solution otherwise its hard to suggest any solution

radhakrishna.p 29 Posting Whiz in Training

its work perfectly on my side (10 rows and 10 cols)

please look at line 16 in the above post

i have set the loop upto totalRows.length only

check that loop on your side

happy coding

radhakrishna.p 29 Posting Whiz in Training

the following link will be helpful when your table has no key for any any column

http://www.codeproject.com/Tips/159881/How-to-remove-duplicate-rows-in-SQL-Server-2008-wh

as pritaeas said

its very difficult to give the answer for your requirement without knowing the structure of the table

please provide the table stucture once so that we are here to help you

happy coding

radhakrishna.p 29 Posting Whiz in Training

you may proceed with your actual requirement requirement i am just saying that what it will be like for your table creation and its design part only

thats it

radhakrishna.p 29 Posting Whiz in Training

yeah i think

you have created table without applying any styles so that eventhough it is created thats not visible to us

apply some styles to table and add it to the div firstly then start creating the rows and columns as follows

replcae with this modified code in to your script code

<script type="text/javascript">
    var totalRows = new Array(10);
   function drawTable() {
    var div_id = document.getElementById('div1');
    var tbl = document.createElement("table");

    tbl.setAttribute("id","table_id") ;
    tbl.setAttribute("border","1") ;

    div_id.appendChild(tbl); 

    var tabl_id  = document.getElementById("table_id");

    for(var i=0;i<totalRows.length;i++){
    var row=document.createElement('tr');
    for(var j=0;j<totalRows.length;j++){
        var cell=document.createElement('td');
                                      cell.setAttribute("width","100px") ; 
                                      cell.setAttribute("height","35px") ; 
                                      cell.innerHTML = "     "+j;                 
         row.appendChild(cell);
    }
    tabl_id.appendChild(row);
    }
}
setTimeout(function(){
       drawTable(); 
    },2000);
</script>

i hope this helps you

happy coding

note: i dont know when you are calling this drawTable() method ,i am just calling this method 2 secs after window is loaded

radhakrishna.p 29 Posting Whiz in Training

place that script code file before the end of </body> tag

i think it may work

pls check it once and let me know the status

happy coding

radhakrishna.p 29 Posting Whiz in Training

i think query might be the problem there

$query="SELECT post,link from pagination ORDER BY id DESC LIMIY $pageLimit,".PAGE_PER_NO;

can you check the query once by manually at phpmysqladmin sql prompt?

(what i mean is copy the query here and paste and run at sql prompt)

let me know the OP?

radhakrishna.p 29 Posting Whiz in Training

to be more specific str_pad() does well for this kind of requirement

$input = "41";
echo str_pad($input, 10,"0", STR_PAD_LEFT);                  

please check this too

radhakrishna.p 29 Posting Whiz in Training

try with this

$number = 41;
printf("%04d\n", $number);

printf() in php, follows some internally implemented rules for formating the numbers based on the given expression in the left side of the statemnt as shown above

please see manual for more details about this method

let me know the status

happy coidng

code739 commented: ahahah cool i really didnt think of that thing nice job +4
radhakrishna.p 29 Posting Whiz in Training

replace this $my_array[$rec_count] = $fv->value ' ' $fz->value;
with the following

 $my_array[$rec_count] = $fv->value.' '.$fz->value;

in php '.' is used for concatenating operations

please check it
and let me know the status

happy coding

radhakrishna.p 29 Posting Whiz in Training

at line 15 you are creating a new array for each and every record thats giving the invalid output to you

move that declarion out side of the while loop and make changes as follows

$my_array = array();
$rec_count =0;
while (!$result->EOF) 
    {
        $fz = $result->Fields("PersonNameFirst");
        $my_array[$rec_count] = $fz->value ;
        $result->MoveNext();        
        $rec_count++;
    }
echo json_encode($my_array);  

please check it once
let me know the status

radhakrishna.p 29 Posting Whiz in Training

just pass the method name to the page where your processing is done
based on the method name you may call the appropriate method as follows

for example: the following are the methods to execute (think this would be servelet or jsp whatever you want )

method_name = request.getParameter("metod_to_execute");

if(method_name.equalIgnoreCase("add")){

    addDetails();

}else if(method_name.equalIgnoreCase("delete")){

    deleteDetails();

}else if(method_name.equalIgnoreCase("update")){

    updateDetails();

} 

the only thing you have to do is just send the method_to_excute value to this page from the selection of your choice

i think you got my point

if you have any doubts in my clarification let me know

happy coding

radhakrishna.p 29 Posting Whiz in Training

hai deadsolo,

i tried the solution for your requirement by using split(" +")

i dont know whether this is an exact solution for your requirement or not. because iam not considering any other issues like( perfomance isssue ... etc) to give this solution

i know this is not the correct way for what you are looking for but its giving a way for the solution

i apologies to all the experts/guys over here who are giving solutions for this problem

File f = new File("Your_data_file_location here");
BufferedReader br = new BufferedReader(new FileReader(f));
String strt = "";

while((strt = br.readLine()) != null){                

     if(strt.startsWith("BitTorrent")){

         System.out.println(strt);
         String[] str_toks = strt.split(" +");
        // for (int i = 0; i < str_toks.length; i++) {
        //            String string = str_toks[i];
        // }
         System.out.println("your desired value :"+str_toks[str_toks.length-2]);
}
}
br.close();

explanation of my code:
1.i have taken your data in a file
2. then i read the file data line by line
3. then i checks if the line starts with (BitTorrent) or not
if yes i split the line using the above regular expression

4.based on our requiement i get the value from the array of spllitted line

thats it

let me know whether this is right approach or not

i will wait for all your valuable comment's

note: i dont have much experience in java

radhakrishna.p 29 Posting Whiz in Training

i found that syntax error in my script code (what i have posted so far in this blog )

Syntax Error : reasons

keep this ePlace array values in a single line as follows (while posting this code into here the values are jumped to another line that gives the above syntax error )

var ePlace=['Ten',' Eleven', ' Twelve', ' Thirteen', ' Fourteen', ' Fifteen', ' Sixteen', ' Seventeen', ' Eighteen', 'Nineteen'];

so keep the array values in sigle line and test it

it works fine on my side

let me know the status

happy coding

radhakrishna.p 29 Posting Whiz in Training

please replace following code in your script code what we had so far (in the given example ).

i just made some changes to this method

function convert_amount_into_rupees_paisa(){
        var finalWord1 = test_value();
        var finalWord2 = "";

        var val = document.getElementById('rupees').value;
        var actual_val  = document.getElementById('rupees').value; 
        document.getElementById('rupees').value = val;

        if(val.indexOf('.')!=-1)
       {
              val = val.substring(val.indexOf('.')+1,val.length);
              if(val.length==0){
    finalWord2 = "";
    document.getElementById('container').innerHTML=finalWord1 +" Rupees Only"+finalWord2;
              }
              else{
                  document.getElementById('rupees').value = val;
                  if(val != '00'){                      
                      finalWord2 = test_value() + " paisa only";
                      document.getElementById('container').innerHTML=finalWord1 +" Rupees and "+finalWord2;
                  }else{           
                      finalWord2 = "";
                      document.getElementById('container').innerHTML=finalWord1 +" Rupees only"+finalWord2;
                  }
              }

       }
       else{
             //finalWord2 =  " Zero paisa only";
             document.getElementById('container').innerHTML=finalWord1 +" Rupees Only";
       }
    document.getElementById('rupees').value = actual_val;   
}

check it and let me know the status

radhakrishna.p 29 Posting Whiz in Training

let me know

is it nessasary to use regular expression concept to get your actual output?

may i suggest any alternate solution to your requirement?

isn't it good to use split() for this requirement?

radhakrishna.p 29 Posting Whiz in Training

i used the same script by doing one example

here is that example and its work great

<html>
<head>
<title>welcome to Convert Currency In Words(http://pandiyachendur.blogspot.in/2009/11/javascript-to-convert-indian-

rupees-in.html)</title>


<script type="text/javascript">


function test_value() {
    var junkVal=document.getElementById('rupees').value;
    junkVal  = Math.floor(junkVal);
    var obStr = new String(junkVal);
    numReversed= obStr.split("");
    actnumber=numReversed.reverse();

    if(Number(junkVal) >=0){
        //do nothing
    }
    else{
        alert('wrong Number cannot be converted');
        return false;
    }
    if(Number(junkVal)==0){
        document.getElementById('container').innerHTML=obStr+''+'Rupees Zero Only';
        return false;
    }
    if(actnumber.length>9){
        alert('Oops!!!! the Number is too big to covertes');
        return false;
    }

    var iWords=["Zero", " One", " Two", " Three", " Four", " Five", " Six", " Seven", " Eight", " Nine"];
    var ePlace=['Ten', ' Eleven', ' Twelve', ' Thirteen', ' Fourteen', ' Fifteen', ' Sixteen', ' Seventeen', ' Eighteen', ' 

Nineteen'];
    var tensPlace=['dummy', ' Ten', ' Twenty', ' Thirty', ' Forty', ' Fifty', ' Sixty', ' Seventy', ' Eighty', ' Ninety' ];

    var iWordsLength=numReversed.length;
    var totalWords="";
    var inWords=new Array();
    var finalWord="";
    j=0;
    for(i=0; i<iWordsLength; i++){
        switch(i)
        {
        case 0:
            if(actnumber[i]==0 || actnumber[i+1]==1 ) {
                inWords[j]='';
            }
            else {
                inWords[j]=iWords[actnumber[i]];
            }
            inWords[j]=inWords[j];
            break;
        case 1:
            tens_complication();
            break;
        case 2:
            if(actnumber[i]==0) {
                inWords[j]='';
            }
            else if(actnumber[i-1]!=0 && actnumber[i-2]!=0) {
                inWords[j]=iWords[actnumber[i]]+' Hundred and';
            }
            else {
                inWords[j]=iWords[actnumber[i]]+' Hundred';
            }
            break;
        case 3:
            if(actnumber[i]==0 || actnumber[i+1]==1) {
                inWords[j]='';
            }
            else {
                inWords[j]=iWords[actnumber[i]];
            }
            if(actnumber[i+1] != 0 || actnumber[i] > 0){
                inWords[j]=inWords[j]+" Thousand";
            }
            break;
        case 4:
            tens_complication();
            break;
        case 5:
            if(actnumber[i]==0 || actnumber[i+1]==1 ) {
                inWords[j]='';
            }
            else {
                inWords[j]=iWords[actnumber[i]];
            }
            inWords[j]=inWords[j]+" Lakh";
            break;
        case 6:
            tens_complication();
            break;
        case 7:
            if(actnumber[i]==0 || actnumber[i+1]==1 ){
                inWords[j]=''; …
radhakrishna.p 29 Posting Whiz in Training
radhakrishna.p 29 Posting Whiz in Training

have you done anything so far ?

if pls post here so taht we are here to help you

radhakrishna.p 29 Posting Whiz in Training

we can add background color to div by using style property of div tag as shown bellow

<div id="your_id_value" style="background-color: grey">  
// you may give color name directly or its rgb value like (#FFCCEE)
</div>   

based on your condition you may add style property for the particular div tag

thats it

radhakrishna.p 29 Posting Whiz in Training

what i mean is to place the entire thread code in your button actionListner method

radhakrishna.p 29 Posting Whiz in Training

so then take a global variable for continuing (screen capture) the loop as folllow

public static boolean loop_status = true

and then modify your code as follows (here we are making the total process of your work in a seperate thread so that its never distrub the main thread at all)

new Thread(new Runnable(){

public void run(){
   try{
        for(int x=1;;x++) 
        {
             fn= Integer.toString(x) + "filename.jpg";
             ScreenShotRobot.captureScreenShot( "folder/", "jpg", fn );
             Thread.currentThread().sleep(2000);
             if(!loop_status){ // this loops until the value of the variable changed to false
             break;
             }
        }
}catch(Exception e ){
      // handling code if any exception raises here
}

}

}).start()

whenever you want to stop the screen capturing then try make the loop_status variable value to false

pls try to make changes in your code

let me know whether this is woirking perfectly or not

happy coding

radhakrishna.p 29 Posting Whiz in Training

try the bellow code for your requirement

try {    

    capture = new Robot().createScreenCapture(screenRect);
    ImageIO.write(capture, mode, new File( uploadPath, filename));

    // this makes 2 sec sleep
    Thread.currentThread.sleep(2000);  // here 2000 means 2 sec     
}
}catch(Exception e){
     // your remaining code 
}
radhakrishna.p 29 Posting Whiz in Training

can you explain the requirement clearly?

so that we are here to give some idea on your requirement ?

radhakrishna.p 29 Posting Whiz in Training

suggegtion only :

PixelGrabber is also another class where we can get image data in a pixel by pixel manner

radhakrishna.p 29 Posting Whiz in Training

hai davy_yg

replace that 'field name' with column's name of the table what you are trying to place the values into combo box

radhakrishna.p 29 Posting Whiz in Training

if you are looking for if the file exists or not
go with the following method available in the File Class

check it with 

if (f.exists())

let me know whether this is your requirement or not
happy coding

stultuske commented: since this is a correct answer to the question, see no reason why it should be flagged as a "Bad Post" +14