CTO, Software engineer and Team leader
Others
How to add Syntax Highlight to WordPress
Jul 2nd
I wrote quite a while ago about How to implement Syntax Highlight in your WordPress blog. It used an forward, yet permanent approach: modify you’re theme’s header.php. But is it enough?
Lately, I wanted to update my blog’s theme to the newest version. But hey! I had a lot of modifications such the one above that kept me from doing a smooth update: BNR Slider, custom images for RSS and Twitter, hints, Syntax Highlight and so on.
The newest solution that I come up with is using a child theme, feature provided by WordPress engine. Basically, you have a theme applied to you blog that you like. Instead of modifying it, you create a new folder in theme’s directory with a special name who’ll be applied OVER your base theme, customizing only the aspects you need. Assuming that your theme’s name is MyFavoriteTheme, you’ll have to create the child theme as MyFavoriteTheme-child.
In order to use your new theme, you’ll have to create in the MyFavoriteTheme-child folder two files:
- styles.css – required – who’ll mark your folder as a child theme
- functions.php – optional – for our example is required, as we’ll write code inside of it
Create a simple HTML .MOV player
May 26th
As a Ruby developer, I work quite a lot with their “special” plugins called gems. The nice fact about the gems is that they bring lots of functionality. By example, there’s a gem for paginating a collection who takes just few parameters and not only that finds out how many objects the collection has, but also how to split them, generating the corresponding links and serving to the original container (that used to show the entire collection) only the collection part that is representative in the context of current page and items per page.
Before someone new to a specific gem starts thinking to implement it, usually searches on the net for examples. The most important gems are described and exemplified in Railscasts.com. The content is excelent, the quality is good, sound is nice but the format chosen for movies is Apple’s .MOV proprietary format. There are few plugins to install for playing the files with MediaPlayer, but frankly I wanted a quicker solution than go on some obscure websites and getting from there a creepy .exe installer.
So I’ve created a simple .mov player that will replace the 33 MB of useless QuickTime Player (if you’re a Mac user, you have already this installed so you’ll not need my hack).
So let’s see some code!
First, I decided to use the Object method in order to play mov files. Apple provides a .cab file, who is able to play this files in browser. More documentation on its parameters you can find in their Embedding tutorial.
Don’t forget to add a link to JQuery library!
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
The html code is shown below and it is pretty straight forward:
<body>
<div class="media">
<div class="navigationTabs">
<input type="text" id="txtURL" style="width:75%"/>
<input type="button" id="btnPlayMov" value="Play"/>
<input type="button" id="btnClearMov" value="Clear"/>
</div>
<div id="divPlayer">
http://media.railscasts.com/videos/188_declarative_authorization.mov
</div>
</div>
</body>
The JavaScript is a little bit trickier as it involves JQuery. For a newbie, it is pretty hard to debug, but after a while you’ll just feel it:
$(function() {
// bind an onClick event for this second Flash container
$("#btnPlayMov").click(function() {
var _height = "306px";
var _width = "400px";
var _movie = $('#txtURL').val();
var _html = '';
$("#divPlayer").html(_html);
});
$("#btnClearMov").click(function() {
$("#divPlayer").html("http://media.railscasts.com/videos/188_declarative_authorization.mov");
})
})
Not to mention that it works in all major browsers (IE 8, FireFox 3.6 and Chrome) !
Research on LASIK
Apr 22nd
When starting such an important process as LASIK surgery (on which your sight is affected) it is crucial to get as many information as you can. You might want to bing it, to Google it and also ask your friends about it. Also discuss with professionals! You never know when you will find someone who already had it and can give their own personal impression.
I found a lot of information on the Softpedia forum, in an interesting article How to "Fix" Your Vision? and a very large list of discussions (in Romanian). I read a lot of advices pros and cons like:
- All about vision: “Choosing the right eye surgeon probably is the single most important step you can take to decrease any risks associated with LASIK. An experienced, reputable surgeon will make sure you are properly screened and let you know up front if you aren't a good candidate for LASIK eye surgery.”
- Presentation of LASIK on Wikipedia
- More about Lasik Technology
- after the surgery I found out the FDA’s opinion on Lasik – it can be fully read under Home > Medical Devices > Products and Medical Procedures > Surgery and Life Support Devices : here ( excerpt from their site: Food and Drug Administration is an agency within the Department of Health and Human Services and consists of centers and offices, which are listed in menu at left. The FDA is responsible for protecting the public health by assuring the safety, efficacy, and security of human and veterinary drugs, biological products, medical devices, our nation’s food supply, cosmetics, products that emit radiation, and tobacco products.)
Among others, FDA presents the main risk factors associated with this operation:
- Blepharitis. Inflammation of the eyelids with crusting of the eyelashes, that may increase the risk of infection or inflammation of the cornea after LASIK.
- Large pupils. Make sure this evaluation is done in a dark room. Although anyone may have large pupils, younger patients and patients on certain medications may be particularly prone to having large pupils under dim lighting conditions. This can cause symptoms such as glare, halos, starbursts, and ghost images (double vision) after surgery. In some patients these symptoms may be debilitating. For example, a patient may no longer be able to drive a car at night or in certain weather conditions, such as fog.
- Thin Corneas. The cornea is the thin clear covering of the eye that is over the iris, the colored part of the eye. Most refractive procedures change the eye’s focusing power by reshaping the cornea (for example, by removing tissue). Performing a refractive procedure on a cornea that is too thin may result in blinding complications.
- Previous refractive surgery (e.g., RK, PRK, LASIK). Additional refractive surgery may not be recommended. The decision to have additional refractive surgery must be made in consultation with your doctor after careful consideration of your unique situation.
- Dry Eyes. LASIK surgery tends to aggravate this condition.
Because during the research I also looked for centers, I found out that in Istanbul there is a clinic named EyeStar or its Romanian version who uses the latest lasers(Wavelight Allgretto 400 hz eye- Q) and technologies to improve vision:
Our laser, the Wavelight Allegretto Wave Eye-Q 500Hz/400Hz. is the newest, fastest, and most advanced FDA-approved eye laser platform on the market. It is reputed for the most precise outcomes, and the highest level of safety and patient comfort.
Another argument pro was that a former colleague ,with whom I’ve worked in Alensa, had the same LASIK for myopia in this clinic and she was very happy about her choice. Also I liked very much their care for their clients: lifetime warranty for the operation, included transportation to and from the clinic, help in your native language (native English, German, Bulgarian, Japanese, French, Italian, Romanian, Russian, Turkish, Spanish).
Next, I’ll present to you the Discussions with Patient coordinators.
How to generate image_src for Facebook links in WordPress theme
Feb 18th
Sharing your article for free advertisement on Facebook is a fact. While using different Social Networks sharing tools I had a problem when sharing my articles on Facebook: sometimes the image that I intended to use to represent the article wouldn’t show in the list of the images who can be chosen. Why is that?
It bothered me some while I got the some free time to actually look into this, between exams, work and master research. After some wandering on the internet, I found here the correct directions. What I learnt: Always search for the API!
In order to make sure that the preview is always correctly populated, you should add the tags shown below to the <head> element in your HTML code. If you don’t tag your page, Facebook Share will grab the title of your page as specified in the <title> tag, and will create a summary description from the first text that appears in the body of your page. A list of thumbnails will all be selected from available images on your page.
You can control the exact title, description, and thumbnail that Facebook Share uses by adding the following meta tags to the <head> element in your page:
<meta name="title" content="title" /> <meta name="description" content="description " /> <link rel="image_src" href="thumbnail_image" / >
Technorati checks my blog
Nov 25th
So I applied for Technorati enrollment and they gave me the KNQ3S98TZ58S token for verification. I have to just create a new blog entry and publish in it to verify my domain claim. That’s the price to get into their area.
Enjoy!
How to add a nice jQuery slider
Nov 15th
This weekend fun was adding to my website the cool sliding control from Jérémie Tisseau website. That pretty it was, I immediately started thinking it as a container to my BNR exchange rate page. The coded worked perfectly, with few modifications.
Firstly, WordPress uses the $ operator for Prototype library, so if you want to add your jQuery library the invocation to WordPress Firebug will report the error “$ is not a function”. So here’s the fix: you’ll have to change any occurrence of the $ sign to jQuery. Just like in the following example:
$(document).ready(function() {
// Expand Panel
$("#open").click(function(){
$("div#panel").slideDown("slow");
});
// Collapse Panel
$("#close").click(function(){
$("div#panel").slideUp("slow");
});
// Switch buttons from "Log In | Register" to "Close Panel" on click
$("#toggle a").click(function () {
$("#toggle a").toggle();
});
});
TO:
jQuery(document).ready(function() {
// Expand Panel
jQuery("#open").click(function(){
jQuery("div#panel").slideDown("slow");
});
// Collapse Panel
jQuery("#close").click(function(){
jQuery("div#panel").slideUp("slow");
});
// Switch buttons from "Log In | Register" to "Close Panel" on click
jQuery("#toggle a").click(function () {
jQuery("#toggle a").toggle();
});
});
How to add a Webslice
Sep 15th
It is very nice and user-friendly to have Webslices on your website. It improves the user experience by allowing visitors to be up to date with the latest content that you provide, assuming that it is fitted to this presentation style. Since my BNR exchange rates page was this kind, I pursued in adding a Webslice especially for it.
Adding a webslice to your website is simple. After you read the main specifications or my previous article, you’ll understand the concept behind: first you signal to the browser that you have a special part of your website by setting to a container element the class “hslice”:
<div id="BNRExchange" class="hslice">
<div style="display: none" class="entry-title">
<img id="image" alt="Radu Poenaru's weblog gives you BNR Exchange rates" src="http://www.radupoenaru.com/bnr/images/radupoenaru.jpg" width="128" height="128" />
<p>
Cursul oficial BNR
</p>
</div>
<p>
<a style="display: none" href="http://www.radupoenaru.com/bnr/bnr.php" rel="entry-content">
<a style="display: none" href="http://www.radupoenaru.com/bnr/bnr.php" rel="Bookmark" target="_blank">
<span style="display: none" class="ttl">5</span>
</p>
<div id="updateTrigger" class="entry-content" runat="server" />
........ your content that you want surrounded by the green webslice part ..............
</div>
WordPress – Database backup and restore
Sep 13th
From time to time, you’ll need to get a backup of your MySQL database and install it on a different machine – as I needed when reinstalling my Windows 7. I wanted to do something simple, as the last time. But now the database sql file is 11 Mb as opposed to merely 2 MB last time.
But I thought that this would be a breeze for the MySQL interface that I use and enjoy – HeidiSQL. It’s free, easy to use and user friendly. I personally don’t like too much the phpMyAdmin interface from the Vertrigo webserver installation that I use for local development.
Add Webslice to your website
Sep 11th
You might ask: what is a Webslice? It is a chunk of information, allowing you to stay up-to-date with the latest news without actually needing open a website. They are added to special toolbars (special because they usually require a specific version of a browser, like IE 8). But otherwise, the content inside itâ??s just plain old HTML. When a WebSlice is added to the toolbar, it will be represented as a clickable drop-down area, allowing you to click on it and then see a specially designed small-scale version of the website. For example, my website provides a webslice for BNR exchange rates , allowing you to keep up with latest information available.
Usually, while hovering to an area webslice-enabled, the browser will show a specific icon â?? developed by Microsoft and symbolizing this technology. There are few design guidelines that you need to follow, quoted from Microsoft website :
WordPress – How to Delete Existing Post Revisions
Sep 9th
This is the second part of managing WordPress feature of post revisions, for the users who had disabled or turned off post revisions tracking or versions history feature. As you already know, this feature exists in WordPress (starting with WordPress 2.6). After disable it (of course, if you really need to do that), it also make sense to also delete and remove all existing stored post revisions. By doing so, you’ll remove changes made on pages stored in the database such that you’ll slim down the wp_posts table size´. This is especially recommended when there is already lots of revisions or changes inside.