Category Archives: Canadian, eh!

Articles written in English (at least attempted to be, I’m not very good at it)

New WP site

This is my temporary web site, intended to serve as a sand box for learning more about WordPress. It will evolve, grow, change, and very often – be broken.

I’ve been using / playing with WP since Mingus (v1.2). It was residing on different web servers that I was building and killing in my basement. Each of those servers had an installation or two of the WP. Although I can be considered as an experienced WP user, I was only that – just an user. Trying different plugins, themes, little bit adjusting some of the themes … Nothing seriously. No consistent posting, no big traffic, no big deal.

Now, although I don’t work in the web industry as a professional anymore (been there from the end of the ’90s – ’till around 2003), I can confidently say that I have necessary skills for more serious meddling with the WP. HTML, CSS, JavaScript, PHP, … everything is here, it’s just little bit rusty. Engine needs some oiling and TLC. That’s going to be purpose of this site.

PICAXE LCD Thermometer

Code and schematic for the LCD thermometer built with PICAXE 28X1.

Click on the schematic to get big picture, or click here for the pdf.

To copy the code, hover over the code and you’ll see four icons on top right. First icon opens new window with the code only, second icon copies the code to the clipboard, third icon prints the code (be careful with that, prints more than 5 pages, so don’t kill the trees).

; =================================================================
; author: Goran Poprzen
; filename: lcd-temp-0.7.bas
; target: picaxe28x1
; date: Jan 5, 2009
; version: 0.7
; description: Measures the temperature with DS18B20 temp. sensor
; and shows on the 2x16 char LCD display,
; also sends to the serial terminal, and
; checks against the limits and sets the output accordingly:
; high if temp. is lower then higher limit,
; low if temp. is higher then lower limit.
; Confusing, eh? Not really!
; =================================================================

; picaxe28x1 variables
; bit0-31, b0-27, w0-13

; variables used here:

symbol lcdchar = b4
symbol lcdtmp = b5
symbol counter = b6

symbol position = b7
symbol tenths = b8
symbol ones = b9

; 16-bit measured temperature
symbol temp12 = w5
symbol temp12lo = b10
symbol temp12hi = b11

; 16-bit lower temp. limit
symbol TL = w6
symbol TLlo = b12
symbol TLhi = b13

; 16-bit higher temp. limit
symbol TH = w7
symbol THlo = b14
symbol THhi = b15

; status of the output pin
symbol LED = bit0

; greetings message
eeprom 0,("GPtronics 2010Thermometer")

#rem
here is the table for
decimal part of the temp reading

0 / 16 = 0.0000 ==> 00
1 / 16 = 0.0625 ==> 06
2 / 16 = 0.1250 ==> 12
3 / 16 = 0.1875 ==> 19
4 / 16 = 0.2500 ==> 25
5 / 16 = 0.3125 ==> 31
6 / 16 = 0.3750 ==> 37
7 / 16 = 0.4375 ==> 44
8 / 16 = 0.5000 ==> 50
9 / 16 = 0.5625 ==> 56
10 / 16 = 0.6250 ==> 62
11 / 16 = 0.6875 ==> 69
12 / 16 = 0.7500 ==> 75
13 / 16 = 0.8125 ==> 81
14 / 16 = 0.8750 ==> 87
15 / 16 = 0.9375 ==> 94

#endrem
; two decimal digits rounding
; eeprom 32,("00061219253137445056626975818794")

; four decimal digits - not rounded
eeprom 32,("0000062512501875250031253750437550005625625068757500812587509375")

; =================================================================

main: ; executed at the beginning
gosub taketemp ; first measuring to determine initial status of the output relay
gosub init
gosub lcdinit ; initialization of the lcd display
gosub hello ; greeting message - just for fun :)

main2: ; loop
gosub taketemp ; temperature measuring
gosub checklimits ; checks measured temp. against limits and sets output accordingly
gosub sendtemp ; sends data to rs-232
gosub showtemp ; converts numbers and shows them on lcd

goto main2 ; loop again

; =================================================================

init:
counter = 0

TLhi = 22 ; lower temperature limit
TLlo = 0
THhi = 24 ; higher temperature limit
THlo = 0

if temp12 <= TH then : gosub ledon : else : gosub ledoff : endif

return

; =================================================================

lcdinit:
pins = 0
pause 200

pins = 48
gosub pulsing
gosub pulsing
gosub pulsing

pins = 32
gosub pulsing
gosub pulsing

pins = 128
gosub pulsing

lcdchar = 14
gosub wrins

lcdchar = 12
gosub wrins

return

pulsing:
pulsout 3,3
pause 10
return

; =================================================================

wrchr:
pins = lcdchar & 240
high 2
pulsout 3,1
lcdtmp = lcdchar * 16
pins = lcdtmp & 240
high 2
pulsout 3,1
return

wrins:
pins = lcdchar & 240
pulsout 3,1
lcdtmp = lcdchar *16
pins = lcdtmp & 240
pulsout 3,1
high 2
return

; =================================================================

hello:
lcdchar = 1
gosub wrins

lcdchar = 12
gosub wrins

for counter = 0 to 13
read counter, lcdchar
gosub wrchr
next counter

lcdchar = 192
gosub wrins

for counter = 14 to 24
read counter, lcdchar
gosub wrchr
next counter

pause 1000

lcdchar = 1
gosub wrins

return

; =================================================================

taketemp:
readtemp12 7, temp12
temp12 = temp12 * 16
temp12lo = temp12lo / 16
return

; =================================================================

sendtemp:
#rem
sertxd("Temp= ",#temp12hi," and ",#temp12lo,"/16 C",13,10)
sertxd("TH= ",#THhi," and ",#THlo,"/16 C",13,10)
sertxd("TL= ",#TLhi," and ",#TLlo,"/16 C",13,10)
return
#endrem
sertxd("Temp= ",#temp12,13,10)
sertxd("TH= ",#TH,13,10)
sertxd("TL= ",#TL,13,10)
return

; =================================================================

showtemp:
lcdchar = 2
gosub wrins

lcdchar = temp12hi / 100
if lcdchar = 0 then leadzero
lcdchar = lcdchar + 48
goto nonleadzero
leadzero:
lcdchar = lcdchar + 32
nonleadzero:
tenths = temp12hi // 100
gosub wrchr ; write 100s

lcdchar = tenths / 10
lcdchar = lcdchar + 48
ones = tenths // 10
gosub wrchr ; write 10s

lcdchar = ones
lcdchar = lcdchar + 48
gosub wrchr ; write 1s

lcdchar = "."
gosub wrchr

for counter = 0 to 3
position = temp12lo * 4 + 32 + counter
read position, lcdchar
gosub wrchr
next counter

lcdchar = 178
gosub wrchr

lcdchar = "C"
gosub wrchr

return

; =================================================================

checklimits:

if LED = 1 and temp12 > TH then gosub ledoff

if LED = 0 and temp12 < TL then gosub ledon

return

; =================================================================

ledoff:
low portc 1
LED = 0
return

ledon:
high portc 1
LED = 1
return

; =================================================================

[/sourcecode]

That’s it. In the next episode, I’ll break-up the code and try to explain each subroutine.

PC in a Mac’s case

As I said to my friend Andrew, we are going to end up on “The (Electronics) Antique (read: mostly junk) Road Show”. And we are proud of it. My recent find is a Mac G4, almost complete. Time for a new project. I’m not going to try and restore the Mac. No, most of the parts are going back to the same recycling bin, but case is … I’ve never seen that good PC case. Here are the pictures:

Mac in the basement

Mac in the basement

Open case

Open case

Mac with distant relatives

Mac and its distant relatives

On the last picture is the Mac with its distant relatives: Sinclair’s ZX Spectrum (anyone remembers it? 48kB RAM!!!) and Acer’s Aspire One running UNR 9.04. Anyway, as you can see from the second picture, there is PS, mobo, dvd drive, video card. There was no hard disk in it, and whoever took it out, he didn’t leave the HD mounting bracket. No worries, there is two more still left in the case.

That’s going to be my fall/winter project: PC in the Mac’s case, running Ubuntu 64bit, whatever version is going to be the most recent, probably 9.10. I wont finish it before the release date, that’s for sure.

Piece of an old PHP code

I was going through some old notes today. Found cute little piece of the php code. Here’s to try wordpress’ sourcecode tag:

$self = $_SERVER['SCRIPT_NAME'];

if (isset($_COOKIE['style'])) { 
  $stil = $_COOKIE['style']; 
} else { 
  $stil = 'default'; 
}

if (isset($_COOKIE['lang'])) { 
  $lang = $_COOKIE['lang']; 
} else { 
  $lang = 'en'; 
} 

if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['pazi'] == 'sad') {
  setcookie('style',$_POST['izbor'],time()+6000000,'/');
  Header("Location:$self"); 
} 

if ($_SERVER['REQUEST_METHOD'] == 'GET' && (isset($_GET['ln']))) { 
  setcookie('lang',$_GET['ln'],time()+6000000,'/'); 
  Header("Location:$self"); 
} 

Looks like it works, eh? How about some arduino code?

/*
Blink

Turns on an LED on for one second, then off for one second, repeatedly.

The circuit:
* LED connected from digital pin 13 to ground.

* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13, so you don't need any extra components for this example.

Created 1 June 2005
By David Cuartielles

http://arduino.cc/en/Tutorial/Blink

based on an orginal by H. Barragan for the Wiring i/o board

*/

int ledPin = 13; // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}

Night walk on Nose hill

Last night was our first hike/walk with Calgary Outdoor Club. Here are the pictures:

Nose hill sunset

Nose hill sunset

It was beautiful evening.

Calgary viewed from the Nose hill

Towers of Calgary from the Nose hill

Then the city lights came on.

Full moon above the city

Full moon above the city – shot from hand, hence the blur.

With the moon like this, we didn’t need flashlights.

Thanks, outdoorphil and the rest of the gang! See you soon, again!

UNR 9.04beta on AA1

Hey, I’ve just installed Ubuntu Netbook Remix 9.04beta daily build (.img file dated April 4, 2009). Here is the link to daily-live/current. It might change, of course. Not link, but .img file.

When tried previously, with alphas and previous beta builds, didn’t have luck with wireless and touchpad. Wifi didn’t work, and touchpad was flaky.

I have to report that today everything works without tweaking. Will test further and post it here.

New summer recipes … be prepared!

As found in Barbecues Galore 2009 flyer:

Planked, Sweet Mashed Potatoes

Ingredients:

  • 1 large sweet potato
  • 4 large potatoes
  • 2 Tbsp butter
  • 1 Tbsp melted butter
  • 1/2 cup half-and-half cream
  • 1/4 cup sour cream
  • 1/4 cup Parmesan cheese – grated
  • 2 cloves roasted garlic – minced
  • chives for decoration
  • 1 Tbsp chopped parsley
  • paprika for a bit of finishing colour
  • 1 cedar grilling plank, soak overnight

Peel and cube both kinds of potatoes and boil until tender (approx. 20 min). Add half the Parmesan , all the garlic, butter, cream, and sour cream. Mash it up. Arrange the potato mash onto the plank. Grill using indirect medium/high heat for about 25 min. Remove and top with the rest of the cheese and some greens (parsley, chives, etc.) so it looks pretty. Some salt and pepper to taste. Serve on the plank, blah, blah, blah, …

Pork Tenderloin with vaguely exotic spice rub

Ingredients:

  • 3 medium sized pork tenderloins
  • 3 Tbsp brown sugar
  • 1 Tbsp kosher salt
  • 1 Tbsp ground pepper
  • 1 Tbsp chilli powder
  • 1 Tbsp dried thyme
  • 1 Tbsp fennel seeds
  • 1 tsp paprika

Mash up the rub ingredients with a mortar and pestle. Work the rub into the tenderloins and let sit for an hour or two. Grill on a medium heat for approx. 20 min. Let rest before slicing – against the grain – and serve.

Blind Bananas

Ingredients:

  • 4 bananas – not too ripe
  • 4 Tbsp butter
  • 1/2 tsp cinnamon
  • 1/2 tsp allspice
  • 1/4 tsp ground cloves
  • 4 tsp brown sugar
  • 2 tsp dark rum
  • Juice of a lime
  • Ice cream
  • A few berries as a decoration

Melt butter in the saucepan, add spices, sugar, and rum. Heat on low, stir, and let thicken. Cut bananas lengthwise leaving the skin on. Brush half the thickened sauce on the bananas and place them, skin side up, on the barbecue for about two minutes. Flip them over and grill them, skin side down, for another two minutes. Remove from grill, slip the bananas out of their skins and serve with ice cream, some berries and the remaining sauce.

Note: that’s the original recipe. I used what I had on hand. Instead of cinnamon, allspice, and ground cloves I put 1/2 tsp of spice for mulched wine. Didn’t have the berries, too, but it was good, nevertheless. Also, 1 Tbsp of butter per 1 banana is little bit too much (or I should let it thicken little bit more than I did). Rum is never too much!