Technology easy as ABC

Posted on July 9th, 2008 in pub, tech, web | 1 Comment »

ABC

How many do you recognize ?

via…

How to remove Yahoo messenger ads

Posted on April 20th, 2008 in tech | 2 Comments »

Old topic but always usefull.

The “hard way”:

Removing the Ad from the bottom of the main Yahoo! Messenger window

1. Open “%Programfiles%\Yahoo!\Messenger\YahooMessenger.exe” file into a Hex Editor.
2. Locate the offset 3981AC and change the string “enabled” to anything you want.
3. Save and Exit.
Remove Ads from chat window, webcam, etc.

1. Open notepad and paste the following code:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\yahoo\pager\YUrl]
“First Login Beacon”=”*”
“Tutorials”=”*”
“Messenger Help”=”*”
“Voice General Help”=”*”
“Change Room Banner”=”*”
“Address Book”=”*”
“Finance Disclaimer”=”*”
“Messenger Ad”=”*”
“Chat Adurl”=”*”
“Calendar Alert Ad URL”=”*”
“Conf Adurl”=”*”
“Mail Alert Ad URL”=”*”
“News Alert Ad URL”=”*”
“Personals Alert Ad URL”=”*”
“Stock Alert Ad URL”=”*”
“Webcam Viewer Ad Medium”=”*”
“Webcam Viewer Ad Big”=”*”
“Webcam Viewer Ad”=”*”
“Webcam Upload Ad”=”*”
“Chat Transition Ad”=”*”
“N2Phone Adurl”=”*”
“Webcam Viewer Ad Bid”=”*”

2. Save the file with any name and give the extension as .REG
3. Run the file.

The easy way:

There is also another Y!Msgr ad removal tool Yahoo! Messenger AD-Remover New 2 Patch (download link) which patch the YahooMessenger.exe and edit some registry values. After patch, the flash ads on the main windows will be removed completely.

P.s. soultions tested vor versions lower than 8.1.0.421 (including)

Firefox memory usage

Posted on April 17th, 2008 in tech | 3 Comments »

…5 mins ago!

How to save a youTube video to your computer.

Posted on April 16th, 2008 in tech | No Comments »

Ok there are several possibilities to download a video from youTube, Google video, or any video sharing site. Here are 2 of them:

  1. Using Mozilla Firefox’s cache. First find out where the browser stores the cache files by typing “about:cache” in a new Firefox tab. Then open the video that you want to save to your computer in a new tab. When the video starts Firefox begins writting a cache file to the previous found folder. After the video is completly loaded you should just copy the file from the cache folder (beware at the creation timestamp!), give it a “.flv” extension and you are ready to go.
    This option has a big fault, and it seems that the Mozilla developpers wont fix it. The browser wouldnt create cache files larger than ~67 Mb and the user can’t change that limit. The size of the whole cache folder can easily be changed to any value by going to Firefox’s Tools>Options>Advanced menu. (the default value is 50 Mb)
  2. Using Download Helper - a Mozilla Firefox Add-on that enables you to get virtualy any video/picture from almost any site. A minor disadvantage of this add-on is that it only lets you download one file at a time, butt I still preffer this way of getting stuff from video sites.

For playing .flv files I recommand Real’s Real Player

MacBook PRO

Posted on April 15th, 2008 in tech | 1 Comment »

Behold the holy Grail!

Starting at €1800 (USD amount) more …. here

You could get a notebook with similar specs. at around €1200 (USD amount). Wonder if it worths the extra €600 (USD amount).

Uploading a file into a database with JSP

Posted on April 11th, 2008 in Uncategorized | No Comments »

These days I’ve came uppon the problem of uploading an image to a web server and save it into a database as a Blob field with JSP. After some research and some experiencing on my own the solution that worked for my case looked like this:

  • The upload form:
  • <form method=post action="includes/upload.jsp?imgId=<%=iNumPhoto%>"
    name="upform" enctype="multipart/form-data">
    
    onchange="LimitAttach(this.form, this.form.uploadfile.value)">
    

    Where “iNumPhoto” is a parameter that i use when i need to overwrite an image (it’s set to -1 when the image is new), and “LimitAttach” is a JavaScript function that limits the types of file that can be submited trough my upload form.

  • “LimitAttach” function:
  • The Jsp file looks like this:
  • 
    
    <%@ page import="java.io.DataInputStream" %>
    <%@ page import="java.io.FileOutputStream" %>
    <%@ page import="java.util.Hashtable" %>
    
    <%
    String iNumPhoto = request.getParameter("imgId");
    String contentType = request.getContentType();
     if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
       DataInputStream in = new DataInputStream(request.getInputStream());
       int formDataLength = request.getContentLength();
       byte dataBytes[] = new byte[formDataLength];
       int byteRead = 0;
       int totalBytesRead = 0;
       while (totalBytesRead < formDataLength) {
           byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
           totalBytesRead += byteRead;
        }
       String file = new String(dataBytes);
       String saveFile = file.substring(file.indexOf("filename=\"") + 10);
       saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
       saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1, saveFile.indexOf("\""));
       int lastIndex = contentType.lastIndexOf("=");
       String boundary = contentType.substring(lastIndex + 1, contentType.length());
       int pos;
       pos = file.indexOf("filename=\"");
       pos = file.indexOf("\n", pos) + 1;
       int boundaryLocation = file.indexOf(boundary, pos) - 4;
       int startPos = ((file.substring(0, pos)).getBytes()).length;
       int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
       FileOutputStream fileOut = new FileOutputStream(saveFile);
       int imageSize = endPos - startPos;
       byte[] imgBuffer = new byte[imageSize];
       byte[] width = new byte[4];
       // Calculate width from byte position 17 to 20 of PNG header
       System.arraycopy(dataBytes, startPos + 16, width, 0, 4);
       Integer myWidth = (width[0] * 16 * 3) + (width[1] * 16 * 2) + (width[2] * 16) + width[3];
       System.arraycopy(dataBytes, startPos, imgBuffer, 0, imgBuffer.length);
       Hashtable< Integer, Object> messageImages = message.getMessageImages();
       if (!iNumPhoto.equals("-1")) {
       Integer idPhoto = Integer.parseInt(iNumPhoto);
       MessageImage messageImage = (MessageImage) messageImages.get(idPhoto);
       if (!myWidth.equals(messageImage.getWidth())) {
       out.print(" The selected image has an invalid width! Please select a valid one! (width = "+myWidth+")");
                    out.print("");
                    //todo send error
                } else {
                    messageImages.remove(idPhoto);
                    messageImage.setWidth(myWidth);
                    messageImage.setData(imgBuffer);
                    messageImages.put(idPhoto, messageImage);
                    message.setMessageImages(messageImages);
                    out.print(" Image replaced! (width = "+myWidth+")");
                    out.print("");
                }
        } else {
             MessageImage newImage = new MessageImage();
             newImage.changeMandatoryValues(new String[]{"id", "messageId"}, new String[]{"-1", message.getId()});
            newImage.setWidth(myWidth);
           newImage.setData(imgBuffer);
           messageImages.put(-1, newImage);
           message.setMessageImages(messageImages);
    %>

    The tricky part was getting separated the byte-array containing the image, from all the data sent by the upload form (yes the form doesn’t send only the file). After that all easy, even figured out how to get the image width. I’m using a bean called “message”, and the “saving into the database” part is done by passing the byte-array to the bean where all the data-base related operations take place.

    Posting source code in WordPress

    Posted on April 10th, 2008 in programming | 1 Comment »

    ….Googled it!

    First atempt: Ended up here, tried [sourcecode language='css']…[/sourcecode] and got no result. (guess that this works only for wordpress.com users….no harm done)

    At a second try: got a plugin here (syntaxhighlighter Google Code project by Alex Gorbatchev). Copied it to my server into the wp-content/plugins, activated it from the wp-admin and… that’s it. It works like this: Place your code on the page and surround it with < pre > tag. Set name attribute to code and class attribute to one of the language aliases you wish to use. Works for: XML/HTML, C++ (cpp, c, c++), C# (c#, c-sharp, csharp), CSS (css), Delphi/Pascal (delphi, pascal), Java (java), Java Script(js, jscript, javascript), PHP (php), Python (py, python), Ruby (rb, ruby, rails, ror) , Sql (sql), VB (vb, vb.net ).
    After playing around a bit with the style my first try looked like this:

    if($you_can_see_this)
                echo "syntaxhighlighter works!";
    

    So from now on i will post pieces of code that trigger my attention.

    W3C Has Published HTML 5

    Posted on April 9th, 2008 in programming | No Comments »

    January 22nd 2008: W3C published a working draft for HTML 5. The HTML 5 working group includes AOL, Apple, Google, IBM, Microsoft, Mozilla, Nokia, Opera and many hundred other vendors.

    Some of the new features in HTML 5 are functions for embedding audio, video and graphics, client-side data storage, and interactive documents. Other features are new page elements like <header>, <section>, <footer>, and <figure>.

    HTML 5 improves interoperability and reduce development costs by making precise rules on how to handle all HTML elements, and how to recover from errors.

    See full HTML 5 Reference