Zombie James
Banned
What's GAF's thoughts on functional programming? I used some of it's philosophies on some Python code yesterday and I liked the results, very nice way of thinking.
PyCharm looks pretty good. I was considering using PyDev plugin for Eclipse, but this might be a better option. I will see if I can snag the student's license.It's not free, and I actually haven't used it for Python, but the JetBrains IDE is actually incredibly well done, at least RubyMine is. It's super easy to just jump in and out of libraries, test drive code, etc. There's a 30 day trial that doesn't bother you or make you register your email or anything @ http://www.jetbrains.com/pycharm/
I'd still advocate knowing vim, though, it's incredibly useful when remoting into servers, and sometimes just when you feel like using vim.
For things like lambdas, and functions like map and filter, I find them absurdly useful. My code would be a lot more verbose without them. It'd be tedious to read and write. However, I don't often use things like returning a function from a function, although I love passing them in as callbacks and stuff.What's GAF's thoughts on functional programming? I used some of it's philosophies on some Python code yesterday and I liked the results, very nice way of thinking.
Yes, I think soIt's a small do whatever you want assignment so I need to give some sort of context (ie make a stupid game) to a generic sorter that can do "any" kind of type/object.
Hey guys, what's the best language to learn as a network/server administrator? People have said powershell and thinking of that but I've been kind of leaning towards c# since of how I can create MIS packages with it and also the object based benefits doing so. This is coming from a guy with little programming language done in the past and more cmd and some other syntax commands. Thanks guys.
Generic I think, We've been taught to substitute a specific data type with "Element" basically. I talked to my tutor and what I already have is enough but I'm kinda fumbling in the dark nonetheless.Is it supposed to be generic or are you expected to use var?
(I'm not a fan of var, but it's practically a coding standard at the bf's company)
Sounds right. A good example that you've probably seen before in C# is List (Systems.Collections.Generic.List<T>). If you haven't encountered it, basically it's just a container that you put things in (like an array), but the type of things you put in isn't limited to one type; you define the type of things it holds with the Type parameter "T".Generic I think, We've been taught to substitute a specific data type with "Element" basically. I talked to my tutor and what I already have is enough but I'm kinda fumbling in the dark nonetheless.
public bool Equals(Foo f)
public class Crab : IEquatable<Tiger>
{
public string Name;
public bool Equals(Tiger t)
{
if(t == null)
{
return false;
}
return t.Name == this.Name;
}
}
public class Tiger
{
public string Name;
}
public class ConfigProvider
{
public T GetConfig<T>(string filename) where T : class, new()
{
var configText = File.ReadAllText(filename);
T config = Json.Deserialize<T>(configText);
return config;
}
}
public class ServerConfig
{
public string Url;
public int TimeoutMs;
public string UserName;
public string Password;
}
public class PlayerMotionConfig
{
public float Acceleration;
public float AirFriction;
public float MaxSpeed;
}
void Main()
{
ConfigProvider configProvider = new ConfigProvider();
ServerConfig serverConfig = configProvider.GetConfig<ServerConfig>("serverCfg.json");
PlayerMotionConfig motionConfig = configProvider.GetConfig<PlayerMotionConfig>("motion.json");
}
What's GAF's thoughts on functional programming? I used some of it's philosophies on some Python code yesterday and I liked the results, very nice way of thinking.
Solving a challenging programming problem in a clever way may be the most rewarding feeling I have ever experience. Can't wait for more challenge endeavors to come.
Funny - I was just commenting to a colleague that 'clever' is the most dangerous word that a coder can ever use.![]()
Funny - I was just commenting to a colleague that 'clever' is the most dangerous word that a coder can ever use.![]()
Functional programming is absolutely critical to growing as a programmer and even if you never write a program in a functional language for actual use the concepts you can learn will vastly improve other imperative programming you do as well. Everyone who is remotely interested in programming should at least expose themselves to a more pure functional language, Haskell or Scheme or similar.
Haskell's been on my radar for the longest time. After you've inherited enough projects where nearly every function changes any number of states in some other random location in the project, just the single, simple concept of functions that don't cause any side effects can have a dramatic effect. I can't count the amount of hours I've spend digging through spaghetti code tracking down bugs. It's annoying to say the least.
A lot of clever ideas end up having a ton of pitfalls you never account for. Elegant solutions are awesome though.Funny - I was just commenting to a colleague that 'clever' is the most dangerous word that a coder can ever use.![]()
I'm not familiar with functional languages. Is haskell not object oriented? Or are you just talking about static methods?
Funny - I was just commenting to a colleague that 'clever' is the most dangerous word that a coder can ever use.![]()
The obnoxious response to this is to say that the right way to learn PHP is to not learn it at all. But the best way to learn it is really to make sure that you are following the most modern conventions. A lot of PHP is bad old junk that's in there because it's in there rather than because it's useful or effective.
I'm far from an expert on PHP, mainly because I refuse to use it for anything, but when I did have to learn it before, I found the Official Documentation to be a reasonably coherent explanation of everything. The comments that people post tend to fill in the blanks or provide opionions on best practice which are usually good. Sometimes a giant flame war erupts in the comments which is your clue that the topic in question is a particularly murky one.
I also came across this the other day, and while I haven't read it in detail, from a quick look through it seems to cover most of the bases well.
You said "switch to", which language(s) are you familiar with already? That might affect the best way for you to approach PHP, depending on existing knowledge.
Hey guys,
I was wondering if you could give me a hand with a bit of C++. I learnt the basics a while back but haven't touched anything C++ in a long time.
Anyway, I have an object with a 3-dimensional std::vector field and I would like to serialize that object (or at least find a way to write that 3d vector to the disk). Any idea? A colleague suggested the Boost library but I am not sure it can be used with multidimensional vectors.
Any advice welcome!
All too familiar :lol Time for an event based and a multi threaded assignment (rough course is rough).Clever = "I don't know why it works but it does!"
Clever = "I don't know why it works but it does!"
worksforme.png.exe
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double Pay=.01, Days, IncreaseF=0;
const int INI=1;
int Ini=INI;
char again;
do
{
cout<<"Welcome to PENNYMASTER"<<endl;
cout<<"Type in the amount of days you'll be working and I will give you a neat little chart showing";
cout<<" the pay for each day you work!"<<endl;
cin>>Days;
if(Days<INI)
cout<<"Hey, that's an invalid input! Now you'll have to reload the program!"<<endl;
else
{
cout<<"Day# Pay"<<endl;
cout<<"---------------------"<<endl;
while(Ini<=Days)
{
cout<<Ini<<"\t\t"<<(Pay*pow(2, IncreaseF))<<endl;
Ini++;
IncreaseF++;
}
}
cout<<"Do you wish to enter a new value?"<<endl;
cout<<"Y or y for YES, N or n for No"<<endl;
cin>>again;
} while ( again=='Y' || again=='y');
return 0;
}
Argh, GAF I do not know why this do/while loop won't work! Is there something wrong with where I put my end while? I can't figure it out, it just terminates and doesn't ask me to enter a value for again. Help for a newbie please.![]()
./a.out
Welcome to PENNYMASTER
Type in the amount of days you'll be working and I will give you a neat little chart showing the pay for each day you work!
5
Day# Pay
---------------------
1 0.01
2 0.02
3 0.04
4 0.08
5 0.16
Do you wish to enter a new value?
Y or y for YES, N or n for No
y
Welcome to PENNYMASTER
Type in the amount of days you'll be working and I will give you a neat little chart showing the pay for each day you work!
1
Day# Pay
---------------------
Do you wish to enter a new value?
Y or y for YES, N or n for No
y
Welcome to PENNYMASTER
Type in the amount of days you'll be working and I will give you a neat little chart showing the pay for each day you work!
10
Day# Pay
---------------------
6 0.32
7 0.64
8 1.28
9 2.56
10 5.12
Do you wish to enter a new value?
Y or y for YES, N or n for No
n
Have you tried printing the value of "again" after the loop ends, to see why it ended?
Python is very popular in certain sectors. Tons of websites use it for the server code, also the science community uses it for a lot of things.So this coursera class and my own pissing around has got me hugely loving Python. But I am kind of concerned that Python is pretty weak when it comes to non-hobby level programming. I was reading up on threading, and apparently python has zero support for parallel programming, and even normal OS level threading is weak. This is unfortunate because I am not experienced in threading and parallel programming at all, and was hoping that it was going to be easy in Python in order to ease myself into it. Apparently I need to either launch multiple instances of different python processes from a C program or possibly use stackless python. Doesn't seem very noob friendly in order to have to do all of this, which kind of goes against the rest of python. Any word if they are fixing this shit in future versions of Python?
#!/usr/bin/perl
print ("What is your name? ");
$name = <STDIN>;
print ("Welcome, $name\n");
@majors = ("Sec", "ComSc", "CIS", "WebDesign", "IT", "SAS");
print ("These are the computer majors at RWU:\n");
print ("$majors[0]\n");
print ("$majors[1]\n");
print ("$majors[2]\n");
print ("$majors[3]\n");
print ("$majors[4]\n");
print ("$majors[5]\n");
print ("What is your major? ");
$major = <STDIN>;
chomp $major;
if ($major == @majors)
{
print ("Thank you for your time. \n");
}
else
{
print ("This major does not exist. \n");
}
Hey GAF, I'm trying to write a really basic perl script for a class and I'm having trouble (I have no programming experience). The script asks your name, then lists all the computer related majors at my school. From there it asks what your major is. The problem is that I can't figure out how to get it to verify the major you enter is in the list. No matter what is entered it prints out "This major does not exist."
I've tried many different ways, but they all have given me the same result. I hope that it's just something simple that I'm missing.
You're comparing a single major to an entire set of majors.
Is there a way to write it so it compares your input to the set? And if what you input is in the set have it print "Thanks for your time." That's what I'm trying to do.
You need to either iterate through the set and store the results of a successful comparison against a member, or use a search function on the set (not sure if Perl has one).
Argh, GAF I do not know why this do/while loop won't work! Is there something wrong with where I put my end while? I can't figure it out, it just terminates and doesn't ask me to enter a value for again. Help for a newbie please.
If someone else can find a reason why this isn't working correctly can they shoot me a dm?
Code:#include <iostream> #include <cmath> using namespace std; int main() { double Pay=.01, Days, IncreaseF=0; const int INI=1; int Ini=INI; char again; do { cout<<"Welcome to PENNYMASTER"<<endl; cout<<"Type in the amount of days you'll be working and I will give you a neat little chart showing"; cout<<" the pay for each day you work!"<<endl; cin>>Days; if(Days<INI) cout<<"Hey, that's an invalid input! Now you'll have to reload the program!"<<endl; else { cout<<"Day# Pay"<<endl; cout<<"---------------------"<<endl; while(Ini<=Days) { cout<<Ini<<"\t\t"<<(Pay*pow(2, IncreaseF))<<endl; Ini++; IncreaseF++; } } cout<<"Do you wish to enter a new value?"<<endl; cout<<"Y or y for YES, N or n for No"<<endl; cin>>again; } while ( again=='Y' || again=='y'); return 0; }
Hmm, before return 0;? Because I tried making it print again, and nothing shows up. I even assigned it a value and for some reason the whole thing completely bypasses the display of the prompt asking to enter a value for again.
Huh, that's curious. I've honestly no clue what seems to be the problem to be honest.
Hrm, well, in any case, a do/while loop isn't necessary for my assignment, it was just a little something extra I wanted to put in to make it easier to rerun if you put in an incorrect value.
Yeah you can use Visual Studio for writing the code, no problem. However, you'll have to build for other platforms with different compilers, with different platform targets. To do this, your code has to be cross-platform (or at least portable).If I want to write multi-platform C++ code am I able to still write and work in Visual Studio? I suppose I probably couldn't compile and run it from there. This is assuming I use solely multi platform libraries such as QT. I really don't have any knowledge on how to package and deploy code :|
public static void Exam1Average(int[][]grades)
{
int sum = 0;
for(int row=0; row<=4; row++)
sum = grades[row][0] + sum;
}
So this coursera class and my own pissing around has got me hugely loving Python. But I am kind of concerned that Python is pretty weak when it comes to non-hobby level programming. I was reading up on threading, and apparently python has zero support for parallel programming, and even normal OS level threading is weak. This is unfortunate because I am not experienced in threading and parallel programming at all, and was hoping that it was going to be easy in Python in order to ease myself into it. Apparently I need to either launch multiple instances of different python processes from a C program or possibly use stackless python. Doesn't seem very noob friendly in order to have to do all of this, which kind of goes against the rest of python. Any word if they are fixing this shit in future versions of Python?
I fixed it. My Problem was with another method where I load the array.
but thats what I get for getting frustrated.
I am going to have trouble trying to find the average of the rows though. How would I go about doing that? The program specifies 5 rows, 2 columns.
Anybody?What books/other resources do you guys recommend for learning Objective C as a first language?