Null-pointer exceptions are a common error in Java, causing inconvenience for many developers. Preventing null pointer exceptions in advance is important, but for developers who want to focus solely on logic, handling them can be tedious. Moreover, it’s not always easy to account for every scenario. Typically, static analysis tools are used to detect potential null pointer issues, but developers still have to find and fix the code themselves. JPlus reduces that burden. Let’s write null-safe Java code with JPlus.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Create a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
Zeev Suraski (Zend CTO) recently released some benchmarking figures comparing HHVM to PHPNG (and PHP 5.6). I was particularly interested in the results for SugarCRM. They show a 14-28% speed benefit in favor of PHPNG. I decided to investigate, and ran some basic benchmarks with siege.
It came up with the following results:
| Trans/sec | |
|---|---|
| PHPNG | 24.12 |
| HHVM | 20.74 |
| Diff. | 16.29% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div ng-app="wizardApp"> | |
| <div ng-controller="WizardSignupController"> | |
| <h2>Signup wizard</h2> | |
| <div ui-view></div> | |
| </div> | |
| </div> | |
| <script type="text/javascript" src="/js/vendor/angular-ui-router/release/angular-ui-router.min.js"></script> | |
| <script type="text/javascript"> | |
| angular.module('wizardApp', [ | |
| 'ui.router', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * A more general PHP two-phase commit implementation. | |
| * | |
| * This assumes that we run on 5.3 or later. | |
| */ | |
| class TransactionException extends Exception {} | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Simple two-phase commit for PHP couchbase. | |
| * | |
| * Michael Nitschinger (@daschl, 2012) | |
| * | |
| * Additional Remarks | |
| * ------------------ | |
| * - The Couchbase extension makes it currently pretty hard to write easy readable code when dealing with | |
| * CAS (compared to the ruby adapter). This could certainly be improved with closures. I also found that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.application.rpc | |
| { | |
| /** | |
| * ... | |
| * @author seb | |
| */ | |
| public dynamic class CallbackVO extends Object | |
| { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JS Client using jquery ajax and json2.js | |
| ======================================== | |
| App.invokeRpc = function(method, params, callback) | |
| { | |
| var rpc = { | |
| method:method, | |
| params:params | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Example | |
| //======= | |
| ini_set("display_errors", true); | |
| error_reporting(E_ALL|E_STRICT & ~E_NOTICE); | |
| set_error_handler(function($errno, $errstr, $errfile, $errline){ | |
| throw new ErrorException($errstr, 0, $errno, $errfile, $errline); | |
| }); | |
| $db = MySQLiDB::getInstance(); |
