Featured Posts

<< >>

Linux (Ubuntu) useful commands

Most of this will work on any Linux distribution, but some commands are Ubuntu Linux specific. Get Ubuntu server version: cat /etc/lsb-release  Empty Ubuntu Gnome Trash from the Command Line: rm -rf ~/.Trash/* Kill user’s processes and logout the user: sudo pkill -u username  extract tar / tar.gz files: To only extract .tar files: tar [...]

Writing an assembly program with visual C++ express/visual studio

Part 1: Part 2: part 3:   The project code: asm1

MySQL common commands

Some mySQL commands you want to keep under you hand. Connecting to a mySQL server: mysql -h host_address -u user -p Viewing all the databases: show databases; Select a database to use: use mydatabase; show db tables (db must be selected): show tables; describe the table content: describe new_table; Selecting all the users in the [...]

Remove the “proudly powered by wordpress” footer

watch here: In this tutorial I used the Notepad++ application, that can be found here.

Removing default window nib in a window based application

When creating a window based application in Xcode4, it usually create an unwanted nib file that represents the default clear white window. Note: your class names will probably be different then mine, try to keep up, it not that hard. Some times we want to remove it and replace it with are own view controller, [...]

Serial port reader

This is a simple Serial reader. You can select the port and start listening on it. Most useful for RFID readers. Download here.

Auto login for windows

Auto login is a small utility I wrote to enable users to automatically login to there winXP machine. The current user need only to enter his password, and that’s all. Note:this was not tested on Win7. Download.  

Enabling the notification panel in unity

The problem? Unity does not show the notification panel. This is a big issue, since some applications reside only there,and without this applet, we can’t call them back after starting them, close them or configure them (yes, we can kill them, but this is something else). we are going to use the command for this [...]

Disabling menu integration in Ubuntu 11.10

If you want to have unity on, but you want to have the menu for each window independent, you need to remove the indicator-appmenu package: sudo apt-get remove indicator-appmenu This will leave unity on, while enabling regular window menu. If you want to set it per application, please visit here.

Linux (Ubuntu) useful commands

Most of this will work on any Linux distribution, but some commands are Ubuntu Linux specific.

Get Ubuntu server version:

cat /etc/lsb-release

 Empty Ubuntu Gnome Trash from the Command Line:

rm -rf ~/.Trash/*

Kill user’s processes and logout the user:

sudo pkill -u username

 extract tar / tar.gz files:

To only extract .tar files:

tar xvf archivename.tar

Most of the time, however the archive will probably will be in gzip format as well (tar.gz) so to extract this you can use:

tar xvfz archivename.tar.gz

to extract only some items:

tar xvzf archivename.tar.gz */item.you.want/*

if you encountered with the bz2 extension then you need bzip2 (usually installed) program and this command:

tar yxf archivename.tar.bz2

Change file mode

You need to use the chmod command:

 

http://www.computerhope.com/unix/uchmod.htm

 

 

Writing an assembly program with visual C++ express/visual studio

Part 1:

Part 2:

part 3:

 

The project code:

asm1

MySQL common commands

Some mySQL commands you want to keep under you hand.

Connecting to a mySQL server:
mysql -h host_address -u user -p

Viewing all the databases:
show databases;

Select a database to use:
use mydatabase;

show db tables (db must be selected):
show tables;

describe the table content:
describe new_table;

Selecting all the users in the system:

select host, user, password from mysql.user;

Creating a user:
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';

where you can omit theIDENTIFIED BY if password is not required (but it usually is).

Deleting a user:
DROP USER user;

Assigning a password:

UPDATE mysql.user SET Password=PASSWORD('newpass')
  WHERE User='bob' AND Host='%.loc.gov';
FLUSH PRIVILEGES;

or

GRANT USAGE ON *.* TO 'bob'@'%.loc.gov' IDENTIFIED BY 'newpass';

grant privileges:
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
where you can replace ALL PRIVILEGES with any privilege that you like.

Revoking privileges:

revoke all privileges  on databasename.* from user;
again, you can replace ALL PRIVILEGES with any privilege that you like.

Show user privileges:

show grants for 'user'@'host';

Clean table – this will remove all the records in the table. unlike the Delete command, this will also reset any counters on the table.

TRUNCATE TABLE tablename;

Remove the “proudly powered by wordpress” footer

watch here:

In this tutorial I used the Notepad++ application, that can be found here.

Removing default window nib in a window based application

When creating a window based application in Xcode4, it usually create an unwanted nib file that represents the default clear white window.

Note: your class names will probably be different then mine, try to keep up, it not that hard.

Some times we want to remove it and replace it with are own view controller, here is how:

  1. delete the default MainWindow.nib. You can totally delete it, assuming you have no information in it.
  2. Click on the project (above the files – blue strip) and select the target. on the right, go to info, locate the “main nib file base name” line and remove it entirely. You can run your application now with no errors (and no output…).
  3. I assume that you have created a view controller. if not create it now. Go to your app delegate file header and import the header for your master view.
  4. declare a property for that controller and synthesize it on the m file.
  5. now we need to create the default window: self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; add this to the application didFinishLaunchingWithOptions function. BTW – the reason that we didn’t get an exception so far is because once the main nib is deleted, the entire application function will not be called.
  6. next, create the nib file: mainController=[[SwitchViewController alloc]initWithNibName:@”MainView” bundle:nil];
  7. then, assign the master controller to the window: [self.window setRootViewController:mainController];
  8. Now, the application is not even aware at this point of its delegate. This is bacause we delete the main nib file, so changes must also be done to the main.m file, hiding sometimes in the supporting files folder. this is actually very simple – just feed the UIApplicationMain function the delegate it deserves! So, instead of the default UIApplicationMain(argc, argv, nil, nil); replace the last nil with your class delegate name, like so: UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

Now it’s working

NSStringFromClass gives a string… from the class. which is what this function requires, in case there is no nib file that loads that data for us.

 

Serial port reader

This is a simple Serial reader. You can select the port and start listening on it.

Most useful for RFID readers.

Download here.

Auto login for windows

Auto login is a small utility I wrote to enable users to automatically login to there winXP machine. The current user need only to enter his password, and that’s all.

Note:this was not tested on Win7.

Download.

 

Enabling the notification panel in unity

The problem? Unity does not show the notification panel. This is a big issue, since some applications reside only there,and without this applet, we can’t call them back after starting them, close them or configure them (yes, we can kill them, but this is something else).

we are going to use the command for this – there is an options for GUI, but it’s simpler.

just under the terminal, using your own username (no need for sudo or root) use this command:

gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

Now, you might see the “all” part. This does mean that you can select only certain applications to go there, if you want them.

Disabling menu integration in Ubuntu 11.10

If you want to have unity on, but you want to have the menu for each window independent, you need to remove the indicator-appmenu package:

sudo apt-get remove indicator-appmenu

This will leave unity on, while enabling regular window menu.
If you want to set it per application, please visit here.

Who is locking my folder

Sometimes, you need to change or remove a folder. but what to do when you get this pesky message saying that the folder “was being used by another process”?

well, if Windows complains, it is usually right. more then that, it is usually NOT the antivirus. If you suspect it is, here is how to disable most antivirus programs.

So, to get to the process that blocking you from moving the file, you need some help. my best solution for this is the Process Explorer. This is a great tool. now to fine the offending process, you just click find and insert the name of the folder. you will get the process ID and name of the process that blocks it. You can even kill (terminate) the problematic process.

Now, make sure you do not need any data contains in this process, because once you killed it… well, it’s dead, and the data can not be rescued.