Saturday, September 5, 2015

Find linux distro

You can use any one of the following method to find out your Linux distribution and name:

a) /etc/*-release file. (for distro, may include multiple release files under /etc/)
b) /proc/version file. (for linux version)
c) lsb_release command. (for hardware version)

See http://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/

Friday, September 4, 2015

Cloudera

Try out Cloudera product.

Download quickstart VM for CDH 5.4.x from:
http://www.cloudera.com/content/cloudera/en/downloads.html

Thursday, September 3, 2015

Get history report of the CPU/Memory usage on windows

How to get history report of the CPU/Memory usage on windows 2008 R2 (64-bit)

Below are from the above link:

Perfmon in server 2008 really is your best option.

We will use system memory as an example but you can add the processor counters just as easily.

Start>run>perfmon

In the left, expand "Monitoring Tools". Now right click "Performance Monitor" and choose, "New">"Data Collector Set".

Give it a name of "Memory" and click "Next"

Now browse to where you want to save the logged data, lets make it easy and drop it into the root of " and then click "Next"

Choose save and close on the next screen and click "Finish"

Now in the left hand side, expand "Data collector sets" then "User Defined" and click on your new "Memory" one we created.

In the right hand screen double click the "System monitor log"

In this screen, click the "Processor" that's already listed and then click the "Remove" button.

Now click the "Add" button, scroll through the list and click the plus symbol next to "Memory". Click on any one of the things in the list to deselect all of them. We are going to individually select jsut the ones that interest us and judging by what you want to see I would hold down the control key and specifically select,

% Committed Bytes in use

Available MBytes

Pages Input/sec

Pages Output/sec

We can start with these and add more if needed later, click the add button to add them to the right hand side.

Now click "OK" then "Apply" and then "OK" again.

Now on the left hand side in the tree, right click your user defined "Memory" and choose "Start".

On the left, expand "Reports">"User Defined">"Memory">"System Monitor Log.blg"

Clicking on that last one should show you your current monitor is running in the right hand side. If we go back to our data collector set on the left right click and say stop, then click again on the system monitor log, we can now see a graph of what is being collected. This same data is also being saved to a log file in the C root which when we open it shows something similar.

In the steps above where we chose what to see, had we left everything selected for memory, it would have been around 30 things it would graph out making it difficult to read.

From here, run it for a week and check your results. It should give you a nice graphical baseline.

Good luck and let me know if you need any further assistance.

-Jay




How to interpret metrics collected by Perfmon.

  - Evaluating Memory and Cache Usage
  - http://www.sqlshack.com/sql-server-memory-performance-metrics-part-1-memory-pagessec-memory-page-faultssec/

For memory usage, the most important counters are pages/sec and page_faults/sec.

pages/sec is the sum of input/sec and output/sec. The normal range is 40-150/sec.

page faults/sec can include both hard and soft page faults. The normal range is 10-15/sec. But it can be as high as 1000/sec sometimes.

To decide if there is a short of memory is more complex than just looking at these numbers. You also should take into consideration the reads/sec etc.

Thursday, August 27, 2015

Share a folder between windows and linux

To share a linux folder with windows, just use Samba.

To share a windows folder with linux, you can use cifs-utils. Details are below:

    1) Create windows shared folder [2] on windows machine (say MachineX): C:\Shared\
       - now can access \\MachineX\Shared\ on other machines on the same domain.
    2) Download/Install cifs-utils on linux machine:
       - download from [3].
       - unzip and install:
         bzip2 -d cifs-utils-6.4.tar.bz2
         tar xvf cifs-utils-6.4.tar
         cd cifs-utils-6.4
         ./configure --prefix=/usr \
            --disable-pam \
            --disable-systemd
         make
         sudo make install
       - finally, the command is available on linux by: sudo /sbin/mount.cifs
    3) Mount the shared folder on linux:
       - mount:
         cd /mnt
         sudo mkdir MachineX_Shared
         sudo /sbin/mount.cifs  //[MachineX IP address]/Shared  /mnt/MachineX_Shared -o user=[username]
       - now can access the folder and write to it.

References:

[1] http://www.howtogeek.com/176471/how-to-share-files-between-windows-and-linux/
[2] http://lifehacker.com/288033/mount-a-windows-shared-folder-in-linux
[3] http://www.linuxfromscratch.org/blfs/view/svn/basicnet/cifsutils.html


Sunday, August 23, 2015

Use WordPress as CMS

WordPress is a popular blogging software. It has a lot of nice-looking themes. It will be very nice if it can be used as the framework of a website.

For this purpose, one should be able to create custom roles (user groups), members of such roles may or may not be able to post blogs, but can access custom pages once log in. Several things are crucial:

1) create custom role(s).
2) check if a user is logged in, and access user profile such as ID, login name, user name, email, user type. Based on this, one can add custom database tables and build whatever function that is desired.
3) make use of WordPress theme in custom page.

A study on these requirements proves fruitful. Over the weekend, I was able to build a member page for 4 WordPress themes. It's easy to extend to more themes.

The files are prepared and will be uploaded to github. See:

https://github.com/chenx/WordPress_Extension


Summary:
  • Shows how to check if a user is logged in, and retrieval user information.
  • Shows how to include header/footer of current theme.
  • To add custom links, go to Appearance -> Menus -> Custom Links
  • To allow user register, see [3] below.
    It seems Wordpress allows each user to have one role only. That's less flexible than .NET membership, which allows each user to have any roles.
  • To change default user registeration email, see [4].
  • To allow manage user roles, use the Members plugin [5].
  • To disable comments/discussion on a per-page basis:
    On Edit Page, click Screen Options and check the Discussion box. Then in Discussion section, uncheck "Allow comments".
  • To add a forum, see .
  • Note: installed themes are in wp-content/themes/
  • Note: to imitate other page's layout, see theme's page.php.
  • Note: to customize page title, see wp-includes/post-template.php function get_the_title().
References:
  1. http://codex.wordpress.org/Function_Reference/wp_get_current_user
  2. https://web-design-weekly.com/snippets/load-a-different-header-in-wordpress/
  3. http://www.wpbeginner.com/beginners-guide/how-to-allow-user-registration-on-your-wordpress-site/
  4. https://wordpress.org/plugins/welcome-email-editor/
  5. https://wordpress.org/plugins/members/
  6. wordpress - redirect to target page after log in 

Thursday, August 20, 2015

HTML 5移动开发从入门到精通

HTML 5移动开发从入门到精通

This introduces some HTML5 elements.

Javascript elements:

1. selectors api
2. JSON parse/stringify
3. Hashchage event
4. async.defer for script
5. progress for ajax
6. DeviceOrientation
7. touch events

Html5 Tag elements:

1. progress: <progress max="100" value="30"></progress>
2. mark (highlight text): <mark>This is a mark</mark>
3. address (italic format)
4. Colgoup col
5. keygen
6. fieldset/legend
7. ol.li (reversed, start, type)
8. q (quotation)
9. contenteditable div

Blog Archive

Followers