nick woodward

Ranch Hand
+ Follow
since Jul 12, 2014
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nick woodward

So on the off chance that someone makes the same mistake as me, what I've discovered is that:

1) When `express.urlencoded()` processes FormData it always seems to convert numbers to strings. Whereas `express.json()` for appplication/json data does not.

2) (and this is the annoying one) `express-validator` has methods that are converting numbers to strings. So `.escape().isString()` won't work, but `isString().escape()` will.

I'm no expert but #2 seems pretty short-sighted for a package validating inputs!

Bear Bibeault wrote:Are you talking about request parameters or the request body?

Both are always strings, but the body is interpreted by the content type mime type (in this case application/json).

For example, if the body represents a binary type (e.g. JPEG image), it'll be passed as the image data encoded as a string (base64 if I recall correctly).

JSON is a string. The mime type tells the receiver that the string in the body is to be interpreted as JSON.

The body itself - and I use `express.json()` on the server side. So should that be converting each variable (as in req.body.x, req.body.y) to it's intended type? If that's true (and it sounds like it is from your JPEG example) then it's not working as intended, but at least I now know where to look, and that I should probably still validate against types that aren't strings


Bear Bibeault wrote:Request parameters are always strings. So checking them as such isn't really checking anything.

That's kind of what I thought. But then I started questioning whether it was because I was using application/json as the content type, or some similar reason.

So if there's no scope for someone passing data that isn't a string, why on earth would express-validator have a `isString()` method? Weird.

Thanks for the reply!

Hello! Long time no ranch! Whilst longing for a similar JS community I thought I'd double check if there was actually a sub-forum here...  and here it is

Anyway, I've been a bit confused lately whilst trying to test my server side validation and thought someone here might be able to enlighten me

I've been using express-validator's `isString()` method, and suddenly realised that all my client -> server communication comes in as JSON anyway, so is in effect, a string. In other words, why would I ever check whether `req.body.exampleVar` is a string?

I've considered leaving the `isString` check in place, just to be sure, but because I can't pass an integer anyway I can't test if the validation is even working!

I guess what I'm saying is that there's a hole in my knowledge here, and I'd appreciate it if anyone knows either a simple answer or of a good resource I could read on the topic



PS: is Roel still about?
From Amazon:

This book is for experienced Java EE developers who are aspiring to become the architects of enterprise-grade applications, or software architects who would like to leverage Java EE to create effective blueprints of applications.
What You Will Learn

It's JavaEE8 according to the cover. Hope that helps

thanks Les. I'm definitely interested in what you're saying, but am a bit confused as to how i'd achieve it? would i apply the html in the columnrenderer if the row was divisible by 2? sorry, i'm not great with tables!

this has gone on the back burner since i *almost* solved it last week. i made an SCCE, passing the standard Jtable width and (cell height * row number (+1)) to a JDialog and got it to popup on clicking a column (column B):

but it's definitely a bit buggy, and i can't get the bloody JDialog to disappear! i've tried setting visible(false), dispose() - none of it works.

perhaps your html method is a better way to go



6 years ago
I posted on stackoverflow yesterday asking about the posibility of a table that resembles this:

From the looks of things, a JXTreeTable can fulfil the expandible side of things, but there seems to be no way to make either the parent or child node span different numbers of columns (as shown above in the childNode). Other questions I've seen are old, go unanswered, or have broken links. One in particular says it's not possible. But is this still the case? It seems pretty strange that it isn't possible, unless I'm looking at using completely the wrong type of object.

An alternative I'm thinking of is just to have a pop-up appear just below when the cell is hovered, which spans the width of the table. But it's certainly not as nice a solution.

Any help would be appreciated,


6 years ago
thanks for the reply andrew

there's a good chance i'll end up buying this or your other on the subject (having reading Jeanne's review)

I've been looking at a few agile books this evening and came across your other book, Learning Agile: Understanding Scrum, XP, Lean, and Kanban. I was wondering if you'd mind outlining some of the differences between the two, including style and tone of writing, as I'm a fan of this series of books too (if you can call them that? O'Reilly's animals...), but I've found a couple of them quite dry. On the other hand, while I like HeadFirst the reverse can sometimes be true, slightly more HeadFirst Design Patterns than HeadFirst Java in terms of 'loudness' (I love my OCA/OCP7 certification book - I'm sorry BB and KS).


I understand where you're coming from, but I don't think it's condemning the book at all. I plan on checking it out initially via safari's trial to see if it's a good fit at least with my second requirement. I'm not withdrawing from the competition, I'd love to win the book - I won't - but I'd love to. As I said, headfirst books are always a good place to start, and I'm sure this is no exception.

However, as Junilu points out in reference to the original question there is a difference between books, and not just this one, that focus on project management and workflows rather than how to develop software. I don't think he meant it as a condemnation either.
nice, i'll definitely have a look at those books.

does the PPP book bridge the gap to some extent? or would I be better with XP Explained and seperate dev books? i only ask because despite asking about the technical side, I'm also helping a friend with his start up company at the beginning of next year, as an intermediary of sorts between him and his small dev team of 2 or 3. I did a decent amount about s/d processes in an information systems course many years ago, but never really dived into the agile side of things in great detail. I'm maybe naively assuming that as a small start up the principles can be applied in a rather adhoc fashion. This seemed to be at least the case for the project management methodologies I learned about back then, although I know that's somewhat different to the more narrowly focused s/d side of things

anyway, I'll probably start with Haines' book. thanks again for the information - and for scaring me with the "just for starters" phrase after naming 6 books!

also, just to confirm - most agile books are management material by their very nature? I only ask because  XP Explained: Embrace Change has had this same criticism levelled at in in it's amazon reviews.

I think I'll probably grab it regardless - although I'm keen on the 1st edition for £1.70 over the £25 second edition (ill check the changes though...)

Junilu Lacar wrote:I don't want get into TDD too much here and digress from the original question of target audience so I will start another topic specifically about TDD.

wow, great answer Junilu, thanks.

TDD is an area I've dodged and know I shouldn't have.... it's one of the pluralsight video series i never quite got to (and as with most of them it no doubt only scratches the surface). will definitely look into it.

as for distractions - i create enough of my own to worry about someone else XD

thanks again
Hi Andrew and Jennifer,

I'm currently learning to develop software and was wondering if this book is good from that perspective rather than from a managerial role? Also what methodologies does it cover? O'Reillys shop doesn't seem to cover either of these. Apologies if these are ill informed questions, I've just started looking into the area and the headfirst books are always a good place to start.