Here’s a cheat sheet on how to decode SD Card speed logos when shopping for SD Cards:
Hope this will help when you are buying your next SD Card.
Just wanted to share this simple log helper method I came up with after some research, which can help you quickly setup Python logging and focus on your main app logic instead of dangling around in logging documentation.
The method is very simple, takes a filename and two other optional arguments, and returns ‘logging’ object, and you can start logging in your Python projects in no time!
Here’s the code:
#file log_helper.py import os, sys import logging def logHelper(fileName, logLevel=logging.INFO, useConsole=True): """ Simple Logging Helper. Retuens logger reference. Paramsmeters: fileName: Filename, may include full path, or will open a file in default folder logLevel: Pass logging.INFO, logging.DEBUG or other enums for logging level useConsole: If Ture, will also dump log to console """ ##### init logging log = logging.getLogger() log.setLevel(logLevel) logFormatter = logging.Formatter("%(asctime)s | %(threadName)-12.12s | %(levelname)-5.5s | %(message)s") ##### file handler fileOut = logging.FileHandler(fileName) fileOut.setFormatter(logFormatter) log.addHandler(fileOut) ##### console handler if useConsole: consoleOut = logging.StreamHandler(sys.stdout) consoleOut.setFormatter(logFormatter) log.addHandler(consoleOut) ##### return reference return log
And usage is simple. Passing just filename defaults to ‘logging.INFO’ log level, and console output turned on:
#import module import log_helper as log # get logger log = log.logHelper('logfile.log') log.info("Got logger")
Or use optional arguments to set up logging level and console output:
#import module import log_helper as log # get logger log = log.logHelper('logfile.log', logging.WARN, False) log.warn("this is a warning message")
Additionally, you can always tweak the method as per your needs, for rotating file handler, additional output handlers and log output format.
Check out Python’s documentation for ‘logging’ module here for more info.
Bugs reports? Suggestions? Let me know if you found this useful. Leave a comment 🙂
“The world doesn
Just found a good feature of WCF, which seems quiet useful for distributed application developing/deployment practices. Through Net.TCP Port Sharing Service, Windows Communication Foundation (WCF) allows different processes to share the same TCP Ports. Now you can deploy your .Net based network services side-by-side with IIS on port 80 or 8080, the standard HTTP and HTTP Proxy ports you find open in many firewalls by default. No need to mess around with client
Wait a minute… you think you can leech some bits of torrents from every public hotspot that comes your way? No sir, that’s not the case (at least for now). This neat piece of software is not a torrent client, it actually lets you control the uTorrent from your mobile, ideally on Wi-Fi in home or office, where you have uTorrent running with WebUI installed.
I just happen to setup WebUI for myself and had this wild idea to get the remote control on my mobile, and guess what, “Your best idea is already copyrighted.” proves true again!
Just like BeBook, yet another cool e-book reader on the block…but still no luck with the prices…the asking price for this gizmo is huge 329.95 EUR with converts to almost 510 USD!!!
The success of Sony Reader and Amazon Kindle Reader proves that even latest large screen mobile phones and other hand-held media gadgets are insufficient for reading books, specifically for mature readers.
Eid Mubarik to all Muslims around the world 🙂 Eid-ul-Fitr is truly a family event and my best wishes to those who are abroad and for any reason, couldn’t make it home with their families.
Enjoy your Eid Moments and Happy surfing!
Software features are cool, technical specifications look promising but its price, which is US$699, is a little too high for a gadget like this. I’ll definitely buy it when it will come under US$300 🙂
Features suggest that this device is the most ultimate one in the electronic reading/writing devices available on the market.
Seems like this e-paper stuff is going to replace conventional paper and “analog recoding devices” (pen and pencils) with their digital counterparts pretty soon.