Friday, October 07, 2011

EC2 OpenSuSE 11.4 install

zypper install yast2 yast2-ncurses yast2-ftp-server yast2-sshd yast2-online-update yast2-mail yast2-ldap yast2-ldap-server yast2-http-server
zypper install vsftpd
zypper install php5 php5-pear php5-mbstring php5-mysql php5-pear php5-bz2 php5-curl php5-ctype php5-gd php5-fastcgi php5-iconv php5-hash php5-json php5-mcrypt php5-sqlite php5-tokenizer php5-xmlreader php5-xmlwriter
zypper install apache2-mod_php5 apache2-mod_mono
zypper install subversion subversion-server
zypper install mysql-community-server
zypper install Imagemagick

curl -O http://www.magentocommerce.com/downloads/assets/1.5.1.0/magento-1.5.1.0.tar.gz
curl -O http://ftp.drupal.org/files/projects/drupal-7.8.tar.gz
curl -O http://wordpress.org/latest.tar.gz
curl -O http://websvn.tigris.org/files/documents/1380/49056/websvn-2.3.3.tar.gz
curl -O http://www.phpbb.com/files/release/phpBB-3.0.9.tar.bz2

mv *.gz /srv/www/htdocs
cd /srv/www/htdocs
tar -xvf magento-1.5.1.0.tar.gz
tar -xvf drupal-7.8.tar.gz
tar -xvf latest.tar.gz
tar -xvf websvn-2.3.3.tar.gz
tar -xvf phpBB-3.0.9.tar.bz2
rm *.gz
mv drupal-7.8 drupal
mv websvn-2.3.3 websvn

chmod a+w drupal/sites/default
cp drupal/sites/default/default.settings.php /drupal/sites/default/settings.php
chmod -R o+w magento/media magento/var
chmod o+w magento/app/etc
mv wordpress/wp-config-sample.php wordpress/wp-config.php
cp websvn/include/distconfig.php websvn/include/config.php
chmod 666 phpBB3/config.php
chmod 777 phpBB3/store/ phpBB3/files/ phpBB3/cache phpBB3/images/avatars/upload/

/etc/rc.d/mysql start
/etc/rc.d/apache2 start

mysql
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'xxx';
CREATE USER 'drupal'@'localhost' IDENTIFIED BY 'xxx';
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'xxx';
CREATE USER 'phpBB3'@'localhost' IDENTIFIED BY 'xxx';
CREATE DATABASE magento;
CREATE DATABASE wordpress;
CREATE DATABASE drupal;
CREATE DATABASE phpBB3;
GRANT ALL ON magento.* TO magento@localhost;
GRANT ALL ON drupal.* TO drupal@localhost;
GRANT ALL ON wordpress.* TO wordpress@localhost;
GRANT ALL ON phpBB3.* TO phpBB3@localhost;
exit

https://api.wordpress.org/secret-key/1.1/salt
edit content of wp_config file
vi wordpress/wp-config.php

http://dev.appcrowd.com/drupal/
http://dev.appcrowd.com/magento/install.php
http://dev.appcrowd.com/wordpress/wp-admin/install.php
http://dev.appcrowd.com/phpBB3/install

chmod a-w drupal/sites/default
rm -rf phpBB3/install/
rm -rf phpBB3/docs
chmod 644 phpBB3/config.php

Sunday, November 07, 2010

VisualStudio 2010 close window performance

Finally I've got to the bottom of one of the Visual Studio 2010 performance problems.

Using Mark Russinovich's Sysinternals ProcessMonitor I cleared by environment down as best as possible and did some evaluation of what devenv.exe was accessing.

For some reason it's accessing the .proj files on a very frequent basis but it doesn't appear to be this causing the performance issue.

Using the File Summary option under tools though indicated that whilst closing a single editor tab there was just over 1 second being spent writing to the suo file - that seems very excessive.

Looking at the .suo file for the solution it was 1.2MB in size - hardly excessive but I guess it all depends on what it contains. I renamed the file and repeated the close of the editor window... almost no lag... a solution? Well possibly.

So what does the suo file contain? It's an OLE compound document and appears to contain a whole bunch of information persisted by the VS and any add-ins.

Have now been assigned a Microsoft Connect bug id of 619775 so will see if they accept and fix it.

Sunday, October 31, 2010

SQL Server Reading

It's been a while since I sat down a read a decent book in the SQL server space - I'm fairly sceptical about the new additions to most database products recently - they've not really been addressing core functionality - just adding minority requirements that don't really gain much.

Considering the above I wasn't expecting much from a single read so bought a collection of books and though that across them I might find a few useful bits and pieces - I was pleasantly surprised by all three books - each had something unique to say and each approached the subject in quite distinct ways.

Links to the books below:





Saturday, October 30, 2010

VisualStudio 2010 performance

Editor performance in VisualStudio on my machine is best described as dreadful - it's very rare to be working on an editor where you actually have to look up to see where the cursor has actually got to especially when touch typing - and yet in VS2010 you have to because it reacts so poorly.

There's a semblance of a fix which has worked for me by turning off the hardware acceleration (due to VS2010 being a WPF app). Tools -> Options -> General -> in the middle are a bunch of options for experience - turn them all off and see if you find that it speeds up.

Friday, October 29, 2010

Compro VideoMate S350 on SuSE 11.2

Well according to the forums people have varied luck with the S350 - I guess there must be multiple models out there as I finally got mind working although it was a bit of a challenge.

The card has the following chipset

saa7164 - this is detected as an unknown card
saa7130/34 - this is detected by v4l2 and driver version 0.2.16 is loaded
saa7133 - this is detected correctly as a Compro VideoMate S350/S300 (card 169)

After dbb_init() the adapter is registered
saa7133[0]
Zarlink ZL10313 DVB-S

This gives you a single channel DVB-S adapter to play with

Saturday, October 16, 2010

Hauppauge Nova-PCI

Hauppauge Nova-PCT DTV tuner

Requires the following settings in /etc/modprobe or /etc/modprobe.d

options dvb_usb_dib0700 force_lna_activation=1
options dvb_usb disable_rc_polling=1

Thursday, July 29, 2010

MVC 2 Notes

Some brief notes about gotcha's and good practices for ASP.Net MVC 2

  • Always use Html.AntiForgeryToken() and use the [ValidateAntiForgeryToken] attribute to ensure that it has been checked on each action

  • Add ActionFilters to handle errors against each controller for the standard error types such as that thrown from ValidateAntiForgeryToken

  • Model binders will bind anything at any time so ensure that binding policies are in place so that users can maliciously bind data

  • Use Linq-to-SQL timestamp logic to protected against concurrency patterns along with the pattern whereby a "stub" object is created with just the PK and the TS value. Then use the Attach method in Linq to do the actual update. Again trap the error and provide good options for the user to continue

  • Use T4MVC to pre-parse all magic-strings into constants and use them throughout

  • Use localised templates copied from "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\VisualBasic\Web\MVC 2\CodeTemplates" / "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC 2\CodeTemplates" to get consistent and useful templates rather than the Microsoft default ones

  • Tick the box to allow edit-and-continue in web applications

  • Tick the box to ensure that the the views are compiled to make sure any errors are caught

  • Be sure to use HttpPost actions when performing any CRUD type actions to prevent spiders from accidentally performing actions

  • Use NUnit / Microsoft Test to perform unit testing of controllers and models

  • Use Moq / Rhino Mocks for mocking of objects for testing

  • Use Castle Windsor / NInject for inversion of control / dependency injection

  • Use areas to divide up large applications

  • Use post followed by a RedirectAction if successful to prevent the "repeated post" warning from the browser

  • To prevent ASP.Net from filtering some URLs use the following config parameter <httpRuntime relaxedUrlToFileSystemMapping="true"/>

  • Use DisplayTemplates to enable rendering of custom datatypes as well as the built-in ones

  • Keep an eye on the ASP.Net MVC Futures stuff on codeplex as it often contains code that will be included in the next major revisions of ASP.Net MVC

Tuesday, June 22, 2010

Exchange 2010 Public Folders

Whilst migrating from Exchange 2003 to Exchange 2010 I came across a very frustrating issue whereby the Exchange 2010 public folder tree just wouldn't replicate across from the Exchange 2003 source.

I could create new public folders in Ex2010 and see them replicate across to Ex2003 but I just couldn't find what was wrong. I could see lots of replication messages in the queue from Ex2003 but they simply weren't being accepted in Ex2010. Strangely though when I had debugging turned on I didn't feel like I could see enough messages at the Ex2010 end.

About 6 hours into the investigation I finally stumbled across the issue - Ex2003 was set to use a smarthost on the SMTP connector and it was stupidly forwarding all of the internal replication traffic via that smarthost, which in-turn was of course losing any security credentials required to actually do the replication.

Remove the smart host on the Ex2003 box (and restart the SMTP service) and all of a sudden the folder tree was in place on Ex2010.

Friday, July 24, 2009

Exchange 2007 SSL

Install certificate service and the web forms that go with it

Ensure that default.asp is included in the default documents for the /certsrv IIS folder

Ensure that anonymous login is turned off for /certsrv

Make sure you run IE as an admin otherwise some of the options (such as Web Server) don't appear

Personally I like certificate services in manual approval mode

New-ExchangeCertificate -generaterequest -subjectname "dc=local,dc=cqd,o=CodeQuest,cn=cqsrv2.cqd.local" -domainname cqsrv2.cqd.local,cqdsrv2,autodiscover.cqd.local,webmail.codequest.co.uk -PrivateKeyExportable $true -path c:\cqsrv2.request.txt

Open the request in notepad and copy and paste it into the certsrv webpage

Choose advance option and in the drop down pick "Web Server" - if it's not there then you're not authenticated as a domain admin.

Once requested go into Certificate Authority MMC and approve the pending request

Save the request as c:\cqsrv2.response.cer

Import-ExchangeCertificate -Path C:\cqsrv2.response.cer | Enable-ExchangeCertificate -Services IIS

voila!

Sunday, December 28, 2008

Visual Studio 2k8 ideas

Ideas for a plug-in for Visual Studio 2k8 - if anyone is interested in OSS'ing this then let me know!


1. Click on a variable and convert it to a with block (probably needs to work on the selection)
2. Organise imports - like the C# one - and can remove anything that is no longer needed
4. Rename that works through to an aspx/ascx page and therefore the .designer files as well
5. Go to declaration on a control takes you to the HTML source
6. Navigate from the code to the HTML designer view

Lutz Roeder's Reflector suggestions

Ideas for Lutz Roeder's reflector which I'll get around to sending to him at some point:

* Use of the new "If" function rather than "Iif" if VB

* When variable names use reserved words they should be wrapped in []

* When dividing integers the integer divide operator should be used

* In places code generated takes the form of
New XYZ isn't valid - needs to be put into a variable
But that doesn't recreate the correct reversal of code

* use of new construct and set method doesn't seem to work properly - missing the " with " operator

* use of AscW and ChrW rather than char constructor and type conversion

* x = y = 1 construct not translated correctly

* friend property get's incorrectly become get_XXX functions

* catch xyz As Object isn't valid syntax

Sunday, July 27, 2008

Implementing the Office Binary Formats

Microsoft released the Office binary format specification earlier in the year and I'm going through a fair few thousand pages of spec building .Net libraries to read and write the files at the byte level.

Below is an errata which I'll keep up-to-date during the process.


OfficeDrawing97-2007BinaryFormatSpecification.pdf

Various types aren't correct

STD is used as a default but never described
MSOCOLORNONE is used as a default but never described


P44 refers to MSOSRH, MSOPRH, MSOPV and MSOPRV which aren't documented anywhere

P49 says line left style twice but should probably say Line Row Style

P51 wzSigSetupProvId claims to be property 192 but is 1922

P52 refers to msopctSizeNone and msopctPosNone and MSOSRH which aren't defined anywhere

No documentation is provided for the additional line styles' extended color information

Tuesday, May 27, 2008

SQL Server CE 3.5 SELECT TOP

Another gotcha but this time in the dialect that SQL Compact Edition 3.5 uses.

Version 3.5 introduced a couple of new features to make it's SQL more compatible with that of SQL Server and one of those is TOP.

Simple you'd think but oh on - they've decided to use a different dialect for the same command.

In SQL server you write:

SELECT TOP 10 [name] FROM [people] ORDER BY [name]

In SQL CE 3.6 you write:

SELECT TOP (10) [name] FROM [people] ORDER BY [name]

How annoying as it means that the same piece of SQL can't be used without a little translation layer. Why anybody though that wrapping the number of lines in parenthesis was a good idea I'll never know!

Shared Folders in Virtual PC 2007

I use Virtual Machines extensively but got caught this weekend with something I've not really found documented anywhere.

I was in the middle of restoring an 18GB Oracle 9i database, and rather than muck up my dev. machine I decided a virtual machine was the obvious answer.

All went well until I tried the Oracle "imp" tool to import the database from a "Shared Folder". It got part way through and complained of a corrupted backup file.

I tried again with a different version of Oracle and the same error occurred.

It turns out that the "Shared Folders" have a limitation on file size like that of FAT which I'm guessing is a 32bit pointer as 2GB seems to be the limit.

The simple answer to the problem is to map a network drive or use UNC but I was quite surprised that the facility of the VM additions failed in such a strange way.

Saturday, May 17, 2008

Immediacy <head> gotcha

I'm currently doing some Immediacy customisation work using templates developed by an Immediacy partner.

I was getting a very strange effect on one particular page when hitting a search button that did a form post... basically the CSS got lost.

I checked the templates thoroughly and couldn't see the problem but when comparing the page before and after a post I noticed that the lines in the head tag had mysteriously had their "href" attributes changed. It appears that something within the Immediacy page pipeline attempts to "play" with the contents of the head tag and on postback it makes a right mess.

I'm guessing it's to do with the themes support within Immediacy as even on a standard page there are a bunch of injected <link> elements picking up CSS from a handler and what it appeared to be doing on postback was moving the href attributes from elements in the template to the next sibling - I even ended up with <meta> tags with a href's pointing to CSS files!

The solution to the issue is to ensure that the head tag, which normally reads as:

<head runat="server">

Is attributed without viewstate and therefore reloaded from the original ASCX file each time.

<head runat="server" enableviewstate="false">

This has now solved the issue, and on further investigation I found that more than just this one page was being affected but due to the CSS in the template it wasn't quite so obvious. I've simply done a search and replace on all templates in the solution and replaced the head tag as above - problem solved.

Tuesday, May 13, 2008

SQL Server Locks

A better alternative to sp_lock with information about the locks in the current database:


SELECT
  li.req_spid As "Session ID",
  o.[name] AS "Object Name",
  i.[name] AS "Index Name",
  v.[name] As "Lock Type",
  u.[name] As "Lock Mode"
FROM
  master..syslockinfo AS li
  INNER JOIN master..spt_values AS v ON li.[rsc_type] = v.[number] AND v.[type] = 'LR'
  INNER JOIN master..spt_values AS u ON li.[req_mode] + 1 = u.[number] AND u.[type] = 'L'
  INNER JOIN sysobjects AS o ON o.[id] = li.[rsc_objid]
  LEFT OUTER JOIN sysindexes AS i ON i.[id] = li.[rsc_objid] AND i.[indid] = li.[rsc_indid]
WHERE
  li.rsc_dbid = db_id()
ORDER BY
  o.[name],
  i.[name],
  v.[name] desc

Wednesday, May 07, 2008

Huawei E220 USB HSDPA Modem

Finally someone has managed to get the Huawei E220 Vista 64bit drivers working on Windows XP 64.

Hurrah!

Much kudos to you whoever you are.

Saturday, April 19, 2008

Forza 3 suggestions

Well I'm not going to deny it - I'm a big fan of Forza 2 and it's probably been the most entertainment for £40 I can think of.

There's a few things though, that if they make it into Forza 3 will really make my day...

In no particular order:

  • Weather effects

  • The challenge here is not to get gimmicky - PGR 4 actually did a reasonable job of rain but the snow, although fun, isn't really worth the effort it must have taken.

    There's two parts to implementing this - the first is the visual effects of water on the cars, the circuits, the spray from cars, the rain itself and of course the darkening of the skies that would add considerable atmosphere to what is a very clinical game.

    The second part is implementing aqua-planing and friction against the water in puddles - PGR4's attempt here is a good example of what can be achieved, but with the additional dynamics that are being modelled in Forza surely it could be awesome.

  • Lighting effects

  • In a similar way that rain would add atmosphere I think that other lighting effects would give the game further depth.

    In addition to the obvious one of night races, the time of the day can trigger effects such as low sun glare or mist burning off during a race.

    I think what would really make things interesting is something along the lines of a weather forecast for the race adding dynamics such as choosing tyres and pit strategy to the mix.

  • Pit strategy

  • I believe I've read somewhere that Forza 2 models the effects of fuel use on the weight of the car, possibly even the weight distribution. That's a great piece of physics implementation but it's stillborn in that you have no choice as to how much fuel you're putting in the car.

    We've seen that in formula 1, pit strategy has become a huge element in determining who wins - I wouldn't want a game to lose it's driving aspects too much but the choice of only filling to say 75% from the grid and knowing that an early pit stop is required would add to the strategy.

    Likewise the pit stops all seem to take about the same length of time - I'd like to see the options as to whether certain damage is repaired and whether tyre changing should be performed and see an appropriate knock on effect on pit time. It would bring into the equation the possibility of "splash-and-dash" pit stops.

  • Length of races

  • I guess looking at all of the above you can see that I'm a fan of the longer races. If it was me designing the career elements I' have added about an extra 5 series, all as long as the endurance races and have some proper endurances races of 4 hours or more.

    The 50'ish minute races are well chosen in that an hour is a reasonable time to set aside for a race but the opportunity is missed to have some really long races allowing for far more to happen during the race.

    I also can't see why adding addition levels has a great deal of effect on play testing - the addition of an extra 50 combinations of race would surely be an easy thing to do. Maybe each class of car could have 5 or 10 circuits for the endurance races rather than just the one.

  • Difficulty levels

  • The model of difficulty affecting credits earned works well in Forza 2 - I've never found myself with too many credits nor too few.

    What I find annoying is that by dropping from hard to easy I only lose 15% of my credits won per race. This could have been changed considerably without affecting the early stages of the game where credits are at a premium. I also find that the "normal" level of difficulty is too closely matched to that of "hard". The "easy" levels can be completed with almost no concentration and in almost any car, yet "normal" and "hard" often require a car and driver of much higher skill. Either an additional level of difficulty or a rebalancing of these would smooth things out. In terms of credits - I'd like to see the levels at -50%, 0% and +100%. That would really make a difference as to which level is chosen.

  • Circuits

  • Oh for more circuits... I guess you can never have enough and at least with Xbox Live there's the possibility of more being added.

    I guess there's a high level of effort (and therefore cost) in presenting a new circuit but surely it's worth it. I'd almost go to say that I'd settle for 1st and 2nd grade circuits, differing in how well they've been modelled. Maybe that's where the community could come alive by modelling circuits they have an interest in - initially just from aerial photography but eventually with contours and additional touches such as scenery. There are so many circuits out there that very easily be modelled in outline from Google maps alone.

    What's most missing from Forza are the street circuits that have been implemented so well in other driving games such as PGR and GT. I know that it is a game concentrating far more on dynamics than visuals and that's one of the main reasons I like it but there's still something about screaming though an Italian city or through London that appeals. It's obviously possible as the New York circuit demonstrates. I can only assume that the development costs are prohibitive compared to that of a normal circuit.

  • Cars

  • With over 300 cars we're not doing badly and there's only a few manufacturers that I feel have missed the opportunity to get included.

    I'm not sure how the licensing works for cars - I'm guessing the manufacturer has to give permission for the trademarked brands to be included and may even contribute 3d models and technical data to start the process off. From there I guess it's all done from publicly available literature and photographs.

    The thing I'd like to see here is far more variants of some of the existing models - the gamer points can still be done my model but surely it can't be that hard to have statistics against different engine options for the same model. Maybe I'm the only person out there, but there is something nice about driving the exact model of car that you own - in the same colour and specification. Something I can only really do with the 350z as it's a popular choice in gaming.

  • Damage

  • The damage modelling in Forza 2 is a valuable addition that models crashes quite well - I'm looking forward to Race Driver: GRID as Dirt had stunning damage modelling and if they've been able to bring that across Forza will be looking very dated.

    More important than just crash modelling for me would be more subtle effects such as those of punctures caused by driving over debris and even flat-spots on the tyres caused by locking the wheels under braking. I don't think these will be hard to model but will add yet another depth of game play. They are also obvious candidates for the rumble in the controller and for the direction tug that's already been implemented.



Enough of me and back to the game - I'm sure there's plenty of other opinion out there and we'll just have to wait and see what Forza 3 brings. Let's hope its constructive towards game play though and doesn't follow GT5's route of only providing eye candy.

SSD performance

Continuing my investigation of SSD performance I've now installed Vista Business 32bit inc SP1 on my Latitude D600 with 32GB PATA Samsung SSD.

The results are a bit annoying... the machine feels much better running Vista than it did running XP and that's something I'm a bit embarrassed to admit to!

I haven't benchmarked it properly yet but so far there have been considerably less stutters that I experienced before and currently experience on the Precision M4300.

Given the 64bit driver problems I've been experiencing (mostly the 3 3G USB modem) I'm very tempted to install Win 2k8 Server on the M4300 and see how it gets on.

I'll be happily living without the Aero interface as I hate it - some of us have work to do - but given that 2k8 is working well on my Precision 690 workstation it's got to be worth a try.

Watch this space where I'll do some more formal performance analysis and benchmarking.

Friday, February 22, 2008

Book recommendations

I occasionally get asked what books I'd recommend to programmers starting out in the game.

Here's what I select for those getting into web applications, flex and ASP.NET



The pocket reference guides below are invaluable for their succinct style although need to be accompanied by more substantial references rather than used on their own