Programming :: Experience To Make A Script More Efficient?
Mar 30, 2010
I wrote this script to attach url's to specified 6 digit numbers in a configuration text file. My original goal was to be able to be able to pull the url's and the 6 digit numbers from .csv files. that would allow me to make the script more versatile, not only for this particular project, but also for other projects in regards to the configuration file. This script works, and has served it's purpose, but it is not very pretty, and it's probably not very efficient. What can I do to improve it and possibly make it more versatile. I've thought about functions and arrays, but my skill set is still pretty limited. I'm not looking for someone to write it for me, just to point me in the right direction.
[Code]...
View 7 Replies
ADVERTISEMENT
Mar 13, 2010
I am starting a project of my own (and learning C++ at the same time. I got my program to successfully scan a custom netmask, but it is REALLY slow. I want my program to do something similar to nmap -sP xxx.xxx.xxx.xxx-xxx. How to speed it up? Such as pinging more than one IP at a time...
Code:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <sstream>
using namespace std;
int ip42;
string ip1, ip2, ip3, ip4, ipaddr;
int main() {
cout << endl << "Enter part 1: ";
cin >> ip1;
cout << endl << "Enter part 2: ";
cin >> ip2;
cout << endl << "Enter part 3: ";
cin >> ip3;
cout << endl << "Enter part 4: ";
cin >> ip4;
while(ip42 < 255){
ipaddr = string("ping -c 1 ").append(ip1);
ipaddr = string(ipaddr).append(ip2);
ipaddr = string(ipaddr).append(ip3);
ipaddr = string(ipaddr).append(ip4);
system(ipaddr.c_str());
ip42 = atoi(ip4.c_str());
ip42 += 1;
stringstream output;
output << ip42;
output >> ip4; } }
View 2 Replies
View Related
May 12, 2010
What is the efficient way to display jpeg images in browsers using c programming. Any links or any sample code.
View 6 Replies
View Related
Sep 30, 2010
I need to figure out how to arrange for the fastest-possible read-access of a large or huge memory-mapped file. I'm writing high-speed real-time object-chasing software for a NASA telescope (on earth). This software must detect images of fast moving objects (across arbitrary fields of fixed stars), estimate what direction and speed the object image is traveling (based on the length and direction of a streak on the detection image), then chase after the object while capturing new 4Kx4K pixel images every 2~5 seconds, quickly matching its speed and trajectory, then continue to track and capture images until the object vanishes (below horizon, into earth shadow, etc).
I have created two star "catalogs". Both contain the same 1+ billion stars (and other objects), but one is a "master catalog" that contains all known information about each object (128 bytes per object == 143GB) while the other is a "nightly build" that only contains the information necessary to perform the real-time process (32 bytes per object == 36GB) with object positions precisely updated for precession and proper-motion each night. Almost always the information in the "nightly build" catalog will be sufficient for the high-speed (real-time) processes.
[Code]...
View 8 Replies
View Related
Feb 9, 2010
I have two files. One huge one (200.000+ lines) called 'db' and one big one (15.000+ lines) called 'indices'.What is the quickest way of filtering out the lines in 'db' containing any index (anywhere on the line) from 'indices'.Is there a faster approach in bash, linux?
View 1 Replies
View Related
Jun 10, 2010
I am very new in linux/aix scripting. I request you all to give me efficient pdf book or documentation for learning scripting.
View 2 Replies
View Related
Aug 7, 2010
I am trying to setup the most efficient way to remotely administer an ubuntu system. So far I was successful in setting up ssh. I have the server running and made sure it only uses keys to authenticate and changed the default port. I can connect to the ssh-server. This system is behind nat and bots trying to break-in when I forwarded the port. I used the AllowUsers option, which helped in knocking back these rouge connections. I was not comfortable leaving a port open all the time, so I set up logmein Hamachi VPN and closed the ports that were open on NAT.
Now I use Hamachi and am very impressed. I use VNC in VPN. But Vino is slow, I tested x11vnc and it was slightly faster. I also tried to set up freenx but nxsetup file was missing. some one posted that file in the forums and suggested copying to the system but I was not sure if I want to download a script from the forum and use it. So for the time being, I thought I will just concentrate on X11vnc until freenx is fixed.
I would like to create a separate desktop on the server and use it to access remotely. This way we will not have to fight over the cursor (sounds funny but very frustrating). From what I understand x11vnc has this function inbuilt (uses vncserver). I cannot get it to work! when using ssh, at the remote machine's command prompt, if I type "evince xyz.pdf", it does not launch the "xyz.pdf". what am I doing wrong? When using VNC, how can I change between different users on the remote machines? Right now I can only use VNC in one account that I first setup. When I try to change to another user, vnc client goes blank. How can I get as much control of the remote system as possible? Right now I need someone to switch on the remote system and login to their account before I can VNC. Can I use ekiga inside VPN, I use skype right now and it's sometimes terrible with dropouts. I looked around and someone suggested using ekiga as it works very well over lan. How do set up ekiga so that I have a direct connection with the remote system? Is there any client that just takes the IP address and creates a connection? Mumble seems to be the popular choice, it's most suited to LANparties, I just need a connection between two systems. I am trying to set this up to help users with hardly any computer knowledge to use the system without any issues.
View 7 Replies
View Related
Sep 15, 2010
I want to gave much details as possible. working directory (~/a1/shell) in the shell directory i have Makefile. also in the shell directory i have subdirectory's (obj, src, include)
My current Makefile
Quote:
#What needs to be built to make all files and dependencies
clean:
# End of Makefile
I wanted it so: all .o files are created in the obj subdirectory, and my application, sshell, is created in the shell directory.
I am getting this error when i run the make run: No rule to make target 'shell.h', needed by 'shutil.o'. stop
View 1 Replies
View Related
Dec 16, 2010
I am stuck with Fedora 13 due to the fact that clutter has some nasty bug which colides with the nvidia binary blob driver (I _require_ CUDA _and_ usable 2D/3D). So the new version is out since some days ago but not yet in rpmfusion. So did anyone give 260.19.29 a shot and does the 2D/3D UI still lag?
View 14 Replies
View Related
May 12, 2010
For some reason, my downloads on Windows are really slow no matter what download accelerator I use. I've tried IDM, FDM , DAP , DAM , Orbit , Supersonic , jDownloader - they all have some problem . Sometimes the files just halt and refuse to be downloaded.
Warning : Not For Advanced Users!
On Ubuntu though I have found a wonderful solution that sees me all the time maxing out my download connection and often exceeding it with absolutely no problems.
Here's the combination :
Aria 2 + Flashgot.
I will show you how to set it up, how to configure it and how to pause , resume downloads.
That's all one needs!
1. To get started , let's download Aria 2.
Fire up a terminal and enter
Code:
sudo apt-get install aria2
2. And now Flashgot : Install the add-on from this site: [URL]
Close Firefox
3. Now to choose Aria 2 as the default download manager
Open Firefox
Tools
Flashgot -> More Options -> General Tab and select Aria 2.
4. Now in terminal:
Code:
cd
mkdir .aria2
Now create a file called aria2.conf inside .aria2( which is a hidden folder can be viewed by pressing Ctrl+H in the Home Folder)
Code:
cd .aria2
gedit aria2.conf
5. Open the file and type split=100 on the first line. That does it . Now to download anything say for example a video from ..... : [URL] in the bottom right corner click the flashing icon ( Flashgot Media) or alternatively go to Tools->Flashgot->Flashgot Media
6. Your download will start after selecting a download folder. A window will open which will display progress. To Pause , press Ctrl+C.
7. To resume open History, navigate to the page and again click 'Flashgot Media'
The file will resume.
View 1 Replies
View Related
May 19, 2010
No matter what desktop I use, there are 5 nepomuk processes and one virtuoso-t process running, taking up quite a lot of CPU in total. These stupid things have been ruining my Ubuntu and KDE experience ever since I upgraded to 10.4. I want to have those things NEVER run again, no matter what they're for, preferably by editing a config file because using graphical settings in KDE hasn't actually disabled them.
EDIT: If I kill the process nepomukservices, it keeps coming back! Who does that??? I installed KDE 3.5 now (instead of the very bad KDE 4). I have no setting to disable desktop search, because the brilliant and good KDE 3.5 has no such useless, CPU hogging, feature. But somehow the evil KDE 4 still manages to hog down my system by keeping to spawn this nepomukservices process all the time even when I'm not logged into KDE4 at all!
View 7 Replies
View Related
Oct 10, 2010
After upgrading one of my computers to 10.10 I experience freeze on shutdown I understand that there are multiple things that can do that. Is there a way to Isolate the issue. It freezes during the ubuntu dots screen. The dots are still changing endlessly. So it is not complete freeze. The only way to intervene is by issuing a CTRL-ALT-DEL then the computer restarts.
View 9 Replies
View Related
Dec 5, 2010
I have no RAID experience on Linux, so I've found dozen of information on the net about software raids, hardware raids and fake raids. Now situation is not clear to me at all. I'm considering to buy one of these cards to run on my Ubuntu server (currently 9.04, but will be upgraded to 10.10):
1. Promise FastTrak TX2300. I believe this is fake raid as it has some RAID bios. It handles SATA II cards and has PCI interface (what is important to me because I don't have PCI-X or PCI-e).
2. Promise SATA 300 TX2 Plus. I believe this could be a software raid because it has no built in raid support at all.
So I don't need to install my system on future raid system I just want to add those disks as storage mirror to my existing system. So what card is better (I believe both are supported on current ubuntu)? Is card better with built in raid which has some settings in BIOS ? What will be setup of the card? I mean should I use any BIOS RAID options or I should disable BIOS raid and use linux dmraid? In that case maybe better choice is card without any RAID in bios ?
Sorry if question is too beginner, but I'm lost with all the information. The main thing I want to know if I should use BIOS raid featured to use fakeraid or I should disable it anyway.
View 8 Replies
View Related
Feb 27, 2011
I came to know about namebench tool while working on a setup of DNS server, test results showed some servers working pretty fast. After investigating different options and many tests i managed to keep a good rank of DNS slave server. The idea was to keep checking available fastest DNS servers in the region and modify named.conf accordingly.As many of us are not building a DNS server, I am not going to discuss it in details here, however in case you are using some flavour of GNU/Linux, UNIX you can use following method to have a faster internet experience.
To have it accomplished we are going to use namebench, cron and a small script. namebench looks for the fastest DNS (Domain Name System) servers accessible to your computer.
View 3 Replies
View Related
Jan 1, 2010
This post is not to ask for help, but rather to document my recent effort to downgrade my ext4 file systems to ext3 file systems. I don't know if it'll help anyone, but here it is anyway, fwiw.I am running ubuntu 9.10 on an older Dell GX-270, and had formatted my partitions with ext4 file systems. I began to notice partimage wasn't backing up my ext4 file systems and I decided to downgrade to ext3 file systems.My system has one 160GB drive and one 500GB drive. I also have an external usb2 500GB drive./home is on the internal 500GB drive. To convert it, I mounted an ntfs file system on the external drive, created a container file, put a file system on it, and mounted the container as a linux file system.
The backup was done done via rsync. rsync makes things really easy. It understands uids, gids, file permissions, and all kinds of links. That's one reason I created the container file on my external drive. NTFS doesn't understand uids gids, linux file permissions, or linux style links.
View 1 Replies
View Related
May 2, 2011
I have assembled an "old" PC I want to attach to my 32" Sony TV. Mainly for browsing, watching videos, playing casual games. Is there a special Desktop theme suited for big screen ? In other words: Big icons, big text? Not sure if Unity helps out here. I would be willing to install another desktop manager (e.g. XFCE, KDE) than Gnome if it provides such features. Firefox for examples supports increased font size for browsing. For shell I've played around with guake and font sizes around 20 pix. It just would be nice to have "enlarged" menu entries.
View 3 Replies
View Related
Jan 18, 2010
Well; soon my site will be down and my internet too.I am still unemployed and can't pay my bills.I wish I could get a job in Linux somewhere, but it doesn't seem possible.Does anyone get paid in Linux? So, was wonderin how can I continue my Linux experience with no internet connection?And, Does anyone know of a hosting site that would hold or distribute my creations URL...they will be deleted from servers in about a week.I only pay $7 a month for my site; but its $40 a month for internet connection.
View 14 Replies
View Related
Sep 26, 2010
has anyone experiences with the bluetooth headset DR-BT101 from Sony under Ubuntu?
View 2 Replies
View Related
Oct 11, 2010
I've been looking around for the past week, but I have yet to find anything yet that provides a media center solution using Ubuntu + Xbox 360, comparable to Windows 7 + Xbox 360.
I want to drop Windows 7 completely on my media PC, and just use Ubuntu (or Linux Mint). I've tried ushare, XBMC, Moovida, and a few other apps. Either they don't support sharing, or it's difficult to configure, or it is a cheap looking solution.
Is there no way to use my Xbox 360 for a smooth media center experience, similar to how it functions as a Media Center Extender for Win7, while replacing Win7 w/ Ubuntu?
I'm even open to commercial Linux solutions, I'm just hoping to be able to drop Win7 if possible..
View 4 Replies
View Related
Jun 9, 2011
When I play Bejewelled Blitz on Mozilla firefox or Google Chrome,, it is so painfully slow that it is frustrating, I have all the latest updates from Ubuntu installed including the Adobe flashplayer. Is there some way I can increase the graphics memory allocation?
View 5 Replies
View Related
Jul 12, 2011
i 've been using fedora 14,15 for like few months and i still have a 4GB NTFS partition win XP pro.i have installed fedora in about like 20gb for root and home ext4.i rarely use win xp nowadays (once in a week) considering i was using windows for like years.i have a commondata partition of about 130GB NTFS.i now dont want to use the windows and i want to convert the 130GB NTFS to ext4, but i am worried that if somehow at some point i crash my partition tables and i was using ext4 i wouldn't be able to recover the data as easily as i would in a windows.i want to know whether there is a reliable ext4 data recovery tool for fedora?igoogled and i found this link .. if any of you guys have used these tools can you share the experiences ?Mondo RescueTestDisk safecopy PhotoRecddrescue
View 4 Replies
View Related
Jan 24, 2010
I always experience "authentication error" when connecting to server.
View 1 Replies
View Related
Apr 19, 2010
That program is recommend by author of foxyproxy extension for firefox,so i installed and connection to socks5 works fine,but i want to set username and password as well,and that for some reason doesn't work.Does antinat support that at all or is that just for local users?Also i tried ss5 socks server which works fine with username and pass but for some reason foxyproxy extension not working with it(on logs i see ERROR IS CONNECT).So basically i need socks 5 server program with username and pass support and it need to work with foxyproxy extension as client.
View 1 Replies
View Related
Oct 4, 2010
I've made a C++ program and compiled it and I can run it in the terminal but I would like it to run like a normal application in the application menu or on the desktop but I don't know how. How do I make it run like a program in the application menu?
View 3 Replies
View Related
Nov 9, 2010
I'm trying to make one that has some sorts in it for now. I know you have to make a header file and a .cpp file. I'm using VC++(yes, I'm in school so windows in needed. I use Ubuntu at home I swear D if it makes a difference. What goes in the header file, how is the cpp file set up, and then where do I put the files once I'm done?
View 5 Replies
View Related
Jun 30, 2010
I want to know how can I make a GUI program from a shell program I coded in C a long time ago. Can anybody point me to good tutorials?
View 4 Replies
View Related
Mar 15, 2010
I am compiling some c++ code trying to connect it with libi2cbrdg.a library where I have a lot of functions. So when I am doing this gcc -g rand.c -lasound -li2cbrdg -o rand.I don't have missed functions instead I have some other C/C++ connected errors, when I am using g++ compiler like this g++ -g rand.c -lasound -li2cbrdg -o rand.it does not see functions inside that library but everything fine with c++ code.How can I make g++ behave like gcc in this case?
View 2 Replies
View Related
Apr 21, 2010
(i) I usually make multiple dir using -p optionex: mkdir -p dicttest/audrep/tdriver/testNow after creating this dir's i stay in current dir instead i want to go directly to test dir how can i acheive this.(ii) When i execute which command as followswhich testerm i will get the location of testterm now i want to open this filewhen i did in this wayhich testterm | vi The file dosent get opened how can i acheive this ?ex:
linuxx86:110$ which testterm
/view/rdl110_linuxx86/vobs_usrrdl/sc/testterm
linuxx86:110$ which testterm| vi
[code]....
View 3 Replies
View Related
Feb 12, 2010
I was thinking about how to make a dynamic array in C, and I thought that it would be much better if it could accept any data type. Is this possible? Of course I thought about void pointers, but how do I store the actual data?
View 7 Replies
View Related
Nov 27, 2010
I use an application called redbutton-browser to access some of the things available on the redbutton digital tv channels. It compiles fine if I use a simple make but fails if I try to run parallel jobs with make -j4. I'd like some help altering the Makefile so that it does a few commands sequentially before it does the rest of the Makefile in parallel.
The relevant bit of the Makefile looks like this:
Code:
ISO13522-MHEG-5.c:xsd2c.c ISO13522-MHEG-5.xsd add_instance_vars.conf add_rtti.conf
make xsd2c
./xsd2c ISO13522-MHEG-5.xsd
./add_instance_vars ISO13522-MHEG-5.c ISO13522-MHEG-5.h
./add_rtti ISO13522-MHEG-5.c > rtti.h
[Code]....
View 7 Replies
View Related