jalilweb.com

You are here: Home
  • Decrease font size
  • Default font size
  • Increase font size
show hidden files in Mac OS X


In terminal type this command to show hidden files, then relaunch finder. 

defaults write com.apple.finder AppleShowAllFiles -bool true

set to false, the command will hide the hidden files again. SimpleS :)

 
how to calculate the number of bits in an integer

if you want to know the number of bits constituting an integer look no further. Here is a very simple solution.

int get_number_of_bits(int the_number){
           int bits = 1;
           int div = (the_number/2);
           while(div != 0){
                      bits++;
                      div = div/2;
           }
           return bits;
}

 

So this is just a simple division by 2 loop, that counts the number of times we could divide the number by two without the result being less than 1 (which is the number of bits -1).

This works for positive integers from 0 and up.

 

Now if you wanted to know the number of bits required to represent a number of elements (i.e. you want to know how many bits would represent a number of states, elements or anything you like)

then use the same algorithm above, except that you need to change the line:  int div = the_number/2   into int div = (the_number-1)/2

this is because, number of states or elements is never 0.

 

Feedback is very welcome.

 

 

 
Wedding Photographer www.PhotoGuru.co.uk

I have been working on a website for a friend of mine. he's a proffessional wedding photographer. He's based in Southampton, and can travel around. The good thing is that the prices are very affordable.

Photo Guru Wedding Photographer

07599 491 703 ()

10 Roberts Road, Southampton, SO15 5DE

Here's the link to the website for more details http://www.photoguru.co.uk

For a map visit this link . If you are looking for other wedding photographers in hampshire then follow this link.

 
Gallerie 1

Here are a few shot's I've taken back in the summer. This is the first time i post one of my pictures using a copyright watermark. Please do not feel offended in any way by this. It is necessary, as there are many thiefs in this world.

 

Click image to open!
Click image to open!
Click image to open!
Click image to open!
Click image to open!
Click image to open!
Click image to open!

 

 
C++: Save Console Output to a File
The most annoying thing when developing console applications (especially under windows) is when you cannot see the entire output when it is too long for the command line window to handle.

The only way around this is to print the output to a file that you can later open and read. You can usually do this by instantiating an output stream and write to it. But there is a simpler and tidier way to achieve that.

Include this line in your Main function:

std::freopen("output.txt", "w", stdout);

What this function does is that it redirects the standard output stream "cout" to the file you specify in its first argument.

Simple, Tidy and Useful.

 
<< Start < Prev 1 2 3 4 5 6 Next > End >>

Results 1 - 5 of 27