Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

2012-11-30

How to install Groovy on Windows?

Groovy is a great scripting language for the Java platform.

The first step to install it is to download the archive (ZIP).
http://groovy.codehaus.org/Download?nc

The second step is to unzip to a folder.
For example, C:\Java\groovy\2.0.5

Set GROOVY_HOME to the installation folder.

Then, edit the PATH variable, to add, in the beginning:
%GROOVY_HOME%\bin;

Finally, open a new console and execute the following command that should print the installed Groovy version:
groovy -version

How to install the Java Developer Kit on Windows?

The first step is to download the installation package.
The file to get is the Java Developer Kit (JDK)
http://www.oracle.com/technetwork/java/javase/downloads/index.html

The second step is to execute the installer.

To compile and execute Java programs in the console, a few environment variables must be set.

Set JAVA_HOME to the installation folder.
For example, C:\Java\jdk\1.7.0_09

Then, edit the PATH variable, to add, in the beginning:
%JAVA_HOME%\bin;

Finally, to check if everything is OK, open a new console and execute the following commands that should print the installed Java version number:
javac -version
java -version 

That's it! Happy coding!

How to set environment variables in Windows?

Environment variables are values that, once set, become available to all programs running in the computer.

The value of an environment variable can be used like this: %name%. Typically, environment variables are used to specify program paths and settings.

Some environment variables are set by Windows.
%ProgramFiles% holds the value of the program folder (english Windows: C:\Program Files; portuguese Windows: C:\Programas).
%UserName% holds the user name of the user in session.
%UserProfile% holds the home folder of the user in session.

One of the most used environment variables is PATH, that specifies where the operating system looks for programs.
Folders are separated by the ; character.

To see the value of PATH, execute ECHO %PATH% in the console.
Also, the SET command can print and set environment variables.


To set environment variables permanently on Windows, go to Computer System Properties, Advanced, Environment Variables. The following screen-shots illustrate this procedure for Windows 7.




Environment variables can be defined for the current user (user) or for all users (system).


The new settings only take effect for new consoles.

2012-10-03

How to pipe command output to Windows clipboard

Use clip.exe!

Copy Command Line Output to Windows Clipboard Directly:

dir /h | clip – Copy the help manual for DIR command to the clipboard

tracert www.labnol.org | clip – Trace the path from your computer to another website – the output is automatically copied to the clipboard and not displayed on the screen.

netstat | clip - Check if your computer is connecting to websites without your knowledge.

 The clip.exe utility can also be used to copy contents of text files to clipboard directly from the command line.
 clip < C:\AUTOEXEC.bat – this will copy all the text from autoexec.bat to your Windows Clipboard.

2012-02-15

Workaround for SVN+SSH password hell

How to avoid repeating password input in a SVN+SSH session:

(open console)

C:\> SET SVN_SSH=plink.exe -pw xpto
(define password as plink command option;
if you want to set the SSH command using the full path, you have to use either / or \\ to separate folders in path - unlike most path settings in Windows e.g. C:\\PuTTY\\plink.exe)

C:\> svn co svn+ssh://username@server/repo
(svn will execute the command defined in SVN_SSH environment variable, and plink will not prompt for password because it is provided in the command option)

C:\> SET SVN_SSH=
(clear the environment variable that is exposing the password;
you can also just close the console using the 'exit' command)

These commands assume that you have SVN and PuTTY folders in the PATH environment variable.

SSH for Windows

Secure Shell (SSH) allows secure terminal console access to remote computers. It is available out-of-the-box in Linux and Mac, but it is not for Windows.

There are two free implementations available: PuTTY and Tunnelier.
(delicious ssh+windows)

Tunnelier is a more complete product, but PuTTY is simpler and works as well!

2011-09-23

Screen capture

Screen captures are useful for most computer users. You might need to show a screen to someone for help, or to include a computer screen in a report, or just to keep a hard record of something you saw in your computer.

In Windows you can capture the screen using the "Print Screen" key. Just press it and then you can paste the image into any program capable of handling graphics. Also, if you want to capture just the active window, use "Alt" + "Print Screen".

If you want to automate the screen capture task or have additional control, I strongly recommend the Greenshot tool. It's very simple and very effective. And it's also open-source and free!

Also, since Vista, Windows also includes a snipping tool.

To complete the topic of screen capture, I also use the ScreenGrab Firefox extension. It's especially useful if you want to capture a complete web page, without having to scroll the window.

2011-09-06

Install Windows ISO using a USB flash drive

Microsoft has released a tool to burn a Windows disc image to a DVD or, more interesting, to a USB flash drive. However, when I tried to use it, it complained that it did not change the boot record. So, I had to use a tool called bootsect.exe to create the boot sector, with the following command: bootsect.exe /nt60 o:

2011-04-06

How to redirect stdout and sterr to a file in Windows

compute.bat > compute.output 2>&1
"compute.bat" is the command we are executing.
"> compute.output" redirects the console output to a file called compute.output. If ">>" was used instead, the file would be appended.
"2>&1" redirects stderr (2) to where stdout (1) is directed

Reference: StackOverflow post

2011-03-07

Windows 7 Special Admin Folders

Did you known that Windows 7 supports a set of special folders that provide quick access to nearly all administrative tasks in your computer?

I didn't :)

Run the following batch commands to create the folders. The secret is in the extension (typed after the dot) and not in the folder name.

mkdir "Special Folders"
cd ".\Special Folders"
mkdir "God Mode.{ED7BA470-8E54-465E-825C-99712043E01C}"
mkdir "Location Settings.{00C6D95F-329C-409a-81D7-C46C66EA7F33}"
mkdir "Biometric Settings.{0142e4d0-fb7a-11dc-ba4a-000ffe7ab428}"
mkdir "Power Settings.{025A5937-A6BE-4686-A844-36FE4BEC8B6D}"
mkdir "Icons And Notifications.{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}"
mkdir "Credentials and Logins.{1206F5F1-0569-412C-8FEC-3204630DFB70}"
mkdir "Programs and Features.{15eae92e-f17a-4431-9f28-805e482dafd4}"
mkdir "Default Programs.{17cd9488-1228-4b2f-88ce-4298e93e0966}"
mkdir "All NET Frameworks and COM Libraries.{1D2680C9-0E2A-469d-B787-065558BC7D43}"
mkdir "All Networks For Current Connection.{1FA9085F-25A2-489B-85D4-86326EEDCD87}"
mkdir "Network.{208D2C60-3AEA-1069-A2D7-08002B30309D}"
mkdir "My Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
mkdir "Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}"
mkdir "Application Connections.{241D7C96-F8BF-4F85-B01F-E2B043341A4B}"
mkdir "Firewall and Security.{4026492F-2F69-46B8-B9BF-5654FC07E423}"
mkdir "Performance.{78F3955E-3B90-4184-BD14-5397C15F1EFC}"

Enjoy!

Source: PC World

2010-12-15

How to reset Picasa?

Picasa is very nice program by Google to manage photo collections. However, sometimes it is useful to "reset" Picasa to factory settings, especially when you move lots of files around.

*** WARNING *** This procedure will destroy your Picasa settings and your albums.

The first thing to do is to delete the Picasa database and albums.
Exit Picasa and go to %USERPROFILE%\AppData\Local\Google\ (in Windows Vista or 7) or to %USERPROFILE%\Local Settings\application data\google\ (in Windows XP) an delete the Picasa folders.

After this, there is still metadata in ".picasa.ini" or "Picasa.ini" files in the image folders.

Open Windows Explorer, choose "Tools" -> "Folder Options" in the menu, go to the "View" tab, and select the "Show hidden files and folders" option.
Search for *picasa.ini files, check if only the right files were found, and then delete them.

This will completely reset Picasa so you can start fresh!

--

References: Google support thread 1, thread 2

2010-05-19

GNU Plotting

gnuplot homepage


On advice from several friends, I've decided to learn gnuplot to produce graphics for my work.

Demos

Windows installation:

1 - Download Windows package (e.g. gp440win32.zip)

2 - Unzip to a folder (e.g. C:\Program Files\gnuplot)

3 - Define environment variables:
3.1 - (optional) GNUPLOT_HOME = C:\Program Files\gnuplot
Add %GNUPLOT_HOME%\binary to your PATH environment variable
3.2 - GNUPLOT_LIB=
3.3 - (fonts for PNG output) GDFONTPATH=%windir%\FONTS
3.3 - (fonts for PNG output) GNUPLOT_FONTPATH=%windir%\FONTS

4 - Open a new console window and type gnuplot.exe or wgnuplot.exe.

(see README.Windows for more information)

2009-07-27

Partition hacking: installing Windows Vista and openSUSE Linux on the same machine

Once in a while a computer scientist has to install a computer. Sounds simple? Think again, especially if you want to perform a multi boot installation. In this case, the goal was to install Windows Vista and openSUSE Linux.

Here are the steps I followed:

(this procedure destroys all data in the computer so make sure you have all your data stored safely elsewhere before starting something similar)

Step 1 - Create partitions

Insert the Linux installation disc.
Restart your computer. Press key combination at start-up to boot from disc (e.g. F8).

Create the partition scheme:
(the sizes are just examples)

P1 (recovery) - NTFS - 13 GB
P2 WinVista - NTFS - 50 GB
P3 WinData - FAT32 - 500 GB
P4 Extended partition
P4.1 Linux Swap - swap - 8 GB
P4.2 Linux - ext3 - 42 GB

No need to format.

FAT32 is supported by Windows and Linux. This way the data partition can be accessed by both Windows and Linux. The drawbacks of using FAT32 are the maximum file size of 4GB and no security and extended attributes.

Take note of the device name for the Linux partition. It should be something like: /dev/sda6 or /dev/sde6.


Step 2 - Install Linux

Continue Linux installation on partition P4.2.

After installation, the MBR is loaded with GRUB.


Step 3 - Install Windows Vista

Insert the Windows installation disc.
Restart your computer. Press key combination at start-up to boot from disc (e.g. F8).

Install Windows on partition P2.

After the installation, GRUB is replaced in the MBR with Windows Boot Manager. This means that it is no longer possible to boot Linux.

Reboot.

Install drivers.
Run Windows Update until there are no more updates available. It is normal to have a large number of updates.


Step 4 - Restore GRUB

Insert the Linux installation disc.
Restart your computer. Press key combination at start-up to boot from disc (e.g. F8).

Choose the "Rescue mode" option and choose the 'root' user.

Rescue> mount /dev/sda6 /mnt

Rescue> grub

grub> find /boot/grub/stage1
(hd0,5)

grub> root (hd0,5)

grub> setup (hd0)

grub> quit

Rescue> reboot

Restart - GRUB should be back in control of the booting process.

If you wish to change the GRUB menu, just edit the /boot/grub/menu.lst file using Linux.

If at any time you need to restore Windows Boot Manager (for a Windows Service Pack installation, for instance), you can use the free tool EasyBCD.


--

Good luck with your installations!

2009-02-06

Windows Vista is actually OK

Back in the days when Microsoft named the Windows versions by year - Windows 95, 98, 2000 - I had a "golden" rule: never install a Windows version on its year!

This meant that I would wait at least a year after release so Microsoft could finish the product. By the way, this is true not only of Microsoft software but of all software: complex software has bugs; new software has more bugs than older software (assuming it is still being developed, of course).

I applied the "golden" rule to Windows Vista: wait for the first service pack before installing it.

Now that I did, I'm happy with it. Windows Vista is not bad and is actually OK. It got very bad early reviews but now that hardware has caught up with it, and that many bugs have been fixed, using Windows Vista is actually an upgrade from Windows XP. It has several user interface improvements that are worthwhile. The main problem is UAC. It's so annoying I have my doubts it actually makes the system more secure. As a user I just want to click "continue" to get on with what I'm doing.


Screenshot credits: Paul's Computer Service

2008-12-03

Ray Ozzie quotes


I love software, because if you can imagine something, you can build it.

I love Windows, because without it there would be no PC. There would be no PC developers. There might not even be a Web.

I love the ubiquitous Web because of the connections it opened up.

I love competition. But when we're behind a competitor, I hate it when we find ourselves just chasing their taillights.

-- Ray Ozzie - Microsoft's Chief Software Architect - quoted on Wired Magazine (Dec 2008).

2008-11-26

Computer protection policy

One thing is to teach computer security; another thing is living it! Due to the recent theft, I had to practice more of what I "preach".

I redesigned my identity management policy, using a multi-tier approach, to balance usability and overall security.

I upgraded the use of data security mechanisms. Consider Windows file encryption capabilities (don't forget to backup your certificate, though). If you're using a Mac, consider FileVault. TrueCrypt is also highly recommended, for the most sensitive files.

The data backup procedures were also revised. I finally finished a batch file script, relying on Windows robocopy. The easier it is to backup, the more often you can do it. This decreases the chances of data loss. However, remember to find an alternate, safe physical location for your backup disks. They won't be of any use if they're stolen along with your computer. You can also use an on-line backup service, for less sensitive data.

Currently I'm looking at GadgetTrak or similar service, to enhance the chances of recovering a stolen computer.

In short, take good care of your computer, and prepare for worst case scenarios. It can happen to you!

2008-10-28

Windows Azure

Microsoft is announcing a new cloud operating system, called Windows Azure.

See a technical introduction by Manuvir Das, Director of the Windows Azure team.

2008-10-09

In defense of Windows

I used to think Macs were great, but some bad experiences have left me seeing the down side of single-vendor lock-up. I also think that currently Apple is scrambling to keep up with multiple fronts - Mac, iPhone, MacOS - and it's superior quality premise is getting weaker.

For me the ideal solution would be Linux. I like SUSE. But currently I'm pretty comfortable with Windows XP (no, I don't like Vista that much, but eventually will end up using it).

I found the following article with a good case of
Why PCs are better than Macs.

2008-06-24

Launchy power tip

On a previous blog entry I mentioned Launchy, a free Windows utility to launch applications using just the keyboard. It's a highly recommended productivity booster!

Since then, I've been using Launchy and I've even done some tweaking...

- You can launch command line applications by typing: cmd [TAB] command arg1 arg2 ...
- You can also launch web sites by typing: google
[TAB] query

These features are pre-configured in the Options, Plugins menu:


You can create additional entries, like the following for Google I'm Feeling Lucky search:

[Name, URL, Query]
GLucky, http://www.google.com, search?q=%s&btnI

Or entries to quickly search on-line programming documentations:

[Name, URL, Query]
PHP, http://www.google.com, search?q=php.net+5+%s&btnI
Javadoc, http://www.google.com, search?q=site:java.sun.com/j2se/1.5.0/docs/api+%s&btnI

Very handy, huh? ;-)

2008-04-21

Launch applications by typing their name

A student of mine was running a nice utility for Windows to launch applications just by typing their name. It's called Launchy and it's free!

(It is very similar to QuickSilver and Namely for Mac).