Search Results

Search found 111 results on 5 pages for 'anirudh goel'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • How to get Java XP Look and Feel

    - by Yatenda Goel
    I want to give XP Look and Feel to my Java Desktop Appliction, regardless of the platform it will run. I came to know that since JDK 1.4, Sun Microsystems has officially released a look and feel for XP - com.sun.java.swing.plaf.windows.WindowsLookAndFeel I am using Java 1.6 but when I didn't find any package named windows in javax.swing.plaf package. Q1. How can I use the XP Look and Feel? Q2. Will using this look and feel will appear same on all platforms (mac, solaris, linux)?

    Read the article

  • Struts 1 - How to display ActionMessages

    - by Yatendra Goel
    I am displaying ActionMessages through a JSP file by the following command: <logic:messagesPresent message="true"> <ul id="messsages"> <html:messages id="msg" message="true"> <li><bean:write name="msg"/> </li> </html:messages> </ul> </logic:messagesPresent> Now I want to display only selected messages. How can I indicate which message to display?

    Read the article

  • Java - Problem in JTree

    - by Yatendra Goel
    There are 2 JTree: JTree1 and JTree2. Note that the nodes (country, city, colors, blue ...) all will be implemented as JCheckboxes so that user can select particular colors for each city or for the whole country by selecting their corresponding checkboxes. Problems: Q1. I want that each country or city can have its own colors selected. Means if a user wants city1.1 to have colors blue and violet and city2.1 to have colors red, then he first have to select the city1.1 checkbox and then select blue and violet, and after that when he selects city2.1, then the checkboxes blue and violet are deselected automatically so that user can select the colors for city2.1. But when the user selects the city1.1 again, then the JTree2should show the selected colors (bule and violet) for city1.1. So for this purpose, Is the JTree (with its nodes as checkboxes) correct option to implement or I should use some other JComponent? If JTree is a correct option, then how can I remember the colors of each city?

    Read the article

  • Is selling a "website screen scraper" is illegal?

    - by Yatendra Goel
    I have coded a "website screen scraper" and want to sell it commercially. I know that webpages scraped by the screen scraper are restricted to be scraped by the webmaser of that website. The robots.txt file of the website says that its webpages must not be scraped. So my question is whether selling that screen scraper is a crime or using that screen scraper is a crime in legal terms. I know that this question is related to law but I thought the software experts on SO must also have answer to this question.

    Read the article

  • Java - How to detect that the internet connection has got disconnected through a java desktop applic

    - by Yatendra Goel
    I am developing a Java Desktop Application that access internet. It is a multi-threaded application, each thread do the same work (means each thread is an instance of same Thread class). Now, as all the threads need internet connection to be active, there should be some mechanism that detects whether an internet connection is active or not. Q1. How to detect whether the internet connection is active or not? Q2. Where to implement this internet-status-check-mechanism code? Should I start a separate thread for checking internet status regularly and notifies all the threads when the status changes from one state to another? Or should I let each thread check for the internet-status itself? Q3. This issue should be a very common issue as every application accessing an internet should deal with this problem. So how other developers usually deal with this problem? Q4. If you could give me a reference to a good demo application that addresses this issue then it would greatly help me.

    Read the article

  • worker process in IIS shared hosting

    - by Akshat Goel
    Can anyone tell me, is there a way to run a process in IIS shared hosting service. Suppose, the scenario is like "I want to send emails to a list of email id's after everywhere 3 hrs", so the challenge here is the process should not be invoked by a HTTP link. It should be automatic. I think we can do this by IIS worker processes. Also this all will be happening on a shared server(like GoDaddy) in IIS7, .NET 3.5 Please anyone give me a direction. Thanks in advance.

    Read the article

  • Java - SwingWorker - problem

    - by Yatendra Goel
    I am developing a Java Desktop Application. This app executes the same task public class MyTask implements Callable<MyObject> { in multiple thread simultaneously. Now, when a user clicks on a "start" button, I have created a SwingWorker myWorker and have executed it. Now, this myWorker creates multiple instances of MyTask and submits them to an ExecutorService. Each MyTask instance has a loop and generates an intermediate result at every iteration. Now, I want to collect these intermediate results from each MyTask instances as soon as they are generated. Then after collecting these intermediate results from every MyTask instance, I want to publish it through SwingWorker.publish(MyObject) so that the progress is shown on the EDT. Q1. How can I implement this? Should I make MyTask subclass of SwingWorker instead of Callable to get intermediate results also, because I think that Callable only returns final result. Q2. If the answer of Q1. is yes, then can you give me a small example to show how can I get those intermediate results and aggregate them and then publish them from main SwingWorker? Q3. If I can't use SwingWorker in this situation, then how can I implement this?

    Read the article

  • How to store a file on a server(web container) through a Java EE web application?

    - by Yatendra Goel
    I have developed a Java EE web application. This application allows a user to upload a file with the help of a browser. Once the user has uploaded his file, this application first stores the uploaded file on the server (on which it is running) and then processes it. At present, I am storing the file on the server as follows: try { FormFile formFile = programForm.getTheFile(); // formFile represents the uploaded file String path = getServlet().getServletContext().getRealPath("") + "/" + formFile.getFileName(); System.out.println(path); file = new File(path); outputStream = new FileOutputStream(file); outputStream.write(formFile.getFileData()); } where, the formFile represents the uploaded file. Now, the problem is that it is running fine on some servers but on some servers the getServlet().getServletContext().getRealPath("") is returning null so the final path that I am getting is null/filename and the file doesn't store on the server. When I checked the API for ServletContext.getRealPath() method, I found the following: public java.lang.String getRealPath(java.lang.String path) Returns a String containing the real path for a given virtual path. For example, the path "/index.html" returns the absolute file path on the server's filesystem would be served by a request for "http://host/contextPath/index.html", where contextPath is the context path of this ServletContext. The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive). So, Is there any other way by which I can store files on those servers also which is returning null for getServlet().getServletContext().getRealPath("")

    Read the article

  • Java - JPA - @Basic and @Embedded

    - by Yatendra Goel
    I am learning JPA from this tutorial. I have some confusions in understanding the following annotations: @Basic @Embedded Fields of an embeddable type default to persistent, as if annotated with @Embedded. If the fields of embeddable types defualt to persistent, then why would we need @Embedded

    Read the article

  • How to read an XML file with Java?

    - by Yatendra Goel
    I don't need to read complex XML files. I just want to read the following configuration file with a simplest XML reader <config> <db-host>localhost</db-host> <db-port>3306</db-port> <db-username>root</db-username> <db-password>root</db-password> <db-name>cash</db-name> </config> How to read the above XML file with a XML reader through Java?

    Read the article

  • Java Swing - Problem in disabling JCheckbox

    - by Yatendra Goel
    I am disabling a JCheckbox and then enabling it with the help of setEnabled(...) method. But the problem is if I disable a unselected checkbox, then it becomes selected after I enable it. I want all of them to have the same state after being enabled that they had before being disabled.

    Read the article

  • Java - Parsing a Date from a String

    - by Yatendra Goel
    I want to parse a java.util.Date from a String. I tried the following code but got unexpected output: Date getDate() { Date date = null; SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd"); try { date = sdf.parse("Sat May 11"); } catch (ParseException ex) { Logger.getLogger(URLExtractor.class.getName()).log(Level.SEVERE, null, ex); return null; } return date; } When I run the above code, I got the following output: Mon May 11 00:00:00 IST 1970

    Read the article

  • Hibernate - Problem in parsing mapping file (.hbm.xml)

    - by Yatendra Goel
    I am new to Hibernate. I have an exception while running an Hibernate-based application. The exception is as follows: 16 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA 16 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found 16 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 31 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 94 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml 94 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml 219 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : app/data/City.hbm.xml 266 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(12) Attribute "coloumn" must be declared for element type "property". 266 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(13) Attribute "coloumn" must be declared for element type "property". 266 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(14) Attribute "coloumn" must be declared for element type "property". It seems that it is not finding coloumn attribute of the property element in the mappings file but my mappings file do have the coloumn attribute. Below is the mappings file (City.hbm.xml) <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="app.data"> <class name="City" table="CITY"> <id column="CITY_ID" name="cityId"> <generator class="native"/> </id> <property name="cityDisplyaName" coloumn="CITY_DISPLAY_NAME" /> <property coloumn="CITY_MEANINGFUL_NAME" name="cityMeaningFulName" /> <property coloumn="CITY_URL" name="cityURL" /> </class> </hibernate-mapping>

    Read the article

  • Java - Thread problem

    - by Yatendra Goel
    My question is related to all those methods(including Thread.sleep(...)) which throw InterruptedException. I found a statement on Sun's tutorial saying InterruptedException is an exception that sleep throws when another thread interrupts the current thread while sleep is active. Is that means that the interrupt will be ignored if the sleep is not active at the time of interrupt? Suppose I have two threads: threadOne and threadTwo. threadOne creates and starts threadTwo. threadTwo executes a runnable whose run method is something like: public void run() { : : try { Thread.sleep(10 * 1000); } catch (InterruptedException e) { return; } : : : // In the middle of two sleep invocations : : try { Thread.sleep(10 * 1000); } catch (InterruptedException e) { return; } : : } After thread creation, threadOne interrupts threadTwo. Suppose the threadTwo is in the middle of two sleep invocations at the time of interrupt (when no sleep method was active), then will the second sleep method throw InterrupteException as soon as it is invoked? If not, then will this interrupt will be ignored forever? How to be sure that threadTwo will always know about the interrupt (doesn't matter whether its one of the sleep method is active or not)?

    Read the article

  • Is selling a "website screen scraper" illegal?

    - by Yatendra Goel
    I have coded a "website screen scraper" and want to sell it commercially. I know that webpages scraped by the screen scraper are restricted to be scraped by the webmaser of that website. The robots.txt file of the website says that its webpages must not be scraped. So my question is whether selling that screen scraper is a crime or using that screen scraper is a crime in legal terms. I know that this question is related to law but I thought the software experts on SO must also have answer to this question.

    Read the article

  • JPA - Entity design problem

    - by Yatendra Goel
    I am developing a Java Desktop Application and using JPA for persistence. I have a problem mentioned below: I have two entities: Country City Country has the following attribute: CountryName (PK) City has the following attribute: CityName Now as there can be two cities with same name in two different countries, the primaryKey for City table in the datbase is a composite primary key composed of CityName and CountryName. Now my question is How to implement the primary key of the City as an Entity in Java @Entity public class Country implements Serializable { private String countryName; @Id public String getCountryName() { return this.countryName; } } @Entity public class City implements Serializable { private CityPK cityPK; private Country country; @EmbeddedId public CityPK getCityPK() { return this.cityPK; } } @Embeddable public class CityPK implements Serializable { public String cityName; public String countryName; } Now as we know that the relationship from Country to City is OneToMany and to show this relationship in the above code, I have added a country variable in City class. But then we have duplicate data(countryName) stored in two places in the City class: one in the country object and other in the cityPK object. But on the other hand, both are necessary: countryName in cityPK object is necessary because we implement composite primary keys in this way. countryName in country object is necessary because it is the standard way of showing relashionship between objects. How to get around this problem?

    Read the article

  • Strange padding in Safari when using SVG images

    - by Naman Goel
    I thought I was having issues with margins but then on a closer look I found that SVGs are acting funky in Safari 6. I am building a simple Hexagon based website. Of course I used negative vertical margins to for a little overlap to 'inter-lock' the hexagons. And to save space I was using SVG images for the hexagons. It works great in chrome and firefox, but in Safari, there is a strange padding in the SVG images. I'm using simple img tags for the svg images. Everything works when I switch to PNG, but I'd prefer to stick to SVGs. Any insight? Can I perhaps delve into the SVG code and somehow fix the SVG problem in Safari? or is it some sort of bug, that I can do nothing about without browser sniffing?

    Read the article

  • Java - SwingWorker - problem in done() method

    - by Yatendra Goel
    I am using javax.swing.SwingWorker for the first time. I want to update a JLabel from the interim result published by the swing worker as follows: publish("Published String"); Now to update the JLabel, I have coded the following: process(List<String> chunks) { if (chunks.size() > 0) { String text = chunks.get(chunks.size() - 1); label.setText(text); } } The above code works but my problem(or to be more specific, my doubt) is as follows: The above swing worker task is an annonymous inner class so it can access label field. But what if I want to make the swing worker class a non-inner class. Should I need to pass label as an argument to the constructor of swing worker class so that the process() method can access. Or Is there any other way? What approach does other developer follow to update UI components from the swing worker class' result when the swing worker class is not an inner class?

    Read the article

  • How to fill HTTP forms through java?

    - by Yatendra Goel
    I want to fill a text field of a HTTP form through java and then want to click on the submit button through java so as to get the page source of the document returned after submitting the form. I can do this by sending HTTP request directly but I don't to this in this way. Very Urgent. You can also paste the code or demo code to explain in a better way.

    Read the article

  • Hibernate or JPA or JDBC or ???

    - by Yatendra Goel
    I am developing a Java Desktop Application but have some confusions in choosing a technology for my persistence layer. Till now, I have been using JDBC for DB operations. Now, Recently I learnt Hibernate and JPA but still I am a novice on these technologies. Now my question is What to use for my Java Desktop Application from the following? JPA Hibernate JDBC DAO any other suggestion from you... I know that there is no best choice from them and it totally depends on the complexity and the requeirements of the project so below are the requirements of my project It's not a complex application. It contains only 5 tables (and 5 entities) I wan't to make my code flexible so that I can change the database later easily The size of the application should remain as small as possible as I will have to distribute it to my clients through internet. It must be free to use in commercial development and distribution.

    Read the article

  • Examples of good JPA Java Desktop Application

    - by Yatendra Goel
    I have learnt JPA recently. Now I want to use it in one of my commercial product. But before proceeding, I want to see some example JPA Java Desktop applications so as to have a better understanding of using JPA in desktop applications. I have searched google for this but all I found was tutorials on JPA with examples of entities. I need some good real java desktop applications which have used JPA.

    Read the article

  • Java Persistence API

    - by Yatendra Goel
    I am new to Java Persistence API. I have just learnt it and now want to use it in my Java Desktop Application. But I have the following questions regarding it: Q1. Which JPA implementation is smallest in size (as I want to have my application's size as small as possible)? Q2. How to find the value of the <provider> tag in the persistence.xml file. I know that its value is vendor scpecific but I couldn't find the value for the JPA implementation downloaded from here.

    Read the article

  • Java - How to get current year?

    - by Yatendra Goel
    I want to know the current Date and Time. The code Calendar.getInstance(); represents a date and time of the system on which the program is running and the system date can be wrong. So Is there any way by which I can get correct current date and time irrespective of the date and time of the system on which program is running?

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >