Awesome. That's my one-word summary of HackUPC this past weekend. Seeing 400 international students take the initiative to turn dreams into reality was an inspiring experience for me and my twin brother @Jofre Espigule.
Friday's night opening ceremony at the Sports Pavilion of Universitat Politècnica de Catalunya.
Hack UPC took place in UPC's North Campus in sunny Barcelona. And it was made possible thanks to Miquel Llobet (founder of Hack UPC), the Major League Hacking, the sponsors (Wolfram, Skyscanner, Everis,...), and an amazing team of volunteers. Here are the TravelDirections to Hack UPC:
Jofre and I got some cool Wolfram swag to give away. We also demoed a bunch of code examples to people interested in the the Wolfram Language. And we helped several teams that came to us with great ideas. Below is one of the hacks I demoed there, a "Weather Station in a Snap" similar to @Arnoud Buzing Arduino Yún weather station but using the new Sense HAT for the Raspberry Pi.
hat = DeviceOpen["SenseHAT"];
bin = CreateDatabin[];
RunScheduledTask[DatabinAdd[bin,<|"temp" -> DeviceRead[hat, "Temperature"], "hum" -> DeviceRead[hat, "Humidity"], "pres" -> DeviceRead[hat, "Pressure"]|>], 120]
Temperature, humidity and pressure measurements were being added in a regular basis at this databin: https://wolfr.am/aDkxtY91.
Now let's take a look at some great Wolfram projects done by students at Hack UPC. The first project that I want to share with you was about cryptography. And it was carried out by two students, Xavier Perranau and Arnau Bordas. Right after signing in to WOLFRAM DEVELOPMENT PLATFORM they got familiarized with functions covered in the WLanguage Guide about Cryptographic Number Theory. Their next step consisted in developing a cloud service to allow users send encrypted messages. And after some trial and errors, they ended up adapting the example Hide Secret Messages in Images from the WL Code Gallery. They called their project Steganography a la Wolfram which allows users to drag and drop an image in two cloud-deployed FormFunction to wether hide a text message on it or decipher a message previously inserted in the image.
Here is how it works. A function called InsertSecretMessage is defined to insert a string into a photo:
InsertSecretMessage[carrierImage_Image, mesg_] :=
Block[{carrierBytes, pixelChannels, secretBits, secretBytes},
carrierBytes = BitAnd[ImageData[carrierImage, "Byte"], 254];secretBits = Flatten[IntegerDigits[ToCharacterCode[ToString[mesg, InputForm, CharacterEncoding -> "ASCII"]], 2, 8]];
secretBytes = Fold[Partition, PadRight[Join[IntegerDigits[Length[secretBits], 2, 48], secretBits], Times @@ Dimensions[carrierBytes]],
Reverse[Rest[Dimensions[carrierBytes]]]]; Image[carrierBytes + secretBytes, "Byte"]]
Then, an advanced FormFunction with four fields named "Message","Image","ByEmail" and "SendTo" is cloud-deployed with the InsertSecretMessage function added inside a conditional to see if the user wants to send the image by email with SendMail or just generate it on the Wolfram Cloud:
CloudDeploy[FormFunction[{"Message"->"String","Image"->"Image","ByEmail"->{True,False},
"SendTo"-><|"Interpreter"->"EmailAddress","Input"->"nomail@exemple.com"|>},
If[#ByEmail==True,SendMail[#SendTo,{"Email from Wolfram",InsertSecretMessage[#Image,#Message]}],InsertSecretMessage[#Image,#Message]]&,
AppearanceRules-><|"Title"->"Wolfram Steganography Insertion","Description"->"Insert your plaintext message here and we will add it to the image of your choice."|>,
FormTheme->"Black"],"insert",Permissions->"Public"]
https://www.wolframcloud.com/objects/user-bb7ad2a9-a624-45e5-a867-8da9c0832887/insert
To get back the previously given string, an ExtractSecretMessage function is declared and inserted in the following simple FormFunction.
ExtractSecretMessage[img_Image] :=Block[{secretData, messageLength},
secretData = Flatten[BitAnd[ImageData[img, "Byte"], 1]];
messageLength = FromDigits[Take[secretData, 48], 2];
secretData = Partition[Drop[secretData, 48], 8];
ToExpression[ FromCharacterCode[FromDigits[#, 2] & /@ Take[secretData, messageLength]]] ]
CloudDeploy[FormFunction["Image"->"Image",ExtractSecretMessage[#Image]&,
AppearanceRules-><|"Title"->"Wolfram Steganography Extraction","Description"->"Insert your image here and you will get the Text"|>,
FormTheme->"Black"],"extract",Permissions->"Public" ]
https://www.wolframcloud.com/objects/user-bb7ad2a9-a624-45e5-a867-8da9c0832887/extract
The project awarded with the Skyscanner Prize was GrooveScanner: quality events on a budget because planning just got easy. A project developed by a group of polish students that consisted in building a service that searches for cheapest most convenient flight and nearest accommodation to the venue requested. What makes it unique is the combination of Skyscanner API and Wolfram Alpha API for Transportation.
Finally, the project that won the Best Use of Wolfram Tech Award was .... DriveFlyTeleport! Sightseeing: The Smart Way. Given three main constrains which are: time, money and the topics a person is interested in, the system determines which places in the area (museums, monuments, places of interest in general) are the best fit. It uses a Wolfram Cloud API and a twitter handle of any given user to get the text content from his timeline and analyze it to see which of the travel options may fit him best: https://github.com/adamszewe/HackUPC-Wolfram
Congratulations to all HackUPC participants for coming up with such amazing projects!
http://hackupc2016.devpost.com/submissions