Posts Tagged Windows

Remove DOS carriage return

After writing a shell script on Windows and trying to execute it on Linux, I got the following error message:

/bin/sh^M: bad interpreter: No such file or directory

The problem is obviously because the return line character on Windows and Linux are different. But how to fix it in order to execute it on Linux?
I firstly tried to open it, copy the content of the file and paste it in a new file using only Linux command line, but it didn’t work. ๐Ÿ™

However, I found the following thread which fixed the problem:
http://www.reachdba.com/showthread.php?335-bin-sh-M-bad-interpreter-No-such-file-or-directory-apps11i-Instalation

Here is what you need to do:

  1. Open your file using vi
  2. Write the command :set fileformat=unix
  3. Save the file using :wq

The file should now run on Linux. ๐Ÿ™‚

, , , , , , ,

1 Comment

Image manipulation in VBScript

I am back on Windows development. It is not what I prefer but still, it is development so I am right here! ๐Ÿ˜‰

My task was to upload an image from a website (nothing difficult there) but the application has to resize and crop the uploaded image before saving it on the hard drive in order to save space.
Oh, and I forgot to mention that the website is built in VBScript (it would have been too easy if it has been built in ASP.Net…). ๐Ÿ™„

I went across a lot of image management libraries which work with VBScript during my search:

But I must admit that the most difficult part of this task was to find a good and FREE library.
The one I finally picked is ImageMagick.

Once the library is installed (click here to go to the download page), you can use the following code to resize the image to a maximum of 800 pixels and crop the white space around it:

Dim imageMagick
Set imageMagick = CreateObject("ImageMagickObject.MagickImage.1")

imageMagick.Convert "C:/testimage.jpg", "-fuzz", "10%", "-trim", "-resize", "800x800>", "C:/thumb-testimage.jpg"

Obviously, this tool can do much more than that, but this will be subject of another topic.
Or you can simply read the documentation: http://www.imagemagick.org/Usage/

, ,

1 Comment

Apple UK keyboard layout for Windows

Because I am now working on a .Net project and I don’t want to work on a PC ๐Ÿ˜‰ , I decided to install Windows as guest on my Mac in VirtualBox.

Everything works perfectly fine except that Windows doesn’t like my Apple keyboard. What a surprise! ๐Ÿ™„

After a quick search on Google, I found a fix for:

But I didn’t find anything for the ‘normal’ Apple UK keyboard. Unfortunately, I can’t use the MacBook Pro UK keyboard layout because it is slightly different than the USB and Wireless Apple UK keyboards layout. ๐Ÿ™

So my friend Google ๐Ÿ˜› didn’t leave me any other choice than create my own keymap for this keyboard using the Microsoft Keyboard Layout Creator.

You can download it clicking on the following link: Keyboard Layout Setup Files (English UK – Apple). And here is the source KLC file if you want to make change to it: Source KLC File for English UK – Apple Keyboard Layout.

To use, simply unzip, run setup, and then in your keyboard settings (Control Panel -> Regional and Language Options) change to โ€œUnited Kingdom – Customโ€. You may wish to remove the default UK keyboard to avoid confusion. If it still doesn’t work, don’t hesitate to reboot Windows! ๐Ÿ˜‰

This is working well on my VirtualBox but it should also work on any Windows instance (i.e. VMWare, Parallels, etc).

, , ,

30 Comments