Welcome to SysTutorials! Here you can find posts on Linux, Software, Programming and Web topics.

SysTutorials Keywords

Tutorials: Latest | Latest updated | Most viewed | All

QAs: Answered QAs | Dtivl posts

Latest SysTutorials tutorials

To get updated when new posts are published? Subscribe here.

  • Posted on Friday May 12, 2017
    Call forwarding is useful if you are expected to be unavailable for receiving calls or lose cell phone coverage for some time. Call forwarding is not something that is "new" to modern phones. It is a feature which is invented in 1960s (the patent expired in 1980) of some telephone switching systems. But with iPhone/iOS, there is a convenient call forwarding feature in iOS for you to set up call forwarding to forward calls to a landline or other phone by its number or disable the call forwarding. » Read more Continue Reading »
  • Posted on Thursday April 20, 2017
    HTML supports many characters/symbols such as mathematical symbols, and currency symbols. They are not present on a normal keyboard. And some of these characters may have special meanings for formatting text. To add such characters / symbols to an HTML text, you can use an HTML entity name or an entity number in decimal or hexadecimal. This post list many special Characters in HTML as a friendly reference. » Read more Continue Reading »
  • Posted on Tuesday April 18, 2017
    From a small business owner, a blogger, a student or individual with a personal project, the need to create websites has never been more prominent. Having a basic understanding of HTML and canvas knowledge can be helpful, and it is simple to master. The thought of learning to code and programming may seem a long and daunting task, but some people may be surprised to know that it need not be as scary as it sounds. » Read more Continue Reading »
  • Posted on Saturday April 15, 2017
    This post introduces how to install a paravirtualized CentOS 7 DomU on Xen. The very common way of installing DomU does not work for CentOS 7. A little trick to set the repository and the network used by the VM should be used by adding a setting strings to the “extra=” field for this VM. To install the DomU VM, first download the pxeboot images from CentOS’s official website at http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/. » Read more Continue Reading »
  • Posted on Sunday April 09, 2017
    The USB standards have evolved to 3.1 and the supported throughput have been increased too. On Linux, the support to USB standards are following the standards development. In this post, we will survey the standards that common hardware support and the support in Linux. USB standards USB 2.0: https://en.wikipedia.org/wiki/USB#USB_2.0Speed: » Read more Continue Reading »
  • Posted on Saturday March 18, 2017
    Building Linux kernel may sound a complex and geek-only thing. However, as Linux kernel itself has much less depended tools/packages compared to other software packages, it is quite easy to compile, build and install a Linux kernel from the source code in an existing Linux OS. Building Linux kernel is needed if you need to build a specific Linux kernel or update your drivers for a kernel by yourself. » Read more Continue Reading »
  • Posted on Friday February 24, 2017
    In today’s time, data visualization has become a significant part of the success story of an organization. With the help of right techniques, visualizing data can reveal insights which the management staff can use in their decision-making in order to make sound data-driven decisions. Mapping software is among the robust data visualization tools that you can avail today. With maps, you can find stories, trends, and insights that cannot be found in spreadsheets. » Read more Continue Reading »
  • Posted on Tuesday February 14, 2017
    Motivation Recently, I find it is hard to know the percentage of time that one process uses to wait for synchronous I/O (eg, read, etc). One way is to use the taskstats API provided by Linux Kernel [1]. However, for this way, the precision may be one problem. With this problem, I dig into Linux Kernel source codes to see how “blkio_delay_total” (Delay time waiting for synchronous block I/O to complete) is calculated. » Read more Continue Reading »
  • Posted on Monday February 06, 2017
    Making a career choice is difficult. And, if you have decided on becoming a programmer, the difficulty is just beginning. The most important thing is to first decide the language that you want to learn and this is often the most difficult decision. The good part is that you know you need to focus on learning programming and the bad part is that you might still be thinking which programming language should you begin to learn. » Read more Continue Reading »
  • Posted on Saturday December 31, 2016
    There are many Vim tutorials and Vim tips on the Web. However, I find the vimtutor provides the best tutorial among those so far as I found on the Web while the vimtutor seems usually reachable from a terminal which is not obviously known to Vim beginners who are usually Linux beginners too. This page shows the content of the Vim tutorial from the command vimtutor in a web page which is especially easier for Vim beginners to get and learn. » Read more Continue Reading »
  • Posted on Friday December 23, 2016
    This post is about the Spring Shell technology and its use in java. Experts of java development India have shared their best knowledge in this post for Spring Shell with the community people. If you have anything to ask, do it at the end. Technology: It is command line tool for Java applications to interact with java applications using spring shell framework. » Read more Continue Reading »
  • Posted on Saturday December 17, 2016
    Abstract In systems, sometimes, we use one global lock to keep synchronization among different threads. This principle also happens in QEMU/KVM (http://wiki.qemu.org/Main_Page) system. However, this may cause lock contention problem. The performance/scalability of whole system will be decreased. In order to solve this problem in QEMU/KVM, x-data-plane feature is designed/implemented, which the high-level idea is “I/O requests are handled by dedicated IOThread rather than QEMU main loop threads so that it will not have lock contention among I/O threads and other QEMU main loop threads”. » Read more Continue Reading »
  • Posted on Thursday December 15, 2016
    In this tutorial, Microsoft Dynamics CRM India experts will teach you how to filter salutation based on Gender field in MS CRM. You can follow the step-by-step guide shared in this post to avail the results. Description- According to the requirement we need to filter salutation based on gender in contact entity. For this we need to create two new field having Datatype(option set). » Read more Continue Reading »
  • Posted on Friday December 09, 2016
    In this blog Dynamics CRM consultants are sharing a step-by-step guide to explain how to filter another lookup field value based on one Lookup field value. In this Lead entity, they are having two fields Branch and Sub Branch and you will learn how they filter Subbranch based on Branch field. Based on one Lookup field value, how to filter another lookup field value. » Read more Continue Reading »
  • Posted on Monday December 05, 2016
    Abstract As is known, CFS (Completely Fair Scheduling) is a famous process scheduling algorithm in Linux Kernel but there is no convenient way for developers to get the timeslices of processes if CFS is chosen. In this article, I will introduce one way to hack the timeslices of process easily for CFS in Linux Kernel. Note that, the way introduced following is under Linux Kernel 3.16.39. » Read more Continue Reading »
  • Posted on Saturday December 03, 2016
    Solution is very important part of Dynamics CRM. In order to deploy your customization, solution is the only bridge which help you to achieve your goal. There are two types of solutions available in CRM: Managed and Unmanaged. Managed Solutions: This is the solutions that you can import and publish only. You neither export it nor you can make any changes in it. » Read more Continue Reading »
  • Posted on Thursday December 01, 2016
    Abstract Currently, the most famous process scheduling algorithm in Linux Kernel is Completely Fair Scheduling (CFS) algorithm. The core idea of CFS is to let each process share the same proportional CPU resources to run so that it is fair to each process. In this article, I will introduce how sched_min_granularity_ns and sched_latency_ns work internal CFS to affect the timeslice of processes. » Read more Continue Reading »
  • Posted on Friday November 25, 2016
    In this post, asp.net development India based professionals will explain the best way to manage the Restful service using AngularJS. They are explaining the push and pull functionality available in Rest service in simple steps. Read the article to know more. In this Post I am going explain how we can manage the Restful service using AngularJS. Push and Pull functionality of Rest service Json data in MVC View in easy steps. » Read more Continue Reading »
  • Posted on Saturday November 19, 2016
    Abstract In computer systems, resources have to be balanced so that the performance will be better based on the same hardware. In Linux Kernel system, we will see some migration kernel threads running as daemons to do this kind of jobs as follows. In this article, we will discuss how Linux Kernel balances its hardware/software resources (NOTE: this article is based on Linux Kernel 4.7 and other versions may have some differences). » Read more Continue Reading »
  • Posted on Wednesday November 09, 2016
    Abstract Sometimes, we may want to migrate one process/thread to one specific CPU for some specific purpose. In the Unix/Linux systems, you may choose sched_setaffinity to finish this job. This article will help you to understand how sched_setaffinity (or other APIs like pthread_setaffinity_np in user-space) works internal Linux kernel. Details -- sched_setaffinity(pid_t pid, const struct cpumask *in_mask) --- __set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask, bool check) ---- stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg) ----- migration_cpu_stop(void *data) ------ __migrate_task(struct rq *rq, struct task_struct *p, int dest_cpu) ------- move_queued_task(struct rq *rq, struct task_struct *p, int new_cpu) -------- enqueue_task(struct rq *rq, struct task_struct *p, int flags) --------- returns the new run queue of destination CPU Above character steps give a workflow of how sched_setaffinity works (how it migrates one process/thread from the run queue of source CPU to the run queue of destination CPU). » Read more Continue Reading »

Latest QA answers

  • Posted on Tuesday May 23, 2017
    In C++, you may open a input stream on the file and use the std::getline() function from the <string> to read content line by line into a std::string and process them. std::ifstream file("input.txt"); std::string str; while (std::getline(file, str)) { // process string ... }A full example is as follows: $ g++ file-read-line.cpp -o s && ./s $ cp file-read-line.cpp input.txt $ ./s #include <iostream> #include <fstream> #include <string>int main () { std::ifstream file("input.txt"); std::string str; while (std::getline(file, str)) { std::cout << str << "\n"; } } Continue Reading »
  • Posted on Tuesday May 23, 2017
    In Bash to process a file ./input.txt line by line: while read line ; do echo $line done < ./input.txtReference: https://www.systutorials.com/qa/2166/how-to-process-a-file-line-by-line-in-go Continue Reading »
  • Posted on Tuesday May 23, 2017
    In PHP, you can use this code snippet to process a file line by line: if ( ($fhandle = fopen("./input.txt", "r") !== FALSE ) { while (($line = fgets($fhandle)) !== false) { echo $line }fclose($handle); } else { // error handling } Continue Reading »
  • Posted on Thursday April 20, 2017
    In Python, you may use this piece of code to get an environment variable: os.environ.get('ENV_MIGHT_EXIST')or this piece of code: os.getenv('ENV_MIGHT_EXIST')It will return None if the environment variable is not present. Reference and for more ways, please check https://www.systutorials.com/dtivl/13/how-to-get-an-environment-variable?show=80#answer-80 . Continue Reading »
  • Posted on Thursday April 20, 2017
    In Python, you can get the epoch time by calling time.time(): import timeprint time.time()Reference: https://www.systutorials.com/dtivl/16/how-to-get-the-epoch-timestamp#answer-18 Continue Reading »
  • Posted on Thursday April 20, 2017
    In Python, you can get the hostname by the socket.gethostname() library function in the socket module: import sockethostname = socket.gethostname()Reference: https://www.systutorials.com/dtivl/20/how-to-get-the-hostname-of-the-node?show=34#a34 Continue Reading »
  • Posted on Sunday April 09, 2017
    The java-repl tool https://github.com/albertlatacz/java-repl/ works nicely for most situations for me. It is released as a .jar. Hence, it is easy to download and run: $ wget --quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jarOne usage example is as follows. $ wget --quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jar Welcome to JavaREPL version 428 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25) Type expression to evaluate, :help for more options or press tab to auto-complete. Connected to local instance at http://localhost:33598 java> long ts = Continue Reading »
  • Posted on Friday March 31, 2017
    A tip to help you save a file with spaces in its name into HDFS: putting file from STDIN. One example is as follows: date | hdfs dfs -put - "/path/file with space.txt"For your example above, the command can be: cat "/home/u1/testa/test a" | hdfs dfs -put -f - "/u1/testa/test\ a"Then your file will be save into HDFS successfully with the space kept. Note that if you would like to keep the mode of the file, you will need to set it explicitly using hdfs dsf -chmod .... Continue Reading »
  • Posted on Friday March 31, 2017
    To get an environment variable (e.g. "VAR") in GO: import "os" import "fmt"fmt.Println("VAR:", os.Getenv("VAR")) Continue Reading »
  • Posted on Friday March 31, 2017
    In Python, you can process a file line by line by a for in the file like with open("./input.txt", "r") as thefile: for line in thefile: print line Continue Reading »
  • Posted on Sunday March 19, 2017
    To effectively disable a Linux user account so that it can't login using its password or keys, you can use the usermod tool: Lock a Linux user zma2: # usermod -e 0000-00-00 -L zma2Unlock the user locked by the above one: # usermod -e "" -U zma2The -L/-U options lock/unlock the user's password and -e set/clear the expiration dates so that the user can/cannot login using other ways than the password. Continue Reading »
  • Posted on Sunday March 19, 2017
    For CentOS 6, I used a slightly old version (version 1.7.4) using an RPM built for by PUIAS: For x86-64 version: # yum install http://puias.princeton.edu/data/puias/6/x86_64/os/Addons/fuse-encfs-1.7.4-1.puias6.x86_64.rpmFor i686 version: # yum install http://puias.princeton.edu/data/puias/6/i386/os/Addons/fuse-encfs-1.7.4-1.puias6.i686.rpm Continue Reading »
  • Posted on Sunday March 19, 2017
    The best way I found is to use the texlive offical installation tool to install the full packages for texlive 2016. It will take around 4.5GB. First, remove existing texlive packages if they are installed: # yum erase texlive texlive*Then download installation package from its website. And execute the installation tools in the decompressed package: # ./install-tlIt will download and install the packages/tools for texlive. After it is done, set the path in your ~/.bashrc or a global location accordingly: export PATH=/opt/texlive/2016/bin/x86_64-linux/:$PATHHere, /opt/texlive/ is the path you chose to install texlive. If Continue Reading »
  • Posted on Sunday March 19, 2017
    You can find built dia packages in some additional repositories for CentOS. First, enable EPEL following this link. Second, enable Nux Desktop following this link. Then, you can install dia by # yum install dia Continue Reading »
  • Posted on Wednesday March 08, 2017
    Hover over a blank part of the bottom panel. Press Ctrl + Super + Right Click. Press delete/remove this panel. Continue Reading »
  • Posted on Tuesday February 21, 2017
    You may use a way as follows.open the file seek to the end tell its position which is the file sizeAn example is as follows. Python 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> file = open("/tmp/file.jar", "rb") >>> file.seek(0, 2) # 2 is os.SEEK_END >>> filesize = file.tell() >>> print filesize 3364Here, the value of os.SEEK_END (2) is used Continue Reading »
  • Posted on Sunday February 12, 2017
    You can use the ReadFile() func from the io/ioutil package in Go to read the whole file content: func ReadFile(filename string) ([]byte, error)For example, read file filepath content and check the error: if bytes, err := ioutil.ReadFile(filepath); err != nil { log.Fatal("Failed to read file: " + filepath) } Continue Reading »
  • Posted on Sunday February 12, 2017
    You can use the NewReader() func from the bytes package of Go to convert bytes to io.Reader. For example, reader := bytes.NewReader(thebytes) Continue Reading »
  • Posted on Tuesday January 24, 2017
    Since you're dealing with passwords, you probably want to have a safer generation method. Here's an example with SecureRandom taken from here: object RandomUtil { private val random = SecureRandom.getInstanceStrongdef alphanumeric(nrChars: Int = 24): String = { new BigInteger(nrChars * 5, random).toString(32) } } Continue Reading »
  • Posted on Tuesday January 24, 2017
    Some references: 1, How to write a good systems paper 2, How to be a good graduate student 3, Doing a System Ph.D. 4, Giving an Academic Talk Continue Reading »

Latest Dtivl (Do This In Various Langs) posts

  • Posted on Thursday May 11, 2017
    For C++, as in Going Native 2012 Keynote by Bjarne Stroustrup:light-weight abstractionKey strengths:infrastructure software resource-constrained applications Continue Reading »
  • Posted on Saturday April 22, 2017
    You may call the System.getenv(name) library function in Java to get the environment variable value. public static String getenv(String name)Parameters: name - the name of the environment variable Returns: the string value of the variable, or null if the variable is not defined in the system environmentOne example, in the Java REPL: java> System.getenv("JAVA_HOME") java.lang.String res0 = "/usr/java/default/" Continue Reading »
  • Posted on Thursday April 20, 2017
    In C, we common way to store a list/collection of objects of the same type is to use one-dimensional arrays. In C, an array is a collection of data objects of the same type. An array is in a contiguous memory area. The lowest address of the memory area corresponds to the first element in the array and all other elements follow it one by one. Arrays can be statically allocated or dynamically allocated: // statically allocated // declare a static array a1 of 100 ints int a1[100];// dynamically allocated on the heap // allocate a dynamical Continue Reading »
  • Posted on Wednesday April 19, 2017
    In OCaml, you may print a string with the end line character by using the function in the Pervasives module: val print_endline : string -> unitPrint a string, followed by a newline character, on standard output and flush standard output. One usage example: $ ocaml OCaml version 4.01.1+dev2-2013-12-18+CLOSED# print_endline "hello world!";; hello world! - : unit = () # Continue Reading »
  • Posted on Wednesday April 19, 2017
    In C++ https://www.systutorials.com/qa/2409/how-to-process-a-file-line-by-line-in-c Continue Reading »
  • Posted on Wednesday April 19, 2017
    In C and C++, you can call the getpid() library function which is a function from the POSIX library. #include <sys/types.h> #include <unistd.h>pid_t getpid(void);getppid() returns the process ID of the calling process. Example usage: getpid.c #include <stdio.h> #include <sys/types.h> #include <unistd.h>int main() { pid_t pid = getpid();printf("pid: %lu\n", pid); }Build and run it: $ gcc getpid.c -o s && ./s ppid: 7108 Continue Reading »
  • Posted on Wednesday April 19, 2017
    In C and C++, you can call the getppid() library function which is a function from the POSIX library. #include <sys/types.h> #include <unistd.h>pid_t getppid(void);getppid() returns the process ID of the parent of the calling process. Example usage: getppid.c #include <stdio.h> #include <sys/types.h> #include <unistd.h>int main() { pid_t ppid = getppid();printf("ppid: %lu\n", ppid); }Build and run it: $ gcc getppid.c -o s && ./s ppid: 22312Verify the pid of the parent process (the Bash shell): $ echo $$ 22312 Continue Reading »
  • Posted on Wednesday April 12, 2017
    In OCaml, you can use the Printf.eprintf function to print to STDERR (which is in Pervasives.stderr). Examples: Use Printf.eprintf: $ rlwrap ocaml 2>/tmp/a.txt OCaml version 4.01.1+dev2-2013-12-18+CLOSEDCannot find file topfind. Unknown directive `thread'. # Printf.eprintf "hello world!";; - : unit = () # $ cat /tmp/a.txt hello world!Use Printf.fprintf to print to Pervasives.stderr: $ rlwrap ocaml 2>/tmp/a.txt OCaml version 4.01.1+dev2-2013-12-18+CLOSEDCannot find file topfind. Unknown directive `thread'. # Printf.fprintf Pervasives.stderr "hello world!";; - : unit = () # $ Continue Reading »
  • Posted on Monday April 10, 2017
    In Go, you can use the os.Hostname() function to get the hostname of the node. func Hostname() (name string, err error)Hostname returns the host name reported by the kernel.One example is as follows. The main.go source code: package mainimport ( "fmt" "os" )func main() { name, err := os.Hostname() if err != nil { panic(err) }fmt.Println("hostname:", name) }Run it: $ go run main.go hostname: host001 Continue Reading »
  • Posted on Saturday April 08, 2017
    In C, from man 7 time: UNIX systems represent time in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). A program can determine the calendar time using gettimeofday(2), which returns time (in seconds and microseconds) that have elapsed since the Epoch; time(2) provides similar information, but only with accuracy to the nearest second.You can use the time() library function to get the epoch timestamp: On 32-bit POSIX systems: fprintf(stdout, "%u\n", (unsigned)time(NULL));On 64-bit POSIX systems: fprintf(stdout, "%lu\n", (unsigned long)time(NULL)); Continue Reading »
  • Posted on Monday April 03, 2017
    In Bash, you can use the date command's -d option: date -d @<your epoch>Here @ specifies the epoch timestamp. One example: $ date -d @1490157520.05 Wed Mar 22 12:38:40 HKT 2017 Continue Reading »
hss-keywords.png

Most viewed tutorials

sai-kung-hong-kong.jpg

Latest updated tutorials

Subscribe, contact, and license

Subscribe to SysTutorials: Subscribe. Contact us: Contact. General license and policy: License.

Please share if you like this post: