Author Topic: Programming Megathread  (Read 144199 times)

why do you use nwjs over electron? I've always used the latter and am curious.
never knew the latter existed

nice meme fam. do you have a job yet?

Yeah I work for a company that makes a core processor for credit unions.

[10:09:31 AM] Foxscotch: computer feelings can not be hurt
[10:10:36 AM] Foxscotch: computer feels only what you tell it to feel

also
i'm probably not even using nwjs to its full extent but w/e
I wish people would be more clear
I can't figure out what this nwjs thing is supposed to do
I also can't figure out what the advantages are of using requirejs instead of just importing all the needed scripts in script tags

I've been working with node on that shotgun website project and I can say that the entire platform and community surrounding node is complete rubbish. There is so much infighting between developers that no standards ever take hold. For any module I look up I can find a dozen others with similar names doing the same thing hooking into the same APIs which are all broken in their own forgeted up undocumented ways. And then there is the hell in which every developer assumes you would never want to perform some tasks synchronously over the natural asynchronous model that node imposes on everything...

I'll be glad when this is over.
« Last Edit: February 11, 2016, 10:39:30 AM by Otis Da HousKat »

I've been working with node on that shotgun website project and I can say that the entire platform and community surrounding node is complete rubbish. There is so much infighting between developers that no standards ever take hold. For any module I look up I can find a dozen others with similar names doing the same thing hooking into the same APIs which are all broken in their own forgeted up undocumented ways. And then there is the hell in which every developer assumes you would never want to perform some tasks synchronously over the natural asynchronous model that node imposes on everything...

I'll be glad when this is over.
this is a pretty common sentiment. i always try and select projects based on the number of github stars which can be pretty ineffective sometimes. you can promise-ify apis that arent written to be async depending on the situation but it can be a pain in the butt. another good option would be to use babel and use async/await as it makes writing async code way better but transpilers are already iffy if if your build process doesnt use them already (webpack/gulp/etc) you might as well not bother

node is pretty schizophrenic and npm library versions can also be hellish. i would suggest checking your node_modules into your source control to reduce problems. just a tip if you arent doing it already
[10:09:31 AM] Foxscotch: computer feelings can not be hurt
[10:10:36 AM] Foxscotch: computer feels only what you tell it to feel

alsoI wish people would be more clear
I can't figure out what this nwjs thing is supposed to do
I also can't figure out what the advantages are of using requirejs instead of just importing all the needed scripts in script tags
nwjs and electron give you a webkit context and you can basically create a local webapp using nodejs. its a pretty easy way to write cross platform gui applications. require.js/AMD and common.js etc are module import systems which make it easy to split your code across multiple files. you should write javascript in a way where everything is a small module that does one specific purpose. theres no other way to build 'large' javascript applications that are also maintainable. there are programs where you can concatenate all your dependencies together and minify them to reduce network usage
Yeah I work for a company that makes a core processor for credit unions.
hey thats cool. im at a web startup now doing fullstack development. theres lots of memes but it pays pretty well so i cant complain even though its kinda monkey coding tbh
« Last Edit: February 11, 2016, 03:31:07 PM by Ono-Sendai »


why does this work and not ruin everything

nwjs and electron give you a webkit context and you can basically create a local webapp using nodejs. its a pretty easy way to write cross platform gui applications.
wow. that's really cool
electron's website is a lot more clear (at least to me) about what it does
require.js/AMD and common.js etc are module import systems which make it easy to split your code across multiple files. you should write javascript in a way where everything is a small module that does one specific purpose. theres no other way to build 'large' javascript applications that are also maintainable. there are programs where you can concatenate all your dependencies together and minify them to reduce network usage
I completely understand why you'd use it in node.js, I just don't get the point in using something like that on a webpage. I can see how it would help managing dependencies to other files during development, but only until you concatenate them. it seems like it'd hurt performance being used on a production page

edit: can someone tell me why npm downloads packages that you already have installed globally...
like, if you already have the right version in the global node_modules folder, why not just copy that to the local one, instead of downloading a new one?????
« Last Edit: February 12, 2016, 10:53:32 PM by Foxscotch »


why does this work and not ruin everything
you push the reference of the x array onto the back of the array itself. in the inspector when you see the contents of x[2] it resolves that reference and displays that same array. it lets you do this forever.
I completely understand why you'd use it in node.js, I just don't get the point in using something like that on a webpage. I can see how it would help managing dependencies to other files during development, but only until you concatenate them. it seems like it'd hurt performance being used on a production page
it doesnt really hurt performance when all the dependencies are concatenated into one file before minification. theres a very slight performance overhead but not much. it would be very hard to write complex web applications like facebook etc without javascript module systems because it would get very hard to maintain. also there are such things as source maps which allow you to untangle the concactenated files during debugging. these are VERY useful.
edit: can someone tell me why npm downloads packages that you already have installed globally...
like, if you already have the right version in the global node_modules folder, why not just copy that to the local one, instead of downloading a new one?????
good question. if the versions matched between the current one and the globally installed one then that would make sense. ive always found package managers to be kind of stuffty. why dont more of them grab more than one package at the same time?

bump.cs

ive been thinking of trying something a bit greater than the stuff our teacher gives us; maybe a program to display all the possible structural formulas of a hydrocarbon, given its molecular formula, or a rough recreation of minesweeper in c++

I started working on a project in C# and using my arduino that has been pretty fun to do. I've been wanting to interface real world devices with the computer and this was one of the first things I could do to teach me some stuff. I've never dealt with serial communications, then also all the fun of C# dealing with classes and what not.

I use the C# application to get the information of the computer devices then it passes that along to the arduino over a serial connection on USB. I wanna make the C# application minimize down to the dock but have some info about the system and some settings to mess around with.

The arduino displays all of this using a little display made up of 4 8x8 LED matrixes next to eachother for  a grand total of 32x8 resolution. It scrolls the device name across and then the numbers are displayed in the center of the display. It's not super useful but I love these little displays, I wanna do something with the pile of 7 segment LED displays I have but don't have a clue yet.

Right now I have it so I can hit a button to send the info to the arduino to display stuff. It displays whatever is separated by a line break and then adds it to a linked list it works it's way through. I'm trying to make it so that when the arduino goes through the whole list it sends back a message saying it needs more info and then the C# application automatically sends it over.

That's the part that I'm getting really screwed up with, at first I thought I was gonna need to multithread to listen for stuff, then I found out the serialport has an event for when new info comes back over however I'm confused on how to call the temperature stuff again without making everything static.

I started working on a project in C# and using my arduino that has been pretty fun to do. I've been wanting to interface real world devices with the computer and this was one of the first things I could do to teach me some stuff. I've never dealt with serial communications, then also all the fun of C# dealing with classes and what not.

I use the C# application to get the information of the computer devices then it passes that along to the arduino over a serial connection on USB. I wanna make the C# application minimize down to the dock but have some info about the system and some settings to mess around with.

The arduino displays all of this using a little display made up of 4 8x8 LED matrixes next to eachother for  a grand total of 32x8 resolution. It scrolls the device name across and then the numbers are displayed in the center of the display. It's not super useful but I love these little displays, I wanna do something with the pile of 7 segment LED displays I have but don't have a clue yet.

Right now I have it so I can hit a button to send the info to the arduino to display stuff. It displays whatever is separated by a line break and then adds it to a linked list it works it's way through. I'm trying to make it so that when the arduino goes through the whole list it sends back a message saying it needs more info and then the C# application automatically sends it over.

That's the part that I'm getting really screwed up with, at first I thought I was gonna need to multithread to listen for stuff, then I found out the serialport has an event for when new info comes back over however I'm confused on how to call the temperature stuff again without making everything static.
Gonna plug a thing my friend made/is making that works with Arduino. http://alicorn.io

at school in visual studio 2013 I'm trying to get a program to add 100 different things (one is names, one is numbers) in visual studio, and then I need to check for the highest scorers name and mark. In order to get the name from this, I need to have a loop and a counter added around the 2 lines of code to find the name. I haven't brought it home with me so I can't explain the other problems but I can at least remember this

Code: [Select]
counter2 = 0

Do
For counter = 1 to 50
counter2 = counter2 + 1 ' this increases with the loop, it's the "identifier"
HighestScorer = FullName(counter2) ' FullName is the name of the array that stores all 50 of the names
Next
Loop until counter2 = 50

now I've just realised something that will probably give me wrong information somewhere else, but the REAL problem is that when I run this program and run this code, the entire program freezes. like it doesn't even throw a breaking point, but I can fix this if I simply remove the loop:

Code: [Select]
counter2 = 0
counter2 = counter2 + 1
HighestScorer = FullName(counter2)

this works, if I run the code counter2 is going to increase by 1 up to 2, and then HighScorer = FullName(counter2) uses counter 2 to find something in the array, so it will now list the name stored in value 2 of the array

I have tried setting counter 2 to a number like 3 and I can confirm that this works, this outputs the correct info, but that's not useful enough because I need it to check the entire list but it can't because the loop breaks it. What I want to know is why the program just seizes up and never gets to the end of that loop? shouldn't the counter get to 50 and display that arrays value? I'm probably being super dumb by not posting the rest of the code, but I see no reason why that loop shouldn't work
« Last Edit: February 25, 2016, 05:08:08 PM by Maxwell. »

i don't know any of whatever you're programming in but im not seeing anything that increments counter at all. counter will always be at 1 and will never reach 50. is that the issue?

i don't know any of whatever you're programming in but im not seeing anything that increments counter at all. counter will always be at 1 and will never reach 50. is that the issue?
it can definitely increase, it's just with that loop which can get it to 50 the entire thing just freezes and won't tell me what's wrong

if I'm looping it 50 times, then it should add 1 to counter2 each time and end up at 50. then the fullname uses that number 50 to find whatevers in value 50 of the array
« Last Edit: February 25, 2016, 05:07:49 PM by Maxwell. »