Better HN
topnewbestaskshowjobs
Log inSign up

eksith

5,196 karma · joined Dec 8, 2012 (13y ago) · 1,580 submissions

I should have been a carpenter

Twitter: @eksith

Email: reksith at google's email thingy.

Web: eksith.com | eksith.neocities.org

When engaging in a pointless argument on HN, please heed the following advice: https://news.ycombinator.com/item?id=5976026

Submissions

comment 12y ago · link · parent

It's worth noting that this model works quite well for the vast majority of client facing applications out there.

I.E. Things categorized by tags or groups where 1-to-n relationships are necessary. Of course, the extreme of this is EAV (Entity Attribute Value) which I would limit to meta/taxonomy data for performance reasons.

But for information where the labels (or quantity) aren't known before input are easier to deal with in normalized databases.

E.G. Getting metadata on a specific entry with no prior knowlege of said data except parent id:

  SELECT id, label, content FROM meta WHERE id IN (
    SELECT meta_id FROM posts_meta WHERE post_id = :id
  );
Or if you're using Postgres, you can return the metadata as an associative array. E.G. http://stackoverflow.com/a/11942726

The following is an excerpt from the actual schema I used on a very simple forum that ran on SQLite for years before switching to Postgres fairly recently. The normalization (varying forms) afforded a lot of flexibility. Maybe someone will find it useful.

  CREATE TABLE posts (
  	id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
  	created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, 
  	updated_at DATETIME DEFAULT NULL, 
  	title VARCHAR NULL,
  	summary TEXT NOT NULL, 
  	body TEXT NOT NULL, 
  	plain TEXT NOT NULL, 
  	quality FLOAT NOT NULL DEFAULT 0, 
  	status INTEGER NOT NULL DEFAULT 0, 
  	reply_count INTEGER NOT NULL DEFAULT 0, 
  	auth_key VARCHAR NOT NULL 
  );
  
  
  CREATE INDEX idx_posts_on_status ON posts ( status );
  CREATE INDEX idx_posts_on_created_at ON posts ( created_at );
  
  CREATE VIRTUAL TABLE posts_search USING fts4 ( search_data );
  
  CREATE TABLE posts_family (
  	parent_id INTEGER NOT NULL, 
  	child_id INTEGER NOT NULL, 
  	PRIMARY KEY ( child_id, parent_id )
  );
  
  CREATE TABLE taxonomy (
  	id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
  	label VARCHAR NOT NULL, 
  	term VARCHAR NOT NULL, 
  	created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, 
  	updated_at DATETIME DEFAULT NULL, 
  	status INTEGER NOT NULL DEFAULT 0
  );
  
  
  CREATE TABLE posts_taxonomy (
  	post_id INTEGER NOT NULL, 
  	taxonomy_id INTEGER NOT NULL, 
  	PRIMARY KEY ( post_id, taxonomy_id ) 
  );
  
  CREATE TABLE taxonomy_family (
  	parent_id INTEGER NOT NULL, 
  	child_id INTEGER NOT NULL, 
  	PRIMARY KEY ( child_id, parent_id )
  );
  
  CREATE TABLE meta (
  	id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
  	label VARCHAR NOT NULL, 
  	parse_as VARCHAR NOT NULL DEFAULT "text", 
  	content TEXT NOT NULL
  );
  
  CREATE TABLE posts_meta (
  	post_id INTEGER NOT NULL, 
  	meta_id INTEGER NOT NULL, 
  	PRIMARY KEY ( post_id, meta_id ) 
  );
  
  CREATE UNIQUE INDEX idx_taxonomy_on_terms ON taxonomy ( label ASC, term ASC );
  CREATE INDEX idx_taxonomy_on_status ON taxonomy ( status );
  
  
  -- Triggers
  
  -- Post create procedures
  CREATE TRIGGER post_after_insert AFTER INSERT ON posts FOR EACH ROW 
  BEGIN
  	INSERT INTO posts_search ( docid, search_data ) 
  		VALUES ( NEW.rowid, NEW.plain );
  	UPDATE posts SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.rowid;
  END;
  
  -- Post update procedures
  CREATE TRIGGER post_before_update BEFORE UPDATE ON posts FOR EACH ROW 
  BEGIN
  	DELETE FROM posts_search WHERE docid = OLD.rowid;
  END;
  
  CREATE TRIGGER post_after_update AFTER UPDATE ON posts FOR EACH ROW 
  BEGIN
  	INSERT INTO posts_search ( docid, search_data ) 
  		VALUES ( NEW.rowid, NEW.plain );
  	UPDATE posts SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.rowid;
  END;
  
  -- Post deletion procedure
  CREATE TRIGGER post_before_delete BEFORE DELETE ON posts FOR EACH ROW 
  BEGIN
  	UPDATE posts SET reply_count = ( reply_count - 1 ) 
  		WHERE id != OLD.rowid AND id IN (
  			SELECT parent_id FROM posts_family WHERE child_id = OLD.rowid 
  		);
  	DELETE FROM posts_family WHERE parent_id = OLD.rowid OR child_id = OLD.rowid;
  	DELETE FROM posts_search WHERE docid = OLD.rowid;
  	DELETE FROM posts_taxonomy WHERE post_id = OLD.rowid;
  	
  	DELETE FROM meta WHERE id IN (
  		SELECT meta_id FROM posts_meta WHERE post_id = OLD.rowid
  	);
  	DELETE FROM posts_meta WHERE post_id = OLD.rowid;
  END;
  
  -- Post parent insert procedures
  CREATE TRIGGER posts_family_after_insert AFTER INSERT ON posts_family FOR EACH ROW 
  BEGIN
  	UPDATE posts SET reply_count = ( reply_count + 1 ) WHERE id IN (
  		SELECT parent_id FROM posts_family WHERE child_id = NEW.rowid
  	);
  END;
  
  
  -- Taxonomy procedures
  CREATE TRIGGER taxonomy_after_insert AFTER INSERT ON taxonomy FOR EACH ROW 
  BEGIN
  	UPDATE taxonomy SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.rowid;
  END;
  
  CREATE TRIGGER taxonomy_after_update AFTER UPDATE ON taxonomy FOR EACH ROW 
  BEGIN
  	UPDATE taxonomy SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.rowid;
  END;
  
  CREATE TRIGGER taxonomy_before_delete BEFORE DELETE ON taxonomy FOR EACH ROW 
  BEGIN
  	DELETE FROM posts_taxonomy WHERE taxonomy_id = OLD.rowid;
  	DELETE FROM taxonomy_family WHERE parent_id = OLD.rowid OR child_id = OLD.rowid;
  END;

comment 12y ago · link · parent

I think the larger the craft, the more this would make sense. I had the idea of a long pontoon craft for inter waterway trade powered by solar panels based on a patent I had seen[1]

Although that was for a ground-effect craft[2], the long flat deck seemed perfect to mount solar panels. I'm not well versed in hydrodynamics, but I imagine the smaller contact area with the water would reduce drag for the initial launch phase as well.

[1] https://www.google.com/patents/US5746146

[2] https://en.wikipedia.org/wiki/Ground_effect_vehicle

123.

iOS8 will predict your passwords(qz.com ↗)

4 points · by eksith · 12y ago · discuss

comment 12y ago · link · parent

Changing databases is extremely painful if there's a fair amount of data already stored there. It doesn't matter how "database agnostic" the code was originally, there are too many edge cases that tend to become front cases over time that you have to adjust for your specific database.

But just like with MySQL, I imagine those who can migrate to another DB would do so at the first opportunity or wait for the equivalent of MariaDB to make a "drop-in replacement" in lieu of messing with their application code.

125.

Fake fingerprint fools iPhone 6 Touch ID(arstechnica.com ↗)

2 points · by eksith · 12y ago · discuss

comment 12y ago · link · parent

You're referring to :

  Mallach agreed with Surfrider that closing the gate amounted to “a change 
  in intensity of use,” That change, she said, could be considered development 
  under the law. As a result, she said in her ruling, Khosla must apply 
  for a coastal development permit if he wants to close the gate or make other 
  changes to the property.
Removing public access means he intends to use the land privately. While what constitutes "use" is debatable, these are moot points considering the laws passed in 1972 and 1976:

  prohibit homes or developments from blocking access to beaches. They essentially 
  make the entire coast, including all beach property below the mean high tide line, 
  public property.

comment 12y ago · link · parent

At the risk of sounding indelicate, why did he buy the property when the real possibility of maintaining public access was there? I can understand he wanted some peace and solitude, but if that's the case, there are options available to him as a billionaire that aren't available to the vast majority of the populace.

Access was in the law books before his purchase and claiming the 1848 Treaty of Guadalupe Hidalgo as being present before the 1972 Coastal Zone law is ridiculous in the extreme. There were many other things legal in 1848 that aren't today for very good reasons.

  "The judge could have fined Khosla $15,000 a day for every day the gates were shut, 
  but she waived all fines."
Why?

comment 12y ago · link · parent

What do you mean by this?

comment 12y ago · link · parent

They allow electronic payments for my apartment, but honestly in the US, that's very rare. Here, a check is the most acceptable way to pay for their mortgage/rent. Many people prefer it due a) A lack of an existing process to accept them (haven't setup through their bank yet) and b) A prevailing distrust of computers and the internet in general.

There are erroneous deductions that can happen if you don't keep an eye on automatic payments and there are horror stories of overbillings, overdrafts etc... so that scares away some people too.

comment 12y ago · link · parent

If the amount of energy and money spent on this level of sophistication can be devoted to actual customer service, imagine their retention. After all, it's the retention that keeps your business going. If your customers will spread the word about you too, that's far more convincing than "convincing looking" handwriting.

comment 12y ago · link · parent

Is this really a problem in the design/startup community or does it just appear to be so as judged by the loudest bunch? I'm not in the community so maybe I'm just not exposed to it directly, but these criticisms are awfully similar to what was happening before the first DotCom bust.

132.

Ashkenazi Jewish population has distinctive, yet similar genomes(arstechnica.com ↗)

2 points · by eksith · 12y ago · discuss

comment 12y ago · link · parent

Patents etc... They may have other reasons as well, like price of replacing a plug/wire vs. damaged socket. I've broken many a plug by pulling on the wire at an angle due to laziness, but luckily, nothing in the port broke.

134.

Musings on Deep Learning(medium.com ↗)

2 points · by eksith · 12y ago · discuss

135.

End User Devices Security and Configuration Guidance(gov.uk ↗)

1 points · by eksith · 12y ago · discuss

comment 12y ago · link · parent

Extremely well put!

137.

An Efficient and Provable Secure Revocable Identity-Based Encryption Scheme(plosone.org ↗)

6 points · by eksith · 12y ago · discuss

comment 12y ago · link · parent

I often wonder if our civilization is in some sort of false vacuum.

While it's true our lives are better than in the Middle Ages, stories like this and the myriad of misconceptions and outright lies that follow cannabis really demonstrate, superstition still rules law. We've clothed ourselves in technology, but not wisdom.

comment 12y ago · link · parent

The very first sentence starts with a faulty premise: "Apple has announced that it has designed its new operating system, iOS8, to thwart lawful search warrants"

Why couldn't Apple have designed it to remove itself from the burden of having to play fisherman? While it's true that there may have been moral drivers in this design decision, it makes sound business sense as well.

You can't betray what you don't know. Which is the ultimate position to take in order to be competitive in a privacy conscious world. Besides, warrants are rubber stamps now (as pointed out here and many places elsewhere) and are by no means the carefully measured moderator of state influence they may have once been.

140.

Joan Pujol Garcia(en.wikipedia.org ↗)

1 points · by eksith · 12y ago · discuss

comment 12y ago · link · parent

If you're not following their Twitter, you should https://twitter.com/atlasobscura

comment 12y ago · link · parent

I'll have to disagree on shutting down the FDA. It's purview goes well beyond medication and into medical devices as well as food production, of course. Not having a trusted authority (central or not) to vet and evaluate products for human consumption can return things to the days of Snake Oil.

I do agree that the FDA is largely ineffective at preventing people from doing things to their bodies.

Ironically, the FDA would probably be able to better serve the public if it switches roles from enforcement to advisement. Keeping food, medication/devices and production methods to FDA standard, I believe, should get a UL type verification for things we use every day. Having that stamp brings trust that the FDA has verified the efficacy of whatever it is you put into your system, however there's nothing preventing you from going non UL if you're aware of the risks.

edit_ To the folks downvoting your post, I disagree with them as well!

comment 12y ago · link · parent

Thanks! That's actually a very helpful list. It's ironic that it's posted on a large closed dataset like Quora ;)

comment 12y ago · link · parent

I'm not signing in to Facebook to read that.

comment 12y ago · link · parent

Perhaps you should scroll down a tad. The linked article discusses that same documentary extensively.

comment 12y ago · link · parent

The enemy of any crypto is naïve assumption. That's not unique to PHP, but I agree, the type system can make it worse.

comment 12y ago · link · parent

This is quite nice. The approach fits well with ubiquitous computing.

If anyone is interested in another tiny Linux version, not necessarily for education, but personal use, I'd recommend CrunchBang (based on Debian). If you have an old laptop you want to give someone or a new netbook that doesn't have a CD drive, it's very easy to install via USB.

Edit: I just realized, "tiny" doesn't quit fit CB. So let's call it efficient and simple instead.

comment 12y ago · link · parent

This is normal. If you think about it, at no point in the history of our species has another bipedal, humanoid creature shared our space (excluding perhaps early humans and Neanderthals). We're used to seeing that we're the only things that look like us.

149.

One man’s journey to restore Star Trek’s bridge(arstechnica.com ↗)

6 points · by eksith · 12y ago · discuss

1
456
53