What’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
Author: Q A
Find out the number of CPU cores on Linux
Posted onHow to find out the number of CPU cores on a Linux host. Use the command nproc. $ nproc nproc – print the number of processing units available: man page of nproc.
Vim Regular Expressions Tutorials
Posted onGood tutorials on Vim regular Expressions. Vim Regular Expressions: http://www.softpanorama.org/Editors/Vimorama/vim_regular_expressions.shtml Another good one in Chinese: http://www.study-area.org/tips/vim/Vim-10.html
Installing Fedora 19, Error “you have not created a bootloader stage1 target device”
Posted onInstalling Fedora 19, Error “you have not created a bootloader stage1 target device” . It seems appear from Fedora 15: http://forums.fedoraforum.org/showthread.php?t=271743 This can be solved by adding noefi nogpt to the kernel parameters when booting the Linux for installation in grub as follows. Note: the “_” between nogpt and root is the cursor, not the
Read more
How to change strings in MySQL tables
Posted onHow to change strings in MySQL tables? e.g. I want to change domain.com to www.domain.com. Use the REPLACE functions of MySQL: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace One example is like this: UPDATE table SET field = REPLACE(field, ‘domain.com’, ‘www.domain.com’) WHERE field LIKE ‘%domain.com%’ The WHERE clause is not needed but can make execution faster.
How to change the maximum execution time and memory size allowed for PHP
Posted onI see this message in the error log of httpd: PHP Fatal error: Maximum execution time of 30 seconds exceeded in and PHP Fatal error: Allowed memory size of 268435456 bytes exhausted How to change them to a longer and larger value? To change the allowed maximum memory usage of PHP: Set memory_limit = 256M
Read more
How to find out and change the storage engine of tables in MySQL
Posted onHow to find out and change the storage engine of tables in MySQL databases? Find out the storage engine of a table in a database: SELECT ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = ‘database’ AND TABLE_NAME = ‘table’ Change the storage engine of a table: ALTER TABLE table ENGINE = type type can be innodb or
Read more
HP Printer with Fedora Linux 19
Posted onHow to use HP Printer connected with USB on Fedora Linux 19. Install these packages and it may ask you to download and install other plugins. Without these packages, my printer does work. # yum install hplip hplip-gui hpijs May also need to run: # hp-plugin to install plugins for the HP printer. This plays
Read more
PDF annotation tools on Linux
Posted onWhat are good PDF annotation tools on Linux? Preferring saving the annotation in the PDF instead of separate files or images. I find the best solution may be wine + Foxit Reader. Foxit Reader can annotate PDF files and save them. It works very well on wine. Steps to install them: Install wine # yum
Read more
How to install WordPress on Fedora 19
Posted onHow to install the latest WordPress on a newly installed Fedora 19? Thanks! First, install the LAMP (you already have ‘L’) stack: # yum install httpd php php-mysql mysql-server php-gd and start these services: # systemctl start mysqld.service httpd.service Then, install WordPress on the LAMP stack following the tutorials on the Web. Two good ones
Read more
gnuplot and ps2epsi do not work on Fedora 19
Posted onI find that gnuplot and ps2epsi do not work on Fedora 19. The same packages/scripts work for me on old installations on Fedora 17. I find this line is printed out multiple times: Fontconfig warning: “/etc/fonts/conf.d/50-user.conf”, line 14: reading configurations from ~/.fonts.conf is deprecated. I even tried an older version of gnuplot (4.2 patchlevel 6).
Read more
How to repair tables database by backup
Posted onHow to repair tables database by backup Is this possible? Please explain how to repair. and thanks This post may help: https://www.systutorials.com/qa/300/how-to-repair-a-mysql-table thanks dear Zhiqiang Ma
Online image editor like Photoshop
Posted onIs there any online image editor that has the basic functions of Photoshop. Basic editing of the image should be enough. pixlr is a very good tools for this purpose: http://pixlr.com/ It works great for me.
Trap Ctrl-C in a Bash script
Posted onHow to trap Ctrl-C in a Bash script? The piece of code: # trap ctrl-c and call ctrl_c() trap ctrl_c INT function ctrl_c() { echo echo “Ctrl-C by user” # do the jobs exit }
How to choose the number of mappers and reducers in Hadoop
Posted onHow to choose the number of mappers and reducers in Hadoop to get good job performance? The Hadoop Wiki gives a discussion on this: http://wiki.apache.org/hadoop/HowManyMapsAndReduces Some valuable points: About the number of Maps: The number of maps is usually driven by the number of DFS blocks in the input files. Although that causes people to
Read more
Specifying –no-print-directory within the Makefile
Posted onThe –no-print-directory option of make tells make not to print the message about entering and leaving the working directory. However, how to specify the –no-print-directory inside the Makefile itself? Add this line to the Makefile: MAKEFLAGS += –no-print-directory You can also set MAKEFLAGS in a makefile, to specify additional flags that should also be in
Read more
How to spawn a background process in a bash script
Posted onFor example, I want to spawn many ssh background processes in one bash script: for i in `cat ./all-hosts` do ssh $i “ifconfig | grep Link” done Simply adding a & to the ssh commands does not work. Here is the script that works: for i in `cat ./all-hosts` do ssh $i “ifconfig | grep
Read more
MySQL at Facebook
Posted onFacebook uses lots MySQL databases. Any information about how Facebook scales MySQL? Some information on the Web: MySQL at Facebook’s page https://www.facebook.com/MySQLatFacebook?filter=1 A post by Ryan Thiessen, Database Operations at Facebook on Quora: http://www.quora.com/Facebook-Engineering/How-does-Facebook-structure-MySQL-so-that-it-is-robust-and-scalable And more: http://mashable.com/2011/12/15/facebook-timeline-mysql/ http://gigaom.com/2011/12/06/facebook-shares-some-secrets-on-making-mysql-scale/ http://www.wired.com/wiredenterprise/2011/12/facebook-timeline-anatomy “A lot of people are surprised that for this shiny new thing for Facebook, we’re using
Read more
Force Linux to reboot
Posted onHow to force Linux to reboot when the reboot command does not work. Enable the use of the magic SysRq option: # echo 1 > /proc/sys/kernel/sysrq Reboot the machine: # echo b > /proc/sysrq-trigger Even if you could not log on the system but sshd is working, you can force the Linux to reboot by:
Read more
Cache at Facebook
Posted onAbout caching system at Facebook. According to: https://www.facebook.com/notes/facebook-engineering/monitoring-cache-with-claspin/10151076705703920 Facebook has two major cache systems: Memcache, which is a simple lookaside cache with most of its smarts in the client, and TAO, a caching graph database that does its own queries to MySQL. The NSDI’13 paper introduces more about Memcache: https://www.usenix.org/conference/nsdi13/scaling-memcache-facebook The USENIX ATC’13 paper introduces
Read more