Posted at December 12, 2012
Task
- Make an absolutely positioned element expand across the width of the span.
Expected Outcome
- A repsonsive floating element exactly where you want it, that is the size of the span.
Issues
- May need to do some margin resets on some elements.
Solution
- Simply add width: 100%; to the style that is absolutely positioned to have it be the same size as the span.
Posted at October 22, 2012
Task
- Identifying the URL the user is on for some specific task or function.
Expected Outcome
- The full path of the URL will be returned by some variable.
Issues
- There are a few different methods that will not get the full path that includes the protocol and domain and port, and there are a couple deprecated methods that should not be used.
Solution
- Rails 2: Use the method request.url, as this combines the current protocol being used (http:// or https:// for most cases), and the host, and the request_uri method.
- Rails 3: The method previously used in Ruby On Rails 2 is now deprecated, and ”#{request.protocol}#{request.host_with_port}#{request.fullpath}” must be used to concact all the return values together.
Notes
- The method request.fullpath is misleading as it does not actually include the domain, port, or protocol.
Posted at October 18, 2012
Task
- Be efficient when writing code
- Don’t Repeat Yourself
- Use functions to render things that repeat on webpages, such as list items, links, shims for older IE support, and various other uses.
Expected Outcome
- Code is clean, readable, and separated to allow for easy modification via branching using Git (less chance of conflicts)
- Writing the same code over and over again will not happen.
Issues
- It’s difficult to get organized and think of situations where this could be used when you don’t have experience
Solution
- Practice! Look at some old code that you have, find places where you use the same HTML or CSS tags repeatedly and make simple helper functions that will do all the heavy lifting for you
Notes
- The Ruby On Rails programming community is very big on this. All the code you will find will be implementing a lot of helper functions, so get in the habit of knowing how to write in this style!
Posted at October 18, 2012
Task
- Attempt to compile a C++ program that is utilizing shared boost libraries, especially those that need to be linked (boost_system.so for example).
Expected Outcome
- Compilation is successful and compiled program can be run.
Issues
- Program fails to run with error ‘error while loading shared libraries : …’
Solution
- Run the following from shell : sudo ldconfig path_to_boost
Notes
- You must have root access to perform solution steps outlined above.
- Shared object libraries are loaded at runtime so they are need to be present in LD_LIBRARY_PATH, a location that system is searching for required shared objects.
- Executing the command as provided above in Solution section above does the job.
Posted at August 14, 2012
Task
- Configure ethernet interface eth0 with static IP address=192.168.20.100 and default gateway IP=192.168.20.1
Expected Outcome
- You linux centos system is connected to internet via configured interface eth0.
Issues
Solution
- Edit /etc/sysconfig/network-scripts/ifcfg-eth0 so it reads as follows
BOOTPROTO=none
DEVICE=eth0
IPADDR=192.168.20.100
NETMASK=255.255.255.0
GATEWAY=192.168.20.1
ONBOOT=yes
- Activate your changes by executing the following scripts : ifdown eth0 && ifup eth0
Notes
- You must have a root access to perform steps outlined in Solution section above.
- The eth0 ethernet interface I chose is a sample interface (it is usually the default ethernet interface on linux system). You may apply this solution to other ethernet interfaces available on your system by changing eth0 to other available interface (it can be eth1, eth2, etc).
- The eth0 IP address and gateway IP address used are sample addresses. You can apply this solution to any valid and available IP addresses you may get at time of eth0 configuration.