Top windows Questions

List of Tags

I mean 100+ MB big; such text files can push the envelope of editors.

I need to look through a large XML file, but cannot if the editor is buggy.

Any suggestions?

Answered By: Nick ( 327)

I'm assuming that you're on Windows, so I'll recommend gVim. Where Notepad++ will choke on very large files, VIM has chowed through those puppies with little problem.

010Editor on Windows will open GIANT (think 5GB) files in binary mode and allow you to edit and search the text.

Community wiki:

Suggestions are

  • gVim loads entire file into memory first.
  • SlickEdit
  • Emacs (has a low maximum buffer size limit if compiled in 32-bit mode).
  • Large Text File Viewer
  • PilotEdit (loads entire file into memory first).
  • HxD hex editor, but good for large files.

Text editors with 2GB limit: Notepad++, Jujuedit, TextPad

280
Rory Becker

I use Subversion via TortoiseSVN but I hear good things about Git.

Are there any similar tools available for Git on Windows?

Feel free to answer with tools which still in early development.

Answered By: BlaM ( 110)

There is a TortoiseSVN port for GIT: http://code.google.com/p/tortoisegit/

The software installs as shell extension (right-click in Explorer and other file-browsers) and works with sites like GitHub.

I've successfully used it in WindowsXP (x86), Windows Vista (x64) and Windows 7 (x64) environments.

What is the up-to-date way to install pip on windows?

Answered By: Adrián Deccico ( 206)

-- Outdated -- use distribute, not setuptools as described here. --

As you mentioned pip doesn't include an independent installer, but you can install it easily with its predecessor easy_install.

So:

  1. Download the last pip version from here: http://pypi.python.org/pypi/pip#downloads
  2. Uncompress it
  3. Download the last easy installer for Windows: (download the .exe at the bottom of http://pypi.python.org/pypi/setuptools ). Install it.
  4. copy the uncompressed pip folder content into C:\Python2x\ folder (don't copy the whole folder into it, just the content), because python command doesn't work outside C:\Python2x folder and then run: python setup.py install
  5. Add your python C:\Python2x\Scripts to the path

You are done.

Now you can use pip install package to easily install packages as in Linux :)

235
namin

As I sometimes have path problems, where one of my own cmd scripts is hidden (shadowed) by another program (earlier on the path), I would like to be able to find the full path to a program in Windows, given just its name.

Is there an equivalent to the UNIX command 'which'?

On UNIX, which command prints the full path of the given command to easily find and repair these shadowing problems.

Answered By: Michael Ratanapintha ( 312)

Windows Server 2003 and later provide the WHERE command which does some of what which does, though it matches all types of files, not just executable commands. (It does not match built-in shell commands like cd.) It will even accept wildcards, so where nt* finds all files in your %PATH% and current directory whose names start with nt.

Try where /? for help.

232
Chris Noe

What are some of the lesser know, but important and useful features of Windows batch files?

Guidelines:

  • One feature per answer
  • Give both a short description of the feature and an example, not just a link to documentation
  • Limit answers to native funtionality, i.e., does not require additional software, like the Windows Resource Kit

Clarification: We refer here to scripts that are processed by cmd.exe, which is the default on WinNT variants.

(See also: Windows batch files: .bat vs .cmd?)

Answered By: Chris Noe ( 186)

Line continuation:

call C:\WINDOWS\system32\ntbackup.exe ^
    backup ^
    /V:yes ^
    /R:no ^
    /RS:no ^
    /HC:off ^
    /M normal ^
    /L:s ^
    @daily.bks ^
    /F daily.bkf
221
redspike

Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?

The only other way I can think of doing this is to run a Mac VM image on a VMWare server running on Windows, although I'm not too sure how legal this is.

Answered By: Andrew Grant ( 186)

It's certainly possible to develop on a Windows machine, in fact my first application was exclusively developed on the old Dell Precision I had at the time :)

There are two routes;

  1. Install OSx86 (aka iATKOS / Kalyway) on a second partition/disk and dual boot.
  2. Run Mac OS X Server under VMWare.

The first route requires modifying (or using a pre-modified) image of Leopard that can be installed on a regular PC. This is not as hard as you would think, although your success/effort ratio will depend upon how closely the hardware in your PC matches that in Mac hardware - e.g. if you're running a Core 2 Duo on an Intel Motherboard, with a NVidia graphics card you are laughing. If you're running an AMD machine or something without SSE3 it gets a little more involved.

If you purchase (or already own) a version of Leopard then this is a gray area since the Leopard EULA states you may only run it on an "Apple Labeled" machine. As many point out if you stick an Apple sticker on your PC you're probably covered.

The second option is the more costly. The EULA for the workstation version of Leopard prevents it from being run under emulation and as a result there's no support in VMWare for this. Leopard server however CAN be run under emulation and can be used for desktop purposes. Leopard server and VMWare are expensive however.

If you're interested in option 1) I would suggest starting at Insanelymac and reading the OSx86 sections.

I do think you should consider whether the time you will invest is going to be worth the money you will save though. It was for me because I enjoy tinkering with this type of stuff and I started during the early iPhone betas, months before their App Store became available.

Alternatively you could pickup a low-spec Mac Mini from eBay. You don't need much horse power to run the SDK and you can always sell it on later if you decide to stop development or buy a better Mac.

211
Sam Phelps

I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux - I have no other need or interest in moving my OS to Linux so I was wondering if there is a equally good program for Windows.

Answered By: Lailin Chen ( 117)

As jakobengblom2 pointed out, valgrind has a suit of tools. Depending which one you are talking about there are different windows counter parts. I will only mention OSS or free tools here.

1. MemCheck:

Dr. Memory. It is a relatively new tool, works very well on Windows 7. My favorite feature is that it groups the same leaks' allocation stacks in the report.

http://code.google.com/p/drmemory/

I have also used UMDH( http://support.microsoft.com/kb/268343 ) and found it quiet useful and easy to setup. It works from Win2000 to Win7.

AppVerifier is a must have swissknife for windows native code developers, its "memory" checker does similar job http://msdn.microsoft.com/en-us/library/dd371695%28v=vs.85%29.aspx

2. Callgrind:

My favorite is verysleepy ( http://www.codersnotes.com/sleepy ) It is tiny but very useful and easy to use.

If you need more features, AMD CodeAnalystâ„¢ Performance Analyzer is free: http://developer.amd.com/documentation/videos/pages/introductiontoamdcodeanalystperformanceanalyzer.aspx

Windows Performance Analysis tools is free from Microsoft, not very easy to use but can get the job done if you are willing to spend the time. http://blogs.microsoft.co.il/blogs/sasha/archive/2008/03/15/xperf-windows-performance-toolkit.aspx Download: http://msdn.microsoft.com/en-us/performance/cc752957

3. Massif:

Similar(not quite exact match) free tools on windows are:

VMMap from sysinternals : http://technet.microsoft.com/en-us/sysinternals/dd535533

!heap command in windbg : http://hacksoflife.blogspot.com/2009/06/heap-debugging-memoryresource-leak-with.html

4. Cachegrind:

Above mentioned Windows Performance Tools has certain level of L2 cache miss profiling capability but not quite as good and easy to use as Cachegrind.

5. DRD:

Haven't found anything free and as powerful on Windows yet, the only free tool for windows I can find that is slightly close is the "lock" checker in AppVerifier: http://msdn.microsoft.com/en-us/library/dd371695%28v=vs.85%29.aspx

178
Lodle

I can't seem to get the icons to display under Windows 7 and I really miss this from Windows XP.

How can it be fixed?

Answered By: Kris Erickson ( 172)

Windows can only show a limited number of Overlay Icons (15 total, 11 after what Windows uses). Programs like Office Groove, Dropbox, Mozy, Carbonite, etc, will hijack a bunch of the 11 possible overlay icons (boy would it be nice if Microsoft upped the number of these as the number of applications that use them seem to increase and increase)...

You can see what overlays are set up, and change them (at your own risk) in the registry here:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\ShellIconOverlayIdentifiers

If you are using TortoiseCVS (and have nothing else using overlay icons), you will get a couple of TortoiseSVN Icons, and all of your TortoiseCVS icons. This is because the overlay icons are used in alphabetical order. Again, at your own risk (editing the registry may blow up your computer, yada, yada, yada -- and if you are reading Stack Overflow and using Windows and haven't edited the registry, you are a rare beast indeed), feel free to rename them (I suggest putting numbers in front of the ones you want to use and "z_"'s prefixed to the ones you don't need). The TortoiseSVN Shell extensions are nicely named so you know what they do, the TortoiseCVS extensions are not. After looking through the source code, I found the pertinent information:

  • TortoiseCVS0 - In CVS
  • TortoiseCVS1 - Not in CVS
  • TortoiseCVS3 - Conflicted
  • TortoiseCVS4 - In CVS readonly
  • TortoiseCVS5 - Ignored
  • TortoiseCVS6 - Added
  • TortoiseCVS7 - Deleted
  • TortoiseCVS8 - Locked
174
Mike Viens

I have written a simple Java class to generate the hash values of the Windows Calculator file. I am using Windows 7 Professional with SP1. I have tried Java 6.0.29 and Java 7.0.03. Can someone tell me why I am getting different hash values from Java versus (many!) external utilities and/or websites? Everything external matches with each other, only Java is returning different results.

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.zip.CRC32;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Checksum 
{
    private static int size = 65536;
    private static File calc = new File("C:/Windows/system32/calc.exe");

    /*
        C:\Windows\System32\calc.exe (verified via several different utilities)
        ----------------------------
        CRC-32b = 8D8F5F8E
        MD5     = 60B7C0FEAD45F2066E5B805A91F4F0FC
        SHA-1   = 9018A7D6CDBE859A430E8794E73381F77C840BE0
        SHA-256 = 80C10EE5F21F92F89CBC293A59D2FD4C01C7958AACAD15642558DB700943FA22
        SHA-384 = 551186C804C17B4CCDA07FD5FE83A32B48B4D173DAC3262F16489029894FC008A501B50AB9B53158B429031B043043D2
        SHA-512 = 68B9F9C00FC64DF946684CE81A72A2624F0FC07E07C0C8B3DB2FAE8C9C0415BD1B4A03AD7FFA96985AF0CC5E0410F6C5E29A30200EFFF21AB4B01369A3C59B58


        Results from this class
        -----------------------
        CRC-32  = 967E5DDE
        MD5     = 10E4A1D2132CCB5C6759F038CDB6F3C9
        SHA-1   = 42D36EEB2140441B48287B7CD30B38105986D68F
        SHA-256 = C6A91CBA00BF87CDB064C49ADAAC82255CBEC6FDD48FD21F9B3B96ABF019916B    
    */    

    public static void main(String[] args)throws Exception {
        Map<String, String> hashes = getFileHash(calc);
        for (Map.Entry<String, String> entry : hashes.entrySet()) {
            System.out.println(String.format("%-7s = %s", entry.getKey(), entry.getValue()));
        }
    }

    private static Map<String, String> getFileHash(File file) throws NoSuchAlgorithmException, IOException {
        Map<String, String> results = new LinkedHashMap<String, String>();

        if (file != null && file.exists()) {
            CRC32 crc32 = new CRC32();
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
            MessageDigest sha256 = MessageDigest.getInstance("SHA-256");

            FileInputStream fis = new FileInputStream(file);
            byte data[] = new byte[size];
            int len = 0;
            while ((len = fis.read(data)) != -1) {
                crc32.update(data, 0, len);
                md5.update(data, 0, len);
                sha1.update(data, 0, len);
                sha256.update(data, 0, len);
            }
            fis.close();

            results.put("CRC-32", toHex(crc32.getValue()));
            results.put(md5.getAlgorithm(), toHex(md5.digest()));
            results.put(sha1.getAlgorithm(), toHex(sha1.digest()));
            results.put(sha256.getAlgorithm(), toHex(sha256.digest()));
        }
        return results;
    }

    private static String toHex(byte[] bytes) {
        String result = "";
        if (bytes != null) {
            StringBuilder sb = new StringBuilder(bytes.length * 2);
            for (byte element : bytes) {
                if ((element & 0xff) < 0x10) {
                    sb.append("0");
                }
                sb.append(Long.toString(element & 0xff, 16));
            }
            result = sb.toString().toUpperCase();
        }
        return result;
    }

    private static String toHex(long value) {
        return Long.toHexString(value).toUpperCase();
    }

}
Answered By: Jon Skeet ( 224)

Got it. The Windows file system is behaving differently depending on the architecture of your process. This article explains it all - in particular:

But what about 32-bit applications that have the system path hard coded and is running in a 64-bit Windows? How can they find the new SysWOW64 folder without changes in the program code, you might think. The answer is that the emulator redirects calls to System32 folder to the SysWOW64 folder transparently so even if the folder is hard coded to the System32 folder (like C:\Windows\System32), the emulator will make sure that the SysWOW64 folder is used instead. So same source code, that uses the System32 folder, can be compiled to both 32-bit and 64-bit program code without any changes.

Try copying calc.exe to somewhere else... then run the same tools again. You'll get the same results as Java. Something about the Windows file system is giving different data to the tools than it's giving to Java... I'm sure it's something to do with it being in the Windows directory, and thus probably handled "differently".

Furthermore, I've reproduced it in C#... and found out that it depends on the architecture of the process you're running. So here's a sample program:

using System;
using System.IO;
using System.Security.Cryptography;

class Test
{
    static void Main()
    {
        using (var md5 = MD5.Create())
        {
            string path = "c:/Windows/System32/Calc.exe";
            var bytes = md5.ComputeHash(File.ReadAllBytes(path));
            Console.WriteLine(BitConverter.ToString(bytes));
        }
    }
}

And here's a console session (minus chatter from the compiler):

c:\users\jon\Test>csc /platform:x86 Test.cs    

c:\users\jon\Test>test
60-B7-C0-FE-AD-45-F2-06-6E-5B-80-5A-91-F4-F0-FC

c:\users\jon\Test>csc /platform:x64 Test.cs

c:\users\jon\Test>test
10-E4-A1-D2-13-2C-CB-5C-67-59-F0-38-CD-B6-F3-C9
169
Alan Storm

I find working on the command line in Windows frustrating, primarily because the console window is wretched to use compared to terminal applications on linux and OS X such as "rxvt", "xterm", or "Terminal". Major complaints:

  1. No standard copy/paste. You have to turn on "mark" mode and it's only available from a multi-level popup triggered by the (small) left hand corner button. Then copy and paste need to be invoked from the same menu

  2. You can't arbitrarily resize the window by dragging, you need to set a preference (back to the multi-level popup) each time you want to resize a window

  3. You can only make the window so big before horizontal scroll bars enter the picture. Horizontal scroll bars suck.

  4. With the cmd.exe shell, you can't navigate to folders with \\netpath notation (UNC?), you need to map a network drive. This sucks when working on multiple machines that are going to have different drives mapped

Are there any tricks or applications, (paid or otherwise), that address these issue?

Answered By: Maximus ( 120)

Sorry for the self-promotion, I'm the author of another Console Emulator, not mentioned here.

ConEmu is opensource console emulator with tabs, which represents multiple consoles and simple GUI applications as one customizable GUI window.

Initially, the program was designed to work with Far Manager (my favorite shell replacement - file and archive management, command history and completion, powerful editor). But ConEmu can be used with any other console application or simple GUI tools (like PuTTY for example). ConEmu is a live project, open to suggestions.

A brief excerpt from the long list of options:

  • Latest versions of ConEmu may set up itself as default terminal for Windows
  • Use any font installed in the system, or copied to a folder of the program (ttf, otf, fon, bdf)
  • Run selected tabs as Administrator (Vista+) or as selected user
  • Windows 7 Jump lists and Progress on taskbar
  • Integration with DosBox (useful in 64bit systems to run DOS applications)
  • Smooth resize, maximized and fullscreen window modes
  • Scrollbar initially hidden, may be revealed by mouseover or checkbox in settings
  • Optional settings (e.g. pallette) for selected applications
  • User friendly text and block selection (from keyboard or mouse), copy, paste, text search in console
  • ANSI X3.64 and Xterm 256 color

Far Manager users will acquire shell style drag-n-drop, thumbnails and tiles in panles, tabs for editors and viewers, true colors and font styles (italic/bold/underline).

PS. Far Manager supports UNC paths (\\server\share\...)