A commit lost in the wrong branch (git cherry-pick case) [Git-2]

I work on an Android project and I made a mistake. I have committed all my work on the wrong branch ! Now I want to repair it and I will use some git commands to achieve that goal. These commands are cherry-pick and rebase.

This article is the first of three where I explain how to correct this. The others are available here:

 

The current situation

I have 5 branches but the 3 most important ones are:

  • develop
  • feature/diagrams
  • feature/DesignBeautifulReceptionScreen

git-2-1-git-branch

Read more

Switching between java JDKs versions on Mac OS X [Shell-2]

For some reason, you want to have more than only one JDKs on your machine. So you have made the installations and want to easily switch between them.

JDKs Inventory

On MacOS, once JDKs are installed, they are located in the /Library/Java/JavaVirtualMachines directory. 

[Terminal-2] Switch JDKs - Terminal analysis - 965*319

As you can see in this screenshot, I have the Java 7 and Java 8 versions available on my Mac. But the 1.8 is my default one.

Read more

The correct short name is “Java EE” [Java-1]

When I watch over the Internet, read some blogs or discussions. Or when I read resume (document or Linkedin). I continuously see that a lot of persons are unsure what the correct abbreviation for the Java Enterprise Edition is.

So let say it, J2SE and J2EE are dead but there is nothing named JEE !

Here are the explanation given by Bill Shannon :

Read more

Use .htaccess mechanism to redirect trafic with Apache [Apache-1]

When you create a website, you may want to store all the content in a dedicated directory. The plus with this way of doing is the ability to easily change for future versions of your blog. You will just have to play with the directory by moving, renaming, etc.

The problem when you do that, is to redirect the users from the root address to this directory.

If your web server is Apache, which is more than probable when you see the usage of web servers for websites.

Then you can create an configuration file named .htaccess with the following content at the root of your domain:

^ at the second line mean the beginning of the line, and $ means the end. Their combination means redirect the whole line (aka the actual URL) to the blog directory. The [L] at the end stands for this rule is the last you will read. Redirect now !

Here is the documentation.

In my case, all the connection made to http://www.software-crafting.com will automatically be redirected to http://www.software-crafting.com/blog.

Git Line ending issue (CRLF would be replaced by LF) [Git-1]

 

When you are playing with Git, you may encounter this situation. Which is, more than painful from my point of view:

[Git-1] EOL issue with Git - git add before

This mean you have an issue with the Operating System EOL (end of line) file format.

Read more

Search informations in multiple files [Shell-1]

You are searching a file containing some text but don’t remember where this damn file is !

I had this problem while I was trying Drupal on my MacBook Pro. I couldn’t find the php.ini file used by MAMP, and used the following command to help me:

This command is pretty much self-explanatory but the important point is that I knew I allready add the parameter “nicolas-xdebug” from a previous test. The options H and n in grep respectively print the name of the file where the pattern is find and the line number.

The result told me that the information I search are:

  • in the file /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
  • at line 1171
  • the full line is xdebug.idekey=”nicolas-xdebug”

[Terminal-1] Search infos in multiple files - php.ini xdebug section

 

I can now update the PHP config file with the parameters needed by Drupal.