23 August 2013

Links

Here’s a link for all those people who want you to “just write a vbscript…”
Getting started with Powershell

And for more advanced scripts

Entity Framework
Entity Framework 6 Release Candidate is available… Includes a list of what’s new in this version of the framework and a link to guidance on Updating Applications to use EF6

08 August 2013

This is a reminder for me to watch Scott Hanselman's video from Build : What’s New in ASP.NET and Visual Studio 2013

03 June 2013

Configuring Relationships with the Fluent API
Reminder to self to look at the MSDN Magazine June Issue when it comes out.
  Windows Azure Insider gets you up to speed on concepts and principles behind multi-tenant applications...

30 May 2013

A useful web developer tool from Google.

Get Mobile

It allows you to test and score a web-site on its mobile readiness. This blog score's 6 out of 6, which is all donwn to Google. The last web-site I built (some years ago) only scores 2 out of 6. An indication of how the times keep changing.

CSS links:

Blueprint is a CSS framework, which aims to cut down on your development time.

W3C CSS Validator

Minify your CSS

Zen Garden

28 May 2013

An excellent site for 3D tutorials, AeroTwist

24 May 2013

I had heard of Microsoft BizSpark before but never really looked into it. It is surprising to see how many entrepreneurs have been supported by it.

There is an interactive map showing companies set up by people on the programme which is fun to browse around. Some of the companies look to have been going for a while, others have not got going yet.

More about BizSpark

18 May 2013

Having used the Beekeeping App at the hives today I realised two things.

Firstly, it was incredibly useful to be able to look at the previous hive inspections, just to know what state the hive was in on the last visit, because it is difficult to remember the details, even with only four hives

 And, secondly, there is a lot more detail that I would like to be able to record, on diseases and treatments, configuration of the hive and more.

With more information collected it would be possible to automatically analyse the data and come up with suggestions as to what might need doing. It would also be possible, with the data being in the cloud to analyse information from multiple beekeepers, and provide insight into the health of bees nationally.

I think this has a lot of potential and I'm going to redesign the app and get it to a state where others can use it.

16 May 2013

A Microsoft book on Developing Multi-tenant Applications for the Cloud. 246 pages, free to download. This is so much better than having to buy those paper things.

15 May 2013

Dino Esposito has an article on Social Authentication in ASP.NET MVC 4 in this month's MSDN Magazine.

This was the article on OAuth that shows how to authenticate with facebook / twitter...
It is almost too easy to add OAuth authentication and authorization with Facebook, or Twitter to an MVC 4 Internet application. Include the commented out lines in the AuthConfig.cs file and add your facebook appId and appSecret and the job is done.

The only difficulty I had with this was down to a NuGet package that was not up to date. Click the update button and NuGet solves it for you. Microsoft are really making this easy.

14 May 2013

Having fun with Windows Azure and ASP.NET MVC 4...

My Bee Hive Inspection app is coming along nicely. It is remarkably easy to create a web based data driven app, put it in the cloud and access it from your mobile phone...


17 December 2009

XNA 2d animation

Added animation to pieces. They now glide from one square to another smoothly. At the start of the animation I make a note of the game time, so I know when the animation started. I add a second to calculate when it should end. Then I get the x and y coordinates of the start and end positions.

Then later on, in the display function, work out how far the piece should have moved between the start and end points given the current game time and display a piece at that location.

When the animation starts I make the call to move the piece so I have to display over the destination square with a sprite to show one fewer pieces than are actually there until the animation ends, when the moving piece arrives at it's destination.

The animation takes the same length of time no matter how far the piece is going to move, and the movement is linear, there is no easing into and out of the move. I am developing on a netbook, and I think the animation would be smoother on a desktop, but it looks pretty good.

15 December 2009

XNA, the fun bit

I worked on improving the graphics, creating help screens, realising that twiddling with images could extend indefinitely, so have made a list of things to change and will stop when it looks good enough. Also decided that I really must add some animation of pieces so that they glide from one position to another rather than teleporting.

10 December 2009

Changing the rules

I played a few games and realised I wanted to change the rules. Instead of capturing the opponents pieces you can send them back to their start square. This improves the game play enormously, but does mean that the weightings I generated earlier are all invalid.

08 December 2009

XNA game

I hooked up the existing code to generate the computer's move and make it.

There are still no delays yet, so after your turn the dice get rolled and the move is made instantly, then the dice are rolled again instantly and it's your turn. I need to think of a way to introduce a delay, possibly even an animation to move the pieces smoothly and give the human player a chance to appreciate what is happening.

07 December 2009

Highlighting moves

I added highlighting to show the square you are hovering over and the square the piece would move to with the current dice. To do this I am using PNG files with transparent backgrounds as follows

Background



Piece



Highlight



Put it all together



and for the destination cell

Background + Highlight


These only show up if there is a legal move for the piece hovered over using the current dice.

To display them I am adding them to a spriteBatch:

// start collecting sprites
spriteBatch.Begin();
...// where to display the sprite
Vector2 tempVector = new Vector2(x, y);
// display piece (a Texture2D)
spriteBatch.Draw(piece, tempVector, Color.White);
...
// finished collecting sprites
spriteBatch.End();

That's all it takes to display a 2D board game, lots of sprites displayed in the right place. Not too difficult.

05 December 2009

Moving pieces

I captured the mouse position and added the ability to select a piece to move, checking, of course, that it was a legal move.

This was easy to add as all the game logic for deciding legality of moves already existed in the console app. This was partly why I wanted to get the game play sorted out in a console app before trying to tackle XNA.

04 December 2009

Searching the rainforests

If you have been using Bing or Yahoo for search, consider using Ecosia instead.

It's a search engine created by the WWF in conjunction with Yahoo and Bing. It has the advantage that most of the money taken from advertising goes to protect the rainforest. According to the search page they have already managed to protect 108,000 square yards. The more people use the search engine the faster that figure will grow.

Obviously, it isn't enough and what is really needed is for Governments to act. I know small changes are not enough, but it is time to do whatever we can.

XNA Conference

Tomorrow is the first XBLIGUK conference in Birmingham, for XNA developers. I am not going to be there, but I hope it is a success and that it is the first of many. The agenda looks very promising.

02 December 2009

Putting the code into XNA, part 2

I added a GameMode class to handle the succession of different modes that happen within the game, starting with the following :-

Player 1 rolls the dice,
Player 1 enters a move,
Make player 1's first move,
Player 1 enters second move,
Make player 1's second move,
Player 2 rolls the dice,
Player 2 generates 2 moves,
Make player 2's 1st move,
Make player 2's 2nd move

After player 2 has moved the game loops back to player 1's turn.

I found it best to keep to keep the Draw method just for displaying the board and all the changes to the gamemode in the Update method of the game loop.

So the game Update method contains a switch statement similar to this...

switch (GameMode.State)
{
case GameMode.Player0RollingDice:
{
Dice.Roll();
GameMode.State = GameMode.Player0Input1;
break;
}
case...

01 December 2009

Putting the code into XNA


I started by getting XNA to display the board, this is easy
as it is just a static background so I used the spriteBatch.
Vector2 tempVector = new Vector2(0, 0);
spriteBatch.Draw(background, tempVector, Color.White);

I also needed to resize the window in the Initialize() method...
this.graphics.PreferredBackBufferWidth = 224;
this.graphics.PreferredBackBufferHeight = 471;
this.graphics.ApplyChanges();

Then display the pieces on the board in their starting positions and finally the dice. It is only a 2d game but this seems really easy.
I needed to get mouse input. I used Mouse.GetState().
If the game was ever going to run on the XBox then this wouldn't be enough. Apparently they forgot to add a mouse when they designed the XBox. What were they thinking? I'd need to add support for a GamePad. I don't own an XBox so I am not too bothered about this.

KeyboardState keyboard = Keyboard.GetState();
MouseState mouse = Mouse.GetState();

Now, I can use mouse.X, mouse.Y and compare mouse.LeftButton with ButtonState.Pressed.

29 November 2009

Alpha beta tree pruning

A method where you can limit the number of nodes that the computer looks ahead in a game by stopping if you can prove that a particular move would be worse than one you have already evaluated. I think.

The wikipedia article leads me to conclude that some people
have spent a lot of time thinking about games.

Maybe next time I write a game I'll use it.

22 November 2009

XNA game

I tried to improve the genetic programming approach.

Player One uses a set of weightings giving different importance to various ways of evaluating a position. Then generate ten random sets of weightings around Player One's settings for Player Two to use. Get Player One to play twenty games against each of the sets of ten mutated values. If there was a clear winner then let Player One adopt those weightings and continue with ten new mutated sets based around them. If there was no clear winner then increase the variability slightly and try again with new mutations.

I left it running over night to see if it would improve dramatically.

It seems to have varied the weightings a lot but not really in one direction. Looking at the logs I can see one particular value would go up then down, repeatedly. This could mean there are different approaches to playing and that some of them have slight advantages over others, but not a significant advantage.

Or it could be like stone - paper - scissors played as if there was a best choice. Playing stone all the time leads your opponent to play paper, but if you adopt paper as the winning solution then they play scissors. When you play scissors they play stone and together you proceed around and around.

Not sure what to do about this, but I've added "Read a book on genetic algorithms" to my ever increasing to-do list along with "find out about alpha-beta pruning next time" (as recommended by El Walrus).

XBLIG-UK conference

There is an XBLIG-UK conference in Birmingham on Saturday 5th December. It is organised, I think, by nxtgenug.

This looks like it will be a jolly good event, lots of interesting sessions from people who are experienced with XNA.

Sadly, I shall not be there as I have other commitments that day. So, I hope there will be another.

19 November 2009

Is it improving?

Checking the game to see if the computer player improved Switched back to human vs computer mode and played a game. I was pleased that it actually won a game. I wasn't trying hard to win, but this is progress.

So far the approach seems to have worked well. The moves it makes are occasionally sensible ones that I would make myself.

Sometimes it makes moves that I wouldn't.

17 November 2009

XNA game. Evolving a better player

I've changed the code so the computer can play against itself. I gave each of the two computer players different weights for the evaluation. This is like having two human players with different playing styles.

Changed the game loop so that they play matches of twenty games against each other using their current weightings. The loser of a match changes their weightings by some small random amount. Then they play another match to see who wins.

I left it to play 5,000 matches to see if it improves. Over time, it ought to evolve into a better player.

16 November 2009

XNA game development

Trying to improve the computer's game:
I gave the software a way of evaluating a position. So some moves will result in a position that achieves a high score, such as capturing pieces, and some a low score, such as having pieces taken or leaving them exposed.

I am working out what to evaluate by noticing what I think is a good position when I am playing.

I gave random weights to each of the methods of evaluating the position, since I can't really say what priority I actually give to the things I consider.

The approach is to sum the results from each of the weighted methods for each possible position and use those to pick the best move.

The computer still loses every time.

10 November 2009

XNA game progress

I have been working on getting the computer to play. The simplest approach is to have it pick random pieces to move, and keep trying till it finds a legal move. This isn't a good approach, it loses every time, I just want to get the flow of the game going.

The game I am writing involves two players taking turns to roll two dice and move one or two of their pieces. Unfortunately, the computer move is instantaneous so it makes it difficult to see what is happening. I need to add some delays. I might leave this until I put the code into
XNA.

03 November 2009

Notes on Open University Course T206_2 An introduction to

4 Renewable Energy Sources
Most renewables originate from the sunTidal from gravityGeothermal from heat trapped in the earth Solar-thermal-PV
Indirect solar-Wind-WaveThese will be renewed naturally, won't run out.
Presently more expensive than fossil fuels but attractive
due to lower environmental impacts
5 Energy Services and Efficiency Improvement
Efficiency : 2 thirds of the energy ends up as waste heat
Energy has been reducing in price so little incentive to
attempt to improve efficiency.
Supply side: generation efficiency can be improved...Combined Cycle Gas Turbine (CCGT) uses hot exhaust gases
from gas turbine generator to power a steam generator.CHP Combine Heat and Power, uses waste heat from power
stations to heat buildings8% of energy lost through transmission/distribution
Demand side:More efficient appliances (must be wary of embedded carbon,
co2 produced in the creation of a new appliance can outweigh
any benefit from energy saved in use) Social changes (walking cycling to work, public transport)
Four sectors: Domestic (draught proofing, insulation) Commercial & Institutional Industrial (reuse waste heat, product design, thinner
materials) Transport
6 Energy in a Sustainable Future
How to improve sustainability:Carbon sequestration (storing carbon so it cannot get back
into atmosphere)Fuels switching - to less polluting fuelsSwitching to renewablesDemand side efficiency improvements
Royal Commission on Environmental Pollution (RCEP) proposed
four scenarios for the UK which consider the options
available for balancing supply with demand given the need to
reduce CO2 emissions by 60%.
World Energy Council has come up with six scenarios
incorporating different assumptions about rates of economic
growth in rich and poor countries; choices of technology and
its development; and the priority given to ecological issues
A number of paths to sustainability, but, since they rely on
different mixes of technology, they are likely to have
different social, environmental and political implications.

Writing an XNA Game

I'm writing a board game in C# with the intention of getting it to run in XNA.

I don't want to get distracted with xna and graphics just yet. I want to have a working game first. The approach I am taking is:-

1. Create a console app.


2. Get it to initialise and display the board as text. Each of the 24 squares on the board is numbered (0 - 23) and the pieces are represented by red or green non-zero values. An empty square is shown as a white zero. Start squares and home squares are in blue

3. I have added code to capture how the pieces move from square to square.

4. Also added rules, for checking when the game is over and who won, and preventing any illegal moves.

5. I have added a game loop so you can play a game human vs human.

This is working well so far, but the display is not easy to read in a console app.

12 August 2009

Notes on Open University Course T206_2 An introduction to sustainable energy

A free course from the Open University

1 Why sustainable energy matters
Current use of fossil fuels not sustainable.
Finite supply(but not about to run out immediately)

Location of 2 thirds of oil in Middle East or N. Africa - has led to conflict.
Price rises led to protests. (Renewables need to enable the same level of affluence that fossil fuels have enabled, else acceptance will be low)
Accidents during extraction, distribution and use.
Pollutants from use. And CO2 leading to climate change affecting ecosystems, agriculture, sea levels
Nuclear is source of 7 percent of primary energy
No green house gases, but...Supply of uranium also limited (decades or possibly centuries at current rate of use), proliferation of weapons, problems of disposal and cleanup.
Efficiency of systems is an important factor in mitigating the effects of energy use.

Renewables - Replenished by natural processes.
Solar energy, bioenergy, hydroelectricity, wind and wave power
Current costs can be higher than conventional sources, slows take up.
Need:-
  • To reduce impact of fossil and nuclear
  • To develop and deploy renewables
  • To improve efficiency of conversion, distribution and use
2 Definitions: Energy, Sustainability and the Future

Energy is the capacity to do work.
Power is the rate of doing work.
Energy = power x time
Sustainable development is ‘development that meets the needs of the present without compromising the ability of future generations to meet their own needs ’ (United Nations, 1987).

3 Present Energy Sources and Sustainability

80% of energy comes from fossil fuel at present
At current rate-200 years of coal, 60 years gas, 40 years oil

Hydrocarbons release co2 on combustion, a greenhouse gas.

Nuclear:Energy released by splitting uranium atoms (fission)
Major concerns are safety and disposal of waste
Biofuel:Combustion of straw and forestry waste. Incomplete combustion can release pollutants. Only sustainable if trees replanted ( also only sustainable if biodiversity of resource is maintained.)
Hydroelectricity 17% of electricity produced in 2000 came from hydroelectric.
- indirectly solar power from evaporation of water to rain

14 June 2009

Bee pictures

Here is a view inside the hive. The bees are mostly on five frames:-


Rachel with some of the bees on a new frame:-

Me, posing with the hive:-



14 April 2008

Jottit

I have just tried out Jottit for the first time, it seems to be a very friendly wiki-like web site. It is free.

Jottit makes it very easy to create and edit web pages, almost a friction free publishing experience.

My site is here. I don't know if it will catch on with me for frequent use, but I'll try anything new. Especially if it is free.

06 March 2008

Mix08

Tim Sneath wrote a wonderful blog post on the Mix08 keynote.

The Mix08 sessions are appearing online now...

13 February 2008

ASP.NET wiki

There is now a wiki on ASP.Net

05 February 2008

MSDN Code Gallery

MSDN Code Gallery is a new community site for code samples, snippets and resources...

22 November 2007

Silverlight Training

Free Silverlight Essential Training on Lynda.com, by Mike Harsh.

18 September 2007

DDD6

DDD6 has been announced for November 24th.

With SqlBits on the 6th October, I can't help wondering when the next WebDD will be?

03 September 2007

SQLBits

SQLBits is a community conference on all things SQL, to be held at Microsoft Reading on 6th October. It's free.

17 July 2007

Galaxy Zoo

Galaxy Zoo is a site where you can help to classify galaxies, up to a million of them if you have the time...

A lot of them look very fuzzy, but then they are far away and long ago...

09 July 2007

Scott Guthrie videos

Phil Winstanley has made four videos of Scott Guthrie available on the WebDD website. These were really good sessions, so it is worth downloading them...

28 June 2007

Live Folders

Windows Live Folders is in Beta, but not in this region. Maybe later?

It offers 500MB of online storage.

23 June 2007

MixUK

Mix:UK 07 is "the premier event for web designers and web developers."

I wonder if it will be like Mix07... where all the sessions are recorded? I hope so.

13 June 2007

11 June 2007

Real Alternative to Real Player

The BBC still seems to provide a lot of content in Real Player formats, .ram or .rm files. Rather than installing Real Player there is an alternative, called Real Alternative.

I have installed it, and so far it seems ok. There are a lot of other free video and audio tools on the site.

07 June 2007

05 June 2007

Keep running

Here's another one...

The Microsoft code name “Acropolis” Community Technology Preview 1 is a set of components and tools that make it easier for developers to build and manage modular, business focused, client .NET applications. Acropolis is part of the “.NET Client Futures” wave of releases, our preview of upcoming technologies for Windows client development.

02 June 2007

Expression videos

The Microsoft Expression Knowledge Centre has some videos on the Expression tools

31 May 2007

DDD5 agenda

The agenda for DDD5 is available...

30 May 2007

Microsoft Surface

The Microsoft Surface computing website...

and a video.

29 May 2007

DDD5

Register now for DDD5. It is on June 30th, at Microsoft in reading, and it's free.

26 May 2007

Popfly mashups

Popfly makes mashups easy. This one gets videos from soapbox and displays them in a video player. I didn't write any code, not a single line.

22 May 2007

Bristol DotNetDevNet

Alex Homer gave a splendid talk, at Monday evening's .NET Developer Network meeting, on the Enterprise Library from the Microsoft Patterns and Practices group.

He then went on to talk about Cross Cutting concerns, Aspect Oriented Programming and The Policy Injection Block.

As you can tell from all the links, this was a learning experience for me.

18 May 2007

Popfly

Microsoft Popfly... online tools for building mashups.

17 May 2007

Ajax view

Mike Ormond on Ajax View

15 May 2007

Scratch

The BBC has a story on Scratch, another "programming for kids" tool, this one from MIT.

14 May 2007

13 May 2007

SilverlightPad

Silverlight Pad is a Silverlight 1.0 Beta application that gives you a simple way to experiment with creating XAML content--the XAML you enter can be instantly rendered as Silverlight content.

11 May 2007

100 apps

A list of 100 web applications for freelancers.

10 May 2007

The upside-down-ternet

I'm not sure whether to think this is real or not, but it sounds very convincing. The upside-down-ternet... a brilliant way to discourage your neighbours from stealing your wifi.

There are some very clever people about.

08 May 2007

Scott Hanselman on Mix

Scott Hanselman's post on Mix, DLR and Silverlight

07 May 2007

The Guardian

The Guardian on Silverlight.

05 May 2007

Silverlight Quickstarts

The Silverlight Quickstarts are now available...

04 May 2007

Silverlight everywhere?

Miguel de Icaza seems to be very keen on the idea of creating a version of Silverlight on Mono.

03 May 2007

02 May 2007

Jasper

Another one!

Jasper sounds a bit like Ruby on Rails. Convention over configuration, RAD database applications...

Astoria

What is Astoria?

01 May 2007

Getting started with Silverlight Streaming

Following Tim Sneath's post on Getting started with Silverlight Streaming.

I downloaded Expression Media Encoder and encoded a short video. The video I imported was not widescreen, so I had to resize it. It had something like a coloured barcode effect down the right hand side after being imported into Media Encoder.

After encoding, it opened a browser to view the results... and wanted to install Silverlight. That's a bit odd, since I already have it installed. Then it wanted to restart, reporting Error 3010, "Silverlight installed successfully, but needs to restart"...

I followed the rest of Tim's instructions and soon had my video uploaded to Silverlight.live.com and available to play on my own web page.

The Expression Media Encoder trial version has a 180 day licence.

30 April 2007

Mix announcements

The Mix07 keynote.

"Today we announced that Silverlight is not only a great media platform; it is cross-platform .NET."... Silverlight on Channel9

Silverlight Streaming. A free account, with 4GB of space where you can upload Silverlight applications.

There are a lot of Silverlight screencasts on Channel9 too.

29 April 2007

Silverlight quickstart coming soon

The Silverlight SDK and QuickStart will be available April 30th.

28 April 2007

DDD5

Don't forget to vote...

26 April 2007

Javascript intellisense

The Visual Web Developer 2005 Express edition has Javascript intellisense support just like Orcas.

I have been writing more Javascript recently, and this could really save a lot of time. And, it's free.

25 April 2007

DotNetDevNet Bristol

I attended the first DotNetDevNet meeting in Bristol on Monday.

It was a brilliant event, organised by Guy Smith-Ferrier, with Mike Taulty as the inaugural speaker.

Guy explained the aims of the group. This is a free group, which is remarkable really, given the quality of speakers Guy has already lined up for the first three meetings.

Mike Taulty was entertaining and informative. I liked his approach to presenting LINQ, explaining some of the mysterious features that have been appearing in .NET recently and showing how, although they may not be things you have wanted to use, the LINQ team needed them. I found it was a struggle to keep up at times, it had been a long day... but fortunately Mike Taulty's blog has plenty of posts on LINQ and other topics to catch up on.

He also mentioned the Road Show Resources.

LINQ for SQL was very impressive. At first, I had what turned out to be inappropriate flashbacks to SQL select statements hardcoded in VB3, but then realised that this is very different. LINQ seems to offer a lot of power, and does an amazing job of figuring out the right way to behave whatever you do.

I'm looking forward to the next meeting. Alex Homer is another excellent speaker.

20 April 2007

Strangeloop

Strangeloop.net... not ready yet, check back later. Some kind of clever optimisation, using routers...

19 April 2007

Geocoding

Rooftop geocoding allows you to locate properties correctly. A lot of current map applications seem to locate by postcode.

18 April 2007

The Region

The Region is a web site run by Microsoft Regional Directors. It has posts from people like Richard Campbell and Scott Hanselman.

16 April 2007

Silverlight

Tim Sneath announces Microsoft Silverlight, previously known as WPF/E.

15 April 2007

Another way to sell shareware

ByteCommerce offers another way to sell shareware. They keep the payment for every twentieth item sold.

14 April 2007

MicroISV in 25 steps

Leon Bambrick has reached step three of his microISV series, designing your website.

13 April 2007

Where's Wally

You can find out on the BBC's Walrus Tracking map. Over the next two months the map will be updated to show the location of ten tagged animals.

It's a shame they didn't use Virtual Earth or Google maps.

12 April 2007

UI design

Fun with check-boxes.

I don't like check boxes. Too complicated.

11 April 2007

Run As Radio

Run As Radio is a new weekly podcast from Richard Campbell.

It doesn't seem to be available on iTunes yet, but maybe that will change.

10 April 2007

DDD5

The proposed sessions for DDD5 are looking good.

09 April 2007

Speech in Vista

An article on speech recognition in Windows Vista.

It seems there are new voices available, including "the Windows Vista Chinese synthesizer, Lili".

08 April 2007

XML Tools

There are some useful XML utilities here.

Xml Notepad 2007 and XML Diff and Patch...

07 April 2007

04 April 2007

Search .NET

Dan Appelman has created a .NET specific search site using Google's custom search. It limits the search to selected web sites that Dan recognises as having good .NET related content.

03 April 2007

$5 app

More on the $5 app idea.

Of course, there is more profit to be made from a £5 app.

02 April 2007

Selling software

ShareIt.com - Selling software online

01 April 2007