Skip to main content

Posts

Convert String to Long

Is it possible to convert a String to long without using java's built in function? For instance: String s = "35"; long ans = Long.parseLong(s); How can you carry out the same task without using java's Long.parseLong function

Array lists and string splitting(Java) [closed]

I am trying to read a text file, and read its contends. Easy enough, right? But the files contents read: Part1:Part2 Part1:Part2 I am trying to add the string(s) to a to an array list, with the following protocol: Add "Part1" to an arraylist called p1, then add "Part2" to an arraylist called p2. I need to go through the whole text file with multiple lines. How would I do so?

Technology for e-commerce website? [closed]

I am student of Computer engineering. I want to develop e-commerce website(online shopping website). I have good knowledge of JAVA but I dont have any experience in web development. Which language or technology should i choose or which is best for e-commerce site? Also any advice or things i should consider or keep in mind before starting development of e-commerce website.

ResultSet How to get strin from object when data is null?

In my Oracle table there are columns with different type. I want to read all columns as number. String str = resultSet.getString("col1"); The problem is that if column in database is defined as number, and value is 0.5 The returned string will be .5 I can not use any other getter like getDecimal and etc. if I use: String str = resultSet.getObject("col1").toString(); I'll get an exception if the value is null.

Create a stuck thread (Weblogic)(J2SE)(1.5)

I need to test WLST script that checks for stuck threads across some managed instances on a weblogic deployment. Unfortunately when I need to test, I am unable to get my stuck thread problem to rear its head. How can I intentionally create a stuck thread to test my script's detection with? My thoughts presently have been to sleep a thread for more than my stuck thread limit on Weblogic's settings, but that is also longer than the timeout for webpages. So my request should timeout before the thread ever becomes stuck. Apache commons executor is another idea... Does anyone have an elegant solution to reproducing this ugly issue?

Java - How to resize components in GroupLayout

., Hello, I have a problem with GroupLayout . My code is: public chat () { JTextField chatbox; JTextField msgbox; JButton sendbutton; GroupLayout layout; super(); chatbox = new JTextField(); msgbox = new JTextField(); sendbutton = new JButton("Send"); layout = new GroupLayout(this); sendbutton.setPreferredSize(new Dimension(60, 20)); setBackground(new Color(255, 255, 255)); setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(chatbox) .addGroup(layout.createSequentialGroup() .addComponent(msgbox) .addComponent(sendbutton)) ); layout.linkSize(SwingConstants.HORIZONTAL, sendbutton); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(chatbox)

GravityManager.getGravity() returns null

I'm trying to implement Gravity from GraniteDS. I did everything like in example from GraniteDS website, but when I'm trying to get gravity from servlet context, GravityManager.getGravity returns null. Here is the code: Gravity gravity = GravityManager.getGravity(contextManager.getServletContext()); What can be the reason of this error?