CAT | Uncategorized
I’ve done this to a few people – it works well if you are with a fairly computer illiterate person on a windows computer. If they leave the room for a moment, don’t frape them – that’s frankly old and boring, do this instead:
Open a command prompt (run->cmd).
Type the following:
color 97
help for
Then press alt+enter. This will give a full screen white on blue gibberish messge (or appear that way and first glance) – then sit back and wait for the horror as they “realise” their computer has got a BSOD. Most people know enough about them to recognise them and know theyre bad, but not enough to be able to analyse the kernel dump messages.
No tags
Introduction
Barely days after writing the first compile time hashing post, I needed to use the information in it. As I said at the time it’s ugly, and the Boost license raises some questions for its use in all locations, so I developed a better solution as a separate tool, giving the much nicer overall syntax of:
#include "file_ext.cth"
switch (Hash(szInputString))
{
case __H(hello):
// Do something
case __H(there):
// Something else
default:
// Other
}
No tags
This is something that I have been interested in for a while. As people may know, in C++ you can’t do:
switch (szInputString)
{
case "hello":
// Do something
case "there":
// Something else
default:
// Other
}
This has always seemed quite an arbitrary limitation to me, especially given that it would not be hard – all you need is a standard hash function to convert the strings to unique numbers in both code and the compiler. (more…)
No tags
5
Even more distance check optimisations – Updated
3 Comments · Posted by Y_Less in Uncategorized
Okay, since my last post on this topic I have been doing more work in this area and have further refined my codes. Basically, I made the realisation that if you have two static items and want the distance to both from a point, you don’t need to calculate them both. If the two points are always static (or move infrequently) then you can easilly store the distance between them statically (or, rather, you can store a value which is a function of the distance between them). If you know the distance from the point to the first item, and the distance between the items, it is very easy to get the distance to the second item.
(more…)
No tags
Pythagoras’ rule is used to calculate the distance between two points in space (in any number of dimensions). In a lot of use cases in computing a very large number of points are compared at once, leading to many repeated applications of pythagoras. The computational compexity of every one of these calculations can be reduced by a simple rearrangement to get pre-computed per-point constants. This method reduces both temporary variables and complex operations form every pair of points, at an expense of additional calculations for every individual point (usually a good trade off except in very small sets).
I’ve never seen this detailed anywhere else, though it likely has been, so I’m going over it here as a semi-official location.
(more…)
No tags
During the course of my EngD I have started using LaTeX for writing papers and documents (technically I use MikTeX, but that’s just because I’m on Windows). It’s a bit tricky to get used to, especially as it does some things in an odd way, so I’ve written a handy little script to automate everything.
(more…)
No tags
http://www.el-mo.org/ has just been released – the latest site in the rapidly expanding (or not) y-less.com network. It’s just a basic homepage for my friend’s baby and entirely unmaintained – it was just made after a chat with him.
No tags
I have unofficially unveiled yavascript.org, by that I mean it’s on-line but this is the first public mention of it. It is fairly basic at the moment but has all the important information relating to the first version of my yavascript compiler and development system. So yeah, head on over and check it out, download and try out the tool and, if you’re so inclined, read my report on its development:
javascript · release · Site · website · yavascript · yavascript.org
Recently I saw a question on a board I visit asking about how to make tooltips in Javascript, now I am a big JS fan, having spent a lot of time writing yavascript to aid in it’s development, but it’s a last resort – if you can’t do something any other way, use Javascript. Although doing things such as tooltips without Javascript is admittedly hard and people may not even realise it’s possible – it is, so I did:
Example 1 – CSS tooltips:
http://yavascript.org/css/tooltip.html
Note: CAN be dodgy in IE6 if you don’t make the offset big enough to appear under the link.
Example 2 – CSS lightbox:
http://yavascript.org/css/lightbox.html
Note: Currently only works in Firefox 3.
css · html · javascript · proof-of-concept
Introduction
One of the things added to the yavascript compiler, but not completed by the time I had to hand the project in to uni, was a debug mode. Because the compiler reads all the code in syntactically it can output it in whatever form it likes, including an experimental full debug mode. Basically your code goes from:
a += /search/i;
To:
$Y._addAss( /* target */ $Y._ref( /* name */ 'a', /* original code */ 'a', /* original line */ 42, /* original file */ 'my_code.js'), /* expression */ $Y._regex( /* pattern */ 'search', /* modifiers */ 'i', /* original code */ '/search/i', /* original line */ 43, /* original file */ 'my_code.js'), /* original code */ 'a +=\n\t/search/i;', /* original line */ 42, /* original file */ 'my_code.js');
The obvious question is WHY? But if you examine this code carefully you will see that it makes run-time debugging information a snap to collect and use to find problems.
(more…)
No tags
