From 99e1e5cb77744f2dc904d74110296e5052cadaee Mon Sep 17 00:00:00 2001 From: DeadFire Date: Fri, 20 Jun 2014 16:09:54 +0800 Subject: [PATCH] =?UTF-8?q?20140620-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ny Languages Do Developers Need To Know.md | 86 ++++++++ ... Questions and Answers' for Linux Users.md | 204 ++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 sources/talk/20140620 How Many Languages Do Developers Need To Know.md create mode 100644 sources/tech/20140620 11 Advance MySQL Database 'Interview Questions and Answers' for Linux Users.md diff --git a/sources/talk/20140620 How Many Languages Do Developers Need To Know.md b/sources/talk/20140620 How Many Languages Do Developers Need To Know.md new file mode 100644 index 0000000000..a4eb9c11eb --- /dev/null +++ b/sources/talk/20140620 How Many Languages Do Developers Need To Know.md @@ -0,0 +1,86 @@ +How Many Languages Do Developers Need To Know? +================================================================================ +![](http://readwrite.com/files/styles/1400_0/public/fields/code%20example%20Flickr%20Ruiwen%20Chua.jpg) + +> Big companies like Apple, Facebook and Google are developing their own programming languages, forcing developers to adapt. + +At its Worldwide Developer Conference last week, Apple announced its new programming language [Swift][1]. It’s the latest in a rash of new languages developed by big tech companies, in some cases for specific use with their own platforms. + +Apple has Swift for iOS developers; [Facebook has Hack][2], a language for back-end development. Google, meanwhile, has its own entries—the would-be Javascript replacement Dart and a new general programming language called Go. + +This rash of new languages raises a number of issues for developers. Perhaps the most significant is one my colleague [Adriana Lee][3] raised after Apple's Swift announcement: + +> (How many languages are devs supposed to learn?) +> — Adriana Lee (@adra_la) [June 2, 2014][4] + +### A Computer-Language Babel ### + +There are already [hundreds of programming languages][5] in existence, and more are popping into existence all the time. Many are designed for use in a relatively narrow range of applications, and large numbers never catch on beyond small groups of coders. + +Similarly, big tech companies have been developing new languages for about as long as there have been big tech companies. The [seminal general-purpose language C][6] originated at AT&T Bell Labs in the early 1970s. Java, now the primary language for development of Android apps, was [born at Sun Microsystems][7] in the 1990s. + +What's different these days is the extent to which companies embrace new languages to further their specific business objectives—a process that also has the effect of creating a dedicated base of developers who are effectively "locked in" to a company's particular platform. That sort of dual strategy dates back at least to Sun's introduction of Java, which the company promoted as a way to challenge Microsoft's dominance on the PC desktop. (Things didn't work out the way Sun planned, although Java eventually found a home in enterprise middleware systems before Google adopted it for Android.) + +It's also clearly Apple's goal with Swift. Should it live up to the company's early hype, Swift seems likely to simplify iOS app development by filing the rough edges off Objective-C, the current lingua franca of iOS and Mac OS X developers. But it will also require those same developers to learn the ins and outs of a new language that they're unlikely to use anywhere else. + +### Why Companies Roll Their Own ### + +Which cuts against the ingrained "don’t reinvent the wheel” philosophy that animates most developers. So why don't more companies just adopt already existing languages to new uses? + +One answer is simply that companies build their own languages because they can. Designing a new language can be complex, but it's not particularly resource-intensive. What's hard is building support for it, both in terms of providing software resources (shared code libraries, APIs, compilers, documentation and so forth) and winning the hearts and minds of developers. Companies are uniquely positioned to do both. + +There's also the fact that existing languages are often difficult to shoehorn into today's complex code frameworks. Take, for instance, [Facebook's decision to create Hack][8], a superset of the [scripting language PHP][9] that's commonly used in Web development. + +Facebook's main goal with Hack—a common one these days—was to improve code reliability, in this case by enforcing data-type checking before a program is executed. Such checks ensure that a program won't, say, try to interpret an integer as a string of characters, an error that could yield unpredictable results if not caught. In Hack, those checks take place in advance so that programmers can identify such errors long before their code goes live. + +According to Julien Verlaguet, a core developer on Facebook’s Hack team, the company first looked for an an existing language that might allow for more efficient programming. But much of Facebook was already built on PHP, and the company has built up a substantial software infrastructure to support PHP and its offshoots. While it's possible to make PHP work with code written in a different language, it's not easy—nor is it fast. + +“Let’s say I try to rewrite our PHP codebase in Scala,” Verlaguet said. “It’s a well designed, beautiful language, but it’s not at all compatible with PHP. Everytime I need to call to PHP from the Scala part of the code base, I’ll lose performance speed. We would have liked to use an existing language but for us, it just wasn’t an option.” + +Instead, Facebook invented Hack, which has enough in common with PHP that it can share the company's existing infrastructure. The vast majority of the Facebook codebase has been migrated from PHP to Hack, said Verlaguet, but the company has open sourced the language in hopes that independent developers will find uses for it outside of Facebook. + +“You can still use PHP,” he said. “But we’re hoping you’ll want to use Hack.” + +### Who Holds The Power ### + +Therein lies the balance of power between companies and developers. Companies can make their languages as specific as they like. But if developers don’t want to use them, nobody is going to—outside, that is, of anyone who might harbor hopes of one day working at the company that invented the language. + +It’s not unusual for companies to make it easiest to develop in one language over another. For example, you would use Objective-C to develop iOS apps, but Java to develop Android apps. This has never been a major sticking point with developers because both Objective-C and Java are general purpose object-oriented languages. They’re useful for a number of purposes. + +Hack, Dart, Go, and Swift, however, so far have only proven useful for particular company-designated programming solutions, usually in tandem with that company’s programming environment of choice. Granted, it may be too soon to judge. Hack, for example, can be used in several back-end implementations; it’s just so new that Facebook doesn’t yet have any data that people want to use it that way. + +It’s not that developers aren’t capable of learning multiple languages. Most already do. Think of them like the Romance languages—if you know Spanish, it’ll be easier to learn French and so on than if you didn’t already know one. Likewise, if you already know Java, it’ll be easier to learn Ruby or Perl. And if you know PHP, you basically already know Hack. + +On the contrary, it’s more of a question of habit. If Java already solves your specific problems, you don’t have any incentive to learn Ruby. And if you are happy coding iOS apps in Objective-C, you’re not going to feel very tempted to pick up Swift. + +To some developers, though, ecosystem-specific languages just make life harder for everybody. Freelance designer Jack Watson-Hamblin, for instance, told me that initiatives like Apple's Swift risk overburdening programmers and fragmenting the developer community: + +> It's important for programmers to know multiple languages, but forcing them to keep up with new languages all the time doesn't make sense. If I'm making a simple cross-platform app, I don't want to have to know four languages to do it. I only want to use the single-purpose language if I really need to. + +Watson-Hamblin argues that when companies each build their own language for their own needs, it slows down overall progress both by dividing the attention of coders and by enforcing a monolithic perspective on development within that language. "When companies are in charge of a language vs. an open-source community, it's like the difference between a corporation and a start-up," he said. Communities are more flexible and adaptive by definition. + +Of course, Apple had [a lot of very good reasons to start from scratch][10] with Swift, just as Facebook did when it invented Hack. That doesn't mean it's not going to force change on developers—some of it doubtless unwelcome. + +“As new languages are invented, it gets more hegemonic,” said Verlaguet. “It can be frustrating to have to keep up. But on the other hand, you’re more likely to have a new language to fit your exact problem. Imagine the reverse—a world where programmers used the same language for everything. It’d be a language that could do everything poorly but nothing well.” + +Lead image by [Flickr user Ruiwen Chua][11], CC 2.0 + +-------------------------------------------------------------------------------- + +via: http://readwrite.com/2014/06/17/apple-swift-facebook-hack-google-dart + +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:https://developer.apple.com/swift/ +[2]:http://readwrite.com/2014/03/20/facebook-new-programming-language-hack +[3]:http://readwrite.com/author/adriana-lee#awesm=~oGfPbJlSrFBamJ +[4]:https://twitter.com/adra_la/statuses/473537386266112000 +[5]:http://en.wikipedia.org/wiki/List_of_programming_languages +[6]:http://en.wikipedia.org/wiki/C_(programming_language) +[7]:http://en.wikipedia.org/wiki/Java_(programming_language) +[8]:http://readwrite.com/2014/03/20/facebook-new-programming-language-hack +[9]:http://en.wikipedia.org/wiki/PHP +[10]:http://blog.erratasec.com/2014/06/why-it-had-to-be-swift.html#.U58BJI1dXtA +[11]:https://www.flickr.com/photos/ruiwen/3260095534 \ No newline at end of file diff --git a/sources/tech/20140620 11 Advance MySQL Database 'Interview Questions and Answers' for Linux Users.md b/sources/tech/20140620 11 Advance MySQL Database 'Interview Questions and Answers' for Linux Users.md new file mode 100644 index 0000000000..9cfdd6f10e --- /dev/null +++ b/sources/tech/20140620 11 Advance MySQL Database 'Interview Questions and Answers' for Linux Users.md @@ -0,0 +1,204 @@ +11 Advance MySQL Database “Interview Questions and Answers” for Linux Users +================================================================================ +We have already published two MySQL articles, well appreciated by Tecmint Community. This is the third article on MySQL Interview series and sixteen in the the Interview Genre Column. + +- [15 Basic MySQL Interview Questions][1] +- [10 MySQL Database Interview Questions for Intermediates][1] +注:上面这两篇文章我们都翻译过,可以适当修改成我们的链接 + +![11 MySQL Interview Questions](http://www.tecmint.com/wp-content/uploads/2014/06/MySQL-Interview-Questions.jpeg) + +We have reached here all because of yours support and we seek the same in future form your end. Here in this article we will be concentrating on the practical aspect of MySQL, the question relevant for Interview aspect. + +### 1. Using SELECT statement find the version of the server you are running and print the name of the current database? ### + +**Ans**: The below MySQL command will show server version and currently selected Database. + + mysql> SELECT VERSION(), DATABASE(); + + +-------------------------+------------+ + | VERSION() | DATABASE() | + +-------------------------+------------+ + | 5.5.34-0ubuntu0.13.10.1 | NULL | + +-------------------------+------------+ + 1 row in set (0.06 sec) + +In the Database Column it is showing **NULL** value because we have not selected any database. So, select database as shown in the following command. + + mysql> use Tecmint; + + Reading table information for completion of table and column names + You can turn off this feature to get a quicker startup with -A + + Database changed + +---------- + + mysql> select VERSION(), DATABASE(); + + +-------------------------+------------+ + | VERSION() | DATABASE() | + +-------------------------+------------+ + | 5.5.34-0ubuntu0.13.10.1 | tecmint | + +-------------------------+------------+ + 1 row in set (0.00 sec) + +### 2. USE NOT Operator (!) to select all the users except ‘SAM’ from a table say ‘Tecmint’ ### + +**Ans**: The below statement will show all the columns of all the users from table ‘**Tecmint**‘ except the user ‘**SAM**‘. + + mysql> SELECT * FROM Tecmint WHERE user !=SAM; + + +---------------------+---------+---------+---------+---------+-------+ + | date | user | host | root | local | size | + +---------------------+---------+---------+---------+---------+-------+ + | 2001-05-14 14:42:21 | Anthony | venus | barb | venus | 98151 | + | 2001-05-15 08:50:57 | TIM | venus | phil | venus | 978 | + +---------------------+---------+---------+---------+---------+-------+ + +### 3. Is it possible to implement ‘AND’ with NOT (!) Operator. ### + +**Ans**: The AND operator is used when we use (=) and the operator OR is used when we use (!=). An example of (=) with AND Operator. + + mysql> SELECT * FROM mail WHERE user = SAM AND root = phil + +An Example of (!=) with OR Operator. + + mysql> SELECT * FROM mail WHERE user != SAM OR root != phil + + +---------------------+---------+---------+---------+---------+-------+ + | date | user | host | root | local | size | + +---------------------+---------+---------+---------+---------+-------+ + | 2001-05-14 14:42:21 | Anthony | venus | barb | venus | 98151 | + +---------------------+---------+---------+---------+---------+-------+ + +- = : means Equal to +- != : Not Equal to +- ! : represents NOT Operator + +The AND & OR are treated as joining operators in MySQL. + +### 4. What IFNULL() statement is used for in MySQL? ### + +**Ans**: The Query in MySQL can be written precisely using **IFNULL()** statement. The IFNULL() statement test its first argument and returns if it’s not NULL, or returns its second argument, otherwise. + + mysql> SELECT name, IFNULL(id,'Unknown') AS 'id' FROM taxpayer; + + +---------+---------+ + | name | id | + +---------+---------+ + | bernina | 198-48 | + | bertha | Unknown | + | ben | Unknown | + | bill | 475-83 | + +---------+---------+ + +### 5. You want to see only certain rows from a result set from the beginning or end of a result set. How will you do it? ### + +**Ans**: We need to use **LIMIT** clause along with ORDER BY to achieve the above described scenario. + +#### Show 1 Record #### + + mysql> SELECT * FROM name LIMIT 1; + + +----+------+------------+-------+----------------------+------+ + | id | name | birth | color | foods | cats | + +----+------+------------+-------+----------------------+------+ + | 1 | Fred | 1970-04-13 | black | lutefisk,fadge,pizza | 0 | + +----+------+------------+-------+----------------------+------+ + +#### Show 5 Record #### + + mysql> SELECT * FROM profile LIMIT 5; + + +----+------+------------+-------+-----------------------+------+ + | id | name | birth | color | foods | cats | + +----+------+------------+-------+-----------------------+------+ + | 1 | Fred | 1970-04-13 | black | lutefisk,fadge,pizza | 0 | + | 2 | Mort | 1969-09-30 | white | burrito,curry,eggroll | 3 | + | 3 | Brit | 1957-12-01 | red | burrito,curry,pizza | 1 | + | 4 | Carl | 1973-11-02 | red | eggroll,pizza | 4 | + | 5 | Sean | 1963-07-04 | blue | burrito,curry | 5 | + +----+------+------------+-------+-----------------------+------+ + +---------- + + mysql> SELECT * FROM profile ORDER BY birth LIMIT 1; + + +----+------+------------+-------+----------------+------+ + | id | name | birth | color | foods | cats | + +----+------+------------+-------+----------------+------+ + | 9 | Dick | 1952-08-20 | green | lutefisk,fadge | 0 | + +----+------+------------+-------+----------------+------+ + +### 6. Oracle Vs MySQL. Which one and Why? ### + +**Ans**: Well both has its advantages and disadvantages. As a matter of time I prefer MySQL. + +#### Reason for Selection MySQL Over oracle #### + +- Mysql is FOSS. +- MySQL is portable. +- MYSQL supports both GUI as well as Command Prompt. +- MySQL Administration is supported over Query Browser. + +### 7. How will you get current date in MySQL? ### + +**Ans**: Getting current date in MySQL is as simple as executing the below SELECT Statement. + + mysql> SELECT CURRENT_DATE(); + + +----------------+ + | CURRENT_DATE() | + +----------------+ + | 2014-06-17 | + +----------------+ + +### 8. How will you export tables as an XML file in MySQL? ### + +**Ans**: We use ‘-e‘ (export) option to export MySQL table or the whole database into an XML file. With large tables we may need to implement it manually but for small tables, applications like phpMyAdmin can do the job. +A native command of MySQL can do it. + + mysql -u USER_NAME –xml -e 'SELECT * FROM table_name' > table_name.xml + +Where USER_NAME is username of Database, table_name is the table we are exporting to XML and table_name.xml is the xml file where data is stored. + +### 9. What is MySQL_pconnect? And how it differs from MySQL_connect? ### + +**Ans**: MySQL_pconnect() opens a connection that is persistent to the MySQL Database which simply means that the database is not opened every-time the page loads and hence we can not use MySQL_close() to close a persistent connection. + +A brief difference between MySQL_pconnect and MySQL_connect are. + +Unlike MySQL_pconnect, MySQL_connect – Opens the Database every-time the page is loaded which can be closed any-time using statement MySQL_close(). + +### 10. You need to show all the indexes defined in a table say ‘user’ of Database say ‘mysql’. How will you achieve this? ### + +**Ans**: The following command will show all the indexes of a table ‘user’. + + mysql> show index from user; + +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ + | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | + +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ + | user | 0 | PRIMARY | 1 | Host | A | NULL | NULL | NULL | | BTREE | | | + | user | 0 | PRIMARY | 2 | User | A | 4 | NULL | NULL | | BTREE | | | + +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ + 2 rows in set (0.00 sec) + +### 11. What are CSV tables? ### + +**Ans**: CSV stands for Comma-Separated Values aka Character-Separated Values. CSV table stores data in plain text and tabular format. It typically contains one record per line. + +Each record is separated by specific delimiters (Comma, Semi-colon, …) where each record has same sequence of field. CSV tables are most widely used to store phone contacts to Import and Export and can be used to store any sort of plain text data. + +That’s all for now. I’ll be here again with another Interesting article, you people will love to read. Till then stay tuned and connected to Tecmint and Don’t forget to provide us with your valuable feedback in the comment section below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/mysql-advance-interview-questions/ + +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.tecmint.com/basic-mysql-interview-questions-for-database-administrators/ +[2]:http://www.tecmint.com/10-mysql-database-interview-questions-for-beginners-and-intermediates/ \ No newline at end of file