Trying to use Safari on my Macbook Air is nigh on impossible. It keeps on "crashing" inasmuch as it gets half way through loading a page and just stops what its doing.
I can't be bothered to troubleshoot it so now my main browser is Chrome.
Bob Powell's External Monologue
Bob Powell is author of the GDI+ FAQ and a developer of software targeted at the .NET framework.
Bob is a Microsoft MVP and independent consultant.
Thursday, February 16, 2012
Monday, February 13, 2012
Follow me...
My blog and my web site get a lot of hits every day. I can see them on the statistics. The problem is that I'm never sure whether the page has been read or just hit by some bot. Now I know that a certain number of people do read the blog and whether you do so on a regular basis or just visit it via my web site or find it by accident is a question I'd like to answer.
I have thought of a number between 0 and 200. Follow my blog and the n'th follower who coincides with that number will recieve a $20 iTunes gift certificate from me. I'll announce the winner as soon as the magic number is reached.
I have thought of a number between 0 and 200. Follow my blog and the n'th follower who coincides with that number will recieve a $20 iTunes gift certificate from me. I'll announce the winner as soon as the magic number is reached.
Gadgeteer PWM
Pulse width modulation is a digital "trick" to fool analogue devices into thinking that a certain level of voltage is present on an otherwise digital IO pin.
Essentially, the system has a frequency, we'll say 100 hertz for argument's sake, and if the output pin remains high for the entire 100th of a second, that can be considered as the maximum output of the pin.
If however it remains high for only 50% of the time and is low the rest of the time than we can consider that the output is at 50% power.
Changing the pulse width within the 100th of a second time slice enables us to create varying levels of power and even synthesize waveforms if we so desire.
PWM on the gadgeteer is ridiculously simple. There are a number of ports that are PWM enabled. For example, the FEZ Spider has PWM on socket number 8 amongst others.
To set-up PWM on any PWM enabled pin we simply need to declare the PWM controller like so:
private PWMOutput pwm = null;
Then in "ProgramStarted" get the PWMOutput controller:
pwm = this.extender.SetupPWMOutput(Gadgeteer.Socket.Pin.Nine);
Then, to set the power of the pulses:
pwm.Set(x,p);
where X is the overall base frequency of the PWM signal and p is the value 0-100 of the percentage of power to set.
The video below shows Pulse Width Modulation in action on my oscilloscope.
I wired some LEDS up to the Gadgeteer and they changed brightness like so:
Essentially, the system has a frequency, we'll say 100 hertz for argument's sake, and if the output pin remains high for the entire 100th of a second, that can be considered as the maximum output of the pin.
If however it remains high for only 50% of the time and is low the rest of the time than we can consider that the output is at 50% power.
Changing the pulse width within the 100th of a second time slice enables us to create varying levels of power and even synthesize waveforms if we so desire.
PWM on the gadgeteer is ridiculously simple. There are a number of ports that are PWM enabled. For example, the FEZ Spider has PWM on socket number 8 amongst others.
To set-up PWM on any PWM enabled pin we simply need to declare the PWM controller like so:
private PWMOutput pwm = null;
Then in "ProgramStarted" get the PWMOutput controller:
pwm = this.extender.SetupPWMOutput(Gadgeteer.Socket.Pin.Nine);
Then, to set the power of the pulses:
pwm.Set(x,p);
where X is the overall base frequency of the PWM signal and p is the value 0-100 of the percentage of power to set.
The video below shows Pulse Width Modulation in action on my oscilloscope.
I wired some LEDS up to the Gadgeteer and they changed brightness like so:
Tuesday, February 07, 2012
UsbHost.USBDriveConnected
Had a little problem with the Gadgeteer yesterday. I was using the UsbHost to read files from a pendrive and after copying files to the drive, verifying that the files were present and plugging it into the Gadgeteer I discovered that the event which is supposed to fire (USBDriveConnected) never did!
After a lot of head scratching I discovered that the pendrive was formatted in NTFS. The UsbHost software only recognises FAT format drives so be sure to get that bit right when you transfer files to your gadgeteer.
After a lot of head scratching I discovered that the pendrive was formatted in NTFS. The UsbHost software only recognises FAT format drives so be sure to get that bit right when you transfer files to your gadgeteer.
Monday, February 06, 2012
Gadgeteer
Simple, brilliant, works... When you can find any information at-all. I can't find a single example of how to use the usbHost.USBDriveConnected event which doesn't seem to fire anyway.
Hey Microsoft. The documentation could do with looking at!!
Hey Microsoft. The documentation could do with looking at!!
Software Passion 2012 in Göteborg Sweden
Come along to the Software Passion Summit in Göteborg Sweden on 19th and 20th of March 2012. I'll be speaking on Tuesday the 20th.
You can get a 10% discount by booking through this link and using the promo code "BOB" when you book.
See you there!
You can get a 10% discount by booking through this link and using the promo code "BOB" when you book.
See you there!
Thursday, February 02, 2012
I am the proud owner of a Macbook Air
Its sooo thin!!! I'm just installing Windows 7 and Visual Studio in a VirtualBox VM ready for Techdays Paris next week.
I'm rather hoping that putting the apple devtools, mono, monotouch and monodroid as well as VS and WP7 SDKs wont overload it.
- Posted using BlogPress from my iPhone
I'm rather hoping that putting the apple devtools, mono, monotouch and monodroid as well as VS and WP7 SDKs wont overload it.
- Posted using BlogPress from my iPhone
Thursday, January 19, 2012
Kodak, a case of the Xerox's
When Bill Gates was a young programmer he worked for Steve Jobs and Apple. This was when Apple had begun work on the Macintosh and the first commercially available GUI.
Apple didn't however invent the Windows, Icons, Mouse and Pointer WIMP system. Xerox did at their PARC facility in Palo Alto where a young Steve Jobs was mooching around seeing what the big boys were doing.
The truth was that the bosses at Xerox didn't think much of WIMPS and thought it was a stupid gimmick. Certainly no good for real computers so they basically let Jobs walk out with the ideas for free. Later, after Microsoft had developed Windows 1.0 Jobs let fly at Gates, accusing him of robbing ideas from Apple whereupon the shrewd Gates replied along the lines of: "We both went into our neighbor's house to rob him. You got the television and I got the stereo"
Kodak were one of the first companies to develop digital imaging. The bosses of the company however were confident in the fact that film emulsions would always be higher resolutions and richer color than digital sensors could produce. Oh how wrong they were and how much that lack of foresight cost them.
There must be a moral to this story somewhere. Perhaps it is that no boss should ever let go of his options when it comes to an interesting but seemingly unpromising technology.
Apple didn't however invent the Windows, Icons, Mouse and Pointer WIMP system. Xerox did at their PARC facility in Palo Alto where a young Steve Jobs was mooching around seeing what the big boys were doing.
The truth was that the bosses at Xerox didn't think much of WIMPS and thought it was a stupid gimmick. Certainly no good for real computers so they basically let Jobs walk out with the ideas for free. Later, after Microsoft had developed Windows 1.0 Jobs let fly at Gates, accusing him of robbing ideas from Apple whereupon the shrewd Gates replied along the lines of: "We both went into our neighbor's house to rob him. You got the television and I got the stereo"
Kodak were one of the first companies to develop digital imaging. The bosses of the company however were confident in the fact that film emulsions would always be higher resolutions and richer color than digital sensors could produce. Oh how wrong they were and how much that lack of foresight cost them.
There must be a moral to this story somewhere. Perhaps it is that no boss should ever let go of his options when it comes to an interesting but seemingly unpromising technology.
ASP.NET button mouseover image change in javascript
The story so far: I wanted to do something very simple. I have a web-site that needs multi language capabilities so, I store all my site text in a database and pull it out using the country code of the client browser. This means for example that I could have a button with "About" in English and "A Propos" in French. I also wanted a mouseover effect for my buttons to provide a little bit of visual feedback so I created button background slices with appropriate blank backgrounds with the intention of updating the button text in the manner mentioned above.
Well. An ASP.Net image button does the mouseover just fine but not the text. It can't have text. With a little bit of cajoling one can make the ASP.net Button control have a background so that one can indeed update the text. The problem was that there seems to be no way in the world to make the mouseover behaviour work with the Button control. Not using Framework 4.0 anyways.
Microsoft recently modified the way attribute encoding is done in Framework 4.0. This means that if you if you put something like:
onmouseover="alert('boo!')
The 4.0 framework however encodes this as:
onmouseover="alert('boo!')"
I have no clue why but if you start the web project as framework 4.0 and use javascript inline, the server falls over at the encoded apostrophes. If however you switch to framework 3.5 and then back to 4.0 again, something magic happens and the javascript sees the ' as an apostrophe.
In order to make my ASP.Net Button control with image background mouseover behaviour work correctly, here's what I did:
#1 Switch the project to framework 3.5 then back to Framework 4.0
#2 Declare your button:
<asp:Button ID="AboutButton"
Style="background-image:url('images/aboutoff1.jpg'); text-align:left; background-color:Transparent; cursor:hand; background-repeat:no-repeat; background-position:left; font-family:Verdana, Sans-Serif; font-size:28pt; font-weight:bolder;"
Runat="server"
Height="53px"
BorderStyle="None"
Text="About"
Width="352px"
#3 declare your mouseover behaviour in javascript
onmouseover="document.getElementById('ctl00_AboutButton').style.backgroundImage='url(images/aboutover.jpg)';"
onmouseout="document.getElementById('ctl00_AboutButton').style.backgroundImage='url(images/aboutoff.jpg)';"/>
Summary
Traditionally, asp.net controls have been a bit closed but relatively easy to coerce. A bit of wc3 compliant Javascript helps out enormously when the ASP control of choice needs a tweak. Ok, one could roll up one's sleeves and write an ASP.net custom control and render the HTML yourself with no problem but it so much easier to mix and match ASP and javascript.
Well. An ASP.Net image button does the mouseover just fine but not the text. It can't have text. With a little bit of cajoling one can make the ASP.net Button control have a background so that one can indeed update the text. The problem was that there seems to be no way in the world to make the mouseover behaviour work with the Button control. Not using Framework 4.0 anyways.
Microsoft recently modified the way attribute encoding is done in Framework 4.0. This means that if you if you put something like:
onmouseover="alert('boo!')
The 4.0 framework however encodes this as:
onmouseover="alert('boo!')"
I have no clue why but if you start the web project as framework 4.0 and use javascript inline, the server falls over at the encoded apostrophes. If however you switch to framework 3.5 and then back to 4.0 again, something magic happens and the javascript sees the ' as an apostrophe.
In order to make my ASP.Net Button control with image background mouseover behaviour work correctly, here's what I did:
#1 Switch the project to framework 3.5 then back to Framework 4.0
#2 Declare your button:
<asp:Button ID="AboutButton"
Style="background-image:url('images/aboutoff1.jpg'); text-align:left; background-color:Transparent; cursor:hand; background-repeat:no-repeat; background-position:left; font-family:Verdana, Sans-Serif; font-size:28pt; font-weight:bolder;"
Runat="server"
Height="53px"
BorderStyle="None"
Text="About"
Width="352px"
#3 declare your mouseover behaviour in javascript
onmouseover="document.getElementById('ctl00_AboutButton').style.backgroundImage='url(images/aboutover.jpg)';"
onmouseout="document.getElementById('ctl00_AboutButton').style.backgroundImage='url(images/aboutoff.jpg)';"/>
Summary
Traditionally, asp.net controls have been a bit closed but relatively easy to coerce. A bit of wc3 compliant Javascript helps out enormously when the ASP control of choice needs a tweak. Ok, one could roll up one's sleeves and write an ASP.net custom control and render the HTML yourself with no problem but it so much easier to mix and match ASP and javascript.
Sunday, January 15, 2012
Star Trek X-Prize
Well, it had to happen. Strangely I was just expounding the possibilities of such a device to my wife, Chrissy, just a few days ago. Qualcom and the X-Prize organisation have put up a ten-million dollar prize for the team who succeeds in creating a "Medical Tricorder" similar to the type used by Doctor Leonard McCoy in the original Star Trek series.
The device should weigh no more than 2.2 kilos so bulkier than that of the good doctor, should be able to scan and analyse a patients vital signs and to diagnose fifteen conditions over a short period of use.
My own view is that this sort of device is well within reach without a vast amount of research. Given that modern smartphones sport multi-processor CPU's, huge memory, internet connectivity and are already packed with peripherals I see no problem in adding to the range of peripherals available and getting the prize.
I would begin with a normal smartphone architecture, add an infra-red camera, an ultrasound that could do scanning using the accelerometers for position referencing. I would interface in an add-on wrist sphygmomanometer (blood pressure doohickey) via a bluetooth connection, similarly a blood-oxygen clip to go on an earlobe. A super sensitive microphone and a nice DSP for listening to lungs and heartbeat with decent frequency analysis software for listening to heart valve noises, gas analysis and a set of really good macro lenses for looking into eyes that could even double as a microscope.
Imagine all that in a SIRI style relationship with a back-end system capable of doing differential diagnosis based on the experiences of a nice fat medical database and you're done!
Hey, somebody give me a job running the team and I'll snag the prize for you!
(Seriously!)
The device should weigh no more than 2.2 kilos so bulkier than that of the good doctor, should be able to scan and analyse a patients vital signs and to diagnose fifteen conditions over a short period of use.
My own view is that this sort of device is well within reach without a vast amount of research. Given that modern smartphones sport multi-processor CPU's, huge memory, internet connectivity and are already packed with peripherals I see no problem in adding to the range of peripherals available and getting the prize.
I would begin with a normal smartphone architecture, add an infra-red camera, an ultrasound that could do scanning using the accelerometers for position referencing. I would interface in an add-on wrist sphygmomanometer (blood pressure doohickey) via a bluetooth connection, similarly a blood-oxygen clip to go on an earlobe. A super sensitive microphone and a nice DSP for listening to lungs and heartbeat with decent frequency analysis software for listening to heart valve noises, gas analysis and a set of really good macro lenses for looking into eyes that could even double as a microscope.
Imagine all that in a SIRI style relationship with a back-end system capable of doing differential diagnosis based on the experiences of a nice fat medical database and you're done!
Hey, somebody give me a job running the team and I'll snag the prize for you!
(Seriously!)
Subscribe to:
Posts (Atom)