Fixing file permissions on network shares in Cygwin

Are you seeing question marks on network shares in mapped drives?

See this page for more information. Basically, modifying the /etc/fstab fixes the problem:

# For a description of the file format, see the Users Guide
# http://cygwin.com/cygwin-ug-net/using.html#mount-table

# This is default anyway:
# none /cygdrive cygdrive binary,posix=0,user 0 0

# noacl = use the ntfs permissions
C:/cygwin/bin /usr/bin ntfs binary,auto,noacl 0 0
C:/cygwin/lib /usr/lib ntfs binary,auto,noacl 0 0
C:/cygwin / ntfs binary,auto,noacl 0 0
none /cygdrive cygdrive binary,posix=0,user,noacl 0 0

Windows Server 2008 R2 & Windows 7 – Adding network share to library

Ok, so you got Windows server 2008 R2 having some shares you want to add to your Windows 7 library. Here’s the guide to make it to work (without having the files available offline) [from here]:

  1. On Windows 2008 R2 server, do NOT install the indexing service! It’s a Server 2003 version that is not recognized by Windows 7 clients. Instead, install the “Windows Search Service” – you can only pick one or the other so make sure you select Windows Search Service – it’s one of the roles under File Services.
  2. The install wizard should ask you which folders/drives you want to index – choose any data drive (recommend NOT selecting the system/boot drives) that contains files you want to include in your Windows 7 library on the workstations. If you missed this during the install, you can go back to CONTROL PANEL and type “indexing” into the search box to find the indexing options and customize it there (exactly the same way you do with Windows 7).
  3. As soon as the drives have been added, you can now include any locations on those drives in your Windows 7 workstation libraries (even before the server finishes indexing). You will no longer get any warnings that “some locations are not indexed”…everything works as it should!
  4. Make sure the SYSTEM account has full access to the folder you are trying to index

I noticed that the above steps might not be enough. If you are trying to add the network share to library using the computers smb name (e.g. someserver) it should work. Also the ip address should work all right according to my tests (I’ve read somewhere that it might cause problems…). However, In my case I have a dynamic dns service (dyndns.com) set up. Using that domain name (e.g. someserver.ath.cx) does not work when adding share to Windows 7 library. So always use the ip address or smb-name (not the domain name) when adding share to Windows 7 library.

Note that you can find some symbolic link trickery to fool windows to add unindexed folders to library. However, that just adds the folders to the library, but the searches will be slow!

AutoHotKey script for controlling multiple music applications easily

With the following AutoHotkey script you can control multiple media players easily. In windows, by default all the keyboard shortcuts (special media buttons play, previous, next and stop) will go to all applications. Obviously, this will cause problems if I have both Spotify and foobar2000 both running at the same time.

The script solves the situation by examining window titles and the active window. The script uses following logic when deciding the window that will receive the keyboard button press:

  1. Window that is active (determined by examined window title, for example)
  2. Media player that is currently playing a song (determined by examining window title, for example)
  3. The default player

The script should be easy enough to expand to more media players; the only hard thing is to figure how to determine if the player is actually playing something. In foobar2000, the window title is customizable to make the detection easy (DUI: Go to Preferences->Display->Default User Interface, CUI: Preferences->Display->Columns UI->->Main tab). You can append the following format string so that it will display [Playing] if a song is playing

$if($and(%isplaying%,$not(%ispaused%)),'[Playing]',)

UPDATE: The following script will use last activated window as the default player (see step 3).

#InstallKeybdHook

SetTitleMatchMode  2
commandSpotify := 0
commandFoobar := 1

detectMusicPlayers()
{
  ; all variables are global unless prefixed with local
  global
  DetectHiddenWindows, On
  WinGetTitle, spotifyTitle, ahk_class SpotifyMainWindow
  WinGetTitle, foobarTitle, foobar2000
  WinGetTitle, currentTitle, A
  DetectHiddenWindows, Off
  spotifyTitleLength := StrLen(spotifyTitle)
  spotifyActive := InStr(currentTitle, "Spotify")
  foobarActive := InStr(currentTitle, "foobar2000")
  spotifyPlaying := spotifyTitleLength > 7
  foobarPlaying := InStr(foobar2000, "[Playing]")

  if spotifyActive or spotifyPlaying{
    commandSpotify := 1
    commandFoobar := 0 
    ;MsgBox spotify active
  } else if foobarActive or foobarPlaying {
    commandSpotify := 0
    commandFoobar := 1  
    ;MsgBox foobar active
  } else {
    ;MsgBox spotify not playing
    ;Use "defaults" as specified by CheckActivations
  }
  
}

; Check for window activation
SetTimer, CheckActivations, 300


CheckActivations:
  if WinActive("Spotify") {
    ;MsgBox Spotify activated
    commandSpotify = 1
    commandFoobar = 0
  } else if WinActive("foobar2000") {
    ;MsgBox foobar activated
    commandSpotify = 0
    commandFoobar = 1
  }
  
return


; 122 = play/pause handling
SC122::
detectMusicPlayers()

if commandSpotify {
  ControlSend, , {Space}, ahk_class SpotifyMainWindow 
} else if commandFoobar {
  Run "C:\program files (x86)\foobar2000\foobar2000.exe" /playpause 
}
return

; 110	 = PREV  handling
SC110	::
detectMusicPlayers()

if commandSpotify {
  ControlSend, , ^{Left}, ahk_class SpotifyMainWindow 
} else if commandFoobar {
  Run "C:\program files (x86)\foobar2000\foobar2000.exe" /prev 
}
return

; 119	 = NEXT handling
SC119	::
detectMusicPlayers()

if commandSpotify {
  ControlSend, , ^{Right}, ahk_class SpotifyMainWindow 
} else if commandFoobar {
  Run "C:\program files (x86)\foobar2000\foobar2000.exe" /next 
}
return

; 124	 = STOP handling
SC124	::
detectMusicPlayers()

if commandSpotify {
  ; there is no stop in spotify, use "play/pause" instead
  if spotifyPlaying {
    ControlSend, , {Space}, ahk_class SpotifyMainWindow 
  }
} else if commandFoobar {
  Run "C:\program files (x86)\foobar2000\foobar2000.exe" /stop 
}
return

Search PDF files (contents) with Windows 64bit

See this link for details.

Adobe currently bundles a 32-bit PDF iFilter with Adobe Acrobat® 9 as well as free Adobe Reader® 9 software. It uses the Microsoft iFilter interface and allows third-party indexing tools to extract text from Adobe PDF files.

In response to customer requests, Adobe is releasing Adobe PDF iFilter 9 for 64-bit platforms, which will allow searching PDF files on Microsoft® Windows® 64-bit platforms for applications such as Microsoft Office SharePoint Server 2007, Microsoft Exchange Server 2007, and Microsoft SQL Server 2005.

Note that Acrobat Reader does not provide IFilter for 64 bit Windows by default.

Matroska (MKV) video thumbnails in Windows 7 64bit (and 32 bit)

Some time has gone since my previous tips for making video thumbnails work in Windows 7. For some reason these tricks doesn’t seem to work in Windows 7 (not at least in 64 bit). Here’s a guide to fix the thumbnails in Windows 7 (probably works in older versions too!)

Fortunately, there is an easy way to make mkv files show the thumbnails, just install the latest MKV on Windows 7 from divx. Now you are probably thinking that you don’t want to install divx — it’s so 90′s. Fortunately, you don’t have to install anything extra just install the parts you need (meaning that you don’t need any codecs).

The following picture shows the necessary parts you need to have mkv video thumbnails in 64bit Windows 7. This probably works for 32bit too.

Just install these components in DivX

You will also have to install 64 bit video codecs. I prefer ffdshow since it basically contains video codecs for every possible video, in addition it supports hardware accerelated video decoding. You can install ffdshow from here. Just select the 64 bit version under SVN Builds. Notice that the 64 bit ffdshow codecs are still experimental so they might prove to be unstable…I think choosing the “H.264 Decoder” and DivX codec in DivX installer might work just as well for some people. To me it really doesn’t matter so much since the 64 bit codecs are used only for thumbnail generation. The video player I use  (media player classic home cinema, available here) is 32bit and therefore it uses 32 bit codecs. Actually, the media player home cinema is bundled with internal h.264 decoder.

EDIT:Installing the direct show filters is no longer possible. One must install DivX Plus. Only the codec pack is mandatory for thumbnails.

7zip “default programs” on Vista and later

Unfortunately 7zip doesn’t support “Default programs” feature available in windows vista and later. Here’s a thread to associate 7zip to default programs by using a simple reg file.

http://sourceforge.net/projects/sevenzip/forums/forum/45797/topic/3505217

Dragon Age + Windows 7 Backup

microsoft forums thread on the subject

If you install Dragon Age Origins to another drive, let’s say D:, it will cause Windows Backup tool to make image backup of D: drive too.

This is because Dragon Age  contains “Updater service” which Windows considers part of the “core system” and that’s why it creates image backup of D: too. If you don’t want to backup D: drive one option is to move the update service to c: drive and update service’s registry entry accordingly. Please see above link for more details.

Google Chrome and pdfs

This my story of struggle to get Google Chrome working nicely with pdf-files. First I will talk the symptoms and finally I will walk through the suggestions and fixes I found from the web.

So I first installed Chrome version 4.0.223.16 (newest at the time of writing). I already had Acrobat Reader installed.

OK, so basically everything worked just fine,  pdfs opened inside Chrome using the adobe reader plugins. Unfortunately, there Acrobat Reader seems to have some problems on my computer so sometimes it just hangs indefinitely. The problem is that then the Chrome hangs…The whole program!…I know, I know it shouldn’t happen because Chrome should run each tab in its own process but it seems that some compromises has been made when it comes to plugins (like the Acrobat Reader plugin).

OK, I must admit that after you wait something like 10 seconds, Chrome asks if you want to shut down the non-responding plugins. After pressing OK, pdf-tabs come back alive by refreshing them.

This was unsatifactory for me, since the Adobe plugin hanged quite often.

I wanted to know whether the problem was the Acrobat reader or the plugin itself. I tested opening pdf files manually from explorer and found out that sometimes the whole acrobat reader just hanged and I had to force kill it. It’s quite safe to assume that this was the reason why the Chrome sometimes stopped responding too.

Solution Suggestion #1: Disable pdf viewing in Adobe Reader (Open pdfs outside the browser)

  1. Open Acrobat Reader, select Settings/Internet and uncheck the “Display PDF in browser” checkbox.
  2. Restart chrome and open pdf file

When the option is unchecked, Chrome opens every pdf file outside the browser, therefore opening Acrobat Reader. OK, this might be good for some, but it didn’t resolve my problem since the Acrobat Reader itself hanged quite often.

Note: Chrome doesn’t handle this setting very nicely. When you press pdf hyperlink in page, let’s say “http://www.site.com/report.pdf” it opens it outside the acrobat reader, but unlike you might expect the URL bar in Chrome still displays “http://www.site.com/report.pdf” EVEN THOUGH the website is still displayed. None of the stuff in the website is clickable since the real URL is “http://www.site.com/report.pdf”, not “http://www.site.com/”. So ther must understand to press Back-button to get to the web page the link is on. Not very ideal, when compared to IE or FF, for example. At this point I can tell you that I haven’t found a way to Chrome work properly in this situation. So currently there’s no way (as far I can tell) to tell Chrome to open pdfs outside the browser, and not changing the url of the browser to the pdf. Chrome seems to be designed to use the pdf plugin and nothing else.

Solution Suggestion #2: Install alternative pdf viewer, Foxit Reader (Best I’ve found so far)

There exists alternative pdf readers, one of them is Foxit Reader. It’s free but has some ads displayed on the top corner. I thought that this might fix the problems I was having with Acrobat Reader.

I installed Foxit Reader normally and associated all pdf files to it. It worked very fast and didn’t show no problems. PDFs opened automatically using Foxit, as expected.

The problem was that Chrome still opened the files using the acrobat reader!!! This is against all expectations, definately Chrome should respect system’s defaults.

After digging deeper (Note:you can see the used plugins by writing about:plugins to the URL bar) it seems that that Chrome still uses Acrobat Reader pdf plugin and ofcourse the Acrobat plugin opens Acrobat Reader.

I’ve googled way to make Chrome use the Foxit Reader plugin but all suggestions didn’t seem to work (One of them suggested creating Plugins folder inside Chrome directories and moving the foxit plugin dll there, didn’t work for me.)

It seems that Chrome uses Acrobat Reader plugin nppdf32.dll located in

C:\Program Files (x86)\Adobe\Reader 9.0\Reader\Browser

If you just delete the file, pdfs don’t open at all in the browser so that doesn’t work. EDIT: Deletion is enough, and after that Foxit browser works.

What if we replace the file with the Foxit plugin (btw, it’s located in C:\Program Files (x86)\Foxit Software\Foxit Reader\plugins\npFoxitReaderPlugin.dll)

Well, it turns out that after this the Chrome opens pdfs inside the browser, using the Foxit Reader. I’m satisfied with the result, although it’s not perfect. Ideally I would prefer the pdfs opening outside the browser but please note the problems mentioned before.

By the way, the solutions might be easier if you just delete the Acrobat Reader alltogether and install Foxit Reader, probably then Chrome would understand to use Foxit. I’m not ready for this yet (until I’ve verified that Foxit displays the pdfs correctly).

Chrome seems to have some sort of weakness here, I think the user should be able to set which file is opened in what application.

Hopefully this helps someone. Please ask and comment!

For Reference: http://www.geekrant.org/2009/07/08/use-foxit-reader-in-chrome/comment-page-1/