www.archive-org-2013.com » ORG » J » JAMES-CARR

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

    Archived pages: 767 . Archive date: 2013-03.

  • Title: James Carr | Rants and Musings of an Agile Developer
    Descriptive info: .. James Carr.. Rants and Musings of an Agile Developer.. Skip to content.. Home.. About.. Training.. Javascript BDD.. TDD with PHPUnit.. Older posts.. Zend Framework 2: Select Optgroups.. Posted on.. September 16, 2012.. by.. On my project I m currently working on I needed to use optgroups.. After looking high and low through the documentation and the code I discovered the feature kind of worked, but kind of didn t.. I issued a.. pull request.. that fixed the code for the next release (2.. 0.. 1) but here s the skinny on how to set it up.. When setting the valueOptions attribute of a SelectElement specify an array as follows for optgroup support.. Posted in.. Uncategorized.. |.. Leave a comment.. Using Select In Zend Framework 2.. I ve been using Zend Framework 2 on a recent project as a way to asses it s features and one of the early blockers I had was trying to figure out how the heck to use the Select form element.. As of this writing there is no good documentation on how to use it, so I ll instead introduce how to use it in this blog post.. Album Manager, Revisited.. For this demonstration I ll be using the zend-skeleton application I originally worked on following through the zend framework 2 tutorial.. I ve left off from my previous post where we DRY d up our code by using form annotations.. You can follow me in this post by checking out my.. zend-skeleton.. project on github and checking out the select-beginning tag.. To start with, we have our annotated Album model object with just the title and artist:.. So we ve written our application and our customer is pleased, however he d like to be able to tag the albums with a genre.. When adding or editing a new album, there should be a genre drop down populated with options like Rap, Jazz, Alternative, Rock and Country.. Turns out this is a breeze, we just need to add a new field to our model and a Select form element:.. Now comes the boilerplate part, adding it to your views and AlbumTable (soon I ll blog about replacing TableGateways).. I ll leave this as an exercise for the reader.. See the tag.. select-annotated.. to see the completed work here.. You ll also need to add the genre column to the album table yourself (boo no migrations).. Getting Values From an External Source.. Commonly we ll be getting genres from a database table or some other external source, not hard coded as a list of values in an annotation.. To understand how to do this better, let s first extract the value population out of the form annotation and do it elsewhere.. The obvious place to manipulate the form after the fact is obviously not within the controller so let s extract form creation out to something that can encapsulate it.. With the lack of any kind of convention our guidance from the framework here, let s just call it AlbumFormBuilder and go strong.. First we create a new class called FormBuilder under module/Album/src/Album/Form/FormBuilder.. Previously (as in during the last tutorial) we applied extract method to extract a common method out of the addAction and editAction to handle the form building logic.. Now we simply need to move this method over to our new FormBuilder class and name it something meaningful, like newForm.. Now we could simply drop this object into the existing method in the AlbumController and see it still work (and I normally do this while refactoring).. But to really harness the power we should create this new builder through ZF2 s factory mechanism.. So we open up module/Album/Module.. php and the following to the factories section:.. And modify the AlbumController to use it via the service locator.. Now with the logic better encapsulated away from the controller, let s simply set the value options directly within the builder class.. Now if we save this and check out the app, we ll notice that our new addition completely overrides what was in the annotation.. Since we don t need those anymore, we can remove the value_options attribute from our form annotation.. Go ahead and edit or add a new album, select a genre and save it.. Notice something? If you use an array of string literals the values will all be the index number of the item while the actual values will be the labels.. We have two options here either specify keys that represent option values or explicitly define the label and the value (yes this is a bit strange).. See the examples below for a quick reference.. This actually didn t give me what I originally expected I expected to see the array keys as labels and the values as, well, values.. However using a keyed array will basically match the same left to right layout an actual select elements option items will have.. If you want to be more explicit you can also do the following:.. Final Step: Extract Values Out.. There was a reason I used ZF2 s dependency management to fetch the new FormBuilder instance and that was to easily extract the value options out to be provided by something else, perhaps another table gateway.. So let s go ahead and move that array to be returned by a new GenreTable.. Now we modify FormBuilder to take the GenreTable as a constructor argument and use it to populate the value options.. Finally, we update module/Album/Module.. php to inject an instance of the new GenreTable.. Now we re free to change the object injected into FormBuilder to fetch genres from the database rather than use an in-memory array when we re ready but I m tired of writing TableGateways.. In my next post I ll make my code a bit DRY er by ripping those table gateways out in favor of doctrine.. You can see my completed work for this post on.. github.. 2 Comments.. Fixing PHP Code Standard Issues.. September 10, 2012.. It s been one busy day, cranking out features like no tomorrow (even issuing.. pull requests.. on github to fix Zend Framework 2 issues) and still finding time to improve my PHP toolbelt.. Today while issuing pull requests I came across.. PHP-CS-Fixer.. which was referenced as a way to fix some minor code formatting issues in my pull request.. Basically run it on a project  ...   world (2006!).. PEAR.. was pretty much the de facto dependency management system, and it was meh.. Not bad, but not as good as rubygems, pip, or.. npm.. Imagine my joy last week when I discovered.. composer.. , which is heavily based off of ideas in npm.. With composer I can define a composer.. json file that defines all the dependencies my application has, whether they re composer enabled or not.. I ve used this with composer based packages, pear, github projects, etc.. Here s a sample of one from a current project:.. Basically I just run composer install from the project directory and all the dependencies are downloaded and placed under.. /vendor.. A nice addition is that it also handles psr-0 autoloading as well, which is a separate topic in its own right.. Jenkins.. FInally, I tie all this together with Jenkins by using it to automatically check out projects on commit, run PHPUnit and php lint on the project, then ship it to staging if all goes well.. I usually leave the production deployment to be manually kicked off but I can also automated that as well if I wanted to.. If you re not already using.. jenkins.. , why aren t you?.. That s about all for now.. In a nutshell I guess I could say PHP development isn t great due to being very verbose but it s tolerable.. Knowing tools from other stacks goes a long way in making it fun.. Capistrano Deployment from Jenkins.. Recently I had a challenge of getting.. deployments working from jenkins installed on a RHEL box.. The problem seemed to be down to the fact that ssh-agent isn t running for the daemon process that jenkins runs as for whatever reason and it is needed to do ssh agent forwarding (which is what I do so I can use the ssh key on the jenkins server to check code out from github on remote servers).. After banging my head against the head for a couple hours, I came up with a simple solution: execute a shell script through ssh-agent.. I simply created a deploy.. sh script in the root of my project with the following contents:.. Then execute it through ssh agent.. exec /usr/bin/ssh-agent "${WORSKPACE}/deploy.. sh" "production".. Works perfectly.. Hopefully this helps someone else, took me a lot of grief to figure this out.. Oh yeah, in case you didn t know, I m back in PHP development again for awhile so there should be some interesting posts ahead.. Don t Be the Bearer of Bad News.. August 13, 2012.. Nobody likes hearing bad news.. Whether someone passed away, another dismal economic report or a project failure within your company, bad news does nothing but breed negativity in the person who hears it and brings their morale down.. Instead of rebroadcasting negativity that brings people s hopes down, why not share something to bring their hopes up? Rather than focusing on dreadful economic reports, why not share stories of people toughing it out and making a profit despite all the odds against them?.. Seek to inspire people, not demotivate them.. The First Thing When You Wake Up.. June 18, 2012.. What s the first thing you do when you wake up in the morning? Check facebook? Check twitter? Your email? Watch some morning news when you get ready?.. All of these things are easy for us to do when we wake up but in my opinion they re the worst possible activities we can engage in when waking up.. Why? All of the activities listed above are a form of procrastination of some type and by doing them first thing in the morning we set our day up to be a day of procrastination.. My challenge this month is to start my mornings by doing something productive.. It might be a blog post, reviewing a chapter from one of the books I m tech editing, or getting some early morning yard work done.. Whatever it may be, I m going to start the day off with an achievement (however small) rather than idle procrastination.. As Dogen Zenji once said,.. Life and death are of supreme importance.. Time swiftly passes by and opportunity is lost.. Each of us should strive to awaken.. Awaken.. Take heed, do not squander your life.. Back to Blogging.. June 4, 2012.. Recently a friend of mine posted something interesting.. He had referred to a blog post that he wrote three years ago during a meeting and, afterward, read some of his other posts and realized that he really missed blogging.. Likewise, I realized lately that my blog posts have been very scarce and few between.. While I used to blog whatever I was randomly thinking at the moment, I ve kind of gotten away from that and only blog a tutorial here or there.. There s a lot of excuses I could make, such as twitter being the new outlet for my random thoughts or that I just don t have the time anymore but both are really lame (and overplayed) excuses.. So the new goal for me is two write two posts per week minimum.. Even my random thoughts feel much more fleshed out and better conveyed in a blog post vs.. just a tweet.. I m not worried that the two a week goal will be hard to meet, there are just too many interesting things going on in my life (and the tech community at large) to not have something to blog about.. Search for:.. Archives.. September 2012.. August 2012.. June 2012.. March 2012.. February 2012.. January 2012.. December 2011.. November 2011.. October 2011.. September 2011.. August 2011.. June 2011.. May 2011.. April 2011.. March 2011.. February 2011.. January 2011.. December 2010.. November 2010.. October 2010.. September 2010.. August 2010.. July 2010.. June 2010.. May 2010.. April 2010.. March 2010.. February 2010.. January 2010.. December 2009.. November 2009.. October 2009.. September 2009.. August 2009.. July 2009.. June 2009.. May 2009.. April 2009.. February 2009.. January 2009.. December 2008.. November 2008.. October 2008.. September 2008.. August 2008.. July 2008.. June 2008.. May 2008.. April 2008.. March 2008.. February 2008.. January 2008.. December 2007.. November 2007.. October 2007.. September 2007.. August 2007.. July 2007.. June 2007.. May 2007.. April 2007.. March 2007.. January 2007.. December 2006.. November 2006.. October 2006.. August 2006.. July 2006.. June 2006.. Meta.. Log in.. James Carr.. Proudly powered by WordPress..

    Original link path: /
    Open archive

  • Title: About | James Carr
    Descriptive info: Background.. Wow where do I start? Grew up in Hannibal, MO, attended college in Quincy, IL.. Worked for a local web dev firm there, Carfax here in Columbia, MO, consulting in St.. Louis, then back at CARFAX again.. I have a zeal for learning new things and helping teams delivery better products.. Anything else just ask.. Interests.. I enjoy programming in my free time and spend a considerable amount of time hacking away at open source projects as well as implementing those projects for various clients.. My recent interests have included messaging (RabbitMQ specifically), Node.. js, NoSQL, and alternative JVM languages such as Scala.. You can also occasionally find me at several conferences speaking on some  ...   February 13, 2011 at 5:01 pm.. Hi James,.. Awesome blog, keep up the good job.. Is there an email address I can contact you in private?.. Thanks.. Reply.. mpron.. January 17, 2012 at 11:13 am.. Hey James,.. Would you be interested in having some of your content featured on DZone.. com and Javalobby? Shoot me an email and I ll explain more of the details.. Best,.. Mitch P.. Leave a Reply.. Cancel reply.. Your email address will not be published.. Required fields are marked.. *.. Name.. Email.. Website.. Comment.. You may use these.. HTML.. tags and attributes:.. a href= title= abbr title= acronym title= b blockquote cite= cite code del datetime= em i q cite= strike strong..

    Original link path: /about/
    Open archive

  • Title: Training | James Carr
    Descriptive info: In this fast paced world your developers need to best mentoring and coaching that they can get to succeed.. We provide a large range of on-site and online training to help defeat today s challenges and give your company a competitive edge! Our courses can be taught as is or tailored for the specific needs of your company.. Courses.. Test Driven Development with PHP.. This three day power course will enable your team to begin utilizing the craft of TDD to develop high quality PHP Code.. Web Testing.. You just deployed your corporate site to staging before going to production and dread the next few hours of running through the site manually testing forms and links.. No more! This course is designed to introduce you to tools like Geb and Selenium to help you automate web testing painless and easily.. Full Project Automation.. Project automation is the key to high efficiency and performance..  ...   all the fundamentals all the way to advanced concepts and how to test drive complex behaviors.. Node.. js Bootcamp.. If you re looking to leverage one of the most powerful asynchronous platforms today, I can offer help in training your team everything there is to know about node.. js to get you up and running in no time.. This course can be customized to your needs, anywhere from one day to a full week covering the fundamentals all the way to building high throughput infrastructure hosted in the cloud.. Interested?.. Feel free to.. contact me.. and we ll set up a program that will work for you!.. One Response to.. Daniel.. September 16, 2011 at 2:01 am.. Dear James,.. I m a fan of your blog.. But something got wrong on your blog.. One of your post is keep repeating, repeating, repeating.. Could you check what is going on and fix the issue?.. Sincerely,..

    Original link path: /training/
    Open archive

  • Title: Javascript BDD | James Carr
    Descriptive info: Outline.. This course is an intensive 3-day course on client side BDD that is a mix of live coding, instructing, exercises, and one-on-one mentoring.. The overall aim is not to just instruct developers on how to use BDD to test their code but how to use it as a tool to think about how their code achieves the business goals for a particular feature.. This course not only covers the technical  ...   javascript.. Applying javascript design patterns.. Refactoring best practices.. Using jasmine to describe features.. Using spies and mocks to describe the collaboration between multiple components.. Test-Driving legacy code.. Creating custom matchers to clarify intent.. Automating tests through Jenkins.. Test driving asynchronous behavior.. Dummying up the DOM for dom specific tests.. Strategies for separating DOM manipulation from business logic.. Mocking and stubbing AJAX requests.. Decoupling tests from implementation details.. Interested?.. Contact me.. for details..

    Original link path: /training/javascript-bdd/
    Open archive

  • Title: TDD with PHPUnit | James Carr
    Descriptive info: Price:.. $900 per student.. Course Outline.. This course is an intensive 3-day course on TDD that is a mix of live coding, instructing, exercises, and one-on-one mentoring.. The overall aim is not to just instruct developers on how to use PHPUnit but how to use it as a tool to think about how their code achieves the business goals for a particular feature.. A gentle introduction to Behavior Driven Development and Test Driven Development.. Getting started with PHPUnit.. Using test doubles to describe interactions with mocks and stubs.. Database testing, setting up test data using DataSets to verify data mappers work as expected.. Web Testing and various tools available (ranging from Selenium’s PHP Remote to other non-PHP based tools).. Test automation.. Demonstrate migrating from a procedural  ...   clear understanding of the concepts behind TDD and how to apply them within PHP and web development in general.. They should also walk away with a better understanding of using tests to help define business requirements and write the appropriate code needed to meet those requirements.. Upon course completion participants should:.. Be able to write effective unit tests and use them as a tool to help them develop faster.. Achieve business requirements better.. Be able to write clear and concise tests that document the feature.. Be able to use mocks and stubs.. Be able to write unit tests for legacy applications.. Understand the concepts of BDD and how it can be used to get non-developers (BA, Product Owners, Sales Reps, etc) involved in the development process..

    Original link path: /training/tdd-with-phpunit/
    Open archive

  • Title: James Carr | Rants and Musings of an Agile Developer | Page 2
    Descriptive info: Newer posts.. Scheduled Message Delivery with RabbitMQ.. March 30, 2012.. Earlier this month I gave a presentation at.. ComoRichWeb.. on.. RabbitMQ.. and one question from an attendee was Is it possible to publish a message to be consumed at a later date? I answered that it wasn t possible to the best of my knowledge, but that there might be some hack to accomplish it.. Well, this evening while trying to figure out how to use a push vs.. polling model for timed notifications I discovered a clever hack using temporary queues, x-message-ttl and dead letter exchanges.. The main idea behind this is utilizing a new feature available in 2.. 8.. 0,.. dead-letter exchanges.. This AMQP extension allows you to specify an exchange on a queue that messages should be published to when a message either expires or is rejected with requeue set to false.. With this in mind, we can simply create a queue for messages we want to be delivered later with an x-message-ttl set to the duration we want to wait before it is delivered.. And to ensure the message is transferred to another queue we simply define the x-dead-letter-exchange to an exchange we created (in this case I ll call it immediate) and bind a queue to it (the right.. now.. queue ).. In coffeescript with node-amqp this looks like this:.. Next I define the immediate exchange, bind a queue to it and subscribe.. Finally, after defining the queue I created earlier we want publish a message on it.. So to revisit the earlier queue definition we add a publish call to publish directly to the queue (using the default exchange).. The result of running this is we ll see a 5 second wait and then the message content and headers get dumped to the console.. Since the queue is only used temporarily in this scenario I also set the x-expires attribute of the queue to expire in a reasonable amount of time after the message expires.. This makes sure we don t wind up with a ton of unused queues just sitting around.. Here s the result of this exercise in its entirety.. You can get this exercise in full on.. This is pretty interesting and I plan to experiment further with utilizing this in one of my production node.. js applications that use interval based polling to trigger scheduled events.. nodejs.. 3 Comments.. Gradle: Using JMX with the Tomcat Plugin.. March 21, 2012.. Lately at work we ve been using the.. tomcat plugin.. for our.. gradle.. projects instead of the bundled.. jetty plugin.. There were a lot of reasons for doing this with the main reason being our production environment for our current project is tomcat so it makes sense to have an embedded server that mirrors that environment.. I had already devoted time getting JMX working with the jetty plugin, so today I investigated doing the same with the tomcat plugin.. Luckily this is one of those cases where it just works.. Well, almost.. You ll need to add the following properties to the GRADLE_OPTS environment variable.. That s it.. Now when you you fire up tomcatRun you can open up jconsole and navigate to.. service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi.. and you re good to go.. Gradle: Deploying an Artifact to the Local Cache.. March 14, 2012.. One question that came up a couple times this week is how to set gradle up to deploy jars locally.. For the most part I was satisfied with just having people push snapshot releases to our Artifactory server but some people did express a real desire to be able to publish a jar to the local resolution cache to test changes out locally.. I m still a fan of deploying snapshots from feature branches but luckily you can do a local publish and resolve with gradle.. First off, ask yourself if the dependency is coupled enough to warrant being a submodule.. Also, could just linking the project in your IDE be enough to get what you want done? If the answer to both questions are no then your next recourse is to use gradle s excellent maven compatibility (don t run!).. For the project you want to publish locally you simply need to apply the maven plugin and make sure you have version and group set for the project (usually I put group and version in gradle.. properties).. That s all you need to install it locally, just run.. gradle install.. from the project root to install it to the local m2 cache.. Now let s update your project that will depend on it.. The magic sauce here is using.. mavenLocal().. as one of your resolution repositories.. This will resolve against the local m2 cache.. mavenCentral().. can be replaced by whatever repositories you might use, it is only included since it s the most often used.. That s it! I know some people dislike this approach due to ingrained disdain for maven but the beauty of it is that maven is silently at work and you really don t get bothered by it.. A Tale of Two Cultures.. March 6, 2012.. Today I found myself thinking again of what I see as two distinct cultures in the development world: Hackers and Enterprise Developers.. This really isn t any kind of a rant just an observation that I ve been thinking over lately.. Hackers are really bleeding edge.. They have no problem using the commandline, using multiple languages, or contributing back to open source.. They ll find and fix bugs in the opensource software they use and issue pull requests frequently.. They ll always be willing to use new tools that help them produce better software when there might not even be any good IDE support.. Finally, they re always constantly investigating new technologies and techniques to give them a competitive edge in the world.. Now when I say hacker I don t mean someone who just hacks lots of random shit together and calls it a day (that kind of developer isn t good for anyone).. Just someone who isn t afraid to shake up the status quo, isn t afraid to be a bit different and go against the grain.. They re the polar opposite of enterprise developers.. Enterprise Developers on the other hand are fairly conservative with their software development methodology.. I m not saying that a lack of standards is a good thing, but enterprise developers want standards for doing everything and they want it standardized across the company.. If there isn t IDE support for a tool they ll refuse to use it.. Want to use mongodb, riak, etc? Not unless there s a fancy GUI client for interacting with it.. If they find a bug they ll back away from the framework they re using and simply declare that the company shouldn t use the framework until the bug is fixed externally.. I find this group prefers to play it safe and work on solidifying their existing practices rather than explore new ideas.. Now don t get me wrong, this isn t another rant on IDEs or developers who don t use the command line.. But give me a couple days in any organization and I can quickly point  ...   way through.. Introduction to Algorithms.. , which come complete with captions for the hearing impaired (like me)!.. Really awesome stuff.. Which gets me back to my original point.. We hear in the news everyday that there are so many job losses in the unskilled job market or even in certain skilled markets that were traditionally profitable.. Meanwhile, EVERY SINGLE COMPANY I KNOW HAS BEEN DESPERATELY LOOKING FOR DEVELOPERS! And even more important, I ll tell you from experience of being the interviewer for over 100 interviews (and also being the interviewee for several) that interviewers don t give jack about whether you have a Bachelor, Masters, or even a PhD degree, just whether or not you have good problem solving skills, work well with others, and can write good clean code.. So why don t you help the economy out and start watching lectures and completing coursework for.. MIT Introduction to Computer Science.. today?.. NPM: Install Packages Not Yet Published.. January 29, 2012.. This morning I was working on a project and one of the modules I depended on had a small bug in it.. As I was about to log an issue on the project s github page I discovered that it was already fixed, just not yet released.. I really wanted to push my changes out to our staging server and my build process relies on npm gathering all the dependencies my project needs, so I looked for ways to install through npm without much modification to my build process.. What I discovered could be considered an abuse of npm s preinstall hook, but it works.. This brings in not just the module, but also all of the module s transitive dependencies as well.. This trick worked for me, but I m still a little doubtful that this is considered the right way around the problem.. Blog Rolling with MongoDB, Node.. js and Coffeescript.. January 16, 2012.. This morning I woke up with a lingering thought on my mind that was left over from recent conversations.. In the technical community we often get so invested in our work that rather than talk about the simple building blocks that build our success we talk about the huge breakthroughs we make.. The problem however is that our breakthroughs most often aren t accessible to someone who wants to just get started.. So today I will give an intro tutorial to using node.. js, coffeescript and mongodb to build a simple blog.. It builds off the concept in a.. tutorial.. I first used to learn node.. js more than a year ago, but with a completely from scratch approach.. In this tutorial I will also cover practicing.. Behavior Driven Development.. using Mocha.. Continue reading.. 10 Comments.. Streaming Files from MongoDB GridFS.. January 9, 2012.. Not too long ago I tweeted what I felt was a small triumph on my latest project, streaming files from.. MongoDB GridFS.. for downloads (rather than pulling the whole file into memory and then serving it up).. I promised to blog about this but unfortunately my specific usage was a little coupled to the domain on my project so I couldn t just show it off as is.. So I ve put together an.. example node.. js+GridFS application.. and shared it on github and will use this post to explain how I accomplished it.. GridFS module.. First off, special props go to.. tjholowaychuk.. who responded in the #node.. js irc channel when I asked if anyone has had luck with using GridFS from.. mongoose.. A lot of my resulting code is derived from an gist he shared with me.. Anyway, to the code.. I ll describe how I m using gridfs and after setting the ground work illustrate how simple it is to stream files from GridFS.. I created a gridfs module that basically accesses GridStore through mongoose (which I use throughout my application) that can also share the db connection created when connecting mongoose to the mongodb server.. We can t get files from mongodb if we cannot put anything into it, so let s create a putFile operation.. This really just delegates to the putFile operation that exists in GridStore as part of the mongodb module.. I also have a little logic in place to parse options, providing defaults if none were provided.. One interesting feature to note is that I store the filename in the metadata because at the time I ran into a funny issue where files retrieved from gridFS had the id as the filename (even though a look in mongo reveals that the filename is in fact in the database).. Now the get operation.. The original implementation of this simply passed the contents as a buffer to the provided callback by calling store.. readBuffer(), but this is now changed to pass the resulting store object to the callback.. The value in this is that the caller can use the store object to access metadata, contentType, and other details.. The user can also determine how they want to read the file (either into memory or using a ReadableStream).. This code just has a small blight in that it checks to see if the filename and fileId are equal.. If they are, it then checks to see if metadata.. filename is set and sets store.. filename to the value found there.. I ve tabled the issue to investigate further later.. The Model.. In my specific instance, I wanted to attach files to a model.. In this example, let s pretend that we have an Application for something (job, a loan application, etc) that we can attach any number of files to.. Think of tax receipts, a completed application, other scanned documents.. Here I define files as an array of Mixed object types (meaning they can be anything) and a method addFile which basically takes an object that at least contains a path and filename attribute.. It uses this to save the file to gridfs and stores the resulting gridstore file object in the files array (this contains stuff like an id, uploadDate, contentType, name, size, etc).. Handling Requests.. This all plugs in to the request handler to handle form submissions to.. /new.. All this entails is creating an Application model instance, adding the uploaded file from the request (in this case we named the file field file , hence.. req.. files.. file.. ) and saving it.. Now the sum of all this work allows us to reap the rewards by making it super simple to download a requested file from gridFS.. Here we simply look up a file by id and use the resulting file object to set Content-Type and Content-Disposition fields and finally make use of.. ReadableStream::pipe.. to write the file out to the response object (which is an instance of WritableStream).. This is the piece of magic that streams data from MongoDB to the client side.. Ideas.. This is just a humble beginning.. Other ideas include completely encapsulating gridfs within the model.. Taking things further we could even turn the gridfs model into a mongoose plugin to allow completely blackboxed usage of gridfs.. Feel free to check the.. project.. out and let me know if you have ideas to take it even further.. Fork away!..

    Original link path: /page/2/
    Open archive

  • Title: Zend Framework 2: Select Optgroups | James Carr
    Descriptive info: About James Carr.. An agile software developer living life in Columbia, MO working for Carfax.. com.. View all posts by James Carr.. This entry was posted in.. Bookmark the.. permalink..

    Original link path: /2012/09/16/zend-framework-2-select-optgroups/
    Open archive

  • Title: James Carr | James Carr
    Descriptive info: Author Archives:.. I issued a pull request that.. As.. It s been one busy day, cranking out features like no tomorrow (even issuing pull requests on github to fix Zend Framework 2 issues) and still finding time to improve my PHP toolbelt.. Today I ll share guard-phpunit, which I discovered thanks to a tip by @ctshryock.. I ve been using this as a replacement for watchr which I use.. I ve been using Zend Framework 2 on a recent project due to it being the department s framework choice and off the bat one of the things that really irked me was the Struts-ness of how models are  ...   stating that (yeah, I hear you screaming PHP!? Yech!!! ) I m actually quite happy with a change in pace and the development environment.. Recently I had a challenge of getting capistrano deployments working from jenkins installed on a RHEL box.. The problem seemed to be down to the fact that ssh-agent isn t running for the daemon process that jenkins runs as for whatever.. Instead of.. What s the first thing you do when you wake up in the morning? Check facebook? Check twitter? Your email? Watch some morning news when you get ready? All of these things are easy for us to do when we wake.. Likewise,..

    Original link path: /author/admin/
    Open archive

  • Title: Uncategorized | James Carr
    Descriptive info: Category Archives:.. For the most part I was satisfied with just having people push snapshot releases to our Artifactory server but some..

    Original link path: /category/uncategorized/
    Open archive

  • Title: Using Select In Zend Framework 2 | James Carr
    Descriptive info: Zend Framework 2: Select Optgroups.. 2 Responses to.. Will Smith.. October 18, 2012 at 10:50 pm.. $form- get( genre )- setValueOptions() throws the fatal error of call to undefined method.. Did you define your own setValueOptions? Can you update the post with how you would actually add options?.. October 19, 2012 at 8:21 am.. This should work as shown.. Did you checkout my.. skeleton project.. I put together on github? This is the actual project I reference in this post..

    Original link path: /2012/09/16/using-select-in-zend-framework-2/
    Open archive

  • Title: Fixing PHP Code Standard Issues | James Carr
    Descriptive info: Using Select In Zend Framework 2..

    Original link path: /2012/09/10/fixing-php-code-standard-issues/
    Open archive


    Archived pages: 767