Because the project I was basing things off of used Bower and when I went to Bower's site for documentation, they said to use Yarn.
e: maybe i'll switch off of Yarn to npm. it looks like i can use the same everything else, so it wouldn't even take long or be a big deal
e: maybe i'll switch off of Yarn to npm. it looks like i can use the same everything else, so it wouldn't even take long or be a big deal
By Kibner Go To PostnothingIt's interesting.
sorry kemosabe
Go (often referred to as golang) is a programming language created at Google[12] in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson.[10] It is a compiled, statically typed language in the tradition of Algol and C, with garbage collection, limited structural typing,[3] memory safety features and CSP-style concurrent programming features added.[13] The compiler and other language tools originally developed by Google are all free and open source.[14]
Go originated as an experiment by Google engineers Robert Griesemer, Rob Pike, and Ken Thompson to design a new programming language that would resolve common criticisms of other languages while maintaining their positive characteristics. The developers envisaged the new language as:[20]
statically typed, scalable to large systems (as Java and C++)
productive and readable, without too many mandatory keywords and repetition[21] ("light on the page" like dynamic languages)
not requiring integrated development environments, but supporting them well
supporting networking and multiprocessing
In later interviews, all three of the language designers cited their shared dislike of C++'s complexity as a primary motivation for designing a new language.
Asking for a friend: if you are developing a content site using some sort of templating engine, what would you use? My friend is considering Preact and MVC ASP.Net but he really wants more options. He said he wants server side rendering for SOA/speed stuff.
By Kibner Go To PostAsking for a friend: if you are developing a content site using some sort of templating engine, what would you use? My friend is considering Preact and MVC ASP.Net but he really wants more options. He said he wants server side rendering for SOA/speed stuff.
There's this that explains some of hte options with Python
If you're concerned about using a framework that provides you with the most robust templating engine solutions of your liking, then Rails is probably a good place to look because they have so many from HAML to ERB to buncha others.
By giririsss Go To PostIt's interesting.The most interesting thing about your excerpts (that didn't somehow get quoted) is that golang has been created by Rob Pike and Ken Thompson, two names instantly recognizable by people who've had to read Unix-related manuals in their line of work.
Kernighan is still GOAT daddy tho.
By giririsss Go To PostIt's interesting.
Not too interesting even most C++ programmers I know hate many things around the language. I've messed around with Go a few times. I like it as a language, but I don't know/use it enough to really make a definitive statement on it in comparison to say C++
hey, if anyone is around that wants to help with some bash scripting, do let me know.. preferably in my DM.
I've started taking a free C++ course and idontknowwhatimdoing.gif. Might bug you guys from time to time with stupid questions such as this one.
So this is pretty straight forward. Now what if I wanted to add another 'if' which would let the user know he can only input natural numbers, if he tried to input a decimal number? What would be the code for that?
if (n ... ?)
start:
cout << "Insert number: ";
cin >> n;
if (n == 0)
{
cout << "The number can't be less than 1 " << "\n\n";
goto start;
}
So this is pretty straight forward. Now what if I wanted to add another 'if' which would let the user know he can only input natural numbers, if he tried to input a decimal number? What would be the code for that?
if (n ... ?)
By Zabojnik Go To PostI've started taking a free C++ course and idontknowwhatimdoing.gif. Might bug you guys from time to time with stupid questions such as this one.Yeah, another if though an else if might be better to prevent multiple checks. You could also look at switch statements if you have a couple more conditions you want to test for that same input value.start: cout << "Insert number: "; cin >> n; if (n == 0) { cout << "The number can't be less than 1 " << "\n\n"; goto start; }
So this is pretty straight forward. Now what if I wanted to add another 'if' which would let the user know he can only input natural numbers, if he tried to input a decimal number? What would be the code for that?
if (n … ?)
e: or did you mean what would the condition be to check if it would be an integer?
By Kibner Go To Poste: or did you mean what would the condition be to check if it would be an integer?Yeah, that's what I want to know. Still figuring out all that if / which stuff.
By Zabojnik Go To PostYeah, that's what I want to know. Still figuring out all that if / which stuff.
You could apply the modulo function to the input value and see if there is a remainder. If there is, then it's a decimal. If there isn't, then it's an integer.
Since you are new, I should probably link you some reference sites that are useful in helping you help yourself. I don't program in c++ myself, but a quick google tells me that these are two popular sites (I linked to their modulo function pages):
http://www.cplusplus.com/reference/functional/modulus/
http://en.cppreference.com/w/cpp/utility/functional/modulus
http://www.cplusplus.com/reference/functional/modulus/
http://en.cppreference.com/w/cpp/utility/functional/modulus
Uhhh, the % operator, right? I'm not sure how I would apply it to my input value, which I declared as "unsigned int = n".
(Yeah, I'll dive into it in the following days and weeks, just wanted a quick answer. Thanks.)
(Yeah, I'll dive into it in the following days and weeks, just wanted a quick answer. Thanks.)
By Zabojnik Go To PostUhhh, the % operator, right? I'm not sure how I would apply it to my input value, which I declared as "unsigned int = n".Yeah, modulo is the % symbol.
Also, I don't know how strongly typed c++ is, but generally if you declared a variable as an unsigned int, then it can't be negative (since it is unsigned) and it can't be a decimal (since it is an integer).
A signed number uses the last bit to determine positive or negative. An unsigned number uses that last bit instead to increase how large a number it can store, but the lowest an unsigned number can be is 0.
Just as an example for anyone else reading this, I want to describe what signed/unsigned means a little better. I am assuming the reader knows what bits and bytes are.
Say we are dealing with an integer that is stored in only four-bits. The largest value it can hold is written the same for both signed and unsigned: 1111. The difference is in their magnitude.
1111: unsigned = 16
1111: signed = 8
That first bit in a signed number determines the sign (positive/negative) of the number. A 1 means positive and a 0 means negative. So, if we flipped that first 1 to a 0 in the example above, we would get:
0111: unsigned = 8
0111: signed = -8
Say we are dealing with an integer that is stored in only four-bits. The largest value it can hold is written the same for both signed and unsigned: 1111. The difference is in their magnitude.
1111: unsigned = 16
1111: signed = 8
That first bit in a signed number determines the sign (positive/negative) of the number. A 1 means positive and a 0 means negative. So, if we flipped that first 1 to a 0 in the example above, we would get:
0111: unsigned = 8
0111: signed = -8
By Kibner Go To PostYeah, modulo is the % symbol.Yes, the program calculates a formula / sequence (which I can't really describe with my limited english math vocabulary, lol), where n = 0, 1, 2, 3 ... It can't be a negative or decimal value, which is why I used unsigned int.
Also, I don't know how strongly typed c++ is, but generally if you declared a variable as an unsigned int, then it can't be negative (since it is unsigned) and it can't be a decimal (since it is an integer).
A signed number uses the last bit to determine positive or negative. An unsigned number uses that last bit instead to increase how large a number it can store, but the lowest an unsigned number can be is 0.
I think I get the % operator, I just don't know how to use it in this instance. ^^
By Zabojnik Go To PostYes, the program calculates a formula / sequence (which I can't really describe with my limited english math vocabulary, lol), where n = 0, 1, 2, 3 … It can't be a negative or decimal value, which is why I used unsigned int.When you use the % operator, it divides the two inputs you give it and returns the remainder. So, 14 % 10 would return 4. I think you could do n % 1 (or maybe 1.0?) and if the remainder is a number other than 0, then it is a decimal.
I think I get the % operator, I just don't know how to use it in this instance. ^^
e: if that doesn't work, you could multiply by 10 before then doing mod 10 and check to see if the remainder is 0 or not
By Kibner Go To PostWhen you use the % operator, it divides the two inputs you give it and returns the remainder. So, 14 % 10 would return 4. I think you could do n % 1 (or maybe 1.0?) and if the remainder is a number other than 0, then it is a decimal.This makes sense to me, but how would I code that?
start:
cout << "Insert number: ";
cin >> n;
if (n == 0)
{
cout << "The number can't be less than 1 " << endl;
goto start;
}
if (n % 1 != 0)
{
cout << "The number must be a natural number " << endl;
goto start;
}
Would something like this work?
Ok, so I think I've got most of the code working as intended, but that second if (else if) keeps getting ignored and I'm not sure why. Might be a good idea to call it quits and continue tomorrow with a rested mind, but since it must be something easy to fix ... Take a look, please. Don't mind the alien language, should be understandable regardless, and it's really just that 'else if' that's giving me trouble. :P
Btw, this is the formula / sequence (or whatever it's called in english) in question:
Btw, this is the formula / sequence (or whatever it's called in english) in question:
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char** argv)
{
unsigned int n;
double clen = 0;
double vsota = 0;
zacetek:
cout << "Vnesi stevilo clenov zaporedja: ";
cin >> n;
if (n == 0)
{
cout << "Stevilo clenov mora biti enako ali vecje od 1." << endl << endl;
goto zacetek;
}
else if (n % 1 != 0)
{
cout << "Stevilo clenov mora biti pozitivno naravno stevilo." << endl << endl;
goto zacetek;
}
for (int i = 1; i <= n; i++)
{
clen = 1 / (1 + pow(i - 1, (3 / 2)));
cout << endl << "Clen n je " << i - 1 << ", izracun je " << clen << "." << endl;
vsota = vsota + clen;
}
cout << endl << "Vsota clenov zaporedja je " << vsota << "." << endl;
cout << endl;
return 0;
}
I couldn't tell you specifically why the else if is being ignored without running the code myself. Most of that looks familiar and correct to me, but I don't know C++ intricately to point out any syntax errors.
From what I can tell, your code looks correct.
From what I can tell, your code looks correct.
You can run it here: https://www.onlinegdb.com/online_c++_compiler
It runs fine, but when I input 'n' as a decimal number, I should be getting back that 'else if' output sting ("Stevilo clenov mora biti pozitivno naravno stevilo." -> "Number must be a natural number / integer.") Instead, if I input say '4.66', the program runs as if I put in just '4'.
It runs fine, but when I input 'n' as a decimal number, I should be getting back that 'else if' output sting ("Stevilo clenov mora biti pozitivno naravno stevilo." -> "Number must be a natural number / integer.") Instead, if I input say '4.66', the program runs as if I put in just '4'.
Looks like you have to guard against single and double quotes: https://stackoverflow.com/questions/3683602/single-quotes-vs-double-quotes-in-c-or-c
Running
returns 0.
I'm going to guess it's being converted into a byte. So I'd look into checking the type of the input in a different way not using modulo.
Running
unsigned int n = 'n';
cout << n %1;
returns 0.
I'm going to guess it's being converted into a byte. So I'd look into checking the type of the input in a different way not using modulo.
By Zabojnik Go To PostYou can run it here: https://www.onlinegdb.com/online_c++_compilerBecause you've declared N as an integer. Somewhere there must be a fail safe that ignores the decimal on the input. a built in safety in C++
It runs fine, but when I input 'n' as a decimal number, I should be getting back that 'else if' output sting ("Stevilo clenov mora biti pozitivno naravno stevilo." -> "Number must be a natural number / integer.") Instead, if I input say '4.66', the program runs as if I put in just '4'.
Gotcha. I think I'll leave the 'if' part out of it for now, come back to it later, when I have a better idea of what I'm doing. User experience be damned.
Thanks m8s.
Thanks m8s.
By Dark PhaZe Go To PostHows the transition between Java and C++?Are you specifically asking Zabo or the general audience here?
By Dark PhaZe Go To PostHows the transition between Java and C++?If you mean in general... It feels like going backwards.
And you are. Design wise, you apply 99% of the same patterns. But the syntax is pretty wildly different. C++ gives you a ton more manual control over everything. But it comes at a price and it's a lot niceities are left exposed.
By Kibner Go To PostAre you specifically asking Zabo or the general audience here?
anyone with decent experience with both--only experienced with Java at the moment, but as I learn more about lower levels of architecture I'm realizing there's some things hidden from me in the language that might not be the case with others
Aight, MacInCloud isn't too bad of a service for those of us wanting to do iOS development without a Mac. Especially when hooked up with Visual Studio Enterprise. The Enterprise version has a feature where the simulator on the remote server is actually launched and displayed through VS on my local machine.
A bit niche, but my buddy is doing a livestream of how to use Squarespace's Developer Platform to do a full website buildout: https://www.twitch.tv/kitajchuk
By reilo Go To PostA bit niche, but my buddy is doing a livestream of how to use Squarespace's Developer Platform to do a full website buildout: https://www.twitch.tv/kitajchukThe twitch resolution makes the text blurry but I can still read everything.
.Net Core seems easier to exert more control over your stack than normal .Net. That whole open-source and multi-platform thing it has going is probably a driving reason behind it being easier to add/remove modules and maintain their versioning. Better (or just more accessible?) terminal interaction, too.
By Kibner Go To Post.Net Core seems easier to exert more control over your stack than normal .Net. That whole open-source and multi-platform thing it has going is probably a driving reason behind it being easier to add/remove modules and maintain their versioning. Better (or just more accessible?) terminal interaction, too.
I've not done a ton in it, but used it for some quick stuff we had to do.
It seems like a noble goal, but it will miss out on a ton of .Net functionality.
Now, .Net is MASSIVE. So whether you need all that functionality is a different debate and probably project dependent. It will probably be fine, until you find that one thing you want that isn't core.
They are working to port over pretty much all non-IIS and Windows specific libraries over to Core, thankfully. It's not all there, but I think it has made some good progress. They are being released as Nuget packages as they are finished. After some brief googling, it looks like the shared/common libraries are known as .Net Standard.
My co worker just spent 1.5 hours this morning going over these custom programs he's built in house using AWK. Complicated af. Showed me scripts that he's built up over like 3 years. All makes his job super easy. He doesn't mind showing/sharing with me as I consider him a mentor. He built an entire custom Excel sheet with pages of financial investment information. He literally builds or makes everything he needs. Custom databases, programs, scripts etc. I'm fascinated by people like that. Then again he's been at programming / scripting for pretty much my lifetime.
By Smokey Go To PostMy co worker just spent 1.5 hours this morning going over these custom programs he's built in house using AWK. Complicated af. Showed me scripts that he's built up over like 3 years. All makes his job super easy. He doesn't mind showing/sharing with me as I consider him a mentor. He built an entire custom Excel sheet with pages of financial investment information. He literally builds or makes everything he needs. Custom databases, programs, scripts etc. I'm fascinated by people like that. Then again he's been at programming / scripting for pretty much my lifetime.I like to call that "working hard at being lazy." It should always be a goal, imo. It's great that he's sharing that knowledge and tools with you. Some think letting others know that stuff will impact their job security.
I learned about SRI (subresource Integrity) for browsers yesterday: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
In short, it's a way to make sure the third party .css and/or .js files a browser downloads are the same as the expected ones by way of hashes. If the browser determines the hashes of the downloaded file and the expected file do not match, it will block that file from being loaded.
In short, it's a way to make sure the third party .css and/or .js files a browser downloads are the same as the expected ones by way of hashes. If the browser determines the hashes of the downloaded file and the expected file do not match, it will block that file from being loaded.
The whole process of starting from scratch to getting an app ready for submission review on iTunes is a right pain in the ass. $99 yearly developer fee to get access to a platform for invite beta testing, setting all the different icon sizes, getting a certificate, making a provisional profile, creating an app on iTunes Connect, making sure that all the info on iTunes connect matches your Info.plist. There might be another one or two things I'm missing but good grief.
By Dark PhaZe Go To PostHows the transition between Java and C++?The difference is that Java is a runtime with built-in memory management, so it can let you prototype faster, but there's a considerably lower ceiling to how much you can optimize performance. Basically, Java lets you microwave your food.
Basically, if you do development for a mission-critical system that needs to be energy efficient as hell, you're going to want to go with C++, as it's like going directly to farmers and building out the logistics for your boutique grocery store from scratch.
So, to answer your question, the transition is rough.
By Dark PhaZe Go To Postanyone with decent experience with both–only experienced with Java at the moment, but as I learn more about lower levels of architecture I'm realizing there's some things hidden from me in the language that might not be the case with others
The only thing that you need to know about lower levels of architecture is that there are really only two data types: integers and characters.
Everything else is an abstraction of those two literals, and the looping mechanisms used to structure and iterate over them (oftentimes recursively).
But what's really hidden from you between a low-level and a high-level language is basically just memory management, which is the process of allocating memory bytes when you need them, and dumping them when you don't, a.k.a. garbage collection. It's really as simple as needing to know what "heap" and "stack" do/are, that's the key differentiator.
lmao need to make 19 different sized icons and 18 different sized splash screens in order to fully support iOS and Android devices
Learning about 9 Patch images today. It is basically a way to mark where it is ok for an image to be stretched: https://developer.android.com/guide/topics/graphics/drawables.html#nine-patch
Has anyone here ever done a "active users" count widget for a web app and if so how'd you go about it?
The original web app is done in PHP, and iv'e got a fairly solid idea of how to count the number of users. My problem comes in tracking when they're no long there.
Counting the number of users is relatively simple. There's a user entity. Every time a page loads it triggers an event listener, that event listener takes in the user id, and time stamp. It then updates the user entity with the new time stamp.
To refine the above, you would actually only update the time stamp on the user entity if the "active" time stamp was say... more than 5 minutes old. To save useless write to the data base.
My problem here is that, every implementation i've seen from there requires querying the database for every timestamp <5minutes old, to get all the "current users".
For a live update widget on a dashboard that seems terrible and expensive.
The only mildly efficient way i can think to do this would be to, when the users time stamp updates, trigger a call to a ReactJS element. And let the React element somehow handle all of the sorting of timestamps etc. So that they're done client side, not server side (by making a ton of expensive DB queries).
The original web app is done in PHP, and iv'e got a fairly solid idea of how to count the number of users. My problem comes in tracking when they're no long there.
Counting the number of users is relatively simple. There's a user entity. Every time a page loads it triggers an event listener, that event listener takes in the user id, and time stamp. It then updates the user entity with the new time stamp.
To refine the above, you would actually only update the time stamp on the user entity if the "active" time stamp was say... more than 5 minutes old. To save useless write to the data base.
My problem here is that, every implementation i've seen from there requires querying the database for every timestamp <5minutes old, to get all the "current users".
For a live update widget on a dashboard that seems terrible and expensive.
The only mildly efficient way i can think to do this would be to, when the users time stamp updates, trigger a call to a ReactJS element. And let the React element somehow handle all of the sorting of timestamps etc. So that they're done client side, not server side (by making a ton of expensive DB queries).