As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label time. Show all posts

A while ago, I was learning how to write a custom function in Google Docs Spreadsheet, even wrote a wiki page to note about input and output of custom function. I picked timeago function as an exercise.

I submitted the finished script to gallery, you could find it by searching timeago:

http://4.bp.blogspot.com/-d_GEU-_TPU8/T9lYasFsvQI/AAAAAAAADZc/uOHWTK1Rnpg/s1600/timeago+in+Google+Docs+Spreadsheet.png

Here is the test spreadsheet.

For the source code, I think you can view it in that test spreadsheet or after you install the script, not really sure. I lost my interest in writing custom function since I dont need any for practical uses.

As some of you may know you can search "time UK" for current local time on Google or Yahoo. I use this feature quite often, but one thing I never couldn't understand is why I can't query by the timezone.

It makes no sense to me. Since it's about time, using timezone as key is so natural to me. When you are participating international events remotely, it is not always have geographical location listed in the time table, timezone abbreviation is most likely to see. Practically, an event often is listed with two or three different local times with respective timezones.

I just don't understand why Google engineers don't get it or, the worst,not even think about it.

Okay, no timezones, fine. Then how about ISO-3166-1 alpha-2/3?
  • "time DE" gets you time in Delaware. I can't really argue about this one, because it's US-regional Google Search.
  • "time DEU" gets nothing.
  • "time GER" gets nothing.
  • "time germ" still nothing.
  • "time germa" still nothing.
  • "time german" frak still nothing.
  • "time germany" yea, finally.
Although "time CET" gets nothing on Yahoo, too, but "time DE" will get you time in Delaware and time in Germany in second line. You can also try "time NL"

Yahoo is smarter when you ask about time. Note that it's not like Google can't give you a list of times regarding the key you use, see "time US".

Maybe time is not so important in Google?

I had thought about writing a web page which can support querying by timezone, but DST is really the pain in the ass and I don't really know how to get accurate DST starting and end information.

2011-02-28--20:46:39Yesterday, I made these in text file with Unicode Box-drawing characters. I like the last two styles, so I finished a full set.

A set of clocks in terminal, how cool is that?

I don't know but I don't really need to know when people get up around the world. So, this is just an idea, I didn't start writing this program. I have also tried to find some programs but I didn't find a world clock program which I visualized. But I found this question on StackOverflow, which have some commands that list clocks. They are simple clock, just print out the time.



I think with colors for day and night, it will be a nice way to tell A.M. or P.M. Also colors in location text can indicate time ahead or behind the current local time.

Another idea is flip clock. Yes, flip clock in terminal, I believe is doable. I have written a Chrome Extension, which also works on Firefox. You can see the main file, use Space or 2 to switch mode, or double-click on clock.

I think it's possible to emulate with 256-color, maybe that would already work in 16-color? Making a bigger clock text with boxes, I truly believe it will look like flipping.

Anyway, they are just ideas. I am not gonna implement them, because I know I won't be a user of them. But if you want to have them, you really need such program, please let me know. I will finish for you.

If you know any programs already do what I described, leave me a link, I would like to check them out. If you want to ask why not just use web app or GUI program? Why? Let me tell you this "The answer is simple, because we can make it."

Where I really want to have these fonts is in tmux clock mode.

Google Webmaster Tools told me:

Performance overview

On average, pages in your site take 6.4 seconds to load (updated on Oct 31, 2010). This is slower than 83% of sites. These estimates are of low accuracy (fewer than 100 data points). The chart below shows how your sites average page load time has changed over the last few months. For your reference, it also shows the 20th percentile value across all sites, separating slow and fast load times.

http://4.bp.blogspot.com/-ddn_YW5Pl8I/T4faS3WuFRI/AAAAAAAADO8/myClQS47l8M/s800/chart.png

6.4 seconds?! Are you kidding me? Well, its not. My posts pages really take about that long to load. You might want to ask me, whats the problem with 6.4 seconds? Its not really long comparing to other blogs. Its not, but if you look at my page, you dont see any crap banners, icons, images. My blog is basically pure text only, except the images in post contents and two Google AdSense ad units. So, its too long to me.

I am pretty sure where I can cut the number down: Disqus!

https://farm5.staticflickr.com/4104/5212507835_8448c57ce2_o.png

If you scroll down, you will see Disqus is no longer loaded by default. You will need to click on that button to load comments. I also make related posts list loaded by user request, that helps a little, and I moved jQuery code into yjlv.js, request_count--. I know this is cheating in order to get low loading time.

Here is a diff for my template changes:

--- template.xml.orig       2010-11-28 08:11:25.000000000 +0800
+++ template.xml    2010-11-28 07:58:55.000000000 +0800
 -3,7 +3,7 
 <html xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
   <head>
     <b:if cond='data:blog.pageType == &quot;item&quot;'>
-      <title><data:blog.pageName/> &lt;&lt;&lt; $(<data:blog.title/>)</title>
+      <title><data:blog.pageName/></title>
       <b:else/>
       <b:if cond='data:blog.pageType == &quot;static_page&quot;'>
         <title><data:blog.pageName/> &lt;&lt;&lt; $(<data:blog.title/> --page)</title>
 -26,8 +26,8 
     <data:blog.feedLinks/>
     <b:skin><![CDATA[]]></b:skin>
     <link href='http://www.yjl.im/css/yjlv.css?4' rel='stylesheet'/>
M#-    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'/>
     <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
+    <script src="http://www.yjl.im/js/yjlv.js?8"></script>
   </head>
   <body>
     <header id='blog-header'>
 -253,7 +253,12 
             </div>
             <footer>
               <b:if cond='data:blog.pageType == &quot;item&quot;'>
-                <div style='float:right;width:312px'>        Possibly (Definitely Not) Related Posts:        <div id='gas-results'/>      </div>
+                <div style='float:right;width:312px'>
+                                   <div>Possibly (Definitely Not) Related Posts:</div>
+                                   <div id='gas-results'>
+                                           <input type="button" value="Click to load related posts list" onclick='$.getScript("http://brps.appspot.com/gas.js")'/>
+                                   </div>
+                           </div>
               </b:if>
               <div class='post-footer-line post-footer-line-1'>
                 <span class='post-author vcard'>
 -312,11 +317,19 
             </footer>
             <b:if cond='data:blog.pageType == &quot;item&quot;'>
               <section id='post-comments'>
-                <h2>Comments</h2>
+                <h2><a expr:href='data:post.url + &quot;#disqus_thread&quot;'>Comments</a></h2>
                 <div id='disqus_thread'/>
-                <script type='text/javascript'> if (document.location.href.indexOf(&#39;/b/post-preview&#39;) == -1) $.getScript(&#39;http://yjlv.disqus.com/embed.js&#39;);</script>
-                <noscript>Please enable JavaScript to view the <a href='http://disqus.com/?ref_noscript=yjlv'>comments powered by Disqus.</a></noscript>
-                <a class='dsq-brlink' href='http://disqus.com'>blog comments powered by <span class='logo-disqus'>Disqus</span></a>
+                           <script>
+                           $(function(){
+                                   // If visitors are led to comments, then load comments automatically.
+                                   var href = document.location.href;
+                                   if (href.indexOf('#disqus_thread') >= 0 || href.indexOf('#comment-') >=0) {
+                                           $.getScript("http://yjlv.disqus.com/embed.js");
+                                           $('#comments-loader-button').remove();
+                                           }
+                                   });
+                           </script>
+                           <input type="button" id="comments-loader-button" style="width:620px;margin:10px;" value="Click to load comments or to write a comment" onclick='$.getScript("http://yjlv.disqus.com/embed.js");$(this).remove();'/>
               </section>
             </b:if>
           </article>
 -639,4 +652,4 
       </div>
     </footer>
   </body>
-</html>
\ No newline at end of file
+</html>

I added a small piece of code which will automatically load comments when visitors come via a link like .../post-title.html#disqus_thread or .../post-title.html#comment-1234567. Visitors will have no problems to read the comment.

Also, I made a change to posts page titles. I removed <<< $(YJL --verbose) from title because I saw this in my Stats page:

http://farm6.static.flickr.com/5201/5212521441_ae24c47be9.jpg

The last keyword "yjl table" made me do so. That visitor must found nothing what he or she was looking for. "yjl" matched on page title, search engines are just not smart as you and me. If I was that visitor, I would not even click on the result since its clear that matched part is useless.

We will see if next check (after 2010-11-27T08:47:50-07:00) will resullt a significant drop on loading time, I believe it will.