Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×

Comment: Compactness and Readability (Score 0, Flamebait) 180

by UnknownSoldier (#49356351) Attached to: Ask Slashdot: What Makes Some Code Particularly Good?

Let's let at the clusterfuck of Boost's CRC code
1109 lines of over-engineered C++ crap for a simple CRC32 function!?!?

Now compare that to these simple 27 lines of C/C++ code.

#include <stdint.h>
 
const uint32_t CRC32_REVERSE = 0xEDB88320; // reverse = shift right
const uint32_t CRC32_VERIFY = 0xCBF43926; // "123456789" -> 0xCBF43926
/* */ uint32_t CRC32_Table[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // i.e. 0x00000000, 0x77073096,
 
void crc32_init()
{
  for( short byte = 0; byte < 256; byte++ )
  {
      uint32_t crc = (uint32_t) byte;
      for( char bit = 0; bit < 8; bit++ )
          if( crc & 1 ) crc = (crc >> 1) ^ CRC32_REVERSE; // reverse/reflected Form
          else /* = 0*/ crc = (crc >> 1);
      CRC32_Table[ byte ] = crc;
  }
  if( CRC32_Table[8] != (CRC32_REVERSE >> 4))
      printf("ERROR: CRC32 Table not initialized properly!\n");
}
 
uint32_t crc32_buffer( const char *pData, uint32_t nLength )
{
  uint32_t crc = (uint32_t) -1 ; // Optimization: crc = CRC32_INIT;
  while( nLength-- > 0 )
      crc = CRC32_Table[ (crc ^ *pData++) & 0xFF ] ^ (crc >> 8);
  return ~crc; // Optimization: crc ^= CRC32_DONE
}

Typical bloated code solves some theoretical "general purpose" solution. Good code does one thing well:

It communicates clearly what it is trying to do.

_When_ was the last time you actually needed a different CRC function from the standard 32-bit one?

+ - Amazon Requires Non-Compete Agreements...For Warehouse Workers

Submitted by Rick Zeman
Rick Zeman (15628) writes "Amazon, perhaps historically only second to NewEgg in the IT nerdling's online shopping heart, not only has treated their warehouse workers to appalling working condtions, but they're also making them sign a non-compete agreement for the privilege. Excerpt from the agreement:
During employment and for 18 months after the Separation Date, Employee will not, directly or indirectly, whether on Employee’s own behalf or on behalf of any other entity (for example, as an employee, agent, partner, or consultant), engage in or support the development, manufacture, marketing, or sale of any product or service that competes or is intended to compete with any product or service sold, offered, or otherwise provided by Amazon (or intended to be sold, offered, or otherwise provided by Amazon in the future)...."

+ - Did Neurons Evolve Twice?->

Submitted by Anonymous Coward
An anonymous reader writes "When Leonid Moroz, a neuroscientist at the Whitney Laboratory for Marine Bioscience in St. Augustine, Fla., first began studying comb jellies, he was puzzled. He knew the primitive sea creatures had nerve cells — responsible, among other things, for orchestrating the darting of their tentacles and the beat of their iridescent cilia. But those neurons appeared to be invisible. The dyes that scientists typically use to stain and study those cells simply didn’t work. The comb jellies’ neural anatomy was like nothing else he had ever encountered.

After years of study, he thinks he knows why. According to traditional evolutionary biology, neurons evolved just once, hundreds of millions of years ago, likely after sea sponges branched off the evolutionary tree. But Moroz thinks it happened twice — once in ancestors of comb jellies, which split off at around the same time as sea sponges, and once in the animals that gave rise to jellyfish and all subsequent animals, including us. He cites as evidence the fact that comb jellies have a relatively alien neural system, employing different chemicals and architecture from our own. “When we look at the genome and other information, we see not only different grammar but a different alphabet,” Moroz said."

Link to Original Source

Comment: Re:Check their work or check the summary? (Score 1) 476

by UnknownSoldier (#49339225) Attached to: No, It's Not Always Quicker To Do Things In Memory

> Optimizing memory is a dying skill,

It is now called Data Orientated Design.

Google+ Group
* https://plus.google.com/+Datao...

Data-Oriented Design and C++
  * https://www.youtube.com/watch?...

Typical C++ Bullshit
  * http://macton.smugmug.com/gall...

Pitfalls of Object Oriented Programming
* http://research.scee.net/files...
* http://www.slideshare.net/royc...

+ - Microsoft to Rename Modern Apps "Windows Apps"

Submitted by jones_supa
jones_supa (887896) writes "While fumbling with the new application platform for Windows, Microsoft has juggled with different names for the applications: Metro, Modern UI, Windows Store apps, universal apps. Going forward, these apps will be called "Windows apps", Microsoft explained during the Developing for the Windows 10 Hardware Platform session at WinHEC 2015. This is what the future of Windows is all about, and these apps are expected to completely supplant desktop applications. A "Windows app" can run on every device category: phone, PC, Xbox, IoT, and on more obscure devices like the HoloLens. For now the classic Win32 platform will remain fully supported on x86 PCs, but Microsoft is taking a "legacy" attitude towards it."

+ - We know where you've been: Ars gets 4.6M license plate scans from the Oakland PD-> 1

Submitted by schwit1
schwit1 (797399) writes "One citizen demands: "Do you know why Oakland is spying on me and my wife?"

If you have driven in Oakland any time in the last few years, chances are good that the cops know where you’ve been, thanks to their 33 automated license plate readers (LPRs).

In response to a public records request, Ars obtained the entire LPR dataset of the Oakland Police Department (OPD), including more than 4.6 million reads of over 1.1 million unique plates between December 23, 2010 and May 31, 2014. The dataset is likely the largest publicly released in the United States—perhaps in the world.

After analyzing this data with a custom-built visualization tool, Ars can definitively demonstrate the data's revelatory potential. Anyone in possession of enough data can often—but not always—make educated guesses about a target’s home or workplace, particularly when someone’s movements are consistent (as with a regular commute)."

Link to Original Source

Comment: Re:PHP is fine (Score 1) 177

by UnknownSoldier (#49331377) Attached to: Modern PHP: New Features and Good Practices

Ad hominem fallacy. The reasons _why_ I hate PHP are irrelevant.

PHP is a shit design language. Education is the only way to get people to see its problems.

> They either don't notice it,

Typical head in the sand. Ignoring a problem doesn't make it go away.

> work around it,

Sometimes you can, however one can't work around fundamental inconsistency embedded in the design.

> or work in the language with such a level of abstraction that they are not a problem.

Exactly; They use a better designed language.

+ - US Government Doesn't Want You to Know How to Make a Hydrogen Bomb 3

Submitted by HughPickens.com
HughPickens.com (3830033) writes "The atom bomb — leveler of Hiroshima and instant killer of some 80,000 people — is just a pale cousin compared to the hydrogen bomb, another product of American ingenuity, that easily packs the punch of a thousand Hiroshimas. That is why Washington has for decades done everything in its power to keep the details of its design out of the public domain. Now William J. Broad reports in the NYT that Kenneth W. Ford has defied a federal order to cut material from his new book that the government says teems with thermonuclear secrets. Ford says he included the disputed material because it had already been disclosed elsewhere and helped him paint a fuller picture of an important chapter of American history. But after he volunteered the manuscript for a security review, federal officials told him to remove about 10 percent of the text, or roughly 5,000 words. “They wanted to eviscerate the book,” says Ford. “My first thought was, ‘This is so ridiculous I won’t even respond.’ ” For instance, the federal agency wanted him to strike a reference to the size of the first hydrogen test device — its base was seven feet wide and 20 feet high. Dr. Ford responded that public photographs of the device, with men, jeeps and a forklift nearby, gave a scale of comparison that clearly revealed its overall dimensions.

Though difficult to make, hydrogen bombs are attractive to nations and militaries because their fuel is relatively cheap. Inside a thick metal casing, the weapon relies on a small atom bomb that works like a match to ignite the hydrogen fuel. Today, Britain, China, France, Russia and the United States are the only declared members of the thermonuclear club, each possessing hundreds or thousands of hydrogen bombs. Military experts suspect that Israel has dozens of hydrogen bombs. India, Pakistan and North Korea are seen as interested in acquiring the potent weapon. The big secret the book discusses is thermal equilibrium, the discovery that the temperature of the hydrogen fuel and the radiation could match each other during the explosion (PDF). World Scientific, a publisher in Singapore, recently made Dr. Ford’s book public in electronic form, with print versions to follow. Ford remains convinced the book “contains nothing whatsoever whose dissemination could, by any stretch of the imagination, damage the United States or help a country that is trying to build a hydrogen bomb.” “Were I to follow all — or even most — of your suggestions,” says Ford, “it would destroy the book.”"

+ - Southern California Edison Lays off 500 workers- replaces with H1B Visa workers.->

Submitted by Maxo-Texas
Maxo-Texas (864189) writes "California Edison workers are being laid off and replaced with Infosys H1B visa workers. They will be required to train their Infosys replacements in order to receive their severance pay and they will be required to sign NDA's in order to receive their full payment.

This violates the premise of H1B visa's-- that the workers are needed to fill jobs for which employees cannot be found. The story is being widely reported on conservative talk radio as well so this event may actually bridge the political gap and bring about bipartisan corrections to the H1B programs

Full details:
http://www.computerworld.com/a..."

Link to Original Source

"Be *excellent* to each other." -- Bill, or Ted, in Bill and Ted's Excellent Adventure

Working...