lion

A tumble-style blog that has bringing you nonsense since 2006
Jun 11
1 year, 2 months ago.

APPFT

App for that

How did I not know about this site?

(p.s. my little project is taking a little bit longer than I thought, give me another day)



Chatter

Jun 9
1 year, 2 months ago.

Blogging is easy

Blogging it a lot easier than hardcore coding; I’ve put a little time aside for a side project. You’ll see it tomorrow.



Chatter

Jun 9
1 year, 2 months ago.

I love College humor.

So… can you really puke from that?



Chatter

Jun 8
1 year, 3 months ago.

I want to meet Streeter Seidell

Streeter Seidell

Honestly, don’t laugh.

Streeter Seidell is one of my idols and one of my favourite actors from College Humor. He is up there on the “I want to meet one day” list I’ve been building for awhile. He just seems like one of those funny guys that would be pretty bad ass to chill with. I guess you can consider this a goal, to one day meet him. You never know, one day he could stumble upon my blog and be like “this kid seems pretty bad ass” and shoot me an email. Or vise versa.



Chatter

Jun 8
1 year, 3 months ago.

I FORGOT

WWDC is today!

wwdc-keynote-2009-06-07_23-34-13-rm-engjpg



Chatter

Jun 8
1 year, 3 months ago.

Is this spam?

Maybe it is spam

Maybe it is spam

I’m debating if it is, or some kind of death threat from someone that I’ve pwned in a recent debate. Time to do some research.



Chatter

Jun 7
1 year, 3 months ago.

Twitter #robotpickuplines

Yesterday, #robotpickuplines was a Twitter trend for over 5 hours.

@Playboy: You make me melt like the T2’s liquid metal core on a hot day.

@NemesisPrime: Why don’t you turn me on and try me out?

That made my day.
An now I have to stop drafting shit and start posting it (I have upwards to 5 or 6 drafted posts that will probably never see the daylight, or will become irrelevant when I post them).



Chatter

Jun 7
1 year, 3 months ago.

Yu-Gi-Yo (Yo!)

A throw out to my friend Theo@Suteki.nu

If you read that article, chances are you’ll get a good laugh.



Chatter

Jun 6
1 year, 3 months ago.

A Dirty Cheater & Doctrine Pager

Yesterday I was talking to a friend about my hack for the ability to use the Doctrine Pager with Symfony (and still build the model in the action).

I figured it was post worthy, especially since it is something I could see other people having problems with it.

To start, I had to pull the URL helper into the model, which normally would be a No-no, but this doesn’t really break MVC architecture due to the fact that no view elements are being created.

public function executeComments($request)
  {
    sfProjectConfiguration::getActive()->loadHelpers("Url");
    ...

Next (for those who don’t do this, you should), define your column count. Do not let Doctrine do this. It is inefficient because Doctrine does not know to add the ->select(”x.id”) piece of the DQL.

$this->pager_count = Doctrine_Query::create()
  ->select("c.id")
  ->from("BlogComments c")
  ->where("c.post_id = ?", $this->post->id);

Now we have the fun part.

$this->pager_layout = new Doctrine_Pager_Layout_NextPrev(
  new Doctrine_Pager(Doctrine_Query::create()
    ->select("c.*")
    ->from("BlogComments c")
    ->where("c.post_id = ?", $this->post->id)
    ->orderBy("c.created_at ASC"),
   $request->getParameter('page', 1),
   50
  ),
  new Doctrine_Pager_Range_Sliding(array(
    'chunk' => 5
  )),
  str_replace("pagenum",
    "{%page_number}",
    url_for("blog/comments?id=".$id."&page=pagenum"))
  );

Okay, let me start out by saying I use a custom Doctrine_Pager_Layout class to generate my Prev & Next links correctly, so this code won’t translate perfectly.
Once the layout class has been initiated, we do the Doctrine_Pager.
The three prerequesits are filled, the third input, however, is the fun part.

We use the url_for() function to generate the correct URL and we use a placement, “pagenum” for the page. We use the str_replace() method due to the fact that url_for() will URL encode “{%page_number}”, which is required for the pager (so it can know where to put the page number).

Next you just need to set the important info:

$this->pager_layout->getPager()->setCountQuery($this->pager_count);
//We manually set the link HTML. Who does this anymore? lol
$this->pager_layout->setTemplate('<a href="{%url}">{%page}</a>');
$this->pager_layout->setSelectedTemplate('{%page}');

That is pretty much the hardest part. All you have to do next is place the actual loop in the layout.

<?php
  foreach($pager_layout->getPager()->execute() AS $comment):
?>
    ...

And the pager.

<?php if($pager_layout->getPager()->haveToPaginate()): ?>
  <div class="pagenav" style="text-align:center;">
    <br /><br />
    <?php $pager_layout->display() ?>
   </div>
<?php endif; ?>

BAM. You’re done.
Hopefully this can help some people out, I know it’s a pain in the ass.



Chatter

Jun 5
1 year, 3 months ago.

OS X and xBox360

I just found out I can stream media from my Mac to my xbox 360!
Friggin’ sweet, 40gb+ of content I can now watch while I’m working on Notemine. Go me.

Later today I’m going to publish a few new screenshots. Sweetz.



Chatter

Dan is

& this is his thumblish-blog.
I want to know more!

btw, you can contact me at:
dan[at]contagious.nu

Elsewhere