WikiPedia
"Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds."
Sunday, September 27, 2009
Convert FLV to MP3 - uBuntu
sudo apt-get install ffmpeg
ffmpeg -i /suorcefile_path/sourcefile.flv -ab 128k /path/file.mp3
Source
may need to get ffmpeg from non-os repos because of non-os nature of format
ffmpeg -i /suorcefile_path/sourcefile.flv -ab 128k /path/file.mp3
Source
may need to get ffmpeg from non-os repos because of non-os nature of format
Saturday, September 26, 2009
Evolution - GMail POP
http://tuxicity.wordpress.com/2007/03/08/howto-set-up-gmail-in-evolution-gnomes-mail-client-and-organizer/
http://cviorel.easyblog.ro/2008/11/05/nokia-n73-synchronization-with-opensync-under-ubuntu-804/
http://sidrit.wordpress.com/2008/07/03/nokia-e61i-sync-with-evolution-on-ubuntu-804/
http://discussions.europe.nokia.com/discussions/board/message?board.id=smartphones&message.id=94045
http://cviorel.easyblog.ro/2008/11/05/nokia-n73-synchronization-with-opensync-under-ubuntu-804/
http://sidrit.wordpress.com/2008/07/03/nokia-e61i-sync-with-evolution-on-ubuntu-804/
http://discussions.europe.nokia.com/discussions/board/message?board.id=smartphones&message.id=94045
Tuesday, September 22, 2009
Set GRUB Default Boot Option
config file = /boot/grub/menu.lst
edit line
## default num
...
default 0
change default number (generally to 4 for std ubuntu/win dual boot)
for karmic koala (9-10), the config file is /etc/default/grub
and change GRUB_DEFAULT=4
in either case, follow up with
update-grub
Source = HowToGeek
edit line
## default num
...
default 0
change default number (generally to 4 for std ubuntu/win dual boot)
for karmic koala (9-10), the config file is /etc/default/grub
and change GRUB_DEFAULT=4
in either case, follow up with
update-grub
Source = HowToGeek
Saturday, September 19, 2009
mySQL - Python
Official mySQL Site on Integration
MySQLdb is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2.0, and is built on top of the MySQL C API.
Writing MySQL Scripts with Python DB-API
SourceForge mySQL-Python Home
PEP 249 : Python Database API Specification v2.0
DOWNLOAD
MySQL for Python [SourceForge]
MySQLdb is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2.0, and is built on top of the MySQL C API.
Writing MySQL Scripts with Python DB-API
SourceForge mySQL-Python Home
PEP 249 : Python Database API Specification v2.0
DOWNLOAD
MySQL for Python [SourceForge]
Installing & Configuring MySQL
excellent BASIC MYSQL CONFIGURATION
(typical) LOCATION OF mySQL CONFIG FILE [=my.cnf]
= /etc/mysql/my.cnf
LOG ON TO MYSQL CONSOLE
> mysql - u user -p
drop database syntax
How to change the mysql database location
LIST DATABASES
> mysqlshow -u root -p
CREATE DATABASE
1
2
3
SHUTDOWN SERVER
mysqladmin -u root -p shutdown
---
Information Schema Tables [official mysql ref]
The schema 'information_schema' contains the meta-data for the db server
TO QUERY ALL TABLES CONTAINED IN DB test
> select *
> from information_schema.tables
> where table_schema = 'test';
(typical) LOCATION OF mySQL CONFIG FILE [=my.cnf]
= /etc/mysql/my.cnf
LOG ON TO MYSQL CONSOLE
> mysql - u user -p
drop database syntax
How to change the mysql database location
LIST DATABASES
> mysqlshow -u root -p
CREATE DATABASE
1
2
3
SHUTDOWN SERVER
mysqladmin -u root -p shutdown
---
Information Schema Tables [official mysql ref]
The schema 'information_schema' contains the meta-data for the db server
TO QUERY ALL TABLES CONTAINED IN DB test
> select *
> from information_schema.tables
> where table_schema = 'test';
Thursday, September 17, 2009
Thai Green Curry Recipe
THAI GREEN CURRY
Ingredients
1 tbsp vegetable oil
2 tbsp green curry paste (according to taste)
1 tbsp soft dark brown sugar
1-2 thick stalks lemongrass, fat ends bashed with a rolling pin (optional)
750g skinless, boneless chicken, cut into chunks (use breast and/or leg meat)
6-8 lime leaves, torn into pieces (if unavailable, use the grated zest of 1 lime)
400ml coconut milk
good shake Thai fish sauce or light soy sauce
small handful coriander, roughly chopped
1 lime, juice only
Method
1. Heat the oil in a wok or large frying pan. Add the green curry paste and sugar and cook over a fairly high heat for about a minute, stirring with the lemongrass, if using. Reduce the heat slightly and stir in the chicken pieces and lime leaves or zest until coated in the paste. Add the coconut milk, fish sauce or soy sauce and bring to a simmer, cooking for 25-30 minutes until thickened slightly. Stir in the coriander and lime juice. Check for seasoning, adding more fish sauce or soy sauce if needed.
2. The curry is now best left to sit for a few minutes so the sauce becomes creamier. You will also taste the true flavours of the curry paste ingredients when it's slightly cooler. Serve with lots of fragrant Thai jasmine rice.
THAI GREEN CURRY PASTE
Ingredients
4-6 medium green chillies, de-seeded and roughly chopped
2 shallots, roughly chopped
5cm/2in piece of fresh ginger, peeled and grated
2 garlic cloves, crushed
small bunch of fresh coriander, stalks and roots attached if possible
2 lemongrass stalks, chopped (if unavailable, use 2 tbsp dried)
1 lime, grated zest and juice
8 kaffir lime leaves, torn into pieces (if unavailable, use the grated zest of
1 extra lime)
2.5cm/1in piece galangal, peeled and chopped (if available)
1 tbsp coriander seeds, crushed
1 tsp ground cumin
1 tsp black peppercorns, crushed
2 tsp Thai fish sauce or light soy sauce
3 tbsp olive oil
Method
1. Place all of the ingredients in a food processor and blitz to a paste. Use straight away or store in a jar in the fridge for up to 3 weeks. This quantity is enough for a curry for 8 people.
Tip:
When your curry is cooked, if you think it is too spicy, add some more sugar; if it isn't spicy enough, fry a little more curry paste in some oil for a minute or two and add to the sauce.
Ingredients
1 tbsp vegetable oil
2 tbsp green curry paste (according to taste)
1 tbsp soft dark brown sugar
1-2 thick stalks lemongrass, fat ends bashed with a rolling pin (optional)
750g skinless, boneless chicken, cut into chunks (use breast and/or leg meat)
6-8 lime leaves, torn into pieces (if unavailable, use the grated zest of 1 lime)
400ml coconut milk
good shake Thai fish sauce or light soy sauce
small handful coriander, roughly chopped
1 lime, juice only
Method
1. Heat the oil in a wok or large frying pan. Add the green curry paste and sugar and cook over a fairly high heat for about a minute, stirring with the lemongrass, if using. Reduce the heat slightly and stir in the chicken pieces and lime leaves or zest until coated in the paste. Add the coconut milk, fish sauce or soy sauce and bring to a simmer, cooking for 25-30 minutes until thickened slightly. Stir in the coriander and lime juice. Check for seasoning, adding more fish sauce or soy sauce if needed.
2. The curry is now best left to sit for a few minutes so the sauce becomes creamier. You will also taste the true flavours of the curry paste ingredients when it's slightly cooler. Serve with lots of fragrant Thai jasmine rice.
THAI GREEN CURRY PASTE
Ingredients
4-6 medium green chillies, de-seeded and roughly chopped
2 shallots, roughly chopped
5cm/2in piece of fresh ginger, peeled and grated
2 garlic cloves, crushed
small bunch of fresh coriander, stalks and roots attached if possible
2 lemongrass stalks, chopped (if unavailable, use 2 tbsp dried)
1 lime, grated zest and juice
8 kaffir lime leaves, torn into pieces (if unavailable, use the grated zest of
1 extra lime)
2.5cm/1in piece galangal, peeled and chopped (if available)
1 tbsp coriander seeds, crushed
1 tsp ground cumin
1 tsp black peppercorns, crushed
2 tsp Thai fish sauce or light soy sauce
3 tbsp olive oil
Method
1. Place all of the ingredients in a food processor and blitz to a paste. Use straight away or store in a jar in the fridge for up to 3 weeks. This quantity is enough for a curry for 8 people.
Tip:
When your curry is cooked, if you think it is too spicy, add some more sugar; if it isn't spicy enough, fry a little more curry paste in some oil for a minute or two and add to the sauce.
Sunday, September 13, 2009
Re-Using .DEB Packages
[select saving of downloaded packages]
Downloaded packages saved to /var/cache
http://www.go2linux.org/debian-ubuntu-package-proxy-server
Downloaded packages saved to /var/cache
http://www.go2linux.org/debian-ubuntu-package-proxy-server
Friday, September 11, 2009
Log4Net - load config from file and demo basic log
public class Program
{
private static readonly log4net.ILog alog = LogManager.GetLogger("AlgoLogger");
public static void Main(string[] args)
{
FileInfo fInfo = new FileInfo(@"C:\this\that\log4net.config");
log4net.Config.XmlConfigurator.Configure(fInfo);
Klass klass = new Klass();
klass.LogStuff();
}
}
public class Klass
{
private static readonly log4net.ILog alog = LogManager.GetLogger("AlgoLogger");
public void LogStuff()
{
string logStr = "log info";
alog.Debug(logStr);
}
}
log4net.config XML file
[?xml version="1.0" encoding="utf-8" ?]
[log4net]
[appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" ]
[layout type="log4net.Layout.PatternLayout"]
[conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" /]
[/layout]
[/appender]
[appender name="RollingFile" type="log4net.Appender.RollingFileAppender"]
[file value="log-file.txt" /]
[appendToFile value="true" /]
[maximumFileSize value="1024KB" /]
[maxSizeRollBackups value="10" /]
[rollingStyle value="Size" /]
[layout type="log4net.Layout.PatternLayout"]
[conversionPattern value="%date %level %thread %logger - %message%newline" /]
[/layout]
[/appender]
[!--
[root]
[level value="ALL" /]
[appender-ref ref="RollingFile" /]
[/root]
--]
[logger name="AlgoLogger"]
[level value="ALL" /]
[appender-ref ref="AlgoAppender" /]
[/logger]
[/log4net]
Sunday, September 6, 2009
Retaining WhiteSpace When Posting Python Code
To post python code in a blog (html) and retain the line whitespace that is required in order for the code to remain unambiguous, simply enclose your code within pre html tag block.
The 'pre' tag yields a fixed-width (monospace) font, and preserves spaces and line-breaks.
<pre>
</pre>
The 'pre' tag yields a fixed-width (monospace) font, and preserves spaces and line-breaks.
<pre>
def doStuff(i):
print()
for z in range(i):
print(z)
c = 4
for z in range(c):
doStuff(z)
</pre>
Subscribe to:
Posts (Atom)