r3dux.org

A number-pimping side project from the valleys in *NEW* upside-down flavour.

  • Home
  • ABOUT
  • OLD SITE
  • SEARCH
  • FEEDBACK

The Longcut – Holy Funk

r3dux | January 20, 2011

The Longcut - A Call And Response

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

I fired up Tiger Woods 07 the other day on the 360 (yes, that old!) because I hadn’t played any golf games for ages, and I’ve been really enjoying it! Even got a double-eagle (which I thought was more correctly termed an albatross) from about 190+ yards… Anyways, this song is in the EA Trax in the game, and I’d forgotten all about it. No more!

Awesome, awesome tune. Makes me feel all psyched up to work and get some good things done =D

Comments
No Comments »
Categories
Gaming, Music
Tags
A Call and Response, Golf, Holy Funk, The Longcut, Tiger Woods
Comments rss Comments rss
Trackback Trackback

The Illustrated Guide to a Ph.D

r3dux | January 19, 2011
Imagine a circle that contains all of human knowledge:
Ph.D Knowledge 1

By the time you finish elementary school, you know a little:
Ph.D Knowledge 2

By the time you finish high school, you know a bit more:
Ph.D Knowledge 3

With a bachelor’s degree, you gain a specialty:
Ph.D Knowledge 4

A master’s degree deepens that specialty:
Ph.D Knowledge 5

Reading research papers takes you to the edge of human knowledge:
Ph.D Knowledge 6

Once you’re at the boundary, you focus:
Ph.D Knowledge 7

You push at the boundary for a few years:
Ph.D Knowledge 8

Until one day, the boundary gives way:
Ph.D Knowledge 9

And, that dent you’ve made is called a Ph.D.:
Ph.D Knowledge 10

Of course, the world looks different to you now:
Ph.D Knowledge 11

So, don’t forget the bigger picture:
Ph.D Knowledge 12

Keep pushing!

Source: The Illustrated Guide to a Ph.D by Matt Might.

Comments
No Comments »
Categories
Imagery, Life
Tags
Knowledge, Matt Might, Ph.D
Comments rss Comments rss
Trackback Trackback

How to: Use mod_rewrite to stop hotlinking in Apache

r3dux | January 17, 2011

If you find that people are hotlinking to images on your site, and assuming you have mod_rewrite enabled and working, then just add the following to your root level (i.e. /var/www or such) .htaccess file to cut that crazyness right out:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?the-name-of-your-site\.the-top-level-domain-of-your-site/.*$ [NC,L]
RewriteRule ^.*\.(bmp|tif|gif|jpg|jpe?g|png)$ - [F]

So, for example, on this site, I’m using:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?r3dux\.org/.*$ [NC,L]
RewriteRule ^.*\.(bmp|tif|gif|jpg|jpe?g|png)$ - [F]

I’m just returning a [F] (forbidden) message to the hotlinking web server (so they don’t get an image returned to them), but you can always send them alternate images if you’re feeling vindictive… In fact, there’s lots of neat stuff you can do with mod_rewrite =D

P.S. For a full list of rewrite flags (i.e. [R,L,NC] etc.) and what they do, try this.,

Comments
No Comments »
Categories
Coding, Site
Tags
apache, hotlink, hotlinking, inline-link, mod_rewrite
Comments rss Comments rss
Trackback Trackback

NASA Suck at PR – But Reid Gower Doesn’t

r3dux | January 16, 2011

…so he made this.

YouTube Preview Image

Truly beautiful.

Comments
No Comments »
Categories
Life
Tags
Beginnings, Carl Sagan, Exploration, NASA, PR, Space
Comments rss Comments rss
Trackback Trackback

A Simple C++/SDL_Net Chat Server & Client

r3dux | January 14, 2011

Update – Nov 2011: I’ve refactored this code into something significantly easier to work with, modify and extend – so you should probably try this instead: http://r3dux.org/2011/11/a-simple-csdl_net-chat-server-client-rewritten/.


I was due to be teaching some network programming in the new term, so I thought I’d try to find the simplest library for cross-platform socket programming and knock up some examples that I could teach from. The trouble is, there are lots of different socket libraries… Lots and lots. So I did a bit of investigating and came up with the following:

Library Good Points Bad Points
Boost ASIO
  • The real deal – a world-class, well documented socket library
  • Comprehensive – you can do absolutely anything with it
  • More complicated than I’d like for the level I’m teaching at – I’m not convinced they’ll get it
  • You need to include the boost library in each project, which makes each project big (like 60MB+ big)
C++ Sockets Library
  • Lots of documentation
  • Appears to be very solid from all accounts
  • I couldn’t get it to play ball!
SDL_net
  • Pretty small
  • Works without you having to jump through too many hoops
  • Decent level of abstraction without the need to mess about with too much C (as opposed to C++) stuff
  • Does not require SDL – SDL_net can be happily used standalone
  • Good documentation available at:
    http://www.libsdl.org/projects/SDL_net/docs/index.html
  • You do still need to transfer strings to char array pointers
  • Resolving hosts and IPs puts the details in Network Byte Order (i.e. Big Endian) numbers, which you then have to jump through hoops to retrieve as human-readable values, so you end up doing stuff like hacking a unsigned 32-bit number into an array of four 8-bit numbers to get the dot-quad IP address etc.
NetLink Socket Library
  • Small!
  • No documentation at all (that I could find), which could be because…
  • …netlink is already the name of a *nix socket mechanism which transfers data between kernel-space and user-space – why the hell would you name your C++ socket library with a name which is already used for a different type of socket communication? Fail.
SimpleSockets
  • ?!?
  • Surprisingly for a library called SimpleSockets, not that simple – lots of memset and memcpy stuff needed

In the end I chose SDL_net as teh winnah, as I’d already done some SDL stuff with the class previously (before switching to GLFW to minimise code-bloat), and I managed to get SDL_net up and communicating pretty easily. So, for the next couple of days I put together some simple client/server examples, culminating in the code you’ll find below, which is a (very) simple IRC-esque chat server.

Have a look – you can tell what it’s doing from the output in the windows:

SDL_net Client-Server Example

The server is in the middle, the clients connect in, and chat commences (click for larger, more legible version)

Although I’ve written this code in Linux, as SDL_net is cross-platform, this code should be cross platform – only there are two tweaks you’ll need to make for it to work in Windows: I’ve used some custom kbhit and getch functions to check for a keypress and read what key was pressed, if one was. These functions come natively with Windows, so you should use the native versions and strip the custom ones out.

With those small changes made this should work fine in Windows – but if it doesn’t please feel free to fix it yourself and send me the changes you made :)

As the code for all this is a couple of hundred lines for each for the client and server I’ve put all the source after the jump. Part of the reason it’s so large is that I’ve commented it to the hilt (no really, I’ve gone to town on it – even by my exceptionally verbose standards) as it was originally meant to be a teaching aid. Also, I’ve also left a lot of commented-out debug code in there, so you can uncomment it if you’d like to see exactly what’s going on behind the scenes.

Anyways, I hope this is of use to someone starting off socket programming with SDL_net – and if you have any issues or such please feel free to sling a comment in the article and I’ll do my best to help out.

Cheers!

Read the rest of this entry »

Comments
40 Comments »
Categories
Coding
Tags
ASIO, Boost, C++, network, Programming, SDL_net, Socket, Sockets
Comments rss Comments rss
Trackback Trackback

« Previous Entries Next Entries »

Translate

Categories

Archives

Tags

3D ActionScript ActionScript 3.0 Adobe AI Ballarat Bash C++ Class Convert CS4 Effect Error Film Flash GLSL Gnome Hack How-To install Jaunty Java Kinect Linkage Linux Mash-Up Microsoft Motion OpenGL Particle Problem PS3 Remix Retro script Slides Sound Systems Texture Ubuntu Video VirtualBox Wii Windows XBox

Gamercard

OpenR3dux

Misc.

Flattr this

RSS Feed

r3dux twitter feed



“Back in the day, bucko, we just had an A and a B button... and we liked it.”

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox