Jump to content

448191

Staff Alumni
  • Posts

    3,544
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by 448191

  1. There are a small number of design patterns and an introduction to Design Patterns on the main site that I wrote ages ago which I think are pretty concise and noob-proof.
  2. If by "Sencha" you mean Sencha Touch, this probably is not the right place to ask. I have plenty of experience with ExtJS, which I could advise you on, but I think you need to be at the Sencha forums.
  3. Do NOT code for "speed". Code for manageability. For speed, install an opcode cache. The result of parsing PHP code by the Zend engine are "opcodes", instructions for the Zend engine which is written in C. Caching these instructions will dramatically reduce response times, especially when using large libraries. If even that is not enough, which is highly unlikely, there's HipHop for PHP, which basically transforms PHP to C++ which you can compile. Google it.
  4. It is very necessary if you want to do anything beyond some basic scripting.
  5. With Virtual Proxy the object is a transparent replacement for the actual object. So you issue a query to the database, if the resulting data contains the data needed to fully load the related object, you just construct and set the normal object. If you did not load the related data (but did for example load a foreign key so you can load later), you set the vproxy instead. Client code is completely unaware of the difference: they cannot tell the diff between a "Meh" and a "MehProxy". This solution is far superior for the purpose of ORM to other lazy init solutions.
  6. PHP treats undefined constants as strings. Up your error reporting level and you'll see that the second example is actually horribly wrong. Another example is: echo FOO . PHP_EOL; const('FOO', 'bar'); echo FOO . PHP_EOL; Will output:
  7. That is Lazy Init. Lazy Loading includes Lazy Initalization, Virtual Proxy (my personal favorite) and Value Holder. This a vproxy btw: class Meh { public function foo(){} } class MehProxy extends Meh { private $_subject; public function foo(){ if(!$this->_subject){ $this->_subject = $this->_getSubject(); //From wherever } return $this->_subject->foo(); } }
  8. Any idiot can see that this is one of those "slap something together" hosted services, not a hoster.
  9. Meh. It's not like the previous games were that much fun to watch. Call me picky, but next cup I'd like to see them get far AND play entertaining football. Some people argue that winning is the most important thing. Maybe for the players, but not for me watching the game. I'd rather watch a good game where we lose than two poor games where we win. But, we could still have won if the worthless ref caught that offside that preceded the Spanish goal. The arbitrage really, really sucked this cup.
  10. Screw the designers needs, just do it for the sake of SOC. Un- SOC leads to un- DRY code, leads to omfg who wrote this piece of shit (un- manageable)..
  11. Ruby is almost as slow as PHP, perhaps even slower since 5.3. What Daniel is trying to say is that you shouldn't go out of your way to try to improve performance, at the expense of software design, readability, maintainability, whatever. Because that sort of micro- optimizations really don't make much difference, doing more harm than good. If you really want well performing applications, write everything in C. Otherwise, focus on more important things during development, profile the performance *afterwards*. Then you can apply some improvements, if needed.
  12. http://en.wikipedia.org/wiki/Lithium Maybe so, but: - Only the cathode in a lithium battery is (partly) made from lithium. We probably wont run out for 2 or 3 hundred years. - Batteries can be recycled, the lithium reclaimed. If everyone trades in his old car batteries when buying new ones the earth supply could last millennia. We're more likely to run out of other metals before that time. - Batteries are currently developed with a life expectancy of 10 years, talk of 20 years. Unlike a tank of gasoline which has a life expectancy of maybe 2 days. - Most importantly, lithium is only an implementation detail. Companies will continue to look for cheaper production, an obvious way to do so is using less rare materials (for example "Vanadium Boride air", Vanadium is a common element that is even found in living organisms -- some day we may be able to "grow" it through genetic engineering). When they develop a new type of battery not using lithium, you can just stick it in your existing EV.
  13. Hi all, Has anybody been able to use namespaced PHPUnit tests in 7.1? I could get it to run by setting the default debugger to 5.3 CGI and hacking into ZendPHPUnit: class ZendPHPUnitSuite extends PHPUnit_Framework_TestSuite { public static function suite() { $suite = new self(); $suite->setName(__CLASS__); syslog(LOG_DEBUG, "adding " . count($GLOBALS['ZendPHPUnitTests']) . " tests"); foreach ($GLOBALS['ZendPHPUnitTests'] as &$test) { syslog(LOG_DEBUG, "looking for {$test['name']} in {$test['file']}"); if(!class_exists($test['name'], false)) { $code = file_get_contents($test['file']); $namespace = preg_replace('/.*?(namespace\s+([a-zA-Z0-9\\\]*?).*/s', '$2', $code); $test['name'] = "$namespace\\{$test['name']}"; } if ($test['type'] === 'suite') { $suite->addTest(call_user_func(array ($test['name'], 'suite'))); } else { $suite->addTestSuite($test['name']); } } return $suite; } } That will at least make it run, but trying to explore the textcase by clicking on it throws an error..
  14. Btw two of the above links refer to advancements in these techs: http://en.wikipedia.org/wiki/Lithium_sulfur_battery http://en.wikipedia.org/wiki/Lithium_iron_phosphate_battery Another interesting upcoming technology is: http://en.wikipedia.org/wiki/Air-fueled_lithium-ion_battery
  15. Not true. The technology *does* exist. You just need a high powered outlet. But a full charge under 10 minutes is possible using a Lithium-titanate battery. These batteries increase the possible energy absorption and discharge rate by increasing the surface area. Several companies already produce these, including Altair/nano (which also delivers to the US military), Epyon (a small company started by three Technical University graduates), and Toshiba. These batteries are used in the Lightning GT EV. Toshiba is currently investing in production capability for these type of batteries, marketed as SCiB (WikiPedia), and supposedly further developed to a 90% recharge in 5 minutes. In summary, this technology does exist, it just very new and hasn't yet penetrated the mass market. I think one of the reasons why manufacturers are still a bit reluctant is that major strides are still being made in this area: say you invested hundreds of millions (as Toshiba did) and a new, even better technology comes along, you're gonna get screwed. For example this competing technology developed by MIT, which supposedly increases internal conductivity and would allow full charging in seconds instead of minutes and could start production in a little as 2 years. Or this, which supposedly has way lower production cost (by replacing some of the more costly materials with cheap Sulphur) and up to 3 times the energy density, which could mean the range of EVs could surpass that of exploding goo vehicles by over a factor of two. Some of these technologies might not be exclusive. Of course you can wait forever in fear of investing in technology that is obsolete before your products hit the market. But I think Toshiba has the right approach -- aiming at industrial applications and in the near future consumer electronics and EVs (although reportedly Altair will attempt to do so as well but of course they don't have Toshiba's network). I mean even if you don't drive electric, it's quite nice if your laptop can recharge in 5 minutes and last hours, or your mobile phone in 30 seconds. The Dutch government has committed to placing thousands of high powered charging stations, to kickstart EV usage. But my guess is as soon as oil companies start losing money by not offering charging stations, they'll change their mind and before long you were ever there's a gas station, you can recharge. These charging stations are currently being exploited by electricity producers such as Nuon and Essent, but before long I see companies like Shell buying them up.
  16. I'm preparing for my first 5.3 project, thought I'd share my own little 5.3 options supertype.. <?php namespace kwd\pfnotify\options; use kwd\pfnotify\exceptions; abstract class Options { public function __construct(array $args) { foreach($args as $key => $value) { if(!method_exists($this, 'set' . $key)) { if(!property_exists($this, "_$key")) { throw new exceptions\InvalidArgumentException(exceptions\InvalidArgumentException::INVALID_KEY, $key); } $this->{"_$key"} = $value; continue; } $this->{'set' . $key}($value); } array_walk(get_object_vars($this), function($item, $key) use ($args){ if(!isset($args[substr($key, 1)])) { throw new exceptions\InvalidArgumentException(exceptions\InvalidArgumentException::MISSING_KEY, $key); } }); } public function __call($method, $arguments) { if(!strpos($method, 'get') === 0) { throw new \BadMethodCallException("Method '$method' does not exist"); } $ucProp = substr($method, 3); $property = '_' . strtolower(substr($ucProp, 0, 1)) . substr($ucProp, 1); if(!property_exists($this, $property)) { throw new exceptions\InvalidArgumentException(exceptions\InvalidArgumentException::INVALID_KEY, $property); } return $this->$property; } } You can extend this, define some private props and implement some getters (or not, it'll fetch them anyway). Found my first use for closures as well, albeit a little forced EDIT: btw I notice the post above says pointerplate. That's bogus of course. I meant boilerplate.
  17. Yes you could, and no you shouldn't if you are even the least bit serious about whatever you are making.
  18. 448191

    Music

    cags iz jus frontin, wnat to show of hiz speling efrybody know firefox haz spelchekr.
  19. United States of the Internet? Meh, I wasn't planning on mailing you anyway. The Viagra ran out.
  20. Adobe AIR is basically just a browser that uses local source files to run web applications. It implements some interfaces you don't find in your average browser though (such as using the taskbar, writing to local files and databases). And plenty of stuff you find in browsers you won't find in AIR, but essentially it's just a WebKit browser which provides the web developer some integration points to the environment.
  21. Ext is pretty cool. I'm currently working on my third project with it. It can also be inconsistent, too rigid and and not defensive enough. But overall it rocks. One thing that sucks is the size of the lib, especially since it's not very defensive. Firebug will normally crash if you try to look at the source of an exception. I recently found a solution for it though: download the most version, it will contain the source files and a build file. You can use the build file to generate head script links, including all the source files in the right order. For debugging only of course.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.