There are occasions where you can't just do a straight insert. Perhaps you need to conditionally create a foreign record, or you want to format a value on insert instead of doing it directly in the CSV.
That said, I can't see how the OP actually helps me with that.
LOAD DATA INFILE can't conditionally create a foreign record, but you can certainly format a value on insert by using the SET clause, for example:
LOAD DATA INFILE 'people.txt'
INTO TABLE Person (@first, @last, date_of_birth)
SET full_name = CONCAT(LEFT(@first, 1), '. ', @last);
You can even do funky stuff like lookups:
LOAD DATA INFILE 'projects.txt'
INTO TABLE Projects(@first, @last, project)
SET person_id =
(SELECT id FROM people
WHERE name = CONCAT(@first, ' ', @last) LIMIT 1);
Much more frequently I run into the issue that my csv isn't perfectly formed. Some people have funny ideas about how to handle newlines or escape quotes/commas.
Yeah.. I'd be interested in something that does the opposite of this tool actually. LOAD DATA INFILE is a lot faster than SQL query files for heavier data
I think you'll miss the tide on this one, arguably the ice bucket thing has already peaked. But keep that code handy! you'll be able to adapt it next viral video craze with ease
Why do you assume that your attention is so valuable that developers should go out of their way to cater specifically to you? The number of people who disable JS is statistically insignificant.
You have chosen to break your web experience, you have no one to blame but yourself.
It's not really what I think would be appropriate, it's just a comparison of the length of sentences, which is totally different across legislatures. I've seen a TV report about Indonesia, where possessing drugs (if I understand it correctly) has extremley high sentences, comparable to murder here in Germany.
As someone who's fundamentally opposed to prison for white collar crimes like this, I could suggest:
* The felony record he's going to have for the rest of his life
* Massive monetary fine, to be automatically garnished from (and only payable by) any wages earned, leaving him with the equivalent of the local minimum wage until the fine is paid.
* Permanent banishment from any kind of justice system work, even as far as being a janitor in an administration building.
* Community service, on the order of weeks/months of time for each person who was unjustly sentenced.
* Felony record? He's an older, privileged white male. The only substantive effect on him will be loss of voting privileges.
* Only payable by wages earned? He's already earned a lifetime's worth of money. Why are you opposed to taking the money from his bank accounts, his house, and his net worth? Seems to me you're trying hard to put up a shield for the wealthy.
* Cynical to suggest permanent "banishment" from the justice system. I doubt there was much danger of him being appointed a judge again.
So. Why are you opposed to prison for white-collar crimes?
Background figures into a lot more than employment and voting, for one.
I hadn't considered his current financial situation - I'd be perfectly okay with taking his net worth for damages.
In case it wasn't blatantly fucking obvious, this was a list of ideas, non an exhaustive compendium of possible penalties!
Cynical? It's an assurance that he never ends up in a position to do this again.
I'm opposed to prison for white-collar crimes because I see prison as a place for segregation from society when there is no other option; specifically for violent and dangerous criminals. I don't see how locking this guy up serves any kind of justice other than the poetic type.
You got downvoted a lot but no one actually touched on the important issues: This is not a white collar crime.
The judge may not be the person physically handcuffing someone, but by improperly sentencing people to any kind of imprisonment he is directing violence at them. Someone is on the other side of the bars / glass / building and will use violence to keep the prisoner there if necessary.
Agreed. If you or I were to detain someone against their will for an extended time, its called 'kidnapping' and is a capital crime in some states. Definitely imprisonment is a violent act.
> As someone who's fundamentally opposed to prison for white collar crimes:
I'm curious. What constitutes a white collar crime in your opinion? Is it fundamentally non-violent, or is it really just a class distinction? Would you suggest prison time for armed robbery if the armed robber never hurt anybody over someone who embezzled money? What about kidnapping children but never physically hurting them? What about selling children to buyers who don't physically abuse them? Aren't those crimes very similar to selling children to a for-profit prison system?
I'm really curious what you qualify as a white collar crime and why you don't think it deserves the same level of justice as blue collar crimes.
In case you're asking this out of curiosity and not rhetorically (which your last sentence makes me think it's the latter..)
I'd say prison should exclude fundamentally non-violent crimes on the part of the person taking the action. People who have to be isolated from society, not because they've done something that violates some law, but because they've proven that they are a clear and present danger to others. Robbers, rapists, murderers, and so on.
I say this because prison has incredibly deleterious effects on the human psyche. As long as our system is about punishment rather than reform, I cannot in good faith condemn someone to that fate unless there is literally no other option to keep them from harming further.
This guy is both older and well off. There are ways to obtain restitution that don't involve having him spend years among violent criminals and ending up more damaged than when he went in.
Good job for shipping, however this project and others like it (e.g. RubyMotion) set off alarm bells for me personally.
I think the same arguments that people have against CoffeeScript apply here - it's not possible to use CoffeeScript without knowing JavaScript, and in this case it's not possible to use JavaScript without understanding the Objective-C ecosystem. At this point, this is Objective-C with a different syntax, it's not really JavaScript. Existing documentation, blog posts, stackoverflow answers etc use Objective-C, so the programmer will have to do a lot of translation in their heads. If I have to learn all the Objective-C / Cocoa APIs anyway, what am I gaining by using a different syntax?
Many people chose CoffeeScript, RubyMotion, and so on, because they address very real problems in the existing toolchain.
With RubyMotion, you gain the ability to work from the command line.
Cupertino (https://github.com/nomad/cupertino) gives you a chunk of that for pure Objective C, but with RubyMotion, I can build an app and deploy it to my iPhone without having to touch Xcode.[1]
Thats a big bonus in my book. I've got a great toolchain on the command line, and don't much care to have to change nearly every aspect of my working environment because Apple wants everybody to use their all-singing, all-dancing tool.
Being able to reuse a bunch of business logic across mobile and web is also a plus.
[1] If anybody wants to share resources on doing this in pure ObjC, I'm very interested.
It's more a matter of what language you're comfortable in.
An analogy: I'm playing with Opal (Ruby in the browser) right now and am greatly impressed. Sure, I know JavaScript - I just don't like it. I write in it regularly and still make howlers every time I do.
I'm more productive in Ruby, and that's where Opal scores for me. In this case I'm sure there are people who are more productive in JavaScript than Swift... even though the notion of anyone being productive in JS boggles me personally.
Thanks for the feedback! At this point writing a serious Cocoa app would require using the frameworks directly.
I think would be awesome if there was a way to implement native Cocoa apps with JS frameworks like Ember or Backbone. It might require some plugins but if done correctly could be interesting and maybe useful.
It may be possible convert official documentation and examples to use JS syntax. This could remove the context switch to Objective-C syntax.
can't you just imagine that a lot of people think that ruby is far more suitable/productive/readable to write applications than ObjC/Swift ? It's not just about learning this or that...
Concerning the translations you are talking about, it's completely trivial if you think the right way and don't just try to copy/paste things all the time. It's about objects, methods, interfaces, whatever the examples are written in...
Most people who choose this kind of thing are not experienced with the transpilation target, they're $language developers who want to avoid learning a new $language. But of course the main challenge when learning a new language is learning the standard libraries / eco-system, and these things don't help at all with that, they obscure it.
Another problem is that they never solve the impedance mismatch, idiomatic JS does not map cleanly to idiomatic ObjC, you end up with code that is idiomatic in neither.
"If I have to learn all the Objective-C / Cocoa APIs anyway" and "who want to avoid learning a new $language"...
Still not the issue, sure some people want to avoid to learn more, but that's not people we are interested in, those people wouldn't learn anything anyways... As you said, if you want to be very good yes you have to learn all the tools. So for good developers it's not about learning this or that, it's about learning both, and choosing the one you think is the best to write a full application.
", idiomatic JS does not map cleanly to idiomatic ObjC, you end up with code that is idiomatic in neither."
Sure, you end up with idiomatic RubyMotion. Is that an issue ?
The advantage here is that you can take a common JS codebase, abstract the platform APIs that you use out, and run it on the web and iOS. The platform layer developers will probably need to understand Cocoa and iOS well, but the other application developers might not need to so much.
Assuming the transpilation is complete and bug free. Otherwise the transpiler's ability dictates what your common code base can do. You're not able to use the full power of the language, but instead are using a less expressive subset.
For example, if your web app is using JS prototypes, and those don't work on the iOS platform (I don't know if Cupertino.js supports this or not, just an example) you're going to have (major?) refactoring to do and all of the application developers are forced to conform.
If you instead decide to run the app's JS in the interpreter, now we're simply talking about a hybrid app (like PhoneGap).
Currently some aspects of prototype inheritance are implemented. One day Cupertino.js should support an ECMA standard http://www.ecmascript.org - the Javascript spec that most web browsers implement. Once this is finished it would have "full" support of the language, minus any vendor added functionality.
I think porting apps might require some refactoring around the UI layer or adding functionality that is only exposed by native frameworks. It may be interesting to look into supporting hybrid web frameworks in the future :)
Yes, once Cupertino becomes more ECMA compliant, we will see the release of specific JavaScript frameworks targeting the creation of Cocoa apps. Kudos for Cupertino.js!
famo.us is shockingly bad IMHO. It breaks many common user interactions and goes through a load of hoops to enable "native performance" and then doesn't even get that right, I really don't understand the hype.
I don't understand this view point. If this is about Free Software, then triviality should be irrelevant, either the code is Free or it isn't. I can write an arbitrarily complicated program within their constraints, license it under a non-free license and this thing will run it.
Its not possible for humans to determine if a work qualify under copyright, so getting a computer to do it is about as impossible task as one can make it.
You can put in arbitrary heuristics and argue how many expressions, lines, or words should be required for copyright status, but then there will always be up to a judge if you guessed right.
The options here seems to either not include any detection for the copyright scope, or try invent something and hope that people will send in patches when it hit a false positive.
If you think such plugin should detect something as trivial code which it currently classify as not, send in a patch.
That's only if there is no license block. If there's a license block, it takes it at face value. So if the code really is free, putting a license statement to that effect should be enough.
I know people are going to say "what about minification", but c'mon, it's the 21st century, web servers know how to compress data streams when they send them and web browsers know how to decompress them. Minification for the purpose of saving bandwidth is a bugbear.
It's strange how age and the passage of time can change you. When I was in my 20's, I used to say things exactly like this. The further along I get into my 30's, the more I read things like this and experience the same feeling I get when reading "9/11 Truth" material.
The main goal of the GPL is to allow that programs can be understood and modified by user. A "trivial" javascript program accomplishes that, regardless of license.
The sample above is "non-trivial" according to the set of heuristics they are using, so they are just saying "if the program is not trivial, then you need to explicitly state that it is GPL for us to consider it free"
Please contact your local politician and make the copyright scope more sane. That way, a few lines won't be copyright-able and we don't need licenses for it.
Stallman talking about the web is like a Catholic priest talking about sexual intercourse: he has no practical experience with it and has no idea what he's talking about.
> Stallman talking about the web is like a Catholic priest talking about sexual intercourse: he has no practical experience with it
Completely tangentially, its quite possible to be a Catholic priest [1], have never violated any Catholic teaching or discipline, and have practical experience with sexual intercourse. Catholic priests can't get married, and men usually can't become priests in the Latin Rite if they are currently married [2], but widowers can be ordained priests in the Latin Rite, and married men can become priests in the Eastern Rites.
And, in any case, even in theory, becoming a priest doesn't require one to never have violated teaching on this (or any other) point before so doing.
[1] in the usual sense of a "priest in a church in union with Rome", not extending that to breakaway or never-in-union churches that might have "Catholic" in their name.
It's actually important to prefer .isNotEmpty over .length here. In some iterables (think generators, or sequences transformed by higher-order functions), calculating the length requires traversing the entire sequence where .isNotEmpty can stop after finding a single item.
Implicit coercion is often a source of bugs. Some languages simply mandate that you be explicit about your intent. It can be slightly more verbose, but you gain clarity and reduce ambiguity.
With implicit coercion, the programmer must mentally keep track of how values get coerced (are negative numbers truthy? are empty strings? empty lists? empty objects?). Different languages have different answers for all of these things. As a result, I prefer to always be explicit.
If you've never seen the WAT?[1] talk, I suggest watching it. It has some great examples of type coercion gone wrong in Ruby and JS.
I think this is wrong or at least misleading. According to the Ecma standard:
Boolean conversion maps any object o into a boolean. Boolean conversion is defined by the function application
(bool v){
assert(v != null);
return identical(v, true);
}(o)
Reading your quote from the ECMA standard, "no implicit conversions are supported" may be wrong but at the same time not generally misleading. That is, that function errors on null values and returns false for anything that isn't identical to true, so while it does provide a conversion to boolean from any non-null value, anything that isn't exactly a boolean "true" (unless I misunderstand what "identical" does) is going to return false on conversion. This is consistent with other writings on booleans in Dart [1]. So it appears that Dart has implicit boolean conversions, but it converts everything that is not the single "true" value to false, so using an expression that never can evaluate exactly to boolean true in a conditional (unless you mean it to be a wordy way to create unreachable code) is never something you want to do.
It's subtle. The conversion rule states that only `true` is true, `null` is an error, and everything else is false. However, the type annotation of `bool` means that in checked mode any non-bool value will cause a type error to be thrown.
The reason it's defined this way is for efficient compilation to JavaScript. Control-flow constructs don't have to perform a type-check, just a null check (which can be left out in cases due to null propagation).
Are you really worried about having to type 2 characters ('>0') more? I think people are too worried about syntax when it comes to programming languages. I guess it makes sense because that is what is most obvious when you look at a language for the first time.
I couldn't get this to work, after selecting a song it appears to work for ~30 seconds and replies with "This song cannot be analyzed because it is not set as public on YouTube." or "This song cannot be analyzed because it is not set as public on SoundCloud."
`Kiesza - Hideaway`. Other songs do work and the app is pretty impressive, but I find the UI for lining up lyrics really awkward, it doesn't seem to be possible to move all of them at once so if the start offset is wrong it's really painful to use. For an example see `Le Youth - Cool`
I Am The Resurrection by the Stone Roses -- happened for both the first youtube and the first soundcloud results. Why does it show search results that are not public?