How to get Website Thumbnail in C#

[Edit: I’ve posted it on CodeProject and there are some greatl people commenting on it that did the investigation on ho to wrap it in a STA Thread and make it a part of your ASP.Net solution – really cool stuff!]

An interesting use case. Darek (our beloved sys admin – we all bow to him and worship his skills) has recently asked if it?s possible to write a .net application to make a thumbnail of a website. Which is pretty trivial with Windows forms actually.

All you really need to do is drop a WebBrowser on your form and once it?s loaded the page call:

webBrowser.DrawToBitmap(bitmap, bitmapRect);

When it gets tricky is when you want to do it in a console application is a way that can take a shot of multitude of websites provided in a batch file. There is a dirty way of instantiating a whole form, making it show (or not), doing the work and then exiting the Winforms app. Which might probably be enough for a quick solution, but I wanted to publish this piece of code, so I would actually NOT take a pride in something like that.

How is it done the proper way then? Read the rest of this article »

Posted in .Net Framework, C#, Downloadable, Software Development, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 4.29 out of 5)
Loading...
| 150 Comments »

ClickOnce

The new project is really exciting. Not that we didn’t expect that, the number of new technologies we get to explore is incredible.

I’ve just finished setting up an automatic build and deployment (of a desktop application) environment consisting of SVN+Nant+CruiseControl+ClickOnce. The system is centered around CruiseControl which detects any commit in the trunk in the SVN repository and every time it’s changed, it calls Nant to pull source code from our SVN, at which point it compiles the source into binary artifacts and put them up on our release server. This means that every time you change anything and commit it to the repository – a minute or two later – any tester can get a working copy of your build to look at, without any intervention on your part, but there’s more…

The app can check on every start whether there is a new build available, so you can basically be pretty sure the tester has the latest copy of your app rather than wondering if they failed to update it. This alone takes a lot of pain off of the testing. It should also help out customers in the deployment of the highly distributed system that we’re working on.

It even installs a shortcut on the user’s Start Menu.

One caveat, which should not be much of a problem once we have the release page properly implemented is that even though you may get an initial feeling that it should work in your preferred browser, unless the preferred browser is Interned Explorer or derivative (or one of multiple of wrappers around IBrowser). The biggest problem as I see it now is that the bootstrap setup app looks like it should work but is broken on the server, while this is not the case.

You may also need to alleviate security restrictions on the site that you’re pulling the app form since it looks like it has a problem even with IE for one of our co-developers.

Some links I’ve gathered while implementing it:

Posted in .Net Framework, C#, Software Development
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 3 Comments »

Learning C#

I?m about to help a few guys here with their transition from Java to .Net, namely to C#. 

I thought it may actually be a good idea to gather a few helpful links together for you. Stuff I found useful while I was phasing into the joys of the .Net framework a while ago.

The official stuff

First and foremost C# is an ECMA regulated standard. And as such is pretty well documented. ECMA allows you to download PDF e-books regarding the standardized part of the language:

The books are a free download, you could theoretically request the books in printed form (for free) which I did back in my time when I was learning C# but it looks like they have a strict publications ordering form with a combo box of publications which? surprisingly do not list entries 334, 335 or 372. I suppose there was a big number of those smart guys who smelled free books? and the trees were crying.

There is also a good explanation (although highly redundant) on MSDN pages.

Hint: I highly suggest that you read the Garbage collection part of that. It REALLY helps in your day-to-day problems.

I have to say I?m really impressed by the official documentation. I was initially trying to shop around for some C# books back in my days of learning but since there seemed to be none that were both accessible here without waiting for a month or so for delivery and worthwhile I reverted to official docs. And I can tell you, THEY ROCK.

For all your ASP.NET need visit? surprise, surprise? ASP.NET official page.

You may also want to read up on the IIS official page for getting accustomed with IIS. For what it?s worth, there are some articles here.

I would say? don?t buy any books for it, it?s all there and it?s written really well.

All in all, I?m really impressed at how well this stuff is documented, Microsoft really did a great job here. Makes me feel taken care of. But after all? when in doubt – throw money at it.

The good stuff

It looks like for almost every problem you may have there is a simple, clean and not-quite-accurate solution out there.

For those I usually look at CodeProject. Amazing how many of those unique problems you may have, are not so unique. Just put up a proper filter (C#, .Net, ASP.NET) and fill in a few words. Amazing stuff there.

.Net framework does not fully cover all the old stuff of the WinAPI. I do not suspect we will need much of it here, but if you ever needed to use some legacy windows DLL access for stuff not directly supported by the platform (like e.g. speedy reading INI files, or manipulation of Windows handles to get a per-pixel translucent windows ) there is a cool site that helps, which is called exactly like the gears that are used to do it – Pinvoke. There are other marginally useful sites like CodeGuru, DevX or C#Corner but I don?t use them nearly as much as CodeProject or Google.

Hint: when on Google try to use Google Groups rather than just the Google Web search engine.

Posted in .Net Framework, ASP.NET, C#, Software Development
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 18 Comments »

Those that met me more than once know what a geek I am, my eyes basically glow on a sight of a cool new gadget. My wife on the other hand, couldn’t care less, she is as far from a geek as it gets. An email? Something needs to be found on The Web? Why learn anything when you have a guy next to you doing it all for you when you need it, and being hapy about it too!

That’s probably the essence of the presence of an Xbox in our house. This little toy (ok it’s not quite little, in fact it’s huge when you compare it to any other console on the market) is basically a fully featured computer connected to a TV. But you won’t see us gaming on it, nor enjoying any Xbox live action. With a little help of google and some creative hacking you can turn your Xbox into a fully fledged media center for the family. Why should I juggle the DVD’s when I can have them conveniently stored on the Xbox (it’s got its tine 8GB hard disk replaced with a 120GB one) when you can conveniently lay on a couch with a remote in your hand and enjoy your whole DVD and music collection being just a remote control click away?

Check out the cool things they’ve done with the old Xbox.
And a review on Tom’s Hardware.
It’s got my music, it stores all my digital photos and I even ripped a few movies to it. And the most important thing that was actually the key for the purchase of it is – it’s completely maintainable by all of my girls! Heck even the youngest (2.5 year) play cartoons on it.

The key was to make the XBMC the dashboard (meaning it’s the app that’s shown when you start your Xbox).

And although the original Xbox was protected against using third party code by means of only running an MS signed code, this protection was quickly removed and there seems to be a galore of semi-legal apps being available for it.

Now it’s essential to mention that MS really seemed to have little incentive to let us do it. The Xbox division has been a total money sink for them since day 1. They literally lost billions on the deal. The model was to make money on licensing the platform to game developers and take a cut out of any game that’s being sold for it. Obviously it didn’t work. The division had only a single quarter profitable (when they shipped the highly succesful Halo2).

Now it turns out that they no longer intend to go with that model (at least for the moment) as reported in those articles:
XNA game development platform will be free for Windows, $99 for Xbox (Tom’s Hardware)
Microsoft Opens Up Xbox 360 Game Development to Everyone (Paul Thurot)
Play your own Xbox game (ZDNet)

Tom’s hardware says:

Microsoft developers report the first beta of XNA Game Studio Express will be made available on 30 August, with a final edition released – still for free download – before the holidays. The product requires Visual C# Express, but that’s also free.

Now how cool is THAT!?

Microsoft is no longer going to limit the development of the games to the few chosen but rather will open it to anyone. Is is bad for giants like EA or Vivendi? Not likely, the indies don’t really have the capital to give them any serious competition in the supper production games like halo2 or NBA stuff. It is however great for the wide range of developers that used to make PC games. The PC games marked has been on decline for quite a while. While console games sell in hundrets of copies, a PC game is lucky to sell a few thousand. If Microsoft will not charge them a hefty price for distribution, this may be a great move for XboX 360 since they can still make a lot by the volume of sales for the platform and it’s good for the platform since it will make lots of new titles made available for it.

Let’s see whom else does it benefit… how about the other most succesful to date gaming platform from Microsoft? Yes – Windows. I think one of the not so many true platform locks for Windows users are games. while people buy computers for their home to work and browse and send emails they definitely want to be able for their kids to be able to play on them, or actually, since the target audience for the majority of games seems to actually be people in their 30’s, they buy them to game themselves. Let’s see… how many big game titles got released for linux last year? Anyone? If any you would probably be able to count them on the fingers of one hand. That definitely locks quite a few people in the Windows platform. And if that’s going to be a platform majority owns at home, they will actually demand them at work, so the circle closes.

But whom is it targeted against? I would say the whole push has been engineered to hurt Playstation 3.

There is no way Sony can pull a stunt like this. They have absolutely nothing to gain from opening their APIS and even if they did… Xbox OS is basically a fork off of Windows 2000, while PS3 is a totally different infrastructure, if it was even possible, it surely would not be fun. Add to that the stupid things Sony does with their DRM and the patent they filed on tieing a game you bought to a specific console and you’ve got the picture. The Playstation series is dead. DEAD!

So, up till today it was hard (and not-quite-legal) to make any unauthorized software for the Xbox, and as far as I know impossible to make it on Xbox 360. This is going to change, and soon enough we will have things like XBMS available for the x360

I guess what I wanted to say in the end is – I cannot wait to replace the old and clunky Xbox with a new shiny 360 one… and there are rumours that for only an additional $200 I can get a HD-DVD for it soon enough!

Posted in .Net Framework, C#, Lifestyle, Software Development
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| Leave a Comment »

It?s the era of XBOX 360. Is Playstation 3 stillborn?

Those that met me more than once know what a geek I am, my eyes basically glow on a sight of a cool new gadget. My wife on the other hand, couldn’t care less, she is as far from a geek as it gets. An email? Something needs to be found on The Web? Why learn anything when you have a guy next to you doing it all for you when you need it, and being hapy about it too!

That’s probably the essence of the presence of an Xbox in our house. This little toy (ok it’s not quite little, in fact it’s huge when you compare it to any other console on the market) is basically a fully featured computer connected to a TV. But you won’t see us gaming on it, nor enjoying any Xbox live action. With a little help of google and some creative hacking you can turn your Xbox into a fully fledged media center for the family. Why should I juggle the DVD’s when I can have them conveniently stored on the Xbox (it’s got its tine 8GB hard disk replaced with a 120GB one) when you can conveniently lay on a couch with a remote in your hand and enjoy your whole DVD and music collection being just a remote control click away?

Check out the cool things they’ve done with the old Xbox.
And a review on Tom’s Hardware.
It’s got my music, it stores all my digital photos and I even ripped a few movies to it. And the most important thing that was actually the key for the purchase of it is – it’s completely maintainable by all of my girls! Heck even the youngest (2.5 year) play cartoons on it.

The key was to make the XBMC the dashboard (meaning it’s the app that’s shown when you start your Xbox).

And although the original Xbox was protected against using third party code by means of only running an MS signed code, this protection was quickly removed and there seems to be a galore of semi-legal apps being available for it.

Now it’s essential to mention that MS really seemed to have little incentive to let us do it. The Xbox division has been a total money sink for them since day 1. They literally lost billions on the deal. The model was to make money on licensing the platform to game developers and take a cut out of any game that’s being sold for it. Obviously it didn’t work. The division had only a single quarter profitable (when they shipped the highly succesful Halo2).

Now it turns out that they no longer intend to go with that model (at least for the moment) as reported in those articles:
XNA game development platform will be free for Windows, $99 for Xbox (Tom’s Hardware)
Microsoft Opens Up Xbox 360 Game Development to Everyone (Paul Thurot)
Play your own Xbox game (ZDNet)

Tom’s hardware says:

Microsoft developers report the first beta of XNA Game Studio Express will be made available on 30 August, with a final edition released – still for free download – before the holidays. The product requires Visual C# Express, but that’s also free.

Now how cool is THAT!?

Microsoft is no longer going to limit the development of the games to the few chosen but rather will open it to anyone. Is is bad for giants like EA or Vivendi? Not likely, the indies don’t really have the capital to give them any serious competition in the supper production games like halo2 or NBA stuff. It is however great for the wide range of developers that used to make PC games. The PC games marked has been on decline for quite a while. While console games sell in hundrets of copies, a PC game is lucky to sell a few thousand. If Microsoft will not charge them a hefty price for distribution, this may be a great move for XboX 360 since they can still make a lot by the volume of sales for the platform and it’s good for the platform since it will make lots of new titles made available for it.

Let’s see whom else does it benefit… how about the other most succesful to date gaming platform from Microsoft? Yes – Windows. I think one of the not so many true platform locks for Windows users are games. while people buy computers for their home to work and browse and send emails they definitely want to be able for their kids to be able to play on them, or actually, since the target audience for the majority of games seems to actually be people in their 30’s, they buy them to game themselves. Let’s see… how many big game titles got released for linux last year? Anyone? If any you would probably be able to count them on the fingers of one hand. That definitely locks quite a few people in the Windows platform. And if that’s going to be a platform majority owns at home, they will actually demand them at work, so the circle closes.

But whom is it targeted against? I would say the whole push has been engineered to hurt Playstation 3.

There is no way Sony can pull a stunt like this. They have absolutely nothing to gain from opening their APIS and even if they did… Xbox OS is basically a fork off of Windows 2000, while PS3 is a totally different infrastructure, if it was even possible, it surely would not be fun. Add to that the stupid things Sony does with their DRM and the patent they filed on tieing a game you bought to a specific console and you’ve got the picture. The Playstation series is dead. DEAD!

So, up till today it was hard (and not-quite-legal) to make any unauthorized software for the Xbox, and as far as I know impossible to make it on Xbox 360. This is going to change, and soon enough we will have things like XBMS available for the x360

I guess what I wanted to say in the end is – I cannot wait to replace the old and clunky Xbox with a new shiny 360 one… and there are rumours that for only an additional $200 I can get a HD-DVD for it soon enough!

Posted in .Net Framework, C#, Lifestyle, Software Development
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 17 Comments »

It?s the era of XBOX 360. Is Playstation 3 stillborn?

Those that met me more than once know what a geek I am, my eyes basically glow on a sight of a cool new gadget. My wife on the other hand, couldn’t care less, she is as far from a geek as it gets. An email? Something needs to be found on The Web? Why learn anything when you have a guy next to you doing it all for you when you need it, and being hapy about it too!

That’s probably the essence of the presence of an Xbox in our house. This little toy (ok it’s not quite little, in fact it’s huge when you compare it to any other console on the market) is basically a fully featured computer connected to a TV. But you won’t see us gaming on it, nor enjoying any Xbox live action. With a little help of google and some creative hacking you can turn your Xbox into a fully fledged media center for the family. Why should I juggle the DVD’s when I can have them conveniently stored on the Xbox (it’s got its tine 8GB hard disk replaced with a 120GB one) when you can conveniently lay on a couch with a remote in your hand and enjoy your whole DVD and music collection being just a remote control click away?

Check out the cool things they’ve done with the old Xbox.
And a review on Tom’s Hardware.
It’s got my music, it stores all my digital photos and I even ripped a few movies to it. And the most important thing that was actually the key for the purchase of it is – it’s completely maintainable by all of my girls! Heck even the youngest (2.5 year) play cartoons on it.

The key was to make the XBMC the dashboard (meaning it’s the app that’s shown when you start your Xbox).

And although the original Xbox was protected against using third party code by means of only running an MS signed code, this protection was quickly removed and there seems to be a galore of semi-legal apps being available for it.

Now it’s essential to mention that MS really seemed to have little incentive to let us do it. The Xbox division has been a total money sink for them since day 1. They literally lost billions on the deal. The model was to make money on licensing the platform to game developers and take a cut out of any game that’s being sold for it. Obviously it didn’t work. The division had only a single quarter profitable (when they shipped the highly succesful Halo2).

Now it turns out that they no longer intend to go with that model (at least for the moment) as reported in those articles:
XNA game development platform will be free for Windows, $99 for Xbox (Tom’s Hardware)
Microsoft Opens Up Xbox 360 Game Development to Everyone (Paul Thurot)
Play your own Xbox game (ZDNet)

Tom’s hardware says:

Microsoft developers report the first beta of XNA Game Studio Express will be made available on 30 August, with a final edition released – still for free download – before the holidays. The product requires Visual C# Express, but that’s also free.

Now how cool is THAT!?

Microsoft is no longer going to limit the development of the games to the few chosen but rather will open it to anyone. Is is bad for giants like EA or Vivendi? Not likely, the indies don’t really have the capital to give them any serious competition in the supper production games like halo2 or NBA stuff. It is however great for the wide range of developers that used to make PC games. The PC games marked has been on decline for quite a while. While console games sell in hundrets of copies, a PC game is lucky to sell a few thousand. If Microsoft will not charge them a hefty price for distribution, this may be a great move for XboX 360 since they can still make a lot by the volume of sales for the platform and it’s good for the platform since it will make lots of new titles made available for it.

Let’s see whom else does it benefit… how about the other most succesful to date gaming platform from Microsoft? Yes – Windows. I think one of the not so many true platform locks for Windows users are games. while people buy computers for their home to work and browse and send emails they definitely want to be able for their kids to be able to play on them, or actually, since the target audience for the majority of games seems to actually be people in their 30’s, they buy them to game themselves. Let’s see… how many big game titles got released for linux last year? Anyone? If any you would probably be able to count them on the fingers of one hand. That definitely locks quite a few people in the Windows platform. And if that’s going to be a platform majority owns at home, they will actually demand them at work, so the circle closes.

But whom is it targeted against? I would say the whole push has been engineered to hurt Playstation 3.

There is no way Sony can pull a stunt like this. They have absolutely nothing to gain from opening their APIS and even if they did… Xbox OS is basically a fork off of Windows 2000, while PS3 is a totally different infrastructure, if it was even possible, it surely would not be fun. Add to that the stupid things Sony does with their DRM and the patent they filed on tieing a game you bought to a specific console and you’ve got the picture. The Playstation series is dead. DEAD!

So, up till today it was hard (and not-quite-legal) to make any unauthorized software for the Xbox, and as far as I know impossible to make it on Xbox 360. This is going to change, and soon enough we will have things like XBMS available for the x360

I guess what I wanted to say in the end is – I cannot wait to replace the old and clunky Xbox with a new shiny 360 one… and there are rumours that for only an additional $200 I can get a HD-DVD for it soon enough!

Posted in .Net Framework, C#, Lifestyle, Software Development
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 17 Comments »