samedi 9 mai 2015

How to use macro define for x86 and 8664 linux in c

I want to compile part of my code only on x86 and 8664 linux, but not s390 linux or others. How to use the macro define in C to achieve it? I know linux is to determine linux OS, and 386, 486 and 586 to determine CPU architecture. Is there an easy macro define to determine x86 linux and 8664 linux? Thanks

Error while trying to run Spark

I am new to spark. I have downloaded the spark version 1.3.1 prebuilt for hadoop version 2.6 . I extracted and navigated to the folder and typed in the below command : ./bin/spark-shell for which i get an error which says spark-shell command not found. I did the same on windows using git bash for which I get an error saying

spark-submit : line 26 tput command not found

is there something else I need to do before trying to run spark?

Primefaces push in linux

I have deployed 2 web applications which have the push (notification) functions. Firstly, I deploy the first app (PUSH_SERVER) and publish web service. When the web method is called, the notification will be push to the second application. My configuration for the second app is as below:

<context-param>
    <param-name>primefaces.PUSH_SERVER_URL</param-name>
    <param-value>myURL</param-value>
</context-param>

The strange thing is: The push runs really well in Windows. But when I deploy them in Linux, in the same server. The first app is still able to get the notification. However, when I open the second app, I get this error (from FireBug):

Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent).
Websocket closed, wasClean: false
Websocket failed. Downgrading to Comet and resending

I'm really confusing about this error. Would you give me some suggests?

Which database type is better for around 10 million data, windows or linux

i have around 10 millions of record for my website.i will create a search on my website for my recoreds. which database is comparetively faster linux or windows

Changing /etc/hosts with sed command

I'm trying to change /etc/hosts file with sed command , I use sudo to execute the following command

 sudo sed 's/127.0.0.1 localhost/127.0.0.1 localhost mydomain.com/g' /etc/hosts |sudo cat > /etc/hosts

but this is the error that I get

-bash: /etc/hosts: Permission denied

how many maximum concurrent users can a tomcat instance, jboss instance and weblogic instance handle?

I am willing to launch a web application. It was completely on the structs only and no springs are used in it. We are willing to launch in either tomcat or jboss or weblogic application servers.

So, I may get many users' hits to the application. My hardware is 32GB/8cores and the OS is RHEL6.3. So, I would like to know how many maximum concurrent users can a tomcat instance handle. Similar the way, I would like to know about the maximum concurrent users that jboss-as and weblogic also handle.

Thanks in advance

daemon: closed stderr and accept(2)

I wrote a TCP daemon, that accepts clients connections on given port and after that it executes a command using execv(3). In every tutorial on writting daemons it is mentioned to close stdin, stdout, stderr to sucessfully daemonize the process.

However I found out that accept(2) reuses file descriptor numbers of already closed stdout/stderr so after calling fork(2) and execv(3), child process writes output to socket simply because stdout/stderr maps to file descriptor now associated with client socket.

Any ideas how can I avoid this without resorting to shell output redirection?