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
revmoo
May 25, 2006

#basta
Uh yeah, does anybody actually know of a browser that famo.us actually works in? None of my testing has uncovered any.

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Just like with every web hipster thing, it's most usable in Chrome running on a top of the line rMBP, scrolling only with two-finger scrolling.

canis minor
May 4, 2011

Today I found out about this:

code:
<?php

class A {
    public function rear end()
    {
        var_dump('hi', $this, get_class($this), get_class());
    }
}

class B {
    public function bss()
    {
        A::rear end();
    }
}

$b = new B();
$b->bss();

?>

quote:

string 'hi' (length=2)
object(B)[1]
string 'B' (length=1)
string 'A' (length=1)

PHP you so crazy.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Plorkyeran posted:

Just like with every web hipster thing, it's most usable in Chrome running on a top of the line rMBP, scrolling only with two-finger scrolling.

The legacy of chrome having the best dev tools I guess. I know when we were prototyping a project I'm on now it was basically Chrome only for a couple of months (full testing now), but really to launch in this state, is it really that hard to spin up some browsers? Hell, IE is actually trivial to test now with modern.ie VMs.

KaneTW
Dec 2, 2011

eithedog posted:

Today I found out about this:

code:
<?php

class A {
    public function rear end()
    {
        var_dump('hi', $this, get_class($this), get_class());
    }
}

class B {
    public function bss()
    {
        A::rear end();
    }
}

$b = new B();
$b->bss();

?>


PHP you so crazy.

What did you expect?

revmoo
May 25, 2006

#basta

Maluco Marinero posted:

Hell, IE is actually trivial to test now with modern.ie VMs.

I've tried two different host operating systems (three different computers) and four different modern.ie VMs and I've had a BSOD on boot on every single one.

canis minor
May 4, 2011

KaneTW posted:

What did you expect?

At least a notice of trying to call non-static method inside a scope of class that has nothing to do with the original class. On the other hand you can use this as a substitute for multiple inheritance (as - simulate it), I guess. I didn't expect though that you can do something like this at all, and get away with it.

get_class($this) - cool that I get the class of the object that the method is called upon, get_class() is bizarre though and is the origin of this "train of thought" code.

Mogomra
Nov 5, 2005

simply having a wonderful time

eithedog posted:

At least a notice of trying to call non-static method inside a scope of class that has nothing to do with the original class. On the other hand you can use this as a substitute for multiple inheritance (as - simulate it), I guess. I didn't expect though that you can do something like this at all, and get away with it.

get_class($this) - cool that I get the class of the object that the method is called upon, get_class() is bizarre though and is the origin of this "train of thought" code.

The :: operator in PHP only changes the scope, but not $this. It's not exactly the same as calling a static method in other languages. Just pretty close. I know.

PHP: Paamayim-Nekudotayim http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

revmoo posted:

I've tried two different host operating systems (three different computers) and four different modern.ie VMs and I've had a BSOD on boot on every single one.

Really? Never had a drama on Ubuntu Virtual box, snappy as all get out, great testing environment, close enough to the real thing even Windows 8.1 VM.

revmoo
May 25, 2006

#basta

Maluco Marinero posted:

Really? Never had a drama on Ubuntu Virtual box, snappy as all get out, great testing environment, close enough to the real thing even Windows 8.1 VM.

I tried Win8 on Ubuntu and got BSOD never tried the 8.1 and to be honest I've totally given up on modern.ie with all of the wasted time it's caused me. Now we have dev boxes to remote into.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

revmoo posted:

I tried Win8 on Ubuntu and got BSOD never tried the 8.1 and to be honest I've totally given up on modern.ie with all of the wasted time it's caused me. Now we have dev boxes to remote into.

Fair cop, maybe an issue with virtualization in general though? Or you run other VMs with no dramas?

Marta Velasquez
Mar 9, 2013

Good thing I was feeling suicidal this morning...
Fallen Rib
C++ code:
char temp [4096+1];
int imageExist = 0;

// ... snip ...

FILE * fp = popen ( "/bin/ls /file/we/are/looking/for > /dev/null; echo $?", "re" );
if ( fgets ( temp, 2, fp ) != NULL )
{
    if ( temp[0] == '0' )
    {
        imageExist = 1;
    }
}
pclose ( fp );
temp is not used anywhere else.

revmoo
May 25, 2006

#basta

Maluco Marinero posted:

Fair cop, maybe an issue with virtualization in general though? Or you run other VMs with no dramas?

Modern.ie images are in fact the only vm images I've ever had not work. I tried using them at two different companies with totally different hardware and the on my home computer and had the same issues. Hence why I gave up. Fortunately I barely have to support IE where I'm at now (IE10+ only).

Speaking of which, when I tested my latest app against IE the only thing that didn't work was the HTML5 fullscreen API. I ended up just removing the functionality for IE clients.

The HTML5 fullscreen API is its own coding horror. When properly used it works great, but the implementation is just repeating past mistakes.

canis minor
May 4, 2011

contrapants posted:

C++ code:
char temp [4096+1];
int imageExist = 0;

// ... snip ...

FILE * fp = popen ( "/bin/ls /file/we/are/looking/for > /dev/null; echo $?", "re" );
if ( fgets ( temp, 2, fp ) != NULL )
{
    if ( temp[0] == '0' )
    {
        imageExist = 1;
    }
}
pclose ( fp );
temp is not used anywhere else.

A paranoid version of fopen.

ExcessBLarg!
Sep 1, 2001

eithedog posted:

A paranoid version of fopen.
Except it doesn't actually open the file. It's more like a Rube Goldberg version of access(2) and has the same TOCTTOU vulnerability, if that's relevant.

Edit: Looks like OpenSSL coding style.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

ExcessBLarg! posted:

Except it doesn't actually open the file. It's more like a Rube Goldberg version of access(2) and has the same TOCTTOU vulnerability, if that's relevant.

Gesundheit.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip



:v:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Yes, I know what it is. It's still a dumb acronym though.

Brain Candy
May 18, 2006

code:
  synchronized ( four){ 
    synchronized ( nested ){
       synchronized ( goddamn ){
          synchronized ( locks )  {

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Maluco Marinero posted:

Bit of a Rude Goldberg machine

I really appreciate your Freudian slip here :)

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



revmoo posted:

Modern.ie images are in fact the only vm images I've ever had not work. I tried using them at two different companies with totally different hardware and the on my home computer and had the same issues. Hence why I gave up. Fortunately I barely have to support IE where I'm at now (IE10+ only).

I've also had no problem with them on VBox on Win 7 and 8.1 :shrug: If I could only get everyone else to use them instead of goddamn compatibility mode.

quote:

Speaking of which, when I tested my latest app against IE the only thing that didn't work was the HTML5 fullscreen API. I ended up just removing the functionality for IE clients.

The HTML5 fullscreen API is its own coding horror. When properly used it works great, but the implementation is just repeating past mistakes.

:hf::smith: yep

canis minor
May 4, 2011

ExcessBLarg! posted:

Except it doesn't actually open the file. It's more like a Rube Goldberg version of access(2) and has the same TOCTTOU vulnerability, if that's relevant.

Edit: Looks like OpenSSL coding style.

I was more about - "why wouldn't you use fopen to check for existence of the file", but I got mixed in my thoughts, sorry.

I think I'll actually save this as an example how strangely people can make their life harder.

EDIT: or stat for that matter. why not stat...

canis minor fucked around with this message at 00:28 on May 22, 2014

QuarkJets
Sep 8, 2008

evensevenone posted:

Actually, it shouldn't. Reproducing results should mean taking your own experiments (where possible, obviously if it's an LHC experiment that might not be possible), and doing your own analysis using the method proposed by the paper (or even better, a completely different method), and then seeing if you get results.

Asking for code is like asking for the investigators lab notebooks and bitching because their handwriting is bad. It's part of the process, not the result. The results should be testable without ever seeing a line of code.

That false economics spreadsheet was revealed because people spent years trying to take the same historical data, do their own analysis using the methods proposed by the paper, and not getting the same results. There were even papers published about the failure to reproduce. If they had just handed out the spreadsheet, would people have actually gone line by line and made sure all the formulas worked?

But the falsehoods in the economics spreadsheet were revealed because eventually the spreadsheet itself was examined. That's analogous to consulting with the original code. You always write your own code, but then if you can't reproduce the same results with the same data there needs to be a consulting process to figure out why, and part of that process involves looking at code. You've basically said that you should never look at research code during verification and then provided an example where important things were discovered by doing exactly that :psyduck:

Yes, it's possible for bad results to be revealed by lots of people trying to reproduce them in a vacuum, but that first reproduction is going to have authors who want to probe deeper if their results look completely different from yours. They're going to ask for your data, and they're going to also ask for your code.

QuarkJets fucked around with this message at 05:12 on May 22, 2014

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Plorkyeran posted:

Just like with every web hipster thing, it's most usable in Chrome running on a top of the line rMBP, scrolling only with two-finger scrolling.

Confirmed that it "works" given these parameters.

It's awful.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Munkeymon posted:

I really appreciate your Freudian slip here :)

Haha, I so rarely use the term I didn't even notice that.

Doctor w-rw-rw-
Jun 24, 2008
https://github.com/NodeOS/NodeOS
https://github.com/NodeOS/NodeOS/issues/22

What is a SysCall? posted:

Hey @groundwater - I took a stab at creating a syscall application, or at least what I understand as a syscall application:

http://www.tutorialspoint.com/unix_commands/date.htm

Basically, to the date application and created a node ndate application with a similar but shortend api structure. Now this may not be along the lines of your vision, but I thought I would give it a shot.

https://github.com/twilson63/ndate

:shepface: This is the bestest of best ideas and will totally not be terrible

JawnV6
Jul 4, 2004

So hot ...
I was all set for garden variety descriptions of repulsion, but given the task of getting a webdev an idea of systems the reply does a really good job v0v

Look Around You
Jan 19, 2009

JawnV6 posted:

I was all set for garden variety descriptions of repulsion, but given the task of getting a webdev an idea of systems the reply does a really good job v0v

Yeah the reply is pretty good. I think he maybe glossed over a little much, such as exactly how sandboxing happens and the concept of context switching and how expensive (computationally) it is.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Architecture horror getting fixed next week:

quote:

security has been re-implemented to use Active Directory Services instead of CRM

My boss has a raging hardon for Microsoft CRM, so way back in The Before Time, he got the original developer the company hired to base internal applications' user accounts in CRM. This misuse was only tolerable because some company made a nice library that wrapped the fractal horror that is the CRM API in one usable by one guy who actually didn't have the skill and knowledge to command a six figure salary as a MS CRM developer. Fortunately for us, that company went out of business years ago and my boss is reluctant to hire a CRM developer to re-do the service to talk to the latest version which we have to upgrade to in order to get out of an exorbitant licensing fee that Microsoft requires to stay on the old version. This means we had to migrate to the service we should have used all along because it's the right tool for the job.

That's my story of how budgetary pressure fixed a horror instead of creating one. Hope you liked it :tipshat:

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
I don't know where I read the statement that C++ is a language for insufferably clever people who want to show just how clever they are at all times, but...

code:
const unsigned clIdx = 1;
unsigned certMask = 1 << clIdx;
ASSERT((m_CertMask & certMask) == 0);
Why no, we can't just write "2". Also, certMask could be const. Also, I'm not sure what the assert is actually testing, or why we don't just use m_CertMask.

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
code:
	const size_t count = m_ActionItems.GetCount();
	size_t i;
	for( i=0; i < count; i++ )
	{
		ActionItem &item = m_ActionItems[i];

		if( GET_AGENT_HANDLE_VALUE( srcHandle ) < item.srcHandle )				// If the next handle is greater, then we found the right place
			break;
		if( srcHandle == (unsigned int)item.srcHandle )				// If the handles match
		{
			if( srcAction < item.srcAction )			// If the next action is greater, then we found the right place
				break;
			if( srcAction == item.srcAction )
			{
				if( !memcmp( &item, &newItem, sizeof(ActionItem) ) )		// If already added
					return;													// Don't add it again
			}
		}
	}
	
	m_ActionItems.InsertAt( i, newItem );
Let's make sure an array is sorted by writing this mess in just one of the places where items are inserted, rather than using an appropriate data structure. Of course, I found this because there was a bug where duplicate items were being inserted.

shrughes
Oct 11, 2008

(call/cc call/cc)

Dessert Rose posted:

I don't know where I read the statement that C++ is a language for insufferably clever people who want to show just how clever they are at all times, but...

code:
const unsigned clIdx = 1;
unsigned certMask = 1 << clIdx;
ASSERT((m_CertMask & certMask) == 0);
Why no, we can't just write "2". Also, certMask could be const. Also, I'm not sure what the assert is actually testing, or why we don't just use m_CertMask.

I'm confused, where is the writer of the code trying to show how clever he and/or she is?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Dessert Rose posted:

I don't know where I read the statement that C++ is a language for insufferably clever people who want to show just how clever they are at all times, but...

code:
const unsigned clIdx = 1;
unsigned certMask = 1 << clIdx;
ASSERT((m_CertMask & certMask) == 0);
Why no, we can't just write "2". Also, certMask could be const. Also, I'm not sure what the assert is actually testing, or why we don't just use m_CertMask.

Writing "2" would be the horror. Cert is the bit in position 1, it makes a mask so that it can extract it clearly. And the assertion is that m_CertMask doesn't have the bit in question set, so probably using m_CertMask instead would be a bad idea since it's guaranteed to have a different value.

KaneTW
Dec 2, 2011

Dessert Rose posted:

I don't know where I read the statement that C++ is a language for insufferably clever people who want to show just how clever they are at all times, but...

code:
const unsigned clIdx = 1;
unsigned certMask = 1 << clIdx;
ASSERT((m_CertMask & certMask) == 0);
Why no, we can't just write "2". Also, certMask could be const. Also, I'm not sure what the assert is actually testing, or why we don't just use m_CertMask.

You are the horror.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Subjunctive posted:

Writing "2" would be the horror. Cert is the bit in position 1, it makes a mask so that it can extract it clearly. And the assertion is that m_CertMask doesn't have the bit in question set, so probably using m_CertMask instead would be a bad idea since it's guaranteed to have a different value.

Just so I can make sure I have this straight, you're arguing that that is the right way to do it because the 1 on the first line corresponds to looking for the bit in position 1 (numbering from the least significant bit and starting at zero)? So if you wanted to get the bit in position 27 you could write the same thing (but with a 27 on the first line instead of a 1) rather than expect the reader to recognise 134217728 as 2 to the power 27.

I mean, I can see why just writing ASSERT((m_CertMask & 2) == 0); doesn't generalise very well, but then, you don't have to do it that way when it's a bit much further to the left that you are looking for. Also you could use a hexadecimal literal which would make it clearer.

return0
Apr 11, 2007
It's a pretty well known/obvious way to check a bit is set, not sure what the horror is tbh?

Hughlander
May 11, 2005

return0 posted:

It's a pretty well known/obvious way to check a bit is set, not sure what the horror is tbh?

People not knowing idiomatic C like languages with a chip on their shoulder.

shrughes
Oct 11, 2008

(call/cc call/cc)
The useful information provided by the original code over using "2" is that this is the "cl" bit.

I don't know why a local variable would need to be made for that name though...

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Hammerite posted:

Just so I can make sure I have this straight, you're arguing that that is the right way to do it because the 1 on the first line corresponds to looking for the bit in position 1 (numbering from the least significant bit and starting at zero)? So if you wanted to get the bit in position 27 you could write the same thing (but with a 27 on the first line instead of a 1) rather than expect the reader to recognise 134217728 as 2 to the power 27.

Yeah, exactly.

quote:

I mean, I can see why just writing ASSERT((m_CertMask & 2) == 0); doesn't generalise very well, but then, you don't have to do it that way when it's a bit much further to the left that you are looking for. Also you could use a hexadecimal literal which would make it clearer.

Why would you do it differently for those two cases? (We don't know if certMask is used elsewhere, I've been assuming so.) I mean, I'd probably use a #define or const for it, but it would take the same form. Using a hex literal isn't any clearer, IMO, but it wouldn't be horrible and I wouldn't bounce something at code review for it if that was the pattern. But do you really know that 0x8000000 is bit 27 as easily? (Count those zeroes!)

Adbot
ADBOT LOVES YOU

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
Well you could also do assert(bitmask & (1<<cert_bp) or whatever. I thought that was the point, it's kind of an overly-verbose way to get the point across.

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