News
Home Home Contact us Contact
home News Projects Tests Files Follow manatlan on Twitter Sign in
2 weeks ago

VueJS is fun !

VueJS is fun ! It's what angular2 should be ! It takes the good ideas from angular1 and react. It's nearly the perfect framework ! And there is a nearly perfect material design UI : Vue material (not as good as material angular)

I've made a front end for my recalbox libs, which is speedier than my old one (which was in pure js ;-)

I like it, but not more than riotjs3 and its router tag. It miss single file component ! In fact, it exists (.vue), but only with nodejs/browserify ;-(.

But I will consider it for my next things, when I need a material UI (in place of angular1). Coz there aren't any good UI libs for riotjs. And VueJS is a more robust than riotjs/

Comments (View)
2 months ago

The Recalbox is perfect

I always like retro-gaming. I've started with mame on pc, bought a dingoo a320, and 4 months ago : I bought a RaspberryPi 3b to try recalbox. It's just a linux based os for emulation, with simplicity in mind ! (and it's french project!).

It's really pleasant to play metal slug, with a ps3 gamepad ;-)

Although it's really easy to setup. It could be a pain to run some arcade games (can be hard to find compatible romsets). The simplest way is to download a ready-to-use image disk like this one "Brevit Games - Recalbox 4.0.0 Final 32GB 23 Sistemas 7000 Jogos" (you can easily find it as a torrent, google is your friend). It's a 18go zipped file which contains a 32gb image disk. But this one was made with a window [free/share]ware : imageUSB from PassMark Software ;-(. It should be really easy with a window desktop.

But it's easy to create your 32gb micro sdhc with linux. Just extract the content, and type :

sudo dd if=<fullpath_to_the_bin_file> bs=512 skip=1 of=/dev/sdX

Just replace the /dev/sdX with the path to your device, which should be unmounted ! (first time : I tried with the usb device mounted, and it fails at runtime (lot of file errors))

For info : the imageUSB's bin file is a proprietary format, but it's simple, according to this thread it just contains a 512bytes header ! So we only need to skip this block with "bs=512 skip=1".

Hope it could help someone ! (really hard to find the info, for me, so I release it)...

EDIT : It works great ! Just need to re-configure the WIFI, the gamepads, to update to the latest final (4.02). And change language to french. Regarding this compilation, there are some roms which don't work (many lynx)

Comments (View)
3 months ago

Happy birthday iBraining

10 years since iBraining is Online !

No special events today ! No new games, no new version, although I remade it in an angular version, and got a riotjs version too. But I don't have the courage to change anything. Last year, I've made the responsive version for smart devices.

I'm not able to decide if it should go with angular or riotjs. I like riotjs, but theses last weeks I came back to angular, because I'm more productive with angular material.

Comments (View)
3 months ago

CavePilot, finally !

Here is a playable CavePilot. It's based on my old test. It should work (with chrome or firefox) on desktop (with keys) or smart devices (with gyroscope and with chrome only)

It's Single Page Application, made with riotjs2. It's a Progressive Web App, so it can be added to home screen, and should be playable offline.

Everything was made with my online editor, in a browser, on the Paas (Platform as a Service) : Google App Engine.

I've made an android app for CavePilot. But it's just a shelf, for fun ;-). But it's a webapp, so no need to update it to get the latest release, coz I can update it whenever, with a simple browser ;-)

Regarding the game ; you should drive into caves, to reach the sun as fast as possible. It's just amazing ;-)

Levels are too simples ... so it will be harder in the future, perhaps ;-)

Comments (View)
4 months ago

Kiss a rest api

I see a lot of things about python libs to help to make restful api, nowadays. Sure, hug is beautiful.

Last year, I've made my own lib for that. But since some months, I use this KISS way, and I'm really happy with it :

Server side, I create a HTTP POST endpoint (here with bottle):

@post("/server")
def serverEndpoint():
    try:
        datas=json.loads(request.body.read())
        c=lambda d: globals()["API_"+ d.keys()[0] ]( **d[ d.keys()[0] ] )
        return {"result":[c(i) for i in datas] if type(datas)==list else c(datas)}
    except Exception as e:
        import traceback
        return {"error":traceback.format_exc()}

Now, I can create a lot of serverside API (method which starts with 'API_'), example:

def API_add(a,b=1):
    return a+b

And client side, I call them easily, like this (here with angularjs, but likely the same with JS's fetch) :

$http.post("/server", {add: {a:12, b:42} } ).then( ... )

And better, within 1 http request, I can call multiple api too, like this :

$http.post("/server", [ {add:{a:36,b:29}} , {add:{a:27}} ] ).then( ... )

If I call one method, the result is in the "result" attribut of the response. If I call multiple, results are in a list in the "result" attribut of the response. If server side error, the traceback is in the "error" attribut of the response.

It's very useful in a lot of cases, and it's hard to make simpler !?

Comments (View)
8 months ago

My first PWA

Here is a scratch app. Progressive Web Apps are the way to go, like I said 3 years ago, it's a different fashion. It's a lot lot better to manage the cache with a service worker than with the appcache manifest ;-).

This one doesn't use angular, neither riotjs; it's just pure javascript ;-) In an near future, "web app" won't need Cordova/phonegap to access to peripherals. All will be added as api/event thru the service worker.

Comments (View)
last year

Websocket on app engine : soon !

Big news ;-)

https://code.google.com/p/googleappengine/issues/detail?id=2535

"Thanks to everyone for your feedback. We recognize the importance of App Engine support for WebSockets[1][2] and are actively working on implementing this feature."

7 years later ;-)

Comments (View) Tags: gae
last year

FreeboxV6 Api V3 avec Python

Un peu de python, et ça vient annuler ça ;-)

Voilà une api python simple de registration et de connexion avec les API v3 de la freebox :

import urllib2,hmac,json,hashlib,time

class FbxCnx:
    def __init__(self,host="mafreebox.free.fr"):
        self.host=host

    def register(self,appid,appname,devname):
        data={"app_id": appid,"app_name": appname,"device_name": devname}
        r=self._com("login/authorize/",data)["result"]
        trackid,token=r["track_id"],r["app_token"]
        s="pending"
        while s=="pending":
            s=self._com("login/authorize/%s"%trackid)["result"]["status"]
            time.sleep(1)
        return s=="granted" and token

    def _com(self,method,data=None,headers={}):
        url = "http://"+self.host+"/api/v3/"+method
        if data: data = json.dumps(data)
        return json.loads(urllib2.urlopen(urllib2.Request(url,data,headers)).read())

    def _mksession(self):
        challenge=self._com("login/")["result"]["challenge"]
        data={
          "app_id": self.appid,
          "password": hmac.new(self.token,challenge,hashlib.sha1).hexdigest()
        }
        return self._com("login/session/",data)["result"]["session_token"]

class FbxApp(FbxCnx):
    def __init__(self,appid,token,session=None,host="mafreebox.free.fr"):
        FbxCnx.__init__(self,host)
        self.appid,self.token=appid,token
        self.session=session if session else self._mksession()

    def com(self,method,data=None):
        return self._com(method,data,{"X-Fbx-App-Auth": self.session})

    def dir(self,path='/Disque dur/'):
        return self.com( "fs/ls/" + path.encode("base64") )

Pour commencer, il suffit de registrer son appli dans la freebox, en lançant, dans son reseau local uniquement, chez soi, la commande suivante :

print "token='%s'" % FbxCnx().register("test.id","le nom de l'app","la device")

Il faut valider la registration sur l'afficheur LCD de la freebox, et garder le token !

Une fois que c'est fait; on peut attaquer les API depuis n'importe où sur le web. Si on est ailleurs que dans son sous réseau freebox, il faudra préciser l'ip public de la freebox, ainsi que sont port, dans un paramètre 'host' (faut évidemment que ça soit activé dans la config freebox).

f=FbxApp("test.id",token,host="11.22.33.44:4444")
print f.dir()

L'instance FbxApp négocie, en douce, un 'token de session'. Si on veut garder la même session, il est possible de l'obtenir (f.session), de la faire persister, et de la donner à l'instanciation, comme ceci :

session="WV+O0z1XgE4QB728uINupbQdBiKKAhKYjAX+UylmGwL2ejo6ViQkcx1tK4onQIzt"
f=FbxApp("test.id",token,session,host="11.22.33.44:4444")
print f.dir()

Il n'y a que la commande "fs/ls" d'implementer (via dir()), mais le reste est tout aussi simple ;-)

Mais on peut aussi appeler directement les API, ainsi (et voir passer des params, via un dict comme second argument):

print f.com("airmedia/receivers")

*EDIT 20/02/2017 : ça marche avec les nouvelles APIs V4, faut juste remplacer "v3" par "v4" *

Comments (View)
last year

In the SPA style

I've built a super tool : it's a "web editor" online, so I can quickly code for the web (static or dynamic (python/bottle) files). It use the marvelous ace editor, it's hosted on GAE, it's built with RiotJS. It's a little bit like koding, but without the linux prompt. It's just for me, but I could release it. The frontend is here, but it's just for me, like I said before ;-( ... (it's already the second version, and this one was coded using the first version ... it's like the chicken & the egg ;-) ... now, I can code with the chromebook or whatever internet devices ;-)

It could be done with angular, but not. RiotJS is more fun (but not widely used ?!?) ;-)

Here are 2 (ugly) demos of a classic (simple) app (a kind of todo's app). The first one : an Angular2 version (with classic ES5 javascript (not typescript!)), the second one : a RiotJS version.

Twos are using :

  • a service (to deal with datas) : 'MyService'
  • a master component : 'app'
  • a child component : 'item' (itered from the master)
  • a mecanism of events to communicate between the twos
  • a pipe (aka filter), to transform data : 'mypipe'

I let you choose which is the most readable, the simplest ;-)

It's not really comparable, A2 comes with a full stack. With Riot, you'll need to import yours polyfills and others libs : but you've got the choice !

Comments (View)
2 years ago

iBraining goes mobile

It's a big day, It's nearly Christmas ! iBraining is now (nearly) fully playable on smartdevices (phones, tablets, small screens, ...).

It's not a big rewrite from scratch (like I planned), not a SPA app, not riotjs/angular* powered! I've just hacked the html/css to be a responsive app, to adapt itself to smallest screens. It should do the job.

Desktop version continues to work ;-), just small changes in the front.

Hope everything will continue to work for everybody.

PS: I will continue to work on it in the future days (mainly : better rendering).

Comments (View) Tags: ibraining
<< oldest

Tags

RSS aex aex
RSS d2 d2
RSS gae gae
RSS go go
RSS ppa ppa
RSS Python Powered Get Ubuntu
©opyleft 2008 - manatlan cmd snippets