Pages

Thursday, March 13, 2014

Getting started with git gui on Windows

Install git for Windows

  • Get a copy of the msysgit .exe installer
  • Double click to install git on your machine
  • Accept all the defaults

A pretend project

For simplicity, let us make a folder for our project in the c:\ drive.
  • Right click on the C:\ drive in Windows Explorer, select “New folder”, name my_idea
  • Right click in my_idea, folder, select New file, of type “Text document”. Name it good_idea.txt.
  • Open good_idea.txt and add some text like “This is my good idea”, and save.

Putting the project into version control

Now we have a very small project, just a folder with a single file in it. We’ll now put this folder into version control.

Initializing the repository

  • Right click in the my_idea folder, choose “Git Init Here” to initialize the git database:
    _images/git_init_rc.png
  • You may notice that there is now a hidden folder called .git in the my_idea folder.
    _images/dot_git_folder.pngIf you can’t see this hidden folder, you may need to change the folder viewing options. From Windows XP explorer this is the “Tools” menu, then “Options”. You should enable viewing hidden folders in the “View” tab:
    _images/folder_options.png

Adding stuff to the repository

Now we have a git database in our folder, we need to add our file.
  • Right click in the my_idea again, choose “Git Commit Tool”
    _images/git_gui_rc.png
  • You will get a dialog like this:
    _images/first_commit_unstaged.pngNotice that our file is at the top left, and is “Unstaged”. That means that, at the moment, it is not going to be part of any “Commit” we do. A commit is where we record changes into the database. We do want to record our file, so
  • Either click on the little icon to the left of the good_idea.txt filename in the dialog, or go to the “Commit” menu, “Stage to commit” option. Notice the good_idea.txt file then goes to the “Staged changes (Will Commit)” section of the dialog.
    _images/first_commit_staged.png
  • Add a message in the lower right box, like The first signs of my idea. The commit message is a reminder what set of changes the commit has. It’s very useful to put meaningful messages here for quick reminders of what you intended with the changes. Now click “Commit”. Congratulations!

Speak with your own voice

Each commit has someone who wrote the contents of the commit - the “author”. So you can get all the blame, and all the credit, you can identify yourself to git. That way git can see who’s doing the work (or doing the damage).
  • Right click in “my idea”, choose “Git Gui”.
  • Click on the “Repository” menu and select “Visualize master’s history”:
    _images/gg_repository_menu.png
  • Notice that you are ‘Author: unknown’:
    _images/first_history.png
  • Close the history window, right click and open ‘Git Gui’ again
  • Go to menu Edit - Options. Set your username and and email address in the Right hand panel (global options).
    _images/setting_self.pngSave. Close.
  • Let’s show ourselves that I have become myself. Make a new file another_idea.txt. Start “Git Commit Tool” with a right click, stage the file by clicking on the icon next to the filename, add a message and the click commit.
  • Open Git history from the Git Gui, choose the “Repository” menu, “Visualize master’s history”. Notice that you have two commits now, and the second one has your name on it.

Making a backup

Now you have your changes backed up into your repository, but you will probably want to back up the repository somewhere.
Let’s pretend to back the repository up to a shared drive (but in fact we’ll back up to the C:\ drive).
  • Right click in the my_idea folder, chose “Git Gui”
  • Choose menu “Remote”, “Add”:
    _images/initial_remote_add.png
  • Give a name for your backup (no spaces) and a path to write the backup to. I like to add .git to the folder name for the backup, because this will be a backup with only the repository (the.git subfolder, but not the .txt files):
  • Select “Initialize repository and push”, then click “Add”.
    _images/remote_add_dialog.png
  • If you get “Success” then your files have been backed up to this other folder.

Working from another machine

Now you can work from any computer and send changes back to the backup copy.
We can pretend to do this by making a new copy as if it was on (say) your laptop. But in fact we’ll create the folder in the C:\ drive again.
  • Right click on the C:\ drive, choose ‘Git Gui’:
    _images/git_gui_main.png
  • Select “Clone existing repository”. For the ‘Source location’, browse to the backup that you just made. Type C:\laptop_working for the target directory. Choose “full copy” from the options (for safety). Click on “Clone”.
    _images/clone_dialog.png
  • You now have a c:\laptop_working folder that is a clone of the “my_backup” repository, and that also has the same data as the c:\my_idea folder.
  • Let’s make some changes on the laptop. Go to the c:\laptop_working folder. Make a new file idea_on_laptop.txt and type some text in it. Save.
  • Right click, “Git Commit Tool”, stage the idea_on_laptop.txt file, add a commit message and click “Commit”.
    Now you have this contents in your laptop_working folder.
    _images/laptop_directory.png
You put the changes back into the backup by doing a “Push”
  • Right click in laptop_working. “Git Gui”, “Remote” menu, “Push ...”
    _images/laptop_remote_menu.pngOn the next dialog, click “Push”.
    _images/laptop_push.pngThe changes go back to the my_backup.git repository.

Getting changes from a common backup

Let’s pretend that we’ve gone back to our original computer and we want the changes that we pushed from the laptop.
  • Go back to the my_idea folder. Notice you don’t have the idea_on_laptop file yet.
  • Right click, “Git Gui”, “Remote” menu, “Fetch from” from the my_backup remote.
    _images/gg_fetch_my_idea.pngNow you have the changes in the repository (the .git subdirectory) - but not in the working tree. Specifically, we don’t have the idea_on_laptop.txt file in the folder yet:
    _images/my_idea_before_merge.pngTo get the file, we need to do a merge. This brings the changes from the repository into the working tree. Open the “Git Gui” if it is not open. Choose the “Merge” menu, “Local Merge” option.
    _images/local_merge.pngIn the dialog, accept the defaults and click “Merge”:
    _images/merge_dialog.pngNow you have your file - and you are synchronized with the laptop.
    _images/my_idea_after_merge.png

Review

  • Code states stored so you can
    • See what you’ve done
    • Go back to an earlier state if you make a mistake
    • Send files to and from different computers
  • If you are working with someone else they can add their changes
    • You can see what they did, they can see what you did
    • It’s easy to undo if one of you makes a mistake
This system is powerful, very useful and sometimes confusing. Consult an expert if you get confused. It is fairly difficult to lose data if you ask an expert after you have made a mistake or got confused.

Netstat tips - Finding open ports

Netstat is a command that some Windows Server admins use every day, while others only use it when there is a problem. I fall into the latter category; I use netstat as a diagnosis tool when something has gone awry, or when I am trying to track something down.
The 10 parameters to the Windows netstat command can display scores of additional information for troubleshooting or everyday use. The most common iteration of netstat is to use the -a parameter, which displays all connections and listening ports. However, netstat displays useful information even without parameters. Here are some pointers on using the netstatcommand:
Fully qualified domain name: The -f parameter will display the fully qualified domain name (FQDN) of the foreign address in the netstat display. This will resolve names internally and externally if possible. Figure A shows the FQDN resolution within netstatFigure A
What process is running on the open port: Tracking down which process identifier (PID) has a port open is quite easy when netstat is run with the -a -n -o combination of parameters. Read my Windows Server 2008 tip on this sequence of commands, and see it in action in Figure B.Figure B
You can take this one step further with the implementation of friendly names for each process with the -b netstat parameter. This parameter requires administrative permissions and is shown in Figure CFigure C
Note that the remote addresses pointing to the 192.168.1.220:3261 address are the Windows iSCSI initiator service and display differently than the other services listed.
Display routing table: If you need to determine why one system has a different experience than another on the same network, netstat can display a route of the current system with the -rparameter. Figure D shows this in use (note the persistent routes section that would display any static routes added to the Windows Server). Figure D
These four netstat commands can greatly add to the troubleshooting efforts for Windows administrators. How else do you use netstat? Share your tips in the discussion.

Add Spell-Checking Dictionary Support to Pidgin Manually

Is there a way to install Spell-checking support manually?

Yes, if the installer isn't able to successfully download and install the dictionaries, you can do so manually.

Versions 2.7.0 and newer use the dictionaries available from the openoffice extension download site. You need to download the appropriate language extension file(s) (files are openoffice extensions *.oxt, which are just zip files that contain additional data). Once you have downloaded a dictionary extension file, you can rename it so it has a .zip extension and then extract the*.dic and *.aff files in it to <Pidgin Installation Directory>\spellcheck\share\enchant\myspell\(create the directories if they don't exist already).
If Pidgin is running, it will need to be restarted for new dictionaries to be recognized.
Versions older than 2.7.0 use Aspell; you can download both the Aspell core and a dictionary from the win32 Aspell website.

Wednesday, March 12, 2014

How to FTP a WordPress Theme

Most people are able to use the WordPress admin options to upload their themes or plugins. Other times, their web host provider is too strict so it becomes necessary to manually upload files to your web server. The most common way to do this is by using an FTP or SFTP (Secure) client.
FTP is short for “File Transfer Protocol” and is basically a fancy name for file uploading. This has been around for years but has recently been replaced by SFTP since FTP does not offer a secure connection.
You should therefore always use SFTP to make sure your username, password, and files are transferred over a secure connection. Most hosting providers offer support for SFTP connections, though you may have to contact them to enable SFTP on your account.

SFTP Clients

Before you’re able to upload files to your server, you need to download an SFTP client. Fortunately there are some open source free versions that work very well so it won’t cost you a dime.
Configuring your SFTP client is beyond the scope of this article but the WordPress Codex has a nice tutorial you can follow (for FileZilla).

FTP Theme Upload Instructions

  1. Unzip your theme .zip file somewhere on your local computer.
  2. After extracting the .zip file, upload the entire theme folder (i.e. classipress, jobroller, etc) via SFTP to your /wp-content/themes/ directory. (file transfer type should be “Auto” and not “ASCII” or “Binary”. This is the default for FileZilla.) The final directory should look something like this /wp-content/themes/classipress/.
  3. You may also upload any plugins you may have via FTP to your /wp-content/plugins/ directory. This step is not required, however.
  4. Now open your web browser and log into WordPress and go activate the theme from “Appearance” => “Themes”. If you don’t see it there or get a message that the “stylesheet is broken”, then you didn’t correctly upload the theme.

Troubleshooting

One of the most common problems is not unzipping the files first before uploading them all. Make sure you unzip the .zip file on your desktop. Then you will see a brand new folder which inside should contain all your theme files. That’s the folder you want to upload using SFTP.

Monday, March 10, 2014

How To Format A Hard Drive To FAT32 In Windows 7 or Vista (or in general)

If you haven't noticed one huge change with Windows 7 is that FAT32 is no longer an option when formatting drives. You are now left with the options of either NTFS or exFAT . OK so your asking what is exFAT? Well its not FAT32, actually its compatible with FAT64.
Format A Hard Drive To FAT32 In Windows 7
Now I need to note you can not format a Hard drive over 32GB to FAT32 unless you use one of these methods. Standard windows will not do it over 32gb. Well never fear, you basically have 2 ways to go about doing this.

Format external drive in FAT32 using DOS

First you need to find what your Hard Drive is named (the label) that is easy to do right click on the hard drive and it will show you in the top box. As you can see mine is called "Storage". You also need to note which drive letter it is. Mine is Drive: N
How To Format A Hard Drive To FAT32 In Windows 7 or Vista
Next thing you need to do is to find your command prompt to do that: Start button > all programs > accessories > Command Prompt
Once you get to command prompt you will see something like this:
How To Format A HardDrive To FAT32 In Windows 7
at the very end just after the > you need to type this:
format /FS:FAT32 X:
**Note: You need to change the X to the letter of your drive.
once you do that it will then ask you these questions:
How To reFormat A Hard Drive To FAT32 In Win 7 or Vista
I have boxed the areas you need to answer:
  • YELLOW: Rename Drive name here - mine was a "N" so that is why it says "N"
  • PINK: What is your drives Lable name (remember we saw it up top) - mine is "Storage"
  • GREEN: Do you want to proceed with format? YES
Once you hit that it will SLOWLY start to format. It took me 5 hours to do a 500GB hard drive. Once its done you will see this:
How To Format A Hard Drive To FAT32 In Windows 7

Friday, March 7, 2014

How to Change, Add, or Remove Startup Programs in Windows 7



information   Information
This will show you how to either add, remove, enable, or disable a startup program in Windows 7.
Note   Note
You can also view the startup logs in Event Viewer (C:\Windows\system32\eventvwr.msc) underApplications and Services LogsMicrosoftWindows, Diagnostics-Performance, and Operational. The logs will be in the middle to show you what ran at startup, how long it took, and more.
warning   Warning
User Account Control prevents programs that require elevated (run as administrator) permission or an administrator password from running automatically when Windows 7 starts. If a program is blocked, you'll see a message in the notification area that says some startup programs need permission to run. You can then right click on the notification area message and either select to run the blocked program by giving UAC permission, remove the blocked program from the startup program list, or ignore the notification and not run the program.





 METHOD ONE 
Through the Program Itself

NOTE: Some programs may have a setting in them to allow it to run at startup or not. You will need to consult the program's documentations on how to do this specifically for their program if it is available for that program.

1. Open the program's settings menu.

2. To Add the Program to Startup
A) Select the program's Run at startup type option.
3. To Remove the Program from Startup
A) Unselect the program's Run at startup type option.



 METHOD TWO 
Through the Startup Folder

NOTE: You can add or remove shortcuts to programs or files from the Startup folder to have them run or open at the startup of Windows 7.

1. Right click on the exe file of the program you want to run at startup, or file to open at startup, and click on Create Shortcut.
NOTE: This is the shortcut that you will add to the Startup folder in either Option One or Option Two below. Skip this step if you are only removing a shortcut from the Startup folder.

A) Do either OPTION ONE "Current User" or OPTION TWO "All Users" below for what you want.


 OPTION ONE 
For Current Single User Only

NOTE: The single (current) user Startup folder is a hidden system folder located at:
C:\Users\(User-Name)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
2. Open the Start Menu, click on All Programs, right click on the Startup folder, click on Open or Explore, and go to step 4below. (See screenshot below)
Name:  Start_Menu_Startup_Folder.jpg
Views: 484834
Size:  127.5 KB
OR

3. In the Start Menu search line, type shell:startup, press Enter, and go to step 4 below. (See screenshot below)
Name:  Start_Menu_shell-Startup.jpg
Views: 475797
Size:  42.2 KB
4. To Add a Startup Program or File Shortcut
A) Drag the shortcut created from step 1 to inside the Startup folder and drop it. (See screenshot below)
Startup Programs - Change-startup_folder.jpg
5. To Remove a Startup Program or File Shortcut
A) Right click on the shortcut in the Startup folder and click on Delete. (See screenshot above)
6. Close the Startup folder when done. (See screenshot below step 5A)


 OPTION TWO 
For All Users

NOTE: The all users Startup folder is a hidden system folder located at:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
2. Open the Start Menu, click on All Programs, right click on the Startup folder, click on Open All Users or Explore All Users, and go to step 4 below. (See screenshot below)
Name:  Start_Menu_Startup_Folder.jpg
Views: 484834
Size:  127.5 KB 
OR

3. 
In the Start Menu search line, type shell:common startup, press Enter, and go to step 4 below.

4. To Add a Startup Program or File Shortcut
A) Drag the shortcut created from step 1 to inside the Startup folder and drop it. (See screenshot below)
Startup Programs - Change-startup_folder_all.jpg
5. To Remove a Startup Program or File Shortcut
A) Right click on the shortcut in the Startup folder and click on Delete. (See screenshot above)
6. Close the Startup folder when done. (See screenshot below step 4A)



 METHOD THREE 
Through System Configuration (msconfig)

NOTE: Using the Selective Startup option in System Configuration (msconfig), you can enable or disable startup programs. You will need to be logged into an administator account, or provide the administrator password to open System Configuration.
WARNING: It would be best to also check the registry entries in METHOD FOUR below as well, since msconfig may not always show all startup programs.

1. Open the Start Menu.
A) In the search line, type msconfig and press Enter. (See screenshot below)
Name:  Start_Menu_msconfig.jpg
Views: 474336
Size:  41.5 KB 
B) Go to step 3.
OR

2. Open the Control Panel (All items view) and click on the Administrative Tools icon, then click on System Configuration. Close the Control Panel and Administrative Tools windows.

3. If prompted, click on Continue for the UAC prompt, or type in the administrator's password.

4. Click on the Startup tab. (See screenshot below)
Tip   Tip
If you look under the Location column for the Start Item, you will see the registry location for it that you can use to remove the startup item using METHOD FOUR below instead.
Name:  System_Configuration_Startup_Tab.jpg
Views: 476760
Size:  160.2 KB
5. To Disable a Startup Program
A) Select a listed startup program and uncheck it. (See screenshot above)

B) Repeat to disable anymore listed startup programs.
6. To Enable a Startup Program
A) Select a listed startup program and check it. (See screenshot below step 4)

B) Repeat to enable anymore listed startup programs.
7. To Disable All Listed Startup Programs
A) Click on the Disable all button. (See screenshot below step 4)

B) Go to step 9.
8. To Enable All Listed Startup Programs
A) Click on the Enable all button. (See screenshot below step 4)
9. Click on Apply. (See screenshot below step 4)

10. Click on the Boot tab, then check the Make all boot settings permanent box and click on OK. (See screenshot below)
Name:  Boot-1.jpg
Views: 466346
Size:  45.6 KB 
11. Click on Yes. (See screenshot below)
Name:  Boot-2.jpg
Views: 463381
Size:  29.7 KB
12. Click on the Restart button to apply. (See screenshot below)
WARNING: This will restart your computer immediately. Save and close anything that you are working on first.
Name:  Restart.jpg
Views: 463847
Size:  46.4 KB



 METHOD FOUR 
Manually in Registry Editor

NOTE: This will allow you to remove a startup program for either the current single user or all users. If you wanted to add a startup program, thenMETHOD TWO above would be a safer and easier way to do so.

1. Open the Start Menu.

2. In the search line, type regedit and press Enter. (See screenshot below)
Name:  Start_Menu_regedit.jpg
Views: 463457
Size:  41.6 KB
3. For "Current User" Only Locations
A) In regedit, go to: (See screenshots below)
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
AND
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

Name:  Current_Reg_Run.jpg
Views: 466910
Size:  101.7 KB

Name:  Current_Reg_RunOnce.jpg
Views: 465654
Size:  79.9 KB
4. For "All Users" Locations
A) In regedit, go to: (See screenshots below)
For 32-bit and 64-bit Windows 7:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
AND
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
AND (If added by Group Policy)
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
AND (If added by Group Policy)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run

AND
For 64-bit Windows 7 only:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
AND
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce

Startup Programs - Change-all_users_reg_run.jpg
Startup Programs - Change-all_users_reg_runonce.jpg
5. In the right pane of Run and/or RunOnce, right click on the startup program you want to remove and click on Delete. (See screenshots above)
NOTE: RunOnce is only to run the program once for the next time that Windows 7 starts up. Run is to run the program everytime that Windows 7 starts up.

6. Click on Yes to confirm deletion.

7. When done, close regedit.



 METHOD FIVE 
Using CCleaner
1. If you have not already, download and install the free program CCleaner.

2. Open CCleaner, and click on the Tools icon (left side) and on the Startup button. (See screenshot below)
Startup Programs - Change-ccleaner.jpg
3. Select a startup item, then either enabledisable, or delete it from the Vista startup programs list. (See screenshot above)



 METHOD SIX 
Through Task Scheduler


Note   Note
By default, you cannot run a elevated (Run as administrator) program that requires UAC permission at startup using the normal Windows 7 startup programs above.

For a Administrator User Account:
You can have Run as administrator (elevated) programs run at startup for a administrator account by running it in a startup task in Task Scheduler.

For a Standard User Account:
You will not be able to run elevated programs at startup for a standard user account though. Only unelevated programs (ex: Notepad).
1. For how to create a startup task, see:

How to Create a Task to Run a Program at Startup and Log On in Windows 7