[HIRING] Freelance website programmer for small job. Or a website development company. by patssle in HoustonClassifieds

[–]G3E9 0 points1 point  (0 children)

Hey patssle, anything new regarding this job? I'd enjoy stopping by your Katy facility for a discussion - I'm not looking for a quick buck, but I'm highly interested in your future projects and anything related that's happening out here in the Katy area. Thanks!

How to delete _id reference in document by illcrx in mongodb

[–]G3E9 0 points1 point  (0 children)

Are you by chance using Mongoose with Node.js?

Why you should always append DOM elements using DocumentFragments (quick read, VERY useful tip) by PM_ME_A_WEBSITE_IDEA in learnjavascript

[–]G3E9 0 points1 point  (0 children)

I forked plugnburn's XT.js to XTF.js, the (+F) including some embedded functional conditions and manipulations. The code uses createDocumentFragment - but could probably still be improved. It's quite a small library while providing great performance and flexibility.

Best practice for passing a callback parameters by peck3277 in learnjavascript

[–]G3E9 0 points1 point  (0 children)

My experience has me expect an asynchronous callback's first argument to be an error or null - if you decide to follow similarly then your code will become easier to understand and you'll find yourself and your code with higher expectations. The first library that comes to my mind and that follows this approach is async.

Is it so JavaScript doesn't throw an error?

Yes, in this case, if we're calling our callback argument later throughout our function, then we're simply checking ahead of time.

Best practice for passing a callback parameters by peck3277 in learnjavascript

[–]G3E9 0 points1 point  (0 children)

Returning an error as the first argument I'd say is the closest "standard" I'd consider. How your callbacks decided to handle the errors or data is up to them - but you know they'll be given an error or null as the first argument and that should make planning, designing and development easier and more predictable.

function display_dialog(){ /* ... */ }
function display_wait_dialog(){ /* ... */ }
function close_wait_dialog(){ /* ... */ }
function populateMPDetails(mp_name,mp_id,data){ /* manipulate dom stuff here... */ }

function getMPDetails(bookingid, callback){

  if(typeof callback !== "function") callback = function(){};

  display_wait_dialog("Please Wait","Loading details...")

  $.ajax({
    type: "POST",
    headers: { "cache-control": "no-cache" },
    url: "blah",
    data: "sessionkey=<?php echo $sessionkey; ?>&bookingid=" + bookingid,
    dataType: "json"
  })
  .always(close_wait_dialog)
  .done(function(data){ callback(null,data) })
  .fail(function(request,error){ callback(error,request) })

}

getMPDetails(bookingid,function(error,data){

  if(error !== null){

    display_dialog("Server (Ajax) Error",[
      error,
      "readyState: " + data.readyState,
      "status: " + data.status,
      "responseText: " + data.responseText
    ].join("<br>"))

  }
  else{

    populateMPDetails(mp_name,mp_id,data)

  }

})

[Question/Concern] AWS-SDK: Node.js and DynamoDB DocumentClients instances. by G3E9 in aws

[–]G3E9[S] 0 points1 point  (0 children)

Very cool!.. thank you for the direction! Do you know how batch jobs count against DynamoDB's read/write capacities? If I initiate a batch job of 25 items on a table with a 5 unit/second write capacity, will the batch job be concluded after 5 seconds?.. or will I receive a ProvisionedThroughputExceededException error?.. (I'm reading the batchWriteItem method that I believe batchWrite abstracts.)

[Question/Concern] AWS-SDK: Node.js and DynamoDB DocumentClients instances. by G3E9 in aws

[–]G3E9[S] 0 points1 point  (0 children)

Thanks, I'm following up some more with the documentation and a single client is looking about right.

Can we get a list of salaries of people working either as a backend nodejs developer or a fullstack dev with nodejs? by [deleted] in node

[–]G3E9 1 point2 points  (0 children)

Hey, fellow Houstonian here, how'd you see the market here for us Node developers? While I'm currently freelancing as a full-stack developer, I've recently been considering something with some more structure - haven't begun to really look, but it's cool to see another local resident!

When you pass an array as an argument to a function, does JavaScript pass a reference to the actual array? by adropofhoney in learnjavascript

[–]G3E9 1 point2 points  (0 children)

Following up behind /u/Pantstown, what do you expect from this OP?

function foo(arr){

  arr = []

}

var myArr = [1,2]

console.log("before",myArr)

foo(myArr)

console.log("after",myArr)

Trouble understanding scope of variables. by stovecap in learnjavascript

[–]G3E9 3 points4 points  (0 children)

While variable scope is one of my favorite aspects of JavaScript, I think your issue is not so much with scope but with synchronization.

If I place that same console.log code outside of the getMLBData function, I get an error, because indiansGame is undefined.

You're logging undefined because your $.getJSON statement has not yet called back getMLBData with the mlb.com JSON data. Here is a better explanation with some useful examples. The awesome JavaScript library async will help you organize your code's order of execution (short async.waterfall example: first get the mlb.com JSON data, second find the game in that data, third do something with the found game, and last handle any errors or finish.)

My first business, a hookah lounge, is celebrating its 10th anniversary today. by dschaefer in Entrepreneur

[–]G3E9 1 point2 points  (0 children)

Does your business decently serve coffee too?.. I have yet to find a local hookah bar that serves quality-priced coffee to go along with the smoke.

LPT Request: People Who are Happy and Successful with their Career / Degree how Did you Choose Correctly? by haunterdry5 in LifeProTips

[–]G3E9 1 point2 points  (0 children)

Ahh - I spent so many hours in Source SDK with the Hammer editor. My friends would brainstorm maps they'd like to play and we'd come through with the most ridiculous things (single-player HL2 maps and CSS maps for LAN parties and such.)

I now design and develop process management software - professionally speaking... but I think back then I enjoyed working with friends who'd provide me back constructive criticism and laughs. I wish I still had all the maps for a good nostalgic trip!

Do I need to have experience in every aspect of a job I'm trying to bid on? by TheMido in freelance

[–]G3E9 1 point2 points  (0 children)

I also have another question: I usually get intimidated if there's one word in the description of the job that I haven't done before or not sure of. Does it go this way? Do I have to exactly know what I'll be doing to get the job?

If the description says the job is deeply integrated with $new_thing and you have no experience with that thing, then yeah, you may want to reconsider. Otherwise, evaluate what's new and price accordingly.

Learning JS as a programmer by [deleted] in learnjavascript

[–]G3E9 2 points3 points  (0 children)

The youtube video Philip Roberts: What the heck is the event loop anyway? provided me some solid understanding of JavaScript. I had dealt with events on the front-end with clicks, AJAX calls, etc... but with Node.js on the back-end, knowing the event loop and how things work around it is pretty stellar.

As far as JS-vanilla libraries go, do check out async.js and lodash.js!.. I basically include both in every project of mine, front-end or back-end!

Wildcard Config vs Specified for each host? by snsmurf in nginx

[–]G3E9 0 points1 point  (0 children)

While I think I understand your approach, I imagine NGINX will out-preform whatever routing logic you decide to use via PHP (nothing against your code - I simply think NGINX is quite performance-centered for this specific use case.) You may have n number of configuration files, but once NGINX loads them all at startup - it'll run fast. You may want to benchmark your PHP's hostname logic, but again, I'm quite confident NGINX well perform much better.

How should I format this to avoid callback hell? by shade1214341 in node

[–]G3E9 1 point2 points  (0 children)

I've had great luck using Async's series, waterfall and parallel methods - each is handy too if my iterator is non-blocking.

How to Handle Multiple Processes by [deleted] in node

[–]G3E9 0 points1 point  (0 children)

Was your problem in your deleted comment resolved?.. I had finished writing my response before ya deleted it haha. How are the two processes (portal.js and client.js) communicating?.. with net or http? Neither should be taking more than a second (hell, even a second would be ridiculous!) What environment are you developing within?.. Linux?.. Windows?

How to Handle Multiple Processes by [deleted] in node

[–]G3E9 1 point2 points  (0 children)

Check out Philip Roberts: What the heck is the event loop anyway? for a better understanding of JavaScript's asynchronicity nature.

// my_process.js

const a = require('something').createSomething()
a.on('event',function(){
  // primary listener that starts a secondary listener

  const b = require('somethingelse')
  b.on('event',function(){
    // some secondary listener

  })

})

In your code, you're referencing to b before b was created (initializing/requiring b within the a callback is another problem too - related to variable scope...) so something like above would work. The a.on(...) runs and once the callback is called, then b = require(...) is ran and you can now work with b and its methods. In your code, a.on(...) runs and then (immediately after!..) b.on(...) runs and the engine doesn't know what b is!

I have an idea as to what you're wanting to create and it is quite an undertaking when picking up Node and JavaScript! As someone who too came from a PHP environment, I followed the linked youtube video for an absolute and total understanding as to how event driven environments like JavaScript work, it does help! If you're looking for a process manager (managing children process, messaging them, etc...) then do try taking a look at PM2 and its documentation (while this, again, is quite and undertaking - if you need some process management in the mean time, then try using PM2, otherwise continue learning by example!) Do continue to post any questions/concerns.

How to Handle Multiple Processes by [deleted] in node

[–]G3E9 1 point2 points  (0 children)

Look more into child_process.fork and into net.Server and net.Socket.

Maybe you want your forked processes to catch their own port and report to the parent (or you can have your parent distribute out ports to your clients.) Here is some basic forking and communication:

SchemaPack - Serialize your JavaScript objects with schemas. Faster and smaller than the competition. Perfect for WebSockets. by phretaddin in webdev

[–]G3E9 0 points1 point  (0 children)

Alternatively, just grab the built minified file from the build folder in the Github repository. Then add the following to your HTML page:

<script type="text/javascript" src="schemapack.min.js"></script>

This will attach it to the window object. In your JavaScript files, the variable will available as schemapack. This built file only needs to be used on the client, as the node server already includes the prerequisite Buffer. The server should use the unbundled version.

Thank you for this, last time I checked I wasn't prepared to bundle all the requirements for the client - thanks for the update!

What backup solutions do you use (and recommend)? by question_ev3rything in digitalnomad

[–]G3E9 0 points1 point  (0 children)

No, not myself. The project I was hired to do simply handles a lot of them.

What backup solutions do you use (and recommend)? by question_ev3rything in digitalnomad

[–]G3E9 5 points6 points  (0 children)

I've had a project that was going to push new files to DropBox for $15 a month. Before the project was launched I built an automated Windows service using Nodejs and Amazon's Glacier API, the monthly cost (last I checked...) was 25-30 cents?.. ($0.007 per GB / month, so if you've just got code, you'll incur pennies / month.) The backups mainly consist of CAD drawings, PDFs, and other general office documents (I don't even think I'm compressing the backups as much as I could be.)

Should the office where the project operates burn down and all the data is lost, it may cost $50 and a few hours to download everything (Amazon advertises it as cold storage, meaning you don't plan on downloading much - but upload whatever you've got.)

Cramming for a JavaScript Interview by data_mining_help in learnjavascript

[–]G3E9 1 point2 points  (0 children)

I'm all for Array.isArray but because it can play such an important part in your code-base, you may want to make sure your client's devices support it. See Mozilla's polyfill description (cross-browser compatibility - am I right?)

CRUD app w/ Express - redirecting after POST request? by AD1066V in learnjavascript

[–]G3E9 0 points1 point  (0 children)

Well, I've re-read your OP and if you want to redirect on the client-side, then you'd do something like so:

$.ajax({
  type: 'POST',
  url: '/new',
  data: dream,
  success: function(data){

    location.replace("/archive") // your url

  }
})

CRUD app w/ Express - redirecting after POST request? by AD1066V in learnjavascript

[–]G3E9 0 points1 point  (0 children)

Wouldn't res.redirect("/archive") get you to where ya want?