hardik.rajani 0 Light Poster

You can use jShowOff lib for developing this. There are many functions, you will have to dig into it.

transitionTo function is being used for slide to perticular div. This should be worked.

There are some other plugins also that you can try.
Cycle plugin

They have provided demo for "go to slide". That would be help full you.

hardik.rajani 0 Light Poster

Perhaps Remote Method Invocation (RMI) is something you should check out if connection itself is troubling you.

Basicly it's a little higher-level programming than the regular serverSocket/socket programming, taking care of http tunneling itself.

http://download.oracle.com/javase/tutorial/rmi/index.html Would be a good start.

Good luck, I'd like to hear your progress :)

Thanks for reply. I was on holidays so have been late.

Actually i have made one demo program for RMI. It is also working fine on LAN. Than I have tried searching about running the same over internet. I have got some clues about RMI/IIOP.

I have again tried compiling whole unit again. But i have not been able to run it over internet.

I think there would be some problem regarding public IP and access over ports.

Would you please suggest further.

hardik.rajani 0 Light Poster

Hi

I was trying to make a remote desktop program using java socket programming. I have been successful to develop it for LAN. But i am wondering that how to use the same application over internet. As i am not an networking guy, i don't have enough knowledge of tunneling and opening a port for public and route to some IP, etc.

Anyone please help me out.

hardik.rajani 0 Light Poster

Communication between mobile device and any type of pc is usually approached through USB connection or communication with servlet. I did not see anything so far showing bluetooth connection from mobile device to pc

I am using bluetooth for copying files to my mobile from PC.

Is is like one way communication ?

As well i have seen people to control Media player of PC by mobile also

hardik.rajani 0 Light Poster

I don't think you can browse computer structure in same manner as mobile device with JME.

Then how to write a file in PC at dynamic location. If you are not able to find the location.

hardik.rajani 0 Light Poster

I was creating a bluetooth program to access files of another mobile device.

I have used 0x1106 UUID for searching services. But i am getting null pointer exception.

As well please let me know about how to set HeaderSet to get folder detials from root.

Thanks

I have sorted out the issue. Now i m being able to get list of folders of pairing device in XML format. But in case if i connect to Laptop having bluetooth. i am getting following XML which do not contains folder lists.

<?xml version="1.0"?>
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"
[ <!ATTLIST folder mem-type CDATA #IMPLIED> ]>
    <folder-listing version="1.0">
        <parent-folder />
    </folder-listing>

Is there any suggestion now about how to get this one ?

hardik.rajani 0 Light Poster

I was creating a bluetooth program to access files of another mobile device.

I have used 0x1106 UUID for searching services. But i am getting null pointer exception.

As well please let me know about how to set HeaderSet to get folder detials from root.

Thanks

hardik.rajani 0 Light Poster

Hi,


I have a submit button in my JSP page. I also have drop down menus and text area in my form. Now my condition is like if drop down values or text area are null in this case if a user wants to submit he should get an alert message to fill the parameters first and it should stay on the same page.

Any suggestions ?

Thanks

Go for javascript validation. It will help you to restrict unnecessary server calls.

You will many suggestion and code snippet. Just do some searching in google.

hardik.rajani 0 Light Poster

Hi.

I need to create a bean class from list of properties in property file. So that if i need more fields in bean i don't need to go and change code. Instead just add a property in file and at runtime, a field with given name be added to the bean.

Its little bit urgent.

I have seen some of the options by searching but want to discuss it.
http://stackoverflow.com/questions/2320404/creating-classes-dynamically-with-java

hardik.rajani 0 Light Poster

Hi.

I am using apache servicemix and apache activeMQ in my product. Here in case of HttpConnector i found a performance issue.

If i increase number of total request at a time then as the number will increase exchange queue gets stuck on any of the component. After all the requests start processing, most of the exchange gets stuck at the end component or at the dispatcher* component. Container's heap size reaches to very high and after some time it crashes and restarts automatically.

I have used transactionmanager also. flowname is also mentioned as jms.

need some solution urgently.

hardik.rajani 0 Light Poster

suvojit.dhole - I think i got your point but i am not getting that SMTP and SMPP are both different protocols then how can i send message to mobile through SMTP server. Would you please clarify more about this.

buzzi - Yeah you are right i got some provider. But by luck my company won't allow me to pay for that. :)

hardik.rajani 0 Light Poster

Thanks for replying man. But i am in gujarat and i m not getting carrier specific email addresses for service providers in gujarat. I tried some from my hotmail account but it is not delivering sms.

I think this is a temporary or improper way to use implement this service.

hardik.rajani 0 Light Poster

Hi.

I am working on a HRMS system in J2EE. Here i need to verify mobile number through sms.

I am reading about it from 2 days but didn't get anything except SMPP. It will take a long time for me to learn this and implement whole.

I need suggestion for this. And if SMPP is the only solution then good resource link for that.

Thanks

hardik.rajani 0 Light Poster

Hey thanks for reply. But I think I could not explain my problem exactly. I am getting error in

ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml");

Your answer have been very helpful.

hardik.rajani 0 Light Poster

I was trying to run a spring program with different style. I am new to this framework.

I tried to load configuration file with types of loader. like

(1) BeanFactory factory = new XmlBeanFactory(new FileSystemResource("spring.xml"));
		
(2) ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");

(3) ApplicationContext context = new FileSystemXmlApplicationContext("/spring.xml");

But in second, I am getting exception that filenotfound.
And same thing i am doing in web application. In my web application configuration file is located exactly in WEB-INF folder. So i could load it as follow.

ApplicationContext context = new ClassPathXmlApplicationContext("/WEB-INF/application-context.xml");

Please give me suggestion. Please be specific with reason.

hardik.rajani 0 Light Poster

Here you are confusing the code.
You are taking input as Integer.

System.out.print("Choose An Operation");
	System.out.print("\nPress1 for Multiplication");
	System.out.print("\nPress2 for Division");
	System.out.print("\nPress3 for Addition");
	System.out.print("\nPress4 for Subtraction");
	System.out.print("\n\nOperation: ");
	option = stdin.readLine();

User gonna press 1 to 4 as input. You will not get character.
If you want to do only with this way then put one if-else and set one char variable with appropriate value as per the input. else change the style to take input. But whole String will not work with switch statement.

System.out.print("\nEnter the first number");
	firstnum = stdin.readLine();

As well you are taking all input as string instead take as integer itself. AS you are taking numbers for calculation.

hardik.rajani 0 Light Poster

You need the mail.jar in your classpath; you need to download the JavaMail jars if you already don't have them.

You would also be needing the Java Activation Framework libraries [activation.jar] if you are not using Java 6.

Thanks it works now.

hardik.rajani 0 Light Poster

Please mark the thread as solved if you get the answer.

hardik.rajani 0 Light Poster

I could not get question exactly.
But i think want to remove the table on click to delete button. If this the case then following solution will work.

<script language="javascript">
function removeRow(src)
{
	document.getElementById(src).style.display = "none";
}

This will hide the table from user.

<table id="tblGrid" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow('tblGrid');" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>
&nbsp;<BLOCKQUOTE>
<p><font color="#FF0000">Freeform text entry</font></p>
<p/>
<p>&nbsp;</p>
<p/>
<table id="tblGrid1" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow('tblGrid1');" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>
&nbsp;<BLOCKQUOTE>
<p><font color="#FF0000">Freeform text entry</font></p>
<p/>
<p>&nbsp;</p>

Here look carefully i m not passing the 'this' to the function instead just pass the table name.

hardik.rajani 0 Light Poster

My Spring.xml is something like this:

<beans>
	<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
		<property name="host" value="_local-mail-server_" />
	</bean>


	<bean id="businessLogic" class="com.logic.BusinessLogicImpl">
		<property name="mailSender" ref="mailSender"></property>
</bean>
</beans>

And bean definition is as below:

import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

public class BusinessLogicImpl implements BusinessLogic {

	private MailSender mailSender;

	public void setMailSender(MailSender mailSender) {
		this.mailSender = mailSender;
	}

	@Override
	public void execute() {
        SimpleMailMessage msg = new SimpleMailMessage();
        msg.setFrom(_senderAddress_);
        msg.setTo(_receiverAddress_);
        msg.setText("Hello, just sending you this message.");
    
        try {
            mailSender.send(msg);
        } catch(MailException ex) {
            // log it and go on
            System.err.println(ex.getMessage());
        }
    }

}

when I run this program i get exception as below:

Jul 10, 2009 4:19:25 PM org.springframework.core.CollectionFactory <clinit>
INFO: JDK 1.4+ collections available
Jul 10, 2009 4:19:25 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [C:\data\test_workspace\SpringMailSender\spring.xml]
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'businessLogic' defined in file [C:\data\test_workspace\SpringMailSender\spring.xml]: Cannot resolve reference to bean 'mailSender' while setting bean property 'mailSender'; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'mailSender' defined in file [C:\data\test_workspace\SpringMailSender\spring.xml]: Class that bean class [org.springframework.mail.javamail.JavaMailSenderImpl] depends on not found; nested exception is java.lang.NoClassDefFoundError: javax/mail/MessagingException
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'mailSender' defined in file [C:\data\test_workspace\SpringMailSender\spring.xml]: Class that bean class [org.springframework.mail.javamail.JavaMailSenderImpl] depends on not found; nested exception is java.lang.NoClassDefFoundError: javax/mail/MessagingException
Caused by: java.lang.NoClassDefFoundError: javax/mail/MessagingException
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:160)
	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:320)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:901)
	at org.springframework.beans.factory.support.AbstractBeanFactory.checkMergedBeanDefinition(AbstractBeanFactory.java:865)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:243)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:167)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:219)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:115)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:798)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:589)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:256)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:167)
	at MailSenderDemo.main(MailSenderDemo.java:12)
Caused by: java.lang.ClassNotFoundException: …
hardik.rajani 0 Light Poster

You might be surprised to know that sleep is not the only one that causes the problem, seldom actually. Any kind of blocking I/O is the main cause why a thread could be made to relinquish control of the CPU. And even if you remove the sleep command altogether you certainly have I/O there.

Darling read the posts carefully. :D

hardik.rajani 0 Light Poster

Not necessarily. There might not be a problem as such in his program but that does not mean the o/p would be as he wants it. It depends on the how the threads are schedule and hence, as mentioned, the same compiled program may generate various output sequences. I feel the advice of JC is the most valued here.

@hardik : You might have been lucky to get a sequence where the threads have been exactly alternating the execution cycle.

@OP : Follow what JamesC mentions about the wait/notify, it is the std procedure.

I have mentioned in my previous post that sleep doesn't works fine in all case.

hardik.rajani 0 Light Poster

Hi....
I have tried your code on my PC. Its works well. output is :

STD01 Saqib 18
BCS 3.4 
STD02 Kashif 17
BCS 3.5
STD03 Memoona 19
MCS 2.6
STD04 Madiha 18
BIT 3.0
STD05 Sidra 18
BBA 2.7
STD06 Hina 17
BCS 3.0
STD07 Shahid 19
MIT 3.2
STD08 Huma 18
BIT 3.4
STD09 Saeeda 17
BBA 3.2
STD10 Anjum 18
BCS 2.9

So now the problem is not your code. So chill.

Thread sequence depends on many factors as System clock, processor type, OS, OS's scheduling algos. So try using some other concept instead of sleep.

hardik.rajani 0 Light Poster
hardik.rajani 0 Light Poster

Hello,
I was wondering why do we need to assign value of -1 to the top of the stack?
topOfStack = -1;
Thank you

No dear it is not compulsory to set topOfStack by -1.

But there is some tradition as well some concept for predefined. If you want to follow the tradition you should set it to -1. Else you can also set it 0. But if you sets it to 0 then you have to make relative changes to the traditional code of stack.

Just for advise don't go beyond the tradition if it is not essential. Because in future you may have to work with a big team at that time it will be hard for other. This is my own experience.

hardik.rajani 0 Light Poster

hi,
i have a jsp page with 3 tabs.
i want to include a jsp page whwn a tab is clicked.
i used following syntax to include.


<jsp:include page="Homepage.jsp" />
</div></div>
</jsp:include>

but it is not working.
can anyone help?

just alittle change

</div><jsp:include page="Homepage.jsp" /></div>
hardik.rajani 0 Light Poster

hi

i'm developing a webpage.page contains various fields like collegename ,studentname and so on.collegename field will be a dropdown box and it gets option from backend table collegedetails.every collegename will have a unique collegeid in collegedetails table.after selecting collegename and filling necessary fields in webpage the details should be stored in data base but instead of collegename ,college id should be stored in another database table called studentdetails.so how to get collegename and college id in key value pairs

What you want to do???
Retrieve values from database and show on page????
or insert data to database with the value comes from page???
FIELDS??? field- this type have many other subtype which one you are pointing to???

hardik.rajani 0 Light Poster

int test = numbers.length;

if (numbers = test)
{
}

i want to find the last array in numbers then do something
with it for example out put it the above code is my attepmtp at it
however i am doingd something wrong and cant for the life of me figure out what it is.

yeah you need to change the code, you don't need to loop over the array.

int test = numbers.length;
    
/*temporary variable with same type as numbers */  = numbers[test-1];

This will give you last member of the array to the temporary variable. Then do what you want to do with it.

hardik.rajani 0 Light Poster

I'm having a project form school for a inventory management system and I want to do something extra. The inventory management system is for spare parts for machines and I want to be able to see the the manuals(PDF files) for thous machines in the GUI but I have no idea how. I tried google for about an hour but nothing concrete.
Can you point me in some direction or give me some examples?

If you want to with program to display in pdf. Then try using itext-API. you will also get tutorials for that. its a very effective and easy.

hardik.rajani 0 Light Poster

Well you may allow the user to enter the text and the URL in a dialog. Then implement a method -

private int linkID = 0;
public void addHyperlink(URL url, String text) {
  try {
    SimpleAttributeSet attrs = new SimpleAttributeSet();
    StyleConstants.setUnderline(attrs, true);
    StyleConstants.setForeground(attrs, unvisitedColor);
    attrs.addAttribute(ID, new Integer(++linkID));
    attrs.addAttribute(HTML.Attribute.HREF, url.toString());
    doc.insertString(doc.getLength(), text, attrs);
  }
  catch (BadLocationException e) {
    e.printStackTrace(System.err);
  }        
}

Then also define a mouse and mouse motion listener and do -

public class LinkController extends MouseAdapter 
                            implements MouseMotionListener {

  public void mouseMoved(MouseEvent ev) {
    JTextPane editor = (JTextPane) ev.getSource();            
    if (! editor.isEditable()) {

      Point pt = new Point(ev.getX(), ev.getY());
      int pos = editor.viewToModel(pt);
      if (pos >= 0) {                    
        Document doc = editor.getDocument();
        if (doc instanceof DefaultStyledDocument) {
          DefaultStyledDocument hdoc = 
            (DefaultStyledDocument) doc;
          Element e = hdoc.getCharacterElement(pos);
          AttributeSet a = e.getAttributes();
          String href = (String) a.getAttribute(HTML.Attribute.HREF);
          if (href != null) {
            if (isShowToolTip()){
              setToolTipText(href);
            }
            if (isShowCursorFeedback()) {    
              if (getCursor() != handCursor) {
                setCursor(handCursor);
              }
            }
          } 
          else {
            if (isShowToolTip()){
              setToolTipText(null);
            }
            if (isShowCursorFeedback()) {    
              if (getCursor() != defaultCursor) {
                setCursor(defaultCursor);
              }
            }
          }
        }
      } 
      else {
        setToolTipText(null);
      }          
    }

  /**
   * Called for a mouse click event.
   * If the component is read-only (ie a browser) then 
   * the clicked event is used to drive an attempt to
   * follow the reference specified by a link.
   *
   * @param e the mouse event
   * @see MouseListener#mouseClicked
   */
  public void mouseClicked(MouseEvent e) {
    JTextPane editor = (JTextPane) e.getSource();
            
    if (! editor.isEditable()) {
      Point pt = new …
hardik.rajani 0 Light Poster

It is possible but it will take a long time to implement. So first try your self. If you need help afterward it will be delievered.
you add something like if user select the text and give a the location by third click options. Then the text selected may be given a onclick event via mouselistener. And as well you can change text color also.
this the the idea i having you can think yourself.
try it, its seems very interesting.

hardik.rajani 0 Light Poster

Hello,
I have an assignment where i have to create few methods using linked lists. one of them is method that should create an integer singly list and return the head. While i know how to add a single node i am not sure how to create list of them. Should i use something like a for loop or something?
Thank you

have a look here:
http://www.java-tips.org/java-se-tips/java.lang/linked-list-implementation-in-java.html

hardik.rajani 0 Light Poster

I need to know how to access two tables which has some reference values within the table.I need the Java Code to Fetch Both the tables values which are same and have to display it

It is a part of DB not java. Use query which implement JOIN. One query can solve your problem.

If you don't know how to fire query through java then first go for it.

hardik.rajani 0 Light Poster

Also I have found something else out about my problem...

If I remove the encoding attribute from my XML document the same error occurs when executing via my IDE.

So it seems the problem is something to do with web start not reading this attribute some how?

Try removing DOCTYPE as well namespace tags from xml.

hardik.rajani 0 Light Poster

The program given here is a solved code. Try using this its working well.

hardik.rajani 0 Light Poster

use javascript.
make a javascript function and call it by a onload event of body tag.
e.g. <body onlaod="load()">
at last in the function use window.close()

hardik.rajani 0 Light Poster

explain your problem properly.

hardik.rajani 0 Light Poster

THis will replace #NUMBER with the array of number. But take care if there are more than one "#NUMBER" in your url. If such condition comes than u have to replace all #Number with good care.

String url = "http://www.sendmessgae.com/send?#NUMBERS"
StringBuffer replacement = new StringBuffer() ;
for (int i = 0; i < numbers.length; i++)
{
   replacement = replacement.append(nember[i]);
}
url = url.replaceAll( "#NUMBER", replacement );
response.sendRedirect(URL);
hardik.rajani 0 Light Poster

Here is the changes to your method.
Two problems solved
1) for(i = a-2; i >= 0; i--)
was wrong.

2) System.out.println("All Values of the Array including the new added value is: ");
System.out.println(+ b);
Here the second sysout is wrong.


public void addAtBegin(int n, int m) // adding an integer at the beginning of the array
    {
        a = n;
        a1 = m;
        int i;
        
        if (a <= MAX_VAL)
        {
        int [] b = new int [a];
        
        for (i = 0; i < b.length; i++)
            b[i] = i;
       // System.out.println("test display:" + b[i]);

        for(i = a-2; i >= 0; i--)        // move all the integers by one
        b[i+1] = b[i];
        b[0] = a1;
        
        for (i =0; i < b.length; i++)
               System.out.println("All Values of the Array including the new added value is: "+b[i]);
        }
        else
        {
            System.out.println("Error");
        }
        

    }
hardik.rajani 0 Light Poster

In the program you give there is no problem of GUI blocking. Clearify the problem.

hardik.rajani 0 Light Poster

I have change your code snippet as below check it out. It will print all the modes having maximum number. Check for the arrays sizes if i think it need some changes.

import java.util.Random;

public class ModeOfNumbers {
	public static void main(String[] args) {
		Random randGen = new Random(1);
		int[] nums = new int[10000];
		for (int i=0; i<nums.length; i++) {
			nums[i] = randGen.nextInt(1000);
		}
		int[] count = new int[1000];
		for (int i=0; i<nums.length; i++){
			int digit = Integer.valueOf(nums[i]);
			count[digit]++;
		}
		System.out.println("Digit: Frequency:");
		for (int i=0; i<1000; i++) {
			System.out.println(i + "\t" + count[i]);
		}
		int highIndex = 0;
		int[] modes = new int[10];
		modes[0] = 0;
		int n = 0;
		
		for (int i=0; i<1000; i++) {
			if (count[i] > count[highIndex]) {
				highIndex = i;
			}
			if (count[i] == count[highIndex]) {
				if(count[i] > count[modes[0]]){
					modes[0] = i;
					n = 1;
					for(int j=1; j<10; j++)
						modes[j] = 0;
				}
				else{
					modes[n++] = i;
				}
			}
		}
		for(int i = 0; i<10 ; i++){
			if(modes[i] ==0) {
				break;
			}
			else
				System.out.println("Mode = " + modes[i]);
		}

	}

}
hardik.rajani 0 Light Poster

try synchronizing the session object.