I'm converting some code written for a linux system to a windows system. I'm using C++ for my windows system and wanted to know the equivalent of the function inet_aton.
I find myself doing this a lot:
script/generate migration my_new_migration
.. then select & copy the generated filename, then paste it into vi to actually write the migration.
Is there any way to do this in one step? i.e. when the script/generate migration runs, it creates the file the automatically opens that file in an editor?
(I'm working in an SSH terminal window on linux..)
I generally have ignored using macros while writing in C but I think I know fundamentals about them. While i was reading the source code of list in linux kernel, i saw something like that:
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
(You can access the remaining part of the code from here.)
I didn't understand the function of ampersands(I don't think they are the address of operands here) in LIST_HEAD_INIT and so the use of LIST_HEAD_INIT in the code. I'd appreciate if someone can enlighten me.
This is a totally newbie question. I'm running Eclipse on Ubuntu. I created a test project that I want to compile to an executable (whataver the linux equivalent is of a Windows .exe file). Here's the contents of my program:
public class MyTest {
public static void main(String[] args) {
System.out.println("You passed in: " + args[0]);
}
}
I want to know how to compile it and then how to execute it from the command line.
Thanks!
I'm messing around with Linux kernel 2.4 and function schedule() in sched.c uses the macro prepare_arch_schedule, which appears to be an infinite loop. What is that? And how does it finish?
Hi,
I am using C language and Linux as my programming platform.
I am learning how to create a daemon, and I want to create a log file so that I write a debug message in my daemon. My question is where should I put the log file in my system. Should I put it in the var folder?
Please advice.
Many thanks.
Is it possible to clear a file preserving its timestamp, using standard Linux commands? For example:
echo "" file-name
converts the text file to empty, this is OK for me. But I need to keep the timestamp unchanged.
I'm curious how far others have pushed Boost.Asio in terms of scalability. I am writing an application that may use close to 1000 socket objects, a handful of acceptor objects, and many thousand timer objects. I've configured it such that there's a thread pool invoking io_service::run and use strands in the appropriate places to ensure my handlers do not stomp on each other.
My platform is Red Hat Enterprise Linux with Boost 1.39, though I'm not opposed to upgrading to a more recent version of boost.
I noticed that in Linux kernel 2.4 setscheduler doesn't force need_resched. Why is that? is it just some convention, or does that happens somewhere else?
Anybody know if it is possible that when making a tar + gzip through 'tar c ...' command if the relative paths will be ignored upon expanding.
e.g.
tar cvf test.tgz foo ../../files/bar
and then expanding the test.tgz with:
tar xvf test.tgz
gives a dir containing:
foo files/bar
i want the dir to contain the files
foo bar
is this possible?
I have a series of python scripts with execute permissions in Linux. They are stored in SVN.
If I then run svn up to update them, the overwritten files are back to 644 - ie no execute permissions for anyone.
Yes I could just script it to chmod +x * afterwards, but surely there's a way to store permissions in SVN or to maintain them when you update?
Any suggestions appreciated.
I need to study about load-balancers, such as Network Load Balancing, Linux Virtual Server, HAProxy,...There're somethings under-the-hood I need to know:
What algorithms/technologies are used in these load-balancers? Which is the most popular? most effective?
I expect that these algorithms/technologies will not be too complicated. Are there some resources written about them?
Thank you very much for your help.
Hi
I have a C++ program running under linux. Is it possible to track its memory usage from the code? I am allocating new objects and running out of memory, so I want to keep track of how quickly I am using memory.
Thanks
When I create a .tex file using vim I get a nice template from having
autocmd BufNewFile *.tex 0r $HOME/.vim/templates/skeleton.tex
in my .vimrc. I also have a makefile-template in my home directory, but this one I have to manually copy to where the .tex file is. In a Linux environment, how can I auto-copy or auto-generate the makefile at the same time as I create a .tex file?
In the beginning of a file on my server (linux), which is located in the /etc/init.d/ folder I have this line:
!/bin/sh -e
What does it mean, because every time I execute the rest of the script it works fine except for an error which shows:
!/bin/sh not found
Any ideas?
I have a piece of usb hardware, for which I know the driver.
However, the vendor id and product id do not match the VID, PID pair registered in the driver. Is there a way in linux to force a driver to be associated with a known device, that do not involve kernel module recompilation to add a PID / VID pair ?
I have a legacy C++ project on Linux which uses the typical:
./configure
make
make install
to build and install. I would really like to build it instead with an IDE like Eclipse.
Is this doable? Is there something in Eclipse that can parse the original Makefile(s) and turn it into an Eclipse project?
Is it possible? Run a cvs diff in terminal at the project root that outputs only modified files (like local files that aren't in source control and local modified files).
I'm running cvs diff --brief but I still have too many results since my project is large, and with a lot of subdirectories - it shows the whole hierarchy and I just want to know which files are different from HEAD revision. I'm using Linux.
I am willing to build an email application which runs on the server side.
Not being familiar with any particular server I wonder if I can get some recommendations based on experience.
I have seen many great startups which built some neat apps on the email platform (for instance, friendfeed's notification mechanism, or surely posterous which mail is at the heart of their business logic), and wonder about which mail server have they found easy to learn and integrate with.
PS:
MS Exchange or any other not open-source are not an option
Must run on linux
Hi guys,
I've a lot of websites (100+ directories) I want to create a unique zip with only public subdirectory.
My structure now is like:
- Site 1
--- app
--- tmp
--- log
--- public
- Site 2
--- app
--- tmp
--- log
--- public
- ... 100+ dirs ...
Now I need a unique zip and then after unzip it I want to see this structure:
- Site 1
--- public
- Site 2
--- public
- others
Any suggestion how I can do that with linux commands zip/tar ?
Thanks so much!
Say our folder structure looks like this:
/app
/app/data
...
/app/secondary
/app/secondary/data
I want to recursively search /app/data but I do not want to search /app/secondary/data.
From within the app folder, what would my grep command look like?
I'm developing application that will read messages from IMAP server.. what would you recommend for local development/testing (easy configurable light server)
Platform - Ubuntu Linux
I am working with telecom company. I am familiar with Java programming language. But now I have a task to write a script, with Linux operating systems. I have to write a script for fetching data from other computer and check some conditions. How can I do that using Java?
I am looking for a way to monitor a Linux mbox email account, when an email arrives I would like to download an attachment from the email and save the attachment (CSV file) so that it may be used by a PHP script. What would be the best way of going about this? I have looked at PHP's IMAP functions but this does not appear to be the most appropriate method when a simple bash script may be all that is required?