the lorenz attractor

demo, code, actionscript, flex, flash, papervision3D, random, work, mxml


we were discussing recursive algorithms and chaos theory at work yesterday. when the chemistry professor brought up the lorenz attractor. he was trying to draw one on the white board for about 10 minutes until i decided it would be easier to draw in flash, lol!

after a quick conversation w/ andy zupko about the new Line3D object, and my new CanvasView3D component for papervision, i made a sweet Lorenz attractor!

the algor is super simple

    pseudo code
  1. x1 = x0 + h * a * (y0 - x0);
  2. y1 = y0 + h * (x0 * (b - z0) - y0);
  3. z1 = z0 + h * (x0 * y0 - c * z0);

A, B, and C are variables that get their values from form components in the application, while H is a constant that represent the angles of the curves dictated by segment size. x0, y0, and z0 are the origin vertex’s while x1, y1, and z1 are the destination points.

besides the form objects for the A, B, and C values, the application features an event driven camera, that follows the drawing as it happens. as well as a hover camera, which lets your rotate the object in 3D. the actual lines that are being drawn are given a new material each render. that's how the color tweening effect is achieved. use the color picker box to select a valid color to start with. also, the algor run 3000 times, (getting slower and slower as it loops) press the generate button to erase the lorenz you already have a begin drawing a new one w/ the form values you have selected.

a little background on the lorenz...
the lorenz attractor is a 3D structure corresponding to the long-term behavior of chaotic flow. the visual “map” represents the evolution of a dynamic system, that complexifys and into a unique non-repetitious pattern. originally discovered by edward lorenz in 1963, the current algorithm is based on simplified version of his equations of convection rolls arising in the atmosphere. for detailed technical info check out math world and this article by dominic van berkel.

click here to check out the demo
then browse the source code

RFC822 compliant dates for rss feeds

code, dotnet, php, work, C#

with the advent of web-syndication, a few different feed protocols have evolved (rss and atom being the most popular). because of their growth in popularity the protocol to create a feed has become more stringent. luckily we have validators who help us keep our feeds on the right track. one of these guidelines is RFC822 compliant dates. these dates look like Sat, 14 Jul 2007 18:40:26 -0400. formatting your data to be compliant with this standard can be challenging, so i have written some code to help you along...

Creating a RFC822 compliant date in php is a snap...

    php code
  1. $rssDate = date("r");


in asp.net this is a bit more tricky. microsoft doesn't have a native RFC822 date format, so we are going to have to convert our dateTime.now() into that format
    asp.net C#
  1. public string dateFormat(DateTime date)
  2. {
  3. int offset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours;
  4. string timeZone = "+" + offset.ToString().PadLeft(2, '0');
  5. if (offset < 0)
  6. {
  7. int i = offset * -1;
  8. timeZone = "-" + i.ToString().PadLeft(2, '0');
  9. }
  10. return date.ToString("ddd, dd MMM yyy HH:mm:ss " + timeZone.PadRight(5, '0'));
  11. }
  12.  

the centeral randomizer

code, dotnet, random, work, C#

here is my asp.net randomizer class based on the c R250/512 shift-register sequence random number generator, by kirkpatrick and stoll and published (j. computational physics, vol 40, pp. 517-526) with an added a pseudo-random class redefinition and buffer overflow protection.

    asp.net 2.0 class
  1. public sealed class randomizer {
  2. private int good_index;
  3. private int evil_index;
  4. private int[] good_buffer = new int[250];
  5. private int[] evil_buffer = new int[521];
  6. public randomizer()
  7. {
  8. Random r = new Random();
  9. int i = 521;
  10. int seed = 1;
  11. int salt = 999999999;
  12. while (i-- > 250) {
  13. evil_buffer[i] = r.Next();
  14. }
  15. while (i-- > 31) {
  16. good_buffer[i] = r.Next();
  17. evil_buffer[i] = r.Next();
  18. }
  19. while (i-- > 0) {
  20. good_buffer[i] = (r.Next() | seed) & salt;
  21. evil_buffer[i] = (r.Next() | seed) & salt;
  22. salt ^= seed;
  23. seed >>= 1;
  24. }
  25. good_buffer[0] = seed;
  26. evil_buffer[0] = salt;
  27. good_index = 0;
  28. evil_index = 0;
  29. }
  30. public int random() {
  31. int g = good_index;
  32. int e = evil_index;
  33. int nina = g - (250-103);
  34. if (nina < 0)
  35. nina = g + 103;
  36. int xero = e - (521-168);
  37. if (xero < 0)
  38. xero = e + 168;
  39. int x = good_buffer[nina] ^ good_buffer[g];
  40. good_buffer[g] = x;
  41. int z = evil_buffer[xero] ^ evil_buffer[e];
  42. evil_buffer[e] = z;
  43. g = (g != 249) ? (g + 1) : 0;
  44. good_index = g;
  45. e = (e != 521) ? (e + 1) : 0;
  46. evil_index = e;
  47. return x ^ z;
  48. }
  49. }
example usage
  1. randomizer x = new randomizer();
  2. int num = x.random();

yew got payed

blog, work, tech, photoz


i just got my first pay check the work webcam.
that's a $1276.40 1st pay check!!!! w00t w00t!

so i already spent part of that on an iubi blue
high rez photos here.
still cant git one in the US yet, so i got mine here.

so yeah, it's an mp3 player

it also plays like EVERY FUxx0RiNG vid 4mat ever!!! MPEG 1, 2, 4 DivX 3.X, DivX 4.X, DivX 5.X, Xvid, WMV9, H.264/MP4, AVI, OGM, WMV 7, 8, MOV, & Real video files!!!!!!!!

damn! and the screen is so0o0o0o00 beautiful!
this photo does no justice to the device, but it proves what ive been watching...

yew can see the screen from every angle,
not like that stoopid iPOD and Creative Zen Vision/M or that lame Archos...

it has a line in/out feature so yew can h00k it up to the TV and watch, but it can also record as well... i use the line in for old records/tapes, not to mention it encodes video/audio in both Xvid and AVI formats!!! high rez stuff too not just crap. ive encoded and watched stuff on the blue, then on my pc, then ripped it to dvd w/ no loss in quality! (thanx nero vision)

and did i mention that it's a 30gb logical hard drive?
no drivers, just plug & play. yew can charge the device w/ usb while it's acting as a hard drive, AWESOME!!!!!!

dotnet querystrings and post vars

code, dotnet, work, C#

here's a nice little snip of c# code. this is meant to be used in an asp.net web application. the following code will return either a querystring variable or a post variable, it tries both and finds the valid one.

    asp.net c# code
  1. public string RequestParam(string paramname)
  2. {
  3. string result = string.Empty;
  4. if (Context.Request.Form.Count != 0)
  5. {
  6. result = Convert.ToString(Context.Request.Form[paramname]);
  7. }
  8. else if (Context.Request.QueryString.Count != 0)
  9. {
  10. result = Convert.ToString(Context.Request.QueryString[paramname]);
  11. }
  12. return (result == null) ? string.Empty : result.Trim();
  13. }
  14.  

CET

work, blog


i finally got a real job! i work at the Center for Educational Technologies making $35,000/yr. its at Wheeling Jesuit University which it ware nina goes to skool. so if we git married soon her skool will be free from then on!

my official job title is web application programmer, but it seems like im gonna' be a c0de jockey, debugger, sql admin, and a tech help (for other employees) kind of guy. but thats kewl. donovan hubbard helped me git the job. he works upstairs as a flash programmer. which iz sweet cuz since were both vegetarians we hangout during lunch.

i'll shove metal threw your face

blog, work

so i *FINALLY* got my piercing apprentice at hotrods! yeah! i'll be working both the oakland and south side shop. im excited and scared at the same time. i wouldn't even pick up a needle for like 3 months though, which i think is a good thing. i'm going to work a lot with chris, which will be very cool. chris has been doing his thing for 9 years now and i trust he knows his shit.

MMVII .( xero harrison ) . http://the.fontvir.us/b10g
RSS syndication