Posts Tagged ‘code’

Weekend of Code

After doing a bit of number-crunching, I’ve decided that its probably best if I stayed on base a bit more than what I’m normally used to. Financially I’m now responsible for not only myself, but for a wife AND a soon-to-be newborn. I believe that after restricting my recreational activities off-base, and not living too-lavishly until I get to my next command, I can safely assume I’ll be quite sound money-wise to set up off-base living and even a car (thats in the works as we speak). I think Jessica and I have decided that Portland, Oregon is where we’re going to rest our heads when I get out of the service.

I was working on a few projects this weekend. I managed to foobar Torrent Coil something aweful and ending up having to rewrite a chunk of the main script. I ran into a huge problem with GoRTFM regarding sessions and the error-system I was writing for it, so I’ve stopped development completely for gortfm until I can pull something out of my ass in that regard. I did manage to work on my weather script, as well as incorporate Bluesome’s Exec-PHP plugin (found here). Now you’ll see awesome weather stats for Amherst and Great Lakes on the top of the right-sidebar, you can even click the link and enter your own area-code in to see your weather stats live (dorky, I know). I also started working on a small project for Cheggit.net, currently working on making the comment-system a bit more lively using ajax, stay tuned for that.

Tags: ,

Whatpulse API

I was reading this thread: http://forums.whatpulse.org/showthread.php?p=22448#post22448 and thought I had the solution here:

<?php
//** read whatpulse userstats **//
// $userid = your whatpulse userid
// $optionsArr = the items you want (read the xml file first)
function readUserStats($userid, $optionsArr) {
// prepare an array to hold your stats
$WhatPulseStats = array();

// types of statistics
$stat_types = $optionsArr;
if(count($stat_types) == 0) {
$stat_types = array(”AccountName”,
“TotalKeyCount”,
“TotalMouseClicks”,
“Rank”,
“GeneratedTime”,
“TotalMiles”);
}

// init the xml parser and read the data into an array
$data = file(”http://whatpulse.org/api/user.php?UserID=”.$userid);
$data = implode(”", $data);
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $tags);
xml_parser_free($parser);

// loop through the structures
foreach ($tags as $key => $val) {
// only process stuff between the tags
if ($key == “UserStats”) {
// loop through the tags inside
$ranges = $val;
for ($i = 0; $i < count($ranges); $i += 2) {
$offset = $ranges[$i] + 1;
$len = $ranges[$i + 1] – $offset;
$statsarray = array_slice($values, $offset, $len);

// loop through the structure of the xml tag
foreach($statsarray as $key => $value) {
// match to a stats_type
for($i = 0; $i < count($stat_types); $i++) {
if($value['tag'] == $stat_types[$i]) {
// remember the value of the stats_type
$type = $stat_types[$i];
$WhatPulseStats[$type] = $value['value'];
}
}
}
}
}
else {
continue;
}
}
return $WhatPulseStats;
}

?>

send me a comment if it works

Tags: ,

Kinda tired

I’ve gotten to hear the rumors that ET “A” has a change of hold status. As of tonight, apparently the time on hold changed from 7-10 days to 4-8 weeks. With that said, it appears that all that I mentioned in the previous post might actually happen soon! This news brings my expected ETA to leave to my next duty station to most likely September, but I’m not believing that anything is concrete at this point in time.
I figured it was about time for a new blog system, the last one was just too bullshit-loaded for me anymore. I’m using one of the more popular ones, and I expect to have quite a few changes to the layout (if not, than atleast the styling) by the end of the weekend. I tried to salvage all my posts on the last blogging software a bit earlier, but I got bored and figured I’d save it for something to play with over the weekend. Other than this blog, I’m still working on gortfm.net, and I hope to be able to open some sort of registration system by the end of the weekend as well.

Tags: , ,