Open Side Menu Go to the Top

07-13-2015 , 12:42 PM
Quote:
Originally Posted by Grue
Thanks this was helpful.

I've never felt the need to use an html templating engine. Biggest reason is that you'll be debugging in html anyways. Jade in particular doesn't seem to fit the JS/front end model especially in regards to whitespace. IDK I could be convinced but it seems like more abstraction for not a lot of benefit.

Could someone who knows express take a quick look at my todo list app(50 lines, no update yet)? Like I said I'm totally going by the seat of my pants here and would love some feedback but hey it works mostly. Usual front end ajax stuff. link
Looks good to me, except what happens if your TODO item ID already exists in your DB? If your IDs aren't unique they really aren't IDs, and the retrieval/remove behavior is not going to be what you expect I suspect.

You probably need some logic to handle duplicate items, although w/o knowing your exact use case and how To Dos get into your DB, it's hard for me to say what that logic should be.

Code:
app.use(bodyParser.json());  // ytf do I need this anyways?
For whatever reason express split off the json body parser a while back, so you have to explicitly add it. There are also some config options you might want to set. Here's what we use:
Code:
app.use(bodyParser.urlencoded({extended: false, limit: config.size_limit}))
.use(bodyParser.json({limit: config.size_limit}))

Code:
      app.get('/', renderPage);
        app.get('/index.html', renderPage);  // redundant?
I don't think you need the second unless you have some weird link pointing to index.html.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
07-13-2015 , 12:50 PM
Quote:
Originally Posted by Low Key
More shocking it's been a full 2 years since a 0 day in Java was publicly disclosed...I mean "discovered".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 12:52 PM
Lol applets
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 01:00 PM
Quote:
Originally Posted by suzzer99
Looks good to me, except what happens if your TODO item ID already exists in your DB? If your IDs aren't unique they really aren't IDs, and the retrieval/remove behavior is not going to be what you expect I suspect.
The id I'm using is auto generated by mongo so I think its fine?

Quote:

You probably need some logic to handle duplicate items, although w/o knowing your exact use case and how To Dos get into your DB, it's hard for me to say what that logic should be.
Items are all (now) being referred to by the id I'm throwing into the data-todo-id there i.e. the DELETE is sending its ajax request to that url. Still seems "wrong" to me but I understand what other people are saying.

Quote:
Code:
app.use(bodyParser.json());  // ytf do I need this anyways?
For whatever reason express split off the json body parser a while back, so you have to explicitly add it. There are also some config options you might want to set. Here's what we use:
Code:
app.use(bodyParser.urlencoded({extended: false, limit: config.size_limit}))
.use(bodyParser.json({limit: config.size_limit}))
Its more like.. why do I even need a json body parser at all? It blew me away that inside of a app.post's req object there's no direct reference to what was sent in the body! req.body does nothing without that bodyParser nonsense. Oh well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 01:00 PM
This is a long shot but is anyone using or has done research on using Violin Memory for their data storage needs? I'm interested to know if you belive they have any advantages vs competitors such as Pure Storage. Be it price or technology. Also any insight you can share on the flash data storage sector as a whole would be appreciated.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 01:05 PM
Quote:
Originally Posted by Grue
I've never felt the need to use an html templating engine. Biggest reason is that you'll be debugging in html anyways. Jade in particular doesn't seem to fit the JS/front end model especially in regards to whitespace. IDK I could be convinced but it seems like more abstraction for not a lot of benefit.
Code:
                                page += '<ul>\n';
                                docs.forEach(function (el) {
                                        page += `<li data-todo-id="${el._id}">${el.todo}<a href=#>x</a></li>\n`;
                                });
                                page += `</ul>\n${footer}`;
Youre using es6 string interpolation which is an improvement over adding a bunch of strings but its still not in fashion I'm afraid. I wouldn't want to be seen wearing anything less than handlebars and still the jade people will look down on your taste.

Code:
<ul>
  {{#each docs}}
  <li data-todo-id="{{_id}}">{{todo}}<a href=#>x</a></li>
  {{/each}}
</ul>
You should probably be setting the status code for your post/delete routes, I think mongo can take another function as the error callback where you can send the 404.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 01:14 PM
Quote:
Originally Posted by Low Key
Quote:
Originally Posted by e i pi
if you leave java enabled in the browser, you're already part of multiple botnets

I thought this was common knowledge?
hehe
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 03:34 PM
Quote:
Originally Posted by Grue
The id I'm using is auto generated by mongo so I think its fine?

Items are all (now) being referred to by the id I'm throwing into the data-todo-id there i.e. the DELETE is sending its ajax request to that url. Still seems "wrong" to me but I understand what other people are saying.
Yeah the problem here is you can have identical To Dos which are viewed as the same thing to the user, but separate identities by the DB. I would think when a user enters a TODO - your code should check for one of the same text that already exists and warn them.



Quote:
Its more like.. why do I even need a json body parser at all? It blew me away that inside of a app.post's req object there's no direct reference to what was sent in the body! req.body does nothing without that bodyParser nonsense. Oh well.
I think there were some potential security issues with body-parser, so they wanted to separate it out from express so users only use it when they definitely need it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 05:05 PM
Quote:
Originally Posted by Grue
Thanks this was helpful.

I've never felt the need to use an html templating engine. Biggest reason is that you'll be debugging in html anyways. Usual front end ajax stuff. link
You probably should consider it.

All your concerns in that snippet seem tangled together. You have your backend server definition, the composing of the pages in pieces, and even the composing of a html <ul> list all together.

Also, you link to js files and mentioned ajax stuff, so I assume you have a SPA app of some sort. So, other than SEO concerns, you should consider not composing your html serverside at all, and using a js framework like react or mithril. That's a separate issue, though. Assuming you are doing server side html rendering, you should at least do it with proper templates rather than manual string concatenation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 08:05 PM
yeah I misspoke, obviously templating engines such as handlebars & even underscores are great and I use them all the time, I meant html templating "languages" such as jade which seems a bit excessive.

and yeah its a 50 line app learning tool for express and mongo so didn't bother with that stuff anyways. ES6 string template literals are actually pretty cool.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 09:19 PM
Another classic example of Android ****edupdness. One of our devs just spent 3 hours trying to create a workaround because the Samsung 10" tablet (which like 43 people own in the world) was getting portrait and landscape mixed up.

I finally figured out that because the button is on the long side, rather than short side - the device reports landscape as window.orientation = 0. When you rotate it to portrait then window.orientation changes to 90 or -90. Whereas every other device we have in our test pantheon (about a dozen) have buttons on the bottom, and therefore portrait is window.orientation = 0, not landscape. Whole front end framework needs to be refactored 2 hours before we're supposed to be done testing.

So fun.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 11:01 PM
Quote:
Originally Posted by suzzer99
Each option in an HTML select form element has a Name and and an ID. Can you use an HTML select and re-style it? If not I see no problem with creating some kind of similar structure.

But yeah something like Dave posted with hidden form elements with IDs indexed by number to correspond to the row would work.

Also this is one of those things where it feels like you're approaching it all wrong if your RESTful API can't handle either a) multiple items with the same name, but actually referenced by ID or b) a lookup/action based on name which could return/act-on more than one item.
You might be able to style the select element but pretty sure you cannot style the options element
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 11:09 PM
Quote:
Originally Posted by suzzer99
I don't know anyone who's used Jade for a while and wanted to go back to straight HTML templating.
I'm about to start on redoing our front end. I've used Jade quite a lot on my own. I suggested that we should use it but my team leader was less than enthusiastic about it. I need a really convincing argument that no sane man can say no to. Can you help me?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2015 , 11:25 PM
Broken HTML breaks hard and fast instead of weird edge case where you find out an orphaned </div> tag is causing layout issues.

Cuts the # of lines of a template roughly in half.

Due to the indentation = opening and closing tag - you get a lot more built in HTML validation than other templating engines.

Indentation for blocks vs. <tag></tag> is much easier to read once you get use to it.

To me the best argument I can think of - I've never known anyone who tried it, got used to it, and still hated it and wanted to go back - whereas I know dozens of people who can't stand to look at HTML tags now.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-14-2015 , 07:37 AM
Quote:
Originally Posted by suzzer99
To me the best argument I can think of - I've never known anyone who tried it, got used to it, and still hated it and wanted to go back - whereas I know dozens of people who can't stand to look at HTML tags now.
I fall into the category of used it for a while, got used to it, disliked it and never touched it again.

It's been around 4 years since I used node/jade heavily but I remember the issue that annoyed me the most with jade. It was wanting to do this:

HTML Code:
Words with a link ended by <a href="#">a period</a>.
I forgot the exact implementation with jade but I remember having to pipe the period on a new line due to how jade processes elements. It was so alien looking, an online converter shows:

Code:
| Words with a link ended by 
  a(href='#') a period
    | .
I remember addressing this with the author of jade and he was like in those cases just use the raw html element in jade, but I think mixing both together is even uglier.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-14-2015 , 08:28 AM
Anyone got a recommendation for cheap cloud static file hosting? Need it for our arcade, if a game gets a ton of hits we need to be serving the game files from the cloud as our 1gbps connection wont cut it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-14-2015 , 09:22 PM
Is there a better recent website overhaul than Bloomberg and even more so BloombergView? Seriously, the sites just absolutely crush in pretty much everything I could use to critique a site.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-14-2015 , 09:25 PM
How long do you think it lasts with Bloomberg in charge?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-15-2015 , 05:31 AM
Bloomberg looks much better on mobile than it does on full screen.

I love the Apple Watch article. I'll give you an estimate. There are 7 million people in the SF Bay area, so if you have the expectation of every man, woman and child in SV buying one and add that to the weighted probability of everyone else in America buying one, you end up with 7 million units sold.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-15-2015 , 06:28 AM
Quote:
Originally Posted by Larry Legend
Is there a better recent website overhaul than Bloomberg and even more so BloombergView? Seriously, the sites just absolutely crush in pretty much everything I could use to critique a site.
Really? On desktop, the front page left scroller, which scrolls faster than the main page (I'm guessing to fit in more content? Or maybe someone trying to be cool?) is distracting and captures my visual focus, so that I'm noticing that instead of the headlines in the main section.

Not crazy about the typography.

The tiled article layout is nice but I don't like the needless animation rollovers that show some kind of article tag I can't figure out in red.

Top nav on homepage seems too thick and cluttered -- I count 5 distinct sections, 3 dropdown menus, 9 or 10 clickable items, and an embedded live news feed, and that's ignoring the stock ticker below the main nav, which has its own nav.

When you click on the main dropdown under "Bloomberg Business" that brings up the full site menu, you cannot click again to close it. It brings up a full page modal, and you have to move your mouse to the far right of the page and click the X to close it.

I could go on... All that said, compared to other major news sites it fares pretty well, but it seems strange to hold it up as some paragon of amazing web design and usability.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-15-2015 , 07:46 AM
Quote:
Originally Posted by daveT
Bloomberg looks much better on mobile than it does on full screen.

I love the Apple Watch article. I'll give you an estimate. There are 7 million people in the SF Bay area, so if you have the expectation of every man, woman and child in SV buying one and add that to the weighted probability of everyone else in America buying one, you end up with 7 million units sold.
"Apple is Failing" is still a safe story I guess.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-15-2015 , 08:07 AM
I believe the Apple Watch' potential lies in what developers can come up with.

So far, I personally haven't found a use case to want one. So I can relate with that point of view.

When the iPad came out, there were similar opinions. But the main difference to the watch (so far) is that people came up with tons of use cases in very short order and that was prior to release. Even to the point where the device itself without specific apps could be of use in some way. I'm missing that with the watch.

Having said all that, it seems to sell like hot cakes. Might be fanboism this time around, but only time will tell.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-15-2015 , 01:02 PM
Quote:
Originally Posted by kerowo
"Apple is Failing" is still a safe story I guess.
Except that's not what the article is at all...

For those who didn't read it, it is actually a total Apple fanboi article, dripping in awe of Apple's incredible marketing strategy. The fact that no sales numbers have been released shrouds the company in mystery and intrigue, and teasing us with sales numbers produces more hype, and yes, it is quite possible that more people have bought the Apple Watch in the first few months than people who bought the iPhone and iPad... combined!

Maybe it is perception, but I haven't seen a single watch to date.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-15-2015 , 02:22 PM
Hmm, that's not the article I read, perhaps we came into it from different starting points.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-15-2015 , 05:56 PM
if the primary functionality of an app is creating user profiles and filtering/aggregating average user stats for these profiles... is the best option by far to use a relational db? or are mongodb queries good enough for say ~1000-10,000 users? computing the #s once a day in a background job would be fine.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m