Latest News
- Linq to Objects – join or intersect
- Charts with Asp.net MVC and jQuery through jqPlot
- Polar ProTrainer 5 – Average speed readout
- Polar RS800cx PTE – IrDA problem
- Polar RS800cx PTE settings – part 2 – Using temperature
- Polar RS800cx PTE settings – part 1 – Using a speed or cadence sensor
- BuzzParadise – Passoã
- Heart rate training
.Net 18-200mm Aleksi Bricolet Anime Arcadia Benjamin Carre bwards C# Captain Harlock Carl Critchlow Clothing Comics Computer Cycling D40x Don Figueroa Eye candy Fake Flickr Fun HTPC iPod iTunes iWatchSyncer John Berkey Kev Walker LightRoom Magic the Gathering Music Nicolas Ferrand Nikon Photography Photoshop Polar Ryan Church SB-600 Spaceships Spawn Star Wars Tilt-shift Transformers Trek Typing Visual Studio Voxel
Categories
Blogroll
Blogroll
Pictures
Programming
Linq to Objects – join or intersect
Posted on December 16, 2009
Thanks to Linq to objects we can have a more sql like coding style in c#. For somebody that has actual sql knowledge, this comes in very handy.
But it seems that several coding methods perform the same task and gives the same result.
So what coding syntax would you prefer?
For example, assume you want to know which items are given in 2 sets?
You could get this list through following code.
string[] filesList1 = System.IO.Directory.GetFiles(@"C:\temp\List1?);
string[] filesList2 = System.IO.Directory.GetFiles(@"C:\temp\List2?);
var fileListEqual = from file1 in filesList1
join file2 in filesList2
on System.IO.Path.GetFileName(file1) equals System.IO.Path.GetFileName(file2)
select System.IO.Path.GetFileName(file1);
var fileListEqual2 = (from fileIpod in filesList1
select System.IO.Path.GetFileName(file1)).Intersect
(from fileDisk in filesList2
select System.IO.Path.GetFileName(file2)
);
Similar posts
- Charts with Asp.net MVC and jQuery through jqPlot
- Cycling update
- Culture sensitivity in List<string> – how to do comparison
Charts with Asp.net MVC and jQuery through jqPlot
Posted on August 31, 2009
Asp.Net MVC is a great way to get dynamic data presented inside a web browser and thanks to the great integration of jQuery now in Visual Studio, we have many programming tools right at hand!
To show of the possibilities, I’ll give an example on how to get data from Asp.net MVC into your client jQuery code. This example will also use jqPlot to draw a dynamical graph from the given data.
First up, you’ll need to download the jqPlot plugin for jQuery from the jqPlot site: http://www.jqplot.com/ !
I have to say, this graph plugin just looks stunning and is easy enough to use with much tweaking options!!
When this is done, create your MVC project inside Visual Studio.
To get jqPlot working in your MVC project, make sure to create a subfolder jqPlot inside your Scripts folder and copy all .js files from the jqPlot download inside this subfolder!
After that, just add following inside your Site.Master page to get the correct reference to your jqPlot plugin.
<script language="javascript" type="text/javascript"
src="<%= ResolveUrl("~/Scripts/jqplot/excanvas.min.js")%>"></script>
<script language="javascript" type="text/javascript"
src="<%= ResolveUrl("~/Scripts/jqplot/jquery.jqplot.min.js")%>"></script>
<script language="javascript" type="text/javascript"
src="<%= ResolveUrl("~/Scripts/jqplot/plugins/jqplot.trendline.min.js")%>"></script>
<script type="text/javascript"
src="<%= ResolveUrl("~/Scripts/jqPlot/plugins/jqplot.canvasTextRenderer.min.js")%>"></script>
<script type="text/javascript"
src="<%= ResolveUrl("~/Scripts/jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min.js")%>"></script>
Small side note, when you need to edit js files inside Visual Studio and you like to have intellisense for jQuery, be sure to add following line on top of each js file!
//Enable JQuery IntelliSense for Visual Studio
/// <reference path="jquery-1.3.2-vsdoc.js" />
Next thing you’ll need to do is add a new controller inside the Controllers section. Inside this controller we will have all calls needed to get a new webpage and also for retrieving data. You add a new controller by right clicking on the Controlles folder and selecting Add>Controller! Give it a meaningful name and click OK.( in this example GraphController.cs )
Add following code inside the controller, this will give us the new web page.
public ActionResult HearthRate()
{
return View();
}
Add following code inside the controller, this will present a JSON data stream back to the client. This data stream represents all markers that will be used by the jqPlot graph to draw lines ( in this example. You can also draw bar or pie charts and many other )
public ActionResult HearthRateDataJSON()
{
List<GraphData> hearthRateDataList = new List<GraphData>();
GraphData hearthRateData = new Cycling.Models.GraphData();
hearthRateData.Name = "series1";
hearthRateData.Serie = new int[4][];
hearthRateData.Serie[0] = new int[2] { 1, 4 };
hearthRateData.Serie[1] = new int[2] { 2, 25 };
hearthRateData.Serie[2] = new int[2] { 3, 7 };
hearthRateData.Serie[3] = new int[2] { 4, 14 };
hearthRateDataList.Add(hearthRateData);
GraphData hearthRateData2 = new Cycling.Models.GraphData();
hearthRateData2.Name = "series2";
hearthRateData2.Serie = new int[4][];
hearthRateData2.Serie[0] = new int[2] { 1, 13 };
hearthRateData2.Serie[1] = new int[2] { 2, 5 };
hearthRateData2.Serie[2] = new int[2] { 3, 7 };
hearthRateData2.Serie[3] = new int[2] { 4, 20 };
hearthRateDataList.Add(hearthRateData2);
return Json(hearthRateDataList);
}
The class used here is called GraphData, it’s created inside the Models section and only contains 2 properties.
public class GraphData
{
public string Name { get; set; }
public int[][] Serie { get; set; }
}
Now that the code is in place, right click on the HearthRate() method and select Add View. This will create a new view inside the Views section.
Edit this newly added View ( this example Views>Graph>HearthRate.aspx ) and add following code inside the asp:Content tag! This div will be used by the jqPlot, it indicates where the graph needs to be visible.
The other line is a reference to a new js file that we need for processing the JSON data and presenting it correctly to the jqPlot plugin.
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/HeartRateGraph.js")%>"></script>
<div id="chartdiv" style="height:400px;width:600px; "></div>
Now the only thing left to do is create the js file with all the jQuery code that will process the JSON stream and draw the line chart.
//Enable JQuery IntelliSense for Visual Studio
/// <reference path="jquery-1.3.2-vsdoc.js" />
jQuery(document).ready(function() {
urlDataJSON = '/Graph/HearthRateDataJSON';
$.getJSON(urlDataJSON, "", function(data) {
var dataLines = [];
var dataLabels = "";
$.each(data, function(entryindex, entry) {
dataLines.push(entry['Serie']);
dataLabels = dataLabels + entry['Name'];
});
Plot(dataLines, dataLabels);
});
});
function Plot(dataLines, dataLabels) {
var line1 = "{ label: 'line1.0' }";
options = {
legend: { show: true },
title: 'Heart rate overview',
axesDefaults: { pad: 1 },
seriesDefaults: { showMarker: false, trendline: { show: false }, lineWidth: 3 },
axes: {
yaxis: { min: 0, autoscale: true, label: 'HR[bpm]', labelRenderer: $.jqplot.CanvasAxisLabelRenderer },
xaxis: { autoscale: true, label: 'Time', labelRenderer: $.jqplot.CanvasAxisLabelRenderer }
}
};
//Data from database is already an array!
plot = $.jqplot('chartdiv', dataLines, options);
plot.redraw(); // gets rid of previous axis tick markers
}
With all this in place, you can start up your website and browse to the http://localhost/Graph/HearthRate site. If everything goes well, you should get following image.

Technorati Tags: Asp.net, MVC, jQuery, jqPlot
Similar postsPolar ProTrainer 5 – Average speed readout
Posted on August 20, 2009
Now that I’m using my Polar RS800cx during my cycling tours, I’m of course am using the Polar ProTrainer 5 software to get nice overviews on the registered data!
It’s a great tool to keep track of your trainings.
But also with this software there are some things that are a bit awkward. One of them it the average speed readout. Let me show you through an example.
Recently I rode from the seashore back to my home, this trip would take up some 150km. So overall a long ride! During this I was using both my Trek speed sensor and my Polar RS800cx. When I got home, I uploaded the Polar data to my pc, to take a look at it in ProTrainer 5.
First thing I mostly do, is taking a look at the overall ride in the graph mode. This mode has all data plotted in a big line graph ( default setting ), like the heart rate, speed, cadence and temperature. It will also give you a good overview of all the totals underneath the graph, like total riding time, max and average speed and others… This overview pointed out that I rode an average speed of 25.3 km/h!
Just take a look at it here:

But before you can see the actual graph overview, you first get a smaller window with also some detailed data already available! The weird thing here is that the given average speed here is only 23.7 km/h!
Just take a look at it here:

So I was a bit confused on how this was possible! Because what is the actual average speed now? Through some calculations of my own, it seems that the average speed on the small overview is the correct one, because the total registered time is 6hours 30minutes and the total distance is 154.1 km. Using this, you would get the 23.7 km/h for an average speed!
So how would the 25.3 km/h be possible? This got me thinking and thanks to my Trek speed sensor I’m able to interpret this. Because my Trek sensor gave following data:
Total distance: 152.4 km ( ok slightly of but on such a distance, nothing to worry about )
Total time: 6hours 2minutes ( hey that is much less than on my Polar!! )
Average speed: 25 km/h ( look the 25 figure is comming back )
So we can have following conclusion: Polar does keep track of the average speed calculated on the total time, total distance basis, BUT it will also give you the actual riding average speed!! Meaning that the 25.3 km/h is the average speed while the speed sensor was registering data!! All the time I was standing still is omitted! ( like how other speed sensor, like the Trek, work! )
But because I didn’t pause on every occasion that we had to stop during the ride, my Polar has a longer total time registered! Resulting in the lower 23.7 km/h average speed given in the smaller overview.
To summarise, I actually don’t mind that these 2 readouts are available in the software! To be honest, I’m glad it gives this, but I don’t like the fact that there is no indication in the software that this data could be different and also any explanation is missing!!
The other thing that bothers me is that the graph data does indeed give me the average speed for the actual riding time, but doesn’t present my what the actual riding time was!! Very annoying.
Technorati Tags: Polar, ProTrainer5, RS800cx, Cycling
Similar postsPolar RS800cx PTE – IrDA problem
Posted on August 18, 2009
Only after a few usages ( I only have my Polar RS800cx for a few months ) my Polar IrDA usb device just stopped working.
Well actually, it didn’t stop… when I plugged it in the usb port, Windows detected it and the IrDA device started flashing red! But I couldn’t make any connection with other infra red devices, so also not with my Polar RS800cx! A real problem because my training sessions were filling up the memory on the watch!
I didn’t see any other option then to drive up to the Polar Service center here in Belgium. At the center they had the same ‘problem’ as I had and they just gave my a new usb device!
All is working well again now, but it worries me that the usb device just stopped working so fast. I hope it was just a bad unit, but looking at the Polar support forum, it seems I’m not the only one with IrDA problems!
For the record, I was also using the Black model with the grey tip and also got this model again as replacement.
Technorati Tags: Polar, RS800cx, IrDA
Similar posts- Nikkor 18-200mm – Nikon World Wide warranty
- Polar RS800cx PTE settings – part 1 – Using a speed or cadence sensor
- Colour schemes
Polar RS800cx PTE settings – part 2 – Using temperature
Posted on July 17, 2009
Second post on how to use the Polar RS800cx PTE concerns the temperature!
One of the nice features of the watch, is the ability to register the environment temperature during your exercise! Best way to get a good readout is not to wear the watch on your wrist during the ride, but place it on the handle bar mount.
But again there is something a bit strange on how to get the temperature data… When you finished a free exercise, you’ll be able to get a quick overview in the log file on the watch itself through the File>ExerciseLog menu! In this log, you’ll notice that the temperature is registered. But when you transfer the log to the Polar ProTrainer 5 software, the temperature will not be visible in the overview graph!
This phenomenon is due to the fact the the Polar ProTrainer 5 will only show temperature readout for each lap during the exercise!! Meaning that per default you will not have a ‘first’ lap when you start a free exercise!

To solve this problem, you’ll have to start a lap manually at the beginning of the exercise. To do this you start up the exercise by pressing the large red button on the watch, start the exercise and again press the large red button at the beginning to set the first lap!
After this, when you upload the log to the Polar ProTrainer 5 software, you’ll have the temperature visible in the grid.
Technorati Tags: Polar, RS800CX, Cycling
Similar posts- Polar ProTrainer 5 – Average speed readout
- Heart rate training
- Polar RS800cx PTE settings – part 1 – Using a speed or cadence sensor
Polar RS800cx PTE settings – part 1 – Using a speed or cadence sensor
Posted on July 15, 2009
Like I stated before, I currently own a Polar hrm that works great! But the first time use can be a bit daunting!
Even looking at the support forum of Polar, it seems that I’m not the only one with some first time usage problems… So for back reference and to maybe help other people I’ll post a series of how to set some features.
First up an overview of the main screen:

Secondly the first detailed feature:
Using a speed or cadence sensor
When buying the PTE edition of the RS800CX you’ll get a bundled speed and cadence sensor! But if you buy a regular RS800CX, you can add sensors later on.
Getting the sensors in sink with the watch isn’t actually a big problem. But what most people will have trouble with, like myself the first time, is the fact that you won’t see any data appearing the first time you start a free training.
This is due to the fact that the first time you start a training with the Polar watch, you have to select what type of material you’ll be using during the training! So in my case, my bike.
How to get set:


When you added the sensors, through the >Settings>Features menu – Shoes/Bike 1/2/3>Cadence, you can start a training!

When you are in the training menu for the first time it is imperative that you select the correct tool for the training! Otherwise the watch won’t know for what sensors to look for…
So in the Training menu go to Settings>Shoes/Bikes ( is not the same menu as the Settings menu in the Main ), choose the correct bike and you’re set!
After this you’ll get the small Bike icon in the lower left hand side when the training has started and you’ll be able to see the speed and cadence data.
Technorati Tags: Polar, RS800CX, Cycling
Similar posts- Polar ProTrainer 5 – Average speed readout
- Heart rate training
- Polar RS800cx PTE settings – part 2 – Using temperature
BuzzParadise – Passoã
Posted on July 14, 2009
Well well… it has been a while, but BuzzParadise has again launched a campaign that acquired my taste ![]()
I’ve been given a new Passoã package that is to good to be true
The package contained a mega shaker that suggests that I have a huge amount of friends
but I do think it will come in handy at the next BBQ héhé
There was also a sweat wrist band, a small key ring shoe and a ventilator!
Of course a new t-shirt was also available with some text printed on small pieces of Velcro that you can swap
very neat!
And last but not least some glasses and a Passoã bottle
Thanks BuzzParadise and Passoã
Technorati Tags: BuzzParadise, Passoã
Similar postsHeart rate training
Posted on July 13, 2009
Currently I’m riding my bike only when I have the time, in other words I don’t have any real training goals set.
But, if everything goes well, I’ll be riding the Mont Ventoux next year.
So best to get serious on setting up a training schedule!
First things first, buying a Heart Rate monitor. For me this means only one brand and that’s Polar. But this doesn’t narrow down the choices very much ![]()
What I was looking for, was the option to fine tune a training on my computer and upload this to the Polar product. So I needed one that could work with Polar ProTrainer 5!
On the other hand I would love to be able to do more than just ride my bike, so getting a watch instead of a normal monitor was the second thing on my list!
All things considered there was only one item that could satisfy my needs and that was the Polar RS800cx Pro Team Edition!
I must say I love the product… it has all the features I was looking for and the use of the Polar ProTrainer 5 software is just fabulous!
There are some weird settings you have to take into account when using the watch and looking at the support forum at Polar I’m not the only one with these problems. So for future reference I’ll post them here on this blog.
So keep an eye out for future posts, they’ll be about the use of the watch!
Technorati Tags: Cycling, Polar
Similar posts- Polar RS800cx PTE settings – part 1 – Using a speed or cadence sensor
- Polar RS800cx PTE settings – part 2 – Using temperature
- Polar ProTrainer 5 – Average speed readout
Cycling update
Posted on June 14, 2009
Let’s do ‘a Wimmeke’ and let me also give you a small update on what I’ve been doing with my cycling hobby.
To start I’ve finally invested in a good Heart Rate monitor from Polar. Because it’s a cycling edition, it also comes with a speed sensor and a cadence sensor… so I can keep track of my fitness progress, currently it’s very out of shape.
The first trip with all this equipment was very good, but the cadence sensor was not active at the moment… so the only info available is:
Total distance: 53,7 km
Total time: 2:16:17
Average speed : 23,6 km/u
Average heart rate : 147 bpm
Calories : 1815 kcal
The latest route is one with the cadence sensor available, so there is a little bit more info now:
Total distance : 40,3 km
Total time : 1:31:40
Average speed : 26,4 km/u
Average heart rate : 149 bpm
Calories : 1250 kcal
Average cadence : 83 cadence
- Polar ProTrainer 5 – Average speed readout
- Polar RS800cx PTE settings – part 1 – Using a speed or cadence sensor
- links for 2006-07-29
Sad news for the Martial Arts community – Mike Martello has passed away
Posted on June 4, 2009
All I can say is that I regret I didn’t spend more time with Sifu Mike!
I was only able to follow 2 training sessions and those sessions where intense. Mike seemed to have some supernatural powers, but all relates to his body structure and perfect muscle control. Not to mention his magnificent knowledge of Chin Na.
All I can say is that his passing is a great loss for the Martial Arts community, my thoughts go out to his family and friends.
Official statement over at Wu Tang
Technorati Tags: Mike Martello
Similar posts









