Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
sloshmonger
Mar 21, 2013

EAT THE EGGS RICOLA posted:

I am using PDQ Deploy to do this, but the user needs to be logged in (the packages make a ton of changes to HKCU). Everyone I work with is a Pretty VIP Princess and this has to be done after hours since the package requires a few reboots and it needs to be logged back in again after each reboot.

Maybe try loading the user's HKCU in an administrative account's environment?

I'm not familiar with PDQ Deploy, so that may be the limitation, but you could script loading the user's hive and then applying changes that way.

Adbot
ADBOT LOVES YOU

GoatShaver
Nov 12, 2010
So the exchange server died, that was neat. Now its being rebuilt.

Boss has been here since 12:45 AM working on it, I never got a single alert, I feel bad for the guy, and I can do gently caress all about it at the moment.

I guess... back to reimaging some machines.

Dick Trauma
Nov 30, 2007

God damn it, you've got to be kind.

mewse posted:

At least you have your stapler?

I don't actually have one!

I'm on the verge of being obliged to drive across town to turn on the monitors for someone's small video art installation.

They told me yesterday that after a power issue the installation was off. I told them to verify that the monitors are on.

Now there's an executive visit there tomorrow morning and it's an emergency and they're refusing to turn the goddamn monitors on because they insist it's my responsibility.

I hate this place so much now.

bobmarleysghost
Mar 7, 2006



Correct me if I'm wrong, but I remember back in the day you had escaped a hell hole (the one with Tony) and found yourself in an amazing company. Is this the company you're with now?

Lysandus
Jun 21, 2010
None of you can hold a candle to Fizz Buzz Enterprise Edition

Dick Trauma
Nov 30, 2007

God damn it, you've got to be kind.

Santa is strapped posted:

Correct me if I'm wrong, but I remember back in the day you had escaped a hell hole (the one with Tony) and found yourself in an amazing company. Is this the company you're with now?

Yup. It's a long story but boils down once again to terrible management.

The user just emailed me that the video installation is working fine but that no one there touched anything. :iiam:

HFX
Nov 29, 2004

evol262 posted:

Programs and timings.

To be fair, with python you are loading the interpreter. I don't know if you have this is compiled or not, but there is a bit more overhead. The C version is just the raw machine code (plus several c runtimes).

Vintimus Prime
Apr 24, 2008

DERRRRRPPP what are picture threads for????

Dick Trauma posted:

I don't actually have one!

I'm on the verge of being obliged to drive across town to turn on the monitors for someone's small video art installation.

They told me yesterday that after a power issue the installation was off. I told them to verify that the monitors are on.

Now there's an executive visit there tomorrow morning and it's an emergency and they're refusing to turn the goddamn monitors on because they insist it's my responsibility.

I hate this place so much now.

Wow. Sounds like some of the users where I work.

stubblyhead
Sep 13, 2007

That is treason, Johnny!

Fun Shoe

GanjamonII posted:

Yeah, upon further conversation it looks like it was a misunderstanding of scope in the first place rather than scope creep. I'll do what I can to deliver, but there is no way the whole thing is going to be ready.

If it's a matter of an extra hour or two during the week to get it done that's one thing. If the difference in scope is as great as you say then you should by no means work weekends or holidays to finish this, because it's still not going to get done in the next week and a half. A failure to plan on your PM's part does not constitute an emergency on yours. Also you have learned a very important lesson, namely to get a spec and an approval in writing. If they try to dick you around then show them what they approved when you deny their request for enhancements.

evol262
Nov 30, 2010
#!/usr/bin/perl

HFX posted:

To be fair, with python you are loading the interpreter. I don't know if you have this is compiled or not, but there is a bit more overhead. The C version is just the raw machine code (plus several c runtimes).

Oh, I'm not saying Python's slow. I mean, it's slow in comparison, but my point was that 100ms is an order of magnitude faster than 4 seconds, even if that 100ms is two orders of magnitude slower than C. But it's really an unfair comparison unless we were trying to deal with a much larger dataset, since the principal limitation of the C version's execution may well be process invocation, ld.so, and other things mostly out of the binary's control.

I just wanted to show that the Python version could also be fast, not that C's faster.

Go highlights the difference: it's 1-2ms compiled. 110ms interpreted.

Things that piss me off:

Recruiters. Stop calling me. No, you did not see an updated resume from me with an address 2000 miles away.

sfwarlock
Aug 11, 2007

evol262 posted:

The same in C:
C code:
#include <stdio.h>
#include <stdlib.h>

void main() {
        int a, b, c;
        for(a=1; a < 1000; a++) {
                for(b=a+1; b < 999-a; b++) {
                        c = 1000 - (b + a);
                        if ((a*a + b*b) == c*c) {
                                printf("Found a = %d, b = %d, c = %d\n", a, b, c);
                                exit(0);
                        }
                }
        }
}
Runs in 1ms. 1.

I wonder how much faster it would be to calculate a*a (and for the hell of it, b*b) once per for loop instead of once per c value:

C code:
int a, b, c, a2, b2;
        for(a=1; a < 1000; a++) {
                a2 = a*a;
                 for(b=a+1; b < 999-a; b++) {
                        b2 = b*b;
                        c = 1000 - (b + a);
                        if ((a2 + b2) == c*c) {

Dr. Arbitrary
Mar 15, 2006

Bleak Gremlin
Since we're all talking about python and a few other programming languages:
I'm currently in desktop support, I'd like to move up to system administrator.

What'd be useful?

Cenodoxus
Mar 29, 2012

while [[ true ]] ; do
    pour()
done


Dr. Arbitrary posted:

I'm currently in desktop support, I'd like to move up to system administrator.

What'd be useful?

I would recommend PowerShell, bash, ksh, Python, and maybe Perl. It all depends on what kind of environments you'll be touching, but knowing any of those will make your job easier through automation.

Darth Various
Oct 23, 2010

Inspector_666 posted:

I've never worked at a place that had an org chart.

I just realized how funny it is that we're supposed to draw local org charts and put them up on a board where I work. There's a template, it's basically this:



Boss at the top, other three or four personnel on the lower row. In case we forget, I guess. :v:

M31
Jun 12, 2012
3 pages and all solutions are still wrong (hint: a=-61500, b=992, c=61508)

Dr. Arbitrary
Mar 15, 2006

Bleak Gremlin

M31 posted:

3 pages and all solutions are still wrong (hint: a=-61500, b=992, c=61508)

Wait, they're supposed to be integers?

Alien Arcana
Feb 14, 2012

You're related to soup, Admiral.
You guys realize you can do that with just one loop, right? You've got three variables and two equations.

Let c = 1000 - (a + b), then substitute that into the squares equation and solve for b. You get b = 500 * (1000-2*a)/(1000-a). Then you just have to compute this for each a, and if you get an integer result you've found a solution.

code:
for (a = 1; a <= 1000; ++a)
{
    if ((1000 - 2*a) % (1000 - a) == 0)
    {
        b = 500 * (1000 - 2*a) / (1000 - a);
        c = 1000 - (a + b);
        // return values somehow
    }
}

EAT THE EGGS RICOLA
May 29, 2008

I am finishing up all the projects I've been working on before I start my new job next week. Today I am finishing up a major project that will take me until relatively late tonight and that has to be done as fast as possible.

One of the lawyers just asked me to stop what I am doing to go take apart the computer at reception so that they could turn it into a bar.

:toot:

stubblyhead
Sep 13, 2007

That is treason, Johnny!

Fun Shoe

Dr. Arbitrary posted:

Since we're all talking about python and a few other programming languages:
I'm currently in desktop support, I'd like to move up to system administrator.

What'd be useful?

Totally depends on if you want to go Windows or *nix. If Windows definitely learn Powershell, and though it's not really scripting per se, I would familiarize myself with the AD command line tools as well (dsquery etc.). It could be argued that VBScript could be useful when dealing with legacy scripts, but I wouldn't spend a tremendous amount of time with it. Never ever ever write a new script in VBScript. VBScripts with create dates later than around 2007 make Baby Jesus cry.

mewse
May 2, 2006

EAT THE EGGS RICOLA posted:

One of the lawyers just asked me to stop what I am doing to go take apart the computer at reception so that they could turn it into a bar.

That sounds mission critical, you should definitely make that your primary action item

evol262
Nov 30, 2010
#!/usr/bin/perl

Alien Arcana posted:

You guys realize you can do that with just one loop, right? You've got three variables and two equations.

Let c = 1000 - (a + b), then substitute that into the squares equation and solve for b. You get b = 500 * (1000-2*a)/(1000-a). Then you just have to compute this for each a, and if you get an integer result you've found a solution.

code:
for (a = 1; a <= 1000; ++a)
{
    if ((1000 - 2*a) % (1000 - a) == 0)
    {
        b = 500 * (1000 - 2*a) / (1000 - a);
        c = 1000 - (a + b);
        // return values somehow
    }
}

The real problem with this is that while it might work algebraically, the legibility is awful, and it's virtually impossible to tell what it's doing if you scroll past this in the codebase.

It also doesn't work, but y'know.

RFC2324
Jun 7, 2012

http 418

Dr. Arbitrary posted:

Since we're all talking about python and a few other programming languages:
I'm currently in desktop support, I'd like to move up to system administrator.

What'd be useful?

If you want to do SysAdmin in the *nix world, learn bash and vi, as well as the shell and editor you actually like(every *nix system has bash and vi, everything else is hit or miss). I would also suggest knowing ipmitool so you know how to query the server hardware directly(not all systems use it, but it is the closest to consistent).

Everything else is a thing you will have to learn new at every job, since every environment is different(for example, my company has AD layered on top of ldap, on top of NIS, and any given account modification might have to go through any and all of those layers)

theangryamoeba
Sep 26, 2008

evol262 posted:

Python code:
import timeit

def clever():
    for n in xrange(1, 500):
        for m in xrange(n + 1, 500):
            a = m*m - n*n
            b = 2 * m * n
            c = m*m + n*n
            if a + b + c == 1000 and (a*a + b*b == c*c):
                print "Clever: a = %d, b = %d, c = %d" % (a, b, c)
                break
    return True

def naive():
     for a in xrange(1,999):
        for b in xrange(a+1, 999-a):
            c = 1000 - (b + a)
            if a*a+b*b == c*c:
                print "Naive: a = %d, b = %d, c = %d" % (a, b, c)
                break
     return True

if __name__ == '__main__':
    print("Clever executed in %f seconds" %
           timeit.timeit(clever, number=1))
    print("Naive executed in %f seconds" %
           timeit.timeit(naive, number=1))
I ran your code and the Clever method does not meet a < b < c
code:
$ python 1000python.py 
Clever: a = 375, b = 200, c = 425
Clever executed in 0.045996 seconds
Naive: a = 200, b = 375, c = 425
Naive executed in 0.047367 seconds

evol262
Nov 30, 2010
#!/usr/bin/perl

theangryamoeba posted:

I ran your code and the Clever method does not meet a < b < c
code:
$ python 1000python.py 
Clever: a = 375, b = 200, c = 425
Clever executed in 0.045996 seconds
Naive: a = 200, b = 375, c = 425
Naive executed in 0.047367 seconds
It's not supposed to, since Euclid's Formula does not. You can trivially swap the variables if you care. Any met condition will necessarily have a larger than b or vice versa, so check.
Python code:
print "Clever: a =..." if a <b else \
 "Clever: a= %d, b = %d..." % (b, a, c)

RFC2324 posted:

If you want to do SysAdmin in the *nix world, learn bash and vi, as well as the shell and editor you actually like(every *nix system has bash and vi, everything else is hit or miss). I would also suggest knowing ipmitool so you know how to query the server hardware directly(not all systems use it, but it is the closest to consistent).

Everything else is a thing you will have to learn new at every job, since every environment is different(for example, my company has AD layered on top of ldap, on top of NIS, and any given account modification might have to go through any and all of those layers)

Bash is not required to be present on non-Linux systems (and even some Linux systems). Ksh is more common. Learn sh scripting. Better, learn python, perl, go, ruby, or any other language you can for scripting (large standard library is nice). Python is probably best these days because it's very common and "batteries included", but eh.

GoatShaver
Nov 12, 2010
Losing my poo poo just a bit this morning and could use some help if someone has seen this before.

Exchange server took a poo poo, just a day or two before migration to our new SAN. Good news, we rebuilt it on the new SAN, moved the datastores (after they were marked dirty and subsequently handled) and got everything rolling again this AM... at least mostly.

Desktop users are now getting mail once again, but for whatever reason, a bulk of mobile users get nothing; no messages, errors, anything. Just blank. Tested connectivity with testexchangeconnectivity.com which showed mostly everything being correct with the exception of a 401 error which seems to reference something about IIS virtual stores and authentication.

AlternateAccount
Apr 25, 2005
FYGM

GoatShaver posted:

IIS virtual stores and authentication.

Don't pretty much all mobile clients use EWS? Is your OWA working?

UFOTacoMan
Sep 22, 2005

Thanks easter bunny!
bok bok!

GoatShaver posted:

Losing my poo poo just a bit this morning and could use some help if someone has seen this before.

Exchange server took a poo poo, just a day or two before migration to our new SAN. Good news, we rebuilt it on the new SAN, moved the datastores (after they were marked dirty and subsequently handled) and got everything rolling again this AM... at least mostly.

Desktop users are now getting mail once again, but for whatever reason, a bulk of mobile users get nothing; no messages, errors, anything. Just blank. Tested connectivity with testexchangeconnectivity.com which showed mostly everything being correct with the exception of a 401 error which seems to reference something about IIS virtual stores and authentication.

Can you browse to https://mail.yourdomain.com ?
We went through something similar a while back with an Exchange migration.

For the phones I had to delete and recreate the account and then enable inheritable permissions: http://social.technet.microsoft.com...um=exchange2010

Sickening
Jul 16, 2007

Black summer was the best summer.

GoatShaver posted:

Losing my poo poo just a bit this morning and could use some help if someone has seen this before.

Exchange server took a poo poo, just a day or two before migration to our new SAN. Good news, we rebuilt it on the new SAN, moved the datastores (after they were marked dirty and subsequently handled) and got everything rolling again this AM... at least mostly.

Desktop users are now getting mail once again, but for whatever reason, a bulk of mobile users get nothing; no messages, errors, anything. Just blank. Tested connectivity with testexchangeconnectivity.com which showed mostly everything being correct with the exception of a 401 error which seems to reference something about IIS virtual stores and authentication.

Check all you exchange services. I would bet that something is off there. I ran into an issue where services that were set to automatic refused to turn on even after a reboot and had to be manually turned on. Exchange only has what... 25 separate services?

AlternateAccount
Apr 25, 2005
FYGM
Things NOT pissing me off: Today everyone seems to be starting their long weekend early. My new long commute sucks, but there wasn't even a hint of traffic this morning.

BaseballPCHiker
Jan 16, 2006

Pissing me off so much today is getting WSUS to play nice with SCCM. System Center just doesnt see the updates no matter what I seem to do. How has pushing out updates somehow gotten harder?

FlapYoJacks
Feb 12, 2009

evol262 posted:

It's not supposed to, since Euclid's Formula does not. You can trivially swap the variables if you care. Any met condition will necessarily have a larger than b or vice versa, so check.

My question is why is Python so much slower brute forcing the equation? It's 3 compounded for loops. I'm not an expert in algroithms, and I know it can be made to be more efficient as you have shown, but it's just three for loops. :psyduck:

RFC2324
Jun 7, 2012

http 418

evol262 posted:

Bash is not required to be present on non-Linux systems (and even some Linux systems). Ksh is more common. Learn sh scripting. Better, learn python, perl, go, ruby, or any other language you can for scripting (large standard library is nice). Python is probably best these days because it's very common and "batteries included", but eh.

Bash isn't required, but it typically is installed. Ksh is more common on older systems, but I have seen some more recent linux boxes without it and I haven't even seen an option to install sh in years on builds I have done. And if you have the luxury of installing some programing language across your farm, then you are certainly not a new sysadmin.

Python might be best of what you listed, but perl is by far more commonly installed on systems, but even it is not guaranteed unless that box is running something that requires it.

I guess, ultimately, a unix admin just needs to be better at learning a new environment than a windows admin, since there is such a huge amount a variance in what you might encounter on any given box(even within an org, if the org is big/old enough) so just learn to be able to figure it out as fast as possible.

Inspector_666
Oct 7, 2003

benny with the good hair
I just had somebody from an enterprise helpdesk tell me to "just Google" for their Citrix SSL cert, and then gave me lip when I said I wasn't going to do that.

evol262
Nov 30, 2010
#!/usr/bin/perl

ratbert90 posted:

My question is why is Python so much slower brute forcing the equation? It's 3 compounded for loops. I'm not an expert in algroithms, and I know it can be made to be more efficient as you have shown, but it's just three for loops. :psyduck:

range() instead of xrange() generates the entire list in memory as soon as it's invoked instead of using a generator.

Python doesn't unroll loops, which itself has an enormous influence on performance.

Python is dynamically typed, which makes bytecode optimization hard, and the interpreter itself would rather err on the side of correct behavior than performance.

This isn't to say that all interpreted languages are slow. But, as a rule, interpreted dynamic languages are slow. Perl is half the speed of Python on "just three for loops". That said, Go is also half the speed of a better algorithm.

The real answer to your question lies in understanding how complexity affects runtime. I'm not the biggest big O weenie in the world (I'd rather have legibility), but I don't do the kind of development where that really matters. Processors are fast, and compiler optimizations are good these days, but execution time is incredibly important.

For fun, pick another pythagorean triple. You can generally multiply all parts.

So 3^2+4^2=5^2. This is also true for 30. And 300. And 3000. 12000 (3000 + 4000 + 5000) will be the triple you're aiming for. Brute force it in C. I'll wait.
(Note that there are actually multiple combinations which fulfill a+b+c=12000, a^2+b^2=c^2, but the naive python algorithm finds them all in 6 seconds, for comparison)

RFC2324 posted:

Bash isn't required, but it typically is installed. Ksh is more common on older systems, but I have seen some more recent linux boxes without it and I haven't even seen an option to install sh in years on builds I have done. And if you have the luxury of installing some programing language across your farm, then you are certainly not a new sysadmin.

Python might be best of what you listed, but perl is by far more commonly installed on systems, but even it is not guaranteed unless that box is running something that requires it.

I guess, ultimately, a unix admin just needs to be better at learning a new environment than a windows admin, since there is such a huge amount a variance in what you might encounter on any given box(even within an org, if the org is big/old enough) so just learn to be able to figure it out as fast as possible.

I guess I tend towards bash on Linux, ksh on everything else. I've never seen bash on Solaris, AIX, or HP-UX. Likewise, I don't see ksh on Linux. Hence the recommendation to learn sh, and use a real language if you have to do anything more complex. ksh and bash will both parse sh syntax fine, without getting into weird bash-isms with regexes or differences between ksh and bash arrays.

If you're on an EL distro (~65% of the Linux market), Python is guaranteed to be there.

Perl will probably be there, too, but Perl's problematic for new admins for a variety of reasons (dependence on CPAN, reliance on regular expressions), even if the syntax is similar to shell. But if you don't know shell, Perl doesn't necessarily have a lot going for it (unless you're on proper UNIX or something that'll have Python 2.2, if it has it at all).

evol262 fucked around with this message at 17:05 on May 23, 2014

tomapot
Apr 7, 2005
Suppose you're thinkin' about a plate o' shrimp. Suddenly someone'll say, like, plate, or shrimp, or plate o' shrimp out of the blue, no explanation. No point in lookin' for one, either. It's all part of a cosmic unconciousness.
Oven Wrangler
Pissing me off: getting pressured into completing our company employee survey since our leadership wants 100% participation. Guess what forcing employees to complete the survey might not result in positive survey results.

Not pissing me off: One more meeting before I can cut loose for the holiday weekend.

GoatShaver
Nov 12, 2010

AlternateAccount posted:

Don't pretty much all mobile clients use EWS? Is your OWA working?
It is, but for some users when logging in, getting a strange account disabled error even though it isn't.

UFOTofuTacoCat posted:

Can you browse to https://mail.yourdomain.com ?
We went through something similar a while back with an Exchange migration.

For the phones I had to delete and recreate the account and then enable inheritable permissions: http://social.technet.microsoft.com...um=exchange2010
Yes I can, and in some cases, can seemingly log in but with nothing there, or a "mailbox not found" (which was easy to pinpoint, user was supposed to be migrated but never got put on a new DB somehow), or an "account disabled" error.

Sickening posted:

Check all you exchange services. I would bet that something is off there. I ran into an issue where services that were set to automatic refused to turn on even after a reboot and had to be manually turned on. Exchange only has what... 25 separate services?
I'll try this next, boss has been on that box for most of the morning along with MS/MSP help, can't force either off just yet.

Thanks for getting the gears turning in my head, its much appreciated.

Sickening
Jul 16, 2007

Black summer was the best summer.

GoatShaver posted:

It is, but for some users when logging in, getting a strange account disabled error even though it isn't.

Yes I can, and in some cases, can seemingly log in but with nothing there, or a "mailbox not found" (which was easy to pinpoint, user was supposed to be migrated but never got put on a new DB somehow), or an "account disabled" error.

I'll try this next, boss has been on that box for most of the morning along with MS/MSP help, can't force either off just yet.

Thanks for getting the gears turning in my head, its much appreciated.

Remote manage it then?

Alien Arcana
Feb 14, 2012

You're related to soup, Admiral.

evol262 posted:

The real problem with this is that while it might work algebraically, the legibility is awful, and it's virtually impossible to tell what it's doing if you scroll past this in the codebase.

It also doesn't work, but y'know.

I didn't test it, so it's entirely possible I screwed up the algebra :sweatdrop:

The basic principle should still work though: c² - (a² + b²) will definitely be some linear function of a, b, and ab, which you can easily solve to get b = R(a), with R some rational function. Then just iterate over a until R(a) is an integer, and you're done.

And yes, the code is more obtuse written this way, but you can easily add comments to explain what it means. For instance:

code:
// The set of solutions to a² + b² = c², a + b + c = 1000 is b = <some function of a>, c = 1000 - (a + b).
// These values will be integers whenever a is an integer and <expression> divides <expression> evenly.
I mean, that's half the point of comments - it lets you explain in plain English what the code is doing if it's not immediately clear.

evol262
Nov 30, 2010
#!/usr/bin/perl

Alien Arcana posted:

code:
// The set of solutions to a² + b² = c², a + b + c = 1000 is b = <some function of a>, c = 1000 - (a + b).
// These values will be integers whenever a is an integer and <expression> divides <expression> evenly.
I mean, that's half the point of comments - it lets you explain in plain English what the code is doing if it's not immediately clear.
Yes, and you can generalize it as:
code:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
        int a, b, c;
        int triple=atoi(argv[1]);
        for (a = 1; a <= (triple/2) - 1; a++)
        {
            b = (triple*(a-triple/2))/(a-triple);
            c = triple - (a + b);
            if (a*a + b*b == c*c) {
                printf("a: %d, b: %d, c: %d\n", a, b, c);
            };
        }
        return 0;
}
As long as you don't try to be clever with remainder checking (which doesn't always work for pythagorean triples).

Blunt answer:

Don't write code like this and try to excuse it with comments. Your comment doesn't matter if the code is illegible. Unless you're Carmack writing a game engine or someone working on HPC code, I'd sacrifice speed for readability.

Kernighan posted:

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

The simple truth is that the vast majority of developer you'll work with don't have degrees in CS, and have a questionable math background. When you leave that company, get hit by a bus, or whatever, and someone potentially has to modify or port that code, and they may not be competent at algebra, or may naively port it and reproduce an error in the original codebase.

Explicit is better, even if marginally slower, and comments are not a substitute for literate code.

evol262 fucked around with this message at 19:11 on May 23, 2014

Adbot
ADBOT LOVES YOU

GoatShaver
Nov 12, 2010

Sickening posted:

Remote manage it then?

Not sure what you mean - two are logged in currently on that particular box.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply