Monday, October 18, 2010

Macbook Pro Late 2008 MATSHITA DVD-R UJ-868 not burning

My Macbook Pro late 2008 was reading both CD's and DVD's fine but burning DVD's just didn't work.

I tried:
TDK DVD-R
Verbatim DVD+R
Hewlett-Packard DVD+R

I tried resetting the pram and smc as suggested on the Apple support forums. Didn't help.

Then I read about using a CD-cleaner.

I bought one at the local electronics shop here in Stockholm, Kjell & Company. Now DVD-burning works fine!

CD linsrengöring

(The instructions didn't recommend to use it in a slot loaded DVD but it worked fine.)

Thursday, October 14, 2010

GTD in Gmail and Google Calendar

Gmail and Google Calendar has a great task feature that you can use to setup a GTD system.

Basic setup
Start with creating the basic set of task lists (they all start with ! just to keep them at the top of  my task lists):

  • !Inbox
  • !Next
  • !Waiting for
  • !Someday
  • !Scheduled

Enter all your stuff to the !Inbox list.

Emails are easily entered by selecting "Add to Tasks" from the "More actions" menu.

If you select a task and then click the little arrow on the right you can:

  • move the task to another list.
  • set a due date
  • add a comment

(You can create hierarchies of tasks by just tabbing them.)


There is no real tagging available (to use for context presumably) but you could either use the comments for that, or do as I and  create two default tasks on the !Inbox list, @home and @work, and then just order the tasks under them.

Scheduling
The simplest way to do this is of course just to add the calendar events as needed and remove the tasks from the !Inbox.

But since I like to keep track of everything in lists I added the !Scheduled list. I move tasks from the !Inbox here and set a due date for them. Then I open up the Google Calendar and select tasks and then the !Scheduled lists and boom (as Steve would say) the scheduled tasks are visible in the calendar. They can be marked as completed as well as rescheduled. (The one downside is that a specific time can not be scheduled for the task in this system, you have to create a specific calendar event for that.)

Conclusion
There are of course lots of ways to set this up. And different plugins available. But since I am new to GTD I wanted the simplest setup possible to get me started. We'll see how it goes...

You're welcome to add comments with questions or thoughts or ideas to improve the above setup.


!Next list in Gmail

!Scheduled list in Gmail

!Scheduled list in Google Calendar

Wednesday, September 15, 2010

LG 37LD420 USB HACK

How to get divx/xvid playback on your LG TV (bought in Sweden).
1. Buy a cheap but great LG 37LD420 on komplett.se for 3995SEK.
2. Borrow a Nokia E51 from a friend.
3. Install irRemote from Psiloc.
4. Add device TV->LG and then refresh.
5. Search for IN-START and then refresh.
6. Select mon.
7. Select the downloaded profile.
8. Press 2 on the phone and have it close to the tv.
9. Password menu pops up. Enter 0413 on tv remote.
10. Select tools option 3 using tv remote.
11. Set Divx to 1 using tv remote.
12. Press exit on the tv remote.
13. Enjoy!

For a more detailed guide check out LG TV USB IR-Hack.

Wednesday, March 31, 2010

Apache modules

Modules are either compiled in (static) or dynamically loaded (shared).

List static with httpd -l
List all with httpd -t -D DUMP_MODULES

Shared modules are stored in /etc/httpd/modules/

Shared modules are either loaded directly in httpd.conf or by looking in conf.d/*.conf
E.g. conf.d/perl.conf
...
LoadModule perl_module modules/mod_perl.so
...

Here are some paths that are good to know (Apache on CentOS):
Executables /usr/sbin
Config /etc/httpd
Logs /etc/httpd/log
Web Root /var/www/html

Thursday, March 25, 2010

CSS resources

SohTanaka

Kuler by Adobe

Kuler is an excellent app from Adobe for color exploration.

Try Create->From an Image...

Saturation is a free iPhone app for exploring existing themes.

Tuesday, March 23, 2010

HTML::FormFu select

When using a FormFu select for a simple relation it is easy to display other item names than the default:

The element looks like:
{
label => 'collection',
type => 'Select',
name => 'collection_id',
options => [ map { [ $_->id, $_->collection . ' - ' . $_->product->product ] }
$c->model('PB::Collections')->search( {}, {order_by => 'product.product, collection', prefetch => 'product'} )->all() ],
constraints => [ 'Required' ],
},
But when using a many to many relation in the listbox it becomes trickier, you have to add an accessor to the result class:

The element looks like:
{
label => 'items',
type => 'Select',
name => 'items',
db => {
model => 'PB::Items',
label_column => 'description',
m_to_m_column => 'item_id',
attributes => { prefetch => [ {book => 'title' }, {book => 'collection' }, {book => 'format' } ] , order_by => 'title.title, collection.collection, format.format ' },
},
multiple => 1,
size => 20,
},

And the following sub has to be added to the items resultset:
sub description {
$_[0]->book->title->title . ' - ' . $_[0]->book->collection->collection . ' - ' . $_[0]->book->format->format . ' - ' . $_[0]->isbn;
}


DBIx:Class debugging

If you use DBIx::Class and you want to see what the SQL generated looks
like, you can set the environment variable DBIC_TRACE.

% DBIC_TRACE=1 my_programme.pl
And all the SQL will be printed on STDERR.

If you give a filename to the variable, like this

DBIC_TRACE="1=/tmp/sql.debug"
all the statements will be printed in this file.

I got this info from i'm a lumberjaph which is a great blog about web programming in general and also have quite a few posts about perl and catalyst.

HTML::FormFu resources

html-formfu (listserv)

Integrate HTML::FormFu with DBIx::Class :

COALESCE

Since I've got back to SQL recently it's nice to learn new tricks. COALESCE is great for defaulting to a value after for example a left join.

SQL

SELECT bindings.*, COALESCE( ft.binding, bindings.binding ) AS sortable_binding
FROM bindings
LEFT OUTER JOIN ( SELECT binding, binding_id FROM bindings_translated WHERE language = ? ) AS ft ON ( ft.binding_id = bindings.id )


DBIx:Class

$c->stash->{collections} = [ $product->collections(
{
language => $c->stash->{language}
},
{
'+select' => \'COALESCE(translations.collection, me.collection) AS translated_collection',
join => [ 'translations' ],
order_by => [ 'translated_collection' ],
}
)->all() ];

perl I18N

If you are using .po files for I18N don't forget to make sure the header has the correct content-type.

I didn't get my Japanese translations encoded in utf-8 to work until I corrected the copy/pasted header.

"Content-Type: text/plain; charset=utf-8"

Perl resources

Perl is alive

Catalyst resources

catalyst (listserv)

DBIx::Class resources

dbix-class (listserv)

Basecamp

We have started using Basecamp at work.

Here are some formatting tips:

Toolbars:
Basecamp formatter (Google Chrome)
Basecode (Firefox)

Monday, March 22, 2010

Configure Apache for multiple instances of catalyst module in fastcgi

FastCgiServer /home/andreas/MyModule/script/pbweb_fastcgi.pl -processes 3
FastCgiServer /home/andreas/MyModule2/script/pbweb_fastcgi.pl -processes 3

NameVirtualHost *:80

<VirtualHost *:80>
ServerName a.xyz.com
Alias / /home/andreas/mymodulea/script/mymodule_fastcgi.pl/
</virtualhost>

<VirtualHost *:80>
ServerName b.xyz.com
Alias / /home/andreas/mymoduleb/script/mymodule_fastcgi.pl/
</virtualhost>

The end / after mymodule_fastcgi.pl is really important.

Configure Apache for multiple instances of catalyst module in mod_perl

The trick was to:
use virtual hosts
PerlOptions +Parent to create a new interpreter
PerlModule instead of PerlLoadModule which caused apache to crash

NameVirtualHost *:80

<VirtualHost *:80 />
ServerName a.xyz.com
PerlOptions +Parent
PerlSwitches -IC:/mymodulea/lib -IC:/morestuff/lib
PerlModule MyModule
<Location />
SetHandler modperl
PerlResponseHandler MyModule
</Location>
</VirtualHost>

<VirtualHost *:80 />
ServerName b.xyz.com
PerlOptions +Parent
PerlSwitches -IC:/mymoduleb/lib -IC:/morestuff/lib
PerlModule MyModule
<Location />
SetHandler modperl
PerlResponseHandler MyModule
</Location>
</VirtualHost>

Update
Sorry to say I only got this working on Windows since DBD:Pg caused error on CentOS.

Tuesday, January 26, 2010

Books you need to buy 3

It's time to update my original list of essential books you need as a (windows) programmer. I'll add some titles the coming weeks.

Web
Learning Perl, 5th Edition, Randal Schwartz, Tom Phoenix 2008 (the very basics)
Intermediate Perl, Randal L. Schwartz, 2006 (references, structures, objects)
Mastering Perl, Brian D. Foy, 2007 (debugging, profiling, config, pod)
Programming Perl, 3rd Edition, Larry Wall, 2000 (more like a reference, includes a bit of everything from the above three)
Advanced Perl Programming, Simon Cozens, 2005 (available modules like DBI and Template Toolkit)
Perl Cookbook, Tom Christiansen, 2003
Perl Best Practices, Damian Conway, 2005
Perl Template Toolkit, Darren Chamberlain, 2003
PostgreSQL, Korry Douglas, 2010

General
Software Fundamentals: Collected Papers, David L. Parnas
Code Complete, Steve McConnell 2004
The Pragmatic Programmer, Andrew Hunt, David Thomas, 1999

Development Processes

Applying UML and Patterns, 3d edition
, Craig Larman 2004
Agile and Iterative Developmen: A Manager's Guide
, Craig Larman 2003
Agile Software Development, Principles, Patterns, and Practices, Robert C. Martin
The Pragmatic Programmer: From Journeyman to Master
, Andrew Hunt, David Thomas
Practices of an Agile Developer: Working in the real world, Venkat Subramaniam, Andy Hunt


Design Patterns
Design Patterns: Elements of Reusable Object-Oriented Software, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides

Designing Interfaces: Patterns for Effective Interaction Design, Jenifer Tidwell, 2005

Refactoring
Refactoring: Improving the Design of Existing Code, Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Roberts
Working Effectively with Legacy Code
, Michael Feathers

C++
The C++ Programming Language, Bjarne Stroustrup


COM
Essential COM, Don Box 1997
Inside Com (Microsoft Programming Series), Dale Rogerson 1997
ATL Internals (The Addison-Wesley Object Technology Series)
, Brent E. Rector, Chris Sells 1999
Programming Distributed Applications With Com & Microsoft Visual Basic 6.0, Ted Pattison

Windows

Programming Windows
, Charles Petzold 1998
Programming Windows With MFC, Jeff Prosise 1999

MFC
MFC Internals: Inside the Microsoft(c) Foundation Class Architecture
, George Shepherd 1996

Computer Security

Applied Cryptography: Protocols, Algorithms, and Source Code in C, Bruce Schneier 1995
Building Secure Software,
Gary McGraw 2001
Exploiting Software, Gary McGraw 2004
Software Security: Building Security In (Paperback), Gary McGraw 2006
Writing Secure Code, Michael Howard 2002
Secure Programming Cookbook for C and C++, Matt Messier, John Viega 2003

OpenSSL, SSL, TLS
Network Security with OpenSSL, Pravir Chandra, Matt Messier, John Viega 2002
SSL and TLS, Eric Rescorla 2000

WPF

Programming WPF, Chris Sells, Ian Griffiths, 2nd Ed, 2007

Windows debugging
Advanced Windows Debugging, Mario Hewardt, Daniel Pravat, 2007