Showing posts with label windowssucks. Show all posts
Showing posts with label windowssucks. Show all posts

Tuesday, January 10, 2017

Poor man's wget for Windows

Windows not only is an awfully stinking mastodon, but it even lacks the most basic tools commonly available on Linux, such as telnet and wget.

I have found a bare bones wget implementation for Java and duly simplified (I love to strip away all useless exception handling)

import java.io.InputStream;
import java.io.DataInputStream;
import java.io.BufferedInputStream;
import java.net.*;

public class JGet {
    public static void main(String[] args) throws Exception {
        if ((args.length != 1)) {
           System.err.println("\nUsage: java JGet [urlToGet]");
           System.exit(1);
        }
        String url = args[0];
        URL u;
        InputStream is = null;
        DataInputStream dis;
        String s;
        try {
           u = new URL(url);
           is = u.openStream();
           dis = new DataInputStream(new BufferedInputStream(is));
           while ((s = dis.readLine()) != null) {
               System.out.println(s);
           }
        } finally {
           is.close();
        }
    }
}


All the credits to Alexander.

Friday, July 11, 2014

windows remote desktop: The Local Security Authority cannot be contacted

Trying to connect to a Windows 7 Desktop, using "windows remote desktop", get this very explanatory message "The Local Security Authority cannot be contacted".

After wasting one hour to find an appropriate monitor to connect to the box, I discovered that simply the password expired.

Just one extra (of the already billions) reason to hate Microsoft.

Friday, January 24, 2014

Getting rid of Windows line feeds

This script to find infected files:
#!/bin/sh

PATH_TO_SCAN=$1

if [ "${PATH_TO_SCAN}" == "" ]; then
    PATH_TO_SCAN="."
fi

FILELIST=$(find "${PATH_TO_SCAN}" |egrep '\.(java|xml|js|groovy|sql|csv|txt|py)$')

IFS_BCK=$IFS
IFS="
"

for FILEPATH in ${FILELIST}; do
    cat -v "${FILEPATH}" | grep -I -q '\^M'
    if [ $? -eq 0 ]; then echo $FILEPATH; fi
done
IFS=$IFS_BCK


In Eclipse: Windows Preferences, then search "encoding" and set "line terminator" to Unix and Encoding to UTF-8

To convert infected files, in Eclipse do "File/Convert line terminator to..."

Otherwise, in Notepad++ use "edit /EOL conversion"



Sunday, September 22, 2013

VirtualBox: Running a 64 bit host RHEL OS on a 32 bit Windows machine

My VBOX is a
facter | more

architecture => x86_64
hardwareisa => x86_64
hardwaremodel => x86_64
kernelrelease => 2.6.32-279.el6.x86_64
kernelversion => 2.6.32

processor0 => Intel(R) Core(TM) i5-3437U CPU @ 1.90GHz

so it clearly expects a 64 bit OS and 64 bit Processor.

My CPU is clearly up to the task, but the host OS is clearly not (Windows 7 32 bit)



Contrary to popular belief, it can be made to work, as long as you are allowed to enable VT-D hardware virtualization in your BIOS (most likely you will have to provide a password).

This is documented here http://www.virtualbox.org/manual/ch03.html and here http://www.virtualbox.org/manual/ch10.html#hwvirt.

I have managed to make it work on my laptop, but it has crashed several times with a BLUE SCREEN OF DEATH. This seems to happen whenever I hibernate my computer while the Vistual Machine is up and running.

Once more I really regret having to use a Windows guest OS to work...