Jquery problem with cached images having height and width of 0
July 8, 2011, 3:17 pm

So I managed to solve a major problem in jquery, an issue that apparently plagues many people.

When dynamically adding a new image, if the image is already cached, the browser has a habit of kicking back a value of zero when .width() and .height() are called on it. This can be especially annoying if the programmer is trying to resize the image dynamically, since no assessment of the image's real width and height can be ascertained.

My current script grabs all image links and all embedded image urls from the current dom, and makes an array of them. Links are no problem usually, since the image hasn't been loaded yet, but i found that after testing my chrome extension on a single page multiple times, I would eventually run into a point when the browser would decide the image was already cached, and would give me the problem that all embedded images already had. It would load, but with a width and height of 0. Terribly annoying.

I tried making a .load() function and that worked sometimes, but eventually there would be a problem again. and then I came upon the solution, I had to add a timestamp to the end of the image to grab a new image. But of course if the timestamp is added dynamically every time, then the images are never cached at all in a good or bad way. Then I figured it out. Since my script creates a large image list object, I added a timestamp when the image was added to the list. I couldn't add it to the link itself, because then matches couldn't easily be made on the links. By separating the timestamp, and adding it at time of load, it allows me to make sure my cache is dynamic, but i still get a local cache.

This solved my problem and hopefully it can solve someone else's.


the death of the music video
May 28, 2011, 6:00 am

Have you ever heard the song "video killed the radio star"? Well I believe the opposite has happened now. The MP3 has killed the video star. It's possible that this is based merely on my own perception, but I haven't watched a music video on purpose in years. I have no doubt that they're still being produced, but the machine that was present in the 90's pushing videos on teens just isn't there anymore.

The flipside of being able to produce and distribute product for cheap on the internet is that consumers no longer rely on one outlet for their product and news. It is now on the consumer to seek out their own information, and so there is no where to focus the media push like there was when it was just MTV and VH1.

An argument could be made that youtube is the current Big Media playground, but even that is so fragmented. Each record label has their own channel and even if youtube has an ad on their main page, that is a page you never have to visit.

The era of Big Media push is coming to an end. We are on the cusp. I for one can't wait.

Posted via LiveJournal app for Android.


jquery just saved me a year
May 26, 2011, 6:32 pm

well... maybe not a WHOLE year. it's amazing what you can do when you don't have to write the code to loop through a bunch of somethings, or do checks on anything...

jquery just does it. i mean... i just didn't get into it because i didn't want to be depending on loading a code, but christ, it makes everything so much easier. I am a convert. welcome to the church of jquery, this is my first sermon. Worship this shit. I stand at the altar of jquery and say to you that it is good.


work getting done
May 16, 2011, 11:53 pm

I have been doing a lot of working on my portfolio.  And when i say work on my portfolio, i mean that i have been working on the code that runs my portfolio.  Some of you might not know this, but i love coding.  It makes me quite happy.  If you go to hamiltondraws.com/portfolio, you can see the very work that i have been doing.  Mainly i've been working on the lightbox for the thumbnail mode.  I'm sure that I will eventually add this to the directory mode, but for now it seemed most appropriate for the thumb mode.

So I wrote the php portion of the default index script quite a while ago.  It's a small script in a single php file with just a simple but added to a .htaccess file that directs any folder without an index file to point at this default index. 

I've used the greased lightbox script from shifting pixel for a long time, which was based on the original lightbox gallery script, and I've always wanted to add this functionality to my own galleries, but I never like to use other people's scripts.  So I have finally made my own.  Even the images used in this script are just base64 text so that this script can be implemented on a system quickly and efficiently.

There is more i would like to do with this and it has features that I always wanted Joe to add to greased lightbox, but for now I think I might leave it alone for a bit.

Posted via LiveJournal app for Android.


i tire of the old ways
May 13, 2011, 10:26 pm

i am sitting on the toilet thinking about how things have gone down recently. it's always hard to figure things out in the moment, and i often find myself pondering topics long into the night when sleep would be preferable.

i want to be happy. i want to live a life where i learn the skills that let me do the things i enjoy, and allow me to use my talents to benefit those around me. it frustrates me to no end when i think about what i could be doing if i just had someone who could genuinely show me how to do it. some people are incapable of learning new things. i have difficulty deciding which new things to focus on learning.

i recently got a new computer and discovered that linux works relatively fine on my old laptops.  in doing so i managed to save some of my website files off of those harddrives, but honestly not enough.  i am genuinely sad that i dont have a backup of those files anywhere.

i keep thinking i should write some music. i want to get a new guitar.

... but i dont really need another distraction.

Posted via LiveJournal app for Android.


in which i wait for a new computer
April 11, 2011, 7:53 am

I found a computer at one point, and now I am using it for some basic work. I think when my new computer comes in, I might set this one up as some sort of lowend server.

I did some work today on my old website code. I was on a server previously that was not completely up to date, and this new server has allowed me to implement some of the newer flashier php5 elements. I have been learning Java in order to program for the android phone, and its more advanced object oriented programming has taught me how to better utilize the php5 oop setup. I find myself to be an infinitely more efficient coder than I was a mere year ago. And I am also a better artist. I'm going to implement some gui changes on this blog, and then get back into coding on the android, but i will always have a soft spot for php, as it was the language that taught me to love.


In which once again I abandon my blog
April 6, 2011, 3:38 pm

It certainly has been a long time since I posted anything on the Internet that wasn't on facebook. It's not because I have forgotten you, journal, mainly its a thing of convenience, and I haven't felt like talking.

Some people may be interested in what I've been up to. I'm engaged to be married to the marvelous Victoria Calderon. I have a job as an art director at a company called Concept Art House, and that job means that I now live in San Francisco.

I have also been reading a lot lately. I have managed to read through 8 Wheel of Time books in the past 5 months, and almost all of it done on the Bart between home and work. Maybe I'll even draw some more art for it when I'm done.

My website went down about a year ago, and that might have also contributed to my not updating this blog. I downloaded and android app called ljbeetle and I'm writing this on my way home. Maybe I'll start blogging again if this turns out to be convenient enough.


in which i return
January 10, 2010, 11:41 am

i haven't had my own computer in months. i've been using victoria's, because she is kind and generous, and because both of my laptops have gone to shit. it saddens me actually. to think of how much computing power i have just lying around wasted. sigh.

i've been doing a whole lot of nothing recently. at work, i've been reading asimov. i should be trying to sell hard, since john will be going on vacation soon, and i am essentially taking all of his shifts, but instead i find myself in the most sincere work doldrums. i just want to finish reading foundation again, and then maybe i will get back my vim and vigor. on the other hand, i've got a card set i think is late, although i can't find the paperwork, and another that is already nearing it's deadline, even though i have yet to even make a dent in it.

sigh. at least my relationship is on the upswing. we are learning how to deal with each other. it's a process that plays out in every story ever, and you STILL tell yourself, i'll never make those mistakes. ah well. we live, we learn, and if we make it through, we're stronger for it. i pray to continue to make it through. this girl has become special to me. she brightens my day. i only hope that sometimes i do the same.


in which i regress/progress
October 21, 2009, 6:00 pm

i can't decide whether i'm moving forward or backward, but i like to hope it's more like circular. all things come and go in their own time, and right now i am going in the direction of traditional media. i was devoted only to digital media for the longest time, and now drawing on a tablet seems awkward and strange to me. i've been doing so many pen and brush and pencil drawings recently that it's the only thing that feels real. i threw myself into the creation of so many sketch cards that i believe i have fairly well mastered the use of the brush faster than most people do. sketch cards will do that to you. draw 200 drawings sometime and see if you don't get good at whatever medium you're using.

but even as my brushing gets better, i can't help but think about how much potential digital art has, and how i might be missing out on valuable growth in that department, by focusing solely on brush work.

... oh well. i can't exactly do sketch cards digitally, now can i?


in which relationships are difficult
October 14, 2009, 5:53 pm

the conversation circled around for an hour, but the gist of it was this, she said to me, "i can't tell you why i'm mad, because you're just going to try to convince me why i shouldn't be mad." to which i replied, "you're goddamn right i am."

i was so startled by her statement that i literally had to step back and gather my thoughts into a cohesive retort. and here is what i came up with. i get to have any and every chance to stop you from being mad. why would you want to be mad? if i did something wrong, genuinely, then you have the right to be mad. but you don't want to be mad... do you? i don't want you to be mad. it doesn't do me any good, and it doesn't do you any good. so why would you want to STOP ME from stopping you from being mad. because you think i'll think less of you? no way. the only time i think less of you is when you DON'T TELL ME WHY YOU'RE MAD! because what can i do about it? i can't defend myself because i don't know why you're mad, and if you don't want me to stop you, that means you just want to stay mad. and yes, THAT makes me think less of you.

but give me the chance, any chance, EVERY chance to make you not mad. cuz 99% of the time, i dont know what the fuck you're talking about. because guess what? i don't want you mad! so if i don't want you mad, then why would i have done something to piss you off on purpose? ours is not a relationship spiraling around the acrimonious asshole of defeat. ours is a healthy young relationship. which only stays healthy by conversation and my opportunity to defuse any situation.

so if i ever do something that pisses you off, don't hold it in and stew over it all day and then bring it up while we're having fun and i say something else that inadvertently sets you off. tell me immediately. something like this "hey, are you serious?" and i'll be all "nah, i'm not serious" and then please, if you don't want to just be mad at me, accept that. because, if i'm mad at you, i'll tell you i'm serious. if i'm not really mad at you, if it wasn't really that big of a deal, i'll tell you i'm kidding, and as far as everyone is concerned, that is now true, whether or not it was a second ago. but chances are much better that i just said something to be funny, or did something to be cute, and you took it the wrong way. you took it the wrong way, and instead of discussing it, you stayed mad all day, and now you're too embarrassed because you realize i don't know what you're talking about and maybe you misinterpreted something and you think i'll think less of you for it. well i won't, but i wouldn't have even less if you had just talked about it earlier.

all of this is not to say i had a fight with someone tonight. because i don't have fights, because i'd rather solve problems. you see, i'm a problem solver, and sometimes people create their own quagmire of problems for themselves that they think they can't get out of because the other person will think less of them. well even though we likely won't think less of you, if we do, it's likely a temporary thing. a lot more temporary than the hate we have for games being played with us.

this is a cautionary tale, kids. some people like to play the "you know what you did" game, and i'm calling bullshit on that, right here, right now. because guess what, we don't know what you're talking about.

i guess it's possible there are people out there who do want to piss each other off. if you're those people FUCK OFF! you're ruining life for everyone. if you're not, then talk it out. don't keep it secret. just like when you were a kid, i'm not gonna be mad at you if you just admit it. i might be mad a little, but i'll get over it. but not if you lie about... or even just keep it from me. that's harder to get over. be up front people. save everyone a little hassle, and a little heartache. talk it out.