Tag Archives: tutorials

Effective Study Habits

When one group of students receive their degrees, a new group is always there to take their place. Each one of us have our our way of successfully demonstrating the acquired skills and knowledge on exams. But in some disciplines such as Engineering and Geology, just a one method will not always work. While I am not the modeled student you should look up to, here are few things that worked for me from first to fourth year at the University of Calgary.

Time management

You do not have to make a timetable to use your time effectively. I personally use arbitrary deadlines as opposed to having a timetable. Some of my friends in Geology have allocated time slots for each subject to make sure no subject is left behind till the end of the semester. For me it will only result in rushing through important concepts just to stick to the time slot. This is not very effective for subjects like Geology. Geology is a mixture of Science, Arts and History. It also involves practical knowledge; lab exams. I recommend all first year students to spend more time on your weak points rather than dividing time equally for each subject. For example, if you are struggling with Mineralogy, you should put more time and effect to that subject over others.

Type of subject matters

Do not expect to study Hydrology or Physics the same way you would study for Paleobiology or Geologic History. The amount of memorization without much of a logical process in subjects like Paleobiology is much higher than that of Hydrology. Hydrology involves understanding of mathematical equations derived from empirical Geologic data. Paleobiology involves studying the history of life derived from the empirical Stratigraphic data. Very few students will be able to study both subject using a similar method. I found it is important to understand logical concepts in any subject that involves Mathematics and Physics than just to memorize formulas. While Professors/Instructors may disagree with my view on how each subject is differ from each other, let’s face it, we all know this is one of the reasons why some students are good at memorizing and others at mathematics!

If you are student in Geology or similar multidisciplinary program, I highly recommended improving both memorizing skills and logical skills.

Tips for studying

If the subject require little of no logical thinking then,

  • Learn the concepts right at the first time early on.
  • Repeat what you have learned by transforming your knowledge into others forms; writings down, anticipating questions for exam, etc.
  • Try to teach someone (your friend or even your dog…) by acting like a teacher. Ask your friends to ask you questions to see if you remember.
  • Test what you have memorized few week earlier by trying to “pull-out” your memory often.
  • If you found that you have learned something wrong, correct immediately. Sometimes I have incorrectly answered questions because I memorized the incorrect information.
  • It is scientifically proven that studying in the early morning improves memory. In fact, this technique has been used by Buddhist monks in India for thousands of years. May be you should try weaking up at 4:00 AM even on Saturday instead of studying all night.

If the subject require logical thinking and memorizing (about equally) then,

  • Addition to what is posted above, relate theoretical concepts to real world issues. For example, hydrological conductivity is not only can be summed up with few equations, but also can be relate to Calgary’s groundwater supply.
  • Never memorize a logical concept like Darcy’s Law. Instead find practice problems and use the formula over and over until you understand how to use it. Memorizing a formula will not only hurt you on exams, but also will effect the quality of work you will do as a Professional Geologist or Engineer.
  • If something makes no sense (logically), probably something is wrong. In other words, if you find things you studies makes no sense, may be it is time to stop studying and time to figure out what went wrong. In multi-steps questions, spend more time getting the first part right before you move on to the next step.
  • During studying and exams, make sure your tools good. What I mean is that if you need your calculator in Degree Mode, make sure it is in degree mode before attempting a question.
  • In subjects like Geophysics and Hydrology, there are often connections between the mathematics side and observational science. Try to find relationships between them to understand the concepts better.
  • Some problems may not have right or wrong answers but rather a logical answer. So make sure you can manipulate what your instructor taught you in any form in any way. Do not just go for questions similar to what you have learned in class. I can take a simple question and without changing any values, I can make it into a complicated one. If I can do that, so can the Instructors.
  • Never assume that all questions have to “make sense”. Do not be confused between the “logics” and “making sense”. They are not always synonymous to each other.

In addition… engineering and Geoscience students should always try to relate their lecture materials to lab materials. It will help bridge the gap between the theoretical knowledge and practical applications.

Some students have found other ways to improving their skills like, mediation/yoga, “puppy theory”, sports, pron, etc. Whatever you do I recommended starting early and not so close to the exams. Changing your habits close to exams could actually hurt you rather than helping in improving your grades.

Google Custom Search Refinements

Google is a very popular search engine. One of the driving forces behind the popularity is the Google Inc’s generous offers such as free site based search. The Google Custom Search Engine (CSE) is a such free Webmaster tool. It allows the site owners to integrate the powerful Google search system into their website. I already discussed how to replace the default WordPress site search with your CSE. In this article, I will introduce you to creating content filters.

Filtering the web

As time progress, the amount of pages and media also increase with it. This is not just true for large scale cooperate websites, but also true for personal websites like SANUJA.COM. Someone who publish articles and other web items regularity would at least have one or two articles/items per week. If you multiply them by the number of weeks per year, that’s a lot of information. The problem with general web search on your site is that the visitor may move out of the site as a result of it. The solution is to use an integrated site search that only search your site. All Content Management System (CMS) comes with some form of built-in or modular site search. For average web owners, that’s all they need. But what if you would like to have more control over how the site content is search? The CSE will allow you to restrict your search to specific area of your site. This is how you configure your Google CSE to refine your search results.

Refining

If you have a section of your website that is more important than the rest, then refining is a good way to help the visitors narrow down their search. For example, on my site I empathize the academic exam bank. I want my visitors to filter out all the materials under Exams and Resources during a search (if desired). Here are the steps to creating a refining filter:

1. Log-in to Google Custom Search Engine (GCS) and select the search engine you would like to edit.

Selecting your Google CSE
Selecting your Google CSE

2. Choose “Search features” from the right hand menu and select the second tab “Refinements”. Now press “Add” button from the Refinements pane.

Adding a refinements.
Adding a refinements.

3. A pop-up window will appear with form for new Refinement addition. Save the item.

Add new refinement popup.
Add new refinement popup.

4. Choose “Setup” from the right hand menu and select the “Basics” tab. Under “Sites to search” you can add a limitation.

Refinement directory/link limitation.
Refinement directory/link limitation.

In this particular example I provided my visitors an option to limit their search to my exams area. Since all my exams bank questions are followed by the common URL, “http://sanuja.com/blog/exams/*”. Which is like a prefix. It will allow the Google CSE to limit all the returned search results to Exams pages.

5. Choose the Refinement option created in step 3.

Limiting the site directory and adding the Refinement
Limiting the site directory and adding the Refinement

Here is an example of a refined search…

Refined search results using the tab style.
Refined search results using the tab style.

Excluding content

You can prevent the Google Custom Search from indexing certain pages or URL (link) patterns. To do that, you can:

1. Navigate to exclude section by clicking the “Advanced” link at the bottom of “Sites to search” section.

Advanced link.
Advanced link.

2. Once in the Advanced sections, you should see “Sites to exclude”. Add either one URL at a time or use the prefix method just like in the refinement configuration.

Restricting (excluding) a prefix URL pattern.
Restricting (excluding) a prefix URL pattern.

There are few reasons to why you may exclude URLs, pages, images or other data. Pages from access restricted or membership based areas can be hidden from search results to prevent unwanted traffic to such areas. Sometimes images have copyright agreements that specifically restrict your users from searching images. You may have “junk” or temporary URLs such as http://domain.xxxx/P?7299 which often generated by some Content Management Systems or plugins/scripts.

Rooting an Android

Some of you may have heard about the term “root” or “rooting” with regards to Android mobile Operating System. This term is not something new to computer and software geeks. Root is the most fundamental level in a UNIX or Linux based operating system. In order to install some apps and to tweak the behavior of a OS, you need the root access.

Due to various variables, every option listed here may not work for your particular phone.

Skip Jargon

Introduction to Android

I am not going to give long history on Android. From a technical perspective, you should know that it is an open sourced mobile Operating System currently supported and developed by Google. More than hand full of manufactures use this OS to streamline their devices. Android can be installed on mobile phones, tables, televisions, GPS units and any other electronic devices that support such architecture.

Rooting

Rooting is granting access to most fundamental operations which otherwise will be blocked by system default. While not all applications of rooting may harm the device, due to the wide openness of what you can do with root access could brick your device (f*&^ked up beyond repair). This is why rooting an Android device will void your manufacture’s warranty. If you are not technically inclined, I would stay away from rooting. This article is written for tech guys who have limited experience in Android environment.

This also place a lot of responsibilities on the end user. After rooting a device, you will not have the “safety net” from malicious apps which otherwise will be in placed by default. It will be your sole responsibility to manage your root access permissions wisely.

How to Root an Android

Installing the Recovery

1) Download and install the drivers for your device from the manufactures. You may find them on their support website and/or the media that was provided to you by in the original packaging.

2) Download ODIN software. It will make it easier in flashing recovery and the rooted firmware. Please note that the ODIN will only works on Windows based computers.

3) Download the Odin flashable recovery (.TAR file) for your device then copy it to the same folder as Odin. There is an another option if you have a .img file. Please read further down for instructions.

4) Open ODIN by right click on Odin.exe –> “Run as administrator”. You should come up with a window similar to the following.

Ordin Program on Windows
Ordin Program on Windows

5) Turn off your phone and reboot into Download Mode. In order to go into the Download Mode, hold Volume Down + Home + Power while it shuts down. Continue to hold until the device is powered up and a text message appears on the top corner (very small sized texts). Once inside the Download Mode, press Volume Up to enter.

6) Connect the device to computer via USB/charger cable. It is recommended to use the original manufacture provided cable. If your phone do not support USB 3.0, please do not use USB 3.0 port on your system even if it is backward compatible. This is just to be safe.

7) The ODIN window should have a COM** port highlighted as shown here.

Comm USB port highlighted in ODIN.
Comm USB port highlighted in ODIN.

If ODIN is not highlighting the port, go back and make sure you have properly installed the right device drivers from your hardware manufactures.

8) Click on the PDA button on the right right pane of the ODIN. Refer to above image.

9) When prompted (once the PDA button is selected) go to the firmware location and select the firmware file (TAR file).

10) Warning! Make sure Auto-Reboot and F. Reset Time are the only options checked and that PDA is the only other thing checked on ODIN before starting the flash. CHECK again and again your settings and that you have selected the correct firmware for your model phone and are using the correct options. If you are using a laptop, make absolutely sure you are plugged in, or if on battery, that it is charged enough and will not go into sleep mode during flash.

11) Click Start to begin the flash. This will take a while, so be patient. Do not unplug or remove the battery during the installation. I highly recommend placing the device on a solid stable surface with the USB cable attached during this process. I would not move the device since some computers and devices have lose USB connections which could potentially disconnect your device. If the device gets disconnected, this may result in bricking your phone.

Flashing the ClockworkMod Recovery.
Flashing the ClockworkMod Recovery.

12) Once the installation is successfully completed, the ODIN will report PASS on the top left hand corner. The phone should have automatically rebooted at this time.

ODIN report back "PASS" in a green box after a successful install.
ODIN report back “PASS” in a green box after a successful install.
You may unplug the phone and close Odin if you wish.

13) Wait at least 5-10 minutes (or even as long as 30 min) for the system to boot the first time and then build its cache. Do not remove the battery or disconnect power during this time.

You may now flash a ROM file using the PDA button on the ODIN. You can also flash a ROM using either a custom recovery or the default system.

Another option for ROM Flash

1) Download the appropriate ROM zip file and save it on your phone (just like saving any other file).

2) To get into the recovery mode, hold Volume Up + Home + Power while it shuts down. Continue to hold until the device is powered up. An example of a recovery screen is shown below (CWM).

ClockworkMod Recovery screen.
ClockworkMod Recovery screen.

3) Choose “install zip” (or “install from zip”, “install ROM”, etc) and select the zip file you saved.

4) After few minutes you should get a success message. Now go back and reboot your phone.

Third option for ROM Flash

You may flash a ROM that comes in the image (.img) format. Do not feel overwhelmed by the coding. Just follow the instructions and it will be installed on your device in few seconds.

1) Download a recovery image of your choice. For example; ClockworkMod Recovery Images. Save the .img file in your device’s memory.

2) Rename the image file to recovery.img or anything of your choice. Note: If you decided to rename the file other than recovery.img, then please change the second line of code appropriately to reflect the file name (dd if=/sdcard/YOUR_FILE_NAME.img of=/dev/block/mmcblk0p18).

3) Download a terminal app, which will allow you to enter commands into your Android system.

4) Open the terminal app and follow these instructions.
– type and enter

$ su

– type and enter

# dd if=/sdcard/recovery.img of=/dev/block/mmcblk0p18

– type and enter

# reboot recovery
Example of a terminal with recovery image named as "re.img".
Example of a terminal with recovery image named as “re.img”.

There are significant risks associated with this method. If you flash an incompatible ROM or if you enter the codes wrong, you could end up bricking your phone.

Common Errors

During the rooting and installation process of a custom ROM, you may come across errors. Do not panic because most of these errors are common and can be fixed.

Status 7 Error – installation aborted

Be warned that editing the code impropriety may result in bricking your device. Before edit the code in the ROM zip folder, make sure that you have the right ROM for your phone. By removing the code, we essentially removes the safety mechanism in which recoveries like ClockworkMod uses to block invalid zips from being installed.

Clear codes in updater-script file up to (NOT including) show_progress(0.500000, 0);. You should be able to locate this file at, META-INF –> com –> google –> android. The number of lines that should be deleted varies with each custom ROM. For example, the CynogenMod 10.2 will have the following check code at the very binging.

assert(getprop("ro.product.device") == "d2att" || getprop("ro.build.product") == "d2att");
assert(getprop("ro.bootloader") == "I747UCDLK3" ||
       getprop("ro.bootloader") == "I747MVLDLK4" ||
       getprop("ro.bootloader") == "I747MUMBLK3" ||
       getprop("ro.bootloader") == "I747MUMBLL1");
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
package_extract_file("system/bin/backuptool.sh", "/tmp/backuptool.sh");
package_extract_file("system/bin/backuptool.functions", "/tmp/backuptool.functions");
set_perm(0, 0, 0777, "/tmp/backuptool.sh");
set_perm(0, 0, 0644, "/tmp/backuptool.functions");
run_program("/tmp/backuptool.sh", "backup");
unmount("/system");

Initial boot stuck in a loop

Go back to recovery and clear (wipe) user data, System, Cache and Dalvik. Instructions for will soon be posted here. These options are in the recovery section under “advanced” menu.

GooglePlay Store is not installed

Most custom ROMs do not include GooglePlay files. You need them not only to download apps, but also for basic functions such as the Google Keyboard. You can flash this file into your device using the any compatible ZIP file available online with the GooglePlay Store.

1) After downloading the ZIP to your computer/phone, relocate the ZIP file to the root of your device storage main memory. This will make it easier to find during flashing.

2) Go to the Recovery Mode and select “install zip”.

ZIP folder installation choice.
ZIP folder installation choice.

3) Select the option for device storage memory.

Go to device storage memory.
Go to device storage memory.
If you have saved the ZIP file in the root of the device, it will probably be under a folder titled “0”.

4)Go back and clear memory before rebooting. Once the reboot is complete, you should see your GooglePlay app. If you end up with a connection error even when you have a wifi or mobile network connection, try the following for troubleshoot:
– Check if you have installed the latest compatible version of gapps for your mod.
– Check if the hosts configuration is correct using a file explorer app. Go to device root -> etc -> hosts (open as a text file).
– If both of the above failed, delete the GooglePlay app (from the settings), then re-download the ZIP and start this process over. Sometimes during download process, the file gets corrupted.

Too many choices; help me out

To a novice Androider, choosing what recovery and ROM to flash along could discourage rooting. I am all for choices, but sometimes even I need some guidance. You may choose any recovery and ROM that is compatible with your device. You may even use the stock ROM with the root access. It all depends on your choices. However, in case you need my opinion (personal choice), this is what I would recommended:

  • Compatible version of ClockworkMod Recovery (Touch or non-Touch)
  • Compatible version of CyanogenMod stable release
  • SuperuserSU app for controls
  • Compatible signed version of Google Apps zip

Happy rooting 🙂

Home electrical wiring basics

During home automation projects, you will probably replace the electrical fittings such as outlets for appliances and lighting fixtures. There are few basic things you should research before you begin. But first of all let me give you a warning; if you do not have experience working with electrical wring, please contact a professional for help. In this article, I will explain how to replace a traditional electrical switch to a Z-wave compatible switch.

Advice to all dummies

Electric shock alert

The following project involves working with ~ 110/240 volts alternating current (AC). Even with the power cut offed, there is always a risk of electric shock. Do not work on this project if; you are unfamiliar with electrical work, do not have proper equipments and/or regulations and laws in your area prohibit do-it-yourself (DIY) electrical modifications. I, Sanuja Senanayake or the site sanuja.com will not take any responsibility for any personal injury or property damage.

ace_sydney_electrians

Equipment

The following items are essential to this project. In addition, you may require other materials such as drywall patches for cosmetic work.

  • Suitable screw drivers and/or bits; electrically insulated drivers would be better
  • Wire cutters and strippers
  • Electrical tape
  • Electrical wire connector clips in few different sizes
  • Multimeter; a digital unit would be better/tester
  • Z-wave compatible switch

Optional items.

  • Extra electrical wires (short one would be enough)
  • Gang box
  • Wire staples and hammer

Let’s go…

After deciding which switch to replace, find the trip switch for the circuit on you central electrical box. If it is a light, I would turn it on to check if the power is still there. If you are installing a relay for a garage door, make sure the door is at closed position before you cut off the power. Prior to installing the Z-wave or wireless device read the manufacture’s guidelines for installation and usage. It is recommended to have at least 1/2 of the signal power from automation controller and the wireless LAN at the location. You may use a repeater for better signal strength. Please note, all Z-wave wired products (non-battery operated) are repeaters of the Z-wave signal.

After turning off the main power to the circuit, using your multimeter and/or tester, check if the power is out. Once you know that for sure, remove the two screws holding the switch. Gently, with some force, pull out the switch until you can access the left and right sides of the unit. Now, you should be able to remove the wires. But wait! Before you disconnect any wires from the old switch, I recommend taking a pictures of the setup. This can be very useful in places with three of more phases (and many other situations with lots of wires). It is important to have enough room in the gang box in order to accommodate the bulky back side of automated switches. If you find it is too tight to place all the new switches in the particular box, please replace the current gang box with a new unit with one extra slot. The extra slot can be closed up with a dummy plate as opposed to populating with an another switch.

You cannot install a dimmer switch in all locations due to wiring limitations. If you already have a traditional dimmer, you can install a automated dimmer at the same location. However, you may not have the dimming support on all gang boxes. The Z-wave switches often require a common wire. So, what is a common wire?

Electrical wire identification for a Z-wave dimmer.
Electrical wire identification for a Z-wave dimmer.

In the above image, the common wire is the white wire that is labeled C. All the common wires from switches attached to the same point. The wire B is the neutral wire (also white) that goes to the light. The green wire labeled G is the ground. Finally the Z-wave dimmer switch is labeled Z.

In this particular location, I can install two independent dimmers. But not all locations are wired to handle dimmers. If you do not currently have a dimming switch, it is possible that you cannot install one without extensive wiring. Unfortunately this is the case for most older houses. The cost of electrical home automation can be significantly increased with the age of the house.

When adding a new unit, always follow the instructions of the manufactures and the guidelines on electrical work in your area. Make sure the wattage rating of the automated unit does not exceed that of the load. For example, in my experience a unit that is rated for 500 W would be good for about 400 W load. After that between 400 – 500 W you are kind of experimenting. It may even handle 600 W but I recommend keeping units under load.

Make sure the wires are connected to each unit are securely held. Gently try to pull out the wires from all wire connector clips to ensure that all the wires are in place. Do not provide power to the circuit, without checking the integrity of your connections.

Once you have hooked up the wires, clear the area of any debris and keep the unit(s) out of the box. Please provide ample space between the electrical unit and the gang box to prevent electrical arcing. Now go to the main switch board and turn on the power. Check if the light(s) or appliance functions as expected. In case of a smoke or spark, immediately turn off the circuit.

Once you are done testing, turn off the circuit again. Now apply electrical tape to all exposed areas and wire connector clips. Put back the devices in the box and place the cover. Now you are ready to program the unit.

Cleaning things up

On the first image you can see I have applied electrical tape to cover all exposed connectors and wires. It is important to use the tapes to isolate these connectors to prevent shorting.

On the image bellow, the arrow in the above image is pointing to a staple which holds the wires in place. You can also see a Z-wave relay switch and the garage door opener switch. I have replaced the entire gang box with a new one. As you can see the metal box has been secured on both sides.

Garage door opener, Z-wave relay module and light switch.
Garage door opener, Z-wave relay module and light switch.

Programming an Z-wave switch

There are several companies manufacture Z-wave compatible switches. GE and Evolve and Leviton are few popular companies. Regardless of the manufacture, the process is simple. Press the add button on your Z-wave controller near the switch. Then press the switch at ON position several times until your Z-wave controller indicate successful addition. Each Z-wave controllers have their own set of instructions on how this works. Please follow the guidelines accordingly. For your information; I am very satisfied with the options and possibilities of VeraLite3 controller. However, I am cannot recommended anything since each controller comes with different advantages.

Other programing options

Electrical installation process is same for all units. The x10 and INSTEON controllers will have sightly different programming steps. At the end of the day, this article is all about basics of home electrical wiring. Refer to your manufacture’s user guide on how to add items to your specific programming standards.

How to use a Brunton Compass

It is essential for a Earth Scientist to be skilled at using the tools of the trade. From day one, students are trained to use the Brunton Compass, a highly popular measuring tool. I am very proud to say it was first designed and developed by a Canadian Geologist, David W. Brunton. If properly used it is a great tool for taking precise geological measurements within few degrees or meters of accuracy.

Skip Background Jargon

Parts of the Unit

Initially the compass was made out of metals which makes the unit very expensive. Recently the Brunton company produce two different versions of their models; one with the original metal body and another with high density plastic. I personally prefer the original unit because I like the weight and feel of it. However, both versions will provide the same results and both versions comes with exact same layout.

Before start using anything, we need to learn the layout and features of the device. The compass has a hexagonal shape to it’s outside perimeter creating flat perfectly straight surfaces. This is not for aesthetic appeal. The flat surfaces, specially on each side, provide the support for measuring angles of inclines and angles of strike of Geologic features. The base casing has an arm mounted to the body for directional measurements. Even the cover (lid) of the unit has a mirror which function as a sight taking tool. Everything on the Brunton Compass is a tool.

Features of the Pocket Transit Compass
Features of the Pocket Transit Compass

Above image is a picture of typical Brunton Pocket Transit Compass model used by universities and professionals. A list of key components on the base casing can be summarized;

A – Long Level – Use for taking azimuth measurements of strike.

B – Circular Level – Use for taking angle measurements of dip.

C – Iron Needle – Points to magnetic North and it is damped using the magnet below the pivot point. But the bearing can be adjusted accordingly by rotating the declination zero pin.

D – 360-degree Graduated Circle – Use for azimuth readings that are accurate to half of a degree.

E – 90-degree Dip Circle – Use for measuring dip using the long level on the vernier.

F – Needle Pin – Helps to lock the needle in place in order to take a reading.

G – Vernier – The vernier is used for inclination measurements with an accuracy to 30 minutes.

H – Rare Earth Magnet – A cast NdFe magnet which allow the iron needle to seek North accurately and quickly. It also reduces the magnetic interferences from the nearby environment.

J – Declination Zero Pin – An arm behind the compass is used to move the pin. Using tabulated data on magnetic declination, the degree of correction is set.

Usage

Here is an example of taking a strike on an inclined surface. Taking dip measurement is not shown here, but it is done by laying the Brunton Compass on the side along the dipping surface. By moving the vernier and long level, you can measure the dip.

Taking a strike on an inclined surface.
Taking a strike on an inclined surface. Click on image for original.