Please login or register. Welcome to the Studio, guest!


Quick Links:



Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Smangii Avatar
Smangii Avatar
So... it's been a few years.... but I reuploaded these by request.

Figured you'd want to fix the links :P

New Preview: fc01.deviantart.net/fs27/f/2008/098/7/1/71a747ed6c7c6779.jpg

New Download: copy.com/90pSOSmmsRHA
Thanks! :)

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
I've decided to start writing a weekly post about the bugs I encounter, either in my personal code or at work.  Part of this is to just share tips/tricks... part of this is to share lols.

Most of my bugs will likely be in Scala code.  For those unfamiliar, Scala is a JVM-like language that adds in functional programming.  Basically, it's Java + Python.



This week's bug was a fun one.  So, we have this object (a singleton instance of a class), and it has a bunch of properties.  It also has an "All" property which is a set of them.  We'll say these properties represent languages:

object Languages {
 val All = Set(Java, Python, CPlusPlus)

 val Java = "java"
 val Python = "python"
 val CPlusPlus = "c++"
}


Can you spot the bug?  Yes, this does compile, so it's not that...

If I did this, you'd find it real quick:
scala> object Languages {
    | val All = Set(Java, Python, CPlusPlus)
    |
    | val Java = "java"
    | val Python = "python"
    | val CPlusPlus = "c++"
    | }
defined module Languages

scala> Languages.All
res0: scala.collection.immutable.Set[java.lang.String] = Set(null)

wtf.  Why is it a set of null?!  Well, as it turned out (after 4 hours of scouring through a ton of code built on top of this simple object), it's because Scala objects and classes evaluate those out of order... if I had made the vals below lazy (evaluated on call; not on defining the class) it'd have worked properly.  Sadly, that has a memory overhead.

The real solution is just to put All at the bottom of Languages:
object Languages {
  val Java = "java"
  val Python = "python"
  val CPlusPlus = "c++"

  val All = Set(Java, Python, CPlusPlus)
}


And boom.  It worked:
scala> object Languages {
    |   val Java = "java"
    |   val Python = "python"
    |   val CPlusPlus = "c++"
    |
    |   val All = Set(Java, Python, CPlusPlus)
    | }
defined module Languages

scala> Languages.All
res0: scala.collection.immutable.Set[java.lang.String] = Set(java, python, c++)


So, yeah, this was just an annoying bug that cost me almost an entire day.  Figured I'd share my annoyances.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Benjamin Avatar
I dunno... it definitely wasn't my favorite episode. I did enjoy the taser scene though.

I cant decide whether I liked the Archer season 5 premiere or the Chozen pilot better.
I haven't seen Chozen's pilot yet.  I keep seeing ads for it on Spotify though. :P

The teaser gave away too much, if they even follow that path.  I figured that was just one of Archer's crazy fantasies.


btw, chances that they make a ton of NSA jokes this year?  I'm thinking it's high.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Little Talks - Of Monsters and Men

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
So, the episode was two nights ago. It wasn't as funny as I hoped, but it definitely set up the plot well for the rest of the season.

Thoughts? (You can use the spoiler tag to hide spoilers!)

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Benjamin Avatar
Chris Avatar
It really makes me feel like your name should be twerk.

Torque -> Tork -> Twerk -> Twerque
It's like... you can tell the future or something...
People listen to my advice.

Sometimes... or, well, occasionally.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Stinky666 Avatar
Chris Avatar
Looks good Stinky. May I recommend that you move the CSS form the board page into the additional css part? :)

Is there any particular reason why? Does it load faster or anything? Or would moving it not really make a difference?

Consistency mainly.  That, and we're -already- editing the CSS file... might as well.  You can also then, in theory, expand it to be customizable using the Advanced CSS Editor by adding rules.  (Again, in theory. :P)

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Stinky666 Avatar
Chris Avatar
Looks good. Only a few small things on your editing instructions:

Line numbers change over time as PBS produces new default CSS, HTML, or as a user edits it before adding your modification. It's actually better to just set the correct value with new rules for CSS.
I agree, obviously, and understand the first part of what you're saying, however, I'm honestly not too sure what you mean by that last sentence.

I have mentioned to use CTRL+F to search for specific things, if that helps though?

CTRL+F is a good improvement, for sure. :) In fact, I think they offer a shitty search field at the top of the box too.

Anyways to clarify... when you remove the CSS, you're telling it to just reset to an earlier rule... in this case, likely "width: auto;"

If we were to insert that rule at the end instead of deleting it earlier, it's easier to support future changes or removal of modifications. :)    

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Twerque Avatar
Chris Avatar
Their marketing team needs help though.  Making it so that I can't order everything from different vendors at once (like Amazon, per se) makes me less likely to spend a ton of money on their site, because I get bored of clicking through so many times.
'Tis a good point. I haven't actually ordered anything quite yet so I haven't run into that problem but I can imagine it's really annoying. I actually wasn't aware it worked like that -- I had thought it WAS like Amazon. Hopefully they'll implement a better system.
As long as they're all one sender, you're good.  Sadly, not easy to get one vendor.

Amazon will still send you multiple packages if they're different vendors. :(

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Twerque Avatar
I guess I'll just hop in here to say I like pretty much everything that's happened and will most likely continue to happen. Everything has a fresher feel to it. It looks nice, and it seems a lot more functionally smart than the old version.
Your lack of favorites disturbs me.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
I'm sure many of you guys heard about the massive Adobe and Snapchat leaks (among others) recently.  It's a few weeks (or month for Adobe) old at this point, but it was a massive deal.

Well, one of the security bloggers I follow (Troy Hunt) decided to make a lookup service that let's you determine if your e-mail (or phone number) was leaked in any of the incidents.

haveibeenpwned.com/

It also lets you sign up for future notifications if you so choose.

(For the coders out there, he talks about the design of handling 1.5m records here and here (part 2). Pretty interesting stuff.)

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
dsc.discovery.com/tv-shows/mythbusters/videos/lego-ball.htm

(original: www.youtube.com/watch?v=VFGVzt7c5bY)

Anyone want to try this as a weekend project with glue? :D

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
It's best to not ask questions sometimes.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Twerque Avatar
I kind of like my name.

"verb: aggravate, agitate, bother, irritate, torment, etc.
My wife knew I had a fierce hangover, but she just had to torque my ass about cutting the grass anyway.

I love to torque my little brother about being gay.

Oh man, stop torquing me! I'll pay you when I pay you!"

Because it's true :D

It really makes me feel like your name should be twerk.

Torque -> Tork -> Twerk -> Twerque

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Twerque Avatar
A LOT of homeless people will commit petty crimes in order to have somewhere to stay while it's cold. I don't blame them ... Honestly, knowing that there are people -- and pets -- out there in this really gets me. I just wish I could do more to help.
These guys aren't actually committing any crimes.  That's the difference. :)

Though, you remind me of a story I read.  A guy once robbed a bank for $1 because he couldn't afford health care for something he had (might have been cancer?), but the prison system would cover it.