Perl: Command-line regex

A few command-line tricks for Perl: Filter based on regex (like grep -E) cat file.txt | perl -n -e ‘print if /regex.*matched/’ Replace based on regex cat file.txt | perl -n -e ‘s/regex.*matched/replacement/gi’ Replace based on regex inside file (will change file) perl -pi -e ‘s/regex.*matched/replacement/gi’ *.txt Replace based on regex inside file (will change … Read more

Tip: Always use ASP.Net State Server during development

Always use ASP.Net State Server during development http://msdn.microsoft.com/en-us/library/ms972429.aspx Using “ASP.Net State Server” during development forces developers to use serializable-attribute on all objects stored in Session. Reasons: No extra effort required by the developer. Changing to ASP.Net State Service or SQL session storage on a solution not developed for it requires a full and extensive test of the … Read more

Tip: Never use IP addresses

Never use IP addresses Use of IP addresses are never actually required. There are two fully valid alternatives: Using DNS name served by DNS server. Windows/Linux can have unlimited number of DNS servers in case one goes down, so there is no problem with stability. Just add more DNS-servers. (At least two) In case DNS … Read more

.Net tools to use: log4net

log4net http://logging.apache.org/log4net/ Description Free popular logging system developed by Apache Foundation. Difficulty 1 line at top of each class. A standard XML-section in web.config. Sample usage: [sourcecode language=”csharp”] // At the top of every class you set up a static logger with the class name (retrieved through System.Reflection) private static log4net.ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType) // … Read more

.Net tools to use: Nini

http://nini.sourceforge.net/ Nini   Description An uncommonly powerful .NET configuration library. Use this for reading web.config (instead of .Net built-in System.Configuration…) and any other .ini-file or .xml-file containing configuration. Difficulty 2 lines to read (usually called at page_load or similar). Sample usage: [sourcecode language=”csharp”] // Set up our config source as web.config or app.config internal static … Read more

OpenSim in Visual Studio on Win64

Note! Article applies to developers using Visual Studio on 64-bit Windows. Visual Studio is a great tool. Most developers who can use it should. Currently OpenSim has some problems with 64-bit mode. This is because we have some native .dll’s and .so’s such as: SQlite ODE OpenJpeg + more SQLite you can do without by … Read more