Mercurial Check In Process With Maven

Many projects I have been on have used Mercurial for repository control, so checking in is a two stage process: 1) commit to your local copy of the repository and 2) push to the central repository. Following the check in procedure before pushing code can help ensure the build does not break.

Prerequisite

All of the code runs and passes a user smoke test, and all of the tests run in the IDE.

Check In Procedure

  1. Do an hg pull –u (or IDE pull/merge).
  2. If you have any merges/conflicts fix them, smoke test and then hg pull –u (or IDE pull/merge) again, repeating process until you have a clean & quick pull and update so you don’t have to test – other people may be checking in etc.
  3. Commit your changes hg commit –m “<checkin message>” (or IDE commit).
  4. Run the FULL maven build: mvn –e clean install site
  5. If the build succeeds, hg push (check in) the code to the central repository.

As usual . . . EVERYONE on the team has to follow a process like this; it keeps the timing down so there aren’t any checkins while you’re running the build.

Wireless Repeater Setup

cynetwork

Add security, or risk the complete destruction of civilization.

Here’s how I set up a wireless repeater with two wireless routers (also called a WDS or wireless distribution system).  The purpose was to add more hard wired connections and also extend the range of our wireless network.  Also, I can cut off my NAS from the outside world/Cylon attack by switching off the repeater at anytime.

Gear:

  • Linksys WRT54G v5 (base) already running your wireless internet/network
  • EnGenius ESR600H (repeater)
  • LAN network cable.

The 54G is the base station, connected to the cable modem for internet access.  The 600H is the repeater with some wired hardware hanging off it.  The intent is that the entire network can share all resources (internet, connected devices, etc.) with one login to the network.  Also the 600H has giagbit wired capability adn 300 mbps wireless (its an upgrade).

If you have older routers, look at open source software like DD-WRT, Tomato or OpenWRT to give your old router repeater capability.

Data to gather before proceeding:

  • Network Name and password/key.
  • Channel # of your base router.
  • MAC Address of your base router.

Stretch Goal:

  • I wanted to make sure I didn’t  interrupt any existing functionality on my current network.  So I didn’t have to do anything special to the 54G (except confirm security).

Keep in Mind:

  • During the setup, make sure to do hard restarts between major steps.  Also, your machine may have to have the WIFI turned off at certain times due to the IP address renewal policy on your computer.
  • Understand how to do a factory reset on your repeater.  If you make a mistake you can start over.
  • Once you turn off the DHCP on the repeater life becomes a little more difficult; make sure you renew the IP address on connected machines.

Procedure (600H)

  1. Hook up with LAN cable to the  repeater (may need to turn off  your computer’s wifiWIFI).
  2. Log onto 192.168.0.1 (or whatever the IP is) and the default usr/pwd to get to the admin screens

Part 1: WIFI setup  (600H)

  1. Goto Wireless 2.4GHz -> Basic
  2. Change Mode from AP to WDS
  3. Change SSID1 to your wireless network name from the 54G (there are four on this 600H model, used #1)
  4. Change Channel to match the channel on your 54G
  5. Enter 54G MAC address
  6. For SSID #1 on 600H, add security information from 54G

Part 2: LAN Setup (600H)

  1. Goto System->LAN change IP address to 54G domain, but outside of the 54G range for DHCP.
    1. The 54G Range is 192.168.0.100-150, so don’t take a number in that range.
    2. Give the 600H the IP 192.168.0.2 (where 54G is 192.168.0.1).
  2. Assign the 600H an IP range outside of the 54G, for instance 192.168.0.151-200.

Now you can test that the network is working.  Anything hooked up should be accessible.

Part 3: Disable DHCP

  1. Disable DHCP Server on the 600H.  Now all the IP’s will be served from the 54G once you cycle everything.

Confirmation:

  1. You should be receiving IP address assignments from the 54G now.
  2. Your equipment attached to the 600H will be online.
  3. Everything should be able to access the internet.

Post work:

  • I turned off 5ghz wireless on the 600H for now, because I don’t have anything that is dual band.

Lessons learned:

  • I hate myself for not getting a dual band card in my notebook when I bought it.  It would be SOOOOO fast.
  • Start at the bottom (repeater), and work back (station) to stay attached to the internet.
  • Keep an alternate way to hook up to the internet in case you have trouble.
  • Security may not mesh well between routers — try different things (WEP, WPA, WPA2 etc) if you have to.
  • If you change any password etc. make SURE you do it on the boxes the lowest on the food chain. What happens is that since the relay box isn’t a DHCP server anymore, if you apply settings after turning it off and wired up then you can’t re-attach and have to reset the box and start over!! Which involves a hard reset and unplugging a box

Future:

  • Switch routers (so that the 600H is the base) due to faster dual band.  But not yet.

Crazyopolis

hannibal

Welcome to my project.

“The Leadership Team”

Sometimes history repeats itself so badly you just can’t believe it.The content you are trying to access is only available to members. Sorry.

Displaying WordPress Post Parts

I switched this blog theme to “Photon” for a bit, very minimalist,  where I had 10 posts per page.  I just wanted to get some Google Analytic stats on specific article reads, and having full articles on a page doesn’t give that to me.  I needed the articles to display like this on the navigational pages:

  • Home Page  (Page 1)
    • Entire Recent Article
    • First 128 character excerpt of next 9 articles.
  • Page 2
    • First 128 character excerpt of next 10 articles.
  • Etc.

So I had to adjust index.php from the WordPress editor, and here’s what I did:

<?php get_header(); ?>

<?php get_sidebar(); ?>

<div id="wrapper">

<!-- $posts defaults to 10 but you can change it-->
<?php /*$posts = get_posts('numberposts=10');*/ ?>

<div id="posts" class="excerpts">

<ul>

<!-- this section sets the length of the preview for older articles, using a WP filter -->
<?php
 $firstElement = 0;
 function custom_excerpt_length( $length ) {
 return 128;
 }
 add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
 ?>
 <?php foreach ($posts as $post) : ?>

<?php setup_postdata ($post); ?>

<!-- this specifies what hyperlinks show up in the title position -->
 <li><h2 class="post-title"><a href="<?php the_permalink (); ?>"><?php the_title(); ?></a></h2>
 <small><?php the_time('F jS, Y') ?> by <?php the_author() ?></small>

<!-- reset the data query or there will be defects in the behavior -->
<?php wp_reset_query(); ?>

<!-- make sure the post is first one on first page, if so show all of it, else you just get a excerpt-->
 <?php if (get_option ('photon_index_post_length') == "full" && $firstElement == 0 && is_home() && '1' > $paged ) : ?>

<?php the_content (); ?>

<?php else: ?>

<?php the_excerpt (); ?>

<?php endif; ?>

 <p class="postmetadata">
 Posted in <?php the_category(', ') ?>
 <strong>|</strong>
 <?php edit_post_link('Edit','','<strong> |</strong>'); ?>
 <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>

<?php $firstElement++; /* bil */ ?>
 </li>

<?php endforeach; ?>

<li>
 <p style="float: left"><?php previous_posts_link(); ?></p>
 <p style="float: right"><?php next_posts_link(); ?></p>
 <p style="clear: both">&nbsp;</p>
 </li>

</ul>

</div>

</div>

<?php get_footer(); ?>

Douchebag UX

The other day a coworker of mine said to me: “God I have Google, it tries to do too much when you start typing in the search.”  I have felt the same way about this for years; I’m sure we all have.  Especially when you have an Android phone and the dang browser starts completing your search before you even start don’t want anything CLOSE to its suggestions.

I commiserated: “you know, I’ve noticed since these spell checkers are automatically in place, I have to re-check my emails even *more* than I did before.  The things always make the wrong corrections.”  She agreed.  It happens quite a bit.  I used to type my thoughts, and run back for one spell check (or run a global checker).  Now the damn things make contextual corrections as well as spell corrections and really get into your head when you are writing.  I do NOT find them helpful anymore.  That and sometimes that ajax lag while the computer “thinks”.

Design many times goes too far.  I think people want simple and people and complex, they want choice, well at least I do.  One of the reasons I continue on with Windows/Linux/Android is because of the choice of configurations, vs Apple which “just works” (I saw, looking at a dead MacBook sitting on the other desk sigh I liked that thing).   If you’re a java developer like me you know why we don’t like Apple — dealing with different JDK’s is a nightmare.  OF course Oracle hasn’t made it any easier for us at all, making everything “installable.”

Simple:  The story I remember was the competition for book sites, and how Amazon won.  Basically all the others (like B&N) had very complex search interfaces with title filters, author filters etc. all in as part of the main search; you had to do 3-4 operations to do a seach whereas on Amazon just type once in a search box and the intel does the rest.  Fine for that — but we don’t always want that.

Complex: Even Amazon has more complex filters alongside the results screen though not always adequate.  But they have them.  Newegg, TigerDirect, all those sites have filters and more complex searches.  I need the complex searches because I am always looking for outliers.  One thing I noted a while back on the job boards is that many of them don’t have filters for obvious things users want — like telecommute vs. onsite.  When I see glaringly obvious and missing options or behaviors in software I wonder just who in the hell is making these decisions of usability.

It’s really about use cases, not some Douchbag UX Wannabee’s Opinion

Ego, it’s the killer.  If you want to develop good skillsets, in my opinion, learn to observe and listen.

Some time back I was in Nordic ski patrol and I needed cheap all purpose ski wax.  Those were my requirements.  I had to take my skis across rocks and through backwoods trails for our race patrols and didn’t need something great, just something inexpensive, all-purpose and easy. In the store the salesman had roots in Olympic racing and doing the famous Birkie and the Loppet races around the world.  He tried to keep selling me on expensive race level wax.  I kept saying that the wax would be toast every 3 k, explained what I needed it for etc.  He just wouldn’t listen.  None of my needs were being me so I left and bought nothing.

This is what I find is happening in many Stand Up and Requirements meetings these days.  Some people are pure douchebags.  They’s as “well, this is really what they want. ”  Wow, What The Fuck.  Then you get one of those locked-in-gold requirements in WRITING even: make it work like it used to – from the same DBags!  Usually users are the experts in their domains and since BA and PM jobs have become professions, not extensions of other professions, the effect is getting more pronounced.  Sure developers have made some bad stuff.  Craigslist is about as good a look as most of us *should* design, and at least that is functional. (Developers aren’t usually UX designers — OBVIOUSLY even we know that.)  And Craigslist is still amazing.

Agile Ain’t Design

God it even gets world if non-builders start pontificating on “Lean” and “Agile.”  If I had a Dimebag for every Douchebag Lean/Agile non-expert, the cartels would be after me.

The mechanisms of agile feedback are pretty much shot due to the blamestorming nature of modern corporations — failure (required to create things) is never tolerated so the benefits of learning are never reaped.  This is critical for UX . . . it is so very difficult to find out the real use cases and they may not emerge until after the software is made — and new use cases show up!

A process isn’t design, and using a process as a management club certainly is not design.

Who’s a Jobs?

If you look at Apple’s business model they they don’t really invent anything groundbreaking, they watch everyone else figure out the Use Cases, take the good ones and perfect them.  That’s their genius, and its what Steve Jobs figured out.  It’s definitely contributative. (lol stupid word — use it in a meeting and see if it starts showing up in job descriptions)

But — how many people are Jobs vs how many think they are Jobs?  How many really understand use cases?

Monstrous egos and the lack of empathy contribute to shitty software.

Recently on a project there was a dropdown on the pages that allowed users to select a page state.  It was very useful for development and testing.  Not useful for customers though (or so we thought).  Having the dropdown allowed testing and development to shave time off our effort. I offered numbers up, and to make the control developer-only and they would have none of it.  It reminds me of the fact that testing and refactoring are part of development but businesses don’t want to pay for them any more than people want to pay for their cars oil changes.

Listen and learn, that’s all I have to say.  Seems simple, but it isn’t.

When All’s You Have Is A Job Title, Everything Looks Like Something To Be Managed

Let’s go back in time, to a famous Mythical Man Month lesson:  Nine women can’t have a baby in one month.  Translates to: Throwing more developers at a project will not get it done faster.  Also translate from my personal experience of being a developer for over 20 years: nothing demotivates a developer more than removing ownership of a story from that person during the time they are working on it.

Developers are motivated by ownership.  And nothing annoys a developer — a good developer — more than having to continuously maintain an old stale piece of code.

One gig I worked was a young upstart “lead,” not the worst by any means.  The lead’s only weapon was to come to a developer or a pair and say “is there anything we can split up into more stories to help out?”    We were on a time crunched schedule and the lead was one of those who didn’t understand where estimates came from, thought the title “lead” meant “better developer” (it’s about 50/50 — and in this case did not).

The problem the rest of us were having was that our estimates were being ignored and we were being held to the lead and a few other pm/BA types estimates.  The usual big corporate — you have all the blame but none of the power.  Usually I would write up analysis of the problem I was assigned with meaningful breakdowns, but, since I wasn’t the “lead” this would get ignored.  Experienced developers know how this goes, and its happened many times over my career.  And I don’t mean that my estimates and analysis were refuted, I mean not even looked at, taken seriously, or considered.  When that happens — you let go.

Many of us were taking strategies on the team to get around this management blocker.  Most would lie about their work.  Some would “push it along.”  Some used social context/friendship to coax sanity out of management.   In fact not one of the developers or pairs during standup status meetings in the morning would say anything other than gray reports because of this management style.

If you worked on the piece the inevitable would come — the lead would “break it up” mid development, cause another to waste their time explaining it, hand it off, while the next person then tacked on another thought of code at the end of the first part.  Defects showed up everywhere and eventually we would get a story done and spend twice as much time fixing defects because developers were forced to mid-work divide and conquer when it didn’t make sense.

Rereading the above, two things come to mind:

  • The lack of trust on the team from less experience leads created havoc and defects.
  • This lack of trust and respect force all developers, junior to senior, to be forced to work in a political minefield.

When a consultant says “that’s why I get the big bucks” — this example is one of the why’s.  Dealing with the BS.

The most difficult thing to do in a management position is to let go and trust.  An even more difficult thing to do is to mentor “superiors” on the org chart through their learning journeys.

In the end cool heads and experience prevailed,

Why Should I Buy Your Product?

Recently I was researching projectors and found a nice Acer I thought would do the trick.  I need one because I am probably starting up a tech group in a city I am moving to and, well, you know.  I saw something interesting in its specifications:

Compatibility: PC Only.

Curious.  A PC ONLY projector?  Who would be fucking stupid enough to do that?  Mac people LOVE to show their stuff, I I love to look at it.  So I opened the PDF manual that was for about 10 projectors including this one, and inside it said this projector was compatible with Mac OS’s.

Hmmm.  OK.  My first instinct is to email them the question, but since most companies don’t like you to talk to them and send nasty emails back like “did you check the FAQ?”  — I checked their forums, their support information, their manuals, and their FAQ first.  BTW – those emails back confirm my suspicion that most support staff knows nothing (in the case of HP, they literally know nothing at all).

My HP Story: When I purchased my current notebook, I asked two questions: 1) does the extended battery stick out of the machine and 2) can I use the VGA and HDMI outputs at the same time.  Their support staff was wrong on both counts.  They made up for it by telling me to check their FAQ’s, which had no information at all, just opportunities to buy different colored mouse pads. (note that I like my HP OK enough, but, I wouldn’t trust them to feed a stuffed animal for a weekend.)

OK so I’ve checked everything.  Nothing, Nada.  Not even an entry for this model that has been out since Spring 2012, and its Spring 2013.  Now time to email them.  Cringe.  I look for the email-us link. I look.  I look and look and look.

From the large toppy mountain I looked for a help link.

Cause I needed somes helps to make sure the product d’nt stink.  

I clicked all anchors, the help-yous, and shines

But there was no way to email this questions o’ mine.

acer serious

You CANNOT be serious . . . . no way.

How many times has that happened to you?  You can’t find the “contact us” link.  I couldn’t.  I wasted 20 minutes looking, and now 20 more here, writing my experience — one we’ve all had.  IBM has usually been the laragest transgressor of this, and I get it.  People want to mail questions that have already been answered and it costs money to hire the support staff.  People want to talk to humans and it costs money to hire support staff.  I get it.

KBaseEmail

Worse — are those “CHAT” boxes.  You know, those effin lightboxes they sometimes pop up to ask you the first time you’ve hit their site, on their home page, if you like their entire site and if you need help.  I have to hunt all over for one; it would show up out of the corner of my eye on one page, flicker up and away on another.  Finally I find it’s home page and  I click it — message: “Chat is available 5am to 2 pm CST”.  WTF, it’s 7:30 am CST.  Annoying.

I mean, people want.  People want.

What happens if you are a company who doesn’t give people what they want?

Remote Connection Commands – Black Screen

I was remoting in to my work box with a Cisco hookup and the screen was black.  I got it back by using ctrl-alt-end, which is the remote (RDP) command for ctrl-alt-del.

Here is a list of RDP commands from Microsoft’s Technet:

Shortcut key Description
ALT+PAGE UP Switches between programs from left to right.
ALT+PAGE DOWN Switches between programs for right to left.
ALT+INSERT Cycles through the programs in the order they were started.
ALT+HOME Displays the Start menu.
CTRL+ALT+BREAK Switches the client between full-screen mode and window mode.
CTRL+ALT+END Brings up the Windows Security dialog box.
ALT+DELETE Displays the Windows menu.
CTRL+ALT+MINUS SIGN (-) Places a snapshot of the active window, within the client, on the Remote Desktop Session Host (RD Session Host) server clipboard (provides the same functionality as pressing ALT+PRINT SCREEN on the local computer).
CTRL+ALT+PLUS SIGN (+) Places a snapshot of the entire client windows area on the RD Session Host server clipboard (provides the same functionality as pressing PRINT SCREEN on the local computer).

Here is a useful translation table created by Patrick Yeung:

Original Combination RDP Combination Description
CTRL-ALT-DELETE CTRL-ALT-END
ALT-TAB ALT-PAGE_UP Switch programs from left to right
ALT-SHIFT-TAB ALT-PAGE_DOWN Switch programs from right to left
ALT-ESC ALT-INSERT Cycle through open apps
PRNT_SCRN CTRL-ALT-<NUMPAD_MINUS> Screenshot of desktop
ALT_PRNT_SCRN CTRL-ALT-<NUMPAD_PLUS> Screenshot of active window
CTRL-ESC ALT-HOME Open Start Menu
ALT-SPACE ALT-DELETE Open active window System Menu
N/A CTRL-ALT-PAUSE Full Screen/Window Mode Toggle

Mercurial Merge

There are times when you will see some more difficult to resolve Mercurial conflicts, perhaps with extra branches in Tortoise.  This usually comes about because a developer forgot to pull the most recent code before pushing a recent check in.  For instance, the .hgtags file which tracks build numbers will be out of sync because the developer did not pull it down before checking in.

Transparent Merge

In Mercurial, when you pull and update from the repository, merges are usually done transparently if there are no conflicts:
:”’hg pull -u”’

Deliberate Merge

There are times when trying to do an update in Mercurial from the central repository, the tool will report that there are merge conflicts.  The first thing to try is a merge, commit, then push like so:

:”’hg pull -u”’
–>cannot update, merge conflicts
:”’hg merge”’
:”’hg commit -m “merge””’
:”’hg push”’

Resolve Merge

But if something more complicated happens, like the hg tags scenario where your local file is completely out of sync you need to resolve the conflicts.
:”’hg resolve”’
–> this will open the default file comparison tool, or KDiff if you have tortoise installed, so that you can manually merge the files:
[[File:Merge sample.jpg]]
:”’hg commit -m “merge””’
:”’hg push”’

Hibernate Eager Fetch gets Too Many Results

Working on a bug today, there was a list of items with a set of sub items coming back from the database via Hibernate. Something like this in pseudocode:

@Entity
@Table(name = "PARENT", schema = "USER")
public class Parent implements Serializable {

private Long id;
private String name;
private List<Child> childList = new ArrayList<Child>();

@Id
@SequenceGenerator
@Column(name="PARENT_ID")
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

@Id
@Column
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@OneToMany(mappedBy = "parent",fetch = FetchType.EAGER)
@Cascade(CascadeType.ALL)
public List<Child> getChildList() {
return childList;
}

public void setChildList(List<Child> childList) {
this.childList = childList;
}
}

@Entity
@Table(name = "CHILD", schema = "USER")
public class Child implements Serializable {

private Long id;
private String name;
private Parent parent;

@Id
@SequenceGenerator
@Column(name="CHILD_ID")
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

@Id
@Column
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@ManyToOne
@JoinColumn(name = "PARENT_ID")
public Parent getParent() {
return parent;
}

public void setParent(Parent parent) {
this.parent = parent;
}
}

@Repository
public class ParentDao implements SomeGenericDao {

public List<JasperReportTemplate> getAllActiveTemplates(Long firmId) {
final Criteria criteria = getCurrentSession()
       .createCriteria(getModelClass())
       .(DO SOME CRITERIA ETC>);
return criteria.list();
}
}

Here are your data sets for PARENT(parent_id, name):

  • (1,”parent1″)
  • (2,”parent2″)

And your data sets for CHILD(child_id,parent_id(foreign key),name)

  • (1,1,”child1″)
  • (2,1,”child2″)
  • (3,2,”child3″)
  • (4,2,”child4″)

When you try to make a list of *just* PARENT with this configuration you end up getting:

  1. parent1
  2. parent1
  3. parent2
  4. parent2

But what you want is this:

  1. parent1
  2. parent2

It’s because of that EAGER fetch — it forces everything to be in ONE BIG QUERY with all the tables so you get a Cartesian result. What you really want is just unique PARENT values.

Solutions

Removing “EAGER”

First, if you remove the EAGER, you won’t be loading any CHILD data. This could be problematic because the CHILD data won’t be available without making another data call to hydrate those objects. Depends on what you want.

Returning a Set instead of a List from the DAO

Another solution is something like this in the DAO in your java, that will return a set object that automatically filters the unique objects:

 Set = new LinkedHashSet();
 set.addAll(criteria.list());
 return set;

Supposably this is a workaround. it does work though.

Setting @Fetch

yet another solution, and one that I use, is to just set @Fetch on the child property:

 @OneToMany(mappedBy = "parent",fetch = FetchType.EAGER)
 @Cascade(CascadeType.ALL)
 @Fetch(FetchMode.SUBSELECT)
 public List<Child> getChildList() {
 return childList;
 }

I’ve also had success with using FetchMode.SELECT. This forces Hibernate to do a subquery on the child instead of one massive query — and you get all the data back.