Il est tard. Vous voulez vous connecter au VPN de l’Université Laval. Évidemment les instructions officielles datent de 2006. Voici donc comment lire votre papier:
- Installer vpnc
sudo apt-get install vpnc network-manager-vpnc
- Redémarrer (juste au cas. Essayez sans)
- Accéder à Système > Préférences > Configuration Réseau > VPN
- Créer un réseau (ulaval) avec les options suivantes:

- Pour les intéressés, le group password à été extrait du profile et cracké avec http://www.unix-ag.uni-kl.de/~massar/bin/cisco-decode
The google app engine image api looks nice before you actually use it. Why? Because it lacks a fundamental feature: the capability to draw an image. That’s right: no trace of a classic canvas api (setpixel, getpixel, rectangle, circle, etc).
Luckily, some clever programmer wrote a PNGCanvas class that saved the day. Here’s how to use it:
from pngcanvas import PNGCanvas
class ImageTest(webapp.RequestHandler):
def get(self):
img = PNGCanvas(256, 256, [0, 0,0,0])
for i in range(0, 256):
img.point(i, i, [0xff, 0, 0, 0xff])
self.response.headers['Content-Type'] = "image/png"
self.response.out.write(img.dump())
This example runs at http://pngcanvas.appspot.com/image
For example, if you want to override the NetConnection::call method, you should do:
override public function call(command:String, responder:Responder, ...parameters):void {
parameters.unshift(command, responder);
super.call.apply(this, parameters);
}
thanks to the good old prototype ..!
I recently added automatic versioning to my Flex projects. This is quite useful when you want to know exactly which version of your application is currently running when it’s being debugged, deployed, tested, etc. This basic example will generate a version string containing a major version number, minor version number, svn revision number and a build number. The build number is incremented every time your application is built. It assumes you have python installed and use SVN as your version control system.
Storing your version information
We will use a simple text file to do that and we’ll call it .version. Its format will be:
major_no
minor_no
build_no
revision_no
Updating the version data
A small python script is used to do that. A build number is incremented each time and the revision number is retrieved from SVN. Here’s the versioner.py script (make sure it’s executable):
#!/usr/bin/python
v = open('.version')
major = int(v.readline().strip() or '2') # can change 2 for any major version number you'd like
minor = int(v.readline().strip() or '5') # idem
build = int(v.readline().strip() or '0') # idem
build += 1
import os, re
ri, ro = os.popen2("svn info", 'r')
rev = ro.read()
ri.close()
ro.close()
revre = re.compile('Revision: ([\d]+)')
revision = revre.search(rev).group(1)
o = open('.version', 'w')
o.write("%d\n%d\n%d\n%s\n" % (major, minor, build, revision))
o.close()
Running the version script
If you’re using Flex Builder, this is easily done:
Go to project properties.
Under the Builders tab, click New
Name it anything you like
Select the versioner.py script in location
Select the folder containing your .version file as the working directory
Check “During manual builds” and “During auto builds” in the Build Options
Once your builder is created, make sure it’s at the top.
Using the version information
You can embed it in your Flex application using the following code:
[Embed(source="../.version",mimeType="application/octet-stream")][Bindable]
public var version:Class;
and then you can access it at runtime using a function like this:
public function getVersion():String {var v:Array = String(new version).split('\n');
return v[0] + '.' + v[1] + '.' + v[3] + ' build ' + v[2];;
}
which will return something like ‘major.minor.revision build’.
I couldn’t find it, so here it is: Django epydocs
2ni:~ denislaprise$ history|awk ‘{a[$2]++} END{for(i in a){printf “%5d\t%s\n”,a[i],i}}’|sort -rn|head
120 cd
97 ls
45 ssh
41 vi
19 svn
13 scp
13 python
12 make
11 find
10 wget
via Tom
ModestMaps is one the nicest mapping API out there: it just feels right. I especially love the python version, which I used to download some Google Maps tiles (anyone remember gMerge?). The following script gets a Google Maps permalink and downloads the tiles all the way down to the maximum zoom level. You may need to alter the file retrieval and naming logic. The beauty here lies in the fact that ModestMaps allows you to download any layer from many APIs (Google, Virtual Earth, Yahoo Maps and OpenStreetMaps) by changing the Google.AerialProvider() call.
import sys, urllib2, re,os, Image, httplib
def parselink(link):
qs = link[link.index('?')+1:]
vals = [v.split('=') for v in qs.split('&')]
params = {}
for v in vals:
params[v[0]] = v[1]
zoom = int(params['z'] or '0')
center = map(float, params['ll'].split(','))
span = map(float, params['spn'].split(','))
ne, sw = list(center), list(center)
ne[0] += span[0]
ne[1] += span[1]
sw[0] -= span[0]
sw[1] -= span[1]
return ne, sw, zoom
def fetch(pt):
if pt.zoom > Core.Coordinate.MAX_ZOOM:
return
if download(pt):
z = pt.zoomBy(1)
fetch(z)
fetch(z.right())
fetch(z.down())
fetch(z.down().right())
def download(pt):
url = layer.getTileUrls(pt)[0]
try:
os.makedirs("tiles/%d/%d" % (pt.zoom, pt.row))
except: pass
fn = "tiles/%d/%d/%d_%d.jpg" % (pt.zoom, pt.row, pt.row, pt.column)
if os.path.exists(fn):
try:
m = Image.open(fn)
a,b,c,d = m.getbbox()
return d > 1
except:
return False
print url
try:
# should use urllib2 to fake user agent here
data = urllib.urlopen(url).read()
out = open(fn, 'w')
out.write(data)
out.close()
return True
except urllib2.HTTPError, e:
if e.code == 404:
#empty tile
out = Image.new('RGB', (1,1))
out.save(fn)
return False
#should not reach this point. add better error handling
sys.exit(-1)
if __name__ == "__main__":
sys.path.append('trunk/py/')
from ModestMaps import *
layer = Google.AerialProvider()
bbox = parselink('http://maps.google.com/maps?f=q&hl=en&geocode=&q=new++york,+ny&ie=UTF8&ll=40.75506,-73.969917&spn=0.100907,0.197926&t=h&z=13&iwloc=addr')
ne = layer.locationCoordinate(Geo.Location(bbox[0][0], bbox[0][1])).zoomTo(bbox[-1]).container()
sw = layer.locationCoordinate(Geo.Location(bbox[1][0], bbox[1][1])).zoomTo(bbox[-1]).container()
cur = ne.copy()
while cur.row <= sw.row:
while cur.column >= sw.column:
fetch(cur.copy())
cur = cur.left()
cur.column = ne.column
cur = cur.down()
Or get the file here
Voici quelques données extraites du rôle foncier de Montréal*
Valeur moyenne des bâtiments: 232,473$
Valeur moyenne des terrains: 91,696$
Année de construction moyenne: 1962
Les 10 plus gros propriétaires sont:
| VILLE DE MONTREAL |
2,074,874,601$ |
| LA VILLE DE MONTREAL - SERVICE DE LA GESTION IMMOBILIERE |
1,270,319,400$ |
| COMMISSION SCOLAIRE DE MONTREAL |
865,440,600$ |
| GOUVERNEMENT FEDERAL MINS DES TRANSPORTS |
766,472,200$ |
| SOCIETE IMMOBILIERE DU QUEBEC |
565,518,300$ |
| UNIVERSITE DE MONTREAL |
554,217,800$ |
| THE ROYAL INSTITUTION FOR THE ADVANCEMENT OF LEARNING |
531,381,400$ |
| 9145 4090 QUEBEC INC(EMPHYTEOTE) |
515,000,000$ |
| COMPAGNIE DES CHEMINS DE FER NATIONAUX DU CANADA |
476,320,700$ |
| UNIVERSITE DU QUEBEC A MONTREAL |
463,720,200$ |
Liste des priopriétaires possédant le plus de logements:
| OFFICE MUNICIPAL D’HABITATION DE MONTREAL |
7,327 |
| IMMOBILIERE SHQ |
6,717 |
| SOCIETE D’HABITATION ET DE DEVELOPPEMENTDE MONTREAL |
3,578 |
| F D L COMPAGNIE LTEE |
2,709 |
| SOCIETE D’HABITATION DU QUEBEC |
2,083 |
| IMMOBILIERE SHQ(EMPHYTEOTE) |
1,659 |
| GROUPE IMMOBILIER EDDY SAVOIE INC. |
1,454 |
| IMMOBILIERE SHQ(SUPERFICIAIRE) |
1,449 |
| 3630005 CANADA INC |
1,357 |
| 1541651 ONTARIO INC(EMPHYTEOTE) |
1,351 |
Nombre total de locaux commerciaux: 37,037
Nombre total de logements: 904,583
Et maintenant, la valeur totale de la ville: 137,633,428,804$
* Extrait à partir de 446772 propriétés dans les arrondissements suivants:
Ahuntsic/Cartierville
Anjou
Côte-des-Neiges/Notre-Dame-de-Grâce
L’Île-Bizard/Sainte-Geneviève
LaSalle
Lachine
Mercier/Hochelaga-Maisonneuve
Montréal-Nord
Outremont
Pierrefonds/Roxboro
Plateau Mont-Royal
Rivière-des-Prairies/Pointe-aux-Trembles
Rosemont/Petite-Patrie
Saint-Laurent
Saint-Léonard
Sud-Ouest
Verdun
Ville-Marie
Villeray/Saint-Michel/Parc-Extension
I just stumped upon those two links, which I believe are spam:
http://www.howcast.com/videos/1865-How-To-Get-FREE-Online-Video-Advertising-For-Small-Business
http://www.howcast.com/videos/945-How-To-Use-Golf-To-Glean-Moneymaking-Information
The first one looks like it’s good text-to-speech with an animated 3d avatar. The second one tries to looks amateur, but it’s interesting to see how much they seem “genuine”, at least compared to emails we receive each day…
Essential report to anyone involved in the data center business. The scary facts:
A 1MW Data Center takes 177 Million kWH
– Worth approx $17mil over it’s 10 year life (at .10 cents per kWH)
source: APC-MGE
• By 2008, 50% of today’s Data Centers will have insufficient
power and cooling;
– By 2009, energy costs will become the 2nd highest cost of a Data
Center
source: Gartner
• By 2010, half of all (Enterprise) Data Centers will have to
relocate or outsource applications to another facility.
– During the next 5 years, 90% of all companies will experience some
kind of power disruption. In that same period one in four companies
will experience a significant business disruption
source: Data Center Institute
• Humans created 161 Exabytesof data in 2006.
– Approximately 3 Million times the information in all the books, ever
written
source: IDC
Power and cooling being the key issue here, I can’t understand why there is no booming data centers business in Québec, a province with huge water resources, cheap electricity and fiber availability.