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
mystes
May 31, 2006

Shaggar posted:

you can create maps like $aThing = @{ SomeProp="fffff", whatever="guuuuhhhhh" } and then $aThing.SomeProp or $aThing.whatever. I haven't done much diving into the syntax cause I was doing something pretty simple.
I think you need a semicolon instead of a comma for whatever reason.

Also, if you specifically need a PSObject for some reason:
New-Object PSObject -Property @{SomeProp="fffff"; whatever="guuuuhhhhh"}

In Powershell 3 you can also cast to a pscustomobject:
[pscustomobject]@{SomeProp="fffff"; whatever="guuuuhhhhh"}

So it should be safe to use the latter syntax by the year 2025.

Of course, by then everyone will probably be using something instead. I kind of like powershell but it has too many warts and having different stuff in different versions on different computers (and different os versions since lots of the commandlets aren't even part of the actual language!) is a pain.

Microsoft has too many languages and they probably should have tried to make c# work for scripting instead.

mystes fucked around with this message at 20:41 on Dec 5, 2015

Adbot
ADBOT LOVES YOU

mystes
May 31, 2006

MALE SHOEGAZE posted:

lol it's like they made objective-c flavored bash but it's still just as bad as bash
I don't know if it's quite as bad as bash. With bash it seems like it's basically impossible to write a script that will behave correctly all the time.

Powerhell is pretty powerful, and I feel like I can use it in situations where I would be reaching for something like python on linux.

On the other hand, a lot of stuff is still way to verbose, and it still has a lot of gotchas. Also, if you write something sufficiently complicated it's like you're ducktaping different weird Microsoft programming ecosystems together (.net, COM, WSH, the cmd interpreter, mmc, probably other stuff), to the point where it might get easier to just write it in some other language directly (it's easy to end up literally having to embed c# code in your powershell script for COM and .net stuff, or even writing what's effectively an IDL file embedded in c# in powershell).

This may be because I keep using powershell for stuff it's not really intended for, just because it's preinstalled everywhere now and has an interpreter, though. It mainly seems to be officially billed as a language to automate system administration tasks, rather then the default tool for everything, like bash on linux.

mystes fucked around with this message at 20:55 on Dec 5, 2015

mystes
May 31, 2006

BattleMaster posted:

sums up visual basic pretty nicely and i am still mystified as to how it ever achieved any level of professional use
Because while the language is complete garbage, other methods for making GUI windows applications at the time were pretty awful in their own right?

Edit: Beaten.

Also, in the late 90s/early 2000s, the attitude of people online was like, "Visual Basic is bad because it makes programming too easy :smuggo:" which is completely insane in multiple ways.

mystes fucked around with this message at 14:10 on Apr 10, 2016

mystes
May 31, 2006

Toady posted:

what even is the point of go
It's a garbage collected language for people who would otherwise be using C by default for unix programming.

mystes
May 31, 2006

Valeyard posted:

you can write a flask-restful python app thats like 15 lines long that acts as a proxy, so instead of hitting site.com/whatever/ you hit locahost:5000/whatever/
You could probably do it in only a few more lines of c# using HttpListener. Unless you need https, in which case add a bunch of random commands to run makecert.exe, which you do have installed, right, and then bind the ssl certificate to the port, which you have to do as Administrator (unless you have already as Administrator already specifically given the user the permissions to do this), even though as a normal user you can't even open an externally accessible port by default using httplistener anyway. Thanks Microsoft!

mystes fucked around with this message at 04:26 on Jul 27, 2016

mystes
May 31, 2006

kalstrams posted:

thinking about trying to write a simple rpg game to check out a new language. c++, c#, or java - thoughts?
Rust. Then when the next version comes out, you came write another rpg in it to check out another new language!

mystes
May 31, 2006

VikingofRock posted:

Changes between Rust versions are very minimal though? Usually it's just a few stabilizations of methods in the standard library.
I guess it's more stable now then? It seemed like before every time I looked at it they had deleted half the features from the language and changed everything since the previous time.

Edit: Oh, I guess that after they released 1.0 they stopped doing stuff like that?

mystes fucked around with this message at 06:10 on Jul 28, 2016

mystes
May 31, 2006

Skim Milk posted:

Haskell prelude: what is a string but a list of characters?

mystes
May 31, 2006

JawnV6 posted:

hi, im putting things in a text file for humans to read

it sure would be nice if i could color the text, there's some common strings that would be very nice to highlight

is there a way to spit out a .rtf or something programmatically that's not as awful as dealing with console color codes?

LordSaturn posted:

IIRC MS Word has an XML format you can write. I have done this for Excel, it's idiosyncratic but not the worst
With Word you also have the super lazy option of simply generating dumb nonstandard HTML and saving it with a .doc extension. Then, you can just set a few word-specific css attributes to get it to display in page layout mode or whatever as necessary. I obviously don't recommend this if you need to do anything complicated, but if you just need to highlight keywords this will work fine (for highlighting just do something like "<span mso-highlight:yellow>text</span>"). I have actually highlighted text using this exact method.

Depending on your requirements, you are probably much better off simply generating html for the browser though. I had a particular, stupid reason why I wanted to use word.

mystes fucked around with this message at 12:34 on Sep 1, 2016

mystes
May 31, 2006

LeftistMuslimObama posted:

have you looked at the structure of them? not only is every aspect of the document extracted into its own separate xml file within the zip, there can be arbitrarily many of each type of "xml piece". you can end up with 8 different xml files all with tracked changes or comments in them and with range ids jumbled up between them. you can get some absurdly nested codes in that xml too (tracked changes over tracked changes over tracked changes).
Plus you have to carefully manage relationships (which are stored in additional, separate files) between the XML files, so you can't just deal with the XML itself.

mystes
May 31, 2006

hobbesmaster posted:

do you have word installed? is it activated? is there a word window or dialog hiding somewhere after that open call?
I don't think it actually matters if word is running already if you instantiate it this way; you will always get a new, separate instance. I believe you have to specially use Marshal.GetActiveObject if you want to connect to an existing instance.

There are tons of reasons it could have problems, though. I'm not sure if it's smart enough not to try to display dialog boxes if you run it from interop and/or it's invisible, so if there's some sort of issue with the file you might have to set Application.DisplayAlerts appropriately to ensure it doesn't try to display a dialog box to ask if you really want to open the file.

It's going to be hard to get office com interop working 100% reliably, at least if you have to work with arbitrary files.

mystes fucked around with this message at 20:37 on Sep 2, 2016

mystes
May 31, 2006

This behavior isn't at all surprising outside the context of python. Any language that has a way to pass a value to fill a list or array is going to have a problem with object references unless the array/list constructor deep copies the object by default. This is the biggest problem in Javascript, because the Array constructor specifically encourages you to make this mistake, but other languages that allow you to easily combine copies of references will have this problem to. In terms of other plangs, I just checked powershell actually has the exact same multiplication syntax with the same problem, although ironically its horrible automatic flattening of lists actually means you have to be really emphatic about keeping nested lists to have this problem.

The main problem in the case of python is that this syntax is actually considered the idiomatic way to make copies of lists of values (e.g. strings) in python, which is dumb considering this pitfall. The smart languages simply don't provide any obvious way to pass a single object to initialize an array/list, which at least makes it more likely that people will at least accidentally instantiate multiple copies.

mystes
May 31, 2006

Captain Foo posted:

finding out that python robobrowser doesn't do javascript at all was p fun
If it's not based on phantomjs or selenium or whatever, of course it doesn't do js.

mystes
May 31, 2006

fritz posted:

why arent corporate it questions allowed
Stack exchange seems to expend more energy worrying about what questions are acceptable than actually answering questions

mystes
May 31, 2006

Captain Foo posted:

it's good tho
No it's really not. It ignores errors / missing variables by default. The parsing is crazy. Random statements can accidentally return values from the middle of functions. It really likes to flatten lists passed through the pipeline, so when you try to return a list of strings you accidentally end up with a single string, etc. It's impossible to keep track of what's a feature of a specific version of powershell, and what is instead actually coming from a specific version of Windows. With .net stuff, 1) static methods randomly have completely different syntax than other .net methods, 2) .net methods have different syntax than powershell functions. It's also pointlessly annoying to convert between c# and powershell syntax even when you're using 100% .net objects/methods. Powershell is extremely slow. Everything uses psobjects but the syntax for creating/modifying them is terrible.

Basically it's a complete mess that copied dumb antifeatures from unix shells. It may actually be worse than JavaScript in terms of making me hate dynamic typing. The only good thing is the pipeline, but it's incredibly verbose and annoying just to define a function that takes input from the pipeline. Linq is better anyway. Microsoft really should have tried to make c# or f# convenient to use as a scripting language instead.

mystes
May 31, 2006

Sapozhnik posted:

I refuse to use a non-IDE dumb text editor that consumes 400 odd MB of memory just on principle

Surely there must be some end to this madness

Soricidus posted:

so basically it's emacs but with javascript instead of lisp?

sounds both bad and pointless
The memory usage is kind of absurd but Atom and vs code are IMO good in that they allow people to add support for languages very easily, similar to emacs, but have excellent cross-platform support and provide an interface that's more like a modern ide. Obviously if you're using c# or Java there are better ides.

mystes
May 31, 2006

Shaggar posted:

still better than javascript
I might almost agree with this if it just had try/except, but the error handling was just too horrible.

mystes
May 31, 2006

Soricidus posted:

han unification is fine. we wouldn't do it today, it was kind of dumb to try to restrict unicode to 16 bits, but now we've got it it really isn't a big deal. after all, the only reason it was ever able to happen in the first place is because nobody in china, japan, or korea had ever previously wanted to distinguish those character shapes in the character sets they created for themselves to use. it only causes problems in cases where it is very, very important that a character should have exactly the right shape, but you are somehow restricted to plain text without the ability to specify a font or language.

mostly it's been hugely overblown as a political issue, because people in $asian_country don't like the idea that their writing uses the same characters as people in $other_asian_country that did something horrible at some point in its history, or because white people who don't even speak any of the languages involved want to show off by pretending they have a deeper understanding of the intricacies of ~oriental culture~ than the chinese, japanese, and korean academics who actually implemented han unification.
It's not a political issue at all. It's just a huge pain in the rear end that makes it hard to display both Japanese and Chinese correctly out of the box without rules to choose fonts based on language. For example, every Android phone sold outside of Japan displays certain characters incorrectly and you can only fix this if your phone is rooted. Most people who encounter this issue don't think "curse the white man for political unacceptable unification of these characters!" they think "why doesn't this device support Japanese properly?"

Just because there is a correspondence between the Chinese and Japanese versions of the characters doesnt mean that showing the right version is some sort of bikeshedding, and if you think it's only white people who are annoyed when the result is incorrect you have no idea what you're taking about. In theory software should be able to use information about what language is displayed to fix this, true, but the reality is that this has not turned out to have worked in many cases, and this problem would never have occurred of it weren't for the han unification.

mystes
May 31, 2006

MrMoo posted:

Presumably like the word language: Japanese top and Chinese below


Lol no.

Characters like 直 and 誤 look different but I'm on my phone and can't easily create an image showing both Chinese and Japanese versions.

mystes
May 31, 2006

LeftistMuslimObama posted:

i think the thing i hate most is that delete(obj.prop) completely removes the property from the object so in won't find it unless the prototype also has a copy of the property, but delete(arr[index]) will not completely remove the index and shrink the array to the previous index if it's the last one but will instead just change its value to undefined, forcing you to be all fucky with splice if you want to actually remove indices from the array.
The thing that seems weird to me as someone who doesn't know javascript is that it would work on properties.

mystes
May 31, 2006

Oh, delete is an operator, not a function. Of course.

mystes
May 31, 2006

VOTE YES ON 69 posted:

print line debugging is an art, and the hallmark of an excellent programmer who needs no fancy tools to aid them
I didn't know Rob Pike posted on SA.

mystes
May 31, 2006

CommunistPancake posted:

https://github.com/Jasonette/JASONETTE-iOS

they were so preoccupied with whether or not they could that they didn't stop to think if they should
I was expecting this to effectively be s-expressions in JSON, but somehow it's even worse.

mystes
May 31, 2006

MALE SHOEGAZE posted:

hey when programmers say that something is orthogonal to another thing, what the gently caress do they mean?


don't understand how to apply that to any programming concept aside from like, statistics, which isn't how people use it.
The metaphor is with the linear algebra meaning.

mystes
May 31, 2006

Luigi Thirty posted:

there's a web browser for classic Amiga that supports HTML4 and CSS2 with HTML5 support in planning stages :pwn:

it requires AGA or a video card and 32MB of RAM though so it doesn't work on my system :(
Guess you'll have to write an emulator.

mystes
May 31, 2006

cinci zoo sniper posted:

coffee cup "musings"

so, if i rewrite my python io thing into a generator (which it kinda is but it's my own hot take continuity, not something ive seen real people do elsewhere), i can then/before migrate everything to 3.5 or later, and use async/await/other asynchronous buzzwords to achieve multithreading, or make decent steps towards it?
Not multithreading, no.

mystes
May 31, 2006

cinci zoo sniper posted:

i see your point about concurrency and i know that core python cant into cores, but i had assumed someone has figured out a cython style solution for that or something
I think you can use the multiprocessing module to spawn multiple processes.

mystes
May 31, 2006

ratbert90 posted:

foo[0] = 'b' is the same as *(foo+1) = 'b'
What?

mystes
May 31, 2006

Isn't the real reason that .net core exists in the first place that even Microsoft doesn't want to have to use Windows for Azure?

mystes
May 31, 2006

Soricidus posted:

java status: tried to run our javafx app in the latest java 9 preview, got an instant crash because apparently you now need to ask specially for certain parts of the standard library using magic command-line incantations, or the jvm will just pretend it can't find them even though they're right fuckign there. added a few magic incantations copied from snack overflow, got another instant crash because apparently they've moved some classes around too. gently caress it i'll just pray it's someone else's problem by the time customers are demanding we support java 9

oh well, it's not like violently breaking backwards compatibility has ever hurt uptake of a new version of a programming language!!!
All that stuff didn't end up being opt in or something after the argument about Jigsaw or whatever it's called?

mystes
May 31, 2006

JavaFX seemed so nice, too. After this, nobody will use it though. (And probably everyone will just switch to Node.js, lol. Thanks Oracle.)

Luckily there's a lot of competition from Microsoft, which is doing a great job of providing a consistent and reliable development experience with the whole dotnet core thing.

mystes
May 31, 2006

Notorious b.s.d. posted:

js implementations using the javax.script APIs have been kicking around for a long time, but they were 3rd party (e.g. mozilla rhino)

java 8 (2014) added js as one of the default things that comes with java, so now every java is guaranteed to also have a javascript engine sitting right there
I think I had heard that it had a javascript engine, but I didn't realize it actually came with a javascript interpreter executable (jjs). That could occasionally be useful on computers that just have the JRE installed.

mystes
May 31, 2006

necrotic posted:

yaml is the better json but still worse than xml. all of them are better than csv which some jerks insist on using for seed data. With embedded json.
Which is the one that hasn't had parser vulnerabilities?

mystes
May 31, 2006

anthonypants posted:

did you know??? .xlsx is actually a .zip
It's still a pain to work with them directly, even ignoring the complexity of the actual xml content itself. I wish Office offered uncompressed flat-file formats like LibreOffice does now. They're really great for things like version control systems.

mystes
May 31, 2006

Gul Banana posted:

typescript is better, but what would be much better is if one group would just give up. we don't need two type-definition-annotation languages for javascript
Facebook is a company that just relicensed their software that has nothing to do with their business and that they were giving away for free, after adamantly insisting that they would never do so, just because the idea that some people on the internet who generate no money for Facebook might stop using it bruised their ego as elite programmers. I'm sure the announcement that they're deprecating Flow in favor of TypeScript will come any minute now.

(They also have a pointless different fork of Ocaml that appears to exist purely due to bikeshedding and NIH syndrome.)

mystes fucked around with this message at 18:16 on Oct 8, 2017

mystes
May 31, 2006

akadajet posted:

both flow and typescript are completely unnecessary. just use babel and write javascript
If your reason for using typescript is that you need an es.next to es5 transpiler, then yes typescript is probably unnecessary.

mystes
May 31, 2006

pokeyman posted:

I saw some posts about this and was completely baffled. why was it such a big deal? if a license is incompatible with your needs then you shrug and move on? if it’s your code you can relicense whenever and however you want? who gives a gently caress???
It was technically actually even dumber, because it was the patent license, and Facebook doesn't appear to have patented anything relating to React in the first place. Also, everyone was talking about moving to React clones that would presumably still violate their patents if they had.

In the end, the last straw was apparently a bunch of projects like WordPress announcing that they were going to *gasp* stop using React, after months of arguing on all sides.

OTOH, facebook also added an explicit patent license (exactly the same as the one that everyone had an issue with for React) to GraphQL which they appear to have actually patented for whatever reason, so I guess that was more of an issue except that nobody was worried about that? I guess nobody actually uses GraphQL, though, they just post on the internet about what a game changer it is.

Adbot
ADBOT LOVES YOU

mystes
May 31, 2006

Notorious b.s.d. posted:

it's atom users who are dumb and should be using vs code

  • Locked thread