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
the bsd boys
Aug 8, 2011
Probation
Can't post for 378 days!
dehumanize yourself & face 2 snype

Adbot
ADBOT LOVES YOU

Flash z0rdon
Aug 11, 2013

the bsd boys posted:

dehumanize yourself & face 2 snype

banned

Whiskerando
Mar 13, 2011

PrBacterio posted:

thats because its actually "software"

qwerasdf
Oct 1, 2006
(Eat shit)

Posting Principle posted:

you can actually just say

code:
using (var file = File.AppendText("c:\\myfile.bar"))
{
	file.WriteLine("im gay");
}

the gently caress

code:
File.AppendAllText("c:\\butt.but", "gently caress you");

Nomnom Cookie
Aug 30, 2009



lol c:

how quaint

Whiskerando
Mar 13, 2011

does anyone know any tips/pitfalls for c++ shared pointers? specifically the boost smart pointers library. i have to use them for work and i feel like m about to piss out memory leaks like a sick cat

Nomnom Cookie
Aug 30, 2009



let me tell u about this amazing thing. its called garbage collection and once the 90s arrive its going to revolutionize programming

PrBacterio
Jul 19, 2000

Nomnom Cookie posted:

let me tell u about this amazing thing. its called garbage collection and once the 90s arrive its going to revolutionize programming
score another point for why I want the 90s back :smith:

Shaggar
Apr 26, 2006

Posting Principle posted:

you can actually just say

code:
using (var file = File.AppendText("c:\\myfile.bar"))
{
	file.WriteLine("im gay");
}

you could also just do
C# code:
File.AppendAllText(@"c:\myfile.txt","im gay");
but that opens and closes the file every time which is retarded if you're doing it in a loop so lets be gay and do

C# code:
File.AppendAllLines(@"c:\urls.txt", doc.DocumentNode.SelectNodes("//a[@href]").Select(x => x.Attributes["href"].Value));
more gay
C# code:
File.AppendAllLines(@"c:\utuburls.txt", doc.DocumentNode.SelectNodes("//a[@href]").Select(x => x.Attributes["href"].Value).Where(href => href.Contains("youtube")));
of course all of this is dumb and stupid cause why are you writing this to a file instead of using the debugger.

Shaggar
Apr 26, 2006
but yes yes wrap ur idisposables in using cause its so much nicer for everyone and its better than forgetting to close the streams.

Doc Block
Apr 15, 2003
Fun Shoe
LOL at you babbies with your garbage collecting or manual memory management. Just use Objective-C and bask in the glory of ARC.

Shaggar
Apr 26, 2006
yeah you have to be painstakingly careful w/ memory on ios cause it only has 4 megs and the os will constantly swap everything out. it sucks for the user but that's the apple experience so deal with it.

Shaggar
Apr 26, 2006

Nomnom Cookie posted:

lol c:

how quaint

drive letters are good and theres never been a legit argument against them other than 'im a retard who uses Linux now was it on /lda/b/f1 or /lbb/0/vmfs ???'

Whiskerando
Mar 13, 2011

i guess the problem is that you can run out of them? i dont know when that would happen but you only get the 26

Shaggar
Apr 26, 2006
then you do like aa:\ or maybe just mount it under an existing drive like at c:\thisisactuallyadifferentpartition

idk if anyone has ever hit the drive letter limit in a legitimate scenario tho

Doc Block
Apr 15, 2003
Fun Shoe
LOL remember when the order the devices were connected determined their drive letter? so if you added a second hard drive or split your hard drive into two partitions (like every PC "power user" used to do) any game that had a CD check would stop working because the CD-ROM's drive letter would go from D: to E:. And you had to pray that the game was just saving what drive letter it was installed from, and thus could be made to work again by reinstalling it, because a bunch of games just had the CD check hard coded to look in drive D:.

does windows still do that?

does windows still reserve drive letters A: and B: for floppy drives?

is windows still a piece of poo poo?

Shaggar
Apr 26, 2006
yeah generally os is C and A/B are still floppy and it just assigns letters as devices are connected. it works great, but you can assign any letter other than c to whatever u want.

Socracheese
Oct 20, 2008

it still starts u off with C: but it let me add a second hdd and name it A:, i don't think it let you in earlier versions idk

Shaggar
Apr 26, 2006
also only bad software would look for a specific drive letter (adobe)

Doc Block
Apr 15, 2003
Fun Shoe

Shaggar posted:

yeah generally os is C and A/B are still floppy and it just assigns letters as devices are connected. it works great, but you can assign any letter other than c to whatever u want.

LOL that's stupid as hell. Microsoft Windows: accommodating that one sperg who still has a floppy drive.

Shaggar posted:

also only bad software would look for a specific drive letter (adobe)

or nearly every game that came on disc ever. like i said, the not-completely-shittily-written-ones would save the drive letter they were installed from, but a bunch had the CD check hardcoded to look in drive D:, especially the earlier CD games.

Shaggar
Apr 26, 2006
why is it stupid? what is the downside?

I've never had a game need a specific drive letter. it just asks that u put the cd in the drive if it needs it for copy protection and everyone just used their emulated drives w/ mounted backup isos on a separate drive letter and it just worked/

maybe like during the dos days it was a problem? idk.

but all that means is nowdays software just works and drive letters are still convenient for users cause

c:\
d:\
e:\

are easy to distinguish unlike

Macintosh HD
Macintosh HD
Macintosh HD

and its not any different from
/dev/hda(:\)
/dev/hdb(:\)
/dev/hdc(:\)

Shaggar fucked around with this message at 06:14 on Oct 24, 2013

Doc Block
Apr 15, 2003
Fun Shoe

Shaggar posted:

why is it stupid? what is the downside?

I've never had a game need a specific drive letter. it just asks that u put the cd in the drive if it needs it for copy protection and everyone just used their emulated drives w/ mounted backup isos on a separate drive letter and it just worked/

maybe like during the dos days it was a problem? idk.

it wasn't as much of a problem once we were well into the windows XP days, but prior to that (dos/win95/win98 era) it was pretty common for games to save what drive letter they were installed from so that the CD check was as easy as looking for D:\GAMENAME.TXT. you'd have to reinstall the game if the CD-ROM's drive letter changed for some reason. some games were so awful as to have the drive letter hardcoded, so it would only check drive D:.

quote:

but all that means is nowdays software just works and drive letters are still convenient for users cause

c:\
d:\
e:\

are easy to distinguish unlike

Macintosh HD
Macintosh HD
Macintosh HD

and its not any different from
/dev/hda(:\)
/dev/hdb(:\)
/dev/hdc(:\)

nobody directly accesses the raw /dev devices, only the OS and the mount utility care about them. if i plug in an external HD named SHAGGAR WAS WRONG, it'll always be automounted under /Volumes/SHAGGAR WAS WRONG (on OS X), and the Finder and Open/Save dialog boxes will always put SHAGGAR WAS WRONG on the side in the Devices section. it will never matter what order it's plugged in, and will never matter what external port it's connected to.

i can make a symlink to /Volumes/SHAGGAR WAS WRONG/yourmom_laffo.txt on my desktop and it will always work (so long as the drive is plugged in), even if I unplug the drive and plug it back in on a different port or plug something else in first.

on windows, if a program expects to find a file on drive D:, but the user unplugs it for some reason, plugs in a USB thumbdrive, and then plugs the first drive back in, welp, the USB thumbdrive is drive D: now.

Whiskerando
Mar 13, 2011

i realize im about to link to a stack exchange site but it seriously sounds like you only get the 26 letters before you have to start mounting them as folders

cowboy beepboop
Feb 24, 2001

Whiskerando posted:

i realize im about to link to a stack exchange site but it seriously sounds like you only get the 26 letters before you have to start mounting them as folders

mounting as folders should be the default

Progressive JPEG
Feb 19, 2003

C: more like :C

Zlodo
Nov 25, 2006

Whiskerando posted:

does anyone know any tips/pitfalls for c++ shared pointers? specifically the boost smart pointers library. i have to use them for work and i feel like m about to piss out memory leaks like a sick cat

the only pitfall are circular references, just avoid those and you're good to to
you can have circular references using weak_ptr

type wise you can do anything because they keep track of the actual type of the pointed object so the right destructor will always be called, even with for instance a shared_ptr< void >

Zlodo
Nov 25, 2006
also use make_shared when you want to create an instance of an object pointed to by a shared_ptr. its cleaner to write and its more efficient because it will allocate a single memory block to store both the reference counter and the object instance itself

plenty of useful things you can do with shared_ptr:
http://www.boost.org/doc/libs/1_39_0/libs/smart_ptr/sp_techniques.html

Shaggar
Apr 26, 2006

Doc Block posted:

it wasn't as much of a problem once we were well into the windows XP days, but prior to that (dos/win95/win98 era) it was pretty common for games to save what drive letter they were installed from so that the CD check was as easy as looking for D:\GAMENAME.TXT. you'd have to reinstall the game if the CD-ROM's drive letter changed for some reason. some games were so awful as to have the drive letter hardcoded, so it would only check drive D:.


nobody directly accesses the raw /dev devices, only the OS and the mount utility care about them. if i plug in an external HD named SHAGGAR WAS WRONG, it'll always be automounted under /Volumes/SHAGGAR WAS WRONG (on OS X), and the Finder and Open/Save dialog boxes will always put SHAGGAR WAS WRONG on the side in the Devices section. it will never matter what order it's plugged in, and will never matter what external port it's connected to.

i can make a symlink to /Volumes/SHAGGAR WAS WRONG/yourmom_laffo.txt on my desktop and it will always work (so long as the drive is plugged in), even if I unplug the drive and plug it back in on a different port or plug something else in first.

on windows, if a program expects to find a file on drive D:, but the user unplugs it for some reason, plugs in a USB thumbdrive, and then plugs the first drive back in, welp, the USB thumbdrive is drive D: now.

this isnt true tho. windows assigns letters to external drives based on the type. heds are assigned the same letters when reattached and only usb drives reuse available letters. also drive labels in osx are allowed to overlap so if ounalready have a Macintosh HD the new one is mounted as Macintosh HD 2 or something even tho its displayed in the ui as Macintosh HD. Mounting drive labels is stupid because users can and should change them to make more sense and that would alter the mount path unlike drive letters which require much more effort and knowledge to change. drive letters are more consistent and less error prone.

although more than 1 hdd is an edge case for osx so its probably not a big deal to use labels. you can just tell the user they were wrong to rename it.

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band
if you're writing c# and have to do something involving the filesystem, can you use proper slashes as path separators, or are you still stuck using backslashes? (i understand most applications will take either these days, but i was wondering about c# programs)

Shaggar
Apr 26, 2006

my stepdads beer posted:

mounting as folders should be the default

mounting as folders would be a retarded default cause users would have no idea why their data disapeared when they removed a drive.

Shaggar
Apr 26, 2006

prefect posted:

if you're writing c# and have to do something involving the filesystem, can you use proper slashes as path separators, or are you still stuck using backslashes? (i understand most applications will take either these days, but i was wondering about c# programs)

you can use wrongslashes but most people just use backslashes out of habit. / and c:\ mean the same thing too.

MononcQc
May 29, 2007

URIs and file paths would totally benefit by not being flattened in a string and instead be some kind of actual data structure :v:

Stringent
Dec 22, 2004


image text goes here

MononcQc posted:

URIs and file paths would totally benefit by not being flattened in a string and instead be some kind of actual data structure :v:

:2bong:

Deacon of Delicious
Aug 20, 2007

I bet the twist ending is Dracula's dick-babies

Shaggar posted:

just tell the user they were wrong

zokie
Feb 13, 2006

Out of many, Sweden

Shaggar posted:

you can use wrongslashes but most people just use backslashes out of habit. / and c:\ mean the same thing too.

I see why you belong in this thread. The correct answer is to use Path.Combine.

hubris.height
Jan 6, 2005

Pork Pro
i have my hdd for steam library set to a: because gently caress floppy dicks

Shaggar posted:

C# code:
File.AppendAllLines(@"c:\utuburls.txt", doc.DocumentNode.SelectNodes("//a[@href]").Select(x => x.Attributes["href"].Value).Where(href => href.Contains("youtube")));

neat.

i could have it print to debugger but i want the tubes urls to be written to a file in case i need to use something else to turn utub urls into a playlist

also, i'm p sure unless you start visual studio as admin you can't write to the root drive

power botton
Nov 2, 2011

MononcQc posted:

URIs and file paths would totally benefit by not being flattened in a string and instead be some kind of actual data structure :v:

i really wish winfs and RDBMS file systems caught on :(

hubris.height
Jan 6, 2005

Pork Pro
trying to firgure out how to use the bbusername/bbpassword cookie stuff to log in to the forums before pulling the site. i found this cool method:
code:
public HtmlAgilityPack.HtmlDocument Load(string url, string proxyHost, int proxyPort, string userId, string password)


that overloads htmldocument load to take all this bonus info. however, this poorly documented project leaves me with the question "is the userID and password actually a proxy user id / password?" am i correct in thinking this? can i use this for my purposes?

Notorious b.s.d.
Jan 25, 2003

by Reene

MononcQc posted:

I'm just surprised Notorious b.s.d. isn't telling people to do it in Java or something

scala can be invoked as a script interpreter with a shebang line and bash preamble (to set up your classpath) and i actually use it that way often. i've even written nagios checks with scala-as-scripting-language

i don't recommend it for 1-liners though.

Adbot
ADBOT LOVES YOU

Notorious b.s.d.
Jan 25, 2003

by Reene

MononcQc posted:

URIs and file paths would totally benefit by not being flattened in a string and instead be some kind of actual data structure :v:

common lisp's native file i/o is like this. it's really unpleasant. they were trying to abstract out the implementation details of mainframe/lispM/unix file io and ouch ouch ouch ouch ouch

  • Locked thread