I have a “t_form” table and a “t_attribute” table. It looks a little bit like below. Form table form_id | form_name | description ———————————– 1 | Laptop | Possible attributes are Model, Screen Size, OS, Cd Player 2 | Mobile | Possible attributes are Model, OS 3 | Tablet | Possible attributes are Model, Screen
Read more
Tag: Tutorial
How to count the number of page view
Posted onI have seen the question Better way to count total page views? I think, the better way is.. We can save the number of page views in the database. It is acceptable. But, it is not fulfilling my requirement, if many different users can appear to have the same IP Address (e.g, if they are
Read more
How to make a static library (.a) on Linux
Posted onHow to make a static library (.a) on Linux? How to generate a library from C programs in files lib1.c and lib2.c: $ gcc -c lib1.c lib2.c Create a library “libmy.a” using ar: $ ar -cvq libmy.a lib1.o lib2.o You can also list the files in a library with ar: $ ar -t libmy.a You
Read more
How to install JRE for Chrome on Linux x86-64
Posted onHow to install JRE for Chrome on Linux x86-64? Use JRE from Oracle on Fedora Linux x86-64 as the example: Download jre from http://java.com/en/download/manual.jsp?locale=en#lin . Select Linux x64. Install it by # yum install jre-7u40-linux-x64.rpm (the downloaded rpm). Make a softlink of the plugin:$ cd ~/.mozilla/plugins/; ln -s /usr/java/jre1.7.0_40/lib/amd64/libnpjp2.so ./ Restart Chrome and browse chrome://plugins/
Read more
How to delete multiple items from Kindle Library
Posted onThe Kindle Library Web interface only provide interface to delete items one by one. How to delete multiple items from my Kindle Library? This works on Chrome. First, browse deki.js to find the javascript for the “DeKi: Delete Kindle Items” plugin. Press “Ctrl + A” then “Ctrl + C” to copy all the javascript code.
Read more
How to set an environment variable in bash?
Posted onHow to set an environment variable in bash? The syntax in bash for setting an environment variable is as follows. export VARIABLE=value Note that there is no space among the variable, the equals sign (“=”) and the value. If the value has spaces, the value should be put in quotes. To check it: echo $VARIABLE
Read more
How to set an environment variable in csh?
Posted onHow to set an environment variable in csh? To set an environment variable in csh: setenv VARIABLE value Most commands used to display/manipulate the environment variables for bash are also available for csh: https://www.systutorials.com/qa/476/how-to-set-an-environment-variable-in-bash
How to set and get an environment variable in C on Linux?
Posted onHow to set and get an environment variable in C on Linux? You can use the setenv and getenv POSIX APIs to set and get environment variables. To add or change environment variable: #include <stdlib.h> int setenv(const char *envname, const char *envval, int overwrite); To get value of an environment variable: #include <stdlib.h> char *getenv(const
Read more
How to pipe the stderr to less
Posted onFor example, try to less the error messages generated by the compiler with make | less Use this command: make 2>&1 | less or, if you want stderr only: make 2>&1 >/dev/null | less
C++ cout formatting output
Posted onHow to format outputs with cout in C++? You need IO Manipulators <iomanip>: Header providing parametric manipulators. There are also good tutorials on the Web: Output Formatting: http://arachnoid.com/cpptutor/student3.html Formatting Cout Output in C++ using iomanip: http://www.cprogramming.com/tutorial/iomanip.html
How to show the list view in iOS 7’s calendar
Posted onHow to show the list view in iOS 7’s calendar? Is it deleted? The list view is still available in iOS 7’s calendar. To find it, just click the magnifying glass on the top right and you will see the list view.
Tutorial: How to trace a function in OCaml
Posted onTutorial: How to trace a function in OCaml. Use #trace. For example, to trace function f: # let rec f n = if n = 0 then 1 else f (n – 1) * n;; val f : int -> int = <fun> # #trace f;; f is now traced. # f 4;; f <–
Read more
How to list the functions in a .a library on Linux
Posted onHow to list the functions in a .a library on Linux? You can use the nm command: The nm utility shall display symbolic information appearing in the object file, executable file, or object-file library named by file. If no symbolic information is available for a valid input file, the nm utility shall report that fact,
Read more
Mount Ext4 Partitions in Windows in read-only mode
Posted onHow to mount Ext4 partitions from Linux in Windows in read-only mode? Read-only is required to ensure safety. Mounting is required so that traditional programs can use the partition without any changes. Ext2Fsd is a great tool for this. Ext2Fsd is a file system driver which allows accessing (both reading and writing) ext2, ext3 or
Read more
How to remove cookies for a certain site in Chrome?
Posted onHow to remove cookies for a specific site/domain in Chrome? I just want to delete the cookies by one site, not the whole cookies stored by my browser. In Chrome’s settings (open chrome://settings/ in the URL bar): Search for “cookie” and you will find “Privacy” -> “Content Settings”. Click the button “Content Settings”. In the
Read more
How to get a 10-byte length random string in bash
Posted onHow to get a 10-byte length random string in bash. Use this script to get a 10-byte string of letters: tr -dc “[:alpha:]” < /dev/urandom | head -c 10 You can also get a string of letters or numbers: tr -dc “[:alnum:]” < /dev/urandom | head -c 10 Or printable characters except space: tr -dc
Read more
How to reset the Disqus WordPress plugin installation
Posted onHow to reset the Disqus WordPress plugin installation? After deactivating/activating the Disqus WordPress plugin, the ID and others are the same as the old ones. What I need is to change the Disqus forum ID for a WordPress installation. Find all the tuples in the _option table of WordPress that contains “disqus” and delete them.
Read more
How to automatically fill a batch of data to the PDF form
Posted onHow to automatically fill a batch of data (well structured) to the PDF form? There are lots data items, so automatically do this by a program/script is required. If you know a little bit of Python, you can achieve this in Python with some libraries. Check How can I auto-populate a PDF form in Django/Python.
Read more
Installing WordPress in a sub directory while working for the whole site
Posted onHow to install WordPress in a sub directory while working for the whole site? Putting the WordPress files in the root directory seems messy. A method is introduced here: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory The process to move WordPress into its own directory is as follows: Create the new location for the core WordPress files to be stored (we
Read more
Broken links checker for sites
Posted onTools to check broken links for websites. This tool is great for broken link checking: http://www.brokenlinkcheck.com/ . It check all your site automatically. W3C also has a tool to check a single page: http://validator.w3.org/checklink There is also an open-source tool LinkChecker: http://wummel.github.io/linkchecker/ If you are using WordPress, a plugin is also available: http://wordpress.org/plugins/broken-link-checker/