Monday, March 31, 2014
Sunday, March 23, 2014
Button click handlers, AJAX, and premature submission
http://encosia.com/button-click-handlers-ajax-premature-submission
Excerpts:
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.
Since
- 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.return falsedoes have the issue of sometimes breaking other code and plugins when it stops propagation, I usepreventDefault()by… default.
Saturday, March 22, 2014
Friday, March 21, 2014
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)
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
- 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
Tuesday, March 18, 2014
Ruby: Installing a gem by specifying the source
https://github.com/rdp/specific_install
E.g.
gem specific_install -l https://github.com/deevis/spree.git
http://stackoverflow.com/questions/2577346/how-to-install-gem-from-github-source#answer-11767563
E.g.
gem specific_install -l https://github.com/deevis/spree.git
Customizing Bootstrap in Rails
bootstrap-sass gem provides the following file, where we can put in whatever custom values we want:
https://github.com/twbs/bootstrap-sass/blob/master/vendor/assets/stylesheets/bootstrap/_variables.scss
https://github.com/twbs/bootstrap-sass
https://github.com/twbs/bootstrap-sass/blob/master/vendor/assets/stylesheets/bootstrap/_variables.scss
https://github.com/twbs/bootstrap-sass
Sunday, March 9, 2014
Advanced Debugging Techniques in Javascript
http://keyholesoftware.com/2014/01/06/advanced-debugging-techniques-in-javascript-part-1/
Final part is Part 4 (not published yet) -
Part 4 – Coming Soon - how teams that use Agile can help their developers and QAs debug JavaScript effectively
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
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/binThen 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.2Important 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
Heroku - hosting service
Chatter - enterprise social network
Force.com - application development platform
Database.com - database in the cloud
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
http://stackoverflow.com/questions/4487948/how-can-i-specify-a-local-gem-in-my-gemfile
gem "foo", :path => "/path/to/foo"
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 ?
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.
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.
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:
---------------------------
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
fade_fold_buttons
Sublime Text Shortcuts:
From http://daker.me/2013/05/5-sublimetext2-packages-to-enhance-your-frontend-development-workflow.html :
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 ##Github Color Theme:
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.
---------------------------
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,
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 FilesSublime 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
Friday, February 28, 2014
Thursday, February 27, 2014
Computer Programming in 5 minutes & Tiny-Robots
I have wondered several times how I would introduce 'programming' to someone who has never done it, not even a little bit.
Below is Larry Wall's take on it. He is the creator of Perl programming language.
The rest of this post is based on an idea from the above video - the idea of robots being at your disposal to do certain tasks.
We can probably explain programming-constructs, by :
And that is probably half the battle won right at the start.
------------------------------------------------------------------------
More complex point that can be introduced after a couple of programs -
------------------------------------------------------------------------
Example:
PROBLEM:
Print numbers 1 to 100 on screen
TINY-ROBOTS AT YOUR DISPOSAL:
1. LOOP tiny-robot
2. PRINT-TO-SCREEN tiny-robot
Info about the LOOP tiny-robot -
obviously since it is a robot, we have to tell it exactly how many times it has to loop;
once we give tiny-robot this number, it stores it and starts looping; it keeps track of how many loops it has completed, how many are remaining, etc; the LOOP tiny-robot is quite smart in this aspect.
Info about PRINT-TO-SCREEN tiny-robot -
this tiny-robot does nothing but print to screen whatever you give it.
SOLUTION:
Instructions from us (programmer) to the tiny-robots will be:
"LOOP tiny robot - please loop 100 times"
"During each loop, since you keep track of how many loops you have already done, give that number to the PRINT-ON-SCREEN tiny-robot, and ask it to print that number on screen.
-------------------------------------------------------------------------------
(In the above example, I have tried to tackle the 'loop' construct, which is a slightly advanced concept for an absolute beginner.
Have to try and add IF-THEN-ELSE construct example;
If idea seems good, perhaps, I will try to create examples for all the main programming-constructs.
In the worst-case, it can be a good way for me to try out while trying to understand new concepts)
Below is Larry Wall's take on it. He is the creator of Perl programming language.
The rest of this post is based on an idea from the above video - the idea of robots being at your disposal to do certain tasks.
We can probably explain programming-constructs, by :
- asking the student to imagine that each programming-construct is actually a tiny-robot. So, for e.g., a for-loop, is actually a tiny-robot that is capable of just doing a 'loop'. Similarly, we can imagine a if-then-else tiny-robot, print-to-screen tiny-robot, etc
- Notice that I modified 'robots' to 'tiny robots' so as to convey the idea/feeling that a tiny-robot can do a 'tiny' task
- This idea might work because everyone knows that robots need to be instructed what to do i.e. robots need to be given 'commands'.
- And it is also easy to add that the commands have to be very specific, otherwise the robot will not understand what to do. We would have introduced concept of 'syntax' by doing that.
And that is probably half the battle won right at the start.
------------------------------------------------------------------------
More complex point that can be introduced after a couple of programs -
- We can ask the tiny-robots to give commands to each other.
------------------------------------------------------------------------
Example:
PROBLEM:
Print numbers 1 to 100 on screen
TINY-ROBOTS AT YOUR DISPOSAL:
1. LOOP tiny-robot
2. PRINT-TO-SCREEN tiny-robot
Info about the LOOP tiny-robot -
obviously since it is a robot, we have to tell it exactly how many times it has to loop;
once we give tiny-robot this number, it stores it and starts looping; it keeps track of how many loops it has completed, how many are remaining, etc; the LOOP tiny-robot is quite smart in this aspect.
Info about PRINT-TO-SCREEN tiny-robot -
this tiny-robot does nothing but print to screen whatever you give it.
SOLUTION:
Instructions from us (programmer) to the tiny-robots will be:
"LOOP tiny robot - please loop 100 times"
"During each loop, since you keep track of how many loops you have already done, give that number to the PRINT-ON-SCREEN tiny-robot, and ask it to print that number on screen.
-------------------------------------------------------------------------------
(In the above example, I have tried to tackle the 'loop' construct, which is a slightly advanced concept for an absolute beginner.
Have to try and add IF-THEN-ELSE construct example;
If idea seems good, perhaps, I will try to create examples for all the main programming-constructs.
In the worst-case, it can be a good way for me to try out while trying to understand new concepts)
Sunday, February 23, 2014
Wednesday, February 19, 2014
git add -p
http://johnkary.net/blog/git-add-p-the-most-powerful-git-feature-youre-not-using-yet/
If you use git, you've used the commandgit add. But do you know about git add's "patch mode" usinggit add -p?Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history.
10-signs-that-you-are-an-awesome-web-developer
http://tutorialzine.com/2014/02/10-signs-that-you-are-an-awesome-web-developer/
Above link seems to have some useful links.
Above link seems to have some useful links.
Sunday, February 16, 2014
Google Charts: removing padding
http://stackoverflow.com/questions/4271390/remove-padding-in-google-chart
options.chartArea = { left: '8%', top: '8%', width: "70%", height: "70%" };https://developers.google.com/chart/interactive/docs/gallery/piechart#Configuration_Options
Friday, February 14, 2014
Rails: Turn off assets precompile
We would want to do this in Dev environment.config.assets.enabled = false
Wednesday, February 12, 2014
Sticky toastr
http://stackoverflow.com/questions/17411171/toastr-how-to-prevent-fade-out-with-sticky-toast-on-mouseover
http://blog.decayingcode.com/post/Better-JavaScript-notifications-with-Toastr
toastr.options = {timeOut: 0, extendedTimeOut: 0}
(observe that 'O' in timeOut is upper-case)
http://blog.decayingcode.com/post/Better-JavaScript-notifications-with-Toastr
toastr.options = {timeOut: 0, extendedTimeOut: 0}
(observe that 'O' in timeOut is upper-case)
Tuesday, February 11, 2014
MySql: find out which tables contain a certain column
To search for a column 'rank' in a database 'mydb':
select * From INFORMATION_SCHEMA.COLUMNS Where column_name like '%rank%' and TABLE_SCHEMA = "mydb"
select * From INFORMATION_SCHEMA.COLUMNS Where column_name like '%rank%' and TABLE_SCHEMA = "mydb"
Sunday, February 9, 2014
XSS, Browser Exploitation Framework, Alice & Bob & Eve & Mallory, Rails & XSS
Cross-Site Scripting - Persistent, Non-Persistent (Reflective)
http://en.wikipedia.org/wiki/Cross-site_scripting
http://en.wikipedia.org/wiki/Cross-site_scripting
Who are Alice and Bob and Eve and Mallory ?
http://en.wikipedia.org/wiki/Alice_and_Bob
Browser Exploitation Framework
http://en.wikipedia.org/wiki/BeEF_(Browser_Exploitation_Framework)
Rails & XSS:
http://guides.rubyonrails.org/security.html#cross-site-scripting-xss
Browser Exploitation Framework
http://en.wikipedia.org/wiki/BeEF_(Browser_Exploitation_Framework)
Rails & XSS:
http://guides.rubyonrails.org/security.html#cross-site-scripting-xss
Friday, February 7, 2014
Security related
https://www.owasp.org/index.php/Ruby_on_Rails_Cheatsheet
There are links to Cheatsheets for .Net, HTML5, Javascript, iOS, etc. also in the above page.
There are links to Cheatsheets for .Net, HTML5, Javascript, iOS, etc. also in the above page.
Monday, February 3, 2014
Ruby: inject
http://ruby-doc.org/core-2.0/Enumerable.html#method-i-inject
What does it do ?
-- Combines all elements of enum
-- by applying a binary operation, specified by a block
For each element in enum -
- the block is passed an accumulator value (memo) and the element
- the result becomes the new value for memo.
Variation:
-------------------------
inject { |memo, obj| block } → obj
What is the initial value for memo ?
- If you do not explicitly specify an initial value for memo, then the first element of collection is used as the initial value of memo.
inject( initial ) { |memo, obj| block } → obj
def sum_of_cubes(a, b)
sum = 0
(a..b).inject(sum) { |sum, x| sum + (x*x*x) }
end
-- Combines all elements of enum
-- by applying a binary operation, specified by a block
For each element in enum -
- the block is passed an accumulator value (memo) and the element
- the result becomes the new value for memo.
At the end of the iteration -
the final value of memo is the return value for the method.
the final value of memo is the return value for the method.
Variation:
-------------------------
inject { |memo, obj| block } → obj
What is the initial value for memo ?
- If you do not explicitly specify an initial value for memo, then the first element of collection is used as the initial value of memo.
Sunday, February 2, 2014
Thursday, January 30, 2014
Rails: specifying callback-javascript in response to Ajax request
respond_to do |format|
format.js { render js: "toastr.success('"+successmsg+"')"}
end
If callback-javascript is only 1 line of code or so, then we can avoid creating a new .js.erb file (with name of controller-action) and just include the javascript as above.
format.js { render js: "toastr.success('"+successmsg+"')"}
end
If callback-javascript is only 1 line of code or so, then we can avoid creating a new .js.erb file (with name of controller-action) and just include the javascript as above.
Tuesday, January 28, 2014
Friday, January 24, 2014
Thursday, January 23, 2014
Ruby: eval, define_method, send
eval, define_method, send
http://rubymonk.com/learning/books/5-metaprogramming-ruby-ascent/chapters/24-eval/lessons/63-eval#solution3816
http://rubymonk.com/learning/books/5-metaprogramming-ruby-ascent/chapters/24-eval/lessons/63-eval#solution3816
evalshould best be avoided in real scenarios. Ruby has saner tools (#define_method,#send) in its meta-programming repertoire that you can use to achieve eval-like cleverness.
Tuesday, January 21, 2014
Dependency Injection example
(I am trying to learn DI. Below is an Example from Adam Freeman's book - Pro ASP.Net MVC 5. Below is my attempt at understading the example in the book)
Dependency Injection example with Ninject:
1. ShoppingCart's constructor expects a concrete class's object (i.e. object of class LinqValueCalculator)
2. HomeController's Index action is instantiating 2 objects before using them (observe the 'new' keyword being used in 2 lines of code)
In page 124 (left page in below screenshot):
ShoppingCart has been 'fixed' now:
-- it has 'declared' that it has a dependency on an object of type IValueCalculator
-- It has done this 'declaration' via its constructor
-- basically it is saying - send me the object and I will use it; i am not going to go through the trouble of creating it
-- Also notice that, in ShoppingCart's constructor, concrete class LinqValueCalculator has been replaced by an interface IValueCalculator
- So, now the responsibility of getting hold of a IValueCalculator object has been transferred to Index() method of HomeControler.cs
In page 128 (right page in below screenshot):
Now, we use the same strategy with HomeController.cs :
-- we make it 'declare' that it has a dependency on an IValueCalculator object via its constructor
-- basically, now, it is also saying - send me the object and I will use it; i am not going to go through the trouble of creating it)
- So the question is - who is going to create the object now (since each class seems to be handing over that responsibility to someone else, and there is no one else to hand that responsibility over to) ?
Dependency Injection example with Ninject:
Starting point
1. ShoppingCart's constructor expects a concrete class's object (i.e. object of class LinqValueCalculator)
2. HomeController's Index action is instantiating 2 objects before using them (observe the 'new' keyword being used in 2 lines of code)
Summary
In Stage1, we 'fix' ShoppingCart class (by transferring the responsibility of creating the object to HomeController class).
Putting this in another way - we make it easier to write the ShoppingCart class, by asking HomeController to pass, as parameter to constructor, whatever ShoppingCart class needs
Now we have to 'fix' HomeController class
In Stage 2, we fix HomeController class
Stage 1 - left page in below screenshot
In page 124 (left page in below screenshot):
ShoppingCart has been 'fixed' now:
-- it has 'declared' that it has a dependency on an object of type IValueCalculator
-- It has done this 'declaration' via its constructor
-- basically it is saying - send me the object and I will use it; i am not going to go through the trouble of creating it
-- Also notice that, in ShoppingCart's constructor, concrete class LinqValueCalculator has been replaced by an interface IValueCalculator
- So, now the responsibility of getting hold of a IValueCalculator object has been transferred to Index() method of HomeControler.cs
Stage 2 - right page in below screenshot
In page 128 (right page in below screenshot):
Now, we use the same strategy with HomeController.cs :
-- we make it 'declare' that it has a dependency on an IValueCalculator object via its constructor
-- basically, now, it is also saying - send me the object and I will use it; i am not going to go through the trouble of creating it)
- So the question is - who is going to create the object now (since each class seems to be handing over that responsibility to someone else, and there is no one else to hand that responsibility over to) ?
Ninject or such DI container will do that...
Monday, January 20, 2014
Reverse Proxy
E.g. NGINX
http://en.kioskea.net/contents/308-proxy-and-reverse-proxy-servers
has good diagrams to differentiate between a forward-proxy and a reverse-proxy
http://en.kioskea.net/contents/308-proxy-and-reverse-proxy-servers
A reverse-proxy is a "backwards" proxy-cache server; it's a proxy server that, rather than allowing internal users to access the Internet, lets Internet users indirectly access certain internal servers.http://serverfault.com/questions/8654/what-is-a-reverse-proxy
A reverse proxy, also known as an "inbound" proxy is a server that receives requests from the Internet and forwards (proxies) them to a small set of servers, usually located on an internal network and not directly accessible from outside. It's "reverse", because a traditional ("outbound") proxy receives requests from a small set of clients on an internal network and forwards them to the Internet.http://www.jscape.com/blog/bid/87783/Forward-Proxy-vs-Reverse-Proxy
has good diagrams to differentiate between a forward-proxy and a reverse-proxy
Sunday, January 19, 2014
Friday, January 17, 2014
Wednesday, January 15, 2014
Cloud - Windows Azure
Below is a slide from "Windowz Azure Websites Deep Dive" course in Microsoft Virtual Academy
Observe how the 'bottom' layers go away, as we move from :
Your Datacenter => Azure Virtual Machines => Azure Cloud Services => Azure Websites
(Also observe how the image of the cloud gets bigger towards Azure Websites)
Observe how the 'bottom' layers go away, as we move from :
Your Datacenter => Azure Virtual Machines => Azure Cloud Services => Azure Websites
(Also observe how the image of the cloud gets bigger towards Azure Websites)
Tuesday, January 14, 2014
Sunday, January 5, 2014
Rails: passing a variable to "render"
<%= render 'credit_card_info', :f => f %>
Then 'f' will be available as a local variable
http://stackoverflow.com/questions/4700617/pass-a-variable-into-a-partial-rails-3
Then 'f' will be available as a local variable
http://stackoverflow.com/questions/4700617/pass-a-variable-into-a-partial-rails-3
Rails: to see path for a given named-route
In "rails console":
if login_path is a route-name, we can get the actual path via:
Rails.application.class.routes.url_helpers.login_path
if login_path is a route-name, we can get the actual path via:
Rails.application.class.routes.url_helpers.login_path
Tuesday, December 31, 2013
Monday, December 30, 2013
git: deleting a remote branch
http://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-both-locally-and-remotely
git push origin --delete branchName
Wednesday, December 25, 2013
Tuesday, December 24, 2013
Ruby: split vs regex, Benchmark
http://stackoverflow.com/questions/7533479/ruby-string-search-which-is-faster-split-or-regex
require 'benchmark'
Benchmark.bm do |x|
x.report { 50000.times { a = 'a@b.c'.split('@')[0] } }
x.report { 50000.times { a = 'a@b.c'[/[^@]+/] } }
end
Sunday, December 22, 2013
Rails: routes
If we want to 'namespace' our routes, but do not want the 'named routes' to have namespace's name in the prefix:
namespace :admin, as: '' do
get '/post/new' => 'posts#new', as: 'new_admin_post'
end
Thursday, December 19, 2013
Unobtrusive Javascript
Need to read these:
http://www.codeproject.com/Articles/410948/How-jQuery-and-unobtrusive-JavaScript-can-be-poiso
http://blog.socialcast.com/unobtrusive-javascript-2/
http://www.ibm.com/developerworks/library/wa-aj-unobtrusive/
http://www.w3.org/wiki/The_principles_of_unobtrusive_JavaScript
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
http://stackoverflow.com/questions/8392374/difference-between-obtrusive-and-unobtrusive-javascript
http://stackoverflow.com/questions/4478795/what-is-unobtrusive-javascript-in-layman-terms
http://www.codeproject.com/Articles/410948/How-jQuery-and-unobtrusive-JavaScript-can-be-poiso
http://blog.socialcast.com/unobtrusive-javascript-2/
http://www.ibm.com/developerworks/library/wa-aj-unobtrusive/
http://www.w3.org/wiki/The_principles_of_unobtrusive_JavaScript
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
http://stackoverflow.com/questions/8392374/difference-between-obtrusive-and-unobtrusive-javascript
http://stackoverflow.com/questions/4478795/what-is-unobtrusive-javascript-in-layman-terms
Monday, December 9, 2013
Wednesday, December 4, 2013
Analytics: Piwik, Clicky
Piwik:
------
Piwik does not have Event Tracking
http://piwik.org/docs/analytics-api/reference/#SitesManager
http://piwik.org/docs/analytics-api/calling-techniques/
http://dev.piwik.org/trac
http://www.youtube.com/user/PiwikAnalytics
http://www.statstory.com/some-reasons-to-choose-piwik-analytics-over-google-analytics/
http://stackoverflow.com/questions/9662357/google-analytics-and-piwik-discrepancy
Clicky:
--------
http://clicky.com/compare/piwik
------
Piwik does not have Event Tracking
http://piwik.org/docs/analytics-api/reference/#SitesManager
http://piwik.org/docs/analytics-api/calling-techniques/
http://dev.piwik.org/trac
http://www.youtube.com/user/PiwikAnalytics
http://www.statstory.com/some-reasons-to-choose-piwik-analytics-over-google-analytics/
http://stackoverflow.com/questions/9662357/google-analytics-and-piwik-discrepancy
Clicky:
--------
http://clicky.com/compare/piwik
Monday, December 2, 2013
Rails: Reordering Columns
Sometimes it is necessary to reorder columns so that data is presented, by default, in a more meaningful way e.g. the 'key' columns probably should appear in the beginning, followed by other columns that do not allow a Null value, followed by columns that can take in Null values (basically, are not that important)
http://stackoverflow.com/questions/18899011/rails-4-migration-how-to-reorder-columns
http://stackoverflow.com/questions/18899011/rails-4-migration-how-to-reorder-columns
Subscribe to:
Posts (Atom)









