Category ArchiveProgramming
Category ArchiveProgramming
jQuery & Internet & Programming Daantje on 26 Aug 2011
It’s a little jquery patch I wrote after I found this post. I think this works better…. and in all browsers… Just copy it somewhere after the DOM is ready. (jquery.ready())
What the problem is; :hover is a css pseudo selector, but a event state in Javascript. (Or some thing like that…) So it only gives the right color on mouse over. Only than the selector is valid.
The fix is simple; rebuild the element on mouse over, so you find the right color. The rebuild has only to be done the first time you role over it. And after reading the Typeface-js source, I found the render method hack to fix the un-rendered text element in the new color. Done is my mesh up. Have fun with it.
$(".typeface-js a,a.typeface-js").hover(
function(){
if(!$(this).hasClass('typeface-js-hover-checked')){
$(this).wrapInner('<span class="typeface-js-normal"></span>').append($('<span class="typeface-js-hover"></span>').text($(this).text()).css('color',$(this).css('color'))).addClass('typeface-js-hover-checked');
_typeface_js.renderDocument();
}
$(this).find('.typeface-js-normal').hide();
$(this).find('.typeface-js-hover').show();
},
function(){
$(this).find('.typeface-js-normal').show();
$(this).find('.typeface-js-hover').hide();
}
);
jQuery & Fun & Programming Daantje on 08 Apr 2011
I’ve made my first jQuery plugin :) It’s called jSpeaker. It will read text that’s within a selected object. It uses the google translate speak/listen function. Check the jquery plugin page or the project page form more info, samples and documentation.
Frustrations & Windows & Programming Daantje on 09 Mar 2010
I found a real strange bug. A client of mine has two sites. One I host, the other is hosted by a 3th party. Now the client has a domain control panel for the other site and rerouted the other domain to the one I host, but the system just makes a frameset. Not real SEO, but okay. After a few days bug reports came in. Can not log in etc. Can only be the sessions? But after testing I found that the bug only appears in Internet Explorer (tested only 8) and only on the rerouted domain, not the one I host. Fix was easy. Just added a little javascript to break out of the top frameset and everyting was working again. I think it’s Microsoft’s Phishing filter that is kicking in, but have to test further.
Here’s my litte fix: :-)
if(top.frames.length){
top.location.href = self.location.href;
}
PHP & Programming Daantje on 15 Feb 2010
Found bug in ezpdf (009) when using sessions and an older php 5.2.0 version. Loose the session and pdf file will parse correctly. Strange that this bug is not appearing with php 5.2.6
jQuery & PHP & Programming Daantje on 10 Jun 2009
I’m now busy with writing a filter, to grep data out of an large based HTML website, build back in the old days. Luckily they’ve used class names to point out the right table cells. I thought it would be a great job for jquery… But server-side… Could it be possible?
After some googling I found this very interesting blog post: “Bringing the Browser to the Server“. A real great way to use a javascript lib like jquery or prototype server side!
I use PHP to grep the HTML and transfer it to valid XHTML so I can use it in rhino.
./html2xml.php [path/to/file.html]
#!/usr/bin/php -q
<?php
$doc = new DOMDocument();
$doc->loadHTMLFile($argv[1]);
$html = $doc->saveXML();
$html = str_replace('<script','<noscript',$html);
$html = str_replace('</script','</noscript',$html);
echo $html;
?>
Than I use jquery to grep all data and do an ajax request to a PHP file to insert the data into a database.
After some testing, my scripts only work wit an older version of jquery. I use 1.2.6, the later ones all give errors…
I’ll try to post more info and code later ;) Check my tweets for info too!
Internet & MacOS & Programming Daantje on 27 Jun 2008
It’s only easy with this Adobe Photoshop plugin. It’s a free and open source plugin available for Adobe Photoshop CS2 and CS3 for MacOSX and Windows. Also it works on PaintShop Pro.
To make a transparent favicon, just design your icon (32 x 32 pixels) with a transparent background. Resize your image to 16 x 16 pixels and choose ‘Save for the web’ and save the image as a GIF, with transparency on (duh!). Now reopen the GIF file and choose ‘Save as…’ and save it as a Windows Icon (.ico) file. And your done.
For an other way to do it on MacOSX with the free app ‘Graphic Converter’, check my older post ‘how-to-make-a-faviconico-on-macos-x‘.
Programming & Personal Daantje on 18 Apr 2008
I was so busy for the last few months! So here is an update about the stuff I was doing the last few months. I’m building a new online web store for the chopperdome that is completely linked to there Exact Globe 2003 administration/accounting system. A lot of work! Also bought a HTC Touch Cruise four weeks ago. Will post some hacks and applications I’ve found use full in the next few weeks. Also bin busy with jQuery. A javascript lib that rules! I use it now for about 6 months and I do everything with it! Check a site I build with only jQuery: jolet.eu Bought a new laptop, a MacBook Pro. Will also post some hacks and apps when I find the time ;) Have a windows partition on it of 20 Gb. Was 5 Gb… To small for my Visual Studio installation. So had to expand it. That is not a great idea to do when you don’t use time machine!! Have Parallels on it for now, but I think that VMware Fusion is a better plan to buy… Have to check some speed tests. That is it 4 now. I promise I will post some kewl stuff soon ;)
Frustrations & Windows & Tech & Programming Daantje on 13 Jun 2007
So, I start with this; please don’t use MSIE 6.0, it is a disaster for web developers! Now, this is what I ran in to last night, a bug in MSIE 6.0. Every item with a transparent PNG as background image, done with the CSS hack/workaround (AlphaImageLoader filter) and the sizingMethod set to scale, all the child objects are locked. Nothing works anymore! No more forms, no more hrefs, no text select, no nothing… I spend 5 hours last night searching the web to solve this problem! (Send the bill to Bill?)
The solution is, or rather the bug is: When the width OR height of the dimensions of the transparent 24bits PNG image is less than 64 pixels, and the sizingMethod set to scale, the bug appears.
If that is not a bug… Please remove all your copies of MSIE 6.x and use a more developer friendly browser like Firefox. Or if you feel the need, upgrade to msie 7.0. IE 6 is a developer nightmare!
Internet & Fun & Tech & Programming Daantje on 11 May 2007
Get lost in this site! This is realy cool for every hardware and web developer! This guy makes cool stuff! The site is dhtml and not flash! I repeat, not flash! I did somthing of the same stuff on this site.
Linux & Tech & Programming Daantje on 07 May 2007
Revised version: Tue March 10, 2009
We use an Axis 206w and a 207w webcam at work. This camera has an build in webserver that serves an MJPEG (Motion JPEG video) stream. Later cams servers also MPEG4 streams, but the 206w doesn’t. It has an buildin .swf feed, but that one does not work on my browsers. Now I have a work around to use swf files. What I do is using FFmpeg to convert the MJPEG feed to swf and flv. I use a separate server, not the build in one on the cam!
(Just for explanation; 10.0.0.1 is my server and 10.0.0.106 is my camera)
What I did to make it all work… Installed the latest ffmpeg. (Downloaded the source, compiled it (./configure;make;make install;) Or on Debian Lenny I used the ‘unstable’ packages. (FFmpeg version 0.5-svn17737+3:0.svn20090303-1) I’ve tried older versions, even the ’stable’ Lenny version, but the swf would not load every time in my browsers. So when you have a good ffmpeg and ffserver, then comes the real trick… Configure your ffserver. Edit /etc/ffserver.conf , use this source:
# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
Port 8090
# Address on which the server is bound. Only useful if you have
# several network interfaces.
BindAddress 0.0.0.0
# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000
# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000
# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000
# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon
<Feed feed1.ffm>
File /tmp/feed1.ffm #when remarked, no file is beeing created and the stream keeps working!!
FileMaxSize 200K
# Only allow connections from localhost to the feed.
ACL allow 127.0.0.1
</Feed>
# SWF output - great for testing
<Stream test.swf>
# the source feed
Feed feed1.ffm
# the output stream format - SWF = flash
Format swf
# this must match the ffmpeg -r argument
VideoFrameRate 5
# another quality tweak
VideoBitRate 320
# quality ranges - 1-31 (1 = best, 31 = worst)
VideoQMin 1
VideoQMax 3
VideoSize 640x480
# wecams don't have audio
NoAudio
</Stream>
# FLV output - good for streaming
<Stream test.flv>
# the source feed
Feed feed1.ffm
# the output stream format - FLV = FLash Video
Format flv
VideoCodec flv
# this must match the ffmpeg -r argument
VideoFrameRate 5
# another quality tweak
VideoBitRate 320
# quality ranges - 1-31 (1 = best, 31 = worst)
VideoQMin 1
VideoQMax 3
VideoSize 640x480
# wecams don't have audio
NoAudio
</Stream>
<Stream stat.html>
Format status
</Stream>
<Redirect index.html>
# credits!
URL http://ffmpeg.sourceforge.net/
</Redirect>
Now your done with your ffserver configuration. Now make a little shell script to start your converter. It uses cCurl Wget to get the stream from the camera. But it could also be done with a php or perl script that opens a socket and parses the content to stout. Curl does that real fast, so I use that. Curl breaks some frames, I use wget now. I’ve made some crude scripts to keep the server up, even when something goes down. I’ve noticed that the server sometimes stops without warning. That is the reason I don’t use the ffserver in daemon mode. Also change the port 8090 when you have some other service running on that port, like OpenERP… (That was my first mistake ;)
Make a file called ’stream.sh’ and put the following source in:
#!/bin/bash while [ 1 ] do wget -nv -O - http://10.0.0.106/axis-cgi/mjpg/video.cgi | ffmpeg -er 4 -y -r 5 -f mjpeg -i - http://127.0.0.1:8090/feed1.ffm done
You can change http://10.0.0.106/axis-cgi/mjpg/video.cgi?resolution=320×240 to your own URL.
Now create a file server.sh and put this in:
#!/bin/bash while [ 1 ] do ffserver done
Now change the mod of the scripts so you can start them…
chmod +x stream.sh server.sh
And now your done, just start the the script with nohup so the process keeps running after you close your terminal…
nohup ./server.sh > /dev/null & nohup ./start.sh > /dev/null &
If you don’t use nohup, the converter parses all messages to stout. Easy for debugging ;)
Now just point your browser to your ffserver :
http://10.0.0.1:8090/test.swf
And it should work! Open a bottle of beer!
Here’s our webcam, viewing Alkmaardermeer, Akersloot, the Neterlands.
Purchase Cheap Oem Adobe Flash Professional Cs5 In German
Buy Microsoft Windows 7 Ultimate Sp1 Online Microsoft Office 2010 Visio Premium Online Purchase Adobe Dreamweaver Cs5 Online Oem Adobe Dreamweaver Cs5 In German Online Purchase Microsoft Windows Vista Ultimate Sp1 Online Purchase Discounted Microsoft Office 2008 For Mac Online Purchase Adobe Creative Suite 4 Design Premium Buy Cheap Adobe Photoshop Lightroom 3.2 In German Online Buy Cheap Adobe Photoshop Cs3 ExtendedBuy Cheap Oem Microsoft Office 2004 Pro For Mac
Buy Discounted Oem Adobe Creative Suite 5.5 Master Collection
Purchase Discounted Oem Microsoft Office 2003 Professional Edition Purchase Cheap Adobe Photoshop Cs3 Extended Online Cheap Oem Adobe Fireworks Cs4 For Mac Discounted Oem Adobe Acrobat 8 Pro For Mac Online Purchase Discounted Adobe Creative Suite 5.5 Master Collection Multilanguage Online Purchase Cheap Adobe Premiere Pro Cs5.5 Online