Tag Archive | tips

Synchronized Code Developing Using GIT and DROPBOX

Simplify your life, if you have too much troubles in code developing with your staff. One of the usual ways is to use a common server and install a Concurrent Versions System (CVS). If you don’t have such facilities around you, you can get a free common server which always readily serve for your interests using DROPBOX. This is a great service! Subscribe to site, invite your staff and start sharing your code or documents through it now.

When it comes to use a CVS, i can suggest you to make the best of using GIT. It is an free & open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. If your code is in a <code_folder> and you installed GIT successfully, use below steps to be synchronized with your staff using DROPBOX now.

If you are the first person who will share your code with your staff through DROPBOX:

  • Open terminal and cd into your code folder.
  • Write “git init”
  • Write “cd .git” and you’ll see branches, objects and config files here.
  • Edit your git config file writing “nano config”. Your config file should be like that in order to stay synchronized through DROPBOX:

[core]

repositoryformatversion = 0

filemode = true

bare = false

logallrefupdates = true

[user]

        name = <USER NAME>

        email = <EMAIL ADDRESS>

[remote "origin"]

url = /Users/kuday/Dropbox/git-archive/.git

fetch = +refs/heads/*:refs/remotes/origin/*

[branch "master"]

remote = origin

merge = refs/heads/master

  • Save your config file and come back to terminal, then write “git add . ” This will add all of the files in to git repository.
  • Move <codefolder>.git into your DROPBOX and send invitation to your staff to share this code.
  • You’ll see your code repository in sharing after you open your dropbox as <codefolder>.git
If you are not the first person who creates the git repository for your code and you can reach <codefolder>.git file through DROPBOX, things are even easier to clone it into your computer:
  • Open terminal in DROPBOX and copy your <codefolder>.git (–> its behaviour is like a zip file) in to a proper location.
  • Go to this location and write “git clone <codefolder>.git” .This will create back your entire code.
  • Write “cd <codefolder>”
  • Edit your config file in .git folder as above.
  • Write “git add .” on your terminal.
  • Start developing!
SOME USEFUL GIT COMMANDS:

git pull origin master
This command gets the latest changes from your staff. Don’t forget to do it often.
git commit -m “Here will be written some messages after editing the code”
After you decide to share the new version of your code with your staff, this command will search for changed files in the repository and updates DROPBOX. You’ll see a spinning wheel near DROPBOX icon which means that you started sharing you new code.
git log
This will show you the entire history of code developing with users, comments and dates.
gitk 
This command opens a useful interface to trace user activities and changes.
git merge origin
This will merge the separate branches which bear different users developments. Use this command if you believe that your code branching too much.

Fastest Way to Calculate Hadronic Cross Sections

Many of the particle physicists may think that CompHEP is not a proper way of making hadronic calculations. Since in numerical calculations CompHEP treats each subprocess separately, calculation of a process with lots of subprocesses (as it happens usually in calculations for hadron colliders) can be a laborious task. In order to make the task simpler and enable non-GUI calculations both symbolic and numerical programs in CompHEP are equipped with the batch PERL scripts symb batch.pl and num batch.pl correspondingly.

Here’s an example how you can use these scripts:

1 -) Open CompHEP in your working directory as ./comphep

2 -) Enter a scattering process like pb,pb -> t,T.

3 -) Enter C-compiler and complete symbolic calculation.

4 -) You will get the numerical session GUI and see Process, SubProcess, Monte Carlo seesion…etc. Notice that you can only calculate subprocess cross sections here.

5 -) Open a new terminal but don’t close CompHEP numerical session window.

6 -) Open your CompHEP working directory where num_batch.pl and sym_batch.pl are located.

7 -) Write ‘./num_batch.pl -run vegas’

8 -) Write ‘./num_batch.pl -show cs’ and you’ll get the total cross section through all subprocesses.

OR edit process.dat to enter your process and use sym_batch.pl in terminal window to complete symbolic calculations.

Reference: http://arxiv4.library.cornell.edu/pdf/0901.4757v1

MacOSX: Manage Programs that Automatically Launch at Startup

Mac Os X operating system has different options to manage startup items. If you have already installed skype, some messengers, orb or some agents, you may not want to use them at the startup of your computer. To inactivate these processes, actually you should remove your login accounts related to corresponding process. So;

  • Open System Preferences (if it’s not in your Dock, you can go to Apple > System Preferences at the top of the screen)
  • From the System Preferences screen, click the “Accounts” icon under the “System” settings.
  • For each account, there is a “Login Items” tab where you can add and remove programs to automatically launch at startup. If you cannot edit your Login Items there it is one of two things:
    • You do not have proper access to edit the person’s account you are looking at.
    • You have proper access, but you need to “Click the lock to make changes.” Just look at the padlock icon at the bottom-left corner of the page. If it’s locked, that’s what you need to do.