Sunday, March 23, 2014

Button click handlers, AJAX, and premature submission

http://encosia.com/button-click-handlers-ajax-premature-submission

Excerpts:

Clicking the button did run our JavaScript code, which we can verify by seeing that the request began. However, it also triggered a form submission since that’s the browser’s default behavior when buttons inside forms are clicked.
 ... 

Putting a leash on the browser’s default behavior

There are a couple ways to tame the browser’s form submission mechanism and make the button work asynchronously, as expected.
  • return false – In almost all cases, an event handler function returning false causes the browser to cancel any subsequent behaviors that the event would normally have triggered (like submitting a form). Using return false works, but you need to be careful about where you place it since the return statement can abort your code early and it can have unintended side-effects.
  • preventDefault() – The browser sends an event parameters to handlers, which details information about the action that triggered the handler. That event object also exposes a method that prevents the browser’s default reaction to that event:preventDefault(). For click handlers on submit buttons inside forms, that includes preventing the form submission.
Since return false does have the issue of sometimes breaking other code and plugins when it stops propagation, I use preventDefault() by… default.


10 IT Admin skills every .NET developer should have before going live

Wednesday, March 19, 2014

queue.acm.org & 2006 conversation with Verner Wogels (Amazon)

queue.acm.org - seems like a very good website in general

Amazon related - https://queue.acm.org/detail.cfm?id=1142065

(Have to list some of the important points over here later)


Criticism of Agile

- Have started seeing more and more blogposts criticizing Agile.
- Perhaps the criticism (review), is inevitable because, about a decade has passed since Agile became popular.

http://mikehadlow.blogspot.co.uk/2014/03/coconut-headphones-why-agile-has-failed.html

http://effectivesoftwaredesign.com/2014/03/17/the-end-of-agile-death-by-over-simplification/ - this has more links in it

http://effectivesoftwaredesign.com/2014/01/20/attention-agile-programmers-project-management-is-not-software-engineering/ - talks about how Project-Management ideas of Agile are being used heavily but not Agile's Software-Engineering ideas

Friday, March 7, 2014

rvm issue

"You need to change your terminal emulator preferences to allow login shell."

http://stackoverflow.com/questions/10939968/why-wont-my-rvm-allow-me-to-switch-to-an-alternative-ruby

The Problem

RVM does its own installation magic, but in Ubuntu's case it doesn't always install to the right Bash startup file. You probably don't actually have RVM running properly; even though it's sort of installed.

The Fix

You need to make sure the following two lines are at the BOTTOM of your ~/.bashrc file.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
export PATH=$PATH:$HOME/.rvm/bin
Then restart your terminal emulator or log back in. Note that sourcing ~/.bashrc has been known not to work in some cases, so this step will save your sanity.
RVM should now be working properly. The last step is to set your default Ruby.
rvm --default use 1.9.2

Important Edit

As I've just been reminded, RVM breaks Ubuntu login shells by installing ~/.bash_login, which overrides your Ubuntu ~/.profile in login shells. Move the code over to your ~/.bashrc if you haven't already done so, then remove or rename ~/.bash_login.

Tuesday, March 4, 2014

Salesforce & Ruby

http://www.citoresearch.com/cloud/direct-salesforcecom-why-we-bought-heroku
Kelman argues that eventually IT departments will recognize the power of Ruby and use it.
When they do, Salesforce.com will have the most business-friendly way to use Ruby, one that delivers Ruby as a Platform-as-a-Service, but which is connected to a mature ecosystem of business software components like Chatter, Force.com, and Database.com....
Heroku + Chatter + Force.com + Database.com

Heroku - hosting service
Chatter - enterprise social network
Force.com - application development platform
Database.com - database in the cloud

Rails: specifying a 'local' gem

Saturday, March 1, 2014

Foy Savas' methods of giving a Presentation & Blogging

Presentation/Talk technique - Great use of slides

http://www.infoq.com/presentations/savas-polyglots

Not sure how to describe the technique, but the talk just felt great to watch, with the Slides playing a very important role.

Blogging technique - 

http://www.foysavas.com/2013/12/29/why-im-rebooting-my-blog-as-outlines.html

What is the technique ?
  • His blog-posts are going to be structured as Outlines (i.e. list of points) 
How does it help the Writer during writing?
  • He says it - Forces (i.e. helps) the writer to better structure the entire blog-post
How does it help the Reader ?
  • He says it - Allows the reader to "fully absorb" the blog-post
  • I want to add that it - Makes it easier for the reader to 'study' the blog-post (i.e. re-read the points, ponder over them) 
He explains his reasoning in more detail (but, remarkably, by needing to use very few words) in his blog-post. 

Extra effort required by Writer? Yes... but it is suited for Mobile Devices....so... -
Such (well structured) blog-posts or articles will be easier to read on Mobile devices.
This can benefit the Writer immensely. That could be the payoff for spending the extra effort to structure & condense the blog-post using such a technique.


Asp.Net Web API - getting started

Sublime Text 2 extensions - 'git' , 'Github Tools', etc

Before adding any extensions:
1. it is best to install Package Control first
2. to install Package Control, I had to start Sublime Text using admin account (i.e 'sudo' in Ubuntu)

https://sublime.wbond.net/installation#st2

Some useful extensions:

git extension:
------------------
https://github.com/kemayo/sublime-text-git/wiki

Github Tools extension:
------------------------------
From Readme.md:
## Usage ##
Open any directory of your GIT working copy in Sublime Text 2.
* Press `Ctrl + Shift + P` and select `Github: Open File` or just press `Ctrl + Shift + ^` to open currently edited file in Github.
* Press `Ctrl + Shift + P` and select `Github: Blame` to open blame for currently edited file in Github.
Github Color Theme:
---------------------------
https://github.com/alexanderekdahl/github-sublime-theme

Also installed the following:
----------------------------
Color Picker - https://github.com/weslly/ColorPicker
SublimeREPL - https://github.com/wuub/SublimeREPL
BracketHighlighter -https://github.com/facelessuser/BracketHighlighter
Emmet - https://github.com/sergeche/emmet-sublime
Zen Tabs - https://sublime.wbond.net/packages/Zen%20Tabs
Git Gutter - https://github.com/jisaacks/GitGutter

Enable some features that are already in Sublime Text:
    -- we do this by changing the Preferences -> Settings - Default

From http://webdesign.tutsplus.com/articles/simple-visual-enhancements-for-better-coding-in-sublime-text--webdesign-18052

highlight_modified_tabs
To bring more focus to the unsaved files in the current project, this setting will highlight the tabs of the modified files inside a window.
"highlight_modified_tabs": true,
fade_fold_buttons
Did you know Sublime Text can fold and unfold chunks of code? I did, but I always forget that feature is available. If you turn on this setting, it will leave the folding tag to the right instead hiding it.
"fade_fold_buttons": false,

bold_folder_labels

There are some great settings available to bring some stronger visual elements to the side bar, here they are:
"bold_folder_labels": true,

Show Open Files in the Side Bar

Oddly, this option is not set up in the preferences file. To show open files on the top of your side bar, go to:
View → Side Bar → Show Open Files
-------------------------------------------------------------------------------------
Sublime Text Shortcuts:

From http://daker.me/2013/05/5-sublimetext2-packages-to-enhance-your-frontend-development-workflow.html :
Here are some useful Keyboard shortcuts to remember :
  • ctrl+d Select the next occurrence of the selected word
  • ctrl+k, ctrl+b - Toggle the sidebar
  • f11 - Toggle Full Screen
  • shift+f11 - Toggle Distraction Free (this one is my favorite)
  • alt+. - Close Tag
  • ctrl+p - Show the go to overlay panel
  • ctrl+shift+p - Show the command overlay panel
  • ctrl+alt+p - Show the project selector panel
  • ctrl+r - Show the go to overlay panel default to method selector
  • ctrl+g - Show the go to overlay panel default to go to line selector
  • ctrl+; - Show the go to overlay panel default to variable selector
  • ctrl+shift+up - Swap with the line above
  • ctrl+shift+down - Swap with the line below
  • ctrl+/ - Toggle a comment
  • ctrl+shift+/ - Toggle a comment block
  • ctrl+shift+d - Duplicate a line
  • ctrl+` - Display console panel
  • ctrl+space - Auto complete the current selected snippet

Followers

Blog Archive