Raspberry PI 2

First time setting up:

  1. Setting up raspbian
    1. You will need USB wifi adaptors – 802.11N
    2. Wireless keyboard and mouses
    3. Download latest raspbian
      1. https://www.raspberrypi.org/
      2. Noobs/Raspbian
      3. Download torrent to the micro sd/ sd burner (on your local computer)
    4. Setting up the sd card: (on your local computer)
      1. format the sd card – use the formatting tools on sd association (https://www.sdcard.org/downloads/formatter_4/eula_windows/index.html)
      2. even if the card is bigger – the sd card burner will setup the size for the os
      3. copy all the downloaded zip files to sd card
      4. When this is done put the sd card into the raspberry pi 2
    5. keyboard, mouse, wifi and sd card adapters all needs to be on raspberry
    6. put the power up – micro usb
    7. connect hdmi to screen
    8. select the raspbian option on the start up screen and start installing
    9. when the installation done – set the boot path (follow the video guide)
    10. Setting up wifi:
      1. on initial screen – go to wifi config and follow the setu process
    11. Power supply:
      1. any micro usb charger with 5volts power supply at 1A current or more
      2. i’m using Samsung galaxy tab’s charger


Buying wifi adapter from anything below:

  1. http://au.rs-online.com/web/p/wireless-adapters/8920012/
  2. http://www.ebay.com.au/itm/150-Mbps-USB-Wifi-Adapter-W-Antenna-Raspberry-Pi-Mac-OSX-Windows-Linux-/281704710784?hash=item4196e8c280:g:PS4AAOSwx-9WzACc
  3. http://www.ebay.com.au/itm/150Mbps-Mini-USB-WiFi-Wireless-Adapter-Network-LAN-Card-802-1n-g-b-Ralink-RT5370-/182304215506?hash=item2a722d91d2:g:r10AAOSwMtxXq-u-
  4. http://www.ebay.com.au/itm/New-Wireless-USB-Adapter-LAN-Wifi-Dongle-f-Raspberry-Pi-802-11b-g-n-150Mbps-AU-/111838168586?hash=item1a0a13060a:g:GzwAAOSwgyxWXUNj

Installing windows 10:


Installing raspbian with pixel (full desktop version):


Shutting down raspberry pi:

  1. Shutdown like windows from the menu bar
    1. green light (next to the red light) which indicates activity stops blinking when the pi shuts down
    2. wait for a few seconds and then unplug the power
    3. Done

NativeScript – building mobile apps with NativeScript

NativeScript with JavaScript:

  1. NativeScript is a cross-platform JavaScript framework for building native mobile apps for iOS and Android.
  2. NativeScript is free and open source
  3. NS renders UIs with native platform rendering engine, no web views.
  4. Prerequisites:
    1. JavaScript
    2. CSS
    3. Terminal
    4. IDE
  5. Installation: NativeScript CLI install needed on the machine – http://docs.nativescript.org/start/quick-setup
    1. Windows installer – http://docs.nativescript.org/start/ns-setup-installer
    2. If your machine already has Android SDK installed then you’ll need to manually install NativeScript following the steps on the quick-setup page
    3. Windows intaller needs – Java Development Kit, Nodes.js, Android SDK pre-installed
  6. Complete the installation by following all the instructions above

Starting NativeScript:

  1. tns command from CLI
  2. tns create HelloWorld –template nativescript-template-tutorial to create Helloworld app
  3. Go to the app folder – cd HelloWorld
  4. Running the app:
    1. tns run android:
      1. You must have at least one AVD (Android Virtual Device) configured on your development machine for this command to run your app up on an Android emulator. If you don’t have one installed currently go ahead and set one up now.
      2. creating new virtual android emulator:
        1. Open android sdk manager from start menu – You have installed as part of the pre-requiresites for NativeScript
        2. Check all the system images are installed for future use or else click the install packages button at bottom right corner.
        3. Create Andrios virtual devices:
          1. http://docs.nativescript.org/tooling/android-virtual-devices
          2. Install HAXM for accelaration – https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
          3. Complete the creation of emulators by clicking start button – check to see if there are any errors.
          4. If there are no errors the emulator will open up
      3. Execute the run command again to run your app on android emulator
      4. Can run multiple emulators at the same time:
        1. tns device command lists all devices
        2. choosing a device by – tns run android –device 2
        3. to run all connected devices is by – tns run android
    2. tns run ios
    3. Tns run won’t stop until ctrl+c as the app refreshes as you change the code
    4. Changing colour schemes – http://docs.nativescript.org/ui/theme#color-schemes
    5. When you add a new dependency you need rebuild the app from scratch
    6. Ref – http://docs.nativescript.org/tutorial/chapter-1

Builidng a real-world app:

  1. http://docs.nativescript.org/tutorial/chapter-2
  2. http://docs.nativescript.org/tutorial/chapter-4
  3. login.js: code-behind:
    1. frameModule for navigation
    2. UserViewModel is for the login
    3. exports.loaded page binding is important for any parameter passing to work
    4. login works from now
    5. As a best practice, testing for a platform with an if check is the way to go when you have a small number of platform-specific changes to make. If, on the contrary, you have big, entirely different chunks of code for iOS and Android, you might want to go with platform-specific code-behind files—e.g. login.ios.js and login.android.js.



WAMP/localhost access in the domain network

If you want to access WAMP installed one computer from another computer or a mobile device:

  1. Check Firewall settings and make sure port 80 is open. If it is not open, follow this link to know how to open port 80 for HTTP requests.  https://wiki.mcneel.com/zoo/window7firewall
  2. If the Firewall settings are ok and you’re still not able to access it then you’ll need to edit httpd.conf file of your Apache server.
    1. Add your local ip range to the ‘Require’ part of the code.
    2. Follow the below link to know how: http://stackoverflow.com/questions/23382627/wamp-cannot-access-on-local-network-403-forbidden




Note: Bootstrap uses Grunt for its build system, with convenient methods for working with the framework. It’s how we compile our code, run tests, and more.  (http://getbootstrap.com/getting-started/)

Grunt commands:

  1. grunt dist
    • Regenerates the /dist/ directory with compiled and minified CSS and JavaScript files.
  2. grunt watch
    • Watches the Less source files and automatically recompiles them to CSS whenever you save a change.
  3. grunt test
  4. grunt docs
    • Builds and tests CSS, JavaScript, and other assets which are used when running the documentation locally via bundle exec jekyll serve.
  5. grunt
    • Compiles and minifies CSS and JavaScript, builds the documentation website, runs the HTML5 validator against the docs, regenerates the Customizer assets, and more. Requires Jekyll.

  • npm required for Grunt
  • Grunt is a javascript task runner
    • compress everything – all done by grunt
    • compiles Sass into css
    • compress JavaScript, CSS, HTML files
    • Combine JS files into a single file
    • Concatenates JS & CSS files
  • Build system with grunt
  • Software dependencies:
    • Node – javascript runtime
    • npm – package manager
    • grunt cli
    • grunt
    • plugins
  • Installing grunt
    • npm install grunt
    • pakcage json has to be created
      • npm init – creates the package json
      • package name has to be defined and shouldn’t be ‘grunt’
  • Installing grunt cli
    • npm install -g grunt-cli
  • Running grunt
    • grunt
  • Running grunt tasks
    • grunt taskname
  • Using existing project:
    • npm intall – will install all dependencies
  • Plugins:
    • grunt has so many plugins
      • loadNpmTasks – loads the default configs
      • To concat, you need to load the grunt-contrib-concat & to watch the changes grunt-contrib-watch
      • Installing grunt-contrib
        • npm install grunt-contrib-concat –save -dev
        • similar commands for all plugins
    • Handlebars:
    • Uglify:
      • beautifies js code
    • Sass:
      • Complies sass files to css
      • Installing grunt-contrib-sass

Removing /public from URL

There are couple of ways for doing this:

  1. htaccess method:
    • move the htaccess file from public folder to the root folder
    • rename server.php to index.php
    • that’s it really!
    • The biggest flaw using this way is that .env file becomes accessible to web.
  2. Using Content Moving:
  3. Changing the document root on the server



Find this out: