I'm trying to solve this problem, but always get Time limit exceeded. I've tried my best but still can't get under time limit. Could you please give me some hint about it?
I'm trying to write a program that generates a random number and then tells if it is prime or not. I have doe some research about how to calculate prime and random numbers but I'm still having trouble. I don't really get how to calculate a prime number. I know a prime number is a number that is divisible by 1 and and itself. how to calculate a prime number in C?
writing a program to find the prime numbers.i came to know that sieve of atkin is the most efficient algo to find the prime numbers.i am finding difficult to understand it
I wrote a little Bash script which accepts two values -- sender address and recipient address -- and finds any instances of mail sent from sender to recipient in /var/log/maillog. The script works fine, but it seems to be very inefficient. I'm just wondering how I can optimize it.
Code:
Example:
Code:
Again, it seems to work fine, but the script greps through /var/log/maillog three times -- first to find the sender; second to see if it's also going to the desired recipient; finally to view all instances of the message ID in the logs. This seems redundant and inefficient.
I tried to summarize the this as best as possible in the title. I am writing an initial value problem solver in the most general way possible. I start with an arbitrary number of initial values at arbitrary locations (inside a boundary.) The first part of my program creates a mesh/grid (I am not sure which is the correct nuance), with N points total, that contains all the initial values. My goal is to optimize the mesh such that the spacing is as uniform as possible. My solver seems to work half decently (it needs some more obscure debugging that is not relevant here.)
I am starting with one dimension. I intend to generalize the algorithm to an arbitrary number of dimensions once I get it working consistently. I am writing my code in fortran, but feel free to reply with pseudocode or the language of your choice.Allow me to elaborate with an example:Say I am working on a closed interval [1,10]
I store my mesh/grid points in an array called coord. Say I want 10 points total in my mesh/grid.
N=10 coord(10)
Remember, all this is arbitrary--except the variable names of course. The algorithm should set coord to {1,2,3,4,5,6,7,8,9,10} Now for a less trivial example:
num_ivc=3 known(num_ivc)=[xmin,5.5,xmax or just num_ivc=1 known(num_ivc)=[5.5]
Now, would you have 5 evenly spaced points on the interval [1, 5.5] and 5 evenly spaced points on the interval (5.5, 10]? But there is more space between 1 and 5.5 than between 5.5 and 10. So would you have 6 points on [1, 5.5] followed by 4 on (5.5 to 10]. The key is to minimize the difference in spacing.I have been working on this for 2 days straight and I can assure you it is a lot trickier than it sounds. I have written code that
only works if N is large only works if N is small only works if it the known points are close together
[code]....
So as you can see, I have coded the gamut of almost-solutions. I cannot figure out a way to get it to perform equally well in all possible scenarios (that is, create the optimum spacing.)
Twice today, and several times recently, I have had a sudo command rejected with the dreaded message "<user> is not in the sudoers file..." It's because my user -- which is the main user, the one you create on Ubuntu installation -- has "fallen out of" the admin group. I can fix it because there are other users defined which are still in the admin group and I can su to one of them and add myself back.But why is it happening? I'm doing software development, and use sudo mainly to do benign things like copying new versions of Perl programs into the application library: I'm not going anywhere near the security subsystem, for instance. I'm worried that one day whatever-it-is will choose to drop all the users out of admin and then I'll have to resort to live CD hacking to fix it.
http://pastebin.com/raw.php?i=rykHdvBhbix.hu and www.yahoo.com are "pingable" test sites.127.0.0.1 could not be pinged [firewall drops all icmp]
i have a "oneliner" that echoes if theres "internet connection or no". $ ping -W 1 -c 2 bix.hu >& /dev/null && ping -W 1 -c 2 www.yahoo.com >& /dev/null && echo "internet connection ok" || echo "no internet connection"
A hard disk occasionally fails. Standard checks like fsck and scandisk fail to report any problem. Is there other software to exercise the disk much more thoroughly so that bad sectors have no chance of being missed?
I've just tested my new (actually old as hardware) nodes in computing cluster. Use for this http://systester.sourceforge.net/. But in params for tester above 32M system refuses to allocate memory in spite of there are about 250M free.It's because it too defragmented so i cannot run such tester. In future actually will be tasks with big linear memory queries, so is it possible to defrag RAM after every system loading?For this moment can you also point out for me other testers weith big memory queries but without linear manner?
A hard disk occasionally fails. Standard checks like fsck and scandisk fail to report any problem. Is there other software to exercise the disk much more thoroughly so that bad sectors have no chance of being missed?
I am working on optimizing the iptables. I came across some way of optimizing the rules by removing the redundant rules and merging the rules . Is there any other way to increase the optimization of iptables ?The network that we applied the iptables is a simple LAN network. (College Network)
I have just bought a digital-to-analog converter, this one to be exact, along with an amplificator and two speakers. I'd like to get the most of my Ubuntu, a good sound (what player can I use ?) and to know wether I need to do some extra changes in the kernel (OSS / PulseAudio / ALSA ?) or not.
I wonder if my converter will be detected when i plug it in, and if any sound from my computer will be leaded to it automatically ? (I'll have the converter tomorrow). I believe its purpose is to replace the sound card, to provide a greater, pure sound. The converter is linked by USB by the way.
I have a friend who is using Ubuntu 10.10 Netbook Edition on their netbook and well they love it. However, I notice that at times (if not all the time) their internet is ridiculously slow. Yes, it's a 1 Mbps download connection, but I still think it's a little slow and at times I can't even get it to load a website. I'm thinking if I adjusted the MTU within Ubuntu, it might improve, if even only slightly. I believe the router is set to 1490 or 1500, I haven't really looked yet.
I would like to ask how can I optimize apache2 load on my dedicated server. I am hosting Facebook applications on it, but most users will get a Timed Out message when they try to access it. I was tinkering with MaxClients directive in apache2 config, and it got better, but still it's not best. Programmers are trying their best to optimize the applications at their side, but I am afraid this is an server issue.
I am running Ferdora 12 (constantine) 64 with Intel Xeon 3.2GHz processor + 12GB Ram. I am running this machine specifically for number chunching applications but it isnt running as fast as i thought it would! Are there any tips to optimizing the speed of processors in fedora?
I recently purchased a Western Digital 1TB USB hard drive to use for general data storage. I had thought about repartitioning it into 8 - 10 individual drives (most Linux users will doubtless understand the arguments for and against this) and reformatting them with another filesystem, probably ext2.
The unit actually consists of two 500GB drives that are presented by the internal controller as a single 1TB drive, and are formatted with the old HPFS/NTFS filesystem, so I'm a bit cautious about the possibility of my original plan confusing the drive's controller. Does anyone have any experience with these large drives, any thoughts about repartitioning/reformatting, and relevant criteria for optimizing their use?
Where can I find comprehensive information on optimizing Linux? I keep searching online but seem to get only to performance monitoring. I don't want to run a lighter version of Linux or upgrade my hardware! Just want to get my current distro and future ones I might install to run at its best.
On my bare metal server, I get about 130MB/s read from a software RAID 10 array, but when reading the same file from a VM via NFS over the VirtIO interface,I only get about 40MB/s.
Furthermore, the process for the VM uses >180% CPU on the host, and ~40%, and the 5 min average is ~1.5 on the host and guest. I have dual E5620's so I'm disappointed that the transfer is so slow, as I was expecting at least 90MB/s.
I'm new to being a sysadmin, so if anyone has some tips I can use to increase the transfer rate, and possibility reduce the CPU load as well I'd appreciate it. I'm assuming that 130MB/s is the max speed of two 7.2k HDDs, but if there's any way I can squeeze any more out that would be great too.
System specs:
2x Intel Xeon E5620s @ 2.40Ghz 8GB of RAM @ 1066Mhz 4x 1TB Western Digital Black HDDs in RAID10
I have a dual boot on a netbook with windows and fedora13. When I am on my fedora boot and I try to watch streaming video it comes through in waves or not at all. I do not have the same problems on the alternate boot. There are other performance comparisons where the windows boot runs smoother and faster. Is there any work I can do in order to optimise my fedora boot in this capacity?
So I've come across several tips to optimize battery life on Linux. [URLs]. In addition to undervolting, I would like to underclock. Is there a way to control CPU speed outside of the BIOS via some software control in Linux... or some sort of boot manager? I would like to boot to linux using underclocked speeds and have Windows running full blast. Is there a way to run Linux completely in RAM? I have read that saves on power consumption from the hard drive.
Can Cat5e RJ45 connector crimper be used for Cat 6 connector because I heard cat 6 connector is different from cat 5e connector and also same question for cable tester can cat5e cable tester be used for cat 6 cable?
Ok this might get a bit messed up ... but basically..
When someone visits the site, the connection should be terminated in 30 sec and if he wishes to further browse reconnected.
How i can maximize output, the more users server can entertain the better. on peak times i get around 2000 visitors, so any tips on how to compensate the most..
I am interested in learning 3D programming. The thing is, I would hate to put too much effort to learn something that doesn't have future and is dying. My favorite language at the time is Java. My goal is professional programming.
So I have several questions: 1. Should I learn JOGL or start learning C++ and do C++ openGL programming? 2. Is there a big difference between JOGL and C++ openGL programming? 3. Is it worth to learn openGL? Does it have a future? 4. Is it a big difference between openGL and directX coding? 5. If choosing Java, then JOGL or LWJGL?
Groovy is an object-oriented programming language for the Java platform. I do not have experience in Java, only perl and shell scripts. Recently I have been asked to maintain a software written in groovy (also to make enhancements). So can I learn groovy without knowing java language. or isit I have to learn java before venturing into groovy.
I did searched you tube but my results were not great.I have 2 books on KernelProgramming.I feel I need if some where I can get a video tutorial which can help me to understand how to develop a Linux Device driver that will be great.I had a look at Greg Kroah Hartmans video lecture of developing patches on ......I have been reading books and a lot of stuff.So I wish if I could get a video lecture that would be better
I have a server listening on incoming client connections. Once the client establishes SSL connection with the server, the server waits on read() from the client. Only Client can disconnect the connection. I want to have a timer in the server program to wait for x secs after read() and then disconnect the Client connection.
I want that I click with the mouse on the video, it paused.I notice that there is "BaconVideoWidget" which I guess is the video rendering widget but it don't have signal named "clicked":