Sometimes you want/need to reset the git folder to complete new code. Rather than simply removing the folder and repository and creating new one, the following method solves the problem in couple of minutes. Follow the instructions, of course, at your own risk! I can simply assure you that I used it and it worked in my case.

So here it goes: If you aren’t in the same folder as your older code or you don’t have your code at all, then get it first!

git pull origin master

To be sure that your are in master, git checkout to master. Then name the branch for the code, which you won’t need anymore (in this case, it is called old_stuff). Though it is not that necessary, it is recommended. In the end, push this branch to origin.

git checkout master
git branch old_stuff
git push origin old_stuff

Now change to a new branch that you want to use (called new_stuff here)

git checkout -b new_stuff

Now you are ready to remove all the old files you don’t need anymore

ls | xargs rm -rf

Copy new files, which you are going to use, in the same folder

cp -r {SOURCE_LOCATION} .

Add all the new copied files to git

git add -A

Commit and push your new branch to origin

git commit
git push origin new_stuff

Now update master for newer branch

git push . HEAD:master

Finally, push the newer version of master to origin

git push origin master

That’s all. You had just reset your git, while still having your older code as old_stuff branch on remote origin. You can remove that branch anytime you want or keep it for future reviews.

Disclaimer: I am not responsible, if it creates any harm to your code or project. I would recommend you to understand each step, before you apply it. Best Luck!!!

Introduction

Torquebox is a Ruby application platform incorporating supports for technologies such as Rails and Sinatra. It has built-in support for services and functionalities like messaging, scheduling, caching, daemons, clustering, load-balancing and high-availability. Basically the following diagramme describes it all.

Torquebox Stack

Torquebox Stack

Some Notes

This guide helps installing and setting up JRuby with Torquebox on Mac OS X Snow Leopard (OS X 10.6.8). This may vary on OS X Lion/Mountain Lion, but basically, it is similar. Creating an app and starting up the server is generally the same in all operating systems.

Installing and Setting Up

Get and install RVM

$ curl -L https://get.rvm.io | bash -s stable —ruby

Find the latest version of RVM

$ rvm get head
$ rvm requirements

Install Ruby

$ rvm install 1.9.3 —with-gcc=clang

Install JRuby

$ rvm get stable && rvm install jruby

Setting up Torquebox Gemset

$ rvm use jruby
$ rvm gemset create torquebox
$ rvm jeruby-1.7.0@torquebox

Install Torquebox Gem

Install Torquebox-Server via RVM and jruby gem install

jruby -S gem install torquebox-server

Install Rails3 for JRuby

jruby -S gem install rails —pre —no-doc —no-ri

Starting Up

Create Your Rails Project

Use the torquebox template for creating a new rails app, it puts it in a subfolder just like normal rails new myapp

$ torquebox rails myapp

Change to Rails App Directory

$ cd myapp

Do a Quick Test, this should load WEBrick

$ jruby script/rails server

Verify ENV vars

Run this and verify that your ENV vars are set properly, if not torquebox deploy/undeploy won’t work

$ torquebox env

Make sure your environment variables look something like this, your username instead of “username”

TORQUEBOX_HOME=/Users/nandan/.rvm/gems/jruby-1.7.0/gems/torquebox-server-2.1.2-java
JBOSS_HOME=/Users/nandan/.rvm/gems/jruby-1.7.0/gems/torquebox-server-2.1.2-java/jboss
JRUBY_HOME=/Users/nandan/.rvm/rubies/jruby-1.7.0

Set your JRUBY Options: run with 1.9.x, turn on jit logging (turn off to make quieter in term)

JRUBY_OPTS="--1.9 -Xjit.logging=true" 
JRUBY_OPTS="--1.9 -Xjit.logging=false"

Optional Stuff

If you added Gems Bundle Install to make sure we’re all set up, if not torquebox rails already handled this

$ jruby -S bundle install

Setup to Run on Torquebox

$ torquebox deploy .

Test Running on Torquebox

$ torquebox run

Browse localhost:8080 and voila! there it is!

Notice: I’m using Mac OSX 10.6.8

Whenever you are developing different websites or testing same website with different versions, having virtual hosts become useful. Here’s the simple procedure how you can create such hosts on your local system.

First of all, you have to start Apache server. You can do it by enabling websharing:
System Prefrences —> Sharing —> Check Enable Web Sharing

Or by typing this command in Terminal.app

>sudo apachectl start

Now enable virtual hosts for the server by commenting out the following line in /private/etc/apache2/httpd.conf

Include /etc/apache2/extra/httpd-vhosts.conf

You have to give now in Apache configuration file to the default folder, which behaves like default webroot folder. In OSX these files are mostly User specific. So edit the file /etc/apache2/users/[USER].conf, to give right permissions

<Directory "/Users/[USER]/Sites/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Now move over to /etc/apache2/extra/httpd-vhosts.conf to define the virtual hosts you want to configure by adding these lines:

<VirtualHost *:80>
    <Directory /Users/[USER]/Sites/[YOUR_WEBSITE.COM]>
        Options +FollowSymlinks +SymLinksIfOwnerMatch
        AllowOverride All
    </Directory>
  DocumentRoot /Users/[USER]/Sites/[YOUR_WEBSITE.COM]
  ServerName [YOUR_WEBSITE].local
</VirtualHost>

Now you just have to add the server name to the /etc/hosts file:

127.0.0.1    [YOUR_WEBSITE].local

Check the consistency of config file syntax by running the command

>sudo apachectl -t

If all went well, then restart the Apache server by issuing the following command:

>sudo apachectl restart

Your virtual site is finally working. Just go to your favorite browser and enter your preferred URL http://%5BYOUR_WEBSITE%5D.local/ and you are ready to go!

Here’s very simple way to import MySQL database from any MySQL dump file with few easy commands.

First start MySQL by connecting to the host with username

mysql -u [YOUR_USERNAME] -p -h [YOUR_HOST]

Fill up square brackets with your credentials. If you are working on personal computer, your host will most probably be localhost. -p is needed if you had set a password to your Username (which you always should).

Now you will be in MySQL prompt. Create a new database with your preferred name and exit from the prompt

mysql> create database [NEW_DATABASE];
mysql> exit;

If you want to replace existing database with same name, you must remove it (drop it) before creating it. This line should prepend above lines in MySQL prompt.

mysql> drop database [OLD_DATABASE];

You are back to shell command prompt. You can simply import the data from dump file into newly created database.

mysql -u [YOUR_USERNAME] -p -h [YOUR_HOST] [NEW_DATABASE] < [DUMP_FILE]

That’s all. You’ve got your precious data in new database.

LaTeX is powerful language for typesetting. It’s very flexible, too. But many times, the writer is stuck with certain symbols, which he/she doesn’t know how to typeset in LaTeX. There’s a wonderful long list of symbols available as PDF file (you can download it from the sidebar of this blog), which is mostly helpful in finding the required symbols. You must have learnt about it in my earlier post. The symbols in the PDF file are sorted after packages.

Nonetheless, if you are looking for very particular symbol with very unique design, it can be pain to go through all pages. Well, there’s a good web-based solution to it, which classifies the symbols based on your writing/sketch.

 

You just do the sketch of the symbol you are looking for, of course, using mouse and you get all the variants of it on the right side with mentions to required package for it. Isn’t it sweet and easy? This works so well, that I found many symbols or variants of them in just few seconds.

This is called Detexify Squared, a project conceived by Philipp Kühl and Daniel Kirsch. I appreciate their efforts. This is surely going to make life of many LaTeX users easier. Please spread the word using services below!

 

I do not know how many of you had problem to get iCloud account displaying in Mail App of iPhone. I thought it appears in this app after I activated iCloud mail in Settings. Unfortunately, it wasn’t the case. So I found a simple solution. I used the same IMAP server for iCloud, which I used for MobileMe. And voila! I get all the iCloud mails in Mail App on iPhone.

Here’s the screenshot of the setting:

20111015-213013.jpg

Follow

Get every new post delivered to your Inbox.

Join 507 other followers

%d bloggers like this: