Sriharsha Vardhan
[The views expressed on this website/blog are mine alone and do not necessarily reflect the views of my employer.]
Thursday, May 23, 2013
Monday, March 11, 2013
Managing git remote branches
git clone --single-branch [remote URL] [local folder]
Thursday, December 13, 2012
printf instead of echo-e
It is a common need to echo content to files in scripts. But it could turn out a bit tricky to handle escape sequences like new line.
echo is provided as part of binutils but shell can provide its own too. Default handling of escape sequence varies from shell to shell. In case of Ubuntu default shell is dash(debian shell). It handles escape sequences by default. Thus sh -c "echo -e 'foo\nbar'" could end up as "-e foo\nbar" instead of foo followed bar in new line.
But printf is more portable and reliable than echo-e. Something with print is
sh -c 'printf "%b\n%b\n" "for" "bar"'
This yields consistent and more reliable results across mostly used shell variants.
Sunday, November 18, 2012
Windows 8 on Desktop - Review 1
Installation
slui.exe 3
. Login Screen
When there are more users instead of adding rows, it expects user to scroll right. In this case expecting user to do horizontal scrolling is meaning less. This should be scrolling vertical.Start screen
This is the view user gets to see after logging in.Tiles
- Live tiles are good.
- Right click options(live off, big/small, uninstall) are handy.
- Manual arrangement is not so naturally predictive. it needs some used to for users and some improvements from MS
Navigation
- Left Top thumbs down, so confusing
Irrespective of what app user is viewing, it shows preview of first app out of those running. It doesn't show preview of desktop apps like cmd (However Alt+Tab works). Only when user moves cursor down from top left it shows all apps. I don't know it is a bug or intended design. - Left Bottom OK
It is a quick way to navigate between start menu and last accessed app. - Left Bottom(Right mouse) Good
It is a quick launch for professional users. But there should be an option to add items to it. And styling of this menu can greatly improve. - Right Bottom Placing mouse at right bottom for menu is not so obvious but not so difficult to get used to. It is good that it changes background colour once menu is shown. But there is absolutely no need for date, time and network connection status here. It is so out of context here. Also options inside this menu are so discrete.
- Search - thumbs up, well done It gets context of active app by default though user can change it. List of apps is a bit confusing at first glance but now I am OK with that. Clicking on an app need not launch it as the intention here is to search not to launch it.
- Share - May be useful for some apps. Kind of nice to have.
- Start - So confusing. Difficult to get used to. When user is working on an app it opens start screen else last app. It doesn't serve context of any app. MS should consider to rework on this.
- Devices - OK Basically for quick printing etc..
- Settings - Interleaving app settings and pc settings is confusing. But it can be corrected by providing a more distinctive separation like heading or background colour.
- Search - thumbs up, well done
- Lack of close button thumbs down.
Lack of close button is a major departure from natural experience of windows
- Mouse on left top shows mere last window preview
- And sliding down mouse form left top shows banner where all opened apps are listed
- Now user got to right click on preview apps to get to close option
Default Metro apps
- Bing - Not bad
- Camera - Not so impressive
- Finance - Good enough
- Games - OK
- Mail, Calendar, People and Messaging - Good
- Maps - Pretty good actually They are from Nokia. Far better than Apple maps and catching up towards Google maps.
- Music - Below expectation
- News - Good enough
- Photos - Fails to impress
- Reader - Neat and simple
- SkyDrive - OK
- Sport - Could be made a potential area for app developers if MS intends to do so
- Travel - Good one. Social media integration is desirable
- Video - Very primitive. Practically useless
- Weather - Impressive. Sourced from Weather Decision Technologies
Desktop apps and tasks
- file explorer - Retained most of Win 7 features. Ribbon is OK. Otherwise nothing worth mentioning
- Notepad - Nothing changed
- cmd - Pathetic. MS can't build a decent terminal. Really a shame on their part.
- mspaint - Nothing changed
- snipper tool - Nothing changed
- compress & extract - Nothing changed
- calculator - Nothing changed
- task manager - Worthy improvements. It is better and useful
- control panel - Retailed most of Win 7 features
- Internet Explorer - Disappointing.
It has two modes. Metro mode and Desktop mode. Metro mode worked for few hours after installation. After that it always opened in desktop mode. I am not going to inner details like HTML5 etc. but as a user I will continue to use chrome as my default browser.
- Printer/Scanner handling - Nothing changed. Installs if printer is connected during installation.
- User management - Nothing worthy changed
- Add/Remove programs - Nothing changed
- Screen resolution - Nothing changed
- Service start/stop - Nothing changed
- Device Management - Nothing changed
- Disk Management - Nothing changed
- Event Viewer - Nothing changed
- File system hierarchy - Nothing significant
- Turn on/off windows features - Nothing changed
Store
Store app
- Navigation is not so impressive. A single row with long scroll is mediocre. It doesn't sense height of screen and build up visual experience when it is showing all categories. However once can click on a category to get zoom up view of all categories.
- It lacks multi/cross dimensional navigation and thus fails to offer experience-based choice.
- That minus at right bottom corner is rather absurd.
- It isn't very obvious that category header is actually a link.
- Apart from 'Top Free' and 'New Releases' I expected 'Top Rated' there. It is however available inside each category.
- Navigation through Sub-categories(where available) is not so intuitive with that lengthy combo box.
- It is not so obvious that apps can be searched as there isn't any box to type text. Users need to hover mouse at right bottom corner to get main menu and user search option there.
- It shows prices in local currency which is commendable.
- There is no way to uninstall an app from app store
- There is no way to launch an app while viewing at details of app.
- It is not so obvious that user need to click on right mouse and select "Your apps" to get to see installed apps. But it is not difficult to get used to this.
- There is no to clear uninstalled apps. Thus when user installs an app and feels that it isn't so impressive and uninstalls, it still remains in your apps list. There is no way to clear it. And clear button in Your apps doesn't serve any meaning full purpose except to deselect.
- Combo box in Your apps section is buggy. "Apps installed on xxx" shows apps not installed also.
- Experience of paying for an app is OK. And user can change a setting to always ask for password when buying an app. I couldn't find any option for redemption.
- It is not necessary to add payment information to use free apps.
Performance
Sunday, May 27, 2012
Global Keyboard shortcut to launch terminal in Mac OS X
I had to restore my Mac as it screwed up while upgrading to OS X 10.7.4. After restoring from scratch I had to setup few common things like global short cut for terminal.
I followed this http://forums.macrumors.com/showthread.php?t=171464
For quick reference here are the steps.
1. Launch Automator from the Applications folder
2. Choose Service
3. The line that states "Service receives selected" change it to "no input"
4. From the Action side drag to the workflow side "Launch Application"
5. For the pull down in the Launch Application action select the application you would like to launch. For Terminal you will have to go to the bottom and select "Other" and find it in the Utilities folder.
6. Save the Service giving it a unique name like Launch Terminal
7. Goto Keyboard Shortcuts tab within the Keyboard System Preferences
8. Select Services from the left pane and scroll down to General in the right pane. You should see your Service.
9. It's not so obvious, but double click to right side of your Services row. This allows you to enter a key combination for the shortcut.
10. Enter a key combination and close System Preferences.
*Note*
1. As this shortcut is for all applications. Atleast one application should be running for keyboard shortcut to take effect. May be Finder. So if you just login, the short cut may not work straightaway. Start atleast one app then you are ready to go.
2. Also if custome profile is created for terminal, make sure to make it startup (First Tab)
Wednesday, December 28, 2011
adopting sass with Sinatra
And now I regret for not adopting to such good frameworks from the beginning.
Though less offers dynamic stylesheets, 32kb javascript is too much of a burden for my embedded application.
As such I run a rake script to minify and compress markup and javascripts. I thought sass would be a better choice. I could simply run script to convert scss files to css.
But it would not be so much so convenient during development to convert these scss files every now and then to css. But thanks to Rack and Sinatra it was really easy to integrate sass with existing app. Here goes sinatra file.
require 'sinatra' require 'sass' get '/stylesheets/:name.css' do content_type 'text/css', :charset => 'utf-8' filename = "#{params[:name]}" render :scss, filename.to_sym, :layout => false, :views => './public/stylesheets' end get '/' do erb :index end
when they are imported.
_s1.scss
#fullname { p:first-child { color : grey; } p:last-child { color : lightgrey; } }
_s2.scss
#communication { p:first-child { color : red; } p:last-child { color : lightgrey; } }
@function contact_padding($n) { @return ($n * 3) + px; } @mixin contact($bw, $bc) { padding:contact_padding($bw); border: $bw+px solid $bc; font-size:20px; font-weight:bold; }
@import "s1", "s2", "theme"; .theme1 { @include contact(2,orange); }
<!DOCTYPE HTML> <html> <head> <link rel="stylesheet" type="text/css" href="stylesheets/common.css" /> </head> <body> <div class="theme1"> <div id="fullname"> <p>Sriharsha</p> <p>Vardhan</p> </div> <div id="communication"> <p>Email: mail@mydomain.net</p> <p>Mobile: +91 0101 010 101</p> </div> </div> </body> </html>
Monday, December 26, 2011
HTML5 arrows
I tried to get arrows marked out of html and css3. Here is the result http://jsfiddle.net/harsha/2aq7R/1/embedded/result
Just started with arrow head. This wont show up anything as border is transparent is all sides.
.arrow_head {
width: 0px; border-width: 20px; border-style: solid;
border-color: transparent transparent transparent transparent;
}
Now to get top arrow effect let us show up bottom border.
.top_arrow {
border-bottom-color: #E9E9E9;
}
Similarly to get down arrow let us open up top border
.down_arrow {
border-top-color: #E9E9E9;
}
border-left-color: #E9E9E9;
}
to get left arrow let us open up right border
.left_arrow {
border-right-color: #E9E9E9;
}
Now arrow body is pure border with fixed height and width. so to get right arrow
<div style="float:right">
<div style="width:20px; height:20px; background:#E9E9E9; float:left; margin-top:10px">div>
<div class="arrow_head right_arrow" style="float:left">div>
div>
Similarly all sides can be offset as shown below
HTML>
<html>
<body>
<div style="background:gray; width:300px; padding: 10px; height:40px">
<div style="float:left">
<div class="arrow_head left_arrow">div>
<div style="width:20px; height:20px; background:#E9E9E9; margin-left:40px; margin-top:-30px">div>
div>
<div style="float:right">
<div style="width:20px; height:20px; background:#E9E9E9; float:left; margin-top:10px">div>
<div class="arrow_head right_arrow" style="float:left">div>
div>
div>
<br />
<div style="background:gray; width:300px; padding: 10px; height:40px">
<div style="float:left; margin-top:-20px">
<div class="arrow_head top_arrow">div>
<div style="width:20px; height:20px; background:#E9E9E9; margin-left:10px">div>
div>
<div style="float:right">
<div style="width:20px; height:20px; background:#E9E9E9; margin-left:10px">div>
<div class="arrow_head down_arrow">div>
div>
div>
body>
html>
And here is the css
.arrow_head {
width: 0px; border-width: 20px; border-style: solid;
border-color: transparent transparent transparent transparent;
}
.top_arrow {
border-bottom-color: #E9E9E9;
}
.down_arrow {
border-top-color: #E9E9E9;
}
.right_arrow {
border-left-color: #E9E9E9;
}
.left_arrow {
border-right-color: #E9E9E9;
}