Opinion on using properties for your app.

I have a small application which uses a properties file. I want these properties to be global to my application. Throughout the code I may need to refer to the properties.
I created a singleton class which loads the properties file, and then I created a method for each property. So I access the properties through methods, which return the type I want, such as a String, int, boolean...
public String getProperty1() {
public boolean getProperty2() {
What do you think of this design?

The only problem I thought I saw with doing something like:
MyProps.getInt("age");
Would be that you have all of these hardcoded strings throughout your code. Also, if you make a typo it could create a few run-time bugs. I considered making a static variable and using it like this:
MyProps.getInt(MyProps.AGE);
If I needed to also make a small tweak to the actual property name, I only have to change it in one place.
public static String AGE = "newage";
I guess this really is only useful if you anticipate you may change some of the wording, which probably isn't that common.

Similar Messages

  • HT5787 i buy iphone 4sfrom some friend that's he got it from his friend in canada and me set up software for it from Itunes and it asking now for apple ID that's i don't used it for download apps and me can't open my Iphone right now !! what i should do ?

    i buy iphone 4sfrom some friend that's he got it from his friend in canada and me set up software for it from Itunes and it asking now for apple ID that's i don't used it for download apps and me can't open my Iphone right now !! what i should do ?

    It's not stolen ,that iphone came from canada to Egypt and me activeted it last night i got the acc from the owner
    Thanks for Replay Mr

  • Defining server specific properties for EJB app

    I need to define some properties for my app which have different values depending on the server to which I deploy. Eg. the LDAP server name and port.
    When I deploy to my development server it should find the local values of the properties, when I deploy to the live server it needs a different set of values.
    What is the simplest way to do this? I obviously don't want the properties to be part of my deployment.
    Rob

    EJBs are not allowed to read or write files. But they are allowed to read from the JNDI context. The idea is to provide a symbolic name, ie <resource-env-ref>, which contains the value you need.
    The startup-classes which could set this value in the JNDI context are best documented in the OC4J User's Guide.
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • For Superior Stability and Responsiveness: Use Spaces for Every App as Much as Possible

    Hi. It's great to share this experiement. It's Hard to Crash Mountain Lion OS X with Spaces or even bring out the spinning wheel.
    Any OS (it's good to have Windows, OS X and Linux all at the same time, best of all worlds) should probably be stable if each app was on a separate desktop environment or separate account (with the main one logged in, in the background). The permission were repaired (it crashed the last time I tried this with just one Spaces) using Disk Utility in Mountain Lion's Recovery partition.
    Testing the overall stability and responsiveness: more than 12 app including Cinebench 12, Winclone, 2 3D Games from App Store (not Crysis or Rage but helps stress things along with Cinebench), all default Mountain Lion apps except Time Machine launched in one windows , Winclone cloning BootCamp a Win8 (upgraded from Win7) for hours, playing two 3D games (shooter Uberstrike and Marble World, fulscreen windowed) from App Store, Carbon Copy Cloner, watching a fullscreen movie on VLC, Activity monitor and iStats to see how the temperatures, CPU, GPU and memory are doing), quicktime playing a catholic chant in a loop- anything to bring the Mac, the whole system to a crawl, spinning wheel of death or to a crash which it didn't. Launching and relaunching app on their on Spaces was responsive even with all the system taxed at almost 100%.
    There was around 12 Spaces running at the same time on the iMac i7 with 8GB. It's not the most convenient way to switch between apps (having everying in one Spaces and clicking on it still the best, followed by swithing via Dock), the gestures and mission control significantly made it easier to have so many Spaces and not that much of a burden to manage when you get used to it. It's much better than Windows 8 implementation for a less cluttered environment. The command-tab is good to combine with Mission Control gestures for switching from fullscreen apps.
    .All that while running Cinebench 11.5 which taxes the CPU at almost and GPU 100% but surprisingly the fps shooter and Marble Worlds 3D games didn't crawl as I expected.Having an ambient temperature of about 30 Celsius, with full load the CPU temp was at 66, GPU was at 88, fans where surprisingly at CPU and optical disk fans were only at 900+ rpm with hardisk at 1000+ rpm which is the only 'side effect' to having taxing the system like this (I still have Applecare and Time Machine backup for a worry free test) is it confuses the SMC because without load all fans were at 1000+ rpm (I brough it back to normal with a SMC reset). All these for hours and there's still 1GB memory to use out of the 8GB (with 100GB hardisk space).
    When I closed all 11 Spaces and brought all the apps to just one desktop, it wasn't as stable nor as responsive like I have experienced before. Marble World when you switch to it, would have artifacts, the game was almost a slide show. If you have lots of clips to copy past from on the Desktop and you have to hide all to see the finder and then Show All, Carbon Cloner would not show up right away and would have that spinning wheel. I quitted all the apps to prevent a crash and to bring temperatures down.
    At first the Mountain Lion was almost a regret with some crashes but with Spaces, Misson Control and gestures for Mission Control, It's bring out the value and it just incredibly stable and responsive (Linux have their multiple desktop environment but Apple's implementation makes you see everything like a map almost bringing the convenience of just one desktop with all the apps placed strategically so you can click and switch to it faster). It's a great way to do a lot of things when you need to without worrying about slowing things down to a crawl.
    Thank you for your time.
    God bless.

    Hi. It's great to share this experiement. It's Hard to Crash Mountain Lion OS X with Spaces or even bring out the spinning wheel.
    Any OS (it's good to have Windows, OS X and Linux all at the same time, best of all worlds) should probably be stable if each app was on a separate desktop environment or separate account (with the main one logged in, in the background). The permission were repaired (it crashed the last time I tried this with just one Spaces) using Disk Utility in Mountain Lion's Recovery partition.
    Testing the overall stability and responsiveness: more than 12 app including Cinebench 12, Winclone, 2 3D Games from App Store (not Crysis or Rage but helps stress things along with Cinebench), all default Mountain Lion apps except Time Machine launched in one windows , Winclone cloning BootCamp a Win8 (upgraded from Win7) for hours, playing two 3D games (shooter Uberstrike and Marble World, fulscreen windowed) from App Store, Carbon Copy Cloner, watching a fullscreen movie on VLC, Activity monitor and iStats to see how the temperatures, CPU, GPU and memory are doing), quicktime playing a catholic chant in a loop- anything to bring the Mac, the whole system to a crawl, spinning wheel of death or to a crash which it didn't. Launching and relaunching app on their on Spaces was responsive even with all the system taxed at almost 100%.
    There was around 12 Spaces running at the same time on the iMac i7 with 8GB. It's not the most convenient way to switch between apps (having everying in one Spaces and clicking on it still the best, followed by swithing via Dock), the gestures and mission control significantly made it easier to have so many Spaces and not that much of a burden to manage when you get used to it. It's much better than Windows 8 implementation for a less cluttered environment. The command-tab is good to combine with Mission Control gestures for switching from fullscreen apps.
    .All that while running Cinebench 11.5 which taxes the CPU at almost and GPU 100% but surprisingly the fps shooter and Marble Worlds 3D games didn't crawl as I expected.Having an ambient temperature of about 30 Celsius, with full load the CPU temp was at 66, GPU was at 88, fans where surprisingly at CPU and optical disk fans were only at 900+ rpm with hardisk at 1000+ rpm which is the only 'side effect' to having taxing the system like this (I still have Applecare and Time Machine backup for a worry free test) is it confuses the SMC because without load all fans were at 1000+ rpm (I brough it back to normal with a SMC reset). All these for hours and there's still 1GB memory to use out of the 8GB (with 100GB hardisk space).
    When I closed all 11 Spaces and brought all the apps to just one desktop, it wasn't as stable nor as responsive like I have experienced before. Marble World when you switch to it, would have artifacts, the game was almost a slide show. If you have lots of clips to copy past from on the Desktop and you have to hide all to see the finder and then Show All, Carbon Cloner would not show up right away and would have that spinning wheel. I quitted all the apps to prevent a crash and to bring temperatures down.
    At first the Mountain Lion was almost a regret with some crashes but with Spaces, Misson Control and gestures for Mission Control, It's bring out the value and it just incredibly stable and responsive (Linux have their multiple desktop environment but Apple's implementation makes you see everything like a map almost bringing the convenience of just one desktop with all the apps placed strategically so you can click and switch to it faster). It's a great way to do a lot of things when you need to without worrying about slowing things down to a crawl.
    Thank you for your time.
    God bless.

  • Creating a splash screen for your app.

    Im trying to create a splash screen for my app but im not too sure how it's done.
    Im using the following piece of code.
    public static void main(String[] args)
              JPanel display = new JPanel();
              display.setPreferredSize(new Dimension( (300), (200) ));
              display.setBackground(Color.white);
                   // I WILL PUT AN IMAGE ICON ON A JLABEL HERE              
              display.setVisible(true);
                   // I WILL NEED A DELAY HERE
              test.instance();
    }The problem I am having is that the JPanel is not being displayed. I will also need a way to create a delay, I know that I can't just use Thread.sleep(5000); because the JPanel will require the thread to be running in order to display the panel.
    Does anyone know how I could get my JPanel to display and somehow insert a delay before test.instance();?
    Thanks.

    I made my own a few days before for a database program. It can be easily done with Threads.
    I recommend you create a new class to be used as the spalsh screen , it has to extends JFrame and implements Runnable.
    I ll give you an example. I used the spash screen to display the screen and also to laod the main GUI form so that when the spash screen dispose, the main GUI form displays instantly, making the user think that the application loads faster.
    public void run ()
            try
                 this.setVisible(true);
                 Thread.sleep(2000);
                 // sets the menu visible before disposing
                 guiMenu.setVisible(true);
                 // disposes the object and returns the resources to the OS
                 this.dispose();
            catch(InterruptedException exception)
                exception.printStackTrace();
    // this method must be implement in the class
    // that implements Runnable interface
    //MAIN
    public class Main
        public static void main(String[] args)
            Menu menu = new Menu();
            SplashScreen introScreen = new SplashScreen(menu);
            ExecutorService splashExecutor= Executors.newFixedThreadPool(1);
            splashExecutor.execute(introScreen);       
    }ExecutorService is a subinterface of Executor that declares methods for managing the threads. It also has the method execute (that provides the Executor interface) which when invoked calls the method public void run() of the argument class that must implement Runnable.
    Executors.newFixedThreadPool(1); creates a poll consisting of a 1 thread which is been used by splashExecutor to execute the Runnable.
    Hope i've been of some assistance!

  • How many downloads are you hoping/expecting for your app?

    I've seen a thread regarding develoers wanting to find out how many downloads their apps have had.
    I'm in the early stages of developing my own app but wondered what expectations other developers have for their own apps?
    in terms of a percentage of all iPhone users, what percentage would you be hoping to download your app?
    I can't remember the stats for how many iPhone users there are - lets say 5million (if someone knows more accurate figure then please update).
    Is it safe to assume a minimum percentage of 0.001% on average?
    This is very low I think but even so would yeild 5000 downloads.
    I just wondered how the rest of you are working out your expectations?
    Cheers
    Wayne

    I think any app in the top 100 has gotten thousands of downloads at this point. However, not every app in the store is going to get that many; it depends greatly on your audience size, and your audience size is not all iphone users.
    The audience for a game is all users that like *that type* of game - players of crosswords and sudoku will not necessarily buy a shoot-em-up game, and vice versa. An application that shows movie listings has a broad audience, but a birdwatching or insect identification app has a narrow audience. That's why niche apps will have higher prices - the audience is smaller, so each customer will have to pay more.
    So - if you find a broad audience, or a niche audience that is willing to pay, you will get thousands of downloads every month. If you create an app with little or no audience, or create a clone in an area with too much competition, you'll still get a few downloads, but not enough to quit your day job.
    I'm counting downloads on linktracker.com, and multiplying by 100. I consider that a lowball estimate of my total downloads, but it's far exceeded my expectations. Apparently even a pet rock will make enough money to pay the rent.

  • HT5552 Using PayPal for iTunes/App Store

    I try to select PayPal as my payment option for iTunes/App Store, but when I select the PayPal icon and click the "continue" button, as directed, nothing happens.  Why can I not select PayPal?  All of my payment information is stored in PayPal, and I would like to keep it that way.

    Thanks for the pointer Lesnes.
    Unfortunately I am unable to create an itunes account as part of the process for doing so asks for my bank or cc details which I am not happy to provide.
    I received an email from Apple support last night with the following link:
    http://support.apple.com/kb/HT2534
    The link does not take into account that I already have an apple ID so instead of being able to follow all the steps I get asked to log in and review and this goes to a page requesting billing info with no 'None' or Paypal options.

  • I NEED HELP FAST!!! how can i activate wi-fi if i want to use that for facebook apps instead of wasting my data?

    i want the 200 mb plan for my iphone and wanted to know if instead of using safari i can use apps such as facebook or tumblr without using up my data. i got the asnwer that i can avoid that by using wi-fi, but how does that whole thing work?
    sorry i am a bit new at this, and i need help fast!
    THANK YOU!

    hookedonlerman wrote:
    but will that replace the use of using up data? (wifi & 3G)
    It sounds as if you don't really understand what "using data" means. Data is not something different from WiFi and 3G, it's something sent over WiFi and 3G. Think of data as water and WiFi and 3G as types of pipes. Some apps need to send and receive data to work. That data can be sent or received in different ways. It can be sent over WiFi or 3G. Both official iPhone carriers in the U.S. have metered data plans. It's sounds as if you're talking about AT&T's 200 mb data plan. WiFi is not provided by your cellular carrier. You can have WiFi from your Internet Service Provider at home or you can access free WiFi at places like McDonalds or Starbucks or paid WiFi at places like airports.
    If you have WiFi turned on on your phone and WiFi is available, the phone will default to WiFi. WiFi is faster than 3G and generally not metered, and is sometimes even free. If you are out of range of WiFi, you would be using 3G to send and receive your data. With a metered plan, you need to keep an eye on how much you are using because if you go over your allowance, you will be charged additional fees.

  • Cannot use firefox for in app purchase in google play

    Tried to make an in app purchase on google play. would only get blank popup window. Made the purchase with google chrome browser with no problem.

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • Query Program ! use this for your query's like SQLPlus , copy-paste and run

    H!
    Like the Subject Title:
    If you have PHP and Oracle then you can use this if you are learning the query's or you don't wanna use SQLPlus.
    BTW this is my first script, but it works fine here.
    //the code
    <?//made by [email protected]
    IF($_SERVER['REQUEST_METHOD'] == 'POST' AND isset($_POST['username']) AND isset($_POST['password'])) {
    //gebruik het juiste dll bestand.
    dl("php_oci8.dll");
    define("USERNAME",$username);
    define("PASSWORD",$password);
    $conn      = OCILogon(USERNAME,PASSWORD);
    $sql      = stripslashes($sql);
    IF($btnRollback){
         ocirollback($conn);
         echo "Rollback done !";
    IF($btnCommit){
    ocicommit($conn);
    echo "Committed !";
    IF($btnVersion){
         echo OCIServerVersion($conn);
    IF($btnSql){
    $stmt      = OCIParse($conn,$sql);
    IF(OCIExecute($stmt) === TRUE){
              $msg = "The Query was oke !";
    if (OCIStatementType($stmt) == "SELECT") {
         $ncols     = OCINumCols($stmt);
         echo "<table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"0\" bordercolor=\"#FFFFFF\" bordercolorlight=\"#FFFFFF\" bordercolordark=\"#FFFFFF\">\n";
         echo "<tr>\n";
         for($i=1;$i<=$ncols;$i++){
         $column_name[$i] = OCIColumnName($stmt,$i);     //tabel kopjes
              $column_type[$i] = OCIColumnType($stmt,$i);     //extra info
    $column_size[$i] = OCIColumnSize($stmt,$i);      //extra info
              echo "<td class=\"row\"><b>$column_name[$i]</b></td>\n";
         echo "</tr>\n";
         while(OCIFetch($stmt)){
         echo "<tr>\n";
              for($i=1;$i<=$ncols;$i++){
         $column_value[$i] = OCIResult($stmt,$i);
                   echo "<td class=\"row\">$column_value[$i]</td>\n";               
         echo "</tr>\n";
         //extra info
         echo "<tr>\n";
         for($i=1;$i<=$ncols;$i++){
              echo "<td class=\"row\"><i>$column_type[$i] $column_size[$i]</i></td>\n";
         echo "</tr>\n";
         echo "</table>\n";
         OCIFreeStatement($stmt);
    OCILogoff($conn);
    ?>
    <style type="text/css">
    <!--
    .row { 
         background-color: #EEEEEE;
         border: #000000;
         border-style: solid;
         border-top-width: 1px;
         border-right-width: 1px;
         border-bottom-width: 1px;
         border-left-width: 1px;
         font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt;
    -->
    </style>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="submit">
    <hr>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="37%">
    <textarea name="sql" cols="60" rows="10"><?echo $sql;?></textarea>
    </td>
    <td width="63%" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="12%">Username:</td>
    <td width="88%">
    <input type="text" name="username" value="<?echo $username;?>">
    </td>
    </tr>
    <tr>
    <td width="12%">Password:</td>
    <td width="88%">
    <input type="password" name="password" value="<?echo $password;?>">
    </td>
    </tr>
    <tr>
    <td width="12%"> </td>
    <td width="88%"> </td>
    </tr>
    <tr>
    <td width="12%">
    <input type="submit" name="btnSql" value="Sql">
    </td>
    <td width="88%">
    <input type="submit" name="btnCommit" value="Commit">
    <input type="submit" name="btnRollback" value="Rollback">
    <input type="submit" name="btnVersion" value="Version">
    </td>
    </tr>
    </table>
    <?echo $msg;?> </td>
    </tr>
    </table>
    <br>
    <font face="Verdana, Arial, Helvetica, sans-serif" size="1">don't use ;</font>
    </form>

    But your script is not outputing the result of the query. So how do we view the returned resultset.

  • Format Date TextField using Locale for international apps

    Hello there...
    I am developing an application and I want it to be easily converted to different languages.
    In Brazil, we use the date like dd/MM/yyyy. In the USA, it is MM/dd/yyyy.
    My question is: how can I get the text from a text field and convert it to a Calendar using a Locale (or the default Locale)? I don't want something like
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    I would like something like:
    SimpleDateFormat formatter = new SimpleDateFormat(locale);
    The constructor SimpleDateFormat () without arguments says it builds the parser based on the Locale, but I get a ParseException. I must always specify some parse mask.
    The second issue is the deprecation of a lot of things in java.util.Date. So, I would like to use a Calendar object to store the date, and without the warnings I get when I use date.getMonth() for example.
    My code is something like this:
    String text = dateField.getText();
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;
    try {
    date = formatter.parse(text);
    } catch (ParseException ex) {
    ex.printStackTrace();
    Calendar calendar = null;
    if (data != null) {
    calendar = new GregorianCalendar();
    calendar.set(Calendar.DAY_OF_MONTH, date.getDate());
    calendar.set(Calendar.MONTH, date.getMonth());
    calendar.set(Calendar.YEAR, date.getYear());
    Thanks for helping!
    (Sorry the not so good english :) )

    My question is: how can I get the text from a text
    field and convert it to a Calendar using a Locale (or
    the default Locale)? I don't want something like Have you tried DateFormat.getDateInstance(int style, Locale aLocale)?
    And then is your second question just how to go from a parsed date to a Calendar?
    Calendar calendar = new GregorianCalendar():
    if (date != null)
      calendar.setTime(date);

  • How do u make a new foldler for your apps?

    how do u make a new foldder for organizing your apps

    Find two apps you want to put in a folder. Hold your finger down on one of the apps till they are all jiggling, slide that app onto the other app you want to be in the folder. Name the folder whatever you want. Press the home button when you are done.

  • Unable to delete EPMA Planning app & re-use datasource for new app

    We have EPMA Planning application (v11.1.1.3)
    I am trying to delete a deployed planning application and try to use the same datasource for creating new application.
    I have deleted the application from EPMA application library and deleted it from Planning directory in Shared Services. But, still that datasource is not showing up as available datasource for new application.
    Any ideas to how I can re-use the datasource. Please advise.
    Thanks,
    DV

    You may need to update the planning system tables.
    Go into the planning system relational tables
    Table HSPSYS_APPLICATION, delete row relating to planning app, note the app_id.
    Table HSPSYS_PROPERTIES, delete records with id that you have just stored.
    Table HSPSYS_DATASOURCES, update app_id to -1 for the datasource you use for the planning app.
    Restart Planning.
    Try again.
    Ok?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • TS3297 My CC is just fine and I have been used it for bying apps and ets

    My CC is just fine and I earlier regularly used it without any problems. For the last month or so I keep getting a message "Your billing method is declined. Please choose another payment method." ???? I think this is your error and you HAVE TO CORRECT IT!!!

    These are mainly user-to-user forums, you are not talking to iTunes support here.
    The name and address that your credit card is registered to is exactly the same as you have on your iTunes account, and have you checked with your card issuer to see if it's them that are declining it ? If it's not them then you can try contacting iTunes support and see if they can see why it's being declined : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • Can I use my credit from the iTunes card I bought from a local retailer and use it for in app purchases

    Don't want to make a mistake by using my credit card

    Yes, just redeem the card into your iTunes account.
    Apple - iTunes - Inside iTunes - How to Redeem Free Download Codes and Gift Cards In the App Store and iTunes

Maybe you are looking for

  • Error while starting CE1 DB instance on CE Trial 7.2

    Installed CE 7.2 Evaluation Trial but the MAXDB Instance CE1 is not coming up. I have probably a related error coming in my SAPMMC tool with exit error 503. Tried starting DBMCLI with the cmd dbmcli -d CE1 -u superdba,intel123 db_online but i get an

  • Problem installing Flash Player 10.3

    I was trying to install Adobe Flash Player 10.3, which is apparently the latest version.  When I go to YouTube, there is now a message at the top of the YouTube website that states you must have Adobe Flash Player 10.3 to watch any videos.  So I trie

  • CANNOT import RAW files from CANON 40D to Lightroom 1.2

    My color setup in 40D is sRGB my system is windows XP but when I want to import files from my CF card it will show the message: some import operation were not performed. the files use an unsupported color mode. pls tell me how to solve this problem~

  • JMS Queue up or down

              HI,           As part of the application I am developing, I need to write a message on a JMS           Queue of           another application (called Acq).           Is their anyway of knowing programmatically whether the other application'

  • Number of Entries icon should come on report selection screen

    Hi, In my requirement, I want Number of Entries icon on my report selection screen. Means when i insert the required selection parameter's, then i want to see the total number of entries, which is come after the execution of my report. Please let me