Networking tips

Here are some of my notes for simple networking tips. Again, mostly my notes borrowed from the web or other sources so I don’t have to look up all the time. Maybe it’ll be helpful to someone else.

Mac Ordering different Networks

The network service order configuration should be set up in order to properly work on two different networks. Adjust the order if your having problems reaching a specific network or if the different network should be the default.

  1. Open network in System Preference (Apple -> system preference)
  2. Click on configuration gear icon beneath network interface
  3. Select Set Service order from popup
  4. Order networks.
Posted in Uncategorized | Leave a comment

Developers CheatSheet: Linux

A collection of useful commands to get things done.

GIT

Display a formatted list of commits in a range for a specific user
git log --pretty=format: "%aD %an %s" -author="tom" --after="2015-02-08 00:00 --before="2015-03-15 23:59"

Linux/Unix/Mac OS

Add a soft symbolic link
symlink: sudo ln -s /opt/google/chrome/google-chromedriver /usr/bin/chromedriver
brace expansion
echo {aa,bb,cc}
echo file{0..10}.txt

    Getting help

  1. help
  2. man
  3. whatis/apropos
  4. which
  5. whereis
  6. locate

History

!! execute last command
!commandString reruns last command with commandString
!num rerun command by number
ctrl+r+string search command history for last command with string

Shell commands

Set background
setterm -background white -foreground white -store

Networking

connecting

Access remote machine
ssh username@server
Port forwarding
ssh -L <remote port>:<host name>:<host port> username@server

transferring files

copy remote file to local location
scp username@host:mydir/myfile local/dir
copy local file to remote location
scp local/dir username@host:mydir/myfile

web requests

Request data from a web page
curl -XGET -u username:password "http://hostname:port/path?params=value"
search response and count occurrences. Need 2>&1 to properly handle output. Drop the pipe to wc -l if only search is needed
curl -XGET -u username:password "http://hostname:port/path?params=value" 2>&1| grep -o 'searchterm' |wc -l
curl to elastic search. Simple filtered query
curl -XGET localhost:9200///_search -d ‘{"query": { "filtered": { "query": {"match_all": {}}, "filter": { "and": [ {"term": {"": “"}}, {"term":{"": “"}} ] } } }

Posted in Uncategorized | Leave a comment

Web Dev Gottchas

Just thought I’d start adding gottcha’s as I encounter them. This list will grow over time.

  • Uploading files via AJAX is not currently possible. Save your time. You can use iFrames and Flash or other mechanisms.
Posted in Uncategorized | Leave a comment

To IDE or Not

Background
After spending a couple years in the Ruby/Rails world, I made it back to Java (and Groovy/Grails). In doing so I new I’d have some choices to make about my dev environment. Working primarily in Groovy I thought I’d follow some of my previous workflows and use similar tools that I used previously in Ruby and Rails. But being under the gun and not having the luxury of experimenting, I decided I would use what I already knew, the IDE. But I was pretty shocked at how painful it was to go back to the IDE.

The IDE offers a one stop shop of features that increase productivity and is pretty easy to leverage. Just follow the wizards, menus, workflows, etc. You can poke around and find new features pretty easy. Editing, navigating, deployment, even checking code in is pretty easy. Most people might not think they need anything else. However, after using vim for a while, I began to love it and after running into various issues with the IDE, and convinced most developers should experiment with vim and leverage its use.

If you’re not already aware. the Ruby editor of choice is vim with a slew of plugins. Vim is a text base editor that is known for being a bit unfriendly and wooley to the uninitiated. But, vim does one thing and one thing well: editing text. Text can be moved, deleted, changed, duplicated, and more with very simple commands. Boom, boom, boom, done. By the time another developer reaches for the mouse, the task is done. The flip side is trying to remember all the terse commands and just knowing if something can be done. Plug-ins fill in the blanks that a developer needs besides text editing.

No doubt vim is tough. You really can’t experiment with it to see if you like it. You can’t use it for a couple hours and expect any of it to stick or to give you a satisfying feeling in your gut. You have to use it for a while. A few weeks of dedicated use at least. Probably a month, or more. You’ll need to learn the very basics: navigating, editing, saving, quitting. Then you will need more advanced skills, jumping around, substitution, marking, opening up multiple files, and more. Then leveraging plugins for searching, running tests, checking code in and out, and more. It takes a while to learn, but is well worth it.

But hey, I can do all this in my IDE. Why Vim? I don’t need it. Vim is satisfying and efficient once you get the hang of it. There are many places were you can learn about the benefits of vim. My goal is to whet your appetite and encourage the use of vim, not to teach it. Since you read this far, your probably already somewhat interested. The rest of the post will cover the problems I had with the IDE and why vim works better for me.

comparisons
I am currently using Eclipse and this article is primarily targeting Eclipse. I fully acknowledge JetBrains IntelliJ is a much better IDE and hence will be making the switch. I plan on making some updates after I switch and have some time to evaluate. However, I am pretty certain many of the same issues will be present, just less annoying.

Editing
Working with the mouse is just plain inefficient. Thing about saving a file. If I am typing, I can hit ‘:W’ (The save command in vim) well before you can touch the mouse, not to mention to move to the File menu and scroll to save. Don’t believe me? Then why do you prefer ‘ctrl + s’ in your IDE instead of the mouse to save 😉 See your already sold on the IDE. Vim is just a hop and jump to the left away. Next, swap a line of code. I need to get my cursor to the line of code. I can usually get it there in a couple key presses, again about the time you can reach for the mouse. Then a ‘dd’ followed by a ‘p’ swaps the lines. Your still highlighting. A sophisticated IDE user is probably already aware there is a short cut to do this. OK. so there are some nifty commands for editing and moving around, but my IDE of choice has many shortcut keys AND more, it has Auto complete.

autocomplete
A couple notes about auto complete. Auto complete is not always your friend. It gets in the way, especially in Eclipse and more so in Groovy/Grails. My recent forays with autocomplete are frustrating. Given, Groovy is dynamic and the IDE has issues which are not it’s fault, but it still has issues. Eclipse has a habit of completing text that is not what I intended. Options that pop up are of not what I really want. In straight Java, auto complete is pretty cool and works pretty well. But less so in other languages. But what I see is many people use that as a crutch and don’t really learn what is in their code. With that said, Vim has auto complete. It can give you lists of many things that is surprisingly accurate. Typically it buffers information about the file your in and presents those as auto complete field choices. It works surprisingly well. IDE’s get the edge, but vim isn’t really far behind in reality.

searching
Next, searching. I hate searching in Eclipse. I have too many choices. In the file or workspace or maybe working set, remote searching, case sensitive, or wrapping, file name patterns and search pattern, folders choices. Then I get weird output of files that I have to drill down into. REALLY? In vim, I have a few simple options that are super powerful. Built in search is 90% of what I use. In one key stroke I can enter my text or regular expression and can search through the text forwards or backwards, and word wrap by pressing the next button. A line search is handy for jumping to the next character on the line. Handy but not used to often. Then there is the SilverSearcher plugin. A simple ‘ag’ followed by the text will search the current directory and list the output long with file name. You can add folders to limit the search. Need something else. Leverage find and grep. Hey, vim is a Unix/Linux and Mac tool and the OS is our friend. Window guys/gals, upgrade or get something to help like Cygwin to fill the gap. Searching, way better in vim.

resources
Other advantages, vim is lightweight. IDE’s are fat and bloated. Eclipse takes resources. Serious resources. And it keeps taking them. They are memory hogs and freezes are pretty typical for a variety of reasons, most of which you will never know why. Anyone really dare to look at the error log? Set up is often more difficult than it needs to be. Occasionally you can import a project and all works. But when it doesn’t, man, it doesn’t.

files
At the end of the day the IDE is an editor. Everything else is just candy to help you get your editing done. As explained above, vim is just a better editor. But it’s more than just moving the cursor around and typing in text. How much of your IDE. is a text editor? What are all those other boxes surrounding your editor? Not to turn this into a geometry class, but I suspect they take up nearly 50% of the real estate. OK, you can maximize the editor or minimize the other views. But what if you want to see two to different files side by side, or even the same one, but at different points in the file. Do able, but a bit painful in Eclipse. You have to drag tabs around, which always want to go where they want to go, not where you want them to go. But there you go, reaching for the mouse again. In Vim, just a couple key strokes and I have my source file split next to my test file. And I can jump between them with a simple key command. I haven’t figured out how to do this in Eclipse. Gotta grab the mouse. OK, now I gotta look at that other file right next to the one I have open. How do I switch tabs? hmmm…. Oh, there is a funky key command that just made it into Eclipse that allows you to move to another tab. Really? Just recently? Sure there are some shortcuts that go to last edit, which are handy, but not necessarily to the next tab. And if you want to jump from file to file as you dig through the source as a stack, AND keep the other files in view while you do that, with simple key strokes? Don’t try in an IDE. Dealing with file navigation is painful in Eclipse. Big wing for vim.

spelunking
With all that said, an IDE is great a spelunking. I hate poking around source code in an IDE. If I don’t know what I am looking for, but I am just randomly checking files for something, the IDE is much better, I can open a directory and start clicking on files. Very easy and natural. Big win for IDE.

distractions
When I am in my IDE and I maximize my editors, again, because and IDE is primarily and editor and I want to see my code. I get popups that interrupt my editing. This is very annoying. Some view somewhere is updated and it is determined to tell me about it by popping up over my code and taking focus away from my mouse after blinding me of part of my screen. Sure I can find that setting and turn it off, but why the heck was it on in the first place? Again, I should be editing. It seems other things are taking priority over that in the IDE.

Tabs
Tabs. Tabs should not be in source code. That is my belief and your may vary. But like all beliefs mine are correct. Or more accurately, the one that is talking is correct, and this is my blog, therefore… anyways, tabs cause problems. Some environments set tabs differently. Some 8, some 4, and occasionally some to 2 ( but those people deserve what they get). This makes the format of code blow up when code rendered on a editor with 8 space tab is displayed on a 4 space tab. And you get a helpful engineer that fixes the 8 space tab to 4, only to have the even more helpful 8 space tab engineer reset it. In reality, no one does anything and it’s just a mess. Keep tabs as spaces. Wait, is this a diatribe that just lost all focus? Not at all. Try setting tabs to spaces and tab spacing in Eclipse. You will find dozen of places. Did you get them all? Really? Are you really sure? What about for HTML? XML? OK, good. CSS? hmmmmm….. Text files? JavaScript? Other files? Not fun. easy to do in vim.

Compatibility
Many tools work in a specific way. They have to be tooled for the IDE. I was using Spock testing framework and found a feature that wasn’t supported in Eclipse. works fine on the command line but not in the IDE. Probably not common, but it occurs. Tools have to be specially written for the IDE. Bleeding edge experimenting is not for the feint of heart, especially in IDEs.

content assist
And for my number one pet peeve? Content assist. I already mentioned auto completion where Eclipse often just decides it will autocomplete for me, thus interrupting my typing with something not even close to what I needed. But in addition, it tries to complete things other than methods or variables. My quotes. Grails supports triple quotes. Eclipse is damn sure you don’t really mean to use triple quotes. I am sure some poor sap of an engineer spent a long time on that part of the code base to perfect the heuristics of how to deal with quotes. But I can say it is wrong. Sorry dude. Sure Grails is a bit odd in the triple quotes, but truth be told, I don’t use triple quotes that much. My more bothersome issue is when I type regular set of quotes, but I do them in the wrong order. Try typing some text, then add quotes at the end. Not your normal workflow, but I end up doing this a fair amount. I type something and forget the opening quote. Then I add the end quote, but I get two. If I delete the first quote both disappear and I have none. Rinse an repeat, or I have to move over to the last quote. Remember navigation above? I can grab the mouse or I have to move all the way over to the arrow keys. ARGH. The delete the last one. Now I have to get to the beginning of the text to add the first quote. Again grab the mouse, which if I am right handed, I had to let go to hit the back button and re-grab to move the cursor to the beginning of the line. Retype and then delete. ARGH. In vim, the problem never even crops up. and if I do miss the quotes, I have a plugin that will surround text with quotes. Or brackets, or parenthesis, or angle brackets, or what ever. Very cool.

I don’t mean to disparage IDEs, but to show that they have lots of quirks, and I am sure you probably have some of your own, that are much better handled by vim. Vim is not a limited editor, but a powerful IDE in it’s own right with the right support pug-ins and tool support.

resources
A few resources to get you started
A good resource for leveraging Unix as a substitute to your IDE.
Unix as an IDE
A much better explanation of vim and why it is good
Why, oh WHY, do those #?@! nutheads use vi?
A good intro into tackling vim
Vim Revisited
An Example setup for Java
VIM configuration for happy Java coding
And another (primarily for groovy, but still applies to java)
Using VIM as your Grails IDE Part 1: Navigating your project

Posted in Uncategorized | Leave a comment

Modularizing CSS Tips

Let’s talk CSS. Not the uber sophisticated CSS designers use, but let’s focus on how a developer can manage their CSS and keep from going nuts. In particular, how to start thinking about modularizing the style selectors, file layout, and even some naming conventions. CSS is pretty simple in concept and a lot can be done with a little knowledge. But nightmares will plague you  if you don’t think and plan out your CSS files.

Some people don’t seem to care too much about style. Developers often rejoice in not having design skills. And unless your working on a green field project or a site redesign, you probably rarely touch the CSS files. But when you do start making changes to the style problems arise in unexpected ways. Developers cope with unexplained behavior by experimenting and hoping some semi random tweak will work. And if all fails, write a new style to stop the madness by overriding cascading selectors.

I’m offering a tips that can help manage the madness.  These modularizing tips are simple but hopefully will encourage people to plan out there CSS. Don’t balk at the simplicity. Simple means it can be implemented and maintained.

Many CSS resources exist and are only a Google search away. One of my favorite CSS sites is Zen Garden, which highlights the power of CSS. I am not a CSS expert in anyway, I just hate fighting against it when I know CSS could actually work elegantly.

Files

Main CSS

Most experienced CSS authors partition their files and it’s worth looking at some of their code. Check out design centric websites and pick up ideas. A natural approach to start partitioning is to start with general and application wide settings. Zero out margins, remove borders, set default fonts, etc. This is usually the preamble to the main css file. The reason is to remove any unexpected behavior. Browsers historically interpreted borders, margins, and other properties a bit different and caused no end to the headaches when trying to herd pixles. So, tip 1, have a main CSS file named something like main.css.

The main.css should contain the styles that affect the app on the whole. The general look and feel of the site goes here. Fonts, colors, general containers and their spacing, etc are all defined in the file. Don’t litter this file with everything and anything. Just the major styles for the theme of the site.

I know, not a huge tip. You all probably already knew that one. But the real tip is not to make this file thousands of lines long which will impede your leveraging existing styles.

Feature/Module CSS

To prevent fustration when trying to find existing CSS styles to reuse in a gigantic file, think about partitioning the styles into multiple files. That’s tip 2. Like any good piece of software, the problem space is decomposed into smaller more manageable chunks. Same goes for CSS. Put related styles in to a it’s own file. This can be done at a feature or module level. What ever makes sense. This may be layout  concerns for a checkout page, item details page, search results, etc. The style rules should be target specific page level concerns not generic ones. A container such as a panel or pane that is used on the page is probably generic and should have its own file dedicated to panes, panels, or containers. A site that has a public and private section, and/or an Admin area separate from the users may all have a slightly different look and feel. Separate these into a private theme CSS file or admin CSS file.

jQuery plugins come nicely packaged in modules. Packages typically contain a css file for whatever widget the plugin is providing. Think about your own HTML elements as widgets with their own CSS files. Layout your CSS in a way that the widgets work with parent CSS files and don’t restate rules that a parent rule already states. Some times it might require a little refactoring to spit apart an existing rule so your component can use part of an existing definition.

The general idea for tip 2 is to make many small decomposed files that can be mixed and matched and facilitate searching for relevant existing rules, and to limit unwanted rule clashing. It’s not rocket science, but it does take some thought.

Naming

Naming choices becomes important with all these files and widget selectors. Properly naming helps searching and preventing naming collisions. Not sure about you, but I often get frustrated when searching for some potential useful rule and find myself going on a snipe hunt instead. Less disciplined developers will end up creating new selectors rather than finding an existing one.

Name Spacing

Tip 3 is to prevent collisions by name spacing your selector names. Prefix several components together to create a good selector name. A potential name spacing strategy may include the app name, feature name, widget name, and element name all concatenated. For instance “myapp-catalog-frame-header” would define a frame header for my apps catalogs. This would be a different header from the header used on the summary page, or the frame used in a different area of the app. Top level components would have shorter names while other lower level components would have longer names. Generic Layouts for catalog would start with “myapp-catalog”.  I can find all the catalog styles in the catalog.css file instead of some ginormous CSS file that contains rules for everything. The Catalog may have rules for the frame, the frame headers, frame spacings, perhaps even unique button styling on this page, or perhaps custom message styles.

rule names

How do we go about naming our style selectors? I’ve seen class names like “blue”, “right”, “top”, etc. These names seem might seem ok when you first use them. As the saying goes, the two hardest problems in computer science is cache invalidation and naming things. I don’t invalidate caches on a regular basis, but I name things all day long. Get use to it, and make some attempt to make the names be meaningful. That’s tip 4.  I think we can all agree that these names are horrible.

Suppose you have buttons and they have a style called blue attached to them. Your company is bought out and the site is re-branded. Blue buttons become green. What do you do? Update all the pages to include a green rule? Or perhaps, because you you used the DRY principle and only want to change the one rule that matters. You change blue rule to have the the color green. Wow. That would be bad, but is often done. Maybe we won’t get bought out or re-brand our site. That doesn’t negate the issue, it’s still bad.

So what do we do? We have to use names carefully. We don’t want to describe what it does. The details of the selectors do that. We want to give it a name that reflects what it is rather than what it does. This allows you to adjust the content as needed. Perhaps the class can be a “button”, a “checkout-button”, or a ‘signup-button’. Each one with it’s own styling. Perhaps the buttons styles cascade down from ‘button’ as well as some page specific style such as promotion that adds additional characteristics.

Misc

Small Selector Styles

Element styling doesn’t have to be defined in one giant rule. In fact it is probably better to break it into several smaller style rules to facilitate more flexibility and reuse. You guessed it. Tip 5. Segregate font and colors from spacing and alignments. Each get their own selector. How flexible do you want your CSS to be?

Cascade your style sheets

Did I really title this one that way? I find it interesting that a lot of good developers don’t actually leverage the C in CSS. They don’t cascade. Tip 6 is simply to embrace cascading. Stop fighting it. CSS gets very convoluted and difficult to debug when selectors are created to prevent cascading. I admit it isn’t always easy but it is more elegant if you do it right and things work better.

KISS

Yup. How could I not add that. the last tip is to keep it simple. Or maybe, simplify. Quit trying to man handle CSS by forcing the square pegs in the round hole, and using a hammer to smash CSS into submission. Take a step back and rethink the approach a bit. A simpler design is better.

Recap

  1. Put general site wide CSS styles into a main.css
  2. Break up your styles into module, features, or however you want to divide it up.
  3. Incorporate name spacing.
  4. Name selectors with meaningful names
  5. Break apart your styles into cohesive units
  6. Embrace the cascade
  7. Simplify your CSS

wrap up

Going through all these hoops is a bit of a pain. Granted. But having a clean layout and sanely interacting CSS is a joy. Well maybe not a joy, but I assure you the opposite is true. Maybe you don’t fully agree, at least until you have had issues maintaining a project that had less than desirable CSS files. I know these tips weren’t earth shattering and not new. But I do think a lot of developers can use this info. Hopefully I reached one or two of them.

And in case you were wondering about the performance of serving out many small files, don’t worry too much about it. Modern Web Servers have techniques to combine files together to reduce the number of requests made for many small files. Find out what your web server provides and make sure it is implemented.

Just some thoughts
Tom

Posted in Uncategorized | Tagged | Leave a comment

Programming Sucks

Cool article that describes the realities of programming. Oh, the horrors.

Link | Posted on by | Tagged , | Leave a comment

Integrating AngularJs with Legacy Server Controller

This week’s challenge was to integrate our existing Rails app with new AngularJS page to provide better user experience. We are reworking the existing processes a bit and leveraging web service calls to load data into the page. I’m amazed at how quickly we can get work done because of the power of AngularJS’s bindings and lack of DOM manipulation.

Purusing the documentation and Google uncovered little to help with integration. The current focus seems to be doing cool and sexy stuff in AngularJS and a ton of basic how-tos. However, not much press about how to work with legacy code. Hmmm… Do you blame them? I don’t

NoInit

The typical way to init an app is to serve out a bootstrap page and have the JavaScript code initialize itself from embedded, generated, or retrieved data. I can imagine a scenario where the back end server could serve out a page along with some bootstrap data from the outset. Then lazily load other data on demand. Although not ideal, it allows integrating with legacy server side code and can reduce some web server traffic, both speeding up app init time and reducing server load. This won’t be a huge savings, but it’s something and the sooner you can get the page loaded, the better the user experience.

The trick is how to get external data into AngularJS app. We were thinking of three main “integration patterns” and completely ruled out the fourth.

  1. URL
  2. Hidden Tags
  3. ng-init
  4. inline javascript

The first, adding parameters to the URL, is OK for a few items and is commonly used, but it makes for an ugly URLs and doesn’t scale well as the params grow. Cutting and pasting large urls is error prone and inconvenient. Potentially tripping Twitters character limit. LOL. There is a reason bit.ly exists. The second, Hidden Tags, seemed promising, but feels hacky and in-elegant. Hidden tags only exist as a temporary place holder that has no use after the page inits. The third, ng-init, was the most likely candidate and a few developers recommended this approach. Please, for the love of humanity, don’t use inline JavaScript, ’nuff said.

<div ng-init="myVar="Hello world"/>

Happy with our decision, we started to implement the solution and had to reference  the online docs, which is were we found an issue. The documentation strongly states the only use case for using ng-init is with in the ng-repeat tag.

The only appropriate use of ngInit is for aliasing special properties of ngRepeat, as seen in the demo below. Besides this case, you should use controllers rather than ngInit to initialize values on a scope.
https://docs.angularjs.org/api/ng/directive/ngInit

Hmmmm….. That was odd and not expected. Although several online posts pointed to this being the solution we were looking for, there were always those that were quoting the official docs that prophesize doom and gloom if you proceed. Our issue was passing several values into a function that we wired up to ng-init. We were using Rails erb scriptlets, which are make reading the code difficult by being verbose when embedded in a tag parameter.  Undeterred, we moved a bit further until we discovered a fatal error. The ng-init loads AFTER the controller. So we were left with undefined initialized scope variables. ARGH. Those Hidden tags were looking a lot nicer.

<div ng-init="init(<%= APPNAME::MYMODULE::MyFormater.format(
@someclass.my_value.capitalize).to_s%>)"></div>

It’s easy to see how unwieldy this is with only one attribute, imagine passing in two, three, or more. Yukk. Some people would argue that nice looking code isn’t important. For me, readability and clean code has lots of advantages. Other posts to follow on this topic.

The basic thought for using the hidden field contains a single tag for each value to be integrated. This makes the code a little easier on the eyes and readable. The tag initializes from the erb scripting tags which then bind to a Angular model. Ruby evaluates the scriptlet and output a string in the ng-init variable. Angular will load up the ng-init and assign it to the model on the hidden tag making it reachable via the $scope.

<input type="hidden" 
       ng-model="car.engine" 
       ng-init="car.engine = <%= @vechicle_options.engine %>"/>

This isn’t ideal, but it adds one param at a time in a nice “readable” format. It’s not too busy. I’m not happy with this approach, but it seems to be the decent solution.

We finally settled on a different approach. Solutions typically are designed for a given problem. When your trying to do something, you run into a problem and frame it in your mind a specific way, which presents certain solutions. Often I have implemented something only to have some one else ask why didn’t I do it this way or that way. Because I thought about it differently and this was the solution that worked. Reworking the problem space often yields different solutions.

And that is what happened. Thinking about the issue and exploring the data a bit more changed what we really needed to do. It turned out several items didn’t need to be pushed in to the app after all, which made ng-init a little more appealing. We cleaned up the code a bit by simplifying the original param. This was done by moving the logic in the scriptlet into the server and just returned a simple string. This init function was defined in the rootScope and updated a model object that was stored in the service. The view accessed the model via the controller which exposed the model.

The view

 <div ng-init="deliveryInit('<%= @campaign_source %>')">

And here is the initialization snippet from app.js, which injects my model as a service and sets the values.

myApp.run(function($location, $rootScope, $route, myModel) { 

$rootScope.deliveryInit = function(initializedValue) { 
  myModel.someProp = initializedValue
  //other init if needed.
};

The model is currently defined in the service.js. But I want to move elsewhere. Here it is defined as a value. I want to move this into a “domain.js” file which contains POJO’s (plain JavaScript object).

var myServices = angular.module("myServices", ['ngRoute']);
myServices.value('myModel', {
  someProp: '',
  someotherProp: ''
}

The controller exposes the model. The name is the same and can be confusing. Some might want to expose it slightly differently.

blastSendControllers.controller('subscribersController', 
                                 function ($scope, myModel){
$scope.myModel = myModel;
}

And the view that uses the value

 <input type="text" ng-model="myModel.someProp" />

I’m not suggesting this as a valid approach, but a potential solution. The trade off is AngularJS doesn’t seem to endorse this approach which could have some ramifications. The Hidden field approach may make more sense for your app. Anyone have a better, cleaner, more elegant solution?

 

Just some thoughts

Tom

Posted in Uncategorized | Tagged , | 1 Comment

Welcome Post

Welcome to the show. The paints not quite dry and the scaffolding is being removed as I write. I’m feeling out the space a bit. The space echos a bit since their isn’t much here yet. Your probably asking yourself why your reading this post and are just about to click away, and I don’t blame you. But keep checking back and maybe there will be something of interest a bit later.

So, whats this space about? Mostly Development. That would be programming stuff. Java, Ruby, Javscript, Groovy and other alternative JVM languages. Maybe some Python, probably not Perl, and definitely not COBOL. I’ll probably delve into functional stuff here and there and maybe logic programming too. Technologies such as NoSql Databases, Messaging Systems, Web Servers, and other supporting cast of characters will probably grace the stage.

The development process and best practices are a very important to me and will probably take top billing.  TDD, Software Craftsmanship, Agile Processes, OO Design, and Best Practices will hopefully show up in every post.

I will also throw out various random and unrelated things. Audiobooks, podcasts, photography, guitar, cooking, and other tips, tricks, or recommendations as I find them. Basically anything that excites me.

Lots of the material will be inspired by others I admire or think have something interesting to say. I’ll add tips and tricks as I discover or think about them. I’ll provide links to interesting must read posts. I’ll also provide some book reviews for essential must read/own books and other blogs.

You might ask, “why write a blog?”. Several people I admire and several books I’ve read all suggested and recommended it. Get some material out there, stretch your comfort zone, and have some fun. But really, I think the two main reasons is to help me rationalize and digest material I’ve read or things I’ve wrestled with at work. The other is simply marketing. To get your name out there. Some employers want to know more about potential candidates.

Hopefully I’ll share some knowledge that will help someone.

Thanks for stopping by

Tom

Posted in Uncategorized | Tagged , , | Leave a comment