new semester » many things to learn
i now have fully switched from my old computer networks course to generic computer engineering course.
this semester i will learn many different but interesting things. some of which i already have some background.
i will learn
-
computer graphics
learning, geometric modelling, visualization pipeline, color, lightning and shades, canvas, viewports, scenes, ray-tracing, image types, etc.
i will, ultimately, build a game using c++ and opengl. -
compilers
learning how to build a programming language from nothing and thus, building its compiler (should be tough!) -
algorithms' analysis and synthesis
learning about all kinds of algorithms and implementing them in c. analyzing their performance, etc. -
conceptual modelling
learning about how to model an information system (should be very boring)
i think i'll have time to show off some cool stuff i'll learn. be back soon (i hope)
web-sockets » the future of the web
... or so i heard. web-sockets is simply an upgrade to the http tcp connection as it uses http to handshake client and server and then uses the same tcp socket connection for raw communication. the point being, it can bring dual side communications between the client (usually a browser) and the server, instead of the usual http long polling approach. besides, it has a much lower connection delay because there is no http layer overhead.
the catch is (in my view, a minor-catch) » web-sockets (ws) are currently only implemented (as of now), in chrome and safari. firefox had a beta4 pre build with ws but they rolled back because of a bug. other than that, it's a matter of time until all major browsers (chrome, firefox, safari, opera and even ie) have ws working and rocking for the future of the web.
web-sockets must have been implemented many years ago. if you think about it, the browser is, probably, the most used application on any personal computer. you might have an office suite, a music player, chat-client, some games, etc, but the browser is the main area of focus/work.
web-apps are emerging nowadays. everyone is turning to the web more than ever. it makes sense to have a technology like web-sockets.
there is a brief talk on hacker-medley podcast. you can check it on @diogomonica's blog.
so, after discovering this amazing and yet, so old, technology implemented on browsers, i did some tests and got a simple irc-chat-like application. it is a basic command driven communication so one can implement many thing on top.
my goal is to build a game. a 2d game with a real 2d game-engine but that will be for another time.
at the time i started implementing the web-sockets protocol for the server-side, i used php. you can start a php background service by issuing:
$ php -q script.php
and so i got a web-socket server running on the background, done in php.
to communicate back and forth i designed a simple commands protocol and sent utf8 encoded messages written in json. when at the browser, it was very simple to manipulate data but on the server, in php, even with json_encode/_decode, it was not so clean to deal with it. this is where nodejs comes along.
i had already heard about it but never used it. nodejs is, primarily, a server platform that uses javascript as its programming language and sits on top of google's javascript engine v8. it also has an event driven model for i/o, the way real i/o should be handled. yes, you read it well: it uses javascript on the server. it could sound weird but it is amazing and if you're used to javascript on the browser, you'll love the power of it on the server-side.
i have, then, found the perfect platform for my web-sockets server: nodejs. now i have the client's (browser) and the server's code, both in plain javascript, and both communicating through json.
i have to do some code-cleaning but then i'll upload and i'll add a link over here so you can download, try and experiment with the wonders of «the future of the web». i will probably also upload the php version.
ps
here is the code » https://github.com/mwmdev/web-sockets.
note that this is implemented under a game's platform so have that in mind. although client-side is too much simple, it might be kind of hard to read and understand in my gameish version. as for the servers, both php and nodejs are very simple to understand and to follow.
again, any questions, drop me a comment or a reply @mikeziri on twitter.
bmw m3 and fiat 500 – 3d models
i'm kind of rediscovering my old works. i guess i changed a lot! from design to software and networks. nice!
i miss the old days though.
ferrari enzo – 3d model
this is where i stayed, the last time i touched this model. it seems a long time ago and i almost can't remember how to model this stuff.
i hope i have some spare time in the near future, to finish this beautiful car.
how to access your android device through 3g and ssh
on my previous post i made a guide on how to setup sshd server so one can connect to the device remotely and operate through the shell.
if you think about it, it is pretty useless to have a ssh server because most of the time you have the phone with you and so, you are able to connect it to the pc and use adb or any ssh client app.
here is where things get interesting: imagine you lost your phone or it got stollen, wtv. here you have your simple solution to ssh to it:
you can download DynDNS app, go to http://www.dyndns.com/ and create an account. register a hostname and then, simply fill in your username, password, and hostname on the app and it will start updating the device's ip on dyndns.
on the other hand, dyndns will point the chosen hostname to your auto updated device's ip (by dyndns android app) and so, you only have to know your hostname from now on.
all you have to do is have your 3g network on and dyndns will deal with the rest.
as you might have guessed, over wifi you are certainly behind a nat so you won't be able to use this.
how to setup sshd on (rooted) android devices
as i mentioned in the previous post, i'm back in black.
this morning i saw a user reporting on twitter he had lost his android phone.
i then immediately wondered what if it was my phone?
i quickly realized i must have a ssh server on my (rooted) htc desire so i could safely connect to it remotely.
after a few hours of research here is the ultimate guide (i hope) on how to setup ssh on an android rooted device:
#if you aren't root, leave now. you're wasting your precious time
#------------
#if you are, follow along
#run adb as root from your pc or wtv
sudo -s
./adb -d shell
#you are now inside android's shell
su
whoami
#confirm that whoami outputs root
#export path for lazy people
export PATH=$PATH:/sbin:/system/sbin:/system/bin:/system/xbin
#mount /system as r/w
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
#create dropbear etc config folder and sdcard temp folder
mkdir /system/etc/dropbear
mkdir /sdcard/dropbear
#download dropbear binaries (dropbear, dropbearkey [, scp])
#copy dropbear binaries to sdcard
./adb -d push dropbear /sdcard/dropbear/
./adb -d push dropbearkey /sdcard/dropbear/
#optionally » ./adb -d push scp /sdcard/dropbear/
#generate ssh server host rsa and dss keys
cd /etc/dropbear
dropbearkey -t rsa -f dropbear_rsa_host_key
dropbearkey -t dss -f dropbear_dss_host_key
#------------
#optionally » generate client (outsider of phone) pub_key. #1024, 2048, 4096... for trust clients only « on the CLIENT, NOT on the PHONE
ssh-keygen -t rsa -b id_rsa
#copy id_rsa.pub to phone
./adb -d push id_rsa.pub /system/etc/dropbear/
cat id_rsa.pub > authorized_keys
#------------
#mount /system readonly again
sync
mount -o remount,ro -t yaffs2 /dev/block/mtdblock4 /system
#start ssh server in different modes
#1 » password auth only
dropbear -A -N root -U 0 -G 0 -C <password> -p [ip]:<port>
#2 » key auth only
dropbear -A -N root -U 0 -G 0 -s -R /etc/dropbear/authorized_keys -p WLANIP:<port>
#3 » key and password auth
dropbear -A -N root -U 0 -G 0 -C <password> -R /etc/dropbear/authorized_keys -p WLANIP:<port>
#check dropbear is running
ps|grep dropbear
#stop ssh server
killall dropbear
#or
ps|grep dropbear
#then
kill
if something escaped me or if there is any shell-script error, thank god it isn't me who has a problem!
but seriously, tweet me or something.
wait for a future post on how to use ssh over a 3g network and its dynamic ip address...
here i go again on my own
so, 2011 just started. i might (re)start my blog also.
i lost too much time importing old posts from my old blog (built from scratch when i was learning the webz) and didn't pay attention to the content.
so, enough of crying, lets start the year in plain english (sorry if i, sometimes, mistype a word or if my sentences don't actually make any sense. not a native here!)
i hope to post as regularly as possible as it is one of my new years' resolutions: to write (more).
you can also follow my wise words on twitter and other social stuff » http://mwmdev.com.
cya!
cool post