Archive | Software RSS for this section

5 Principles of Apple in Their Success Story

Success story of Apple is not a mystery for over a billion of people who are fond of technology products since everyone can easily follow the rise of the company. I know there are plenty of books about Apple and Steve Jobs that talk about their internal-management ideas or secrets which became legend in business management. And one can find tons of articles about Apple’s main principles or even legends. After reading a lot about these, i think it’s important for every constitution to take lessons for themselves. Here i got my own lessons in the following 5 principles.

If you are producing something and if you want to make it like Apple, you can use this prescription:

1- Design in Principles: 3 design principles of Apple are (i) it should be elegant (ii) it should be minimalist (ii) follow the same design outline of company for every single product.

2- Produce easy to use products: This is what they called “user-friendliness”. To be able to reach the most user-friendly product one should try it hard and push the boundaries in quality control.

3- Add some innovation: Apple normally doesn’t invent a new product or product category. Sure, the company did invent the first commercial PC with the Apple II, and the Mac improved on PCs with a graphical user interface and mouse input. But since then, all of Apple’s other products have been recreations of existing products. Apple did not invent the MP3 player; Apple reinvented it and made it better. Apple did not invent the smart phone; Apple reinvented it and made it better. And Apple did not invent the tablet; Apple reinvented it and made it better.

As Apple designer Jonathan Ive said recently, “Our goals are very simple — to design and make better products. If we can’t make something that is better, we won’t do it.” Clearly, Apple applied that thinking first to iPods, then smart phones and more recently, to the iPad.

4- Provide Customer Support: Jobs understood one of the major conundrums of technology: even if you create products that are easy to use, the variety of things that people want to use technology for often creates complexity. Because of this, consumers at all levels may need some hand holding from time to time. I was one of the most vocal critics of Apple when it introduced its first retail store in Tokyo in 2002. I thought it was crazy for Apple to try and go into retail. At the time, and even today, tech retail stores are in decline while big-box stores like Costco and Walmart sell products on price and nothing else.
Apple uses this conundrum to its advantage. Because it keeps product SKUs simple, the salespeople inside the stores know the products really well. Notice that when you go into an Apple store and are greeted by one of the sales staff, you’re not asked, “How can I help you?” Instead they ask, “What would you like to do today?” They go right to the heart of any technology user’s question, a question that’s always related to what they want to do with the technology the user is interested in.

5- Satisfy Yourself: If you order something from a company, they produce it just because they can. Apple’s approach is quite different. The engineers who are creating Apple products actually make them for themselves. And Jobs was the chief “user” of Apple products when he was alive. All of Apple’s products are based on the fact that Jobs represented the real customer. And his engineers had to come to grips with that when designing a product. It has to be something that they personally couldn’t live without.


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:


repositoryformatversion = 0

filemode = true

bare = false

logallrefupdates = true


        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!

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.
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 and num 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 and are located.

7 -) Write ‘./ -run vegas’

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

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


MacOSX: Solution to PYTHIA / HBOOK Problem in Cernlib

Last month, I was trying to compile some pythia codes to calculate snutau (scalar tau) cross section, Pt and eta distributions. But unfortunately my trusted g77 compiler insistently rejected to compile my code with the following errors:

Undefined symbols:
"_pylist_", referenced from:
_MAIN__ in ccJ7qu36.o
"_pyevnt_", referenced from:
_MAIN__ in ccJ7qu36.o
"_pyinit_", referenced from:
_MAIN__ in ccJ7qu36.o
"_hropen_", referenced from:
_MAIN__ in ccJ7qu36.o
"_hlimit_", referenced from:
_MAIN__ in ccJ7qu36.o
"_pystat_", referenced from:
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
"_pydata_", referenced from:
___g77_forceload_0.0 in ccJ7qu36.o
"_hfill_", referenced from:
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
"_hrout_", referenced from:
_MAIN__ in ccJ7qu36.o
"_hbook1_", referenced from:
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
"_hrend_", referenced from:
_MAIN__ in ccJ7qu36.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

After a little research about HBOOK technology, i discovered that it’s a quite old component even before Fortran 77 and the only way to make it run in this way is to include Cernlib components while compiling. But that didn’t work either for MacOsX because probably MacosX version of Cernlib doesn’t support HBOOK libraries although it’s possible for Linux.

Anyway why do we have to use HBOOK? At the end of the day, we just want to have some data files to draw using Paw or Root and it’s possible using Pythia’s own components. So the principle must be “Use Pythia Commands to get an Output file because that’s the easiest way!” Here is my solution: I changed all HBOOK commands to PY..s in my code below and it worked perfect.

Write “g77 -o mycode.x -w mycode.f libpythia6421.a” to compile.

C...All real arithmetic in double precision.
C...Three Pythia functions return integers, so need declaring.
C...Parameter statement to help give large particle numbers
C...(left- and righthanded SUSY, technicolor, excited fermions,
C...extra dimensions).
      PARAMETER (KSUSY1=1000000,KSUSY2=2000000,KTECHN=3000000,
C...EXTERNAL statement links PYDATA on most machines.
C...The event record.
C...Particle properties + some flavour parameters.
C...Decay information.
C...Selection of hard scattering subprocesses.
C...Supersymmetry parameters.

C....Real definitions...
C ....rapidity: YX

C...First section: initialization.

C...Select generic SUSY generation.
C...39:all MSSM processes except Higgs prod.
C...41:stop pair(ISUB=261-265), 42:slepton pair(201-214), 45:sbottom(281-296)
C...ISUB=210,211,212 for slepton+sneutrino

C...Set SUSY parameters in SUGRA scenario.
      IMSS(1)=2		!mSUGRA parameters given to PYTHIA
      RMSS(8)=230D0	!m_0
      RMSS(1)=360D0	!m_1/2
      RMSS(5)=10D0	!tan(beta)
      RMSS(4)=1D0	!sign(mu)
      RMSS(16)=0D0	!A_0

      do kk=1949,1974

C...Channels for W boson
      do kw=206,208

C...If interested only in cross sections and resonance decays:
C...switch on/off initial and final state radiation,
C...multiple interactions and hadronization.
      MSTP(11)=0	! 1:QED radiation
      MSTP(61)=0	! 2:ISR
      MSTP(71)=0	! 1:FSR
      MSTP(81)=0	! 1:multiple int.
      MSTP(111)=0 	! 1:hadronization

C...Initialization for the LHC.
       CALL PYINIT('CMS','e-','e+',3000D0)

C...List resonance data: decay channels, widths etc.
       CALL PYSTAT(2)

C...Book Histograms
	CALL PYBOOK(10,'PT',100,0D0,1000D0)
	CALL PYBOOK(20,'ETA',100,-5D0,5D0)
	CALL PYBOOK(30,'MTAUTAU',100,0D0,2000D0)


C...Second section: event loop.

C...Loop over the number of events.
       DO 200 IEV=1,NEV
        IF(MOD(IEV,500).EQ.0) WRITE(6,*)
     &  'Now at event number',IEV

C...Event generation.
         CALL PYEVNT

C...List first few events.
          IF(IEV.LE.5) CALL PYLIST(1)

C...Fill the masses of interesting (s)particles.
C...Fill pt of particle
       DO I=1,N
C...Catch tau- lepton
       IF((K(I,2).EQ.15).AND.(K(I,1).EQ.1)) THEN

       CALL PYFILL(10,DBLE(PTX),1D0)
C......       CALL HFILL(10,PTX,0.,1.)
C......       CALL HFILL(20,ETAX,0.,1.)
C...Catch tau+ lepton
       IF((K(I,2).EQ.-15).AND.(K(I,1).EQ.1)) THEN
     .   +2.0*(ptaupx*ptaumx+ptaupy*ptaumy+ptaupz*ptaumz)))
C...       CALL HFILL(30,XMTAU,0.,1.)

C...End of documentation and event loops.


C...Third section: produce output and end.

C...Cross section table.
       CALL PYSTAT(1)

C...Histogram close
C...       CALL HROUT(0,ICYCLE,' ')
C...       CALL HREND('SUSY')


       CALL PYDUMP(3,11,1,IHI)
       CALL PYDUMP(3,22,1,IHI)
       CALL PYDUMP(3,33,1,IHI)

A Simple C++ Simulation For Beginners

Phenomenology in physics, mostly deals with the simulation of events and obtaining data from simulations to compare it with real time event datas. Obviously during event processing, it’s not necessary to give extra effort to visuality. So one should not confuse it with visual simulations. We’r just making event based calculations. Therefore you can ask what exactly do we simulate? or can any calculation be a simulation? Notice that in scientific experiments, you always need a satisfactory amount of statistics. So basically you should have a scenario for gathering statistics in simulations. Here i’d like to present a calculation of “Pi” number as a simulation sample. Here we are collecting statistics via producing random numbers which is included a circle with r=1.

Calculation: Pi number
The method: Monte Carlo Simulation
Fundamental Formulas: (pi)r 2 and x2+y2 = 1 (Note that radius of circle is unit 1.)

1-) Write below code and compile it writing “g++ pi.cpp -o pi.x”


using namespace std;
int main(){
	int jmax=1000; // maximum value of HIT number. (Length of output file)
	int imax=1000; // maximum value of random numbers for producing HITs.
	double x,y;    // Coordinates
	int hit;       // storage variable of number of HITs
	for (int j=0;j<jmax;j++){
		x=0; y=0;
		for(int i=0;i<imax;i++){
		if(y<=sqrt(1-pow(x,2))) hit+=1; }          //Choosing HITs according to analytic formula of circle
	cout<<""<<4*double(hit)/double(imax)<<endl; }  // Print out Pi number

2-) To understand the code: We have just 2 loops here. The inner loop produce random number (<1) and uses these numbers for coordinates x,y. “If” condition increases hit number if this (x,y) point locates in the area of quarter circle (Look at the figure below.)

Hit Production Area

The outer loop resets our variables and print out Pi number according to formula: Area of Quarter Circle/ Area of Square = (1/4)πr2/r2 = (1/4)π= accepted hits / total hits = hits / imax.

3-) Run it as “./pi.x > pi.dat”

4-) Draw output file.

Pi Graph

I used below “root macro” to read and convert it to a .root file.

	ifstream in;"pi.dat");
	Float_t x; Int_t nlines = 0;
	TFile *f = new TFile("pi1.root","RECREATE");
	TH1F *h1 = new TH1F("h1","pi_grafik",100,2.5,4.0);
	TNtuple *ntuple = new TNtuple("ntuple","pi","x");
	for (nlines=0; nlines<10000; nlines++) {
		in >> x;
		if (!in.good()) {break;}
		if (nlines < 5) {printf("x=%5f\n",x);}
	printf("%d deger bulundu\n",nlines);
  • Paste above root macro in a C file and name it as “pintuple.c”
  • Open your root analysis program in the same directory you saved pintuple.c : “root”
  • Execute the file: “root> .x pintuple.c”
  • You’ll get an ntuple file called “pi1.root”
  • Write “TBrowser g” in root.
  • Open pi1.root file and you’ll get the above histogram. Congratulations 🙂

Cernlib Manual Installation

If you are using Unix/Linux based operating system and having difficulties for installing CERNLIB, the best way is to try the simplest way: manual installation.

1- ) Go to and click “compressed tar files” link which is proper with your system.

2-) cd / (open your root folder)

3-) mkdir cern

4-) copy 3 tar files that you’ve already downloaded (cernlib.tar.gz, cernbin.tar.gz, include.tar.gz)  into cern folder you created.

5-) Go into your Cern folder you’ve already created and write the command:
tar -xvf cernlib.tar
tar -xvf cernbin.tar
tar -xvf include.tar
6-) Create symbolic links in this folder:
ln -s 2006 pro
ln -s 2006 new
(If you don’t have a folder 2006, change it with the name you have exp: 2004,2005,2007…etc)

7-) Now you should set some system variables: write “export” on the command line to see all fixed system variables and their values which has been declared in the past.

8 ) You must change the variables related to CERN. So either write following commands on the command line or add them into your /etc/bashrc file (for unix). If you add them into your /etc/baschrc file, you won’t need to set these variables everytime you open your computer.

export CERN=<Your Cern Directory>
export CERN_ROOT=<Your Cern Directory>
export CERNLIB=$CERN/pro/lib
export CERNBIN=$CERN/pro/bin

IMPORTANT: Please check your environmental variables by writing “export” in your command line. If you installed Cernlib by Fink or apt-get before, you may not get correct CERN_ROOT, CERNLIB or CERNBIN variables. In this case, open corresponding bashrc/profile files and edit your CERN variables. For fink, edit cernlib… csh, sh files under /sw/etc/profile.d folder.

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.