ncyoung.com

Update: This part of my website is an archive of old content. Links may be broken, etc. home

You are here: Top->Programming





subcategories

other barcamp misc

A few other things I realized or had re-affirmed at or as a result of barcamp:

- agile programming is _so_ much about having good tests
- it's such a crucial skill to walk the line between creativity and practicality
- behind every amazing project are amazing people

beginner's LISP

Get windows emacs here. (Click emacs-21.3-bin-i386.tar.gz)

If you've never used emacs before, choose "tutorial" from the help menu.

Then walk through this lisp tutorial.

It's fun!

selecting a max of a count

I was looking for a way to layer aggregate functions in SQL, and the only way I could find to do it was with sub-selects.

I wanted to group my data by unique values in a column, count the members of each group, then return count for the group with the most members.

I ended up doing a select for the grouping and counting, then nesting that inside the "from" clause of a query that pulled out the max.

To make things just slightly more complicated, I was grouping and counting number of rows per day based on row timestamps, so the sub select has simple date arithmetic in it.

select
max(ct) as max
from
(
select
count(*) as ct,
DATE_FORMAT(visitTime,'%Y-%m-%e') as dt
from
log_userLog
group by
DATE_FORMAT(visitTime,'%Y-%m-%e')
) as tempTable

new design patterns

patterns:
- model view control freak (thanks Elijah)
- fuseblown
- italian entre
- inversion of intelligence
- spaghetti factory

practices:
- unintelligable naming
- arbitrary entanglement
- hidden dependancies
- redundant comments
- extreme inefficiency

how to ask a good question

ESR's essay: how to write questions the smart way is pretty awesome. I kind of hate the tone, which would make me retitle the essay to "how to ask a cool hacker elite a question when you are probably a worthless fool".

But as usual with Raymond, if you can get past the tone the content is excellent. He describes very methodically how to pick the right time and place to ask, and how to determine and include the right level of detail.

my fight against r****r spam

My r3f3rer boxes have been so filled with spam that I'm just about to give them up completely.

I'm giving two approaches a try. First, I've replaced the text of the headings with images, so any bots searching for "r3c3n7 r3f3r3rs" or "t0p r3f3r3rs" won't find my pages.

Second I've made it very very easy for me to comb my logs for unwanted entries, one click removes all mention of them and prevents them from ever showing up again.

I'll see if the combination makes it manageable, otherwise away they go.

Update!!

I lost!!! I removed the referer box from my site. I also changed my comments to require my approval before going live. Tragedy of the commons and all that.

using ssh tunnelling to create a VPN

The ssh protocol supports tunnelling, in which an open ssh connection can be used to encrypt and transfer all kinds of network traffic from one end of the ssh connection to the other.

If I can open an ssh connection to a machine inside a firewall, I can use it to do a wide variety of tasks from the perspective of that machine. My ssh client watches a local port, and requests to that port are sent through the ssh connection and sent to a server/port from the machine the ssh server is on. The mapping of local port to remote port is specified when you start the ssh connection.

A simple example would be to create a way to access a web server inside the firewall. Say the web server inside the firewall is called grover. I can't see it but the machine I'm connecting to inside the firewall can. Call that machine bird. If I start a ssh connection with the -L option like so:

ssh -L bird 8080:grover:80

The parts are:

ssh -L address-of-server localPort:remoteHost:remotePort

And the result is that local requests to 127.0.0.1:8080 will have the same results as a request to grover issued from bird on port 80.

Here's a document that describes doing the same thing in order to tunnel cvs through ssh to provide a secure transport.

How To Use CVS pserver with SSH

QA haiku

type a line of code
my mind is reaching around
what can go wrong here?

logo

I learned logo when I was a kid, and I forgot how much fun it is.

Here's an applet to do logo:

Here's a tutorial

and a bunch of outrageous samples

Now if I could just find a little logo turtle I could put on my keychain and program from my palm pilot...

k

Just discovered the k programming language. Read some code and yes it is ugly. I itch to learn it, yet can't imagine how I can find an excuse to devote some time to it. Such is life.

some k code
introduction from kuro5hin