Categories
PC Nerding

Counting Plastic Beads

Since I live under a rock, I get to know most of the cool stuff when it is out of fashion. This time my discovery is plastic beads.
I got them at Ikea and I’ve already made everyone else made before me, like Mario shrooms, a couple of PokeMon and PokeBalls, PacMan ghosts and the likes.

But after a while I was wondering how many of them I was using per image and came out with a simple command line tool, using it is simple as writing in you command line

beadscount.exe myimage.png
beadscount.exe "C:\Documents\whatever\myimage.png"

It will output a txt file named myimage.png.txt with a list of colors and how many beads you will need for each color.

You download it here:
beadscount (3001 downloads )
Or copy the C# source from pastebin here. (compile it under .NET or mono, both will work)

Categories
PC Nerding

Work with your Raspberry PI in mobility thanks to your old dusty netbook.

eeepcandraspi
I’m currently working on a Raspberry Pi based fake bomb for some games with my airsoft team and I wondered “what if the bomb suddenly stop working while I’m kilometers away from my home?”. I surely need a setup for debugging it while I’m in the wilderness. The use case is not limited to mine’s, there are a number of others case that could benefit from this: Any headless Raspberry Pi that can’t reach your router/switch via an ethernet cable or any access point + web interface configuration (radio controlled vehicles, carpc setups, automation) where wifi-dongle suddenly stopped.
Important note: This is not a full step-by-step guide. I will skip some steps you can find plenty guides on google and I’m assuming you are a little comfortable with working with linux and its command line.

I still had my EEEPC 701 (also know as 4G) lying around and I had no use for it due to its specs, which are similar to PI and far worse than any modern tablet. The battery still lasts for more than an hour so it is great for what I’m doing.
At a glance this is what we are achieving here:
Raspberry Pi ETH < – > ETH Netbook WIFI < – > Your connection of choice (wifi router while in home, mobile tethering while out)
This setup, with proper configuration, will allow you to SSH into your PI and have Internet access on both PI and Netbook.
ETH < – > ETH connection could be substituted by a Serial RS232 < – > USB using a proper adapter. I currently didn’t test this and this guide will not explain how.

Let’s start.

Requirements

Any kind of netbook with both an ethernet and a wifi card, 1-4GB of disk space depending on what distro you use.
Your Raspberry eth0 interface must be configured with allow-hotplug stanza, Raspbian come with this configuration by default.

NetBook preparation

Install your favorite linux distro on your netbook, in my specific case I installed Debian Wheezy on a SD card. There are a tons of guides about installing linux on your pc, so I will skip the explanation of this step and assume you have already installed a Debian-Like distro (eg. Ubuntu).
If you are using a crap pc like mine’s, I strongy recommend to NOT install an heavy desktop environment (Gnome, KDE) or better to not install a desktop environment at all. You will save a lot of space and a bunch of seconds on boot.
Note: most of the command listed here, like restarting services or editing configuration files in /etc folder will require a root login (or using sudo before each command).

After powering our system up and running and logging as root use command:
ifconfig -a
This will give us a list of devices, we should have an eth0 interface and a wlan0 interface. If numbers are different take note and edit configuration files accordingly.
First off we want to connect our wlan card to our access point. If you are using a properly protected connection (eg. WPA2) install wpa_supplicant to avoid useless headaches.
Edit your /etc/network/interfaces and edit/add wlan0 configuration

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant.conf

Now let’s edit wpa_supplicant configuration file to work with our connection (note this work with MY connection, you may have to edit yours)
/etc/wpa_supplicant.conf

network={
    ssid="YOUR-AP-SSID"
    psk="YOUR-PASSWORD"
    proto=WPA2
    key_mgmt=WPA-PSK
    pairwise=CCMP
    group=CCMP
}

To check if everything is ok, type
service networking restart
And your wlan should be up and running.

Now that our netbook is online, it’s a good time to upgrade everything.
apt-get update && apt-get upgrade

Take your time and, once done, edit again your /etc/network/interfaces
This time we will be editing/adding eth0 configuration, assigning it a static ip.

allow-hotplug eth0
iface eth0 inet static
    address 192.168.3.1
    netmask 255.255.255.0

Make sure that address used here does not conflict with the one in your wlan network. For example my wlan is on network 192.168.0.0, so using 192.168.3.0 network on my eth0 card does not conflict. Bring the interface on with ifup eth0

Time to install a dhcp server to serve IPs on eth0 interface, so when we connect our Rapsberry PI it automatically get its IP. Since I’m already using with dnsmasq on my linux dhcp server, I will use it again here. Install it and edit its configuration file.
/etc/dnsmasq.conf

domain=example.com
no-hosts
min-port = 4096
server = 8.8.8.8
server = 8.8.4.4
cache-size = 1000
dhcp-range = 192.168.3.2 , 192.168.3.10 , 255.255.255.0, 1440m
dhcp-option = 3, 192.168.3.1
dhcp-authoritative
interface=eth0

Use service dnsmasq restart to enable it.
If you connect your NetBook and your RPi ethernet cards, dnsmasq will take care of giving your Raspberry PI an IP. You can use command cat /var/lib/misc/dnsmasq.leases to see that IP.

But right now your Raspberry does not have internet access, we must set up NAT.
Edit your /etc/sysctl.conf
and add the line net.ipv4.ip_forward=1
to enable ip forwardarding on boot, then run the command
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
to enable it without rebooting.
Run those three lines to add the needed forwarding rules
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
Save the NAT configuration running the command
sh -c "iptables-save > /etc/iptables.ipv4.nat"

Then edit again your
/etc/network/interfaces
and add the line
up iptables-restore < /etc/iptables.ipv4.nat
and we're done.

Faqs

Q: Do I need a crossover cable?
A: Nineties are gone. Most (if not all) NICs from the last 10 years will work out of the box with regular cables.

Q: Can I power PI from netbook's USB?
A: No, you can't.

Categories
PC Nerding

Windows 8.1 on Dell XPS M1730

Before you ask: why one should waste 120€ and install Win 8.1 on a 2008 pc? My mom bought a cheap notebook with Win 8.1. By specs, that laptop should be a lot slower than mine’s, but Windows 8 seemed really fast. My huge notebook was still running heaviest OS ever Vista Ultimate (ugh!) and I thought it was worth a try.

Now if you are still using this old car and want to upgrade to Windows 8, don’t. I recently upgraded to 120GB SSD (on a SATA II controller) + 750GB 7200rpm disk, 8gb ram, those plus Windows 8 license were in the 350-400€ range and by shelling out 450-500€ you can buy a new laptop at least on par with M1730’s specs, with warranty, support, drivers already installed and all.

What I really liked was the Windows-ish feeling while installing. Really. Installing a new Windows 8 is still like installing the 15 years old Win 98.
First off, while the Microsoft site says you can’t upgrade from Vista, I purchased the download version thinking “easy, I’m gonna download it, put in a USB stick and install”, mostly because I didn’t want to wait for DVD shipment.
First problem. You can’t upgrade from Vista and that was clear, but the real problem was that the download tool won’t even allow you to download files from Vista. Great.
Unearthed I decided to download an ISO and we all know MS don’t have and official ISO download site. I found that MSDN users can download a RTM copy, so I looked for the hash to make sure I could get an untouched (=virus safe) ISO and I torrented it from TPB. Thumbs up for mandatory piracy.
Obliviously MS official DVD to USB tool wasn’t working with that ISO but using dd on Linux did the trick. I plugged my USB stick and rebooted.
Second problem. My CD key was not working during install, but fortunately the torrent came with a temporary one. Another thumb up for piracy.
Third problem. Windows 8 refused to install to my disk: “We couldn’t create a new partition or locate an existing one. For more information, see the Setup log files”. I tried all the methods I could google, using command line to format and repartition it, loading my controller drivers from another USB stick. Here comes the new Windows (9)8. Looks like Windows 8.1 does not install if there is an USB stick plugged in and the installation one counts. The most straightforward solution was to burn a DVD, but my drive doesn’t work anymore so I can’t boot from it. My solution was to build a PXE server then booting from NIC card.
From now the installation worked flawlessly. Before activating I switched to my legit activation key and Windows activated with no complains.

This is not Win 8.1’s fault, but there’s a fourth problem, caused by using an outdated system like my M1730: drivers. Windows 8 recognizes some stuff but you must manually install (take them from Vista 64 bit category): Chipset driver and Logitech LCD driver from Dell support , PhysX driver (see below), nVidia drivers (get them from nVidia site). You may want to install Dell Quickset for controlling LED colors without accessing bios.
Logitech LCD app you get from Dell website will only support 32 Bit applications. Last Logitech Gaming Software will NOT recognize it. I personally don’t care because I only use it as a clock.
If you have an “unknown PCI device” in your device manager, that’s PhysX. Because of M1730’s unique PhysX card model, PhysX card requires and old version (8.09.04, get it here) and it must be installed BEFORE nVidia drivers. It really doesn’t matter installing them tho because new nVidia drivers will not care about it and will use the second graphics card as PhysX processor.
Webcam will not work if you install drivers from Dell, let Win 8 use a generic driver and hide the Creative driver from Windows Update.

While my installation experience have been the worst in my life, until now my use experience with Windows 8 is ok, everything looks a lot faster than Vista, uses roughly 300MB less ram, the new interface is flat and ugly but I use it only as a big shortcut collection. I’m kinda happy with my new OS because it gave my old system some fresh air.