How 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
Author: Q A
g++: sorry, unimplemented: non-trivial designated initializers not supported
Posted ong++ (version g++ (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)) report: $ g++ -std=c++11 solution.cpp -o sol solution.cpp: In function ‘int main()’: solution.cpp:50:57: sorry, unimplemented: non-trivial designated initializers not supported Stat init_stat {.depth = 0, .moves = tv, .vec = init}; ^ solution.cpp:50:57: sorry, unimplemented: non-trivial designated initializers not supported solution.cpp:50:57: sorry, unimplemented: non-trivial designated initializers
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 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
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
Run cron jobs with environmental variables for an account
Posted onA common error for configuring cron is to use environmental variables for an account in the cron command. However, cron will run the commands without these variables defined. In the crontab -e, adding . $HOME/.profile before the commands play the trick. For example: 0 */8 * * * . $HOME/.profile; ~/bin/my-command Cron is started by
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
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/
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
Shared hosting services with SSH enabled
Posted onWhich shared hosting services have SSH enabled? SSH is a great tool for management and development. Lots shared hosting services support SSH. Here is a non-complete list: Dreamhost SSH on dreamhost: http://wiki.dreamhost.com/Enabling_Shell_Access BlueHost SSH on BlueHost: http://my.bluehost.com/cgi/help/180 GoDaddy SSH on GoDaddy: http://support.godaddy.com/help/article/4942 HostGator SSH on HostGator: http://support.hostgator.com/articles/hosting-guide/lets-get-started/how-do-i-get-and-use-ssh-access HostMonster SSH on HostMonster: http://my.hostmonster.com/cgi/help/180 ServerGrove SSH on
Read more
How to host a domain registered in another account in a Dreamhost account
Posted onHow to host a domain name registered in another account in one Dreamhost account. Simply trying to add the new domain, it reports: Error! You can’t add that domain: already in our system You need to delete the domain from your hosting (DNS) from the account first. Don’t worry, the domain name is still there
Read more
How to set up MySQL replication
Posted onHow to set up MySQL replication. And for debugging purpose, it will be great if I can run multiple MySQL instances on a single host. To set up MySQL replication, check these tutorials: MySQL Replication MySQL replication setup You can Setup multiple MySQL instances on single server.
How to save PuTTY profiles/sessions?
Posted onPuTTY is a great SSH client on Windows. However, how to save it’s profiles/sessions that I saved so that I can migrate my settings from one machine to another? PuTTY saves its settings in the registry of Windows. You can find it in the registry editor by run regedit under: HKEY_CURRENT_USERSoftwareSimonTatham You can save your
Read more
How to change an attachment’s parent post in WordPress
Posted onHow to change an attachment’s parent post in WordPress? The in WordPress posts depends on the child-parent relationship. It will be good to change the parent posts for attachments. The Change Media Parent WordPress plugin works great for me. After installing and activating it, a link to change the parent appears in the media control
Read more
Where is the .mli files for Core
Posted onWhere is the .mli files for Core installed by opam. It is under ~/.opam/4.00.1/lib/core where 4.00.1 is the version of OCaml used. For example, date.mli is under ~/.opam/4.00.1/lib/core/date.mli.
Sending emails securely
Posted onSending emails securely is needed for certain situations, such as sending my bank account to my wife, giving my account password to my close friend for a while. How to send it? Regarding the recent US PRISM program, it is an important issue. Seeing your solution, a few of my own popped up. Here are
Read more
Excerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen
Posted onExcerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen. Also add the “read more” link after the excerpt. The patch: diff –git a/wp-content/themes/twentythirteen/content.php b/wp-content/themes/twentythirteen/content.php index 4f61b22..53b4686 100644 — a/wp-content/themes/twentythirteen/content.php +++ b/wp-content/themes/twentythirteen/content.php @@ -30,7 +30,7 @@ </div><!– .entry-meta –> </header><!– .entry-header –> – <?php if ( is_search() ) : // Only display
Read more
How to import OCaml libraries
Posted onHow to import 3rd party libraries (e.g. not standard libraries) in OCaml? An answer by Gabriel Scherer on how to import Batteries is just great and answers this question with much information. Although it is for Batteries, the method is general. The OCaml compiler (or toplevel, etc.) will find with no additional information only the
Read more
Add the jane street opam repository
Posted onHow to add the jane street opam repository is introduced here. Here, we assume the branch to add is core-branch. You may need to replace the core-branch with the branch you need. $ git clone -b core-branch https://github.com/janestreet/opam-repository.git $ opam repo add js opam-repository Or, directly add the remote branch as an opam repository. $
Read more
Max array length in OCaml
Posted onWhat’s the max array length in OCaml. You can check it by: # Sys.max_array_length;; On 64-bit machine: # Sys.max_array_length;; – : int = 18014398509481983 On a 32-bit machne: # Sys.max_array_length;; – : int = 4194303 This is due to the memory representation of arrays. 64 Bit machines are better here. And AFAIK, OCaml was developed
Read more