Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- OUTPUT



  Easy Parallel Processing in PHP

The proliferation of multicore CPUs and the inability of our learned CPU vendors to squeeze many more GHz into their designs means that often the only way to get additional performance is by writing clever parallel software. One problem we were having is that some of our batch processing jobs were taking too long to run. In order to speed the processing, we tried to split the processing file into half, and let a separate PHP process run each job. Given that we were using a dual core serv...

   PHP,Parallel processing,Multithreading like,Sleep     2011-12-12 10:58:59

  Clojure & Java Interop

About a year ago I got a phone call asking if I wanted to join another team at DRW. The team supports a (primarily) Java application, but the performance requirements would also allow it to be written in a higher level language. I'd been writing Clojure (basically) full-time at that point - so my response was simple: I'd love to join, but I'm going to want to do future development using Clojure. A year later we still have plenty of Java, but the vast majority of the new code I add is Cloj...

   Java,Clojure,Interoprability,Commit,Function call     2011-12-29 09:11:22

  Convert HTML to DOM elements using JavaScript

In some cases, one would want to convert a HTML string to the DOM elements so that JavaScript can handle them easily. This is frequently used when one get some data from third party APIs where the data is in HTML format. In JavaScript, there are a couple of ways one can use to convert HTML to DOM elements. DOMParser document.createElement DOMParser DOMParser can parse XML or HTML source stored in a string into a DOM Document. After the conversion, the normal JavaScript call of h...

   JAVASCRIPT,DOMPARSER,DOCUMENT.CREATEELEMENT,HTML,DOM     2017-08-18 22:51:46

  Be careful when running knife vault command

While using Chef, one would frequently use knife commands which are used to manage resources on the Chef server. One can list all nodes, data bags, vault items and many other stuff on the Chef server. In this post, we would cover one command which may need your attention when using it -- knife vault. On Chef server, one can store data to data bags which can be accessed by registered clients. These data bags usually store the data in plain text format. In some cases, one would need to store data ...

   KNIFE VAULT,KNIFE DATA BAG,CHEF-VAULT,CHEF     2017-08-19 00:26:54

  Using C for a specialized data store

Pixenomics stores and transports 1.2 million pixels from the server to the client. During development we played with various methods to store and process this. Our ultimate goal was to send the entire board in under 1 second. During the stages of prototyping we used a MySQL database without thinking too much about performance. With a mere 2,000 pixels we quickly realised this wasn’t even usable as a demo. Changing the storage engine to memory was much better but still obviously unu...

   C,Data store,Efficiency,Performance     2012-03-07 05:09:38

  /dev/null and /dev/tty in Linux

In Linux, there are two special files /dev/null and /dev/tty. /dev/null will drop all the data written to it, i.e, when program writes data to this file, it means the program has completed the data write operation. But in  fact it does nothing, if you just want the status of a command but not the output of a command, this feature will be very useful. See below shell codes:     /> vi test_dev_null.sh        #!/bin/bash    if grep...

   Linux,/dev/null,/dev/tty     2013-03-04 02:23:23

  A trick of building multithreaded application on Solaris

Firstly, Let’s see a simple multithreaded application: #include <stdio.h> #include <pthread.h> #include <errno.h> void *thread1_func(void *p_arg) { errno = 0; sleep(3); errno = 1; printf("%s exit, errno is %d\n", (char*)p_arg, errno); } void *thread2_func(void *p_arg) { errno = 0; sleep(5); printf("%s exit, errno is %d\n", (char*)p_arg, errno); } int main(void) { pthread_t t1, t2; ...

   C, Solaris     2014-10-14 02:59:40

  How to check why Vim is slow

On *nix, some processes may not be able to start up, software runs very slowly suddenly and software's "Segment Fault" are some issues faced by many *nix users. Here we show you how to use truss to trace why Vim becomes slow suddenly. Operating system : FreeBSD-5.2.1-releas vim version is 6.2.154, after typing vim on command line, sometimes we need to wait for a few minutes to get into the edit interface and there is no error output. After carefully checking .vimrc and all vim settings, there ar...

   vim, truss, linux     2012-11-26 11:54:35

  Why cannot compare double values directly for equality?

A question in PHP: Get some value from the database and use floatval() to convert it to floatint point value, then compare it with another value which is also converted to floating point value with floatval(). These two values are the same when using var_dump() to output, the two outputs are float(8.87), they are the same. But when comparing them for equality, the result is weird., they are not equal. Why?To analyze this question, we need to start with PHP data types. PHP uses weak types. In PHP...

   PHP,floating, precision,compare,equality     2012-06-27 09:01:36

  The magic of go:linkname

When writing Go program, there is frequent need on using time.Sleep() function to pause the logic for some time. And if jumping to the definition of this function, can see below definition: // Sleep pauses the current goroutine for at least the duration d. // A negative or zero duration causes Sleep to return immediately. func Sleep(d Duration) I's strange that there is no function body defined here. What happened? The actual definition of the function body is residing at runtime/time.go&nb...

   TRICKS,GO:LINKNAME,GOLANG     2022-04-10 08:39:00