Interested in contributing to Messaging App?

I am on Chrome, specifically: Google Chrome Version 57.0.2987.133 (Official Build)
On Windows 10 currently.

@OvermindDL1 what does the following return when you run it in the browser console? new Date().getTimezoneOffset() / -60.

Here is the code that is setting tz-offset.

I just patched the server. Let me know if that helps.

That just mean a lot of easy Issues and PR for new members of the community.

Win Win

1 Like

Actually, this is an interesting example of let it fail. I did not check the value of the string before calling String.to_integer (with is a dangerous api to start with since it throws on any non integer string). So @OvermindDL1 could not login.

However, I was able to see the issue immediately in the logs and now I know I have an issue with some browser settings (likely) that is not running the JS to get the browsers timezone offset.

I now have a fix in to default to tz_offset 0, so it should allow him to login, but the message timestamps will be off now.

However, if I had coded it defensively, I would then have to trace down why he is seeing incorrect timestamps. This would have likely taken longer to troubleshoot.

1 Like

Testing now, got this when I entered username, password, then submitted:

Exactly! Let the community do the work! :smiley:

I never ever ever use String.to_integer/1, I only ever use Integer.parse/2. ^.^

Yeah I log very very noisely with anything I do not expect. I get tons and tons and tons of logs… >.>

I try to keep the user-interface always working in some way though.

EDIT: Chrome says this was the submitted form data:

_csrf_token:*******************************************************************************
_utf8:✓
tz-offset:
session[username]:OvermindDL1
session[password]:*******************

@OvermindDL1 Shoot, forgot to load the module after I replaced the beam file. Once more try if its not too much of a bother. Thanks,

Lol, all good, I’m in now, though all it does is breathe at me in the center of the screen? ^.^;

Doing some research, you are pulling in javascript that is not local to the site, cross-domain, however your site is not https/secure so it is disallowed. You should bake all javascript in to your site (and don’t use jquery, jquery is horrible and useless nowdays) and/or add a secure certificate so https works. :slight_smile:

I’m not seeing those issues. So I presume you have tighter security configured on your browser. I know know the issue bringing non secure in from ssl. Did not realize it went the other way. It looks like the web socket connection is broken. I have code in the channel connect that clears the loading mask.

I am at work yes, they do a lot of things to minimize virus’s and such, you know how workplaces go. ^.^;

It’s not a bad idea to do what they do though. Basically they just disallow cross-site-scripting when either of the domains are insecure, allowed only if they are both secure, helps prevent hooking a web session over the wifi or so. They encourage secure sites when at all possible. :slight_smile:

Basically what it looks like is happening is you are trying to access jquery, but since it is not loaded it crashes, so the rest of your javascript is not running. Really should not use jquery anyway, its useless anymore, and if a browser supports websockets anyway then jquery is really entirely useless as the native browser API’s can already do it all anyway, well, except doing it slower. :slight_smile:

1 Like

That makes sense. I’ll work on getting the certs setup. Removing jquery will be a longer term project. I use a number of jquery plugins. So I will have to find alternatives for those. I’ve been following your jQuery rants for a while now and its starting to sink in. LOL

Zepto is a jquery replacement, it removes the internals of jQuery for compat with things like IE8 and crap, entirely lightweight as much as possible, with a lot of built-in common jquery extensions and entirely modular (only build in what you use). It is significantly faster than jQuery, significantly smaller than jQuery, and a good middle-step between removing jQuery and not as you slowly peel parts of jQuery’s calls out. In essence it just translates jQuery calls to the native browser calls to act as a middle step while jQuery is fully removed (or just leave it in). Plus it works well with brunch to only import the parts you actually use to keep it even more tiny. :slight_smile:

Just start with npm install --save zepto as always. :slight_smile:
Then bind it to whatever variable name you want in your Brunch config, like to $ for example, if you want it globally (global access brings in all modules since it cannot tell what you will need for note, keep your javascript in brunch, not html whenever possible).

1 Like

Thanks. I had a bitch of time getting some of the jQuery plugins to work with my node installed jQuery. Using the cdn was just a hack to get things working. I’ll look at zepto. Thanks!!

Adding an entry in brunch to expose jquery globally usually fixes those. :slight_smile:

And no, it was not well documented to do so, that was personal experience finding that out. >.>

It has not been that easy for me. I setup $ in globals. But that did not seem to work. I just don’t understand the whole JS work flow enough. And the docs for brunch really suck IMHO. I’ve spend days farting around with JS build/import issues on this project.

I really should take a couple weeks and learn JS inside and out. But I would much rather work in Elixir. That is part of the reason why I gave up on a JS url auto linker and wrote my own in Elixir. Didi the same with the Emoji picker and filterer. Its Elixir too.

1 Like

I’ve seen some plugins that access jQuery via the global jQuery variable too (I think I have the capitalization correct…) and I had to bind that too (*cough*bootstrap*cough*).

Hmm, drab? ^.^

Or Polymer? ^.^

1 Like

This is a great idea. I have thought about writing a chat app for a long time. One that was more developer focused.

I have spent the past several weeks diving into angular and typescript. I want to write an electron app.

I am happy to help either with my new angular knowledge on the frontend and definitely on the elixir side.

2 Likes

In terms of paying the rent that may have been a wise move - however I continually wonder about the wisdom(/benefits) of using something like Angular in the first place. And while Typescript is great for supplying type information to IDEs for coding assistance and while I like static typing support there is this:

Non-goal: Apply a sound or “provably correct” type system. Instead, strike a balance between correctness and productivity.

Sound’s to me that while being “statically typed”, TypeScript is choosing to be “weakly typed” - i.e. the primary motivation behind TypeScript is to bring in the OO baggage that many Java/C# developer’s are already familiar with.

I spent a significant amount of effort to “skill-up” in Angular 1.x, getting to the point where I started to see the wisdom in “How I’ve Improved My Angular Apps by Banning ng-controller” (Tero Parviainen’s “Build Your Own AngularJS” is a great piece of work btw.). Now Angular 2 fixes a lot of issues but by being an “opinionated framework” it’s “view of the world” is the one-and-only “correct view of the world” and ultimately it still feels way too heavy-weight and too OO (in a Java EE type of way).

In my opinion Angular’s adoption was primarily driven by corporations preferring open source backed by “big names” (i.e. Google - even though this also implied that Google is motivated by it’s own agenda and not really motivated to listen to anybody else) and backend OO developer’s wanting to do front-end development while largely staying away from the browser’s DOM.

The other issue with a heavy-weight framework is the temptation to move actual business-domain-logic into the front-end which architecturally speaking is a “bad idea” (a disconnected, browser-based app is a different kettle of fish). While a UI should remain responsive, it should focus on performing “UI-logic”, not business logic.

Working through jQuery, Angular 1.x, Node.js, React.js, and Elm I’ve become more reluctant to invest in frameworks and favour highly focused, small libraries (which compose well with other highly, focused, small libraries).

So it makes me wonder if @OvermindDL1 is onto something with a “plain JavaScript + Polymer (more generally, web components)” approach; maybe that should become the contemporary equivalent of adopting jQuery in 2006-2008 (unless you are adopting a “compile to JavaScript” language that has more going for it than TypeScript).

3 Likes

I really dislike JS frameworks. That is one of the reasons I went with the render through channels approach on this app. I’m not completely happy with the design yet. I want to look at drab and see how it might make things better.

I’m still noodling over the idea of “plain JS”.

3 Likes

If you are going down that rabbit hole have a look at Kyle Simpson’s Functional-Light JavaScript and if for some reason you develop an appetite for more JavaScript Allongé, the “Six” Edition. None of that deals with DOM/browser environment - for that Mozilla’s Web API reference is probably the best (unfortunately “Professional JavaScript for Web Developers 3e” hasn’t been updated from ECMAScript 5).

FYI:

There was a whole discussion around asset management tool choices in Phoenix. These days I feel strangely compelled to try to strip things down and give rollup.js a go (but have resisted so far, other priorities … - apparently some people have even used make for their JavaScript projects).

PS: This is amusing
Modern JavaScript for Ancient Web Developers

3 Likes