This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Yassine chaouche | |
## [email protected] | |
## http://ychaouche.informatick.net | |
## Jun 16 2012 - 19:21 | |
import sys | |
def main(): | |
numbers = sys.argv[1:-1] | |
result = sys.argv[-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Yassine chaouche | |
## [email protected] | |
## http://ychaouche.informatick.net | |
## Jun 16 2012 - 02:42 | |
""" | |
This file contains the evaluate function that computes expressions like (4+3)/(2*(5+4)). | |
game.py feeds this function with expressions generated by the generator.combo function | |
(file generator.py). Its main function is evaluate. It takes an expression as a parameter, | |
which is simply a string, and returns the result of the computation of that expression. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello, | |
Tahar is a little program (named after Inspecteur Tahar, a famous algerian movie character) that helps you keep your code minimal and clean. It warns you if one of your functions or methods code is longer than MAX_LENGTH lines (you can change the value of this macro in the begining of tahar's source code. Default is 25, this is the french EPITA/EPITECH's school standard for C functions). | |
You don'thave to copy tahar.py (or naive_tahar.py at the time of this writing) in the directory containing the modules you want to scan. You can just pass a dirctory or a list of python files with full access path. | |
Tahar should print something like this : | |
<execution trace> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do you agree what that statement below ? | |
"In Javascript, it is preferable to declare methods outside of the function definition. | |
Because if you define it inside the function, it's like you're defining a method inside a constructor. | |
You usually don't do that do you ? usually a constructor just initialises attributes. | |
You would declare the methods outside of the function definition." | |
So instead of this : | |
var Dog = function(name,age,sex){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Are those identical ? | |
// Javascript | |
var person = Object.create(animal) | |
// Some obscure language | |
object person inherits animal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1 | |
obj = {key:value}; | |
//2 | |
obj = Object.create(null); | |
obj[key] = value; | |
//3 | |
obj = Object.create(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Javascript orienté objet | |
======================== | |
L'orientation objet du javascript | |
--------------------------------- | |
Il n'y a pas de notion de classe en javascript. Il n'y a que des objets. L'héritage se fait entre objets et non entre classes, c'est ce qu'on appelle l'héritage par prototype (où le prototype d'un objet est l'objet duquel il hérite. Analogiquement en orientation objet classique, on parle de classe mère ou classe parente, ici on parle de prototype). | |
Ceci a pour conséquence que l'abstraction du programme en "classes" desquelles on instancie des objets n'existe pas en tant que tel en javascript. Au lieu de ça, on a le choix entre soit créer un objet via le mot clé "new" suivi du constructeur de l'objet (analogiquement aux constructeurs de classes dans la OO classique), ou bien en utilisant la nouvelle fonction Javascript (introduite en ECMAScript 5) dédiée à la création d'objets qui est "Object.create". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function YRSSReader(){ // Yahoo! RSS Reader | |
this.feed_url = "http://rss.news.yahoo.com/rss/topstories"; | |
this.items = []; | |
this.callback = AjxCallback(this,this.simpleResponseHandler); | |
} | |
YRSSReader.prototype = new ZmZimletBase(); | |
YRSSReader.prototype.constructor = YRSSReader; | |
// Handle de la réponse à la requête XHR en cas de succès |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s15389121:/opt/zimbra/bin # telnet localhost 389 | |
Trying ::1... | |
telnet: connect to address ::1: Connection refused | |
Trying 127.0.0.1... | |
telnet: connect to address 127.0.0.1: Connection refused | |
s15389121:/opt/zimbra/bin # | |
So I decided to check | |
s15389121:/opt/zimbra/bin # netstat -natp | grep 389 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> bar = lambda x:all(map(lambda x:x in "ATCG",x)) | |
>>> bar("AGCT") | |
True | |
>>> bar("AGCTACCCTTA") | |
True | |
>>> bar("AGCTACCCTTA1") | |
False | |
>>> |
OlderNewer