Tuesday, November 25, 2008

DDD7: How to develop .Net on Linux using Ubuntu distro

Wow, my first time presenting and a lot of panicking. I hope those who came enjoyed it, and now feel the world of Linux is a less scary place for us .Net developers.
Here is my presentation:

Every DDD session this year has been filmed; so if you missed it watch the DDD site for the video. Please also submit your feedback.

I will be doing a few posts on setting up Ubuntu and adding some addition content which I didn't have time to demonstrate.

Technorati Tags: ,,,

Friday, October 10, 2008

"How to develop .Net on Linux using Ubuntu distro" now showing at DDD7

Thank you too everyone who voted for "How to develop .Net on Linux using Ubuntu distro" session at DDD7. Was not excepting this session to get chosen was hoping the WiX would be selected, if any at all. This is my first time speaking at DDD, or any large/medium event for that matter. So excited and very nervous at the same time, should be fun !

DDD7
www.developerday.co.uk

When: Saturday, November 22, 2008 - 9:00 to 17:00
Where: Microsoft, Thames Valley Park, Reading, Berkshire RG6 1WG, England

Watch out for registration as places go very quickly

Technorati Tags: ,,

Wednesday, September 3, 2008

DDD7 session voting now open

DeveloperDeveloperDeveloper! Day 7 which is been held on Saturday, 22nd November 2008 has now opened the voting for sessions to build the agenda for the day. I has submitted 3 sessions; How FIT are you ?, Introduction to Windows Installer XML (WiX) and How to develop .Net on Linux using Ubuntu distro. So please vote for me !

Technorati Tags:

Friday, July 11, 2008

Alt.Net UK September Registration Open

The registration for the Alt.Net UK Conference is now open. For more information check out Ian Cooper's post Alt.Net UK September.

Friday, June 20, 2008

XSLT - javascript escaping

I could not find a way to do this without writing a template.
I started one then luckily through the power of the Internet found a better one.  Done by Jeni Tennison found in the xsl-list archives and I have reproduce here.

<xsl:template name="escape-javascript">
<xsl:param name="string" />
<xsl:choose>
<xsl:when test='contains($string, "&apos;")'>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
='substring-before($string, "&apos;")' />
</xsl:call-template>
<xsl:text>\'</xsl:text>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
='substring-after($string, "&apos;")' />
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($string, '&#xA;')">
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
="substring-before($string, '&#xA;')" />
</xsl:call-template>
<xsl:text>\n</xsl:text>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
="substring-after($string, '&#xA;')" />
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($string, '\')">
<xsl:value-of select="substring-before($string, '\')" />
<xsl:text>\\</xsl:text>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
="substring-after($string, '\')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$string" /></xsl:otherwise>
</xsl:choose>
</xsl:template>

Thursday, June 19, 2008

Calling all girl geeks

Girly Geekdom blog is running a competition to get more girls presenting at DDD this year. All you have to do is submit a session for DDD and if your session is selected you could win a 1 year MSDN subscription. For full details:

http://girlygeekdom.blogspot.com/2008/06/submit-ddd-session-win-msdn-premium.html

Technorati Tags: ,,,

Wednesday, June 18, 2008

alt.net london beers

Had a good evening last night with the alt.net lads and lady. About 15 people turned up for either the beers and talk and/or dinner.This was only the second one and seeing if people will turn up. Mainly intros and telling others what you are doing technology wise. REST seemed to be the main topic for the main part "resources not services !".

alt.net_2_london_18

Here are some photos from the evening http://www.flickr.com/photos/holytshirt/sets/72157605676029098/

Seb is still coming up with a format for the night. Which will follow something like this:

18:30 - 19:00 drinks
19:00 - 20:00 talk about a predetermined topic
20:00 - late    dinner and each person comments on the topic, which gets posted up.

How should we tag our posts, photos ?

1. alt.net, london, beers
2. alt.net.uk.london.beers

Should we compile a list of attendees ?

See you next time !

Technorati Tags:

String array to Int array

Note to self, putting it down in writing so I don't forget it for the umpteenth time.

string stringOfNumbers = "1,2,3,4,5,6,7";
string[] stringNumbers = stringOfNumbers.Split(',');
int[] numbers = Array.ConvertAll(stringNumbers, s => int.Parse(s));

Monday, May 19, 2008

How do I say => as used in lambdas

When I did my talk recently someone asked what the predicate c => c.CompanyId == (int) results.Element("ID") meant as they had not seen this syntax before. I explained it was the new lambda syntax in .net 3.5, I tried to read the code out and realised I did not know how to say "=>". I was stumped and it has been bugging me ever since.

I read this blog post this morning Reading Code Over the Telephone by Eric Lippert and he goes some way to helping me solve this riddle.

I personally would say c=>c+1 as "see goes to see plus one". Some variations that I've heard:

For a projection, (Customer c)=>c.Name: "customer see becomes see dot name"

For a predicate, (Customer c)=>c.Age > 21: "customer see such that see dot age is greater than twenty-one"

So taking Eric's advice my predicate would be said like this "Company see such that see dot company id is equal to the results element called ID". After reading the comments I thing I might like this one "Company see is used to evaluate see dot company id equal to the result element ID".

I like the idea that if your code is clear enough to read over the phone to someone then your code must be self explanatory, something to keep in mind when writing code.

I still have a feeling I will have to explain a bit more, maybe not, what do you think? How would you say it ? Is this clear enough ?

Friday, May 2, 2008

Acrobat 8, panning, zooming, page flipping speed up

Adobe has snuck in something new into their bloatware PDF reader. If your CPU supports it, you only see the option if it is supported, you can speed up panning, zooming and page flipping.

Edit|Preferences|Page Display

In the Rendering Section, if the check box “Use 2D GPU acceleration” appears check it.

Render Settings

For detail on its effects here is the detail.

http://blogs.adobe.com/2DGPURendering/

Friday, April 25, 2008

LINQ to XML and SQL

From my presentation given at the London .Net User Group on 2008-04-28.

Since LINQ came out, we have been told about how LINQ creates a common way for developers to work with; XML, SQL, Objects, anything. But all the demos I have seen so far show examples of LINQ to SQL, LINQ to XML or LINQ to whatever. Never demonstrating mixing different "LINQs" together, maybe it is just me.

Recently a project required getting results from a web service and adding to it with data from a database. I thought this is a perfect opportunity to use LINQ as I want to create a single object based on data from two different sources.

The background to this is, the web service delivers a list of companies, but we require a flag to display if the company is still trading or not. Currently this is not available via the web service but the company can provide a csv file of company ids of the companies that are no longer trading, which you load into a table in your database. Once you receive your results from the web service you check to see if the id exists is in the database table.

First you need your XML and now days the new flavoured Object for working with XML is the XDocument class.

XDocument resultsXml = XDocument.Load(MapPath("Companies.xml"));


Next create the DataContext for the LINQ to SQL


DataClassesDataContext db = new DataClassesDataContext()


Now use LINQ to XML to get each company and use LINQ to SQL to see if the id exists in the database, the .Any translates to EXISTS in SQL.



var companies = from results in resultsXml.Descendants("COMPANY")
select
new Company
{
Id
= (int) results.Element("ID"),
Name
= (string) results.Element("NAME"),
OutOfBusiness
= db.OutOfBusinesses.Any(company => company.CompanyId == (int) results.Element("ID"))
};


As you can see this is not much code, think how much you would have to write to do this without LINQ.



Here is the demonstration code




 



Keep on keeping on !

Here we go...

I was trying to be retro and not have a blog, but it has not gone down well. So after much hassling and *gasps* "you don't have a blog?", here we go ...  more like in the words of Pink Floyd "I sentence you to be exposed before your peers" ...