Tag archive

HackSheffield hackaton experience

Last weekend has been pretty interesting down here in Sheffy! Me and my brother participated in the local hackaton: HackSheffield (fb event).
Not needing to explain what a hackaton is (previous link to wikipedia opens in a new tab), I’ll describe my point of view. The committee for HackSheffield has been truly amazing. The sponsors, Major League Hacking and The University Of Sheffield very supportive! The organisation was spot on, everything was scheduled with great attention. But let’s proceed with order.
The event was a 24+ gathering of enthusiast developers and curious non-techs. In our case I was the dev and my brother joined me as an interested non-techie.
The sponsors gave brief presentations to open the dances. A team from SkyBet was there, as well as lead-management company DataBowl. Chersoft, Ossila, Wandisco and Huel completed the sponsors lineup.
The hack started at 12 midday on Saturday. Most of the teams were formed already but we found Chris Ingram. Our team focused on one of the datasets provided by the organisation and specifically by Sheffield Uni. It consisted in 64k entries representing human behaviour recorded by sensors. Many of these entries were totally wrong, some were recorded as “unknown” which adds little to no information to the data. Our task was to come up with a solution to reduce the noise in the dataset and to visualise the data. As my brother does not have much experience in code development me and Chris took care of that. Chris developed the visualisation side using node.js, react and gulp. I used python, with numpy and matplotlib to operate on the data.
We set up a Github repo (sadly the data is covered by non-disclosure agreements and could not be shared) and a Devpost project.
The Pasta brothers did some research and came up with a combination of rule-based and classification techniques to reduce the noisiness. We used some simple rules, e.g. collapse an unknown entry if it is between coherent entries. After a couple of hours researching and writing test code for several unsupervised learning techniques (including, k-nearest neighbors and Principal Component Analysis) we decided to use a neural network. We used the features of the dataset as inputs and normalised them (more work needed there) into a numerically stable range. There are a few classes we are trying to capture (e.g. WALKING, IN_VEHICLE, etc.) so we decided to use 6 output neurons (more testing needed here). By splitting the dataset in thirds we could use the first 2/3 for the training phase and the remaining third to test the quality of the classification.
We did not have enough time to carry out an exhaustive testing, as this would have taken too long to mark the correctness of the predictions. We could see from the graphs produced that there was a certain degree of learning but many instances were mis-classified. In my opinion, this is due to the large skew in the class distribution of the data. One class was clearly overrepresented (WALKING) with more than double the instances of the second most common class.
This technical approach won us one of the sponsors prizes. We all got a DBPOWER Hawkeye III Drone. I cannot say how chuffed we were when we received the award and the prize! Really happy times ūüôā
The other hacks were truly amazing! The team who won all the rest of the awards developed a visualisation tool to show on a map the events near the user location, pulling that directly from Facebook! Another team used governmental data (huge files describing London 1 square meter at a time) to plot a map of potential solar panel areas. Some people hacked combining Oculus Rift and Leap Motion. Some really cool stuff on controllers using Myo (an armband which reads the electrical activity of the forearm muscles) to control a remote robot. The list of hacks goes on, incredible effort by all the teams and hackers. Some of which did not go to bed the night before and were still on the stage presenting their work.
Apart from the prize winning or the hack itself, what this experience really gifted me with was the inclusivity, the feeling of being part of a wider community of people. The participants had different background and knowledge areas but were striving to create and to do this in a stimulating and creative environment.

Habemus Raspberry PI

Dear all,

I know… last post was aaaages ago. I’ve been – and I am – really busy but I promise I’ll try to write a bit more now that I have a couple of side projects with my brand new Raspberry Pi.

My main ideas are in the area of home automation: remotely switching on/off on mains, wake-up station reusing an old tv and trying to come up with some way of using an otherwise abandoned kinect. I’ll be working on these side projects only during spare time but hopefully I’ll be able to write about every tiny improvement and share some code as well.

RPi Box I bought a RPi starter kit on Amazon for 50£. It includes the Raspberry Pi model 2 B (Quad Core, 1GB RAM), a snazzy box-case, a 5V 2A power supply, Hdmi and Ethernet cables and a Sandisk Ultra Class 10 MicroSD (8GB pre-imaged with NOOBS).

There are several starter kit, some come already with electronic components and a breadboard, but I will get those separately when I have more time.

Installation is really straightforward and for the hardcore noobs there is plenty of videos and guides to follow for this purpose. I recycled a set of monitor, keyboard and mini-mouse and set it up. WiFI Dongle

As I don’t really like the idea of having the RPi continuously wired to the router I got a wifi dongle from Amazon. It is claimed to be specifically manufactured for Raspberry Pi. I have no idea whether this is true but it works out of the box and pretty well (stability and speed).

 

First thing I want to do is make sure that every time my RPi connects to the router it gets the same local IP so that I can SSH into it.

 

To do so, first find the gateway (router address) with

ip route

and take note of the first line address

default via 192.168.0.1 dev wlan0

Now set up the gateway, netmask, broadcast and the local address you want

nano /etc/network/interfaces

I used 192.168.0.44 as local ip address

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
address 192.168.0.44
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

It is worth rebooting to check if the IP gets assigned properly

An alternative way of setting up a static IP would have been to log in my router and assign 192.168.0.44 to my MAC address. To find the MAC address:

ifconfig wlan0 

wlan0     Link encap:Ethernet  HWaddr 00:0d:60:05:01:1f  
          inet addr:192.168.0.44  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:41369 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6284 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14256133 (13.5 MiB)  TX bytes:821759 (802.4 KiB)

Next step is to set up port forwarding on my router. Each router has a different way of setting the firewall rules for this but, again, there are many guides online and you might be lucky and find a specific guide for your router or just work out how to do it. You will need your local ip (192.168.0.44 in my case). And that is why it is a good idea to have it static. Can you imagine setting up a different rule each time your device connects with a different IP?

Now from a different device connected to the same network

ssh -p XX pi@192.168.0.44

where

  • XX is the port you opened/forwarded on the router
  • pi is the default username on the RPi
  • 192.168.0.44 is your local (static) IP

After setting this up I disconnected my keyboard/mouse/monitor and started accessing the RPi remotely. I can move this tiny piece of hardware around my house and plug it everywhere.

Next step will be accessing remotely over the internet (first step towards boiled remote switch). To do so I’ll have to determine my public IP, which is dynamic. I’ll prepare a python/bash script and write the next mini-guide soon.

Enough for now!

Alvin

phpmyadmin login error ( Cannot log in to the MySQL server )

Having to set up a new desktop today, I was following the usual procedure for phpmyadmin:

– Put the phpmyadmin folder in /Library/WebServer/Documents/phpmyadmin

РAdded the config folder with permissions: chmod o+w /Library/WebServer/Documents/phpmyadmin/config

– Generated config.inc.php with phpmyadmin setup (localhost/phpmyadmin/setup)

– Moved config.inc.php in the phpmyadmin home folder

Still, when trying to log in the UI with the root username and password I was getting this error: “Cannot log in to the MySQL server”.

After resetting the password for mysql 3 times and re-installing entirely phpmyadmin, I stumbled upon a StackOverflow question where Sepp suggested to change localhost to 127.0.0.1 in the config.inc.php file.

Sometimes solutions are that simple.

My two cents for whoever might have the same issue.