Web
libacr published on PyPI
Wednesday, July 28th, 2010 | Computer Science, Opensource, Software Development, Web | Comments
As we are moving to make libacr a very cool and functional python CMF, we published libacr on PyPI!
Now you just need to:
pip install libacr
and you are done, as easy as saying!
More details on http://pypi.python.org/pypi/libacr/
VideoLAN Web Plugin: xpi vs crx
Tuesday, April 27th, 2010 | Hardware, Opensource, Software Development, Uncategorized, Web | Comments
One of the main issue while preparing streaming solution is answering the obnoxious question:
- Question: Is possible to use the service through a browser?
- Answer: No, rtsp isn’t* http, a browser isn’t a tool for accessing any network content.
* Actually would be neat having rtsp support within the video tag but that’s yet another large can of worms
Once you say that you have half of your audience leaving. Non technical people is too much used to consider the browser the one and only key to internet. The remaining ones will ask something along those lines:
- Question: My target user is
a complete idiottechnically impairednaive and unaccustomed and could not be confronted with the hassle of a complex installation procedure, is there something that fits the bill? - Answer: VideoLAN Web Plugin
Usually that makes some people happy since it’s something they actually know or at least they have heard about. Some might start complaining since they experienced an old version and well it crashed a lot. What would you be beware of is the following one:
- Question: Actually I need to install the VideoLAN Web Plugin and it requires attention, isn’t there a quicker route?
- Answer: Yes xpi an crx for Firefox an Chrome
Ok, that answer is more or less from the future and it’s the main subject of this post: Seamless bundling something as big and complex as vlc and make our non tecnical and naive target user happy.
I picked the VideoLAN web plugin since it is actually quite good already, has a nice javascript interface to let you do _lots_ of nice stuff and there are people actually working on it. Additional points since it is available on windows and MacOSX. Some time ago I investigated how to use the extension facility of firefox to have the fabled “one click” install. The current way is quite straightforward and has already landed in the vlc git tree for the curious and lazy:
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-manifest"> <em:id>vlc-plugin@videolan.org</em:id> <em:name>VideoLAN</em:name> <em:version>1.2.0-git</em:version> <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>1.5</em:minVersion> <em:maxVersion>3.6.*</em:maxVersion> </Description> </em:targetApplication> </Description> </RDF>
Putting that as install.rdf in a zip containing a directory called plugins with libvlc, it’s modules and obviously the npapi plugin does the trick quite well.
Chrome now has something similar and it seems also easier so that’s what I put in the manifest.json:
{ "name": "VideoLAN", "version": "1.2.0.99", "description": "VideoLan Web Plugin Bundle", "plugins": [{"path":"plugins/npvlc.dll", "public":true }] }
Looks simpler and neater, isn’t it? Now we get to the problematic part about chrome extension packaging:
It is mostly a zip BUT you have to prepend to it a small header with more or less just the signature.
You can do that either by using chrome built-in facility or by a small ruby script. Reimplementing the same logic in Makefile using openssl is an option, for now I’ll stick with crxmake.
Then first test build for win32 are available as xpi and crx hosted on lscube.org as usual.
Sadly the crx file layout and the not so tolerant firefox xpi unpacker make impossible having a single zip containing both the manifest.xpi and the install.rdf served as xpi and crx.
by the way, wordpress really sucks
The zoom factor in webkit and gecko
Thursday, April 8th, 2010 | Web | Comments
Apparently all the major browsers tried to provide a zoom facility to improve the overall accessibility for the web users. Sadly that often breaks horribly your layout, if you are developing pixel precise interaction you might get a flood of strange bug reports you might not reproduce.
We got bitten by it while developing Glossom, severely…
Our way to figure out it’s value is quite simple once you discover it: Firefox scales proportionally the borders and makes the block dimensions constant, Webkit seems to do the opposite. It’s enough to check if a element with known dimensions and border width has it’s value reported as different and your can find our which is the factor.
This obviously is quite browser dependent and nobody grants that in different version it might get changed, anyway so far it seems to serve us well.
ACR gets Slice Templates
Monday, March 1st, 2010 | Web | Comments
ACR is a flexible and quite powerfull CMS library, but users have to learn Slices and Slicegroups to be able to insert more advanced content like photo galleries, videos and a news section. To simplify this process we created “Slice Templates”.
Slice Templates are actually a set of common ways to use slices to insert more advanced content. The first two slice templates implemented are:
- Youtube Videos which make easy to insert a youtube video inside an ACR Page.
- Photo Gallery which makes easy to insert a photo gallery with cool effects inside an ACR Page.
Next template to come will be a news section, for now you can upgrade your libACR and start using the templates feature or take a look at the screenshots of the currently implemented templates
Turbogears Glossom finally live
Sunday, January 31st, 2010 | Web | Comments
We started to collaborate with the Glossom project more than an year ago, the first version was a Ruby on Rails prototype and has served well thousand of users for about an year. When the Glossom team decided to rewrite the software to move from a prototype to a more complete software we studied which frameworks were available and finally decided for Turbogears2.
Turbogears is a quite complete and really flexible framework, we used it since version 1.0 for about 3 years and the more we used it the more we loved it. It might have its problems but differently from other solutions when the framework has a limit it is really easy to bypass the framework and implement your own solution without any hack and with a clean way. Turbogears developers really focused on letting your tune each component in any way, and even totally replace it with something else if you don’t like it.
After six months of development the application has finally gone live and is now serving ~10000 registered users with its servers based on an apache load balancer, mod_wsgi turbogears application servers and mysql database servers.
So welcome to Glossom and thank you to Turbogears team for all the help!
We also have to say thank you to FFmpeg for now converting our videos and FlyPDF for generating our PDFs!
(you can download FlyPDF from sourceforge if you want to give it a try)
Successor to cloud computing, aka tweelter new architecture
Wednesday, January 20th, 2010 | Web | Comments
When you have to perform a real big amount of operations you have two options
- Increase your computational power (like using a cloud solution or scale on more servers)
- Move your computations to the most available cloud platform of the world: your users
Tweelter, the twitter filter
Saturday, December 5th, 2009 | Web | Comments
While speaking with the top-ix people during a meeting we started to talk about the need of a way to filter out “noise” from twitter searches.
Probably everyone found that searching something on twitter returns a big list of retweets and duplicated tweets. As those reduce the ability to follow a discussion or an event on twitter they are usually more a problem than a useful result.
At the end of that meeting Tweelter was born.
Tweelter is a twitter search engine which filters out duplicated entries, retweets and permits to search results older than one month on most followed topics. More interesting thing is that tweelter performs those search in a parallel manner and on a distributed mongodb. While retrieving all the results of the same search using the twitter api would require more then 10-20 seconds by using tweelter you will get the same results in 2-3 seconds and the more a search is performed the faster it gets.
So give tweelter a try if you need to follow a discussion on twitter, it might help you to follow the discussion in an easier manner.
Rehearsing new ACR look and feel
Tuesday, November 24th, 2009 | Opensource, Web | Comments
As some turbogears projects are starting to use ACR as their CMS library we received the first few requests by real users and the most prominent one is to have a better administrative section. Currently administration section is implemented by using the great tgext.admin and sprox, even if those are really good to quickly implement a CRUD section they might not couple very well when a more interactive and advanced user experience is required.
So a transition phase that will end with a totally new administration section for ACR has been started, currently the system implements a new user interface still using the same backend as before to handle the operations, but on the long time the backend itself will be rewritten to handle easier contents creation and management. In the mean time also support for multi-language, versioning and authors has been added.
- ACR New Dashboard
- ACR New Page Management
Injecting static content in TurboGears
Saturday, November 21st, 2009 | Web | Comments
Something that you usually need to do when providing a library or a reusable wsgi application is installing static data with the library itself.
This can be quickly performed by adding something like
package_data = {”:['*.html', '*.js', '*.css', '*.png']}
to your setup.py
But then how can we let our turbogears application serve that?
- For html files (genshi templates) the solution is quite simple, you can just expose them by using @expose(’librarypackage.templatesdir.template’). For example supposing we are installing libcool with its templates in libcool/templates you can do @expose(’libcool.templates.index’)
- For js and css files you can add them to your pages by creating a tw.api.JSLink or tw.api.CSSLink object. Just create inside your library something like: cool_js = tw.api.JSLink(modname = __name__, filename = ’static/cool.js’) and then place in the controller exposing the view where you want to use that js file cool_js.inject()
- Exposing images can be more complex, you have to declare a widget which will render the img tag by using ToscaWidgets resources exposure.
class IconLink(tw.api.Link): """ A link to an icon. """ template = """<img src="$link" alt="$alt" />""" params = dict(alt="Alternative text when not displaying the image") def __init__(self, *args, **kw): super(IconLink, self).__init__(*args, **kw) self.alt = kw.get('alt')then you can create one IconLink for each icon in your library with something like: parent = IconLink(modname=__name__, filename=’static/icons/parent.png’, alt=’Up’) and inside your views you can place the icon by doing ${parent.display()} . This will add the image by exposing it from inside the static directory of your library package. Remember that you need to add an __init__.py inside the static directory and its subdirectory if you want setuptools to correctly install the static files.
Using SwfUpload with TurboGears 2
Saturday, October 10th, 2009 | Web | Comments
SwfUpload doesn’t permit to upload things through authenticated methods, this is because it doesn’t pass the cookies needed to identify your users.
Partly this problem can be solved by using swfupload.cookies.js plugin. This plugins fetches all your cookies and passes them as POST arguments. This way you can get your authtkt cookie and use it to identify your user.
from webob.exc import *
from paste.auth import auth_tkt
if kw.has_key('authtkt'):
#by default it is usually configured to do not use the remote address
#otherwise you can fetch it from request.environ['REMOTE_ADDR']
remote_addr = '0.0.0.0'
#cookie secret is usually defined in your config/app_cfg.py
#as base_config.sa_auth.cookie_secret or in your development.ini
cookie_secret = "some_random_string_like_BQQP+BeyrTzTHClBCEdW"
try:
data = auth_tkt.parse_ticket(cookie_secret,
kw.get('authtkt'),
remote_addr)
username = data[1]
user = DBSession.query(User).filter_by(username=username).one()
except:
raise HTTPBadRequest
filename = kw['Filename']
file = kw['Filedata'].file
By using this code you can fetch the user that is uploading the file. This requires the method to do not use @require decorator to check for user permissions, as you will know the user only after entering the method. But you can create your own predicate if you really want to use @require.





