Comment on: Looking to learn Java, is Netbeans still a good all around tool?
0 19 Mar 2020 22:30 u/SithEmpire in v/programmingComment on: Python overtakes Java to become second-most popular language on GitHub
The concurrency problem is by far the top of that list for me, and is why Python can fuck itself. I am ever-amazed that it became this popular for data science with its so-called GIL preventing proper threading, only allowing some emulation of it to help handle blocking I/O. 'Use multiple processes', they say -- so at least double the work for concurrency, and one process per core, each with its own copy of the data set in memory (it doesn't have proper shared memory either). Nope!
Comment on: Python: Why is this evaluating to True?
Adding a general note about this -
Strings in Python, Java etc are a clever language construct which returns an object reference. In the background, memory is allocated and populated with the character bytes, while the object itself refers to some range of that memory. The intention is to re-use the memory if it can, but the trade-off is to make it more difficult to distinguish between two identifiers/variables which contain:
* The same object reference (the purpose of is and is not)
* Different objects which refer to the same underlying range on the string heap
* Different objects with different heap ranges, but the actual character content still matches
Various language API and library API will create strings in different ways, so you almost never know which of the above it is and probably shouldn't rely on any particular behaviour quirk with it since it won't stay constant between languages or even release versions within one language.
For protection against an even bigger mess, read about how Python handles integers...
Comment on: Python is eating the world: How one developer's side project became the hottest programming language on the planet
The biggest Python mystery to me is how in the ever-loving hell it is used for so much scientific data processing when it doesn't even have real threading, only a so-called Global Interpreter Lock and a bunch of fools who hesitate and shake as they say "Uh... ehm... use extra processes instead! You'll thank us for saving you from yourself because you're all too stupid to write threaded code anyway.".
Comment on: Python is eating the world: How one developer's side project became the hottest programming language on the planet
That latter one looks like testing whether two objects are 'equal' in value versus testing whether two object references match; it shows True for low integers since they are represented by a standard set of pre-generated objects, whereas representing other integers creates a new object for it implicitly, thus two of such are different objects.
That said, it's still stupid that integers have to be backed by objects in the first place rather than having primitive types.
Comment on: So I don't know anything about coding or programming (don't work in this field) but I want to learn, where should I start?
Python is the easiest modern language to begin (and is used a lot in various industries) - look for a so-called "Hello, world" tutorial for Python.
The best way to start your exploration (as I'm sure the tutorial will say) is just to start Python from a command line and do exercises which involve typing code lines interactively (known as REPL, "read-evaluate-print loop").
Later on, when you move from exercises to putting together a simple program, you will want to move up to a decent dev environment for it (known as IDE, "integrated development environment"). This helps you manage multiple code files as part of one program, and provides useful utilities such as auto-completion and debugging (stepping though code line by line and monitoring the variables).
Comment on: Microsoft now in control of GitHub means they have the kill switch of Open Source
...that point about EEE is a league more important!
Comment on: Microsoft now in control of GitHub means they have the kill switch of Open Source
Disagree with:
- 2 - Successive commits form a crypto chain, so if any parent anywhere back in the graph is modified then it would invalidate everything after it. At worst, this would be purely a destructive action rather than being any way to insert and propagate modifications.
- The title - it's a blow for sure, though obviously Open Source does not back its entire existence on the integrity of one site such as GitHub.
The point about shadow-banning commiters (or indeed pull-requesters) is definitely a critical one.
Comment on: Thoughts on XML - possible extra shorthand for closing tags
I'm okay with JSON, though this was only about a possible enhancement to XML.
Comment on: Thoughts on XML - possible extra shorthand for closing tags
Capitalized - by the spec, tags cannot overlap.
Thoughts on XML - possible extra shorthand for closing tags
1 0 comments 06 May 2018 14:08 u/SithEmpire (self.programming) in v/programmingComment on: Linus Torvalds - "That is either genius, or a seriously diseased mind."
Things of beaty such as this are what gets lost when taking runtime optimisation for granted - not that I've looked much into how that works, though I presume 'literal arguments + stateless function = literal result' is a common rule.
Comment on: (((active users)))
If I recall, there is actually a much faster-running method to achieve Math.floor in Javascript (also more concise, though perhaps less readable). The following two lines should be equivalent:
var onlineCount = (Math.floor(Math.random()*(5000-3000+1)+3000));
var onlineCount = ~~(Math.random()*(5000-3000+1)+3000);
The bitwise NOT operator ~ performs an implicit cast to integer, and using two to undo the NOT effect while keeping the cast is faster computationally than parseInt or Math.floor.
Form which I find more aesthetically pleasing (constant term first):
var onlineCount = ~~(3000 + 2001*Math.random());
Comment on: Weird Python Integers
Mm, I do already use Field.setAccessible, Field.get, Field.set to mess with some library classes (mostly for hooking stuff which doesn't provide enough built-in ways to hook it), which should also be able to change the value of a private final field given its name.
I didn't consider methods before, but now that you mention it I really want a way to get/set a method implementation directly. The best would be if it worked with lambdas, though that will never work unless/until a method signature can be described by referring to an existing method rather than needing a separate interface for it (that being a separate feature I already knew I wanted). The dream would be e.g.:
Integer.class.getMethod("toString").set( obj -> "Object representing the number " + obj.intValue() );
Comment on: Weird Python Integers
Java does something similar to reduce object creation when the value of a primitive type such as 'int' is assigned to a variable of its class equivalent 'Integer'; the runtime always creates a set of reusable (and hopefully immutable!) Integer objects for small values.
E.g.
int a = 5; // Ordinary primitive
Integer b = new Integer(5); // New object created explicitly
Integer c = 5; // Prepared object for '5' is recalled/reused
Integer d = 555; // New object created automatically
I didn't know that Python did that, but I'm definitely passing that article on to a friend who's learning it (first programming language!). It's probably common to most runtimes which perform some sort of automatic conversion/creation.
Comment on: How to Create MySQL database for web projects
I've not used that, though it looks to be active development at the moment. The newest version should be able to handle it in some capacity such as rejecting a row if a text field is non-valid JSON, creating a virtual column which takes a value equal to a named attribute pulled from a JSON field (not sure what happens if that attribute is missing), and indexing on that pulled value.
This will probably be the next case of me finding a good use for that feature soon after finding out about it.
Comment on: How to Create MySQL database for web projects
Thumbnail is bad for 3 reasons:
- The 'php' should be lowercase
- That XML-style end tag is plain wrong; it should end with ?>
- ...or not at all; the best practice is to leave the <?php open at the end of file since it prevents accidental data being sent in included scripts (thus triggering the HTML headers being sent)
Also consider MariaDB instead.
Comment on: SQL Query to select second last row
This should be cleaner in mariadb/mysql -
Select * from table order by key desc limit 1,1
Comment on: Is Git viable for ultra-decentralized anonymous code development?
I meant it in the same context as the OP, which I presume would be 'still able to continue functioning after the feds have confiscated the server'.
Comment on: Is Git viable for ultra-decentralized anonymous code development?
I didn't say that either was (key word is 'if'); to paraphrase what I meant:
"I know that there exists at least one version control package which is decentralised, so the technology exists regardless of whether Git provides it or not."
Comment on: Is Git viable for ultra-decentralized anonymous code development?
Even if Git isn't truly decentralised, I would note that Mercurial is. Without delving into any sort of discussion about which version control package is 'better', the point is that we have the technology in the context of your question.
Netbeans is still around; some use it as it works for them, others swear by it. Personally I prefer Eclipse, where I keep instances of the C/C++ version and the Java version separately (not actually different core IDEs, just different default modules/plugins).
Incidentally, if you still have old Fortran scripts you'd like to revive then the GNU utility 'gfortran' should be able to compile them into a modern executable, either on Linux natively or via Cygwin on Windows.