Monday, September 2, 2013

Use tracepath instead of traceroute

Just wanted to note myself of this one,

$ tracepath 210.213.128.14
1: centos (10.0.1.19) 0.094ms pmtu 1500
1: maximum (10.0.1.1) 1.327ms
1: maximum (10.0.1.1) 1.866ms
2: dsl.49.145.0.1.pldt.net (49.145.0.1) 55.341ms
3: 122.2.135.37.pldt.net (122.2.135.37) 50.527ms
4: 210.213.135.17.static.pldt.net (210.213.135.17) 73.554ms
5: 210.213.128.62.static.pldt.net (210.213.128.62) 79.921ms
6: 210.213.129.33.static.pldt.net (210.213.129.33) 83.518ms
7: 210.213.128.45.static.pldt.net (210.213.128.45) 71.558ms
8: 210.213.131.93.static.pldt.net (210.213.131.93) 71.437ms asymm 9
9: 210.213.128.14.static.pldt.net (210.213.128.14) 211.873ms reached
Resume: pmtu 1500 hops 9 back 247


tracepath can be run without the need of any super user privileges.


Saturday, July 27, 2013

Is RAID 0 still beneficial or not?

Hmmm, I have no idea about this but if anyone might read about this, please check http://tweakers.net/reviews/515/1/raid-0-hype-or-blessing-raid-0-hype-or-blessing.html

That article is so very old but if you have a raid-0 setup either with SSD's in a RAID 0 setup vs SSD itself, any benchmark result you have, please share.

Monday, July 15, 2013

OSX VPN send all traffic over VPN via route command

Base on this inputs from stackoverflow
,
sudo /sbin/route add -host pandora.com -interface ppp0

In this example, "pandora.com" is the host that should be routed via the VPN and "ppp0" is the name of the VPN network interface (ifconfig shows you the list of network interfaces).

Friday, July 5, 2013

Problem with YAML in Perl

I have no idea why this fix but I was installing MySQLSandbox with an error occurred but this link helps me solve it,

http://www.linuxquestions.org/questions/linux-newbie-8/problem-in-upgrading-cpan-918683/

Anyhow, to be particular, this one helps me solve the problem

$ su -
# cpan
# cpan> install Bundle::CPAN
# cpan> reload cpan
# cpan> exit



Sunday, June 16, 2013

Setting global environment in Mac OS X

I just wanted to quote myself on setting the environment variable in Mac OS X.

From, http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x

This is stated as,

1) Open a terminal prompt
2) Type sudo vi /etc/launchd.conf (note: this file might not yet exist)
3) Put contents like the following into the file
# Set environment variables here so they are available globally to all apps
# (and Terminal), including those launched via Spotlight.
#
# After editing this file run the following command from the terminal to update 
# environment variables globally without needing to reboot.
# NOTE: You will still need to restart the relevant application (including 
# Terminal) to pick up the changes!
# grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl
#
# See http://www.digitaledgesw.com/node/31
# and http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x/
#
# Note that you must hardcode the paths below, don't use enviroment variables.
# You also need to surround multiple values in quotes, see MAVEN_OPTS example below.
#
setenv JAVA_VERSION 1.6
setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
setenv GROOVY_HOME /Applications/Dev/groovy
setenv GRAILS_HOME /Applications/Dev/grails
setenv NEXUS_HOME /Applications/Dev/nexus/nexus-webapp
setenv JRUBY_HOME /Applications/Dev/jruby

setenv ANT_HOME /Applications/Dev/apache-ant
setenv ANT_OPTS -Xmx512M

setenv MAVEN_OPTS "-Xmx1024M -XX:MaxPermSize=512m"
setenv M2_HOME /Applications/Dev/apache-maven

setenv JMETER_HOME /Applications/Dev/jakarta-jmeter
4) Save your changes in VI and reboot your Mac. Or use the grep/xargs command show in the code comment above.
5) Prove that your variables are working by opening a Terminal window and typing export and you should see your new variables. These will also be available in IntelliJ and other GUI apps you launch via Spotlight.

Tuesday, May 28, 2013

MySQL: Running MySQL in command line thru mysqld

Just wanted to take note of this. Instead of running your MySQL as a service, or thru mysqld_safe, the command line you can run can actually be like this.


  1.  /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/macmini.local.err --pid-file=/usr/local/mysql/data/macmini.local.pid

Sunday, November 25, 2012

vim problems with ^M (caret M), due to file format incompatibility

The problem with ^M or caret M that you see in files during editing or modifying is that incompatibility with vim's default file format.

Usually, if I have a file edited or created in Mac OS X, and when its edited via Linux, I got ^M plus the lines are displayed as one line which is freaking hard to edit. To fix this, just do edit the file, then reload the file in vim,

:e ++ff=mac

or

:e ++ff=unix

if it was created in Unix. This will render with a great view editor of your file from what you expected it should be.

According to vim's Wiki,
"
unixLF only (each line ends with an LF character).
dosCRLF (each line ends with two characters, CR then LF).
macCR only (each line ends with a CR character).
CR is carriage return (return cursor to left margin), which is Ctrl-M or ^M or hex 0D
" 

You can read for more info for file format in this page http://vim.wikia.com/wiki/File_format

Monday, November 12, 2012

Understanding Threads and Multithreading



In this blog, I just wanna accumulate all things that I need to note regarding threads.


Threads are just a light-weight process. It's actually a process but it runs under a process, literally a subsets of a process, where in this process, threads can share resources like memory. Threads in this subject is distinct from multi-core systems, which deals with instructions that are sent in the hardware resources like instruction set pass from USB to processor, stuff like that, in which multi-core can empower an OS to implement multi-threading. So multi-core is more of dealing with central processing units to execute program instructions.

Multithreading aims to increase utilization of a single ore by using thread-level as well as instruction-level parallelism. As the two (multithreading in cores and threads in OS) techniques are complementary, they are sometimes combined in systems with multiple multithreading CPUs and in CPUs with multiple multithreading cores.

courtesy of Wikipedia:

Advantages

Some advantages include:
  • If a thread gets a lot of cache misses, the other thread(s) can continue, taking advantage of the unused computing resources, which thus can lead to faster overall execution, as these resources would have been idle if only a single thread was executed.
  • If a thread cannot use all the computing resources of the CPU (because instructions depend on each other's result), running another thread can avoid leaving these idle.
  • If several threads work on the same set of data, they can actually share their cache, leading to better cache usage or synchronization on its values.

Disadvantages

Some criticisms of multithreading include:
  • Multiple threads can interfere with each other when sharing hardware resources such as caches or translation lookaside buffers (TLBs).
  • Execution times of a single thread are not improved but can be degraded, even when only one thread is executing. This is due to slower frequencies and/or additional pipeline stages that are necessary to accommodate thread-switching hardware.
  • Hardware support for multithreading is more visible to software, thus requiring more changes to both application programs and operating systems than multiprocessing.

Pleas read more on http://en.wikipedia.org/wiki/Multithreading_(computer_architecture)


Threads
========

Pre-emptive multitasking - temporarily interrupting a task being carried by a computer system without requiring cooperation and with the intention of resuming the task at a later time.

Context switch - This is what is happening when doing a pre-emptive multitasking. It is normally carried out by a privileged task or a part of the system known as a preemptive scheduler.

Pre-emptive multitasking is carried out by privileged task.



Race conditions - where something like data are bumping. Like for example, two variables might get into racing who comes first to get the change the state of such value where these two variables are in different threads/task.

There are two kinds of race conditons:
critical race occurs when the order in which internal variables are changed determines the eventual state that the state machine will end up in.

non-critical race occurs when the order in which internal variables are changed does not alter the eventual state. In other words, a non-critical race occurs when moving to a desired state means that more than one internal state variable must be changed at once, but no matter in what order these internal state variables change, the resultant state will be the same.



Thursday, August 30, 2012

Programming Advice

I wanna take note on this blog "The Best Programming Advice I Ever Got" with Andrei Alexandrescu as I found this notably important as a programmer or developer.

How about yours? What do you think a good programmer should have?

Programming Opinions - Great Blog to Read

I think this blog is cool to read

20 controversial programming opinions

Wednesday, August 29, 2012

Lossy Image Optimization

I have enjoyed this youtube video regarding lossy image optimization from Velocity.

Hope you find this video helpful.

O'Reilly Webcast: The Best of Velocity - Take it all off! Lossy Image Optimization

Wednesday, August 8, 2012

Coding standard in C

I got this file as such a noteworthy to read.

JPL Institutional Coding Standard for the C Programming Language

Hope you like it :-)

Monday, August 6, 2012

difference between Orthogonal and Isometric

I wanna note this myself so I can't forget this stuff.

Orthogonal vs Isometric Via StackExchange.com
or this link StackExchange Orthogonal vs Isometric

Orthogonal vs Isometric via Yahoo Asnwers

With regards to foreshortened, according to Wikipedia on Perspective, it means as,

Foreshortened: the size of an object's dimensions along the line of sight are relatively shorter than dimensions across the line of sight

Sunday, August 5, 2012

10 Reasons You're Not the Boss


I came across reading this article from Yahoo and wanted to save this as a note for myself. This is such a good article and notes to follow, IMHO.