Friday, March 28, 2014

hide a component in jsf

Sometimes it happens that you want to hide some of your components so that they become invisible to users.
And you may suddenly wonder how to achieve that or which option to use. Fine, JSF makes it pretty easy for you to do that by using the rendered  option which is a boolean with either true or false.
e.g:

this component will become invisible. 

Monday, March 24, 2014

Change Orientation of an android emulator.

 Changing the orientation of your device to test your app is very essential for guaranteeing the user friendliness of your app. With a real device in your hand you just have to turn it up and down from portrait to landscape and  etc... without any issue.   But can you do the same thing when using an emulator ? 

    Just press CTRL + F11 or CTRL + F12 and discover it yourself.

           Contrary to what you may have thought before, it appears now to be pretty easy. I have tested this on windows and hopefully it will work on other OS as well, but If you do face any trouble or have a better way to handle this please as usual don't hesitate to drop a line of comment. 

 That said, stay tuned and have a nice coding day !

Setting SD Card File on your android emulator

Developing apps involving taking some photos from the camera requires the use of  SD card, but how do you set it up. Do you need to rush to the nearby hardware store to get an SD card ? Of course not, the solution just lies on few mouse clicks.
 How to set up a virtual SD card in your eclipse IDE ?  If you are using the ADT bundle you are lucky this post will likely help you out.

1. Go to SDK/tools directory :
    make sure that you have the mksdcard utility available else download SDK manager.

2. Go to the cmd and locate the mksdcard directory and your own sd card called mysdcard:
   
C:\adt-bundle-windows-x86-20130917\sdk\tools>  mksdcard.exe 62M mysdcard
   Press Enter and it is done.
 62M represents the size of your sd card file.

3. Go to the Android Virtual Device manager:

Windows --> Android Virtual Device manager

4.  Select the device and Edit:

5. Make sure you change the back camera option  to Emulated or Webcam()

6. Under SD Card:
    select the File option and browse to the location of mysdcard and select it.
  Click Ok.

7. Rebuild your project , run it and have fun

Due to the lack of time I could not provide you with screenshots but trust me I will insert them next time. If you face any problem, please don't hesitate to drop a comment.
 Aurevoir !!!

Thursday, March 20, 2014

This text field does not specify an inputType or a hint

You a scenario like the following where the text field is showing  the above warning

You omitted to declare the type of your text field.
e.g: if you are  going to enter text ,
then

And it becomes:
Done !

hardcoded string should use @string resource

Even though you can proceed without any major problem the principle of clean code recall us to get rid of all warnings at every steps. Now , suppose you have the following snippet:

Due to the following line :

[I18Nhardcoded string "Country" should use @string resource

Solution:

You have to go to your res folder and there will be a strings.xml file under values, then add the line below:


Then now under your main.xml  replace the existing textView with

Done !

Saturday, March 15, 2014

What is NoSql ?

No matter who you are I am sure that is has already happened one day you ask yourself this question: What is nosql ?  Asking many people out there  what they know about nosql, many of them will mention mostly one of the following terms: cassandra, mongoDb, couchDb, Hbase , something related to big data , to name only these few.
   In fact nosql does not mean that SQL is forbidden or that we should never use it rather nosql raises our attention to the fact that for certain problems other storage solutions are well suited. Therefore finish the era of one fit all, where for any problem at hand we had to automatically use a given version of sql database (mysql, oracle, sql server, etc...). In order to simplify our understanding some key points are going to  guide us and they are:

--Basic definitions:
 NOSQL is NOT ONLY SQL 
 NOSQL is not NO SQL
 NOSQL = next generation of databases
 NOSQL = modern web-scales databases
A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases

-- Why NOSQL is used today ?
 -Size: unprecedented data growth
-Connectedness
-Semi-structure
-Architecture

-- Four (04) emerging NOSQL categories:
-Key-value
-Graph DB
-BigTable
-Document

a) Key-value:
   e.g: -Dynamo
          -Voldemort
          -Riak
         
b) Big Table:
  e.g: -HBase
         -Hyper Table
         -Cassandra
c) Document database:
   e.g: -CouchDB
          -MongoDB
          -IBM lotus

d) Graph database:
   e.g: -Neo4j
          -AllegroGraph
          -Sones graphDB
          -InfoGrid

--NoSQL is not  traditional database, how do I query it ?
  
1. RESTful interfaces using HTTP as an access API
2. Query languages other than SQL:
   - GQL: Google table
   -SPARQL: Semantic web
   -Gremlin: graph traversal language
3.Query APIs
  -Google BigTable datastore API
  -The Noo4j traversal API

--Who is successfully using NoSql ?
  -Facebook
  -Google
  -Yahoo
  -Twitter
  -GitHub
  -Linkedin
  - Maybe you who is reading this post right now (LOL !)

Coming to the end of this post, let me reaffirm again that I am not an expert on nosql but throughout this post I personally wanted to share with you my humble understanding of this promising technology that within a very short period has shown us what it is up to. In a case you have something too to share with us, please don't hesitate to drop a comment. If you are planning to get started with using Nosql I am sure that after reading this post nothing will be like before anymore and that you will confidently move on with your investigations on NoSql.

references:
1. http://www.slideshare.net/thobe/nosql-for-dummies
2. http://en.wikipedia.org/wiki/NoSQL


Thursday, March 6, 2014

Production tips#7 : Password Change in Glassfish SOLVED

Changing password in Glassfish Server can be strange sometime especially everything you do seems not to work. In this example I will focus on the case of Glassfish Server 3.0 or 3+ . I haven't yet tested on other versions. Before throwing some commands against the asadmin shell there are some important things that you need to know or at least be aware of.

  • change-admin-password : to change the admin password for the console login, in many documents out there the defaults of this user are:
 username: admin
 password: adminadmin

 However I have noticed that for Glassfish 3.0 when the installation has been done accepting all the defaults,

 the default credentials of this user are instead:

username: anonymous
password: empty 

  • change-master-password: to change the master password for controlling the DAS and IKS for more info on this read this article.
Now coming back to our aim of changing the admin password for a specific domain :

 asadmin> start-domain mydomain
asadmin> change-admin-password --port 4848 --user anonymous
  here port = your admin console page port.
 You are then prompt for a password:
  Enter admin password> just press[Enter] for accepting an empty password.
  Enter new admin password> your password
  Enter new admin password again> your password
 asadmin> stop-domain mydomain
 asadmin> start-domain mydomain

 Just access your admin console url like http:localhost:4848
  username: anonymous
 password: your password.

Congratulation you just did it ! If you still face any problems drop a comment I will come to your rescue. Don't forget to give us your feedback....




Wednesday, March 5, 2014

Production tips#6 : What do you know about Glassfish Configuration files ?

This time I would like to hear about what you really know about all these glassfish server configuration files.
To help you I'm listing them:
  1. asenv.conf
  2. asadminenv.conf
  3. domain.xml
  4. jbi.xml
  5. resources.xml
  6. server.policy
  7. sun.acc.xml
  8. webservices.xml
  9. wss-client-config.xml
 You usually make changes to these file either through the comnand-line utility or the admin console depending of your preferences, and at the end you have to restart the server for the change to take effects.