linux

how to set control register 0 (cr0) bits in x86-64 using gcc assembly on linux

I am using the following code to set the cr0 bit to disable cache. When I compile this #include <stdio.h> int main() { __asm__("pushl %eax\n\t" "mov %cr0,%eax;\n\t" "orl $(1 << 30),%eax;\n\t" "mov %eax,%cr0;\n\t" "wbinvd\n\t" "popl %eax"...

Linux command to translate DomainName to IP

Is there any Linux command to translate domain name to IP? ...

php script is ouputting php code, not sure why

I have a simple modal dialog that I developed on my own linux server, running php 5.3. The script (shown below) runs fine on my server. However, I moved it to my client's linux server and instead of echoing the text/html that it apparently is supposed to do, it echos ALL the actual php code from the > (greater than) character on. Does...

Why won't my program read from a usb interrupt endpoint

Hello. I am writing a libusb program to interact with a usb gamepad. I found it, opened it, detached from kernel, claimed interface, and when I try to usb_interrupt_read it returns -110 (resource temporarily unavailable) what is doing on? also, usb_set_configuration fails, so I commented it out. do I need it? Why isn't it reading? i = ...

Hudson server always stopped every morning day ?

Hi Everyone, I've got this regular problem every morning that my build server (Hudson) is always stopped every morning so I have to manually start it, is there any reason why or any location that i can started to look for the error message ? Thanks. here's the error diagnostic that i did: ascari:~# ps -ef | grep -i hud root 595...

Why doesn't this Avahi client code work to add a CNAME alias to my Linux machine?

Hi all, I'm trying to write a little program that will add mDNS CNAME aliases to my Linux device, so that it can be accessed via more than one "something.local." domain name. This program's intended function is the same as the avahi-aliases Python script, but in order to avoid a Python dependency, I'm trying to implement it in C++ inst...

pthread_cond_broadcast problem

Using pthreads in linux 2.6.30 I am trying to send a single signal which will cause multiple threads to begin execution. The broadcast seems to only be received by one thread. I have tried both pthread_cond_signal and pthread cond_broadcast and both seem to have the same behavior. For the mutex in pthread_cond_wait, I have tried both ...

How to quickly infer start/end time of files that only show start time?

I have a huge list of video files from a webcam that have that look like this: video_123 video_456 video_789 ... Where each number (123, 456, and 789) represents the start time of the file in seconds since epoch. The files are created based on file size and are not always the same duration. There may also be gaps in the files (eg c...

Having a problem figuring out how to get Ethernet interface info on Mac OS X using ioctl/SIOCGIFADDR/SIOCGIFCONF?

Are you having a problem figuring out how to get interface info on Mac OS X using ioctl/SIOCGIFADDR/SIOCGIFCONF? I had a lot of trouble getting code that worked fine on Linux to work on Mac OS X today. ...

(Node.js) application that lets me edit a local file through a web browser?

I wonder if there is a Node.js application that starts a server on the current folder to let me edit files through the web browser? Kinda like http://www.cloud9ide.com, but for general editing (scripts, text etc). ...

Parallel Processes Results Written To Single File

I am new to Linux and was introduced to the "&" recently. I have to run several traceroutes and store them in a single file, and I am curious if I am able to kick off these traceroutes in parallel? I tried the following but the results in the generated file, are not kept apart? Well, that is what it seems to me. traceroute -n -z 10...

Linux' Application

Application of Linux...? ...

Why does my C++ object loses its VPTr

Hi Guys, While debugging one of the program's core dump I came across the scenario where its contained object which is polymorphic loses its VPTr and I can see its pointing to NULL. What could be the scenario when an object loses its VPTr. Thanks in advance, Brijesh ...

Is antivirus software on a Linux desktop more or less secure?

On a Linux desktop (not a mail server for Windows machines, or similar), but sharing a network with other Windows machines, would you say your network is more or less secure running a Linux antivirus product? Or does it make no difference either way? I'd argue that you're extremely unlikely to end up in a situation where you're unknowin...

assembly implementation for kbhit in linux

I'm writing a game in assembly, and I need to check if a key was pressed. So, how is kbhit implemented in Linux? Thanks. ...

Bash script to find the frequency of every letter in a file

I am trying to find out the frequency of appearance of every letter in the english alphabet in an input file. How can I do this in a bash script? ...

Linux: Default prioirty of applications that run dynamically as tasks.

Hello all, I'm a new user of linux and am confused about task priorities of applications that run dynamically at run time. Here's the scenario: 1. I create an application called myApplication and install it in one of the bin folders (/usr/sbin) 2. This task is not run until a. I start it specifically from shell or b...

File names with spaces in BASH

Hello, I'm trying to write script that'll crop and resize large photos into HD Wallpapers. #! /bin/bash for i in `ls *.jpg` do width=`identify -format '%w' $i` height=`identify -format '%h' $i` if [ `echo "$width/$height > 16/9" | bc -l` ] then exec `convert $i -resize 1920 -gravity Center -crop '1920x1080+0+...

question about grep pattern

I'm using grep to match string in a file, here is example file : example one, example two null, example three, example four null, grep -i null myfile.txt returns example two null, example four null, How can I return matched line + line number like this : example two null, - Line number : 2 example four null, - Line number : 4...

Simple regular expression parsing in bash

I want to parse a log file (log.txt) which contains rows similar to these: 2010-10-19 07:56:14 URL:http://www.website.com/page.php?ID=26 [13676] -> "www.website.com/page.php?ID=26" [1] 2010-10-19 07:56:14 URL:http://www.website.com/page.php?ID=44 [14152] -> "www.website.com/page.php?ID=44" [1] 2010-10-19 07:56:14 URL:http://www.website....