Sunday, October 2, 2016

Getting Angular-CLI on Fedora 24

Well we all love Angular :). But for a developer who is stepping from Java Maven world into Javascript client side development with Angular2, nodejs, webpack etc is some what alien. Well the thing is there are so many built tools, packging tools out there for javascript which is hard to grasp the standard to start with.

But like the prayers been answered we have Angular-CLI. But it was bit of a bumpy ride for me to get it started on Fedora24 box. So here are the steps to get you going

1. You need to install g++ if you don't have it yet, run the following command to install it.
$ sudo dnf install gcc-c++
2. Then update the npm to latest, i mean the very latest or next version by running the following command
$ npm -g install npm@next
3. Clean the npm module cache by running the following command
$  npm clean cache
4. Now you can install angular-cli by running
$ npm install -g angular-cli
Thats it, Now you can follow documentation on https://cli.angular.io/ and start developing your first angular2 application.
 
    

Saturday, April 16, 2016

Perfect GTK styles for Eclipse

Recently i switch to KDE and i had to work on the eclipse gtk settings again to get rid of huge toolbars. But lucky ubuntu forums had lot of help and the following particular forum post helped to solve it.
http://ubuntuforums.org/showthread.php?t=1465712

Now before you start you need to make sure the eclipse is running in gtk2 mode. Basically you can do it with a small shell script as below.

#!/bin/bash
export SWT_GTK3=0
./eclipse
Now you need to create a gtkrc file which you can select any name you like, But i choose it to name as .eclipse-gtkrc-2.0. Now copy the following content into this file and save it.

include "/home/{user.home}/.gtkrc-2.0-kde4"
style "gtkcompact" {
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkToolbar::internal-padding=0
GtkToolbar::space-size=0
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0
}
style "compact-toolbar"
{
GtkToolbar::internal-padding = 0
xthickness = 1
ythickness = 1
}
style "compact-button"
{
xthickness = 0
ythickness = 0
}
class "GtkToolbar"   style "compact-toolbar"
widget_class "**" style "compact-button"
class "GtkWidget" style "gtkcompact"
{user.home} must be replaced with the user home folder name of yours.

Now update the shell script that you have made to run eclipse in gtk2 mode as follows.

#!/bin/bash
export SWT_GTK3=0
ECLIPSE_HOME=/opt/eclipse/neon/eclipse
GTK2_RC_FILES=~/.eclipse-gtkrc-2.0 $ECLIPSE_HOME/eclipse
Update the paths to suite you and that's it. Your eclipse will look as follows


Enjoy :)

Sunday, April 10, 2016

Huawei E3131 on Ubuntu 15.10

This post is about getting the Huawei E3131 usb modem to work smoothly on Ubuntu 15.10. If you are a user who is using this modem you must have experienced that the modem fails to connect on a cold start. You need to unplug it and plug it again after you logged in to get the modem working. Well while doing some digging in the internet i came across the following bug report which helped me to fix the problem.

https://bugs.launchpad.net/ubuntu/+source/usb-modeswitch-data/+bug/1192297

What i did was the following

  • Copy /lib/udev/rules.d/40-usb_modeswitch.rules to /etc/udev/rules.d/40-usb_modeswitch.rules 
  • Edit /etc/udev/rules.d/40-usb_modeswitch.rules and add the following rule at the end of the rule list. Make sure its above the LABEL
# Huawei E3131H
ATTR{idVendor}=="12d1", ATTR{idProduct}=="14fe", RUN+="/usr/sbin/usb_modeswitch -v12d1 -p14fe -J"
  • Comment the following rule as below
# Generic entry for all Huawei devices, excluding Android phones
# ATTRS{idVendor}=="12d1", ATTRS{manufacturer}!="Android", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"
Thais it with the configuration. Now shutdown the pc and start it to see if it is working :)

Update:

The configuration file is no longer needed since the rule uses the huawei mode switch.