By reilo Go To PostI hate sysops sometimes lol. Sometimes even do the simplest shit has me like "pls don't break".Yeah. Glad i'm not in that field. Want none of it.
I mean, have to do some of it, but ugh...
I had enough of that working in the hospital. Yeah, sure, let a entry-level guy design, implement, and deploy changes to things that route messages about patient vitals to nurses and doctors and the only person to oversee his work is another entry-level guy.
e: oh, or the thing that allows syncing of patient records between the main hospital and each individual clinic. that isn't nerve-wracking at all!
e: oh, or the thing that allows syncing of patient records between the main hospital and each individual clinic. that isn't nerve-wracking at all!
By Trey Go To PostReilo, what did you break?Nothing. Just trying to upgrade our database to the latest major version and it's giving me trouble. For another day.
TL:DR; I need to upgrade our database to use a specific function not found in the current version we're on for the new search.
Does anyone here have experience with PFSense? Particularly with using it to create a capture portal system?
By Frankenstrat Go To PostDjangreSQL bros. Trying to come up with time to make my Angular 2 app with a Django/Postgre API but shit I got too many things to be studying and learning right now if I want to actually get a job in WebDev. Started talking more intently to recruiters though, fingers crossed.
Anyone have experience with Leaflet.js and dynamic loading of map points?
Postgres for life. I use it for everything.
I'm currently programming a currency converter in Java, college project. We have to read in a file containing the currencies/conversion rates.
I have written some code for it so far but I feel like I have a bad abstraction here. I'm wrapping a HashMap in an Object which I feel is bad practice to simply wrap an existing data type/collection in an Object. At the same time I'm trying to stick to an OOP paradigm so maybe this is perfectly normal.
I just have that "bad code smell" from this, but maybe it's perfectly normal in Java world. I'm normally more of a Python guy.
The text file I created for the purposes of this is here:
I have written some code for it so far but I feel like I have a bad abstraction here. I'm wrapping a HashMap in an Object which I feel is bad practice to simply wrap an existing data type/collection in an Object. At the same time I'm trying to stick to an OOP paradigm so maybe this is perfectly normal.
I just have that "bad code smell" from this, but maybe it's perfectly normal in Java world. I'm normally more of a Python guy.
The text file I created for the purposes of this is here:
USD,EUR,JPY,GBP,CHF,CAD,AUD,HKD
USD,1.0,1.1631,0.0088,1.3214,1.0009,0.7751,0.7650,0.1282
EUR,0.8598,1.0,0.0076,1.1361,0.8605,0.6664,0.6577,0.1102
JPY,113.3900,131.8839,1.0,149.8335,113.4921,87.8856,86.7433,14.5385
GBP,0.7568,0.8802,0.0067,1.0,0.7575,0.5866,0.5789,0.0970
CHF,0.9991,1.1621,0.0088,1.3202,1.0,0.7744,0.7643,0.1281
CAD,1.2902,1.5006,0.0114,1.7049,1.2914,1.0,0.9870,0.1654
AUD,1.3072,1.5204,0.0115,1.7273,1.3084,1.0132,1.0,0.1676
HKD,7.7993,9.0714,0.0688,10.3060,7.8063,6.0450,5.9665,1.0
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.*;
public class CurrencyConversionRates {
private HashMap<string, hashmap<string,="" double="">> currencyConversionRates;
public HashMap<string, hashmap<string,="" double="">> getCurrencyConversionRates() {
return currencyConversionRates;
}
public void setCurrencyConversionRates(
HashMap<string, hashmap<string,="" double="">> newCurrencyConversionRates) {
this.currencyConversionRates = newCurrencyConversionRates;
}
public void populateConversionRatesFromFile(String fileName) {
HashMap<string, hashmap<string,="" double="">> tempCurrencyConversionRates =
new HashMap<string, hashmap<string,="" double="">>();
ArrayList<arraylist<string>> linesFromTextFile = new ArrayList<arraylist<string>>();
String currentLine = null;
try {
FileReader fileReader = new FileReader(fileName);
BufferedReader bufferedReader = new BufferedReader(fileReader);
while((currentLine = bufferedReader.readLine()) != null) {
// Splits the current line on a comma (,) and converts to a String array
// Convert the String array to an ArrayList<string>
// Add this new ArrayList which contains the values of the current row
// as a new element of linesFromTextFile
linesFromTextFile.add(new ArrayList<string>(Arrays.asList(currentLine.split(","))));
}
bufferedReader.close();
}
catch(FileNotFoundException ex) {
System.out.println(
"Unable to open file '" +
fileName + "'");
}
catch(IOException ex) {
System.out.println(
"Error reading file '"
+ fileName + "'");
}
// Loop through each line from the file starting at index 1, ignoring the top header row.
// Loop through each element of the current row (j) starting at index 1. Ignoring the currency type.
// These values of j index will all be strings representing doubles.
// Create a new HashMap to store the values of the current row (tempRow).
// The key for this map will be the currency type (linesFromTextFile.get(0)) which is stored at the 0 index.
// The value of this map will be another Hashmap where the keys are currency names and the values are doubles.
// Convert the strings representing the conversion rates to doubles.
// Save results to tempCurrencyConversionRates and then assign that value to currencyConversionRates.
for (int i = 1; i < linesFromTextFile.size(); i++) {
HashMap<string, double=""> tempRow = new HashMap<string, double="">();
for (int j = 1; j < linesFromTextFile.get(i).size(); j++) {
Double tempDouble = new Double(linesFromTextFile.get(i).get(j).trim());
String tempStr = linesFromTextFile.get(0).get(j-1);
tempRow.put(tempStr, tempDouble);
}
tempCurrencyConversionRates.put(linesFromTextFile.get(i).get(0), tempRow);
}
this.setCurrencyConversionRates(tempCurrencyConversionRates);
}
public void printCurrencyConversionRates() {
for (String key : this.getCurrencyConversionRates().keySet()) {
System.out.println(key + ": "+this.getCurrencyConversionRates().get(key));
}
}
}
I'll try looking over that code later Ryujin, not sure if I can help though.
Anyway, I waste more time writing tests/fixing tests than writing actual code. This is dumb and not even my fault.
Anyway, I waste more time writing tests/fixing tests than writing actual code. This is dumb and not even my fault.
What do you guys think of vuejs? Is it perfect for full stack applications? I used meteor but hate the monolithic approach.
I've heard good things about it! It's kind of come up as a React competitor and even is compatible with certain things that make React super powerful, e.g. Redux. Give it a shot, I don't think you'd necessarily go wrong with one or the other.
By reilo Go To PostI've heard good things about it! It's kind of come up as a React competitor and even is compatible with certain things that make React super powerful, e.g. Redux. Give it a shot, I don't think you'd necessarily go wrong with one or the other.
I've read that it's pretty much the best of angular and react. I will take a udemy course on it.
I'm a sysadmin and find it hard to focus on a framework. For web/mobile apps, i think there's a new framework every weeks.
So I've been thinking, as my background consists of more of the PLT side of computer science than not, is it really appropriate to discuss such topics in this thread? On one hand, I'm leaning towards no, as delineating type theory and quantum mechanics seems counterintuitive to the purpose of this thread. On the other hand, I'm not sure that there are enough users interested in such topics to warrant its own thread.
Is there a general computer science (or even just general science) thread here? That would probably be the best place to post this stuff.
Is there a general computer science (or even just general science) thread here? That would probably be the best place to post this stuff.
lol if Sharp ever remembers to log on, you'd have an ally in someone to discuss type theory with. He's currently in Germany getting a PhD in exactly that and he can talk about it for years.
And yea, I say discuss anything that tickles your fancy here, whether it's computer science or programming in general.
General Sciences might be a bit of a stretch though, but always welcome for new threads as that might be more inviting to people that don't have an interesting in programming!
And yea, I say discuss anything that tickles your fancy here, whether it's computer science or programming in general.
General Sciences might be a bit of a stretch though, but always welcome for new threads as that might be more inviting to people that don't have an interesting in programming!
By reilo Go To Postlol if Sharp ever remembers to log on, you'd have an ally in someone to discuss type theory with. He's currently in Germany getting a PhD in exactly that and he can talk about it for years.
And yea, I say discuss anything that tickles your fancy here, whether it's computer science or programming in general.
General Sciences might be a bit of a stretch though, but always welcome for new threads as that might be more inviting to people that don't have an interesting in programming!
To be honest, I'd be much more interested in a catch-all Science thread because I think it's good for exposure to topics that are normally closed off to general conversations, and I don't have to worry too much about conversations straying off into the other sciences, even if they only loosely relate to computer science. If no such thread exists, I'd be more than happy to create a thread covering all branches of science. It would take me a while to put together, but it would be epic!
As for Sharp, thanks for telling me that. I look forward to taking a deep dive into the subject with him whenever he gets the chance!
Well currently breezing through my CS class. I'm pretty rusty with JS but since I understood the concepts I'm picking up C++ pretty quickly. And humble brag but like everyone asks me for help. I must be doing something right since my classmate was ready to turn in an empty assignment before I helped her out. Anyway it is nice knowing that being self taught wasn't a total waste since I'm doing well in a traditional class setting.
Im too scared right now to embrace anything specifically as an expert (although im prob expert in sql dev accross platforms). Still in schooling phase. i have no confidence :(
By FreezePeach Go To PostIm too scared right now to embrace anything specifically as an expert (although im prob expert in sql dev accross platforms). Still in schooling phase. i have no confidence :(That's a pretty common feeling. Look up "imposter syndrome". You are probably much better than you think you are.
----
https://www.udacity.com/grow-with-google
Earn a Developer Scholarship from Google!
Open to US residents eager to master web and mobile development skills
To apply for a scholarship, you need to be at least 18 years old and live in the US. You'll begin by choosing your learning path, either Web Developer or Android Developer. From there, once you're accepted, we'll place you in one of two tracks, depending on your existing skills and experience, either Beginner or Intermediate. After that, the learning begins! Finally, top students from each track will earn full scholarships to one of our Android or Web Development Nanodegree programs.
By Smoke Dogg Go To PostIs perl still a thing or just a legacy thing now? Don't really hear much about it anymoreI don't really use it, but that's not saying much.
I fucking hate that every language feels the need to have its own package system and even more stupidly platforms that only offer you source and not compiled installs.
So you guys know how there are these things called "transcompilers" now which are compilers that take source code written in one language and output that source code into a different language?
Well, I was wondering, doesn't that basically undermine software licenses?
...Like, how can the GPL be enforced if I'm no longer using their C/C++ code because I transcompiled into some other shit instead?
Am I confused?
Well, I was wondering, doesn't that basically undermine software licenses?
...Like, how can the GPL be enforced if I'm no longer using their C/C++ code because I transcompiled into some other shit instead?
Am I confused?
But it's transpiling the code you wrote. It didn't actually affect the source it only changed the output.
At least I'm not quite sure I'm understanding why you think that violates the GPL?
At least I'm not quite sure I'm understanding why you think that violates the GPL?
I think a transpiler just takes code, period, right? It doesn't know if you wrote it or not. Or I mean, it probably doesn't have the means to verify that you're the original author.
So theoretically, I could copy pasta my way out of infringement by taking GNU's code written in C/C++ and transcompiling it into Python (for example) and then running a Python compiler on that transcompiled code. But because my executable is now the compiled Python code, rather than that of the original C/C++ code, I'm now in the clear?
That's why my question is whether the GPL has been or could be undermined or compromised in that way?
Or have I missed something?
So theoretically, I could copy pasta my way out of infringement by taking GNU's code written in C/C++ and transcompiling it into Python (for example) and then running a Python compiler on that transcompiled code. But because my executable is now the compiled Python code, rather than that of the original C/C++ code, I'm now in the clear?
That's why my question is whether the GPL has been or could be undermined or compromised in that way?
Or have I missed something?
how shook were yall about your first programming interview
might have to go in drunk, but it just relaxes me and you wouldn't know I'd been drinking
might have to go in drunk, but it just relaxes me and you wouldn't know I'd been drinking
By Dark PhaZe Go To Posthow shook were yall about your first programming interviewNot?
might have to go in drunk, but it just relaxes me and you wouldn't know I'd been drinking
Unless you've lied about your resume you should be fine.
Nah I get nervous, too. Especially during programming exercises that I can ace in any other situation. It's dumb, but it's legit fear of imposter syndrome that kicks in.
Needed: Good resources for python, Ruby, bash, perl
I'm finding out that the above is crucial to have in a Linux System Admins pocket. Last time I scripted or did programming really, was in school, and during my internship, which was years ago. So I CAN do it, but obviously I'm rusty as hell. I need to dive back in. I think I want to start with Python, and I know I could use Google, but yall do this for a living so hoping you have some direct pointers I can go to.
I'm finding out that the above is crucial to have in a Linux System Admins pocket. Last time I scripted or did programming really, was in school, and during my internship, which was years ago. So I CAN do it, but obviously I'm rusty as hell. I need to dive back in. I think I want to start with Python, and I know I could use Google, but yall do this for a living so hoping you have some direct pointers I can go to.
By Smokey Go To PostThat's good to here about python. Is it the easiest you'd say to get into?It's one of the easiest, yeah. Teaches good habits, too. I don't have much experience with it but it shouldn't be hard to pick up.
The OP lists a resource that teaches Python also as if you are learning programming for the first time. If you need a refresher on different concepts, this could help: https://learncodethehardway.org/python/
e: free sample: https://learnpythonthehardway.org/python3/
I'm doing some python training from a site while at work.
Not having to declare a type before a variable seems pretty damn dope. And the way lists work seems to be easier to understand for me than arrays in other languages.
Not having to declare a type before a variable seems pretty damn dope. And the way lists work seems to be easier to understand for me than arrays in other languages.
Yea, several languages infer types for you, but are still considered "strong typed" without any sort of declaration. Some do it better than others (looking at you, Javascript, doing it worse).
for (var i = 0; i < someArray.length; i++) {
var element = someArray;
console.log(element);
}
vs (python)
for name in student_names:
print("Student name is {0}" .format(name))
So much easierrrrrrrr
No curly brackets needed either by the gods whew
Ehhh, you're comparing an old spec of JS.
You can readily just do
in Javascript today.
EDIT: Updated for clarity.
You can readily just do
const students = ['One', 'Two', 'Three']
students.forEach(student => console.log(`Student name is ${student}`))
in Javascript today.
EDIT: Updated for clarity.
By reilo Go To PostEhhh, you're comparing an old spec of JS.
You can readily just doconst students = ['One', 'Two', 'Three'] students.forEach(student => console.log(`Student name is ${student}`))
in Javascript today.
EDIT: Updated for clarity.
Ah
That's still a bit more involved, but still easier to read. Remember the programming I've done? It was based on JavaScript and Java. That's what was taught in my courses which granted was MIS vs CS.
Javascript is a whole different beast from where it was even 2 years ago. It's not perfect, but it's closer to a loose-typed C# these days than anything else.
FYI, you could always do:
That was always doable in JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
FYI, you could always do:
for (var student in students) { console.log(student) }
That was always doable in JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
Do you folks still prefer rolling with Windows 7 instead of Windows 10, or have you all upgraded without a pathway back?
Hey Kibner, I vaguely remember you mentioning something about trying out Arch Linux. In your opinion, is the rolling release model better, or is it like always being in beta?
Hey Kibner, I vaguely remember you mentioning something about trying out Arch Linux. In your opinion, is the rolling release model better, or is it like always being in beta?
I upgraded to W10 and never looked back.
No opinion on Arch Linux. I'm mostly just using package managers to make sure I have the right version of stuff installed to work on this site. Speaking of which, there are some path issues I need to resolve in order to start that up again.
No opinion on Arch Linux. I'm mostly just using package managers to make sure I have the right version of stuff installed to work on this site. Speaking of which, there are some path issues I need to resolve in order to start that up again.
By reilo Go To PostJavascript is a whole different beast from where it was even 2 years ago. It's not perfect, but it's closer to a loose-typed C# these days than anything else.Interesting comparison. If C# had proper prototyping it would be a whole different beast, too.
FYI, you could always do:for (var student in students) { console.log(student) }
That was always doable in JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for…in
By Smoke Dogg Go To PostDo you folks still prefer rolling with Windows 7 instead of Windows 10, or have you all upgraded without a pathway back?
Been on win 10 for years. It's good.
By Smokey Go To PostSo much easierrrrrrrr
No curly brackets needed either by the gods whew
No curly brackets can be a real curse when you start writing more complex stuff.
Finding out where loops / conditionals start end can be really painful.
By giririsss Go To PostNo curly brackets can be a real curse when you start writing more complex stuff.If that becomes an issue, then you are probably working on a function that needs to be refactored.
Finding out where loops / conditionals start end can be really painful.
e: Giri, I'm working in earnest on Xamarin forms stuff and omg, is it annoying. I'm trying to emulate this Xamarin repository and it is proving to be a headache. I'm also reading the documentation that attempts to explain some of the patterns they are using.
By Kibner Go To PostIf that becomes an issue, then you are probably working on a function that needs to be refactored.My short respsonse would be. Don't. Like, just don't work in Xamarin. It doesn't save time. it doesn't do anything better. And just makes you look for workarounds for things that shouldn't be problems.
e: Giri, I'm working in earnest on Xamarin forms stuff and omg, is it annoying. I'm trying to emulate this Xamarin repository and it is proving to be a headache. I'm also reading the documentation that attempts to explain some of the patterns they are using.
There used to be a good introductory text book (that was a work in progress ...) that explained the xamarin way to do things. I'll see if i can find the links again. But that was just BEFORE they got bought out by MS. No idea if it will still be relevant.
*grumbles*
fucking template uses bower but recommends to replace with yarn
*grumbles some more*
replaced with yarn but how do i get my dependencies in such a way that it integrates well with Visual Studio ~googles~
*grumbling intensifies*
oh, so i need to install and learn how to use webpack
*grumbling halts*
welp, might as well get this shit configured for typescript while i'm here
----
This is probably old-hat to some of you guys but, oh well. Worse ways to spend holidays than learning stuff you kinda wanted to learn a while ago.
fucking template uses bower but recommends to replace with yarn
*grumbles some more*
replaced with yarn but how do i get my dependencies in such a way that it integrates well with Visual Studio ~googles~
*grumbling intensifies*
oh, so i need to install and learn how to use webpack
*grumbling halts*
welp, might as well get this shit configured for typescript while i'm here
----
This is probably old-hat to some of you guys but, oh well. Worse ways to spend holidays than learning stuff you kinda wanted to learn a while ago.
Ok, well, I think I have all the webpack and yarn stuff settled for what I need, for now.
I have things setup so that Visual Studio will run the dev Webpack script when in Debug Mode and the prod script at all other times. The script will only run on Build.
The script is just a simple command line command that calls the webpack executable with an environment flag set for 'production' or not.
That executable runs based off the options set in the webpack.config.js file. That file took the most work the last couple days. It defines a common, production, and development config. The environment flag set in an earlier step is used to figure out whether to merge the production or development config with the common one.
In an effort to reduce duplicating config options, I also have a webpack.parts.js file. It provides configuration "parts" that can have certain defaults that are common between both prod and dev as well as take arguments for any differences the two different configs may need. This abstraction also makes the main config file easier to read and parse for human eyes.
I have things about as simple and straightforward as I can figure. If anyone wants me to share those files to see exactly what I did, let me know.
I have things setup so that Visual Studio will run the dev Webpack script when in Debug Mode and the prod script at all other times. The script will only run on Build.
The script is just a simple command line command that calls the webpack executable with an environment flag set for 'production' or not.
That executable runs based off the options set in the webpack.config.js file. That file took the most work the last couple days. It defines a common, production, and development config. The environment flag set in an earlier step is used to figure out whether to merge the production or development config with the common one.
In an effort to reduce duplicating config options, I also have a webpack.parts.js file. It provides configuration "parts" that can have certain defaults that are common between both prod and dev as well as take arguments for any differences the two different configs may need. This abstraction also makes the main config file easier to read and parse for human eyes.
I have things about as simple and straightforward as I can figure. If anyone wants me to share those files to see exactly what I did, let me know.