Posts Tagged ‘JavaScript’

12
Jul

jQuery imageless buttons a la Google get an update

   Posted by: Swizec    in Uncategorized

That’s right, after my jQuery plugin for imageless buttons much akin to those Google use in their online apps has been out in the wild for almost six months, an update is now here, making them version … uhm … 1.0.3.

During this time jQuery.com claims the code to have been downloaded … well darn, doesn’t say anything since I apparently didn’t add an actual release. Silly of me. But google analytics claims the page to have been viewed 6222 times, which makes it the single most popular page on this site. Yay.

styledButton screenshot

Nothing much has actually changed except that I fixed a horrible bug, which prevented you from having tagged captions in buttons with dropdowns – this surprisingly took all night to fix, since what you’d normally expect jQuery to do simply melted down and refused to work, yes, even with the latest versions. Aside from that I’ve also dropped support for Safari 2 because updating jQuery to 1.3.x killed everything. It was a surprise to me, but the latest jQuery simply refused to load, nothing worked.

However, if you wish to support the old jQuery this imageless buttons plugin should still work as well as ever, except you won’t be able to use tagged captions for dropdowns.

That makes the list of supported browsers as follows:

Which means it should display pixel perfect and the same in all of those, except of course for any differences in parsing fonts.

    Reblog this post [with Zemanta]

    Tags: , , ,

    6
    Jun

    Slovenia php conference day2 (live blogging)

       Posted by: Swizec    in Uncategorized

    10:16 Today was horrible walking weather. Groggily stumbling to IJS felt a bit like trying to swim through a sauna. I don’t even know how late I was getting here, but I somehow managed to snatch the very last energy drink. Yay! Shame I’m in last row this time … think we’re listening to @markostamcar talking about … something. Is this the “code snippets that saved my life” talk?

    Smoke sauna in Enonkoski, Finland.
    Image via Wikipedia

    Oh and before anyone asks again, yes, I’m the guy in a black bowler and no that card is not an Ace. Never an Ace.

    10:29 @markostamcar just admited to being a dirty dirty pirate thief. Wonder if anyone from the MAFIAA is here or we’re all just a bunch of dirty swashbucklers? Interesting code bit, think it calculates a foreign TV guide into local time for torrent browsing.

    10:34 Interesting thing I just noticed. Trying to make fancy <?phpconference in a blog title makes wordpress do funny things like simply cutting everything ahead of <? off. Couldn’t you please just escape it? It felt lovely having it there and now my url is all funky.

    10:51 Miha Hribat made a refreshing commercial break for igrajmo.se, whatever that is. Looks interesting, but the talk will be about caching dynamic content. Hopefully we’ll all learn something new even though most of us have probably dealt with this before.

    10:58 MogileFS is an opensource filesystem written in perl that runs on the application level and, apparently, uses everything from the DB, disk system and some other funky stuff to keep data safe and bloody quick to access. Sounds very nice. And now the more interesting part about memory caching – the really important thing when it comes to cache. Oh hey, I just noticed a corporate-approved dry joke. Well done!

    11:03 Yes memcached! The greatest thing since caching was invented and of course, all the big names are using it. Been a while since I played around with this thing, should probably try it again. Miha says the biggest object you can store is 1MB in size and since Twitter complained about having a problem with one of their important objects exceeding 1MB I’m concluding twitter uses memcached as well … oh hey I didn’t know memcached will only keep things for at most 30 days.

    11:35 Anze Znidarsic will be talking about abusing flash+php to make rich internet applications. And he just received a raging applause for giving us a 15 minute break :D Win.

    11:54 Anze is talking about Flash on the internets, what we can and what we cannot do. Personally I hope flash dies a quick death and we shouldn’t be abusing it to do new things like we did with pdf. Sure it’s difficult to make things work the same in every browser, but we don’t HAVE TO. What we need to do is teach users that things won’t look the same everywhere, even native desktop applications don’t look the same on everyone’s computer.

    12:01 According to what is being said I’m really going to need to look into this Flex Builder thing. It’s quite ama

    As Seen on Television album cover
    Image via Wikipedia

    zing how, apparently, you can just design something in Photoshop, export and then just add some working logic and you’re done. Looks incredibly simple and like a very fast workflow. Lovely bit is how I can abuse this lecture to pretty much deal away with half the things I could have said on my talk in a few hours. Brilliant! Thanks Anze.

    12:11 That is a wonderfully brilliant sample app. Basically a project managment tool for girls. Stores girl_id and her status that is one of “Done”, “to-do” or “in progress”. Today is definitely much better than yesterday was.

    14:06 We’re back from lunch and Mr. Somebody, didn’t catch his name, is talking about Comet, which is apparently a method for pushing data from server to client and doing it live. This is something I’ve always wondered about so I’m about to have my wet dream answered.

    14:12 Comet is interesting. Apparently it’s some sort of reverse Ajax and once more isn’t a technology in and of itself (just like Ajax) but an architecture design. HTTP/1.1 allows us to do this crap and even though all of this is starting to make a little sense it’s quite odd. It’s polling, but not polling, or is it polling? Damn, can’t wait for the practical demo. (Oh the guy is Mitja Kramberger, cool guy)

    14:20 There almost seems to be more problems with Comet than it provides solutions. Interesting. Since I’m not actually

    Image of Robert Basic from Twitter
    Image of Robert Basic

    understanding a whole lot of this (thanks @robertbasic for giving that wikipedia link) there isn’t much summation I can do for you blog readers. Sorry. Or maybe I’m just not paying enough attention since nervousity is building up ’cause I’m up next. Whose stupid idea was it anyway to get over public talking anxiety by talking publicly a lot? Idiot.

    14:31 Comet on the server is where it gets really interesting. Traditional server software is #fail because you need man concurrent connections and they’re made to quickly close everything and get on with their lives. Someone should implement an event-based IO, but nobody’s really done anything yet, working on it, just not done. So when somebody DOES make something, will the web be all buzzy and broken and fubar and odd as it was when Ajax first became popular?

    14:35 I was wrong. There are many implementations … makes me wonder why not everyone is doing this just yet like they did with Ajax? Poor gecko browser support? Developer ignorance? What?

    16:00 Wow, I’ve never had so much fun talking in front of a large crowd for 45 minutes before. Not sure what it was, but I simply blabbed my mouth off. There were even questions when I finished! Yay. Anyhow, seems we’ll be listening to Tomaž Muraus talking about the CodeIgniter framework. @anze_znidarsic was right, we should have a large discussion over frameworks and slug it out in the mud.

    16:15 Blahblahblah CodeIgniter, blahblah, use frameworks, blahblah, MVC is awesome, blahblah, frameworks are fast

    or slow … this talk shouldn’t take place as last because it’s going to stick with us too much and it’s quite probably one of the less great we’ve seen these two days. Too bad the organisers can’t tell in advance how interesting someone will be as a presenter. Not everyone of us is Gašper Kozak.

    16:35 Let me give you some quotes from the twitter stream of what’s going on right now.

    {{legend|#ff0000|1930 to 1939}} {{legend|#ff54...
    Image via Wikipedia

    @janhancic zzzzzz

    @alesf: I want to know why should I use CodeIgniter not how.

    @anzerobida: Codelgniter prezentation is really not interasting:( Just waiting for Android!

    @deveti: lahko bi bli kaki praktični “live” primeri uporabe codeigniterja … preveč teorije :/

    and so on. Really, really is a shame this will be last. Those five minute quick persentations better be good and interesting.

    16:55 Lightning talks now, hope they’re as interesting as the barcamp ones usually are. First one … no idea, looks marginally interesting. I like the zen-like slides. Nice and clean, just like my very own barcamp lightning talk a while ago.

    17:04 Apparently at the party last night were two gym trainer people and now they’re here talking about http://www.ls-trenerstvo.si, and by god that’s one hot chick on their frontpage. Since I see one of those guys at the gym all the time, and they happen to be aksing about SEO, would be nice if they could be my trainers and I could be their SEO guy. Hmmm … (that chick is really good SEO by the way)

    17:09 talcho.com is a webservice thingy for chatting and even for gameplaying. They’re supposedly also developing an integrated client for embedding in any website and whatnot. Wonder if they use Comet, should ask when he’s done talking.

    17:13 sweetsurveys.com five minute talk feels a bit silent. Must say I’m choked to see the guy can’t type on a mac keyboard, funny. And I am very impressed they have a certificate that actually shows up as green in firefox! Bravo! But a good pitch this isn’t. Oh well, still seems like a cool enough service I guess.

    17:19 This guy is young, very young. But by god he’s great at just pushing and pushing and pushing his stuff on us. There isn’t a barcamp he doesn’t talk at, there isn’t a conference he doesn’t talk at. He’s gotten better and more fluent too, bravo Jan! Bravo! Anyway he’s talking about ig33k.si whatever that is. Looks pretty.

    I think a few years down the road a shrewd businessman will come out of this curly-haired little dude.

    17:32 Awww, I didn’t win an Android G1. :(

    Reblog this post [with Zemanta]

    Tags: , , , , ,

    Adobe AIR
    Image via Wikipedia

    Some days ago when I was developing a plugin interface for Twitulater I came upon an interesting and seemingly unsolvable problem in the way Adobe AIR brainlessly tries to make everything more secure – eval function simply doesn’t work. Even if you use it, nothing happens.

    Alright so there is no eval for evaluating dynamically created javascript. No problem, I’ll just use some sort of include function Adobe has surely implemented since AIR is supposed to be this awesome development platform and we all know the ability to include files is somewhat paramount to serious development.

    But what’s this? Even in AIR 1.5 there STILL isn’t an include? What the fuck! Ok, sure, I do realise that they provide an include with Flex, but to be honest Flex isn’t exactly something I want to use because the way variable types are postfixed to the variable name fucks with my brain and makes me feel dyslexic. Seriously Adobe, what WERE you thinking there?

    Anyhow, back to lack of eval. Adobe claims that eval is an evil funciton people use to evaluate unverified code from third party API’s and thus make their applications superbly vulnerable to an injection attack. Naturally this is a very valid reservation, but I think the solution is severely flawed since it introduces more problems than it’s worth.

    Basically everything they’ve done is force bad developers to use a JSON interpreter of some sort for their third-party stuff. Which makes sense, it’s a little bit slower than eval, but at least no code gets executed since functions and objects produce errors. Great, no executable third-party code. But did this really solve anything? Oh no wait, bad developers will still open their application up to many security flaws and everyone else is more than slightly inconvenienced.

    I could understand if Adobe at least put a JSON compiler or some sort of dumbed down eval into their javascript API, but no, they just leave us out to dry. And, surprisingly, none of the jQuery include plugins out there actually work, neither does javascript MVC’s include function. At least I haven’t been able to make them work.

    But there is in fact a way to include all files from a certain dir, it’s a very fucking ugly hack and using it made my programming heart convulse in pain. See for yourself:

    	PluginLoader.prototype.loadPlugin = function ( pluginDir )
     
    	{
     
    	        if ( this.shouldLoadPlugin( pluginDir ) )
     
    	        {
     
    	                var files = pluginDir.getDirectoryListing();
     
    	                for ( var i in files )
     
    	                {
     
    	                        var file = files[ i ];
     
    	                        if ( file.extension == "js" )
     
    	                        {
     
    	                                this.loadFile( file );
     
    	                        }
     
    	                }
     
    	                this.addLoadedPlugin( pluginDir.name );
     
    	        }
     
    	}
     
    	PluginLoader.prototype.shouldLoadPlugin = function ( dir )
     
    	{
     
    	        return dir.isDirectory &amp;&amp; dir.name[0] != '.';
     
    	}
     
    	PluginLoader.prototype.loadFile = function ( file )
     
    	{
     
    	        var stream = new air.FileStream();
     
    	        stream.open( file, air.FileMode.Read );
     
    	        var script = stream.readUTFBytes( stream.bytesAvailable );
     
    	        stream.close();
     
    	        document.write( "" );
     
    	}
     
    	PluginLoader.prototype.addLoadedPlugin = function ( pluginName )
     
    	{
     
    	        document.write( "" );
     
    	}

    As you can see it relies on injecting HTML javascript inclusion into the head after itself and thus ensuring AIR evaluates it. If you try injecting in any sort of nicer way like with appendChild or whatnot, it doesn’t work. And the catch is this code has to be run before the document is loaded beyond the head and I think it actually makes AIR spout an error of some sort. But it works.

    Reblog this post [with Zemanta]

    Tags: , ,