Major Major 6 Light Poster

Apparently he had recently been persuaded to keep the router configuration in flash. he then set the routers to disable password recovery as a security measure because now there was a permanent record of everything.

I don't know but I think that the punishment for the 'crime' is completely out of proportion to the act. what is he guilty of? Not giving up a password to a superior who, this is the murky bit, may or may NOT have had the clearance for it.

Is that a fireable offence? Sure. Is it a crime? not really (imo ianal).

Of course before you fire the guy make sure someone else knows the passwords. In IT these 'bottleneck' people are all over the place, the guy that really knows what the 40 000 line perl app does and where to change it. or the guy that really knows how the network is put together ans where all the sentinels and firewalls are.

Terry probably feared the opposite. Too many people knowing the password. This situation is worse than no-one knowing the admin passwords because changes are made and you don't know who did them because everyone logs in as admin (*twitches*). We had that situation where I work, there were two development teams sharing the same server and each kept changing the environment, new active perl install was the latest debacle. which completely broke the other website. That was fun. and no one wants to point to the …

Major Major 6 Light Poster

you've got your causality reversed in the first if statement.

if ($env eq "GET")
{
  validate();
}
else
{
  displayform();
}
Major Major 6 Light Poster

I have an Nvidia 8600 and it's fantastic! I must be lucky :)

desktop or laptop? either way keep it cool

Major Major 6 Light Poster

print $query->header();

Major Major 6 Light Poster

you'll have to put all the logic including the input portion inside the while loop and don't forget to reset the integers (unless you want to keep running totals of course).

Major Major 6 Light Poster

wrap your logic in a while loop and add a flag.

int doagainFlag = 1;
char doagain;

while (doagainFlag)
{
  printf ("do you wish to try again?");
  doagain = getchar(); 
  if ((doagain == 'n') || (doagain == 'N'))
  {
    doagainFlag = 0;
  }
}

this should do the trick, it's off the cuff so there's probably typos and it won't compile by itself or even have the correct functions :) but it should give you an idea of how to tackle it.

Major Major 6 Light Poster

Thanks... I have a set of system specs (it's written down somewhere's....) but when I find it, could someone help me with the compatibility? I've done some homework, but I want to be absolutely sure before I lay down the big bucks for anything.
I'm looking at a gaming rig; I already did some research on several websites (Falcon North-West - around $3000 for what I want, AeonCraft - around $1000 for what I want, WindowPC - around $1300 for what I want)
With this in mind, is it worth just going and getting a pre-built machine? (the prices quoted are on their laptops, btw... if I was going with pre-built I'd go with a laptop)

Sure I'll have a look.

To answer your question, pre-built machines are great for desktop/workstation use, a game rig is usually spec'd and built by the person buying it or if there's a good pre-built computer that almost matches your spec a couple of judicious additions (generally RAM and Video Card sometimes a harddrive) will get you on your way. Gaming laptops are a bit different. Laptops don't usually have a lot of swappable components in them so you're pretty much stuck with what you buy, and the parts (if you do have a laptop that has expandability/upgradability you're looking at big bucks).

Stay away from laptops that have a Nvidia 8400/8600 video cards, apparently they are dying in droves.

Major Major 6 Light Poster

I stand corrected fgets() is the smarter way to go.

Major Major 6 Light Poster

just add up the ints I suppose printf(" %d Total character%s\r\n", (vowels + consonants + spaces + other), (vowels + consonants + spaces + other) == 1 ? "" : "s"); the brackets are in there for clarity only, the compiler should use operator order precedence to figure out what is meant but sometimes the wetware can be fooled :)

Major Major 6 Light Poster

use int main() because void main() is bad

just remember to return 0; at the end of your code.

Major Major 6 Light Poster

shape = GetLine(); don't use GetLine(), use something like scanf()

you don't have a default: statement for your switch statement and it looks for all the world like you're trying to call variables as functions in your case statement.

string box;
case 2:box();break;

after that it looks like you're trying to compare an integer value with a string... don't use StringEqual() either.. use something like strcmp()...

int s, r, h, w, l, t, shape;
if (StringEqual(shape, "cube"));
Major Major 6 Light Poster

looks like you're on the right track but I'd follow Kevin and chaos' advice and keep it as one script instead of calling multiple pages you'll need to encapsulate the three different modes of the page in subs and call the appropriate one given the situation. Something like the following will work using a hidden input in your forms with the name action. Depending on what you set action to be you can determine the flow of the cgi.

if ($ENV{'REQUEST_METHOD'} eq "POST")
{
  if (param('action') eq "validate")
  {
    &ShowValidate();
  }
  elsif (param('action') eq "accept")
  {
    &Accept();
  }
  elsif (param('action') eq "reject")
  {
    &ShowEnterData();
  }
  else
  {
    &ShowEnterData();
  }
}
else
{
  &ShowEnterData();
}

the code basically looks to see if this has been POSTed and if it has, depending on what the action was the cgi will call different subs to deal with the info posted. If the page hasn't been POSTed it will perform the ShowEnterData() sub and by default if it doesn't understand the action sent (if it's being spoofed say) it will perform ShowEnterData().

Major Major 6 Light Poster

congrats!

Major Major 6 Light Poster

Hey Major Major,

Thanks for the info, but I think I got lost with your jargon...:$ ...please excuse me for my ignorance...but would you care to explain in layman's terms...:)

Thank you kindly...
May

Sure no problem.

Start with an idea of what you want to build. Building a games computer with massive video card(s) is completely different to building a stable workstation to do photoshopping on.

There are two major vendors of PC processors: Intel and AMD. They both provide processors that are reasonably priced and there is really little to choose between the two, except for serious high end computing (read games computer or the like). I've got more experience with AMD chips lately than with Intel although Intel holds the speed crown at the moment.

Processors have 2 things that you really have to look out for: Front side bus (FSB) speed and socket type. Make sure that the socket type and FSB speeds are supported by the motherboard you choose.

The motherboard, like I was saying determines pretty much everything in the computer, It will dictate the type and speed of RAM you buy, DDR2 and DDR3 are the most popular types of RAM out now. RAM also comes with speeds. Make sure that the RAM and motherboard have the same clockspeed (this is often dependent on the FSB of the processor but not in all cases).

The motherboard also determines the type of video card you will buy, some …

maydhyam commented: Great explanation :) Thank You.. +1
Major Major 6 Light Poster

...well, okay. If we're actually going to try to critique. Um... nothing whatsoever in the script actually attempts to send an email.

That's kinda the root of my earlier comment. The whole thing isn't even a framework of what's described as the objective; it's a non-functional beginning of some of it. So it seems like the OP isn't asking for debugging assistance or critique so much as to have the rest of his script (his homework?) written for him.

Yeah but notice that in the <form> action, different pages are being called as the action, likely the email is being dealt with there. Although I think that the actions are reversed. It makes more sense that Yes should go to the subscriptionSent.cgi and No should go back to the HTML page where the info was entered to begin with.

<form method="post" action="http://www.sgnscoops.com/Magazines/magazineMain.html">
<input type="submit" value="Yes, it's correct.">
</form><form method="link" action="http://www.sgnscoops.com/cgi-bin/subscriptionSent.cgi">
<input type="button" value="No, I made a mistake.">
</form>
Major Major 6 Light Poster

Y'know, that sorta looks less like a 'challenge' and more like an actual forum abuse script.

You're right. especially when "spamming complete" shows up at least twice in the code.

Major Major 6 Light Poster

Hey, he doesn't need to use regular expressions. A hash will do fine.

Didn't think about that

Major Major 6 Light Poster
sub send
print header;
print <<endHtml;

no curly braces after sub send.

sub send()
{
#code
}

send() is never called in the main body of the cgi.

Major Major 6 Light Poster

I remember the days when I pored over specs and megaHertz and compatibility specs.

Those heady days of trying to squeeze every drop out of not only the system but the wallet too :).

Now my advice is if you want a generic computer for run-of-the-mill tasks, go for a name brand. Honestly you cannot put together a system for as few $ as these guys will sell you a full computer with LCD and OS. I know I've tried many times. All I end up doing is ensuring that they give me an OS (not a recovery disc) and wipe the OS and reinstall to get rid of all the crapware that the OEMs think you need, I will protect my LAN with a linux firewall/router thank you, goodbye 90 day trial of really annoying internet security suite <insert major name here> 200X.

Sorry for the rant, for building systems I'd suggest sticking with well known brands for components as they generally have a good track record. But be warned, even major vendors have lemons for example check out; asus A2N MX-SE (USB support), Nvidia 8400 / 8600 (Overheating), creative labs soundblaster (vista support or lack thereof).

Put everything down on a piece of paper (or spreadsheet for the digital only crowd) and make sure that everything is compatible. IE AMD chip with motherboard that is AMD compatible.

Your choice of MB will influence EVERYTHING from processor to memory to video card(s). Make sure …

Major Major 6 Light Poster

only problem I've encountered with logitech wireless KB/ mice is with the bluetooth mx5000 set, it tends to freeze every 4-5 hours for about 10 seconds and then everything is good for another few hours based on this happening about 2 times every workday to me.

To be fair there are about 10 - 12 other KB sets in the area that could be interfering and apparently if you install the software it works seamlessly. Seeing as how this KB is on a Linux box I have no access to the windows only driver, and no I don't want to install wine :)

The battery life is good, 3-4 months on 4AA batteries for the KB and recharge stands for the mouse which goes about two weeks on a charge.

Major Major 6 Light Poster

Remedy (at least as implemented where I am employed) is HORRIBLE, the helpdesk staff here do nothing but complain about it all day long. I thank my stars that I really only have to use it to close the odd ticket.

As an internal bug tracker we have implemented zenTrack. The price (opensource freeware) is right, support is OK from forums but there's no tech to call at 3am if things break. I don't know about it's scalability though.

Major Major 6 Light Poster

Unfortunately all of this boils down, all too often, to budget. TPHTA is correct in that no business can afford to lose all of it's data. The question is how much data loss is acceptable. This will determine much of the cost of your backup solution.

a monthly off-site backup solution will cost much much less than a weekly, or daily solution.

Without any additional information there is a limit to what recommendations can be made. The only way to tackle this is to ask questions which you have here at any rate. Come up with some cost estimates and threat and risk assessments how much will it cost to do X and what are the risks we take do the risks outweigh the benefits? Present them to someone with budget discretion. Pray that they don't just say whatever.

Most people see IT as a hole in the corporation that money disappears into never to be seen again. Show them what that money is doing and you'll have more success.

Major Major 6 Light Poster
Major Major 6 Light Poster

does your distro use SELinux?

if so try disabling it temporarily with

setenforce 0

if everything starts working re-enable SELinux and use the audit2allow and attendant commands to search your audit logs and make a local rules file and import it into your SELinux settings.

Major Major 6 Light Poster

The answer is 49.

42. When you know the question you will understand the answer :)

OK I'm gonna get sued by Douglas Adams' estate now.

I'll even help out,

first you open the file... then you read it... then you use regular expressions to find and remove duplicates, then close the file and open it for writing and write the new text back, then close the file again.


this has been done many many times over... use <insert favourite search engine here> to find a script and modify it.

Major Major 6 Light Poster

Another general rule of thumb:

If you think one of the standard libraries has problems, look at your code again. These libraries are subject to a lot of scrutiny. I'm not saying that there is no possibility of errors in them - it's just much MUCH more likely that

a) you're not using it correctly IE putting an integer value into a function instead of a pointer.

b) it doesn't do what you think it does IE you think its returning something that it isn't.

c) you've got some other coding issue.

Major Major 6 Light Poster

> char c[10]; /* declare a char array */
...
> while(fgets(c, 25, file)!= NULL)
Do you know why you said 25 here?
Do you know why you should have said 10?

heh nice, here I was ready to give you both barrels about the behaviour of fgets() and then I re-read the code, classic.

Major Major 6 Light Poster
printf("The GCD of %d and %d is %d",n1,n2,GCD(g));

Try this instead

printf("The GCD of %d and %d is %d",n1,n2,GCD(n1,n2));
Major Major 6 Light Poster

Hi,

I'd grab the source code for a small but viable app (from sourceforge or the like) then see how the code is structured and try to understand why programming decisions were made then. I'd grab a second and compare the programming styles.

If the two seem similar in style, they are probably coded close to best practices.

Additionally there are many good programming style books and tutorials on the internet.

Major Major 6 Light Poster

you're not getting the rest of the values in the fourth line because you're only using the first two tokens from the split:

powerup_time_u_switch_ring/u2_hs65_ls_sw3l60 = 6.3951e-09 targ = 6.9051e-09 trig = 5.1000e-10

the following line only puts the first two values of the split into variables.

($FieldName, $FieldValue) = split(/= /,$pattern);

instead try something like this:

@Fields = [split(/= /,$pattern);

and then parse through @Fields until you get to the end of the array. you'll also want to hack the meaningless garbage of the ends of your values by doing something like $CleanField = split/ /,$Fields[$j])

Major Major 6 Light Poster

@FieldValue1_array[$i] = $FieldValue;

change this to $FieldValue1_array[$i] = $FieldValue; That will fix your warning

Major Major 6 Light Poster

Problem is if you're using two linux or *NIX boxes Samba is nasty because it's basically translating from *nix fs -> samba's kludge of MS SMB protocol ->*nix fs. a lot can get lost in that translation.

It's a moving target trying to hit another moving target (microsoft's SMB protocol) which changes with every release of MS operating systems and the service packs. "DOS ain't done 'til Lotus won't run." I don't know if you've come across that quote but it applies to Samba and SMB and Microsoft's stance on the two. If you don't need to use Samba to interface with Windows computers, don't use it, is probably the best advice I can give.

SMB is a really chatty protocol too. the latest version requires something on the order of 1500 (I think the number that tridge gave was 1506) packets to delete a file!


getting back to the subject at hand try this

tar -M -L 2000000 -cv -f archive1 -f archive2[...] -farchiveN /dir/to/backup

this will make tar swicth archives after 2000000*1024 bytes, just make sure you have enough
'-f archiveN' defined to cover the size of the backup or it will prompt you in a very cryptic way to mount a new tape (and will overwrite the one it just finished if it doesn't like your answer :) )

a drawback is that you can't use compression when spanning archives.

if you're good at writing shell or …

Major Major 6 Light Poster

exactly. For programming IMHO the most respected is narue, sos and salem
for spyware, maybe crunchie or gerbil

jasimp, zandingo/zandiago or whatever hes called, and serunson, are also really good at welcoming newbies in the welcome board

If I might, I'll weigh in on this, I know I'm new here but let me tell you how I came to apply for daniweb membership. I think that it is important because it is pretty directly linked to Narue and to Narue's comments.

I was looking for a quick solution (more of a confirmation actually) to a problem so I threw it into google and one of Narue's posts came up as the #2 or 3 hit. It gave me the confirmation that I was looking for and the code was nice and tight and well formatted (better than I am wont to do most times). It impressed me so I started lurking around the site and poking my nose into different forums and quickly found that there were certain people here who were giving good answers consistently. I could immediately tell in a broad sense who was a meaningful contributor (whether their answer was correct or in-correct) and who was just answering for the sake of answering.

my point is this: people who understand a subject know find quickly who else knows about that same subject and can formulate a meaningful opinion of that person's contributions. The opinions of peers is more important than statistics.

The only …

majestic0110 commented: nicely put! +3
Major Major 6 Light Poster

I Think

char buffer[40];

I See

p=32;
sprintf(buffer[0],"%d",p);

q=4
sprintf(buffer[1],"%d",g);

TA=100;
sprintf(buffer[2],"%d",TA);

Your Problem

You've set buffer as an array of characters with length 40 and then you're trying to sprint multiple long integers to different parts of that buffer which probably won't work too well.

try with one variable to begin with sprintf(buffer,"%d",p); if that works then try something like this sprintf(buffer,"%d,%d,%d",p,q,TA); you're only sending 14 bytes in your send call. better would be this: result1 = send(acceptfd, buffer,strlen(buffer), 0); you'll have to modify your recv as well, you'll want to grab x bytes at a time until there is no more data left on the socket.

Also; format your code. it's much easier to read and follow program flow if it's formatted properly.

Major Major 6 Light Poster

Your problem might have something to do with samba itself. try mounting the samba share with ,lfs at the end of your -o string

that being said it sounds like both your servers are *NIX based, why use samba at all?

read up on rsync.

Major Major 6 Light Poster

^ yeap... i agree pretty much with everything you said there. (except i think perl is pretty easy for beginners to get started, at least for the basics...)

and FORTRAN is dead. but it also still runs the majority of our nation's nuclear power plants. not bad for a dead language.

i still love Perl, it's amazingly powerful and adaptable.

i think im just annoyed that 5.x has been around for 14 years, and they've been promising 6.0 "any day now" for the past 7 or 8.

Perl 6 will come out with Duke Nukem Forever and Spore...

Major Major 6 Light Poster

mmm Perl.

Perl is not dead, it's just not a fashionable language and it's intimidating as hell for novices. ( I know avoided it like the plague for years :) )

FORTRAN likewise is not dead, in certain scientific circles at least. As a general programming language it's deader than a doornail but in the science community it's still got a good deal of steam. I was helping some scientists with FORTRAN a couple of months ago and made a disparaging remark about certain aged programming languages, I might have mentioned COBOL as well. I got an earful in response.

Bacl to Perl, it is primarily a sys admin's tool. it's great for chugging through log files and extracting data.

I now use Perl whenever I think, "I could do that in C but...".

jephthah commented: good comments. +2
Major Major 6 Light Poster

i'll bet that, as part of the homework requirements, he's not allowed to use the <math.h> library

you're probably right.

it'll be fun to deal with 3^-1 :)

hopefully the scope of the assignment is for integer values of >= 0

Major Major 6 Light Poster

I'll have to watch it and give feedback then.

Major Major 6 Light Poster

I read somewhere that regular expressions don't work on people, vegaseat...

yeah but I was talking about politicians not people ;)

Major Major 6 Light Poster

1) Cowboy Bebop (seems popular with the CS / IT crowd)

2) Full Metal Panic (not because it stands out as a great anime but every time I watch it it makes me laugh so hard my sides hurt)

3) Ghost in the Shell SAC1 (haven't seen 2 yet but it's on my list)

Major Major 6 Light Poster

I think he used to believe in evolution, but now believes in creationism. Changing your mind is the prerogative of old folks.

s/old folks/vote grubbing politicians/g

Fixed.

Major Major 6 Light Poster

hi,
I am trying to take unix administration and shell scripting courses this summer. I have done 2 courses of C++ and a course of java. However i have never learned C. Anyone please give me some opinion if learning C is necessary for Unix. Since C++ is inherited from C, are they pretty much similar? Is unix scripting harder or easier comparing C++?

C is a definite MUST for serious UNIX/Linux development (kernel modules or small-footprint daemons), I concur that it should be easier to pick up C from C++ than the other way around.

As to your question of scripting being easier or harder, that's a tough one. In your class experience it might well be easier because most of the exercises are simple cases. Once you go from several dozen to several hundred lines of shell script or PERL (the two likely suspects for any course in admin/scripting) things can get pretty hairy, especially if you didn't write it in the first place.

Major Major 6 Light Poster

Windows XP64 has the same build version as windows server 2003 64 bit. Try the 64 bit 2003 drivers some should work. I've got a DLink NIC at home it works well, they had 64-bit drivers. The Marvell Yukon GigE on board Port didn't have 64bit drivers when I built the system and I haven't gone looking for them since.

Major Major 6 Light Poster

the program asks to calculate the power of a number, for eg. if 2 is entered as the base and 3 is th power it should display 8.

I assume your question has to do more with the power than

#include <math.h>
#include <stdio.h>

int main ()
{
double base = 2, power = 3;
printf ("answer = %f\n", pow(base,power);
return 0;
}

for the input try using scanf to get the values from the command line. (google it)

Major Major 6 Light Poster

related on data encryption & cryptographic systems

try the free sample chapters of the handbook of applied cryptography:

http://www.cacr.math.uwaterloo.ca/hac/