Thinnest, Slickest and most Sexy eReader

0

Posted by Alex | Posted in , | Posted on

Lately it seems not a day goes by without a new manufacturer jumping out of the shadows to announce something new. An today is not an exception !


At the Hong Kong Electronic Fair last week, Boeye a company from Shenzhen announced a brand new ereader device dubbed E501. It supports a totally legit 16 grayscale level for an e-Book. It has a 5.0-inch 800×600 E-ink display, and a dazzling design:


According to Boeye website, it seems there’s more to come since they display 3 more devices. The first one is named E500 and it is a 5“ model (sibling to the E501??), the second is named E600 with a 6” screen, and finally the E900 which is as you guess ... a 9“ reader:




All of them seem to sport 16 grayscale level eink screens, and able to read a flurry of formats: TXT/PDF/CHM/EPUB/PPT/HTML/XLS/DJVU/TIFF/DVI/POSTSCRIPT.

There’s no mention of any price nor availability those. More to come later if I can find more information on those nice and shiny toys.

[Source]
AddThis Feed Button HaoHao This

Edit your blogger template

0

Posted by Alex | Posted in , | Posted on


I'm going to describe here the simple step to manually edit your blogger template. This is very useful if you want to manually change your theme, CSS, or simple add custom external widgets.

First thing to do is to log on your blogger account and go to your Dashboard. Once there you go to "Layout" and then "Edit HTML". Finally don't forget to tick "Expand Widget Templates"




And that's it.

From there, you can do several things. First thing you SHOULD really do before any modification is to backup your template. Actually even if you don't plan to do any modification, it's a good practice to have a backup of your template, just in case.

You can also edit your CSS, or install a new template, or add new widgets.

That's all for this little how to.
AddThis Feed Button HaoHao This

How to get Adsense ads more relevant to your site content

0

Posted by Alex | Posted in , , | Posted on

Adsense is a great tool to generate revenue on your pages, and very easy to use. A couple of click and editing into your site or blog (widget installation maybe), and you're good to go.

But you may have noticed that something the ads displayed on your site by Adsense, are not that relevant, it not totally out of it. The reason why this happens, is because, Adsense just like Google (the search engine side of the business ;) ) uses bots to crawl on your site and analyze its content. Up to here nothing that you wouldn't expect. The catch is, everything that is on your site may not always be relevant content, and those bots have no way to identify what is and what's not.

Naturally, the trick would be to be able to "guide" those bots in the right direction and clearly indicate the content they have to consider. This can be done with the help of two specific tags that you need to include into the code of your site. If you have a blog, that's around the body of your article, any part, box, div, etc.. that wraps what you want to be indexed. Those two tags are and .

The explanation that follow are a bit specific to blogger since that's what I'm using, but the general procedure is similar whatever the blog or site.

So in blogger you have to edit your template. If you don't know how to edit your template your can check this article. Now that you're editing your template you want to start searching the following:

<data:post.body> 


And replace it with:


<!-- google_ad_section_start-->
      <data:post.body/>
<!-- google_ad_section_end --> 


Here you notice that we point for Adsense the content we want to be used for your ads. Now you want want to do the opposite instead, that is point to the sections you don't want to be considered. In order to do that you have to wrap the content to ignore the same way we wrapped the post's body above:

<!-- google_ad_section_start(weight=ignore)-->
Your content to ignore goes here
<!-- google_ad_section_end -->

And That's it. It is as simple as that. One important note is, the change in your ads won't be immediate, and it may take up to two weeks for the change to actually reflect in the content of your ads.

I hope this will be useful to you, don't hesitate to drop me a line if you that post helped you.



AddThis Feed Button HaoHao This

Related post plugin for blogger

0

Posted by Alex | Posted in , , | Posted on


Since I started using blogger, I've always wondered why this feature is not present by default. To me having a list of related post is very important, because that's a nice way to put forward more relevant content to you dear reader ;)

So i've search on internet, and found a flurry of so called plugin or widget. The most common one seems to have been written by Hoctro. But none of those never really satisfied me.

As a result I decided to write my own using a bit of Ajax query to make everything smooth and nice. The result is a plugin that display on articles pages (not on the front page for now) a list of post related to the current one. It is relying on the post labels and the google API to display thoses.

And here it is:

<b:if cond='data:blog.pageType == &quot;item&quot;'>

<div class='similiar'>

 <div class='widget-content'>
  <div id='relatedPosts' /> <br/>
  <div expr:id='&quot;relatedPosts_&quot; + data:post.id'/> <br/>

  <script type='text/javascript'>

  var blogURL = &quot;<data:blog.homepageUrl/>&quot;;
  var maxNumberOfLabels = 10;
  var nPost = 0;
  var maxPosts = 5;
  var numLabel = 0;
  var receivedResult = 0;

  var outputDone = false;

  var txt = document.createTextNode(&quot;You may also want to read:&quot;); 
  var ul = document.createElement(&#39;ul&#39;);
  var labelRelatedPost = document.createElement(&#39;h3&#39;);
  labelRelatedPost.appendChild(txt);
  var postsFound = [];

  function listEntries(result, postID) 
  { 

   var json = JSON.parse(result);

   receivedResult = receivedResult+1;

   // calculate the number of remaining post to add to the list
   var RemainingPosts = (maxPosts - nPost);
   var nPostToParse = (json.feed.entry.length &lt;= RemainingPosts) ? json.feed.entry.length : RemainingPosts;

   for (var i = 0; i &lt; RemainingPosts; i++) {
    var entry = json.feed.entry[i];
    if(entry)
    { 
     var postURL;
     var title = entry.title.$t

     // parse the link array to find the post URL
     for (var k = 0; k &lt; entry.link.length; k++) {
      if (entry.link[k].rel == &#39;alternate&#39;) {
       postURL = entry.link[k].href;
       break;
      }
     }

     // check the post is not the same as the current post
     if (postURL != location.href) 
     {
      if (postAlreadyKnown(postURL) == false)
      {
       nPost++;

       //alert("Other post found "+nPost);
       var li = document.createElement(&#39;li&#39;);
       var a = document.createElement(&#39;a&#39;);
       var txt = document.createTextNode(entry.title.$t);
       a.href = postURL; 
       a.appendChild(txt);
       li.appendChild(a);
       ul.appendChild(li);   
      }


     }
    }

   }

   // check if everything's been received
   if (receivedResult == numLabel ) {
    if (outputDone == false &amp;&amp; nPost &gt; 0) 
    {
     outputDone = true;
     var relatedPostSection =  'relatedPosts_'+postID;
     var relatedDiv = document.getElementById('relatedPosts_'+postID);
     if (relatedDiv) {
      relatedDiv.appendChild(labelRelatedPost);
      relatedDiv.appendChild(ul);
      
      //
      var providedBy = document.createElement(&#39;h5&#39;);
      var em = document.createElement(&#39;em&#39;);
      var a = document.createElement(&#39;a&#39;);
      a.href = "http://xiuxixiuxi.blogspot.com/2009/10/related-post-plugin-for-blogger.html"
      var txt = document.createTextNode("Provided by XiuxiXiuxi");
      a.appendChild(txt);
      em.appendChild(a);
      providedBy.appendChild(em);
      relatedDiv.appendChild(providedBy);
     }
    }
   }

  }

  function postAlreadyKnown(postURL) {
   for(var i= 0; i &lt; postsFound.length;i++)
   {
    if(postsFound[i] == postURL) 
    {
     return true;
    }
   }
   postsFound[postsFound.length] = postURL;
   return false;
  }

  function searchQuery(query, label) {

   var script = document.createElement(&#39;script&#39;);


   var xhr = new XMLHttpRequest();
   xhr.onreadystatechange = function() {

    if (xhr.readyState == 4) {
     // Your callback code goes here
     listEntries(xhr.responseText, &quot;<data:post.id/>&quot;);
    }
   }
   xhr.open(&#39;GET&#39;, query+ &#39;feeds/posts/default/-/&#39; + label + &#39;?alt=json&#39; , true);
   xhr.send(null);
  }



  <b:if cond='data:post.labels'>
  <data:postLabelsLabel/>
  <b:loop values='data:post.labels' var='label'>
  var textLabel = &quot;<data:label.name/>&quot;
  //alert(textLabel);
  if (numLabel &lt; maxNumberOfLabels) {
   searchQuery(blogURL, textLabel);
   numLabel++;
  }
  </b:loop>
  </b:if>
  </script>
 </div>
</div>
</b:if>

Now where to put that code. You need to edit your blog layout.To do that, go to your blogger dashboard and click on "Layout", click on "Edit HTML", and click on "Expand Widget Templates". Now search for:

<data:post.body> 

and paste the code above just after that.

And your done.


AddThis Feed Button HaoHao This

Code Syntax Highlingting plugin

0

Posted by Alex | Posted in , , | Posted on


If you post any source code on your blog (site) and want to have some syntax highlighting like this on your website then this posts is for you:

alert("Hello World");
 // Example of code


I will concentrate here on how to set it up for blogger but it's basically vadid for any website. More details on that at the end of the post. But let's talk about the plugin a bit.


Supported Languages

This plugin at the time I'm writing this article supports the following languages:
  • ActionScript3
  • Bash/shell
  • C#
  • C++
  • CSS
  • Delphi
  • Diff
  • Groovy
  • JavaScript
  • Java
  • JavaFX
  • Perl
  • PHP
  • Plain
  • PowerShell
  • Python
  • Ruby
  • Scala
  • SQL
  • Visual Basic
  • XML (as well as xslt, html, xhtml)
Not bad heh ;) And there are much much more which haven't made they way to the official package.

Installing the plugin

In order to set this up you will have to edit your template layout. To do that, go to your blogger dashboard and click on "Layout" and then click on "Edit HTML", and search for:

]]></b:skin>

and paste the following code.

<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css">
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css">
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript">
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'/>
<!-- add brushes here -->
<script type='text/javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>


Using the plugin

Once you've completed previous step, all you have to do is to start writing a post, and when you have to put some code, switch to the "Edit HTML" tab and use pre tags as follow:
<pre class="brush: js">
 <!-- Your code goes here -->
</pre>

You need to change the language code (in this case js) to match the language you want to highlight.

Make sure to replace all instances of < with &lt;.

Don't worry if your text looks funny in the "Compose" tab, it's going to be fine when you few the post normally.

Where to know more about it: 

This little baby is named SyntaxHighlighter ans it is the fruit of several years of Alex Gorbatchev efforts. You can find more on his website. You will find there the full list of scripts you can include to get syntax highlighting for different languages. There's also different theme css.


I hope this will be useful to you as well.
AddThis Feed Button HaoHao This

2 greats tools to develop and test regular expressions

0

Posted by Alex | Posted in | Posted on

Regular expression are a very powerful tool that every developer should know, use, and I'd even dare say abuse. But just because they are useful doesn't mean they are easy to use and master. It can even be rather painful to develop and test them.

This is mostly due to the lack of good tools to help test regular expression. By lack I mean that there is not a lot, but there's two that I've found pretty useful and up to the task.

Expresso

Expresso is a very need piece of software that allow you create test, and debug your regular expression. It has everything one may want to work with regular expressions:

It has 3 differents tabs:
  • the first one regular expression testing
  • the second one is a regular expression designer
  • the last one is your regular expression library, which contains a set of commonly used regular expression, but also the history of regular expression you've used recently
 It can even generate C# code to use the regular expression you've designed. You can export to several languages ( C#, VB, C++)

All in all that the one I most often use.


Rubular

The second one is called Rubular and comes in the form of an online tool. It is much simpler and doesn't boast as much features as Expresso, but what it does it does well. If you just want a quick testing tool for your regular expression, without installing anything, then Rubular is what you want:


Quick & easy, straightforward and efficient.



Now where to find those. For Expresso, you can find it here, and for Rubular it's available at this address. I hope you find those tools useful.



AddThis Feed Button HaoHao This

How to view 720p HD trailers in Frontrow

0

Posted by Alex | Posted in , | Posted on

I came to wonder recently why it is that the trailers you see in Frontrow are still in low quality (still good, but nothing close to HD). When you come to think of it, broadband speed have evolved over the year, and it is now common to what HD video on internet, and if you go on the Apple portal you can see the trailer in HD if you want to.

So the question is how to configure Frontrow to display those HD trailer. Well after some searching in the setting it appears there's no easy way to choose the quality of the trailer. After some rummaging around, here's the solution.

Open a terminal and type the following command

defaults write com.apple.frontrow EnableHDMovieTrailers -boolean true && killall "Front Row"
Now reopen Frontrow, go to the Trailer menu. There’s now a HD Trailer at the top of the list.

Voila ;)

Enjoy.
AddThis Feed Button HaoHao This

GTD Outlook: create email to task macro

2

Posted by Alex | Posted in , , | Posted on

On a daily basis, I usually receive a lot of emails. Some I will never read because they don't concern me, but for most of those emails, I need to answer. I sometime don't have time to answer right away. I used to put it in a folder, or leave the email unread, so that I remember that i need to do something about it. But when I was getting reaaally a lot of emails, that wasn't really working. It's wasn't really convenient. Not only it isn't convenient,

Similarly I sometime send email to people, but ... other people are busy, or can't or simply won't answer. So you have to chase them. But again that means you have to remember to chase them.
That makes a lot of things to remember, on top of the usual things you have to do. It wasn't really efficient, which is bad enough, but it also hampered my productivity.

So whenever I receive an email I need to answer, or send an email and make sure I receive an answer in the timeframe I expect (or chase that person), I started to create an outlook task for each of those email. This way I don't have to clutter my mind with little things, and leave room for other more important things to remember. I suppose was the result of reading those article about GTD and productivity.

If you wonder what GTD (also known as "Getting Things Done") is, it is a method (or a collection of various methods) put together by David Allen, famous productivity guru. He wrote a book on the subject called Getting Things Done which i very highly recommand. It's one of those Must read book.

That being said back to the point. That trick of manually creating a task for each mail I was sending or receiving very rapidly grew old.

So I've made a little macro in outlook, that simply create a task from an email, and automatically add that email as an attachement of the task. A very simple to use I just select an mail, and launch a macro and it pops up the create task window, with the selected email automatically pasted in copy. I only have to set the reminder date.

Heres' the code of the macro in question:
Sub MakeTaskFromMail(MyMail As Outlook.MailItem)
   Dim objTask As Outlook.TaskItem
   Set objTask = Application.CreateItem(olTaskItem)
   With objTask
       .Subject = MyMail.Subject
       .DueDate = MyMail.SentOn
   End With

   objTask.Attachments.Add MyMail
   objTask.Display

End Sub

Function GetCurrentItem() As Object
   Dim objApp As Outlook.Application

   Set objApp = Application
   On Error Resume Next
   Select Case TypeName(objApp.ActiveWindow)
       Case "Explorer"
           Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
       Case "Inspector"
           Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
       Case Else
           ' anything else will result in an error, which is
           ' why we have the error handler above
   End Select

   Set objApp = Nothing
End Function

Sub MakeTaskFromCurrentMail()
   Dim currentMail As Outlook.MailItem
   Set currentMail = GetCurrentItem()
   MakeTaskFromMail currentMail
End Sub

Now that works pretty well, but since I'm really lazy and like things to go smoothly, I created a little button that calls the macro, and that the final touch (one could even associate a shortcut). Now in a single click I create a task from any email in my inbox and only have to set the date I want to be reminded.

That simple trick really eased my life and now i almost never forget to answer an email or chase someone to get my answer.

Hopefully this will help others.
AddThis Feed Button HaoHao This

What is a core dump and how to generate one

0

Posted by Alex | Posted in , , | Posted on




In this article we’re going to discuss about core files, what are their use, and how to get them, and what we can do with them.

What is a core file and how to get one

Starting from the beginning, let’s first define what is a core file. A core file, also called core dump is basically a dump, or image of the memory of a computer at a given time. It’s like a photo of everything in memory of your computer at the time of the creation of the core, the registry the stack and heap, pretty much every live data. Usually people will say “Oh S…t the software has cored again”. It’s usually not a good sign.
In most of case the generation of a core dump is involuntary, and is the result of a *violent* crash of a software. Amongst the common cause we can cite memory corruption core dump, stack overflow, lack of memory or even device failure. If your biggest problem is how to dump core, rest assured that'd the easy part by far. If think my favorite one is segmentation fault core dump ;)
Despite the fact that a core file usually means you’ve got a serious bug in your software, they are tremendously useful. Since they are a snapshot photo of the memory at the time of the crash, this can help a lot to figure out what happened. With the help of a core file you can explore the exact conditions at the time of the crash.
Does it mean that core file are the paramount of debugging, the panacea to bug, certainly not. For instance in the case of memory corruption, by the time you get the core file, it’s already too late, the corruption happened seconds before … which means ages for a computer.

What to do with a core file ?

Now if you get a core file that’s good. You can use a debugger that’s able to read core dump on the systems the core was generated. Each system (Windows, Linux, Solaris …) has its own debugger, and each has its own function. So depending the system you’re using you will have to search for the appropriate tool to read core dump. Here’s the list of what tools you can use to debug cores:
  • Solaris Core Dump: dbx or gdb
  • Linux Core Dump: gdb
  • Mac OS Core Dump: gdb or Xcode
This list is by no mean complete since each system boast different tools. Windows is absent from the list because its a it different from other systems in that aspect. For more information about core dump equivalent on windows called minidump, you can check here.

How to generate a core and why ?

As we’ve said above, core dumps are generally the result of a violent crash, so why would one want to force the generation of a core dump ? The answer is to try to investigate dead lock or process hanging issues. When your process is really frozen, you will have to kill it anyway, but if you do it right you can at the same time generate a core dump that will help you later on with your investigation.
You have two ways to generate a core:
  • gcore : This command will generate a core file for a live process but leave the process running
  • kill -6 : as the name of the command, this will kill the process but also generate a core of your application
Additionally before using the kill command you may want to use the command pstack , which will generate a text file that constains the list of all process stack (and each thread of your process) currently running. Executing the command a couple of time before actually killing your application can prove useful, since it’ll give you a better image of what thead is active and doing what than a simple core would.

AddThis Feed Button HaoHao This

Good tools to monitor your website traffic.

0

Posted by Alex | Posted in , , | Posted on

In a previous article I explained why it is important to monitor your website statistics. Now that we know why, let's talk about how to do it, and what to use.

Basically there's two types of statistics tools. The first kind are third party tools for which you need to include a piece of code in all your web pages, the second kind is the tools provided by your webhost.


On site Tools:
Let's talk about the second one, which is to me the best, and easiest to use. Theses tools are provided by your webhost, and generally rely on the webserver logs to provide you those statistics. Why are these better than third party scripts ? For at least two reasons. First of all they are damn easy to use for you as it's usually your provider who install it for you, so you don't really have anything to do ;). Then these tools really on the server logs (which are usually generated no matter what you do), so there's no overheap, it doesn't affect you page loading time.

Now which one to pick ? If you're using the one provided by your webhost, it's not much of a choice. Now it you have a dedicated serve, there's one popular stat tool that I like to use, which is AWstats. It free, and provide a good vision of your traffic. A lot exists but you have to pick oen ... so that's my choice.

Although these on-site tools are good, they do have drawbacks? To me their main advantage (beeing provided by your webhost) is also a serious drawback, because if you don't have a website of your own, if you have a blog on blogspot for instance, that kind of tools is not an option for you. You cannot ask Google to kindly provide you such a tool. That what leads us to the second type of tools, Third party tools.


Third Party tools:
These are scripts, or piece of code that you insert into your pages code that will be called each time someone access one of your pages. They are usually very simple to install, and most of them provide you a ready to cut&paste code to insert in your pages. To check those stats you need to go on the third party tool website to consult them.

The obvious drawback to me is, whenever someone access your pages, it'll contact another webserver to retrieve a piece of code to execute. Although it may seems quite normal, this has a cost as some of these stat tools are pretty heavy and slow. Another drawback is that they usually ask/force you to have a logo on your site. Some people may not like it.


That beeing said they provide a good (if not the only one) alternative to the onsite stats. Which one to pick then, because there's a plethore of sites that which to offer you (or not, because not all of them are free) statistics. I personnaly rely mainly on two, Histats and Google analytics. There's a lot more and a simple search on Google can give you a huge list. When i was looking for tools for myself I stumbled on this list which might be of some help if you don't like those two. Personnaly I find them reliable and provide me enough informations. And i almost forgot, both of them are free, and you are not forced to add a logo , Google analytics doesn't even have one, whereas Histats propose you to add it to your site (but do not force it).

Some may wonder why use two ? Simply because it's always good to be able to put some perspective and compare results when it is a third party that gives you important informations.


RSS Stats

We've talked about webpages statistics but we must not forget about the RSS stats, because after all, this is a very popular way to follow what's happening on a website. And if you do have a RSS feed, you might want to know how many people a following you feed. I recommand feedburner. No only does it provide a good RSS with a lot of tweaking options, but it also gives some nice statistics :




Buttons stats

Another way to get stats, although less direct and general, is all those buttons and script that you can use on your site like the bookmarking tools also generally provide you some statistics on top of their main service.


Now with you're ready to have some good stats about what's happening on your website. As usual if something's missing or just want to add something, feel free to do so.




AddThis Feed Button HaoHao This