Posted by & filed under not about code, productivity.

This is awesome, which I thought worth blogging.

Back in the days, I was tempted to upgrade to pro account on Flickr. But now, not sure, a terabyte without limit to access the oldest photos, is good enough for me.

Although, I can’t remember exactly the cap on storage back then, the problem with free account was you cannot see older photos more than 200. Now it’s here.

http://blog.flickr.net/en/2013/05/20/a-better-brighter-flickr/

Screen Shot 2013-05-21 at 7.39.41 AM

Posted by & filed under code, productivity, work related.

Wrap Google Form in your website. Useful for collecting data from your users without a database, and if you hate country restrictions of the form services out there. Plus you can style it your on way.

Just create a form from your google account and copy the published URL. If you are using Google Apps, please read form options, make sure require sign-in is unchecked.

Installation

Add this line to your application’s Gemfile:

gem 'gfrom'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gfrom

Usage

 GOOGLE_FORM_URL = "https://docs.google.com/a/myorganization.com/spreadsheet/embeddedform?formkey=dGlXS0ZNWVVGYWZqMVhXUENvOXQtSnc6MQ&hl=en"
@myform = Gfrom.new(GOOGLE_FORM_URL)
# fields are stored in array of hashes
# @fields=[
#   {:element=>"input", :type=>"text", :name=>"entry.479273699", :value=>"", :class=>"ss-q-short", :id=>"entry_479273699", :label=>"First name\n\n*", :dir=>"auto", :"aria-required"=>"true"},
#   {:element=>"input", :type=>"text", :name=>"entry.372120214", :value=>"", :class=>"ss-q-short", :id=>"entry_372120214", :label=>"Last name\n\n*", :dir=>"auto", :"aria-required"=>"true"},
#   {:element=>"input", :type=>"text", :name=>"entry.1874514893", :value=>"", :class=>"ss-q-short", :id=>"entry_1874514893", :label=>"Middle name", :dir=>"auto"},
#   {:element=>"input", :type=>"radio", :label=>"Male", :name=>"entry.1593861918", :value=>"Male", :id=>"group_1593861918_1", :class=>"ss-q-radio", :"aria-label"=>"Male"},
#   {:element=>"input", :type=>"radio", :label=>"Female", :name=>"entry.1593861918", :value=>"Female", :id=>"group_1593861918_2", :class=>"ss-q-radio", :"aria-label"=>"Female"},
#   {:element=>"input", :type=>"checkbox", :label=>"Ruby", :name=>"entry.299194237[]", :value=>"Ruby", :id=>"group_299194237_1", :class=>"ss-q-checkbox"},
#   {:element=>"input", :type=>"checkbox", :label=>"PHP", :name=>"entry.299194237[]", :value=>"PHP", :id=>"group_299194237_2", :class=>"ss-q-checkbox"},
#   {:element=>"input", :type=>"checkbox", :label=>"Django", :name=>"entry.299194237[]", :value=>"Django", :id=>"group_299194237_3", :class=>"ss-q-checkbox"},
#   {:element=>"input", :type=>"checkbox", :label=>"Python", :name=>"entry.299194237[]", :value=>"Python", :id=>"group_299194237_4", :class=>"ss-q-checkbox"},
#   {:element=>"input", :type=>"hidden", :name=>"draftResponse", :value=>"[] "},
#   {:element=>"input", :type=>"hidden", :name=>"pageHistory", :value=>"0"}
# ]
puts @myform.fields
# submit the form data to Google will return a hash
result = @myform.submit(params)
# { :success => true, :message => "Thanks" }
# or false otherwise, and an error message, which would probably unsatisfied required fields

In haml:

- @myform.fields.each do |node|
  - if node[:type] != "hidden"
    .inputline
      - element = node.delete(:element)
      %label{:for => node[:id]}=node[:label] if node[:label]
      - if element == "input"
        %input{node}
      - if element == "textarea"
        %textarea{node}
  - else
    %input{node}

TODO

  • Retain form values on unsuccesful submit
  • Fields with error after submit
  • Warn or raise exception if form is disabled (Accepting Responses is unchecked)
  • Provide a sample template for rails app
  • Label for grouped form tags – checkbox and radio
  • Support for getting select form tag (use radio button for now)
  • Support for Authenticated forms (requires login to organization/google apps)
  • Supply an RDOC
  • Tests

Posted by & filed under me stuff, not about code.

This is quite a late post, hehe. Well, this tour was also pre-paid back in November 2012. So, we waited quite a bit for this as well. But all in all, turned out really great! Here you go…

Below are the tour guides, they were awesome. They Kept the entire trip educational and entertaining. One of them actually switched from being a teacher to being a tour guide, amazing isn’t it? It was like finding the things you love. He used to be a teacher in Quezon City, but he gave it up for a career change, when he himself made a tour here in 2001.

The places:

Would I recommend Palawan as tour destination? YES! Plus they make you feel safe, almost everyone ensures you that.

IMG_4811

Posted by & filed under me stuff, not about code.

Posted by & filed under productivity, work related.

Just wanted to highlight this crawler here.

This brought down our servers on their knees and DB connection to soar high yesterday (December 12, 2012) at midnight.

The agent I suspected was 008 by 80legs (not adding the link here, just google it yourself) because our error mailer reported 75% of the user-agent were them, and they were targeting all PDF documents from our client sites.

Posted by & filed under me stuff, productivity.

Found this from this article, and I think, this applies everywhere. Give it a read as well, it’s pretty interesting.

What you want is to be (1) right more often than wrong; (2) willing to recognize when you are wrong; and (3) able and willing to correct whatever is wrong. If you expect perfection, to be right all the time, you’re going to fail on all three of those — you will be wrong sometimes, that’s just human nature; you’ll be less willing or unwilling to recognize when you’re wrong because you’ve talked yourself into expecting perfection; and you won’t fix what’s wrong because you’ll have convinced yourself you weren’t wrong in the first place. The only way to come close to being right all the time is to be willing to change your mind and recognize mistakes — it’s never going to happen that you’re right all the time in the first place.

Posted by & filed under productivity, work related.

I’ve been looking for a good pomodoro timer I can install on Ubuntu the past week, and I think I’ve tested quite a few until I decided which one to use. There’s a lot of them out there, there’s even an web app version. But what I ended up using is Tomighty. I used the java archive from the downloads directory. So, here are the steps:

Download the jar file in your home directory. Then run it typing in the terminal

java -jar tomighty-0.7.1.jar

You’ll notice the tomato icon pops in your system tray.

Done! You can now click the icon and press Start pomodoro. There’s should be a sound like a winding up a clock. If you didn’t hear that sound, you might need to upgrade to Java 7 oracle. Follow these steps

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java7-installer

After that, close pomodoro icon by right-clicking on the system tray icon, then run the same command as above.

I prefer not to launch the terminal just to start pomodoro, and I wouldn’t mind always having it in the system tray. So, I put it in my startup applications. In precise pangolin, you can quickly access from the desktop the ‘Startup Appliations’ under the gear icon next to your name. In the command field, add the same command for starting pomodoro.

java -jar /home/userhome/tomighty-0.7.1.jar

But you must include the absolute path of the jar file.

Posted by & filed under code, productivity, work related.

If you have put strict mode then you will get error if you try to perform following operations.

  1. Assigning value to non-declared variable
  2. Assigning value to read only variable
  3. Defining duplicate property
  4. Defining duplicate parameters in a function
  5. Using future reserved keywords like interface, let, package etc.
  6. Cannot defined a function inside if-else or for statement

Source: http://debugmode.net/2012/09/02/what-is-strict-mode-in-javascript/