Righthand Dataset Debugger Visualizer updated to 1.0.6

by Miha Markič 11. January 2012 13:29

Here is the list of what’s have been added/changed in 1.0.6.:

  • better handling of a single DataTable - now, when table is part of a dataset, it loads entire dataset and jumps to the selected table. Note that when committing changes in this scenario, only changes in selected DataTable will be committed.
  • minor bug fixes

Go, grab v1.0.6 from dedicated page and visit forums as well.

Tags:

.net | VS 2008 | VS 2010 | Visualizer

Realtime graph for WPF

by Miha Markič 10. January 2012 11:31

You know the Task Manager’s CPU Usage History graph that shows CPU utilization over time? Try that type of the graph in WPF and you’ll realize that it isn’t as easy as it should be due to the WPF’s performance for real time graphs. Which sucks due to the way WPF works. Even with 3rd party you’ll have hard time to find a graph fast enough to cope with even more than few hundred samples.

Hence I’ve decide to build my own real time graph. It is based on Direct2D because Direct2D is much faster when it comes to presenting the graphical result. However, merging Direct2D into WPF is, again, not an easy task as it should be (hint to MS – there should be native WPF support for hosting Direct2D output). Anyway, I found the article Using Direct2D with WPF on CodePlex. It comes with sources which I use. Those sources require Windows API CodePack(WACP), a bug ridden set of managed API’s to various, otherwise unsupported, features (MS went with this approach (if it works, it works, if it doesn’t fix it by yourself) instead of providing an official support). The WACP binaries I provide are compiled from 1.1. sources with some bug fixed regarding DirectCompute.

Here is a snapshot from a graph showing a sinusoide as a product of many samples (the attached example contains required code and binaries).

realtimechart

I utilize a combination of Direct2D and samples optimization which yields smooth result even with million and more samples.

 

Required code

Create a class that implements IGraphItem interface. This class will hold a single sample through Time and Value property. Time typically represents a time elapsed since the start and it is expressed in millisecond while Value is a double and holds whatever value.

public class RealtimeGraphItem : IGraphItem
{    
    public int Time { get; set; }
    public double Value { get; set; }
}

Configure RealtimeGraphControl like

xmlns:rg="clr-namespace:Righthand.RealtimeGraph;assembly=Righthand.RealtimeGraph"
...
<rg:RealtimeGraphControl x:Name="Graph" AxisColor="Blue" AxisWidth="1"      VerticalLinesInterval="5" VerticalLabelsStep="2"  SpanX="100"
      MaxY="250" MinY="50"  HorizontalLinesInterval="10"/>

where SpanX is time span expressed in seconds telling the graph how many seconds are shown.

Finally create a BindingList<RealtimeGraphItem> source and bind it to Graph.SeriesSource property (BindingList is required as it has the event ListChanged that is used to trigger rendering update of the graph). And that’s it. When you add new items to the source the graph will automatically reflects the new state.

 

Requirements

.net 4.0

Dowload

Attached are binaries and the sources for the Example project.

Let me know what you think.

RealtimeGraph_1_0.zip (1.31 mb)

Tags:

.net 4.0 | DirectX | Graphics

Burning a bootloader to a (Arduino’s) Atmega CPU

by Miha Markič 23. December 2011 00:45

One of the many uses of an Arduino board is using it as an ISP (In-System Programmer). Which means burning bootloaders or programs without use of a bootloader directly to the ATmega CPU.

Why would somebody need to do that? Here is a real example.

I bought a 9 Degrees of Freedom Razor IMU a while ago. It is an Arduino compatible microcontroller with sensors in reality. Anyway, a small batch of these came with the wrong bootloader and I was lucky to get one of these. So, instead of sending it back and getting a new one I’d chose a simpler way. Burn the proper bootloader. There are ISPs out there that do the job just fine but for me it was an one time gig, thus I decided to go with an Arduino Mega ADK (which I have and I’ll refer to it simply as MegaADK) as an ISP.

A word of caution. This procedure worked for me. You might have a different hardware and it might not work well for you.

How to

  1. Download ArduinoISP sketch that lives in Examples folder of Arduino IDE (using latest version – 1.0) to MegaADK.
  2. Connect MegaADK and Razor through SPI. (note: You will need to solder some pins to enable SPI on Razor). Pin 1 on Razor is marked with a white line (here you can find a diagram for SPI header).
    Connect (from MegaADK to Razor) MISO->MISO, MOSI->MOSI, SCK->SCK and SS->RESET. Power for Razor is brought through USB (using 3.3V FTDI Basic Break board) but you can use other power sources.

    razor
    Razor with marked pin 1 (blue) and SPI header (yellow)
    (original photo taken from Sparkfun)
  3. Using Arduino IDE select Tools/Programmer/Arduino as ISP and a target Tools/Board, which is Arduino Pro or Pro Mini (3.3V, 8Mhz) w/ ATmega328 in my case since ATmega328p is used on Razor.
  4. If everything worked properly you’d hit Tools/Burn Bootloader. But there is a bug in Arduino libraries that come with version 1.0. For some reason you have to find HardwareSerial.cpp source file (located in [Arduino setup folder]\hardware\arduino\cores\arduino. Edit the 43th line which goes like "#define SERIAL_BUFFER_SIZE 64” to “#define SERIAL_BUFFER_SIZE 128”. If the buffer isn’t set to 64 the burn process will most probably stop when it tries to burn data pages with error like this:
    avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
  5. Hit the Tools/Burn Bootloader and wait for half a minute and there you go, a fresh bootloader is burned to the Razor and it can be programmed using classic Arduino way again.

Photo of my setup:

IMG_0424

On the left is Razor, on the centre is Arduino Mega ADK and on the right is a bread board for three LEDs that signal the status of the ISP (green, red and yellow signalling the burning in progress).

Using Arduino BT

I think that it is quite possibly to use the Arduino BT (Bluetooth version). I am mentioning BT version because it has an interesting quirk and a feature.

Reset pin

A program mode LED mentioned above is attached by default to pin 7. The problem is that pin 7 on BT version is used to reset the bluetooth module and shouldn’t be used for anything else. Even if you don’t connect the LED it will reset the bluetooth module and thus drop the connection between Arduino IDE and ArduinoBT once the burn process begins.

The remedy is quite simple. Before downloading ArduinoISP sketch to the ArduinoBT (step 1) you should modify the sources by changing the pin used for signalling the program mode. There are two occurrences:

#define LED_PMODE 7 and the other in void setup() procedure (not sure why the later isn’t using the former). Change number 7 to any other suitable pin and the Bluetooth connection won’t drop anymore.

Serial port speed

Bluetooth communication in ArduinoBT is supposed to run at 119200 bauds, but the ArduinoISP sketch is using 19200 bauds. Simply change the value in void setup() procedure to Serial.begin(119200);

There you go, ArduinoBT is a functioning ISP now.

Hope this article will help somebody.

Tags: , , ,

Arduino | Microcontroller | Tip

Mounting Samsung Galaxy S on the bicycle

by Miha Markič 14. December 2011 11:00

The challenge of mounting your smartphone on the bicycle is much bigger than one would assume. There is one rule though – avoid cheap mounting solutions otherwise the Gorilla glass will have to show its strength. There are few solutions, one of those is using RAM Mount holders which are supposed to be of a great quality and strength. They have a zillion of various combinations of these.

The proper one for my phone and the bicycle is called RAM Mount Adjustable Rugged Universal Finger Grip Holder Cradle for Cell Phone and Smartphone Mobile Devices (product number RAM-HOL-UN4U). What a name, huh? Note that’s just the cradle and it is universal. To mount it on the bicycle you’ll need the proper bicycle mount which goes by name of RAM EZ-ON/OFF™ Bicycle Mount with Dual Strap Base and Swivel Diamond Base Adapter (product name RAP-274-1U). Or even better, buy those two together as RAM EZ-ON/OFF™ Handlebar Mount (product name RAP-274-1-UN4U) to save a few bucks. I bought it from Ram-mount Slovenia.

After assembling and mounting it on the bicycle I have these observations.

The good

  • both cradle and mount are strong, good quality
  • assembling and mounting is straightforward
  • it rotates 360 degrees (albeit nor freely, it has predefined positions)
  • it would fit a variety of smartphones and other devices
  • interchangeable pieces
  • grips doesn’t interfere with phone buttons (not tested yet on the move)

The bad

  • looks big and not too aesthetic
  • due to the mounting mechanism it might not align (alignment might be off by a bit, but that’s can be adjusted I think)
  • it is not water proof (no protection) – but it wasn’t meant to be
  • expensive
  • a bit too high for Galaxy S. However this shouldn’t be an issue as lateral “fingers” won’t let it move anyway.

That said I didn’t yet take a ride with it due to the bad weather conditions (rain, rain and rain) but it certainly looks to me a very solid solution. The phone won’t fall off the bike, that’s for sure.

Here are few photos of the mounted phone next to the excellent Exposure Strada Mk.3 front light on my Cannondale M700. Now just waiting for the rainy period to finish as I am looking forward to test it.

 

RAM Mount for smart phoneRAM Mount for smart phone

RAM Mount for smart phoneRAM Mount for smart phone

RAM Mount for smart phoneRAM Mount for smart phone

RAM Mount for smart phone

Tags:

GPS | Hardware

Slides from my .NET Micro Framework and Netduino (using also XBee Pro and C328R camera) talk at Študent je car

by Miha Markič 8. December 2011 18:26

Today I’ve presented .NET Micro Framework to the students of Nova Gorica. I demonstrated running the C# code on Netduino by taking photos (on demand from client) using C328R camera, sending the JPG bytes over the wireless PAN provided by the two XBee Pros and showing the image within the WPF application running on the desktop. It was my first semi-hardware talk and it went fairly well I assume.

Attached are Power Point slides (in Slovene) and the demo code.

Note about demo: The client code requires PostSharp (if you compile it) for creating and implementing INotifyPropertyChanged. If you don’t have PostSharp then remove the references to it and NotifyPropertyChangedAttribute class. Then implement it manually for MainViewModel class.

mf.rar (13.00 mb)

Tags: ,

.net | Hardware | Microcontroller | Slovenia

Slides (Slovene) from my “compiler as a service” talk at Bleeding Edge 2011

by Miha Markič 2. October 2011 11:32

I have to say that I really liked this year’s Bleeding Edge event. It happens rarely that all the pieces fit together: weather was excellent, location was beautiful, I enjoyed my trip (part by train, part by bicycle), attendees were just great and my presentation was a nice interactive (with attendees) one – just as I like. I gave a ton of swag and shown how to enhance your development experience with extending/using CodeRush DXCore, PostSharp or just by using CSharpCompiler.

Hopefully the attendees did like the presentation as well.

Download the few slides below and see you at the next Bleeding Edge!

Prevajalnik kot storitev.ppt (586.50 kb)

Tags: , ,

.net | CodeRush | DevExpress | DXCore | DXCore plugin | Presentation | Slovenia

My “compiler as a service” talk at Bleeding Edge 2011

by Miha Markič 28. September 2011 15:40

Microsoft is working on compiler as a service codenamed Roslyn for Visual Studio 11 which is supposed to come sometime next year, I assume towards the end of the 2012. Not much is known and Roslyn might be less feature rich as one might expect. Microsoft announced at Build conference that they’ll release some Roslyn CTP bits in a few weeks time.

The good news is that you can already use compiler as a service today through tools such as CodeRush(commercial)/CodeRush Xpress(free), PostSharp(commerical) and custom coding. Even if some tools are commercial, they provide a tremendous value.

Anyway, after a sabbatical year, I’ll talk again at the Bleeding Edge. In fact I’ll be talking about how to leverage these tools and use compiler as a service for improving both design time coding and your applications in general.

But most importantly, I'll be giving a lot of swag away :-)

See you at Bleeding Edge - do stop by and say hi.

Tags: , ,

.net | CodeRush | DevExpress | DXCore | DXCore plugin | Presentation | Slovenia

Added some features to Righthand Dataset Debugger Visualizer

by Miha Markič 13. September 2011 18:50

Here is the list of what’s have been added in 1.0.5.:

  • Tables tree width is persisted
  • added "show original values" feature (through button in a toolbar). When enabled it will show the cell original value in parentheses. Disabled by default.
  • Error and Changed columns are narrower and fixed width to conserve space

Go, grab v1.0.5 from dedicated page and visit forums as well.

Tags:

.net | VS 2008 | VS 2010 | Visualizer

ASUS Support? Who cares.

by Miha Markič 10. September 2011 15:12

Not long ago I’ve purchased an ASUS Transformer (Eee pad) Honeycomb tablet. Good specs, great price. I’d buy it even sooner if it weren’t for ASUS’ blunder with not providing enough units to the market (for some reason they released this great tablet in ultra-low quantities and it took almost a quarter of the year to provide enough units to satisfy market demands – first ASUS fail – what were they thinking?).

Transformer is really a great tablet, nothing to complain about and ASUS is really taking care of updating the OS in timely fashion. In fact it is the best combination out there right now (for Honeycomb tablets AFAIK) – others should follow their example. Anyway, I was a happy user for a month or so until I’ve come across Kendo UI – an optimized javascript/HTML5 library for UI components. Curiosity took over and I’ve tried few demos just to realize that they are running abnormally slow on a tablet that is supposed to perform very fast. My initial though was that Kendo UI is crap but later I’ve found that I was totally wrong on this assumption. Just to be sure I’ve tried Kendo UI on my Samsung Galaxy S phone and wonders, it runs much faster on my phone (supposedly much slower device) than on my (supposed to be) faster tablet. Makes sense? Not really.

So I started investigating by comparing the two devices. The most objective way of comparison are of course benchmark tests. I started with SunSpider (javascript benchmark – Kendo UI is all about javascript). I’ve got a result that is twice as slower compared to what others are getting on the same tablet. Even my phone scores better. I’ve also run Antutu and Quadrant. The results are below (expected results are from a fellow Transformer owner and from results from various web sites).

SunSpider

Expected

Actual

Difference (the factor of slowness)

lower is better

 

2291

4550

1,99

Note that running a different browser doesn’t change the results significantly.

 

Antutu

Expected

Actual

Difference (the factor of slowness)

lower is better

RAM

806

363

2,22

CPU Integer

1152

519

2,22

CPU floating-point

1014

453

2,24

2D graphics

298

302

0,99

3D graphics

859

725

1,18

Database IO

270

165

1,64

SD card write

189

174

1,09

SD card read

126

119

1,06

Overall

4714

2820

1,67

 

Quadrant

Expected

Actual

Difference (the factor of slowness)

lower is better

 

2399

1005

2,39

What can I gather from results is that there is a problem with CPU but not with GPU (factor is about 2 or more for CPU related tests which means twice as slower as it should be).

I even performed a factory reset and still got the same results. This is the first time I saw a device underperforming and I had no idea why. I’ve contacted Asus UK (I’ve bought it from UK because there is cheaper and it was the only EU country actually selling them) and they suggested a RMA (sending it in for a repair). The ASUS’ response was pretty quick in less than a day. I was supposed to contact a local Slovene company which I did and they dispatched an express courier to pick my tablet up (which was a pleasant surprise, something I am not used to). Slovene guys also warned me that they are not a repair shop, they will just forward it to designated repair service (supposedly in Czech republic) and that it might take a couple of weeks or even three weeks until I get it back. At least I’ll get a properly functioning tablet back I thought at the moment, even though I was getting used to the tablet.

The fail of the ASUS service logistics

So the tablet is gone for a service and after three weeks there was no sign of it – even though I’ve waited eagerly outside the house for the postal courier every day (just kidding). Hence I called the local Slovene company to ask how is it going with my tablet and when I might expect it back. The answer was by far the one I didn’t expect: “hey, in a day or two we will finally send it to the service”. “Errr, what? I think I didn’t understood that sentence, can you repeat it for me?” And the repeated answer was horribly the same. “So, you are telling me that you’ve spent three weeks or so just to prepare for sending my transformer to the service?” “Yes, but that doesn’t depend on us, you know. The Czechs (service) are supposed to organize the physical transfer, they are working on it, we are just the messenger, it doesn’t depend on us. We just (magically) open a case on our application and that’s it as far as we are concerned.”. WTF? ASUS could replace the device immediately without even sending it to the repair service if you care about your customers. But no, everything has to be by the internal rules, which involves stupid internal logistic problems or who knows what.

ASUS, is this the way of treating your customers? Is it really? I mean I had plenty of confidence in ASUS that they will make it right with their excellent tablet. I understand that the tablet might malfunction for a reason or another. But not dealing with failures in timely manner is the second and by far their worst failure (first one is failure to provide enough units at the start). And one wonders why iPad is still reigning the tablet market? It is because Taiwanese companies just don’t get it (nor does Motorola). They don’t get the whole picture nor they take care to provide customer friendly service in every aspect. At this point what is “pushing” the repair is the Slovene law which says that the warranty repair has to be done within 45 days (otherwise they have to replace it with a new device). Same on ASUS of even considering this time limitation.

If I know all this I’d just plan a family vacation somewhere in Czech republic near the repair service.

16.9.2011 Breaking update: A month after I sent my tablet for repair and a week after it was actually sent to the service (and after a week I've wrote this rant) I've got a replacement back - or at least the attached document says so. It is working as expected now. I am again a happy Honeycomb user.

Tags: , , , ,

Android | Hardware

Fixed Save As menu item in Righthand Dataset Debugger Visualizer

by Miha Markič 1. September 2011 14:30

The Save As menu item should now work as expected. Go, grab v1.0.4 from dedicated page.

Tags:

.net | VS 2008 | VS 2010 | Visualizer

Miha Markic

About me
Righthand
 
Microsoft MVP
 
Developer Express' DXSquad
INETA Country Leader for Slovenia
INETA Country Leader for Slovenia

Slovene Developer Users Group Lead
Friends of Red-Gate
LLBLGenPro Partner

Miha currently works as a free lance consultant and software developer specialized in .net area.
He graduated in Computer and information science at the University of Ljubljana, Slovenia. He has accumulated experience in various programming languages such as Java, Visual Basic 3-6 (MCP), Visual C++, Delphi, C# and VB.Net through years.
He has experience in practically all (technical) stages of project development, including planning, framework development, user interface, business processes, as well as testing and documenting. He has worked on big and small projects in Slovenia and abroad (e.g. participated in completing level 3 IS for the Nucor steel plant, Hertford, USA).
Currently he enjoys programming in .net environment using C#. Since 2000 he has been active in Developer Express' DX Squad and has been ECDL trainer and tester. He also gives lectures on conferences and other events in Slovenia.

Month List

Tag cloud

Most comments

Paulius Paulius
1 comments
us United States
Meh Meh
1 comments
us United States
bart dm bart dm
1 comments
nl Netherlands

RecentComments

Comment RSS