Jun 3, 2015

AngularJs UI-Router conditional Otherwise link

For easier handling of redirection of $state,
when our angularJs app handling an unknown $state name,
it'll refer to $urlRouterProvider.otherwise("/"); which have to be written inside "config()".
assuming your angular app is declared as below:

var app = angular.module([]);

app.config(['$urlRouterProvider', function($urlRouterProvider) {
  $urlRouterProvider.otherwise(function($injector, $location) {
    var AuthService= $injector.get("AuthService");
    if (AuthService.isLoggedIn()) {
      return "main";
    } else {
      return "login";
    }
  });
}]);
this allow your otherwise become dynamic depend on the login status of a user. In the code above, AuthService is an example authentication service to help determine if a user is logged in.

May 27, 2015

You just simply cannot change the date format in HTML5 date type input

By referring quite number of sites,
and did quite some number of stubborn trials...

the conclusion is that you
CANNOT CHANGE DATE FORMAT FOR HTML5 DATE TYPE INPUT

thanks a lot to the solid references:
Is there any way to change input type=“date” format?
Example provided in fiddle 

further reading, for quick & easy learning:
The date Type

Mar 23, 2014

raspberry pi for dummy: WPA_SUPPLICANT: /SBIN/WPA_SUPPLICANT DAEMON FAILED TO START

Monday, 27 March 2017 UPDATE:
- please refer to this official Raspberry Pi Wifi configuration documentation

After you have the USB Wifi dongle plugged into your RPI, you can scan wifi sign near you with
sudo iwlist wlan0 scan 
command (if this work, that mean you are close to setup wifi successfully)

Finally, if you haven't added any network config in your wpa_supplicant.conf (/etc/wpa_supplicant/wpa_supplicant.conf) insert wifi detail using:
wpa_passphrase "your wifi SSID" "your wifi password" >> /etc/wpa_supplicant/wpa_supplicant.conf

Note: please refer official link attached above for detailed explanation.


If you face problems stated below:
- WPA_SUPPLICANT: /SBIN/WPA_SUPPLICANT DAEMON FAILED TO START


You may first look at this Setting up Wifi (EDIMAX) on Raspberry Pi,
if you're still fail to configure a successful connection to your access point (AP or wifi router),
please remove the quote symbol to your psk value like this in your wpa_supplicant.conf:
network={
    ssid="Your SSID Here"
    key_mgmt=WPA-PSK
    psk=YourPresharedKeyHereWithoutQuote
}
get your PSK value from WireShark WPA-PSK Generator.

Once done:
apply commands and restart network or your RPI (sudo reboot):
sudo service networking restart
sudo ifup wlan0 (or sudo ifdown wlan0 then sudo ifup wlan0)

I wrote this because I saw too many tutorial out there didn't mention/emphasize about removing the quote symbol for psk value.
examples
Circled quotes symbols should not be around your psk value

wireless setup command reference: Useful Linux Wireless Commands

Oct 20, 2013

Samsung SL i9003: from any custom ROM to Stock ROM 2.3.6

Step 1: Download any of the full package files of the Gingerbread from xdaDevelopers

Step 2: Refer to this video and see how do you place each of the downloaded file in Odin.

Step 3: Download the latest firmware from Samsung and flash it in the easy way by referring to xdaDevelopers

Sep 10, 2013

Bootstrap: Automatically add asterisk symbol to detected 'required' form input field

$('input').each(function(){
   if($(this).is('[required=required]')){
    if ($(this).is('[noAsterisk]')){
    return null;
   } else {
       $(this).closest(".YourClassName").children("label").append('<font style="color:red;position:absolute;" > *</font>');
   }
   }
});

* javascript above require jQuery
with the code:
if ($(this).is('[noAsterisk]')){
     return null;
}
allow you to add exception with 'noAsterisk', where you don't require asterisk as there had 'required' html tag appended.