Tag Archives: software

Varnish weird error

Are you getting a weird error from varnish that you’re having trouble working out? Is it cryptically saying that there’s an issue with your host definition in your VCL?

Expected ID got ';'
 (program line 165), at
 ('input' Line 20 Pos 30)
 .first_byte_timeout = 120;
 -----------------------------#

You need to add a time unit to your timeout definitions — ‘s’ for seconds, ‘m’ for minutes.  Stupid cryptic error is dumbly cryptic. Grrr.
https://varnish-cache.org/lists/pipermail/varnish-bugs/2011-August/003983.html

Arduino Variable Types Explained

Here’s something for reference.
I can never find just quite the succinct reference to Arduino Variable types. Nowhere could i find a list of minimum and maximum values, the bits, and the memory used by each variable type.

Neither was there any clear definition of meaning of ‘unsigned’, which just means no plus or minus signs in this type – that is all numbers positive. This increases the highest number that can be stored in the same memory. (thank me in the comments).

Usage Variable type Bits Min value Max value Ram usage Comments
common boolean 8 TRUE FALSE 1 byte
common byte 8 0 255 1 byte
char 8 -128 127 1 byte  A single ‘character’ e.g. ‘a’ is a single char.  Represented by chr(65) or the binary: 01000001
word 16 0 65535 2 byte
common int 16 -32768 32767 2 byte
unsigned long 32 0 4,294,967,295 4 byte
common long 32 -2,147,483,648 2,147,483,647 4 byte
common float 32 -3.4028235E+38 3.4028235E+38 4 byte
The below types are only included for compatibility or further study.
redundant unsigned char 8 0 255  1 byte use byte instead
redundant unsigned int 16 0 65535  2 bytes use word instead
redundant double 32 -3.4028235E+38  3.4028235E+38  4 bytes use float instead
The below types are special types (see arduino.cc)
special string variable  1 byte + x An array of chars
(used for storing strings to modify)
special enum variable  N/A Like boolean but custom fixed set of values allowed instead of TRUE/FALSE.
special struct variable  N/A Public sub variables
(as if you’d made a public class)
special pointer  N/A I’ll be honest, I wasn’t sure the use of this one. Here for completeness though!
Source: https://learn.sparkfun.com/tutorials/data-types-in-arduino
Source: https://playground.arduino.cc/Code/DatatypePractices
Remark: “Unsigned” means no negative sign. This increases the range of positive numbers available.
Remark: Unsigned variables that exceed their capacity roll over back to zero. This could be useful to iterate through arrays of limited length

PPS If anyone can figure out how to properly format this table so it looks nice, with ‘center’ aligned text, please let me know wordpress was being frustrating!

(The formatting css is in the source, see the table tag)

Excel tip – adding two numbers where one is text

Just a quick tip as i couldn’t quickly find the answer in google.

If you have two cells of data and you want to add them when one might have text instead of a number, use the SUM function.

For instance

Class Section 1
QTY
Section 2
QTY
Totals
Robots 10,000 1,000 =sum(B2:C2)
=11,000
Humans 9,000,000,000 n/a =sum(B3:C3)
=9,000,000,000
Plants n/a n/a =sum(B4:C4)
=0

I also searched for: sum two values if isnumeric, excel add two numbers if text only include the non text and excel add two numbers if text.

Link

Just a super-quick post here.

If you’re looking for addons or plugins for Microsoft Outlook to help you organize your emails and extend the functionality of Outlook

(note Outlook is very extensible, as with all Microsoft Office applications you can write Visual Basic code for Applications to hook into it’s functions. Absaloutely fantastic for hacking excel as I have been doing for the last few weeks – my work needs to invest in a proper database program for sure *sigh*)

You’d do no better than looking here

Snapfiles Outlook Add-ons

http://www.snapfiles.com/freeware/comm/fwoutlook.html

 

They have addons that are useful – and unlike most of the sites on i’ve found so far – up to date and compatible with recent versions (2003+) of Outlook.

Hope this helps folks!

 

Windows Command Line Ping Replacement

So the windows version of ping is really stupid.

I was writing a batch script to mount up a network share that involved checking to ensure my NAS unit was turned on. The script is scheduled to run after the computer resumes.

What I found out is that the built in version of Ping.exe is terrible at telling you whether the ping has returned successfully or not. I was checking the ERRORLEVEL – %ERRORLEVEL% variable to find out what ping was returning. It should be 0 for success and 1 or higher for a failure.

What I found was, i was getting replies from the local pc (dunno why, leave me a comment if you know) and ping was reporting a success even though the correct pc failed to reply. The solution?
Replace the Windows ping.exe with Fping. It has a lot more options and appears – from some initial quick tests – to correctly report the errorlevel.

Kudos to Wouter Dhondt for developing it. I’ll update this post with any more news!

 

image Fping vs Ping errorlevel return values

Hancock, Books and photographs

Hancock

I went and saw this film with my brother and a couple of mates today. Was good, up to a point. Certainly, Will Smith is getting better – he appeared to play the part flawlessly, at a level I’ve not seen him act at before.

My one, slight moan, is that they included a brief, guarded and pointless sex scene. I guess, it *may* have been included to make a point, but it felt more like a box-tick exercise than anything else. Apart from that, an enjoyable way to while away a bit of time.

Books

Stack of booksBooks, I finished a Colin Forbes book this week. Awful. I had to put it down mid-way, and read a completely different book as a break before I picked up again. It felt so rough! And to think, I used to like his books. Fit his usual formula to a T, felt contrived, with a few instances of what PBEM RPG players call “SuperHero Syndrome“. In a Matthew Reily book, I can forgive SuperHero syndrome: he does it with such flair! However, it is not forgiveable in a Colin Forbes book. Which is a shame.

I started to read a Clive Cussler book “Dark Watch” a few weeks back. I got half way through, an OK book, till I got to a line of pure placement advertisement, which put me off completely and utterly. Here’s an extract. (For the copyright fiends out there, this is fair use!)

“Juan found a parking spot a few blocks from the court and spent the next two hours walking the neighborhood, sipping black coffee from a Starbucks. He felt he should have bought his coffee from a local vendor instead of an international franchise, but it had been months since he’d had a taste of his favourite brew. He made a mental note to contact the company’s Seattle headquarters and see if it was possible to buy their special equipment for the Oregon.” [Oregon is the wet-merc ship he captains.]

Oh dear. What an abysmal excuse for an advert. At the very least, it could have been subtle! Stopping at “it had been months..” would have been fine. I have stopped reading the book. I’ll finish it sometime, but not yet. When I’m not so irritated at that advert. At least on the web, it is generally fairly easy to spot, and ignore, them. A bit harder to when you’re engrossed in a story.

Photographs

I’ve been trying to use F-Spot on my laptop to manage photos. Unfortionately, it has a nasty habit of freezing my laptop totally, when I click “OK” on certain dialog boxes. Quite frustrating. So, another question for those reading, what image management software would you recommend ? It has to run nativly on Ubuntu Hardy, but apart from that, pick whatever you like (including web-software). I have a large collection of photos (my camera’s counter recently went over the 1,000 mark), which I want to tag and organise. An effective search function is a must, so that I can add relevant photos to my blogs from my collections.