Profile

Cover photo
ヽポール
36 followers|51,131 views
AboutPostsPhotosVideos

Stream

ヽポール

Shared publicly  - 
 
Good primer. The Florida gun stats are borderline criminal.
1
 
Why is G+ now only covering half my screen? What are the huge borders are the side for? #googleplus  
1

ヽポール

Shared publicly  - 
 
Computer says "no" to a guy called "God". Reminds me to change my middle name to "Null", for the lulz.
A Brooklyn businessman is ­suing the credit-reporting agency Equifax for falsely reporting him as having no financial history ­because their system rejects his first name — God. God Gazarov —…
1
 
Visual Studio 2012 defaults to inserting spaces instead of tab characters for C# code. I fear it has lost all credibility in my mind.
1
1
Angus McIntyre's profile photo
 
Even now Maria Miller is still spinning like mad. First she tries to blame "a Labour MP" for complaining about her fraud, then says she went because she realized she had become an "enormous distraction". Not because she took £45,000 that wasn't her's to take. Even now she won't just admit what she did and properly apologise. Also, can we have the other £39,200 that she hasn't repaid back? #mariamillerapology  
1
1
Angus McIntyre's profile photo
Have them in circles
36 people

ヽポール

Shared publicly  - 
 
Directory Opus developers spamming users, trying to hide critical security problems. This thread doesn't even appear in the main forum it is in any more, the mods have hidden it.
1

ヽポール

Shared publicly  - 
 
Game of Thrones was extremely satisfying today.
1
 
I've been writing some code that takes packed 12 bit PCM audio data, unpacks it and saves it to a WAV file. Took about half an hour in C, but the desktop guys needed to use it in C#. Should have just made a DLL, but I though "how hard can it be to do in native C#?"

C# does not like handling basic types like uint8 or int16. It doesn't like bitwise operations. It doesn't like structs that mirror binary on-disk formats. In fact calling it a variant of C seems to be a stretch.

Take this line that does some simple sign extension. Started off like this, the same as in C:

word[0] |= ((word[0] & 0x800) ? 0xF000 : 0);

word[] is an array of Int16s.

First problem is that the compiler can't convert int to bool... Except I didn't use any ints or bools here. The int is because using a bitwise operand converts everything to int for some reason. The bool is because you can't just test an int to see if it is non-zero, doing so converts it to a bool. I can see what they mean I suppose. So, let's try again:

word[0] |= ((word[0] & 0x800) != 0 ? 0xF000 : 0);

The compiler complains that I shouldn't use bitwise operations on a sign-extended type, even though what we are actually doing is sign extending it. I could use an unsigned type but later on I want to multiply by 16 to go from 12 to 16 bit full scale. It also moans about not being able to convert an int to a short, unless I specifically cast it which I guess is okay if they want to discourage potentially unsafe type conversions.

So, let's try to fix it:

word[0] |= ((word[0] & 0x800) != 0 ? (Int16)0xF000 : 0);

Compiler says that 61440 (0xF000 in unsigned decimal) can't be converted to a short (Int16). Apparently hex values are unsigned in C#, which makes them kinda useless for bitwise stuff. Anyway:

word[0] |= ((word[0] & 0x800) != 0 ? (Int16)(-4096) : 0);

And we are back to a warning about using bitwise operators on signed values and an error about converting int to short. What the hell? I messed about for five minutes before out of desperation trying this:

word[0] |= ((word[0] & 0x800) != 0 ? (Int16)(-4096) : (Int16)0);

WTF, I have to cast zero to Int16!? I'm really not sure what is happening here, because clearly integer constants are converted to whatever type (signed/unsigned int/short/float etc.) necessary automatically, except here. Seems to be due to the bitwise operations but... Why?
2

ヽポール

Shared publicly  - 
 
I'm in Novatech returning a graphics card that was sold as new but is clearly second hand. The guy denied it, but then a woman came in with a tablet that she bought as "new" and found pictures of someone else on! Would have been hilarious if Novatech weren't such dicks about it. #novatech
1

ヽポール

Shared publicly  - 
 
5 internet prophecies that didn't come true.

1. Spam will end within two years (2004, Bill Gates)
2. Web sites will never replace newspapers (1995, Newsweek)
3. The internet will collapse (1995, Robert Metcalfe)
4. The internet will cause the downfall of governments and others in power (1995, Columbia Journalism Review)
5. No-one will want to shop on the web (1995, Newsweek)

Personally I think Newsweek was the most short sighted. Gates wasn't far off for users of some services, e.g. I get maybe one or two spams a week on Gmail thanks to filtering.
今から25年前、英科学者ティム・バーナーズ・リー博士が提案した「情報管理システム」の構想に、上司が返したのは「漠然(ばくぜん)としているがおもしろい」という簡単なコメントだった。この提案がインターネットの誕生につながるとは、だれが予想しただろう。それ以来、ネットの発展を巡って飛び交ったさまざまな...
1
People
Have them in circles
36 people