Monday, June 30, 2014

How to create a MySQL database with default encoding and collation

Hi there, pretty much time since my last post (and I 'll apologise in a future post)!

During the project that I was exposed to, to the company I work for, the last months' google searches resulted finding myself with the difficulty to reach a solution for creating a database with default encoding/character set and collation, so I decided to write this post, when finding some free time.

Assuming that we want to create a MySQL database from command line, with default encoding and collation, the command should look something like this, in a generic format:
CREATE DATABASE [preferred_database_name] DEFAULT CHARACTER SET [preferred_encoding] DEFAULT COLLATE [preferred_collation];

More specifically, if I would like to create a database named test_db, with the default encoding of utf8 and default collation of utf8_general_ci, the generic format, easily converts into:
CREATE DATABASE test_db DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

Pretty easy, huh?! Have a nice week!

Monday, April 21, 2014

Git: Hot to solve fatal: unable to access [url]

So today, while trying to push the latest commit for my last JSF tutorial here, I got an error like this:

fatal: unable to access 'https://github.com/toubou91/JavaCodeGeeks_examples.git/': SSL read: error:00000000:lib(0):func( 0):reason(0), errno 10054

After a small investigation, I found myself reading this thread but the question persisted, as I knew that I had configured properly both my local repo's .git and git's .config file, so I tried pinging my remote repo from a browser.

I noticed that I was prompted to insert my account's credentials (so the reason was that I have been logged out from my remote repo and the local push couldn't match the destination).

After signing-in again, git push succeeded!

Cheers!

Sunday, April 20, 2014

PanelGrid Example in JSF 2.2

Hi there.

So, yesterday, I had some time to write another small tutorial for the JCG community.

You can find the full tutorial here; I also uploaded the source code to my GitHub account.

Have a nice week!

Wednesday, April 16, 2014

How to avoid console errors in older browsers

    

Sunday, March 9, 2014

How to add a single file to an existed GitHub repository

So today, after finishing the required editing about my forthcoming published tutorial on JCG, I wanted to push the final compressed project in the corresponding GitHub repository.

Here is a full guide of how he do something like this:
  • Firstly, locate Git Shell to the directory of the local repository
  • Ensure that you have the right "version" of the remote repository by pulling it: git pull
  • Add the file that you wish to push: git add [filename]
  • Commit changes (it is recommended to also submit a commit message, something that can be done with the -m parameter): git commit -m "your commit message"
  • Push changes to the remote repository: git push
And here's a full screenshot of my effort - yes, you did make it clear; I made a mistake (tried to push without having my repo pulled first) just to demonstrate how helpful is the error handling provided from the shell.
And a personal statement: Finally, I have to admit that learning Git wasn't a pain at all.




Friday, March 7, 2014

How to fix Java heap space error in Maven

So you want to build a maven project but you 're getting an error like this : java.lang.OutOfMemoryError: PermGen space.

What the output says is that you have to define a MAVEN_OPTS environment variable, where you can place your -Xmx and -XX:MaxPermSize memory parameters.

What are you staring at? Go for it!


  • Right click on My Computer and select Properties
  • Click Advanced System Settings on the left
  • Go to the Advanced tab, click the Environment Variables
  • Create a New user variable, under the name of to MAVEN_OPTS and set the Variable value to what the error specified or whatever you need to get it build successfully.


  • Here's a sample configuration :


    Thursday, March 6, 2014

    JSF projects available on GitHub

    I found myself today having a lot of desire to contribute to community, although I needed a lot of rest, so here is my latest commit to my github account : JSF 2.2 projects .


    I know, all of us would prefer the full sources of it, but keeping in mind my full schedule this period, it's the best I could do.