Stories
Slash Boxes
Comments

SoylentNews is people

Log In

Log In

Create Account  |  Retrieve Password


There is no bottom

Posted by DannyB on Friday January 17 2020, @07:56PM (#4909)
49 Comments
Nexuses

I have become convinced.

There is no bottom.

There is no low that is too low. No ethical boundary that cannot be crossed. No crime that cannot be ignored. No profanity or taking the Lord's name in vain that cannot be hand waved away.

Trump really could parade naked in the streets, with hookers and drugs, shoot some or several random persons in the middle of the street in broad daylight . . .

and his band of FoxNews fed mouseketeers would just wave it away. Fake News! It didn't happen. We won't hear any witnesses. No evidence. Witch Hunt! Anyone who says it happened is a liar! I cannot recall! I would have to check my records. The trial judge is working closely with Trump's lawyers to fix this, so no worry.

The evangelicals cover their eyes or look the other direction. Justify and rationalize it by inches at a time.

Good is called evil and evil is called good.

We are all numbed to the bizarre and irrational. Reporters are afraid to report on the worst of Trump's behavior because it is so bad that they fear people will think they are biased against Trump merely for telling the simple facts. Because it sounds so bad that in normal times you would think the press is biased. Comedians make jokes about it, but it's not even funny any more. Just boring every day events.

Hear no evil, See no evil, Speak no evil.

Its fashionable to hate Java

Posted by DannyB on Wednesday January 15 2020, @10:27PM (#4904)
76 Comments
Code

People who don't like Java shouldn't use it. Use something more to your liking.

Java is not perfect (shocker!)

Java has warts from being designed in the early 90's and released later in the 90's. Computers and their limitations were different back then.

The Java runtime is a big disk footprint. At least if you use other languages, and don't realize what all you're getting in this fat package.

Java likes lots of memory.

Java programs start up slowly.

Java is not ideal for all programming tasks. (shocker! I can't write my bootloader or micro controller code in Java!)

Java (rather the JVM) does not have tail call optimization.

Java has Garbage Collection (GC). (Some people see this as a problem. If GC is a problem, you probably don't want Java, nor the JVM runtime system.)

Terminology clarification

From here on I'll try to use Java to mean a programming language that you write source code in, and compile it to JVM bytecode. I'll use JVM bytecode to mean the object code from compiled source languages, including the Java language. I'll use JVM to mean the Java Virtual Machine, that is the runtime system which executes JVM bytecode -- no matter what source language it was compiled from.

Virtues of Java / JVM -- Garbage Collection

Java and the JVM have Garbage Collection (GC) ! Free clue: all modern languages now have GC. Visual Basic. Visual FoxPro. JavaScript. Python. Arguably: Perl. C#. Erlang. Go. Lisp like languages. Prolog, Haskell and other higher order languages. And many others.

If GC is so horrible, why do so many languages have it? Some will say because programmers do not know how to manage memory. But that is not true. Speaking for myself, I wrote untold amounts of Pascal in the 80's, with complex data structures and understand quite well how to manage memory, avoid, detect and deal with memory leaks.

I would point out: Greenspun's tenth rule

Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.

(and that includes garbage collection along with other higher order programming idioms)

JVM GC is not comparable to other systems like Python or Node.js. Modern JVMs can run with Terabytes of memory and hundreds of cpu cores and have only 1 ms GC pause times. (Please call me when your Python or Node.js or Go can do that!)

Java offers multiple GCs to choose from. Each one has various tunable knobs and dials. Instrumentation (like VisualVM) can give you insight into the GC behavior of your large program that has many third party libraries so you can tune accordintly. (again, call me when your system can do that)

Red Hat's Shenandoah, and Oracle's ZGC are the current new state of the art GCs on Java. Both of these are open source in the latest Open JDK builds.

Multiple languages

Multiple languages compile to JVM bytecode. Not just Java. Kotlin. Scala. Clojure. And other languages run on the JVM (Groovy, Jython, even C).

Cross Platform

Java object code (JVM bytecode) is cross platform. I can take a desktop GUI program written in Java using Swing in 2004 on Windows, and run that object program on a Raspberry Pi (different OS) which did not even exist when the program was written. It runs perfectly.

Java programs, especially servers, which have no GUI are extremely cross platform.

The only pain points I can think of is (1) serial port communication, (2) doing extremely platform specific things (uh, say, accessing /proc or /sys). There are some nice cross platform solutions for serial communication; I had to use one a few years ago. I had to deal with whether to use names like /dev/ttyS1 or COM3:.

Compiled JVM bytecode runs on amazingly diverse platforms. From Blu Ray players to giant IBM Mainframes with seemingly strange architectures. Smart cards, car infotainment, single board Linux (eg, "Pi" type boards), and who knows what else.

Speed, yet dynamic access

The JVM runtime interprets JVM bytecode. It dynamically profiles every function to see how much CPU time it is getting. (How "hot" it is) Hot functions are immediately compiled (C1 compiler). C1 rapidly compiles the JVM bytecode into unoptimized native code. The function is added to a list to be compiled later by the C2 compiler.

Later, when the C2 compiler comes along, it spends significant time and effort recompiling that function into highly optimized native code.

C2 is one of, if not the most sophisticated compiler on the planet. The product of a couple decades of much research. It has only one source language to compile: JVM bytecode. It has multiple target instruction sets to compile to.

C2 compiles to the instruction set of the actual hardware it is running on. Something that an ahead of time C compiler, for example, cannot know in advance. C2 knows which instruction set extensions your actual processor has. Does your processor have SSE, MMX, ISSE instructions?

C2 also has global knowledge of the entire linked runtime program. Also something that a C compiler does not have advance knowledge about. C2 could know that a certain function could be called efficiently in two different ways from two other parts of the program, and compile two separate versions accordingly.

All method references in Java (JVM) are "virtual" (to use C++ terminology). But in practice many or most methods do not actually need to be virtual. C2 can (and does) prove that a method is never called in a way that it needs a vtable entry, and can compile efficiently accordingly. The programmer never needs to make decisions about whether functions should be virtual or not.

Research has shown that in many cases even when a virtual polymorphic function is called, from a specific call site, it often always calls the same concrete function at that call site. The new GraalVM takes advantage of this and cache which virtual function to call for next time. If at this particular call site (where function is called from) this time a different virtual method will be invoked, then a runtime error occurrs, is handled, the right virtual function computed and it is now cached.

C2 aggressively inlines code for performance. It is after speed not small code size. Memory is cheap. You can never get back time.

Now suppose that YOUR function A calls MY function B. When C2 compiles your function A, it may inline my function B inside the native code of your function to avoid function call overhead. Now suppose that the class which has my function B is dynamically reloaded. Oh no! Your function A now has a stale version of my function B inside of it! Not to worry, the JVM de-optimizes your function A back to being bytecode interpreted. If your function is still "hot" it will very soon get recompiled by C1 and then later by C2.

This "hotspot" and C1/C2 behavior is one reason why Java programs seem to "warm up". They start up slowly and then within a few minutes become very fast. If you have a program which needs to be restarted very infrequently, runs for a very long time between restarts, then this is for you! (example: long running servers) If you have a program that is rapidly and frequently started from the command line and needs to do something very quickly and exit, then this is definintely NOT for you!

When running a 64bit JVM with less than 32 GB of memory, JVM can do a pointer optimization trick. It can use 32-bit pointers instead of 64-bit pointers. All objects start on 8 byte boundaries (on x86/x64). So the low three bits of a 32-bit pointer are always zero. So why have them. Thus a 32-bit poiner can reference objects in 32 GB of memory. Next time you start the program with more than 32 GB of memory, it will have to use normal 64-bit pointers everywhere.

GC is the lubricant between different code libraries

In C or C++ there may be different memory management disciplines. Different calling conventions. Different ideas of responsibility about who "owns" something and is responsible to dispose of it. Even different allocators. Are there instances where glue code is needed to adapt the conventions of one code base with another that are both used in the same program?

An overlooked and maybe little known benefit of GC is that these problems go away. Everything uses one memory management discipline. Same calling conventions. A library written two decades ago can be passed data structures from another library that was only recently written.

GraalVM

This is so new I am not very familiar with it.

The JVM runtime is written in C++. Such a complex runtime, with GC, hotspot, C2/C2, native code interfaces, dynamic code reloading, etc is getting hard to maintain. Especially with multiple GCs to choose from. One of the things GraalVM does is let much more of the JVM be written in Java. Graal VM can also run code from LLVM, and other languages like R, Python, etc. So your C, Python and Java code could call functions within each other in the same runtime, and pass parameters transparently.

Concluding remarks

I know it is fashionable to hate Java. Yet Java is consistently year after year the number one language on various job sites and programming language surveys. Java is used by many major corporations. Red Hat, Oracle, SAP, IBM, Azul Systems and others see enough major players needing commercial support that they all seem to have a very tidy business with Java. Amazon and Microsoft Azure both bend over backwards to provide optimized Java runtime systems for these major customers with bucketloads of money. Microsoft recently partnered with Azul to provide their optimized runtine for free to Azure Java users. They did't do that for no reason.

Java must be doing something right. It is the best at what it does. There is nothing else that comes close to doing what I have described above.

Even if it is not right for you.

It's here to stay for a long time. Even if you hate it. But why hate it? Just don't use it.

If there were one perfect programming system for every use, we would all be using it already.

The debate was boring and stupid.

Posted by Arik on Wednesday January 15 2020, @01:25PM (#4902)
9 Comments
News
And frankly just painful to watch.

But to save the day; Tulsi Gabbard, Dennis Kucinich, Stephen Kinzer, and Lawrence Lessig had a real fact-based discussion of current events.

Here are some highlights: https://www.youtube.com/watch?v=7wrf4meoydI

Full event: https://www.youtube.com/watch?v=s-W9b-_K_Xo

Albert Einstein: Why Socialism? (1949)

Posted by Mojibake Tengu on Monday January 13 2020, @06:44PM (#4899)
38 Comments
Techonomics

Albert Einstein, no doubts about it in me, is the most disruptive person of the all twentieth century. No statesmen, no industrialists, no military nor religious leaders of any particular faction had so much effective impact on humanity than this genius with disordered personal life had.
Einstein's theories brought us the new understanding of nature, the atomic age, a historical effect at planetary scale.
Most important of all, his work in physics of electron is conceptually fundamental to the advanced technology built upon that, everything what we have today: electronics and computers, appliances, toys, weapons. Nuclear energy sources and strategic weapons being only in second of that. And his Theory of Relativity brough us slightly better understanding of the Universe.

I got an idea it may be interesting to understand what a genius like him thought about organization of human society. Because, this is a structural problem, like those others he had solved. So I duckducked about it a bit and... was surprised greatly.
Einstein's article Why Socialism? was published in the first number of a Monthly Review magazine, in May 1949 edition, at the verge of the Cold War starting between former war Allies.

It is a well worthy reading, no matter if one accepts or rejects the concepts mentioned, partly or completely. Because, we are not out of this structural problem yet. Actually, we bogged down into it recently even more deeply than before.
https://monthlyreview.org/2009/05/01/why-socialism/

Let me qoute just some of the most protruding observations:

The economic anarchy of capitalist society as it exists today is, in my opinion, the real source of the evil.

Private capital tends to become concentrated in few hands, partly because of competition among the capitalists, and partly because technological development and the increasing division of labor encourage the formation of larger units of production at the expense of smaller ones. The result of these developments is an oligarchy of private capital the enormous power of which cannot be effectively checked even by a democratically organized political society.

Unlimited competition leads to a huge waste of labor, and to that crippling of the social consciousness of individuals which I mentioned before.

This crippling of individuals I consider the worst evil of capitalism. Our whole educational system suffers from this evil. An exaggerated competitive attitude is inculcated into the student, who is trained to worship acquisitive success as a preparation for his future career.

Clarity about the aims and problems of socialism is of greatest significance in our age of transition. Since, under present circumstances, free and unhindered discussion of these problems has come under a powerful taboo, I consider the foundation of this magazine to be an important public service.

I appreciate the Monthly Review survived to the Internet Age, to bring this gem to us.

C=64... smartphone??

Posted by shortscreen on Friday January 10 2020, @10:08AM (#4893)
1 Comment
Hardware

I just ran across the mega65 project (warning: website is a JS disaster), which appears to be another FPGA-based fantasy remake of an '80s microcomputer (following the previous C=One, One-Chip-MSX, Minimig, and other such doohickies).

There are photos of a portable version which is supposed to have 4G connectivity. What the!?

The art of manliness

Posted by The Mighty Buzzard on Wednesday January 08 2020, @11:30AM (#4890)
21 Comments
/dev/random

If you think you're doing it right, I invite you to consider that this thirteen year old girl has bigger balls than you.

Attack on Iran was predicted in 2011

Posted by DannyB on Tuesday January 07 2020, @02:19PM (#4885)
52 Comments
News

The president attacking Iran was predicted in 2011.

https://www.youtube.com/watch?v=wSrC7-ERrE4

The prediction:

"Our president will start a war with Iran, because he has absolutely no ability to negotiate. He's weak and he's ineffective. So the only way he figures he's going to get re-elected, and as sure as you're sitting there, he's going to start a war with Iran. So. I believe that he will attack Iran. Sometime prior to the election. Because he thinks that's the only way he can get elected. Isn't it pathetic."

Kataomoi

Posted by Mojibake Tengu on Monday January 06 2020, @12:05PM (#4879)
0 Comments
/dev/random

I have no words. yurisa.

https://www.youtube.com/watch?v=6YS5obcQy4U


Unrequited Love also known as One-sided Love, originally song by Aimer, music and lyrics by Uchisawa Takahito, a leader of the rock band androp.
My impression is this yurisa's cover is much better performed than Aimer's original.

Q and the Real “Deep State”

Posted by mcgrew on Saturday January 04 2020, @03:25PM (#4874)
94 Comments
/dev/random

I met the infamous Q first online at K5 before meeting him in person over the July fourth weekend in 2003. He was a white guy between 25 and 35, driving a small black sedan, dressed in black and wearing a black hat, which covered his hair. I wrote about it in the book The Paxil Diaries.
        The “Deep State” nonsense started as a joke on K5. Since Trump started running for president an awful lot of people have started taking it seriously.
        The thing is, there really is a secret deep state, but George Soros has nothing at all to do with it, and it’s hiding in plain sight.
        The Deep State is the people who are decrying it—the very rich who seek to transform America into a Fascist nation. They legally bribe the politicians with “campaign contributions”, who are wholly dependent on them. A politician will do what the NRA, or the coal companies, or the telecommunications companies, any of the giant businesses want or they won’t be re-elected. Period.
        THAT is the deep state. If you don’t like the idea of America being run by it, stop voting for party, but pay attention to how your representatives vote. Oh, it helps to not be foolish enough to believe advertising and fraudsters. The Deep State has psychologists and sociologists on staff who know how to make you do anything they want you to.
        For example, President Trump pushed mining coal “for jobs” despite the fact that the coal industry is on its last legs; coal is just too dirty and expensive. HE is the deep state, lying like the deep state always does. Jobs? Those coal miners would be far healthier and financially better off say, building windmills or installing solar panels.
        And why do I peg Trump as Mister Deep State? Because rather than draining the swamp, he has staffed all the regulatory agencies with heads of or lobbyists for the very industries they’re supposed to be regulating.
        He hires foxes to guard America’s hen houses. And some of you will be foolish enough to vote for the Nazi again.
        And speaking of Nazis, you should be told that racism is a tool of the rich to keep the rest of us at each others’ throats so we won’t notice who it is who’s holding us down. It isn’t black people, or white people, or Asian people, or Jewish people, it’s rich people.
        The deep state got the rabid racist elected President. The deep state isn’t partisan; it got the hugely unpopular Hillary Clinton nominated, and Deep State agents infiltrating Russia worked to make her even more unpopular. Right before the election James Comey put the final nail in the coffin when, as Wikipedia put it, “Many Clinton supporters claim his decisions [to say she was innocent of wrongdoing without actually exonerating her] not long before the 2016 election might have cost her the presidency.”
        Face it, Trump is a fraudster and a liar. And you are the butt of the deep state joke that Q started.

The perception thing

Posted by khallow on Wednesday January 01 2020, @03:15PM (#4867)
56 Comments
Rehash
When we talk about real world stuff, here's my hierarchy of viewpoint:

evidence and reasoned argument > biased expert opinion > your uninformed feelings.

For example, we have this quip from turgid in his complaints about the Brexit thing and his life at present:

We are leaving the European Union, the world's most successful and advanced trading bloc, for no discernible reason, on 31st January. Remain has lost the battle.

Sure, I can see good reason for turgid to be sore about this. It's a drastic, muddled change founded on rather flimsy grounds. But does he really not know/discern what his fellow people think? It's not like they're being ninja-stealthy about this. And when I brought up some reasons that came to my mind, he had this to say:

Every single thing you have posted in that list has been refuted many times.

So not only has turgid discerned such reasons, he's familiar enough with them to know of counterarguments. This led to my observation:

The known reason has been "refuted", thus, it can no longer be "discerned". Who else thinks like this?

This is an endemic sickness at SN. Many people have done so. Barbara Hudson came up with this observation in the same thread:

Sometimes it's hard to distinguish between libtard libertarians and contard conservatives.

The repeated use of "tard" indicates she doesn't really care enough to look. Is something "hard", if you're not even trying? Then in the Rwanda opioid story, there were people telling us their feelings about what capitalism (and the US Libertarian Party) should mean.

[sjames:] Seems to me. I haven't heard anything from a Libertarian candidate about abolishing the FDA, prescription laws, controlled substances, etc other than marijuana in a long time. Some libertarians (small L), yes, but not the party.

Why are we to expect that sjames would hear of such things from the party. Does he comprehensively monitor their communications? As I noted, a near trivial web search would have fixed his ignorance on the matter.

A final example here is UnixNut's hypothetical viewpoint of the "far richer and more powerful" in order to rationalize Russian meddling in their part of the internet. Suddenly, we're supposed to care more about a viewpoint, clearly at odds with our own, merely because it supposedly belongs to a bunch of very powerful people?

My take on all this is that it is completely irrelevant how things seem to you, particularly when it devolves to talk about things you see, but claim not to see; or things you don't care about enough to see; or hypothetical viewpoints where you're speculating about what an imaginary entity sees. This is the worst sort of navel gazing and it all happened yesterday.