FeedBurner |
New laptop
This computer have an AMD Turion 64 x2 processor which means that it have a two core processor. Good for me, I'm going to use them when testing my programs on Microsoft Windows. This computer also have 250 Gb in a SATA hard drive, 3GB of RAM and a ATI Radeon HD 3200 graphics card, now that AMD have released the source code for several ATI cards, I hope new and better modules come soon. Now I'm running Ubuntu 8.04 and will upgrade to the latest tomorrow, then use rsync to sync my $HOME between the old laptop and this. I'll thell you how my trip was Calle 13 web page
Calle 13 web page Originally uploaded by markuz I was looking for calle 13 video "Fiesta de Locos" (if it exists) and in my search I get to the calle 13 web page. There is something to note, they (or.. I should say the webmaster). Curious. january 2 2009
I'm getting ready to get back to Salamanca, I have to be in the office the next Monday... So sad, my vacations are over Then, this days the road is full, a lot of people is heading to this city or other near cities (I'm talking about December 24) then, the early days of the year, they get back to their work places. Roads are impassable, and even when you try to travel in bus everything is sold. Fortunately I bought my tickets and my way to salamanca is sure. I'll be in Salamanca on Sunday and start working again on monday. See ya there! January 1st. 2009I also made some last year commits to the christine source code. Now it's supposed to "import" your files in a very fast way. Obviously, I removed the tag import. then, christine is just importing the file path and then it will update the tags of the visible items in the list as the user is using christine, something like what xmms does. But, going far, christine will randomly select items and look for the tags in the background. I start learning the use of the awesome window manager, fisrt because some times I need something that load faster than GNOME, fluxbox is good but I want to try something new and I like it. Mario, a friend of mine teach me how to discover wep keys from access points, very interesting. I wish I could stay here more time to learn more about this and play a bit with my neighbors wireless network. That's all for today Last post in 2008I think this will be the last post in 2008, I'm with my family in puebla since December 20 and I'm going to get back to work on January 5.
I have to say that I have a good year, with some problems, but a good year. I have grown as person, in my current job. I have started the year with a lot of troubles in my software, but they got solved as the time pass, and now is a very stable software, that makes me feel good. And Im happy because this very same software is getting international, doing its work on Several countrys on latin america. But I'm even more happy because in this year cristina and I start living together and now we are waiting for our first baby. I have to admit that this year pass too fast with cristina, I clearly remember when I travel to Tapachula, chiapas to see her. I'm really happy with her and really believe she's the love of my life. But, not everything is sweet, as I said before, I have problems in the early versions of the software I'm developping, something I hope never have to repeat. Problems with cristina's parents that do not support us because we didn't do it the way they want, and problems with money that as you know... nobody have enought, less if you have to pay two cell phones, the BAM and other stuff. The harder is being far from my family, now that I'm in their dining room while my parents and my sister in law are in the tv room watching news, while cristina and my grandmother is sleeping and my brother and my nephew arep playing Company of Heroes make me realize that being far from family is not what I want in my near future. But, at the end this was a good year for me, I have grown in almost any way. I hope I can grow this year in the other ways. I hope this new year become a super year for you. An easy one.For those that are starting with python...
I have two ways to iterate over sequence with a simple filter, one is making a filtered list and store it in a variable, then iterate over that filtered list, the second is put the mapping list in the for statement. Which one is faster and why?
TIMES = 10000 a = xrange(10000) c = [k for k in a if (k % 2) == 0] # def iterate(c): for i in c: pass def mapea(): for i in [k for k in a if (k % 2) == 0]: pass # for i in xrange(TIMES): iterate(c) # for i in xrange(TIMES): mapea() Update: Zodman wins (even when he is not a python newbie)... the iterate function is making just one iteration over a list with the filterered items, the second (mapea) is creating this filtered list in every iteration, so, mapea uses two for cycles and that's why it is slower. Christine 0.2.1Just a few days since the release of christine 0.2.0 and now we have another new release. This time is a bug fix release.
As usual you may download from sourceforge.net, this are the links: Christine 0.2.0 Im proud to announce the release of Christine 0.2.0. I have been working with it for several weeks and after fixing some bugs reported I feel it quite stable to be used for everyone. What's the new?
Debugging with pydevMy first attempt to create video tutorials Python 3000I like the idea that this language is evolving even with this move (which for me is too risky) where we are going to be forced to modify our programs if we want in the future be compatible with Python. Just a few extra minutes
Relativity.. you bitch! Python Logging: RotatingFileHandler Whenever you write a computer program that is going be a service is recommended that this program saves somewhere what is doing, most of the popular services do it (Apache, Cherokee, MySQL, Put your service here:___________________), or maybe you have a desktop application where you want to write what is doing maybe for debug purposes.Fortunately this is an easy task if you use Python's Logging module. This module have several handlers, some of them to write to the standardError, to a Socket, to the syslog and many others One of my favorite handler is the RotatingFileHandler This module creates a log file, when this file is full (if you set the maximum bytes per file flag) it is renamed, appending the .1 and a new file is created with the same name as main log file. You can set up the max number of files to be created. This module (logging) is good, easy to use, but you have to use the RotatingFileHandler with care, or you will have two, three or more files being filled and then, your logs will be in N files.. When you create your Logger Object you can set the log level, which can be INFO, WARNING, DEBUG, ERROR, CRITICAL and EXCEPTION, you already realized which level prints what. You can set the Handler, and this is where using the RotatingFileHandler becomes a bit trickier. In your applications you may want to have several loggers, one for each module you have in your application. If you plan to use the RotatingFileHandler you have to use the same handler for every Logger you are creating if you plan this Logger to use the same file. If you don't do this then you will end with something saving logs in your main file, and every other data will be stored somewhere else. This is because when you try to save a something in your log, the handler check the log size, and if the file size is >= maxbytes makes the rollover, if you are using several handlers related to the same file, then the handler that realize first that the size of the log file reach its max size will do the rollover but this will not take effect in the other handlers, so, one handler will be logging in the newly created file while the others will be logging to the old file and now you have two files growing. To avoid this, just use the same fucking handler for every logger you are creating if you plan to use the same file. Another issue I face with logger what the fact that if you call two time s to the same logger.. I mean:
a = logging.getLogger('chanchanchan')
When you make something like this:b = logging.getLogger('chanchanchan')
a.info('This is a test')
You'll se this:
This is a test
Yes, you are calling a to write "This is a test" but in your log file appears two times (or N times you have created a logger with the same name). So, its better for you to have something like a manager that gives you the logger already created with that name if exists or create it for you.This is a test Let's do an example: This is a small program that logs something in a endless cycle:
#!/usr/bin/env python # -*- encoding: latin-1 -*- import sys import time from logger1 import LoggerManager a = LoggerManager().getLogger('a') b = LoggerManager().getLogger('b') c = LoggerManager().getLogger('c') while 1: t = time.time() for index,i in enumerate((a,b,c)): msg = str(index) + repr(t) i.debug(msg) time.sleep(0.005)
#!/usr/bin/env python import logging import logging.handlers from Singleton import Singleton import os if os.name == 'nt': LOGPATH = 'C:\\' else: LOGPATH = './' class LoggerManager(Singleton): def __init__(self): self.loggers = {} formatter = logging.Formatter('%(asctime)s:%(levelname)-8s:%(name)-10s:%(lineno)4s: %(message)-80s') level = 'DEBUG' nlevel = getattr(logging, level, None) if nlevel != None: self.LOGGING_MODE = nlevel else: self.LOGGING_MODE = logging.DEBUG self.LOGGING_HANDLER = logging.handlers.RotatingFileHandler( os.path.join(LOGPATH, 'log_event.log'),'a',524288, 10) self.ERROR_HANDLER = logging.handlers.RotatingFileHandler( os.path.join(LOGPATH,'log_error.log'),'a',524288, 10) self.LOGGING_HANDLER.setFormatter(formatter) self.LOGGING_HANDLER.setLevel(self.LOGGING_MODE) def getLogger(self, loggername): if not self.loggers.has_key(loggername): logger = Logger(loggername, logging_handler= self.LOGGING_HANDLER, error_handler = self.ERROR_HANDLER, logging_mode = self.LOGGING_MODE) self.loggers[loggername] = logger return self.loggers[loggername] class Logger: ''' Implements the christine logging facility. ''' def __init__(self, loggername, type = 'event', logging_handler= '', error_handler = '', logging_mode = ''): ''' Constructor, construye una clase de logger. @param loggername: Nombre que el logger tendra. @param type: Tipo de logger. Los valores disponibles son : event y error por defecto apunta a event. En caso de utilizarse otro que no sea event o error se apuntara a event. ''' # Creating two logger, one for the info, debug and warnings and #other for errors, criticals and exceptions self.__Logger = logging.getLogger(loggername) self.__ErrorLogger = logging.getLogger('Error'+ loggername) # Setting Logger properties self.__Logger.addHandler(logging_handler) self.__Logger.setLevel(logging_mode) self.__ErrorLogger.addHandler(error_handler) self.__ErrorLogger.setLevel(logging_mode) self.info = self.__Logger.info self.debug = self.__Logger.debug self.warning = self.__Logger.warning self.critical = self.__ErrorLogger.critical self.error = self.__ErrorLogger.error self.exception = self.__ErrorLogger.exception Vim != vim
Vim != vim Originally uploaded by markuz From fabaff.blogspot.com WTF Evolution!!
WTF Evolution!! Originally uploaded by markuz No unread mails in my Inbox, but, in the Unread folder looks like there are 5 unread... select the folder and surprise! there is no messages in that folder.. As a plus in the window title it says that there are 5 unread messages from a total of -142 (yes, a negative value!) messages in the folder. Visitors Statistics1 117 615498 Technorati |
Recent Comments On Blog