As you probably already know, security researcher Dan Kaminsky (and his team I believe) recently reported a DNS vulnerability affecting most DNS servers world-wide. They have also released patches for all platforms before actually revealing details about the vulnerability. In fact, they are leaving people the time to upgrade their systems, before giving us any of the secret facts.
And it doesn't stop there! If you check out the Doxpara research site (at: http://www.doxpara.com), you will find an online DNS checker which will tell you whether your DNS server seems safe or not.
If you are like me your DNS requests might get routed to one of several DNS servers, so this can require several online "tests".
Some people seem to be having issues with ZoneAlarm (as reported by Nathan McFeters at ZDnet) but it seems workarounds are already available. So this really does seem minor to me.
Will this start to pave the way to responsible hack disclosures?
Friday, 11 July 2008
Thursday, 10 July 2008
Batch programming tip#07: Retrieving argument filesize
Imagine you are using a file as argument (this can also be %0 of course) and you would like to know the file's size in bytes.
This is an example of how to do this:
Using %~z0 retrieves the file size of the currently running batch which should be 164 (unless of course you have added in or removed extra line breaks, comments, etc.)
One reason to use file size would be, for instance, you might want a batch to once use a given configuration file, but then use another the next time, and then to switch back to the first the time after that. If these configuration files are definitely of different size, you can use file size to operate the swap.
Voilà!
Thoughts?
This is an example of how to do this:
@echo off
:action
echo File size of currently running batch file: %~z0
goto eof
:eof
echo Press a key to quit...
pause > NUL
goto blackhole
:blackhole
Using %~z0 retrieves the file size of the currently running batch which should be 164 (unless of course you have added in or removed extra line breaks, comments, etc.)
One reason to use file size would be, for instance, you might want a batch to once use a given configuration file, but then use another the next time, and then to switch back to the first the time after that. If these configuration files are definitely of different size, you can use file size to operate the swap.
Voilà!
Thoughts?
Labels:
%~z0,
batch,
file size,
NT,
programming
Wednesday, 9 July 2008
Are you ready for iPhone 3G?
Here it comes, the iPhone 3G is finally being launched in the remaining European countries!!
In Belgium, specific legislation means it cannot be sold exclusively.
But at a selling price of a whopping 525 to 615 euro (!), approximately 4 times the US price, will the Belgians be ready for it?
In Belgium, specific legislation means it cannot be sold exclusively.
But at a selling price of a whopping 525 to 615 euro (!), approximately 4 times the US price, will the Belgians be ready for it?
Tuesday, 8 July 2008
Blogger Quicklist - Making a blog "work"
Blogging - and bloggers - have got me thinking about how to make a blog 'work'. I have had several blogs, and although lots of energy, time and effort can ensure some readership it's very difficult to keep a blog going in the long-run.
So, here are a few things that seem important to me:
1. Use a main thread in your blog e.g. write about your work OR write about your private life OR write about a particular passion and anything related OR ... but don't mix them up in the same blog (or only do so rarely, e.g. explain you haven't posted for a week because you have been on holiday, that sort of thing);
2. Don't post just to post, if inspiration gets low, just let it go for a while
3. Choose a good blog title, only use your name if you are already a well-known blogger figure
4. Go crazy with labels, use lots of them
5. Use blogger's label list (and/or turn it into a label cloud)
6. Use the post options to automatically schedule post publication (for instance, it may be easier to write several posts at the week-end and schedule them to be published during the week) - this way users don't get overloaded with new posts to read, and you don't feel obligated to write more during the week.
7. Don't let posts get too lengthy
Well, there must be lots of other obvious guidelines which I didn't mention here. But I guess it's a start! I can't really talk about how to increase blog participation (e.g. comments, emails, etc.) as I have a very low participative rate on this blog. But one of the tricks is to ask questions every time you end a post like so:
What 'guidelines' do you follow to make your blog successful?
So, here are a few things that seem important to me:
1. Use a main thread in your blog e.g. write about your work OR write about your private life OR write about a particular passion and anything related OR ... but don't mix them up in the same blog (or only do so rarely, e.g. explain you haven't posted for a week because you have been on holiday, that sort of thing);
2. Don't post just to post, if inspiration gets low, just let it go for a while
3. Choose a good blog title, only use your name if you are already a well-known blogger figure
4. Go crazy with labels, use lots of them
5. Use blogger's label list (and/or turn it into a label cloud)
6. Use the post options to automatically schedule post publication (for instance, it may be easier to write several posts at the week-end and schedule them to be published during the week) - this way users don't get overloaded with new posts to read, and you don't feel obligated to write more during the week.
7. Don't let posts get too lengthy
Well, there must be lots of other obvious guidelines which I didn't mention here. But I guess it's a start! I can't really talk about how to increase blog participation (e.g. comments, emails, etc.) as I have a very low participative rate on this blog. But one of the tricks is to ask questions every time you end a post like so:
What 'guidelines' do you follow to make your blog successful?
Sunday, 6 July 2008
Batch programming tip#06: Getting the batch file path
Ok. Well, it's been a while since I posted anything to do with actual programming, and I have missed it. So here goes with the next batch programming trick planned: how to retrieve the batch file path. That is: the path where the batch file being run is located.
This is a dead easy variable: %~dp0. We'll get back to what this sequence actually means in a later post but you will notice how much it looks like the argument 0 (%0 or %~0 in this case) I mentioned in an earlier post. It's just had a couple of characters added in (dp).
So, now for a simple echo example:
This looks too simple to actually be of any use but actually using the current run path can be very handy if you store configuration or content files in the same directory as your batch file (or a subdirectory thereof)!
More about that soon.
Thoughts?
This is a dead easy variable: %~dp0. We'll get back to what this sequence actually means in a later post but you will notice how much it looks like the argument 0 (%0 or %~0 in this case) I mentioned in an earlier post. It's just had a couple of characters added in (dp).
So, now for a simple echo example:
@echo off
:action
echo Current batch run path: %~dp0
goto eof
:eof
echo Press a key to quit...
pause > NUL
goto blackhole
:blackhole
This looks too simple to actually be of any use but actually using the current run path can be very handy if you store configuration or content files in the same directory as your batch file (or a subdirectory thereof)!
More about that soon.
Thoughts?
Saturday, 5 July 2008
Increasing Flash searchability
One of the main concerns when building a website (blogs, wikis, ... included) is of course to make sure all data on it is readily available. Which basically means the search engines need to be able to crawl the data in a way that makes it possible to extract content and relevant keywords.
If you're using plain HTML for instance, this is pretty easy.
It does get more complicated if you're using Flash but that may be about to change.
The following article (dated: 2006) describes what you can do (or had to do in the past) to make sure your Flash-enabled website pages get (got) the correct (or increased) search rankings:
http://www.adobe.com/devnet/flash/articles/flash_searchability.html
However, there have been several reports this week that Google, Yahoo and Adobe are teaming up to make Flash (SWF) files easier to crawl in-depth - more like an HTML page crawl basically.
In eWeek's article, Bill Hunt (president of Global Strategies International) is quoted as saying:
This is a win-win-win situation where both the search engines and Adobe will benefit from an enhanced user experience (thus the third 'win'). And Adobe will subsequently be edging nearer to a position where it could claim to be more than a de facto standard for rich internet applications.
So, will this make the RIA era boom? And should Adobe Flash applications become an official web standard?
If you're using plain HTML for instance, this is pretty easy.
It does get more complicated if you're using Flash but that may be about to change.
The following article (dated: 2006) describes what you can do (or had to do in the past) to make sure your Flash-enabled website pages get (got) the correct (or increased) search rankings:
http://www.adobe.com/devnet/flash/articles/flash_searchability.html
However, there have been several reports this week that Google, Yahoo and Adobe are teaming up to make Flash (SWF) files easier to crawl in-depth - more like an HTML page crawl basically.
In eWeek's article, Bill Hunt (president of Global Strategies International) is quoted as saying:
[The most significant aspect of the announcement] "is that this is not a change the site owners have to implement but that Google, and soon Yahoo, have this baked into their crawl systems and can interact with the SWF format just as a visitor to the site would, allowing them to get deep into the content discovering links and content that have previously been hidden from search engines."
This is a win-win-win situation where both the search engines and Adobe will benefit from an enhanced user experience (thus the third 'win'). And Adobe will subsequently be edging nearer to a position where it could claim to be more than a de facto standard for rich internet applications.
So, will this make the RIA era boom? And should Adobe Flash applications become an official web standard?
Labels:
adobe,
crawl,
Flash,
google,
rich internet application,
search,
search engine,
swf,
yahoo
Browser Security
Ryan Naraine discussed a recent study about browser security in a recent article.
Before we start let's point out the following:
So we're really talking specifically about the browser applications and not the browsing experience as a whole.
I suspect Internet Explorer's surprisingly bad results are due to poor adoption of the browser's latest version IE7. And this will be linked to:
- people who can't upgrade to IE7 because their system requirements cannot be met (e.g. anyone running Win2000);
- people who won't upgrade to IE7 because they found it changes their browsing experience too much (e.g. too different from the user perspective: tabs, new menus, etc. and/or technical issues: breaks current web-based applications which need to be upgraded to ensure IE7 compatibility).
I must say of late Microsoft upgrades have entailed lots of extra unexpected technical work. Just think back to XP SP2 (a real pain in the neck). These new systems require security tweaking everytime - it's no wonder companys and users are slowly changing their ways and going for backward-compatible and standard compliant systems.
And it makes me wonder. Should large corporations be allowed to make application upgrades which will affect everyone actually developing anything for use with said application? Aren't systems today being designed to be so secure at the user's expense, making them difficult to use? Is it not actually counterproductive if users just get annoyed and frustrated with over-secure systems (esp. as these systems are still vulnerable to attacks anyway)?
Perhaps we should just turn to some form of mandatory training about the risks posed by accessing the Internet, how to reduce these risks and how to recognize certain types of attacks/infections, and how to check systems for known infections.
What do you think?
Before we start let's point out the following:
The entire report is a valuable read on the state of browser security but, as Brian Krebs points out, the conclusions should be considered conservative since it does not include information on vulnerable plugins (think Flash Player, Adobe Reader, Java, QuickTime, etc). Also, bear in mind that these numbers only represent Google users.
So we're really talking specifically about the browser applications and not the browsing experience as a whole.
We discovered that at most 83.3% of Firefox users, 65.3% of Safari users, 56.1% of Opera users, and 47.6% of Internet Explorer users were using the latest most secure browser version on any day between January 2007 to June 2008. For the latest version analysis of Safari, we only considered the date range Dec 2007 to June 2008, when Safari version 3 became widespread.
I suspect Internet Explorer's surprisingly bad results are due to poor adoption of the browser's latest version IE7. And this will be linked to:
- people who can't upgrade to IE7 because their system requirements cannot be met (e.g. anyone running Win2000);
- people who won't upgrade to IE7 because they found it changes their browsing experience too much (e.g. too different from the user perspective: tabs, new menus, etc. and/or technical issues: breaks current web-based applications which need to be upgraded to ensure IE7 compatibility).
I must say of late Microsoft upgrades have entailed lots of extra unexpected technical work. Just think back to XP SP2 (a real pain in the neck). These new systems require security tweaking everytime - it's no wonder companys and users are slowly changing their ways and going for backward-compatible and standard compliant systems.
And it makes me wonder. Should large corporations be allowed to make application upgrades which will affect everyone actually developing anything for use with said application? Aren't systems today being designed to be so secure at the user's expense, making them difficult to use? Is it not actually counterproductive if users just get annoyed and frustrated with over-secure systems (esp. as these systems are still vulnerable to attacks anyway)?
Perhaps we should just turn to some form of mandatory training about the risks posed by accessing the Internet, how to reduce these risks and how to recognize certain types of attacks/infections, and how to check systems for known infections.
What do you think?
Tuesday, 1 July 2008
Label cloud
I am probably centuries late on this one but I simply have to share.
I had never payed much attention but when I came across http://acedar.blogspot.com/ and saw the label cloud I just had to investigate.
It hardly took any effort at all, simply check out:
http://phy3blog.googlepages.com/Beta-Blogger-Label-Cloud.html
and "build" your own label cloud within minutes.
The best effect is achieved by simply leaving the labels in alphabetical order, this ensures a nice mix of larger/smaller lettering.
The beauty in the blogger widgets is you can change them (i.e. via the HTML code interface), and then still move them about (via the layout interface) without losing your own changes. Great!
I had never payed much attention but when I came across http://acedar.blogspot.com/ and saw the label cloud I just had to investigate.
It hardly took any effort at all, simply check out:
http://phy3blog.googlepages.com/Beta-Blogger-Label-Cloud.html
and "build" your own label cloud within minutes.
The best effect is achieved by simply leaving the labels in alphabetical order, this ensures a nice mix of larger/smaller lettering.
The beauty in the blogger widgets is you can change them (i.e. via the HTML code interface), and then still move them about (via the layout interface) without losing your own changes. Great!
Thursday, 19 June 2008
Firefox sets the World Record
I have been checking out the Firefox map of its World Record attempt at:
http://www.spreadfirefox.com/en-US/worldrecord
The map is obviously a pretty good indicator of technology acceptance in the various countries with North America and Western Europe hitting the top notches and Africa, South America, and Asia being less well served. I do feel it's a shame that the results aren't also computed in relation to the actual population of each country though.
For instance, France and Spain both downloaded more copies (well above 300,000) compared to Russia where "only" around 130,000 downloads occurred. Yet Russia appears dark red. And a country like Belgium appears in orange.
Let's compare some numbers to show where I am coming from.
Wikipedia tells us Russia's population in 2008 is around: 142,008,838 and we know from Firefox that 134,442, which brings us to 0.09% of the population.
The population of Belgium is around 10,000,000 and we know from Firefox that 69,760 downloads occurred over the 24-hour download period, which is about 0.7% of the population. So, although the map is a good indicator of the global distribution of downloads, it really does give as skewed vision on a per-country basis.
What also struck me was the huge discrepancy between Southern Ireland and the UK. At first sight, Ireland looks like it didn't support the SpreadFirefox initative all that much at all - it shows in pale orange and is hardly worth the notice on that map next to it's dark red neighbour.
Well, let's check it out.
Populations in the UK and Ireland are respectively estimated at around: 60,587,000 and 4,339,000. Firefox downloads reached 387,488 and 42,993 respectively.
The actual percentage of downloads reached: 0.6% in the UK but virtually 1.0% for the Republic of Ireland!
[EDIT: 2008-06-19]
So let's recap with our new numbers:
The colors show the exact opposite to what the true representation in these countries actually is!
[/EDIT]
One last thing caught my eye. Notice the difference between North and South Korea?
Any thoughts?
http://www.spreadfirefox.com/en-US/worldrecord
The map is obviously a pretty good indicator of technology acceptance in the various countries with North America and Western Europe hitting the top notches and Africa, South America, and Asia being less well served. I do feel it's a shame that the results aren't also computed in relation to the actual population of each country though.
For instance, France and Spain both downloaded more copies (well above 300,000) compared to Russia where "only" around 130,000 downloads occurred. Yet Russia appears dark red. And a country like Belgium appears in orange.
Let's compare some numbers to show where I am coming from.
Wikipedia tells us Russia's population in 2008 is around: 142,008,838 and we know from Firefox that 134,442, which brings us to 0.09% of the population.
The population of Belgium is around 10,000,000 and we know from Firefox that 69,760 downloads occurred over the 24-hour download period, which is about 0.7% of the population. So, although the map is a good indicator of the global distribution of downloads, it really does give as skewed vision on a per-country basis.
What also struck me was the huge discrepancy between Southern Ireland and the UK. At first sight, Ireland looks like it didn't support the SpreadFirefox initative all that much at all - it shows in pale orange and is hardly worth the notice on that map next to it's dark red neighbour.
Well, let's check it out.
Populations in the UK and Ireland are respectively estimated at around: 60,587,000 and 4,339,000. Firefox downloads reached 387,488 and 42,993 respectively.
The actual percentage of downloads reached: 0.6% in the UK but virtually 1.0% for the Republic of Ireland!
[EDIT: 2008-06-19]
So let's recap with our new numbers:
- UK, 0.6%, dark red
- Belgium, 0.7%, orange
- Ireland, 1.0%, light orange
The colors show the exact opposite to what the true representation in these countries actually is!
[/EDIT]
One last thing caught my eye. Notice the difference between North and South Korea?
Any thoughts?
Tuesday, 17 June 2008
Second Life take 1
Tony Karrer recently published a comprehensive list of Second Life Learning Videos.
After viewing three, curiosity got the better of me. So... I now have a Second Life account and have downloaded, installed and started (or almost) the program.
Only problem: my home PC doesn't meet the minimum requirements. I do only have 256 Mb of RAM. Ouch. Of course, it does date back to dinosaur era (i.e. ~2002), which explains why it's so outdated.
[EDIT: 2008-06-19]
I did try this again at home in the hopes it may have been a one-off, but no luck, it crashed again.
[/EDIT]
With a bit of luck, I shall be able to pursue this experiment over my lunch hour tomorrow! More news then...
After viewing three, curiosity got the better of me. So... I now have a Second Life account and have downloaded, installed and started (or almost) the program.
Only problem: my home PC doesn't meet the minimum requirements. I do only have 256 Mb of RAM. Ouch. Of course, it does date back to dinosaur era (i.e. ~2002), which explains why it's so outdated.
[EDIT: 2008-06-19]
I did try this again at home in the hopes it may have been a one-off, but no luck, it crashed again.
[/EDIT]
With a bit of luck, I shall be able to pursue this experiment over my lunch hour tomorrow! More news then...
Firefox Download Day
Well, Firefox Download Day started about 4 hours ago (19.00 here in Belgium).
It looks like there might have been a slight glitch in the system as when I first followed the link, it simply gave me the usual RC3 version.
Now it links to a "The Browser That Has It All" page, with the final 3.0 release.
http://www.mozilla.com/en-US/firefox/?p=downloadday
Thoughts?
It looks like there might have been a slight glitch in the system as when I first followed the link, it simply gave me the usual RC3 version.
Now it links to a "The Browser That Has It All" page, with the final 3.0 release.
http://www.mozilla.com/en-US/firefox/?p=downloadday
Thoughts?
Tuesday, 10 June 2008
Google's favicon
Google's favicon needs a make-over! The favicon is the little icon that shows in the address bar and also your favourites, so it's important in getting people to identify company image.
I gather they have already explored an incredible number of possible icons and are now making a public request for more ideas. So, you can now submit your own home-grown Google favicon by following the link: http://www.google.com/faviconideas/
Of course, I couldn't resist building my own 16 x 16 proposal!
Simple version:

This actually looks less than 16 by 16px because there's a transparent background border on the left side of the pic.
Full version:

This looks square because... it is.
EDIT [June 11, 2008] - Done.
Thoughts, advice, opinions?
I gather they have already explored an incredible number of possible icons and are now making a public request for more ideas. So, you can now submit your own home-grown Google favicon by following the link: http://www.google.com/faviconideas/
Of course, I couldn't resist building my own 16 x 16 proposal!
Simple version:

This actually looks less than 16 by 16px because there's a transparent background border on the left side of the pic.
Full version:

This looks square because... it is.
I hope to be submitting these in the near future, as soon as I get my head around their terms of service.
EDIT [June 11, 2008] - Done.
Thoughts, advice, opinions?
Labels:
google favicon
Sunday, 8 June 2008
Object-oriented form rendering using PHP, part 2
There is one fundamental problem with my previous analysis of automatic form generation (using PHP).
Which is: displaying the JS in the header is a really cool idea in a world where all forms are created on full HTML pages: with html, head, body tags. The truth of the matter is though that you often, probably mostly, work with PHP 'chunks' which you then include in the higher level page.
For instance, I am currently working on a login form which I would like to appear on several different pages. Displaying JS in the header using the displayJS() function becomes impossible because the include (using require_once, include, ...) happens when you are already in the 'body' of the resulting page.
So, onto plan B. I have now changed my original idea to a more lightweight technique. On each 'input' you declare, you can add one or more client-side 'rules' which will take effect when the onchange event occurs (i.e. whenever the user validates input for the field). In other terms, whenever the user enters information into the field, it's trimmed, etc. using Javascript.
Once the form gets submitted, the onsubmit event triggered by the browser, will only make sure required fields are present, required being also used in the sense non-empty.
Right, so that's the theory. All it needs now is putting into practice.
Thoughts?
// in the page header
$form->displayJS();
// ... lots of useful stuff
// in the page body
$form->display();
// ... other useful stuff
Which is: displaying the JS in the header is a really cool idea in a world where all forms are created on full HTML pages: with html, head, body tags. The truth of the matter is though that you often, probably mostly, work with PHP 'chunks' which you then include in the higher level page.
For instance, I am currently working on a login form which I would like to appear on several different pages. Displaying JS in the header using the displayJS() function becomes impossible because the include (using require_once, include, ...) happens when you are already in the 'body' of the resulting page.
<html>
<head>
<title>An example</title>
</head>
<body>
<?php require_once('login/login.php'); ?>
</body>
</html>
So, onto plan B. I have now changed my original idea to a more lightweight technique. On each 'input' you declare, you can add one or more client-side 'rules' which will take effect when the onchange event occurs (i.e. whenever the user validates input for the field). In other terms, whenever the user enters information into the field, it's trimmed, etc. using Javascript.
Once the form gets submitted, the onsubmit event triggered by the browser, will only make sure required fields are present, required being also used in the sense non-empty.
Right, so that's the theory. All it needs now is putting into practice.
Thoughts?
Google Webmaster Tools
As you probably guessed the use of the words 'sex' and 'drugs' in my previous post title were not quite as innocent as I tried to make out. I have always wondered the effect using these words could have on a blog's popularity and have now decided to experiment.
Today, time for the grand news! I decide to connect to my Google Analytics account, expecting the zillions of visits I so truely deserve for this pathetic attempt, and low and behold... nothing has changed. Same flimsy statistics.
But my eye did catch on to one thing: Google is now offering a set of tools for webmasters. They are absolutely free, easy to 'plug into' using a simple meta tag in your page headers, and can be added to your iGoogle page.
For instance, you can list top search queries, crawl errors, problems with content (meta tags, ...) and so on and so forth. You can also submit a site map to make sure Googlebot visits all the pages you want referenced.
Other interesting fact, the last time Googlebot successfully crawled my index page was May 22. So my dismay is now tempered by the fact that there is still a tiny gleam of hope for the sex and drugs effect.
Any ideas for better words?
Today, time for the grand news! I decide to connect to my Google Analytics account, expecting the zillions of visits I so truely deserve for this pathetic attempt, and low and behold... nothing has changed. Same flimsy statistics.
But my eye did catch on to one thing: Google is now offering a set of tools for webmasters. They are absolutely free, easy to 'plug into' using a simple meta tag in your page headers, and can be added to your iGoogle page.
For instance, you can list top search queries, crawl errors, problems with content (meta tags, ...) and so on and so forth. You can also submit a site map to make sure Googlebot visits all the pages you want referenced.
Other interesting fact, the last time Googlebot successfully crawled my index page was May 22. So my dismay is now tempered by the fact that there is still a tiny gleam of hope for the sex and drugs effect.
Any ideas for better words?
Labels:
google
Friday, 6 June 2008
Sex, drugs and malbolge
This is probably the most useless piece of information E-VER but you just gotta love it! Pointed out by one of my colleagues today!
Ever heard of malebolge, the eighth circle of Hell? Sounds pretty horrendous, right? Well, some chap called Ben Olmstead, invented the programming language to go with it: Malbolge.
Prepare, for the end is nigh.
Example: guess what the following does.
This actually displays... Hello World.
Uh oh. Ben, you are either crazy or simply have a great sense of humour!!
http://www.antwon.com/other/malbolge/malbolge.txt
Thoughts?
Ever heard of malebolge, the eighth circle of Hell? Sounds pretty horrendous, right? Well, some chap called Ben Olmstead, invented the programming language to go with it: Malbolge.
Prepare, for the end is nigh.
Example: guess what the following does.
(=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk**
hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98\6543W10/.R,+O<
This actually displays... Hello World.
Uh oh. Ben, you are either crazy or simply have a great sense of humour!!
http://www.antwon.com/other/malbolge/malbolge.txt
Thoughts?
Labels:
programming
Wednesday, 4 June 2008
Object-oriented form rendering using PHP, part 1
Well, hi again.
I have had to major annoyances these past two weeks:
- clearing my flat (those who know me well, know this is a endless task);
- and studying for a Dutch exam, which is today! So, there is lots of touching wood going on around here.
[UPDATE: the exam wasn't that difficult. I think I have made it to the next module. Actual results next Wednesday!]
The good news is I actually found my IT diploma certificate!
Other than that, I have continued my personal website, and also started working on anxcity, which I have already renamed zencity because we really want to focus on the aim rather than the "problem".
I know I shall be needing quite a few forms (especially for administration), so I have started developing a form publisher using object oriented PHP. The form and input nodes are ready, but I hope to be adding client-side and server-side rules shortly.
The general idea is (I haven't checked syntax so bare with me):
And of course ultimately:
There are thus to separate types of rules:
- JS client-side rules (the usual: trim(), length()>0, etc.) that get tested before the HTTP request actually gets (or doesn't get) sent.
- PHP server-side rules (non-duplicate identifier, etc.) tested on the server-side once the HTTP request gets through.
Anyhow, once the personal website is up I shall be able to share more with you about the evolution of the project.
Any thoughts for now?
I have had to major annoyances these past two weeks:
- clearing my flat (those who know me well, know this is a endless task);
- and studying for a Dutch exam, which is today! So, there is lots of touching wood going on around here.
[UPDATE: the exam wasn't that difficult. I think I have made it to the next module. Actual results next Wednesday!]
The good news is I actually found my IT diploma certificate!
Other than that, I have continued my personal website, and also started working on anxcity, which I have already renamed zencity because we really want to focus on the aim rather than the "problem".
I know I shall be needing quite a few forms (especially for administration), so I have started developing a form publisher using object oriented PHP. The form and input nodes are ready, but I hope to be adding client-side and server-side rules shortly.
The general idea is (I haven't checked syntax so bare with me):
$form=new Form();
$name=new Text('name',40); // 40 is the size
$comment=new TextArea('comment',4,5);
$form->add($name);
$form->add($comment);
$form->display();
And of course ultimately:
// in the HTML head or before
$form=new Form();
$name=new Text('name',40); // 40 is the size
$name->addPreSubmitJS('trim');
$name->addOnSubmitJS('min-length',0);
$comment=new TextArea('comment',4,5);
$comment->addPreSubmitJS('trim');
$comment->addOnSubmitJS('min-length',0);
...
...
$form->add($name);
$form->add($comment);
// in the HTML head
$form->displayJS();
// in the HTML body
$form->display();
// once the form is actually submitted to server,
// apply server side rules
There are thus to separate types of rules:
- JS client-side rules (the usual: trim(), length()>0, etc.) that get tested before the HTTP request actually gets (or doesn't get) sent.
- PHP server-side rules (non-duplicate identifier, etc.) tested on the server-side once the HTTP request gets through.
Anyhow, once the personal website is up I shall be able to share more with you about the evolution of the project.
Any thoughts for now?
Tuesday, 20 May 2008
I have been thinking
[Note: the thinking process has not brought on fits, high fever, sweating, or any other adverse effects until now. I should engage in this activity more often perhaps?]
I don't really like the idea of complicating life with lots of useless rules but I am starting to believe that 'good practices' really also do apply to batch files as simple as they may be, as they apply to more or less anything when it comes to sharing, reusing some nifty piece of code, or deciding to chuck it for now.
So, I may be coming up with some more generalist posts on this issue, although it may quickly get superseded by other pressing issues I would like to share with you.
One of these (and this is the true reason behind my short absence from the blogosphere) is that I am working on a personal website.
Why?
Well, firstly, I would like to provide a platform to download code which I have posted to this blog (for you ;-)).
Secondly, I would like to actually start working on a project of mine that's been simmering for some time: Anxcity, a website for English and French speaking anxiety disorder sufferers. And, hopefully, I can tag Dutch onto that too!
As you probably know anxiety disorders affect up to 18% of adult population at one time in their lives (according to U.S statistics). Which means about one in five people suffer from some form of anxiety. Which in turn means you are either a sufferer yourself or are close to someone who is, has been or will be.
So, let's recap some of the most common disorders: Generalized Anxiety Disorder (GAD), Obsessive-Compulsive Disorder (OCD), Panic Disorder (PD), Social Anxiety Disorder, Agoraphobia, Impulse Phobia, Specific Phobias, Post Traumatic Stress Disorder (PTSD) and ... I have probably forgotten some.
For most people their disorders are only slight and therefore hardly debilitating, but for others anxiety plays a major, even central, role in their lives, preventing them from doing the most trivial things: food and clothes shopping, working, going out with friends or family, visiting places, traveling, ... you name it.
Of course, at this stage you have already betted a month's wages that I myself am a sufferer, and you were silly not to bet two :p. I have Panic Disorder with Agoraphobia and Social Anxiety Disorder. And finding 'help' has been quite a challenge by itself! The internet, with its vast pool of information and links and references and addresses, wasn't able to provide the answers I was looking for. Yup! Incredible but true. Things are slowly changing and I would like to help bring on that change. That is what the Anxcity project is all about: bringing on awareness, understanding and a common forum for sufferers to share experiences, and stories. And more importantly, a place to share answers to the most important question: where to get help.
So, that's what this project is about. And I hope to be getting it running shortly. Any suggestions, ideas, comments, questions, ... are welcome.
Just drop me a line at: elinor [DOT] hurst [AT] gmail [DOT] com.
Thoughts?
I don't really like the idea of complicating life with lots of useless rules but I am starting to believe that 'good practices' really also do apply to batch files as simple as they may be, as they apply to more or less anything when it comes to sharing, reusing some nifty piece of code, or deciding to chuck it for now.
So, I may be coming up with some more generalist posts on this issue, although it may quickly get superseded by other pressing issues I would like to share with you.
One of these (and this is the true reason behind my short absence from the blogosphere) is that I am working on a personal website.
Why?
Well, firstly, I would like to provide a platform to download code which I have posted to this blog (for you ;-)).
Secondly, I would like to actually start working on a project of mine that's been simmering for some time: Anxcity, a website for English and French speaking anxiety disorder sufferers. And, hopefully, I can tag Dutch onto that too!
As you probably know anxiety disorders affect up to 18% of adult population at one time in their lives (according to U.S statistics). Which means about one in five people suffer from some form of anxiety. Which in turn means you are either a sufferer yourself or are close to someone who is, has been or will be.
So, let's recap some of the most common disorders: Generalized Anxiety Disorder (GAD), Obsessive-Compulsive Disorder (OCD), Panic Disorder (PD), Social Anxiety Disorder, Agoraphobia, Impulse Phobia, Specific Phobias, Post Traumatic Stress Disorder (PTSD) and ... I have probably forgotten some.
For most people their disorders are only slight and therefore hardly debilitating, but for others anxiety plays a major, even central, role in their lives, preventing them from doing the most trivial things: food and clothes shopping, working, going out with friends or family, visiting places, traveling, ... you name it.
Of course, at this stage you have already betted a month's wages that I myself am a sufferer, and you were silly not to bet two :p. I have Panic Disorder with Agoraphobia and Social Anxiety Disorder. And finding 'help' has been quite a challenge by itself! The internet, with its vast pool of information and links and references and addresses, wasn't able to provide the answers I was looking for. Yup! Incredible but true. Things are slowly changing and I would like to help bring on that change. That is what the Anxcity project is all about: bringing on awareness, understanding and a common forum for sufferers to share experiences, and stories. And more importantly, a place to share answers to the most important question: where to get help.
So, that's what this project is about. And I hope to be getting it running shortly. Any suggestions, ideas, comments, questions, ... are welcome.
Just drop me a line at: elinor [DOT] hurst [AT] gmail [DOT] com.
Thoughts?
Labels:
anxcity
How to clear the log file
Now, there is one important issue we didn't cover in our previous post about logs: how to clear the log when it starts taking up too much space.
Probably the simplest way to do this is to redirect type NUL to your log file, as follows:
That's it! You will find your_log.log file size drops back to 0 once you have called this command.
Thoughts?
Probably the simplest way to do this is to redirect type NUL to your log file, as follows:
type NUL > your_log.log
That's it! You will find your_log.log file size drops back to 0 once you have called this command.
Thoughts?
Labels:
batch,
NT,
programming
Monday, 19 May 2008
Using CON... or not
Hi folks. I am back from the wilderness of, well, my inner-self I guess.
And here with another tip: using CON or not.
When you are programming a batch file, it's usually pretty useful to get the output to show on screen. Why? Well, simply because it saves you the trouble of finding and opening a potential log file just to read some silly message about a file not being found, or some syntax error for instance.
So, let's start from the top.
1. How do I redirect output from the console to a logfile?
Here are perhaps the more useful redirection techniques.
This will redirect the command echo Hello World to the hello.txt file (which is created in the directory where the batch file is located).
You can immediately see the way to turn this into a logging functionality:
The poor thing about this is, if you run the batch twice consecutively you will loose the first output. The > is in effect making sure the file is rewritten completely. If you want to append to a file, simply use >>.
Great! Now we are actually adding to the log as we go along. The beauty in this is that if the file doesn't already exist it's automatically created (in the same way as when you use the simple > redirect).
So, all is cool here except echo is a pretty boring command. So let's liven things up a little. First we will copy hello.txt to hello1.txt, then we will remove directory hello.txt (of course, we will assume there is no hello.txt directory on your system, at least please make sure you check for this! - this will fail hello.txt not being a directory).
With these more "complex" commands you can distinguish standard output (numbered 1) from error output (numbered 2). So you can actually redirect standard output to one file, and error output to the console for instance.
Using this example you can see how adding 2>&1 after the redirect will make sure both standard and error output are redirected to file. Otherwise error output will show on screen (first rmdir).
2. Dynamically choosing where to redirect to
Now, let's say in certain cases you want to redirect output to screen but in other cases (say your batch is being called from within another script) you would rather use a file.
You can do this using CON.
If you just launch the batch file, all the output will show up on console (because no %1 argument has been provided).
If you launch the batch via a call as follows, however:
The output will get sent to my_second_log.log. Note that on top of that we can avoid pausing the process 'for nothing' by using the if not "%out%"=="CON" goto blackhole condition in :eof. Neat, don't you think?
I have never actually seen a redirection based on anything else but a "on-a-command" basis i.e. how to redirect output for the whole current process. Have you? If so, drop me a line, I would love to know how to do this, if possible!
Another post will be coming up shortly. Just a few thoughts I would like to share.
And here with another tip: using CON or not.
When you are programming a batch file, it's usually pretty useful to get the output to show on screen. Why? Well, simply because it saves you the trouble of finding and opening a potential log file just to read some silly message about a file not being found, or some syntax error for instance.
So, let's start from the top.
1. How do I redirect output from the console to a logfile?
Here are perhaps the more useful redirection techniques.
@echo off
echo Hello World > hello.txt
echo Press any key to quit...
pause > NUL
This will redirect the command echo Hello World to the hello.txt file (which is created in the directory where the batch file is located).
You can immediately see the way to turn this into a logging functionality:
@echo off
echo Something happened > my_log.log
echo Press any key to quit...
pause > NUL
The poor thing about this is, if you run the batch twice consecutively you will loose the first output. The > is in effect making sure the file is rewritten completely. If you want to append to a file, simply use >>.
@echo off
echo Something else happened >> my_log.log
echo Press any key to quit...
pause > NUL
Great! Now we are actually adding to the log as we go along. The beauty in this is that if the file doesn't already exist it's automatically created (in the same way as when you use the simple > redirect).
So, all is cool here except echo is a pretty boring command. So let's liven things up a little. First we will copy hello.txt to hello1.txt, then we will remove directory hello.txt (of course, we will assume there is no hello.txt directory on your system, at least please make sure you check for this! - this will fail hello.txt not being a directory).
With these more "complex" commands you can distinguish standard output (numbered 1) from error output (numbered 2). So you can actually redirect standard output to one file, and error output to the console for instance.
@echo off
echo Before copy >> my_log.log
copy hello.txt hello1.txt >> my_log.log 2>&1
echo Before rmdir 1 >> my_log.log
rmdir hello.txt >> my_log.log
echo Before rmdir 2 >> my_log.log
rmdir hello.txt >> my_log.log 2>&1
echo Press any key to quit...
pause > NUL
Using this example you can see how adding 2>&1 after the redirect will make sure both standard and error output are redirected to file. Otherwise error output will show on screen (first rmdir).
2. Dynamically choosing where to redirect to
Now, let's say in certain cases you want to redirect output to screen but in other cases (say your batch is being called from within another script) you would rather use a file.
You can do this using CON.
@echo off
:init_vars
set out=CON
if not "%1"=="" set out="%1"
goto do_stuff
:do_stuff
echo Copying hello.txt >> %out%
copy hello.txt hello1.txt >> %out% 2>&1
echo Removing directory hello.txt >> %out%
rmdir hello.txt >> %out% 2>&1
goto eof
:eof
if not "%out%"=="CON" goto blackhole
echo Press any key to quit...
pause > NUL
goto blackhole
:blackhole
If you just launch the batch file, all the output will show up on console (because no %1 argument has been provided).
If you launch the batch via a call as follows, however:
@echo off
redirect5 my_second_log.log
The output will get sent to my_second_log.log. Note that on top of that we can avoid pausing the process 'for nothing' by using the if not "%out%"=="CON" goto blackhole condition in :eof. Neat, don't you think?
I have never actually seen a redirection based on anything else but a "on-a-command" basis i.e. how to redirect output for the whole current process. Have you? If so, drop me a line, I would love to know how to do this, if possible!
Another post will be coming up shortly. Just a few thoughts I would like to share.
Labels:
batch,
NT,
programming
Subscribe to:
Posts (Atom)

