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.
 
  • Locked thread
Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

PokeJoe posted:

But doesn't this just simplify my code? I can't see how it makes it functionally any different.

it turns out that it's usually easier to find bugs in simpler code, and harder to write bugs in it

Adbot
ADBOT LOVES YOU

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
maybe whatever lovely image viewer you;re using doesnt actually like a bunch of extra poo poo at the end of a jpeg

PokeJoe
Aug 24, 2004

hail cgatan


Valeyard posted:

inspect the first and last byte of the working photos and then do the same for the first one that doesnt work

i did this already. they all start with the proper 4 bytes to signify a jpg and they all end in zeros except for one.

heres the first 4

code:
0000000: ff d8 ff e0  ....
0000004: ff d8 ff e0  ....
0000008: ff d8 ff e1  ....
000000c: ff d8 ff e0  ....
0000010: ff d8 ff e0  ....
0000014: ff d8 ff e0  ....
0000018: ff d8 ff e0  ....
000001c: ff d8 ff e1  ....
0000020: ff d8 ff e1  ....
0000024: ff d8 ff e0  ....
0000028: ff d8 ff e0  ....
000002c: ff d8 ff e0  ....
0000030: ff d8 ff e0  ....
0000034: ff d8 ff e0  ....
0000038: ff d8 ff e0  ....
000003c: ff d8 ff e0  ....
and heres the last 4

code:
0000000: 00 00 00 00  ....
0000004: 00 00 00 00  ....
0000008: 00 00 00 00  ....
000000c: 00 00 00 00  ....
0000010: 00 00 00 00  ....
0000014: 00 00 00 00  ....
0000018: 00 00 00 00  ....
000001c: 00 00 00 00  ....
0000020: 00 00 00 00  ....
0000024: 00 00 00 00  ....
0000028: 00 00 00 00  ....
000002c: 00 00 00 00  ....
0000030: 00 00 00 00  ....
0000034: 00 00 00 00  ....
0000038: 00 1e ff ff  ....
000003c: 00 00 00 00  ....
the one that isn't all 0s is a working image.

bobbilljim posted:

maybe whatever lovely image viewer you;re using doesnt actually like a bunch of extra poo poo at the end of a jpeg

its the default one in the virtual machine they provide me for the class

e: the file sizes for the broken images are all reasonable sizes too.

PokeJoe fucked around with this message at 01:45 on Feb 9, 2015

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
if you have the files that should be in there try diffing them

something bugs me about your code and I can't put my finger on it

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
oh, aren't you writing the first block twice

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
like at the end of any loop where new is true you'll call fwrite twice since you're setting foundfirst and found

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
and fwrite advances the stream you're writing into

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
also you should be using sizeof and poo poo rather than magic numbers

PokeJoe
Aug 24, 2004

hail cgatan


i think i know what you're talking about. could i just insert a break after that first new write?

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

PokeJoe posted:

i think i know what you're talking about. could i just insert a break after that first new write?

not sure that'd help since it'd break you out of the current condition and back into that second fwrite.

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
i don't really see why you need that 'write first block' fwrite at all, try commenting it out and keeping the rest and see what happens

Luigi Thirty
Apr 30, 2006

Emergency confection port.

I wrote bubble sort in 6502 today to protect myself from the measles

brap
Aug 23, 2004

Grimey Drawer
is it normal to write if (foo == true) instead of if (foo) :pwn:

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

fleshweasel posted:

is it normal to write if (foo == true) instead of if (foo) :pwn:

:shrug:

PokeJoe
Aug 24, 2004

hail cgatan


uncurable mlady posted:

i don't really see why you need that 'write first block' fwrite at all, try commenting it out and keeping the rest and see what happens

pisss they all worked immediately thanks so much!

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

PokeJoe posted:

pisss they all worked immediately thanks so much!

yw

Valeyard
Mar 30, 2012


Grimey Drawer

fleshweasel posted:

is it normal to write if (foo == true) instead of if (foo) :pwn:

it can be clearer, so sure

pseudorandom name
May 6, 2007

You have to parse the JIFs.

JIFs are made of markers, marker segments, and free-form entropy data.

Markers are two bytes, the first is 0xFF and the second is not 0x00 or 0xFF. 0xFF 0xFF is padding.

Marker segments are followed by a two byte big endian size which includes the size but not the marker itself.
Since marker segments have lengths, they can freely contain 0xFF bytes which don't start markers.

0xFF 0xD0 through 0xFF 0xD9 and 0xFF 0x01 are freestanding markers that do not start a segment and are not followed by a size.

Entropy coded data is free form bytes just sitting there in the file, guaranteed not to contain a marker (all 0xFF bytes are replaced with 0xFF 0x00).

JIF files start with the Start of Image marker 0xFF 0xD8 and end with the End of Image marker 0xFF 0xD9.
JFIF and Exif aren't relevant for this discussion, they're just forms of JIF files.

So you need to find the 0xFF 0xD8 SoI marker, then scan through the succeeding bytes looking for 0xFF bytes.
When you find an 0xFF byte, if the next byte is 0xD0 - 0xD8, 0x01, 0x00 or 0xFF, you need to keep going looking for another 0xFF byte.
If its 0xD9, you're done with the current file.
Otherwise, you need to read the next two bytes, swap them if necessary (it is necessary), skip past that length and go back to looking for 0xFF bytes.

pseudorandom name fucked around with this message at 02:31 on Feb 9, 2015

PokeJoe
Aug 24, 2004

hail cgatan


fleshweasel posted:

is it normal to write if (foo == true) instead of if (foo) :pwn:

i do it to make my code more readable to me b/c im new and don't worry about syntactic sugar

EVGA Longoria
Dec 25, 2005

Let's go exploring!

PokeJoe posted:

i do it to make my code more readable to me b/c im new and don't worry about syntactic sugar

it's not syntactic sugar it's just writing less code

PokeJoe
Aug 24, 2004

hail cgatan


also this is the terrible programmer thread

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

fleshweasel posted:

is it normal to write if (foo == true) instead of if (foo) :pwn:

no


PokeJoe posted:

i do it to make my code more readable to me b/c im new and don't worry about syntactic sugar

stop doing it plz (e: in the nicest way :))

MeruFM
Jul 27, 2010
this is not just terrible, this is yahoo answers of programming

Valeyard
Mar 30, 2012


Grimey Drawer
people trying to cram down poo poo into as little lines as possible should be shot, unless its for a webapp in which case you should be shot anyway

PokeJoe
Aug 24, 2004

hail cgatan


bobbilljim posted:

stop doing it plz (e: in the nicest way :))

ok

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Valeyard posted:

people trying to cram down poo poo into as little lines as possible should be shot, unless its for a webapp in which case you should be shot anyway

you should write thigns as _simply_ as you can. This is often more concise, but not always

lol if you dont minify your web poo poo automatically so it doesnt matter

suffix
Jul 27, 2013

Wheeee!

kalstrams posted:

i have terrible coding question. say, there is an hls live feed, which is locked to a fairly bad player. there is a tool that allows me to extract this live feed and pipe it into whatever video player i want. i think of setting up a website with decent (non-flash) player to be able to avoid using monstrosity of a web player that is there now. in case if i do so and succeed to do so, i have one thing i am not sure about - will it cut into my bandwidth or will it work the way i think it would, as in direct client <-> endpoint connection that just uses my server as a means to "locate the signal" ?

if you're using a link to their feed, the browser connects there directly, it won't be routed via your server somehow

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
todays workflow:

make
<error>
google <error>
fix
goto 1

Space Whale
Nov 6, 2014

AWWNAW posted:

umm why are u doing code first against an existing db u could just import the schema to .edmx and generate the pocos

That doesn't scale, apparently.

Space Whale
Nov 6, 2014

bobbilljim posted:

todays workflow:

make
<error>
google <error>
fix
goto 1

Reember when you used a book instead?

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

fleshweasel posted:

is it normal to write if (foo == true) instead of if (foo) :pwn:

code:
if(variable == true)
{
    another_variable = true;
}
else
{
    another_variable = false;
}

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Space Whale posted:

Reember when you used a book instead?

no bitch I ain't old :roflmao:

theadder
Dec 30, 2011


i owned a book once

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

fleshweasel posted:

is it normal to write if (foo == true) instead of if (foo) :pwn:

the only reason I can think of to maybe make it worth doing would be perhaps if foo is a method call that doesn't sound like it would return a boolean and even then you better have a good reason to not just rename the method

shitface
Nov 23, 2006

ok so I need to learn a bit of js but I have no interest or need for web/browser poo poo. any recommended reading? everything I've found so far is browser focused

jesus WEP
Oct 17, 2004


shitface posted:

ok so I need to learn a bit of js but I have no interest or need for web/browser poo poo. any recommended reading? everything I've found so far is browser focused

https://www.codecademy.com/en/tracks/javascript

is based on the language itself rather than how it interacts with a browser afaik

Space Whale
Nov 6, 2014
WTF. Builds in VS work but break like spun glass in a tornado when I try to use teamcity. Two things about this irritate me.

a) VS lets you just stay broken, figures out how to run, but doesn't use that to fix the build.

b) that it's possible to 'figure it out' but TC can't do it.

Alternatively, this could be because of artifact shenanigans because an upstart dev started adding to gitignore without asking.

brap
Aug 23, 2004

Grimey Drawer

KARMA! posted:

code:

if(variable == true)
{
    another_variable = true;
}
else
{
    another_variable = false;
}

you're fired.

Valeyard
Mar 30, 2012


Grimey Drawer
so I already signed a contract for a grad job on the (standard) condition I get atleast a 2.1

now I am panicking about whether I will be able to do this or not

how iron clad is that?

im thinking about applying somewhere else with a lower req and having it as a backup, but dont really know what would go down if I ended up fufilly choice 1

Adbot
ADBOT LOVES YOU

Space Whale
Nov 6, 2014

Valeyard posted:

so I already signed a contract for a grad job on the (standard) condition I get atleast a 2.1

now I am panicking about whether I will be able to do this or not

how iron clad is that?

im thinking about applying somewhere else with a lower req and having it as a backup, but dont really know what would go down if I ended up fufilly choice 1

Apply to jobs as you wish between now and the start of any other job you have planned. since they can change their minds as much as you! If someone offers more money or a better environment or a ballpit with less piss in it, yanno, take it.

  • Locked thread