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
Reformed Pissboy
Nov 6, 2003

YOSPOS is bad. So, uh, are coding horrors? The likes of which I have not personally posted in a long time.

Adbot
ADBOT LOVES YOU

shrughes
Oct 11, 2008

(call/cc call/cc)
code:
    if (last_rebalance_time + (rebalance_timeout_ms * 1024) > now) {

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Clearly ms is short for mibiseconds.

Suspicious Dish
Sep 24, 2011

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

Westie posted:

I was going to empty quote but then I remembered what forum I'm on.

You're chickening out?

Suspicious Dish
Sep 24, 2011

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

Notorious QIG posted:

Yospos best pos.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

Now you've done it.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Reformed Pissboy posted:

YOSPOS is bad.

Nope.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
A contractor is supposed to push something up for my team to review. I'm sure there's a horror in it, but I can't tell you what it is because he can't figure out how to push changes with mercurial.

How do these people get past interviews? What is this guy working on? :iiam:

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

leper khan posted:

A contractor is supposed to push something up for my team to review. I'm sure there's a horror in it, but I can't tell you what it is because he can't figure out how to push changes with mercurial.

How do these people get past interviews? What is this guy working on? :iiam:

Apparently he's working on how to push something for your team to review :v:

baquerd
Jul 2, 2007

by FactsAreUseless

leper khan posted:

A contractor is supposed to push something up for my team to review. I'm sure there's a horror in it, but I can't tell you what it is because he can't figure out how to push changes with mercurial.

How do these people get past interviews? What is this guy working on? :iiam:

Ah yeah, there's always one; typically an older gentleman, but sometimes a youthful pothead and/or aspiring empty suit. In their final form, they will actively turn any assignments into lots of work for other people while laughing at those who are productive. I have a more benign version on my team right now. They hunt and peck at the speed of a hibernating bear, they regularly perform 1/10 to 1/5 the work of the other team members, and they spend most of their time "learning" on Youtube. I'm going to get them fired soon, but I unfortunately can't do it directly.

People like that get hired for a couple of reasons, either they didn't start out that way and just slowly devolved, or they came across as thoughtful and competent (if a bit slow) in the interview. A person who knows and can explain FizzBuzz and some tree traversal can get hired and then you find out that they need 2 weeks to learn mercurial.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Kilson posted:

Or maybe I'm just jaded by having to look at Asterisk's source code all the time. :cry:

This is way back but...

code:
$ wc -l channels/chan_sip.c
33651 channels/chan_sip.c
Don't even get me started

quiggy
Aug 7, 2010

[in Russian] Oof.


shrughes posted:

code:
    if (last_rebalance_time + (rebalance_timeout_ms * 1024) > now) {

This is a work of art.

Dren
Jan 5, 2001

Pillbug

shrughes posted:

code:
    if (last_rebalance_time + (rebalance_timeout_ms * 1024) > now) {

Wow, a kilo-millisecond.

Suspicious Dish
Sep 24, 2011

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

shrughes posted:

code:
    if (last_rebalance_time + (rebalance_timeout_ms * 1024) > now) {

glorious

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
SI integer: a whole number, possibly containing a suffix denoting the base unit of the value. Accepted suffixes are 'k', 'M', 'G', 'T', and 'P', denoting kilo (1024), mega (1024^2), giga (1024^3), tera (1024^4), and peta (1024^5) respectively. The suffix is not case sensitive. If prefixed with '0x', the value is assumed to be base 16 (hexadecimal). A suffix may include a trailing 'b', for instance 'kb' is identical to 'k'. You can specify a base 10 value by using 'KiB', 'MiB', 'GiB', etc. This is useful for disk drives where values are often given in base 10 values. Specifying '30GiB' will get you 30*1000^3 bytes.

JawnV6
Jul 4, 2004

So hot ...
If you want a 10 bit shift just ask for a 10 bit shift.

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
The assumption that the compiler would apply strength reduction to turn a multiplication by 1024 into a left shift by 10 irks me less than the assumption that integer multiplication is some expensive operation. The latency for imul or mul is what, 3 cycles?

JawnV6
Jul 4, 2004

So hot ...
Wait, you have a hardware multiplier? That can operate on registers??

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

JawnV6 posted:

Wait, you have a hardware multiplier? That can operate on registers??

I'm gonna embed a hardware multiplier up your rear end if you keep sassin people, boy!

PrBacterio
Jul 19, 2000

JawnV6 posted:

Wait, you have a hardware multiplier? That can operate on registers??
Is there even an architecture out there in common use anymore, no matter how small and embedded you go, that doesn't? Even the Atmel stuff has a multiply instruction, doesn't it?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
PICs are pretty common (unfortunately), and the low-end 12-bit PICs don't have hardware multipliers AFAIK.

JawnV6
Jul 4, 2004

So hot ...

PrBacterio posted:

Is there even an architecture out there in common use anymore, no matter how small and embedded you go, that doesn't? Even the Atmel stuff has a multiply instruction, doesn't it?

Atmel what? Atmel sells everything from beefy 120MHz Cortex M4's with 65k gates including a full FPU down to 8-bit AVR's in the ~10k gate range. Down towards the lower end the hardware multipliers get scarcer and with qualifications like 8-bit only or memory-mapped. For a lot of 'sensor glue' type applications you don't really need to multiply anyway.

TI's MSP430 is another line where hardware multipliers are available, but not common.

..btt
Mar 26, 2008
My dad works with an ancient CPU that does have a multiply instruction, but it can use too many cycles depending on input so he ended up writing his own multiply function that can be a little inaccurate but always executes in a known number of cycles.

There is a horror here - the only device that works with his kit relies on some unmaintained DOS software that won't run on an NT kernel, so he runs a Windows 98 box which hosts his dev. environment. Brings me out in cold sweats whenever he talks about it.

feedmegin
Jul 30, 2008

Dren posted:

I thought they were on the stack.

Generally speaking they're in a read-only section of the executable file (e.g. .rodata in ELF on Linux, .rdata in PE/COFF on Windows) that is mapped into the process's address space just like the executable code is. So definitely not on the stack, not technically on the heap either, guaranteed to stick around until the process/DLL is unloaded.

kuf
May 12, 2007
aaaaaa
code:
$overlay = $('<div></div>');
$overlay.addClass('overlay').append('<div class="inner"></div>');
:suicide:

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog

..btt posted:

My dad works with an ancient CPU that does have a multiply instruction, but it can use too many cycles depending on input so he ended up writing his own multiply function that can be a little inaccurate but always executes in a known number of cycles.

What's this use case where you can tolerate occasionally incorrect multiplication as long as you know exactly how long it will take?

Dylan16807
May 12, 2010

Smugdog Millionaire posted:

What's this use case where you can tolerate occasionally incorrect multiplication as long as you know exactly how long it will take?
Probably close to the use case of floating point numbers.

JawnV6
Jul 4, 2004

So hot ...

Smugdog Millionaire posted:

What's this use case where you can tolerate occasionally incorrect multiplication as long as you know exactly how long it will take?

Upstream of a Pentium

Deus Rex
Mar 5, 2005

DotFortune posted:

code:
$overlay = $('<div></div>');
$overlay.addClass('overlay').append('<div class="inner"></div>');
:suicide:

so what? I mean it could just be $('<div class="overlay"><div class="inner"></div></div>') but on the scale of web dev horrors this is nothing.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
I'm trying to fix code in the VLC Windows 8 port (which, if you have not tried it, is an awful mess) when I saw this view model. I kept getting null exception errors in "GetCover()", where it would tried to get the album art of a music file. This code is hit when it can't get the thumbnail from the file.

code:
                    if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
                    {
                        try
                        {
                            HttpClient Fond = new HttpClient();
                            var reponse =
                                await
                                    Fond.GetStringAsync(
                                        "http://ws.audioscrobbler.com/2.0/?
								method=album.getinfo
					&api_key=a8eba7d40559e6f3d15e7cca1bfeaa1c&artist=" +
                                        Artist + "&album=" + Name);
                            {
                                var xml1 = XDocument.Parse(reponse);
                                var firstImage = xml1.Root.Descendants("image").ElementAt(3);
                                if (firstImage != null)
                                {
                                    hasFoundCover = true;
                                    DownloadAndSaveHelper.SaveAsync(
                                        new Uri(firstImage.Value, UriKind.RelativeOrAbsolute),
                                        ApplicationData.Current.LocalFolder,
                                        fileName + ".jpg");
                                }
                            }
                        }
                        catch
                        {
                            Debug.WriteLine("Unable to get album Cover from LastFM API");
                        }
                    }
First, I included the api key because this is a public repository and they left it in there. Second, they are getting the album information from LastFM with XML, then parsing it and creating a new thumbnail with it. Now, LastFM can return Json and they already use Json.net elsewhere. Why not just use that?

Also, "xml1.Root.Descendants("image").ElementAt(3);" is a "large" image in the LastFM Api. Their logic is that if it can't find that element, it would remain null and then continue. The problem is that it throws an error. Now, because of the try catch, it just continues after that, but there is no reason to be doing this at all. Also, if LastFM does not have a "large" image, but does have the other sizes, they would be ignored.

Also, you can see "fileName". This is used to set the filename for the thumbnail to be stored as. Filename is set as such:

code:
string fileName = Artist + "_" + Name;
"Artist" being the bands name, and "Name" being the album name. The problem is that artists and albums can have special characters that Windows does not like, so if you have an album by the band "ALL" called "Greatest Hits!?!?", Windows does not like the question marks and will throw when saving the thumbnail. Now, this is also caught and ignored.

IT BEGINS
Jan 15, 2009

I don't know how to make analogies
php:
<?
function output_line(){
global $schema, $charges,$last_invoice_row,$last_shipment_row, $total_charges, $carrier,$comma_pipe,$table_storage;
?>
Like ... why. loving whyyyyyy?

The extra-extra-extra fun part? The poo poo that calls this uses an extract() on a gigantic array that may or may not contain some of these values. Fan. loving. Tastic.

Bonus:

php:
<?
    //var_dump($last_invoice_row);
    //var_dump($last_shipment_row);
//    print_r($charges);
//     print_r($total_charges); exit(1);
?>
What even is debugging. Or version control.

IT BEGINS fucked around with this message at 14:30 on Mar 14, 2014

substitute
Aug 30, 2003

you for my mum
Tell this person to at least use Kint.

https://github.com/raveren/kint/

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

I just went to take a look and thought "Oh good they have unit tests".


code:
   3 namespace VLC_WINRT_TESTS
   4 {
   5     [TestClass]
   6     public class UnitTest1
   7     {
   8         [TestMethod]
   9         public void TestMethod1()
  10         {
  11         }
  12     }
  13 }

Polio Vax Scene
Apr 5, 2009



Checks out for me!

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

Ithaqua posted:

I just went to take a look and thought "Oh good they have unit tests".


code:
   3 namespace VLC_WINRT_TESTS
   4 {
   5     [TestClass]
   6     public class UnitTest1
   7     {
   8         [TestMethod]
   9         public void TestMethod1()
  10         {
  11         }
  12     }
  13 }

I'm actually sending patches now to help fix this stuff. Unit tests are on the to-do list. It's too crashy for them to be useful right now :v:.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Ithaqua posted:

I just went to take a look and thought "Oh good they have unit tests".


code:
   3 namespace VLC_WINRT_TESTS
   4 {
   5     [TestClass]
   6     public class UnitTest1
   7     {
   8         [TestMethod]
   9         public void TestMethod1()
  10         {
  11         }
  12     }
  13 }

At least they pass.

Space Kablooey
May 6, 2009


Do they? I think they are inconclusive. :v:

IT BEGINS
Jan 15, 2009

I don't know how to make analogies
Just in case you ever wanted a new way to write the number 0:

code:
sum(coalesce(b.charge,b.approved)-coalesce(b.charge,b.approved)) as Disputed_Amount,
There you loving go.

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"

computational physics posted:

C++ code:
complex<double> ****Gn= new complex<double> ***[n_Z];
complex<double> ****POPSELF= new complex<double> ***[n_Z];
The code in all it's glory.
At least it's not Fortran? :suicide:

Adbot
ADBOT LOVES YOU

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
More VLC stuff

code:
            if (args.WindowActivationState == CoreWindowActivationState.Deactivated)
            {
                if (!Locator.MusicPlayerVM.TrackCollection.IsRunning)
                    return;
                StorageFile file =
                    await StorageFile.GetFileFromPathAsync(
                        Locator.MusicPlayerVM.TrackCollection.TrackCollection[
                            Locator.MusicPlayerVM.TrackCollection.CurrentTrack].Path);
                IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);
                App.RootPage.FoudationMediaElement.SetSource(stream, file.ContentType);
                App.RootPage.FoudationMediaElement.Play();
                App.RootPage.FoudationMediaElement.Volume = 0;
            }
            else
            {
                if (!Locator.MusicPlayerVM.TrackCollection.IsRunning)
                    return;
                App.RootPage.FoudationMediaElement.Stop();
            }
This is how VLC for Windows 8 handles background audio. "Locator.MusicPlayerVM" is the VLC backend playing audio. When you leave the app it checks to see if music is playing. If it is, it offloads the stream to a Windows XAML media element, so it will play in the background.

In other words, when you leave the VLC app, it stops being VLC. Windows has now taken control of the stream. It also dips the audio down to 0 and then back up, so you will hopefully not notice. Even though you totally can.

EDIT: I lied. It's actually using the VLC stream still. You can trick Windows 8 to play background audio if you already have audio running and play something on the media element stream. So they play the same audio file turned down so you can hear their stream. gently caress this.

Once again :suicide:

Drastic Actions fucked around with this message at 03:15 on Mar 17, 2014

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