Tuesday, September 28, 2021

Change detection in EF

Entity Framework change tracking is often something that doesn't require too much thought from the app developer. However, change tracking and the DetectChanges method are a part of the stack where there is a tension between ease-of-use and performance. For this reason it can be useful to have an idea of what is actually going on such you can make an informed decision on what to do if the default behavior is not right for your app.

Part 1: What does DetectChanges do?
http://blog.oneunicorn.com/2012/03/10/secrets-of-detectchanges-part-1-what-does-detectchanges-do/

Part 2: When is DetectChanges called automatically?
http://blog.oneunicorn.com/2012/03/11/secrets-of-detectchanges-part-2-when-is-detectchanges-called-automatically/

Part 3: Switching off automatic DetectChanges
http://blog.oneunicorn.com/2012/03/12/secrets-of-detectchanges-part-3-switching-off-automatic-detectchanges/

Part 4: Binary properties and complex types
http://blog.oneunicorn.com/2012/03/13/secrets-of-detectchanges-part-4-binary-properties-and-complex-types/

Monday, September 20, 2021

Lambda and anonymous functions

The point here is that whether a function has a name or not is not particularly important compared to whether or not the function is used as data. JavaScript supports named and unnamed lambdas, and it's useful to understand that a named function can be anonymous. If you don't consider a named function to be a lambda, you're missing the point of lambdas. TL;DR - Lambda means "function expression used as data".

Tuesday, October 27, 2020

Entity Framework .Remove() vs. .DeleteObject()

If the relationship is required (the FK doesn't allow NULL values) and the relationship is not identifying (which means that the foreign key is not part of the child's (composite) primary key) you have to either add the child to another parent or you have to explicitly delete the child (with DeleteObject then). If you don't do any of these a referential constraint is violated and EF will throw an exception when you call SaveChanges - the infamous "The relationship could not be changed because one or more of the foreign-key properties is non-nullable" exception or similar.

Entity Framework .Remove() vs. .DeleteObject()

Thursday, December 13, 2018

Get raw query from Elasticsearch NEST client

https://stackoverflow.com/questions/28939022/get-raw-query-from-nest-client
var json = elasticClient.RequestResponseSerializer.SerializeToString(request);
Great for debugging and finding out what json you are sending.

Wednesday, December 12, 2018

DateTime and DateTimeOffset

Choosing between DateTime, DateTimeOffset, TimeSpan, and TimeZoneInfo

DateTime.ToLocalTime

Utc This instance of DateTime is converted to local time.
Local No conversion is performed.
Unspecified This instance of DateTime is assumed to be a UTC time, and the conversion is performed as if Kind were Utc.

DateTime.ToUniversalTime

Utc No conversion is performed.
Local The current DateTime object is converted to UTC.
Unspecified The current DateTime object is assumed to be a local time, and the conversion is performed as if Kind were Local.

Tuesday, June 5, 2018

ServiceBus Serialization Scenarios

ServiceBus Serialization Scenarios.
Use BrokeredMessage with explicit json to understand whats going on.
E.g. for using in Azure functions
class MyData
{
 public string name {get;set;}
}

// Sender
[FunctionName("Send")]
public static void Send(..., [ServiceBus("%Topic%")] out BrokeredMessage brokeredMessage, ...)
{
 ...
 MyData myData = new MyData();
 string bodyJson = JsonConvert.SerializeObject(myData);
 brokeredMessage = new BrokeredMessage(bodyJson);
 brokeredMessage.Label = "My routing info";
 ...
}

// Receiver
[FunctionName("Receive")]
public static void Receive([ServiceBusTrigger("%Topic%", "%Subscription%")] BrokeredMessage brokeredMessage, ...)
{
 ...
 string bodyJson = brokeredMessage.GetBody<string>();
 MyData myData = JsonConvert.DeserializeObject<MyData>(bodyJson);
 ...
}

If you want to send a test message using Service Bus Explorer in the send message dialog just paste the json e.g. {"name":"Andreas"} into Message -> Message Text and then set Sender -> Body Type to String (i.e. not Stream). Set the Label as well if you want to route the message.
ServiceBus Serialization Scenarios
Messages, payloads, and serialization
Azure Service Bus bindings for Azure Functions

MVC json DTO

If you got a DTO and want camelCase json when returning data.

Is there any benifit in using DataContract and DataMember attributes while working with Asp.net Web API?

Is there a way to alias response model properties in ASP.Net Web API

JSON and XML Serialization in ASP.NET Web API

Thursday, February 25, 2016

Javascript (KnokcoutJS) code that for some reason work in Chrome but not IE?

Had some problems at work where KnockoutJS code worked fine in Chrome but not at all on IE. The problem was ajax caching being done in IE for GET requests.

Observables does not update values

AJAX requests not executing or updating in Internet Explorer? Here's a solution

Wednesday, November 18, 2015

Great article about javascript function declarations vs function expressions

Function Declarations vs. Function Expressions
https://javascriptweblog.wordpress.com/2010/07/06/function-declarations-vs-function-expressions/

And there are other reasons to favour Function Expressions?
How did you guess?
a) Function Declarations feel like they were intended to mimic Java style method declarations but Java methods are very different animals. In JavaScript functions are living objects with values. Java methods are just metadata storage. Both the following snippets define functions but only the Function Expression suggests that we are creating an object.

//Function Declaration
function add(a,b) {return a + b};
//Function Expression
var add = function(a,b) {return a + b};


Compare to C# Anonymous functions:

Anonymous Functions (C# Programming Guide)
https://msdn.microsoft.com/en-us/library/bb882516.aspx

Tuesday, December 9, 2014

CQRS

Martin Fowler

CommandQuerySeparation (Martin Fowler)
http://martinfowler.com/bliki/CommandQuerySeparation.html

CQRS (Martin Fowler)
http://martinfowler.com/bliki/CQRS.html

CQRS, Task Based UIs, Event Sourcing agh!
http://codebetter.com/gregyoung/2010/02/16/cqrs-task-based-uis-event-sourcing-agh/

Microsoft

Reference 1: CQRS in Context
http://msdn.microsoft.com/en-us/library/jj591560

Reference 2: Introducing the Command Query Responsibility Segregation Pattern
http://msdn.microsoft.com/en-us/library/jj591573

Reference 3: Introducing Event Sourcing
http://msdn.microsoft.com/en-us/library/jj591559

Reference 4: A CQRS and ES Deep Dive
http://msdn.microsoft.com/en-us/library/jj591577

CQRS Journey
http://msdn.microsoft.com/en-us/library/jj554200.aspx

Command and Query Responsibility Segregation (CQRS) Pattern
http://msdn.microsoft.com/en-us/library/dn568103.aspx

Event Sourcing Pattern
http://msdn.microsoft.com/en-us/library/dn589792.aspx

CRUD, Only When You Can Afford It
http://msdn.microsoft.com/en-us/library/ms978509.aspx

Greg Young

Stereotypical Architecture
https://cqrs.wordpress.com/documents/a-stereotypical-architecture/

CQRS Introduction
https://cqrs.wordpress.com/documents/cqrs-introduction/

CQRS and Event Sourcing
https://cqrs.wordpress.com/documents/cqrs-and-event-sourcing-synergy/

Task-Based UI
https://cqrs.wordpress.com/documents/task-based-ui/

CQRS provided by Edument

http://cqrs.nu/

http://cqrs.nu/tutorial/cs/01-design http://cqrs.nu/tutorial/cs/02-domain-logic http://cqrs.nu/tutorial/cs/03-read-models http://cqrs.nu/tutorial/cs/04-web-app-integration http://cqrs.nu/tutorial/cs/05-other-matters

Thursday, June 19, 2014

Show image dimension in OS X Finder column view

Just add the word Pictures (capital P) to the front of your folder name, and you will miraculously get Dimensions and Resolution as a column option. Then just rename it back. It works for subfolders as well.

 Thanks Ivan!

Wednesday, April 10, 2013

Monday, April 8, 2013

Friday, April 5, 2013

My domain names dummy for managing my job

Terminology
A-record
The mapping from a name to ip.
abc.com → 123.123.123.123

CNAME-record
Aliases like www.abc.com → abc.com.
A CNAME always should point to an A-record.

How to redirect a domain 4 Apr
When we have acquired a domain name from a domain name registrar (like 1&1 or Godaddy) we have to redirect it to the actual site. Either it is the name of an original site (abc.com), or it is just an alias to an exisiting site (abc.net).

When setting up an original site the name has to be registered with the hosting provider. Either as the main domain or as an add on domain on the specific host (a2hosting terminology).

HTTP Redirect
If we just want to redirect a newly acquired domain name to the original site a http redirect is the simplest to add. For this kind of redirect only the domain name information at the registrar has to be edited. No edits need to be made at the hosting provider. Only http traffic will be redirected.

E.g. When typing abc.net in the browser you will be redirected to abc.com. www.abc.net will also work.

CNAME
The other alternative is to edit the cname for the acquired domain name. No edits need to be made at the hosting provider.

E.g. For abc.net you provide abc.com as cname. www.abc.net will also work.

Name servers
And the third alternative is to redirect using name servers. Typically you change the name servers at the registrar to point to the hosting provider. E.g. from 1&1 name servers to ns3.a2hosting.com. When using cname or name servers all kinds of traffic will be redirected. For this to work the names servers at the hosting company needs to be edited as well. An alias need to be added. (Parked domain in a2hosting terminology.)

E.g. abc.net must be added as a parked domain on the hosted server. For www.abc.net to be redirected as well it must be setup as a subdomain at the domain registrar and redirected to the same name servers. (Then at e.g. a2hosting the www. subdomain is known by default so it does not need to be added.)

A-record
If we a re setting up an original site and have a known IP then editing the A-record at the domain registrar can be of interest. But most likely (if we are using a web hosting service) we would like to do a name server redirect in this case.

Interesting VR news from Valve and GDC

Michael Abrash talk at Game Developers Conference 2013
Why Virtual Reality Is Hard (and where it might be going)
And his colleague Joe Ludwig
Lessons learned porting Team Fortress 2 to Virtual Reality

Thursday, April 4, 2013

My first usenet post 9/3/97

https://groups.google.com/d/msg/comp.windows.x.motif/jmuwjoWuG6U/uB8XS3Aop3UJ

On Wednesday, September 3, 1997 9:00:00 AM UTC+2, Andreas Nilsson wrote:

I'm currently porting an Motif application that have been runnning on
SunOS  4.1.1 (X11R4 and unknown Motif version) to Solaris 2.5.1 (X11R5
and Motif 1.2).
On SunOS all the windows default size were correct, i.e. all the
buttons, scollbars etc fitted nicely in the windows as they were
created. On Solaris the windows
are created in minimum size by default (so you can't see whats in them).
The typical window is constructed of a form widget in a dialogshell
widget. Of course
the form widget then includes subwidgets in the form of buttons and
scollbars.
As far as I can see all the widgets are created and managed in the
correct order.

It is not an acceptable solution to set default width and height on
every window in the application.

Anyone got a clue about what I'm doing wrong ??

Thanks in advance
Andreas

--
-----------------------------------------------------
 Andreas Nilsson         E-mail: and...@basesoft.se
 Basesoft Open Systems   Voice:  +46  (0)8  13 17 20
 P.O. Box 34 140         Fax:    +46  (0)8  13 17 25
 S-100 26 Stockholm
 Sweden
-----------------------------------------------------

Wednesday, November 28, 2012

Windows 7 old alt-tab behaviour

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"AltTabSettings"=dword:00000001

Thanks to Scott Weinstein

Tuesday, November 13, 2012

GDS design principles

Design principles for digital services published by the UK Gov.

GDS design principles

1 Start with needs*
2 Do less
3 Design with data
4 Do the hard work to make it simple
5 Iterate. Then iterate again.
6 Build for inclusion
7 Understand context
8 Build digital services, not websites
9 Be consistent, not uniform
10 Make things open: it makes things better

Monday, April 30, 2012

Failure is fine

Great post by Michael Abrash about organizations, Valve in particular, and the acceptance of failure. And about formal management (or rather the absence of it).

Valve: How I Got Here, What It’s Like, and What I’m Doing

Also read Valves excellent employee handbook. It is truly inspirational!


Thursday, March 15, 2012

Internet beginnings

The wayback machine at the Internet Archive is an amazing resource.

Check out my old webpage from January 1997 that I had as a member at the ABC-klubben in Sweden.

https://web.archive.org/web/19970110005245/http://abc.se/~m10476/

The Bibliotheca Alexandria has an excellent mirror (archive.bibalex.org) of the Internet Archive.

Tuesday, March 13, 2012

jqGrid

jqGrid has a lot more features than WebGrid (like inline editing and frozen columns and group column headers).

Online sample and description
www.trirand.net/demoaspnetmvc.aspx

Sample of using jqgrid in MVC 3
tpeczek.codeplex.com/releases/view/61796

Sample database Northwind
www.codeproject.com/Articles/42837/HowTo-Install-the-Northwind-and-Pubs-Sample-Databa

Thursday, March 1, 2012

Awesome Screnshoot

Great extension and service for saving and annotating screenshots from you web browser. Available for Chrome, Firefox and Safari. www.awesomescreenshot.com

Readability

Great service for saving web articles and reading them later. www.readability.com

Wednesday, February 22, 2012

ASP.NET MVC 3 Security Introduction

Great introduction on Pluralsight to security issues you face when deploying an ASP.NET MVC 3 application.

Security and ASP.NET MVC 3 (Pluralsight)

ASP.NET Security (microsoft)

"With easier I think Scott (Hanselman) means not impossible", Scott Allen in regards to IIS Express ssl configuration.

Tuesday, May 24, 2011

Thursday, May 19, 2011

Thursday, February 10, 2011

Thursday, January 20, 2011

Running SQL Server Management Studio over VPN

If you want to run SQL Server Management Studio over VPN using Windows Authentication you have to somehow supply your credentials from the target domain.

This is how:
use the "runas" command from the command prompt and be sure the include the /netonly switch and specify the user account from your target domain. If you do not include the /netonly switch you will probably get a "no logon servers" type of message. When you connect to a sql server with Windows Authentication it will look like you are using your local account, however, your target domain account credentials will be passed to the sql server!

Here's and example of the command. You can create a shortcut for ease of use. NOTE: you will always be prompted for your password.

RUNAS /user:targetDomain\username /netonly "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

On Vista you will need to be sure that you're running as Administrator if you have UAC configured.

If you make a shortcut right click and choose Run as adminstrator when you want to run it.

Thanks to LucidObscurity writing in the thread Windows Authenticaton - Different Domain.

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

Tuesday, November 17, 2009

Thursday, November 12, 2009

SVN on Windows

SVN Server
Download windows installer
Choose an installation path without white space in it to make things easier (or remember to escape spaces in the path)
Go for svnserve for an easy setup
Run install with the above choices
Open firewall poer 3690
Verify that the user the service is running as has write access to the repository folder
Create repository (command line)
Edit ./conf/svnserve.conf and ./conf/passwd

Tortoise SVN Client
Download tortoise svn client (explorer shell extension)
Install
Exclude folders not used for workspaces (ie Exclude paths: , Include paths: C:\svnwc\)

Tweaks
Started with a repository under N:\Development\SVN_Rep and in that the folder structure like pbweb/trunk/.... I.e. the repository was supposed to store several projects.

Since trac wants to match it’s projects with a specific svn repository I changed the repository layout to only one project in each repository. So now the repository is in N:\Development\SVN_Rep\projectname. And the folder structure starts with trunk/....

The server serves all repositories under N:\Development\SVN_Rep.

Some CentOS basics

First try
Some basic app admin
chkconfig, activate/deactivate services,
service, start and stop services
system-config-securitylevel

Get VNC up and running
Follow the instructions.
If you get an error that says bad display name when starting the vgcnserver at the end make sure that the machine recognizes it’s name. If not add it to /etc/hosts.
Open up the firewall for 5901 (and perhaps more) by running system-config-securitylevel

Apache
service httpd start
chkconfig httpd on
Works to connect from my windows machine after this

PostgreSQL
Followed the instructions approximately.
Got an error at the Starting postgresql service: prompt.
Read something about SELinux causing problems so I shut it down and rebooted and the server seems to be running. Don’t know if it was related with SELinux though.

Second try
During installation
For tasks, choose “Desktop – Gnome” and Server
Disable firewall and SELinux

Installed software
Perl 5.8.8
mod_perl 2.0.4
httpd 2.2.3
PostgreSQL not installed
Check installed version:

# rpm -q

VNC
As above.

PostgreSQL
8.3.6 install
# rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-6.noarch.rpm
# yum install postgresql-server
Followed the book then a bit for initdb:

# su - postgres
-bash-3.2$ initdb
...
-bash-3.2$ exit
Start service and autostart at reboot:

# service postgresql start
# chkconfig postgresql on

Ended up with 8.3.9 but that should be ok.

Createuser and db:

# su - postgres
-bash-3.2$ createuser XYZ
-bash-3.2$ createdb -O XYZ XYZ

ftp
service vsftpd start
chkconfig vsftpd on

Add data to db
# psql -U XYZ < XYZ.sql

Apache
As above.

Perl stuff

Started with:

# yum install postgresql-devel.x86_64
# yum install gcc
since pg_config and gcc is needed when running:

# cpan install Bundle::DBD::Pg
When checking things out with get_datasources.pl (from the book) make sure to use a user that can read db and script. I added XYZ as a unix user and copied the script to ~ before getting it to work. Don’t know why though.

# cpan install Catalyst::Devel
Results in a million dependencies, just said yes to everything. Something was installed.

Readability and Instapaper

Great tools for reading articles:

Open stuff for web development

CentOS

Thursday, June 18, 2009

Augmented reality

Finally an augmented reality app finding its way to the public! That is if you have an Android phone...
Check out Layar, an augmented browser from SPRXMobile.

Friday, March 20, 2009

Obama Headlines

Check out Obama Headlines by Vertigo. A great Deep Zoom demo.

Photosynth update

Photosynth viewer in Silverlight
Explore Synths in Silverlight

Photosynth on the iPhone

Read about all the other interesting updates regarding Photosynth on their blog!

Seadragon AJAX

There are plenty of times when you want to see something closer, to get a good look at the texture of a sculpture, or find out if that's a reflection or a scratch on that used car you're looking at.

Seadragon, implemented as the Deep Zoom feature of Silverlight, allows you to do that. But what if you're not using the Silverlight platform? That's what Seadragon Ajax is for.

PS
Seadragon Mobile is available for the iPhone as well!

Better Place update

Electric cars for all! David Pogue writes about Better Place in NY Times.

Thursday, February 19, 2009

OpenSSL Command-Line HOWTO

Excellent OpenSSL Command-Line HOWTO by Paul Heinlein

reCAPTCHA



Read about how CAPTCHAs are used to help digitize books for the Internet Archives.

http://recaptcha.net/learnmore.html

Wednesday, February 11, 2009

Tuesday, February 10, 2009

Monday, November 17, 2008

Livescribe && OS X = true, HWR && PC == true

Finally!

Livescribe Pulse supports Mac OS X!

The Business Wire article also breaks the news that hand writing recognition will finally be available through Vision Objects MyScript for Livescribe!

Is that based on MyScript Notes? Only PC?

I wonder how the MyScript integration with the Livescribe desktop is done? Will the MyScript app read the .afd files or is it more tightly integrated using the forthcoming "Desktop SDK"? It will be really interesting to see!

Engadget blog post

Business Wire

Update

Livescribe's press release

Tuesday, November 4, 2008

Livescribe shipping to Sweden

Livescribe has started to ship the Pulse outside the US.

To accommodate other international requests, Amazon US is currently shipping overseas to the following countries: Austria, Canada, Chile, Denmark, Finland, France, Germany, Great Britain, Hong Kong, Ireland, Italy, Mexico, Netherlands, New Zealand, Norway, Portugal, Saudi Arabia, Singapore, Spain, Sweden, Switzerland, Taiwan, Thailand, United Arab Emirate.

Friday, October 31, 2008

Congratulations Livescribe

The Pulse is number 4 on Popular Mechanics Top 10 Most Brilliant Gadgets of the Year!

Great work eveyone at Livescribe! Let's hope that 2009 brings even more success!

Wednesday, September 17, 2008

Livescribe Pulse reviewed in swedish newspaper Dagens Nyheter



There is a short review of the Livescribe Pulse in the swedish newspaper Dagens Nyheter today:

Anteckna snabbare med vassa pennan
(Take notes faster with a sharp pen)

They seem to be quite impressed with the pen and the paper replay functionality. The only negative being that you have to wear the earplugs for the best sound recording. They would have preferred a solution with a external microphone that could be placed on a table.

They also note that the Pulse isn't available in Europe (yet) and cites that Livescribe refers to Amazon for buying and importing the pen. I guess they (Livescribe and Dagens Nyheter) missed the following info on Amazon:

Shipping: Currently, item can be shipped only within the U.S.

Wednesday, August 27, 2008

Ubiquity

Ubiquity from Mozilla Labs was released in an alpha the other day.


Ubiquity for Firefox from Aza Raskin on Vimeo.

Thursday, August 21, 2008

Photosynth


Microsoft have released the first online version of Photosynth!

Read David Pogue's review in NYTimes.

Read my previous entries about Photosynth.

Tuesday, August 19, 2008

Standing Next To Me, The Last Shadow Puppets

Better Place

I've just read a great article about Better Place in Wired. Fascinating how such a simple idea have been ignored until now. And then suddenly someone thinks outside the box. And boom!

Better Place (website)
Better Place (Wikipedia)

Wednesday, August 6, 2008

Burn Your Burndown Charts

Burn Your Burndown Charts is an interesting post by Jurgen Appelo at the excellent site Agile Software Development. It describes some alternatives to the traditional burndown chart in Scrum.

He runs another interesting blog as well at NOOP.NL.

Tuesday, August 5, 2008

WPF tutorial

Scott Hanselman has written a fun little WPF tutorial by implementing a kids game called BabySmash.

Books you need to buy 2

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.

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

Sunday, June 29, 2008

Pork and Beans, Weezer

Weezer's latest single is quite good. And fun. Sorry to say the Red Album isn't as good as the exceptional Pinkerton and Blue Album. But Weezer always rocks!

Monday, June 23, 2008

CUDA

Here are some interesting articles about CUDA (Compute Unified Device Architecture):

Are you interested in getting orders-of-magnitude performance increases over standard multi-core processors, while programming with a high-level language such as C? And would you like that capability to scale across many devices as well?

Rob Farber, Dr. Dobb´s

CUDA, Supercomputing for the Masses: Part 1

Nvidia's CUDA: The End of the CPU?

Monday, June 16, 2008

Ubuntu update

I had a good laugh yesterday reading LinuxHater's Blog. After my installation of Ubuntu the other week I thought that Linux really isn't that bad. But yesterday evening my wife was watching streaming TV on our laptop, ie Windows, and it kept freezing up. So I thought that now was the time to check out Ubuntu and see how good it was! But during boot the laptop got stuck and promted BusyBox and initramfs. So I gave up and uninstalled Ubuntu immediately. I mean, WTF!

Monday, June 9, 2008

Patterns in Practice

Patterns in Practice is a new article series in MSDN Magazine. It starts off with the Open Closed Principle. Read my previous post about programming principles.

Tuesday, June 3, 2008

Google goes Photosynth

Google has implemented Look Around in Panoramio and it is a photo technology very reminiscent of Microsoft Photosynth. Read my previous post as well.

Monday, June 2, 2008

Hitta 3D

This is extremely cool map technology rivaling what is done both at Microsoft and Google.

Hitta 3D

You can currently find lots and lots of ugly graphics in the view but I am anyway surprised at how good the rendering is based only on automatic data prcessing.

Sunday, June 1, 2008

Ubuntu

It's is more than 10 years since I regularly used a Unix system. I have of course followed the Unix/Linux development in general over the years but have never seen a reason to head back. I work with Windows and I use Windows at home. By parents have got a Mac and I really like Mac OS X and have thought about switching to this platform in the future.

Anyway the other day I read about Ubuntu 8.04 and Wubi and decided to give it a try.

First I installed it on my old Shuttle SB81P configured with one IDE disk, one SATA and a Powercolor 800XL. Everything went extremely well and I had my Ubuntu up and running after approx. 30 minutes. The default installation works fine and I haven't bothered to check what packages actually got installed.

Secondly I installed it on my even older laptop Acer Travelmate 632LC. This machine has some integrated Geforce2 graphics and an old disk that regularly gives me trouble. The first install got disk problems half way through. I cancelled the installation and got the choice to save the downloaded data in a backup. I tried once more and now the install went fine. But when booting up the first time the machine hung when formatting swap disk. I found an advice to rename the swap disk (C:\ubuntu\disks\swap.disk -> C:\ubuntu\disks\noswap.disk ) and restart so I tried that and now it booted up nicely! (Afterwards I found this error description that sounds like my error, I haven't verified the fix though.) Everything seemed to work fine and I got the option to upgrade the video drivers by the system since the Geforce2 obviously was detected. I accepted this and rebooted. Now the 2D performance became totally unacceptable. I was a lot worse than the default drivers. The fix for this was to uninstall the nvidia-glx drivers and install the nvidia-glx-legacy drivers. This was simple using the Synaptic Package manager.

Most impressive was that Ubuntu/Wubi detected my Netgear WG511 wireless adapter on my laptop and got it running without a problem!

So now I got Ubuntu on two machines at home. I have tried some basic functions like using the Firefox browser, the Open Office package and the default media player. Everything works fine but I can't see one reason to stop using Windows! It was a fun excercise though!

Update
Perhaps I'll try using MonoDevelop for some .NET (Mono) development on this platform in the future to see how it compares with the express versions of Visual Studio.