• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

JeTmAn81

Member
I think working from home is a lot more common in software development than it is in a lot of other jobs. It's a job that can be done from anywhere. I work from home full time but that's only because my wife has health problems and can't take care of our daughter during the day.

Working from home isn't really something you go out looking for but some places do allow it depending on circumstances.
 

Mr.Mike

Member
Websites in general are probably bottle necked by IO speeds anyway. I'd imagine if IO was much faster than we'd see more effort into making web apps more performant so that they could run on less/cheaper hardware.
 

Somnid

Member
Let's put it this way, plenty of high profile sites are dropping Java for Javascript (node.js) and getting faster as a result. In the web world it's all about the architecture, not number crunching ability.
 

Kalnos

Banned
As long as the performance is good enough people will opt for the setup that allows them to be the most productive, Java isn't that to anyone that I know.
 
As long as the performance is good enough people will opt for the setup that allows them to be the most productive, Java isn't that to anyone that I know.

I know a web dev shop in Charleston that basically only uses Java. That blew my mind, they hosted a hackathon last year that I went they completely swore off anything else for web development. Node? Nope, Rails? Nope, .NET? nope.

Like I understand having a preference and damn. Like I prefer working with Django but I have no problem with Rails, Any of the PHP frameworks, Node, etc.
 

hateradio

The Most Dangerous Yes Man
So, ^(?!.*(.)(.)\2\1)


The prime one is an interesting use of look-back.

n is not a prime if n = a*b where a and b are integers greater than 2

So you want a>1 identical groups of b>1 times the same character

b>1 times the same character is ..+ (or rather (.)\1+ in fact but here, it doesn't matter)

a>1 identical groups of b>1 times the same character is (..+)\1+

Now, you want the opposite, so throw in negative look-ahead and you get ^(?!(..+)\1+$)

Still, it was working on Python no that long ago...
I see. I was trying this, but I didn't need the equal sign and needed the caret: (?!=(.)(.)\2\1).

That prime thing is kinda interesting. I didn't know that the dollar sign could be put elsewhere than the end.
 

Koren

Member
That prime thing is kinda interesting. I didn't know that the dollar sign could be put elsewhere than the end.
The look-ahead is "try and forget". It tries to match, then discard everything. So even if you reached the end, you can use the characters again. In other cases, you can't expect anything after $.

Not sure it works with all flavors...

But

^(?!.*z$).(?!o.$).*$

will match bar and foobar but neither foo or baz.
 

Arthrus

Member
I'm a novice programmer building myself a website as a hobby, and I'm finding my biggest hurdles right now are not knowing what things are called. (e.g. I wanted to make a feature for my site and then learned a few days later that it was called an accordion.)

I don't suppose anyone could tell me the name of some javascript/jQuery functions that would be useful for displaying information when a button/thumbnail is pressed. I made an mspaint image to show what I'm trying to do.

Selecting%20Cards_zpshh3rki52.png
 

JesseZao

Member
I'm a novice programmer building myself a website as a hobby, and I'm finding my biggest hurdles right now are not knowing what things are called. (e.g. I wanted to make a feature for my site and then learned a few days later that it was called an accordion.)

I don't suppose anyone could tell me the name of some javascript/jQuery functions that would be useful for displaying information when a button/thumbnail is pressed. I made an mspaint image to show what I'm trying to do.

I like unobtrusive jQuery. You'd need an on click event.

Code:
$('elementID').on('click', function() {
    // do stuff
    // i.e. $('displayBoxID').html('whatever you want to display');
});
 
Anyone know what's wrong with this processing 3.1.1 program? The first "sum" is underlined and says the function "sum()" expects parameters like "sum(int,int)". Its for a class and i have extremely limited knowledge of programming and this is my second week in a processing class and i dont really know what im doing lol

void setup() {
int a = 1;
int b = 2;
int c = 3;
float result = sum(div(a,b), mul(b,c));
println(result);

String s1 = "hello";
println(s1);
}

int sum(int a, int b) {
return a + b;
}

int mul(int a, int b) {
return a * b;
}

float div(int a, int b) {
return a / b;
}
 

kadotsu

Banned
your div function returns a floating point value. Your sum function only adds integers. Change the sum function to take floats.
 

kadotsu

Banned
How would i go about doing that? I thought it was already a float since float was in that line

int sum(int a, int b) {
return a + b;
}

The return value gets type casted into a float. The error in your code is because the parameter value has the wrong type. You could fix your code in two ways:

1. (bad) float result = sum((int)div(a,b), mul(b,c)); //is stupid because you lose floating point in the function and cast back to it

2. (good fix the function) float sum(float a, float b)
 
int sum(int a, int b) {
return a + b;
}

The return value gets type casted into a float. The error in your code is because the parameter value has the wrong type. You could fix your code in two ways:

1. (bad) float result = sum((int)div(a,b), mul(b,c)); //is stupid because you lose floating point in the function and cast back to it

2. (good fix the function) float sum(float a, float b)

I actually was thinking of a similar solution , thanks though!
 

leroidys

Member
I'm primarily a python (2) dev- anyone have recommendations for a language to look into that

1) Will actually net me jobs
2) Is not java, javascript, c#, c++, perl, ruby

I actually like C a lot, but it's so hard to make myself work on C projects in my free time given how onerous it is to do simple things compared to python.
 
I'm primarily a python (2) dev- anyone have recommendations for a language to look into that

1) Will actually net me jobs
2) Is not java, javascript, c#, c++, perl, ruby

I actually like C a lot, but it's so hard to make myself work on C projects in my free time given how onerous it is to do simple things compared to python.

Why wouldn't you be able to get jobs? I was under the impression that Python was fairly popular and well regarded. Especially in the sciences and web development Python has a big life as far as I know. What field within Python do you specialize in?

Also as a side note, why don't you get up to speed with Python 3? There have been a lot of changes to it the last few years and almost everyone seems to be aboard the Python 3 train now.

I'm also curious why you ask for advice on other languages that will get you a job and then immediately reject all of the current most popular/most employable languages.

I mean there are other languages besides the ones mentioned, they exist in various flavours (Some functional and some OO). None of those languages would be as popular as Python though especially where employment is concerned, so if you are unable to find a job in Python why would you then be able to find a job in a niche language that might be popular in online communities but has very little adoption in the workplace?
 
I'm primarily a python (2) dev- anyone have recommendations for a language to look into that

1) Will actually net me jobs
2) Is not java, javascript, c#, c++, perl, ruby

I actually like C a lot, but it's so hard to make myself work on C projects in my free time given how onerous it is to do simple things compared to python.

So you are looking for a language that companies want, but you dont want the languages that corporations use (Java/C#) or the language that startups use (javascript and ruby)?

Well, i guess C is the only remaining option if you want to dive into embedded systems, but im not sure if you will be able to find a job unless you got a degree in say computer engineering or electrical engineering.
 
I'm primarily a python (2) dev- anyone have recommendations for a language to look into that

1) Will actually net me jobs
2) Is not java, javascript, c#, c++, perl, ruby

I actually like C a lot, but it's so hard to make myself work on C projects in my free time given how onerous it is to do simple things compared to python.

I mean you basically just listed all the languages that would net you jobs...
Ruby/JS for the startup world
Java/C# for corporations

You could learn COBOL and work at a bank?
There's also PHP

How are you not getting jobs with Python? o_O
 
Whyyyy does everything have to beeeee sooooo friggin' slooooooow while doing Scala/Play crap on IntelliJ IDEA. Mainly building indices and downloading dependencies and then building the indices again and again again again.

I like the language but so far I have mostly stuggled with everything being so painful with the tooling that I have barely any time writing any code.

Any other suggestions for editors that aren't IDEA or anything Eclipse based? I guess I could go for the emacs route instead but I don't think I have the time to learn Scala AND Emacs stuff right now.

edit: Installed Ensime (https://atom.io/packages/ensime) integration to Atom and suddenly life feels much better.
 

w3bba

Member
I'm primarily a python (2) dev- anyone have recommendations for a language to look into that

1) Will actually net me jobs
2) Is not java, javascript, c#, c++, perl, ruby

I actually like C a lot, but it's so hard to make myself work on C projects in my free time given how onerous it is to do simple things compared to python.

tried looking into go? it's similar to c, but got a lot of convenience stuff that you have in python and interesting concepts in general . also it's starting to get more popular with companies(in my experience)
 

JeTmAn81

Member
I'm primarily a python (2) dev- anyone have recommendations for a language to look into that

1) Will actually net me jobs
2) Is not java, javascript, c#, c++, perl, ruby

I actually like C a lot, but it's so hard to make myself work on C projects in my free time given how onerous it is to do simple things compared to python.

Why don't you want to work with the most popular and well-made languages in the industry?
 

leroidys

Member
Why wouldn't you be able to get jobs? I was under the impression that Python was fairly popular and well regarded. Especially in the sciences and web development Python has a big life as far as I know. What field within Python do you specialize in?

Also as a side note, why don't you get up to speed with Python 3? There have been a lot of changes to it the last few years and almost everyone seems to be aboard the Python 3 train now.

I'm also curious why you ask for advice on other languages that will get you a job and then immediately reject all of the current most popular/most employable languages.

I mean there are other languages besides the ones mentioned, they exist in various flavours (Some functional and some OO). None of those languages would be as popular as Python though especially where employment is concerned, so if you are unable to find a job in Python why would you then be able to find a job in a niche language that might be popular in online communities but has very little adoption in the workplace?

So you are looking for a language that companies want, but you dont want the languages that corporations use (Java/C#) or the language that startups use (javascript and ruby)?

Well, i guess C is the only remaining option if you want to dive into embedded systems, but im not sure if you will be able to find a job unless you got a degree in say computer engineering or electrical engineering.

I mean you basically just listed all the languages that would net you jobs...
Ruby/JS for the startup world
Java/C# for corporations

You could learn COBOL and work at a bank?
There's also PHP

How are you not getting jobs with Python? o_O

tried looking into go? it's similar to c, but got a lot of convenience stuff that you have in python and interesting concepts in general . also it's starting to get more popular with companies(in my experience)

Why don't you want to work with the most popular and well-made languages in the industry?
Thanks for the feedback. It wasn't very clear, but I currently have a job as a python dev. I'm just looking broaden my horizons, and I haven't really enjoyed the time I've spent with my arbitrary blacklist of languages. Go seems like a good possibility
 

poweld

Member
Whyyyy does everything have to beeeee sooooo friggin' slooooooow while doing Scala/Play crap on IntelliJ IDEA. Mainly building indices and downloading dependencies and then building the indices again and again again again.

I like the language but so far I have mostly stuggled with everything being so painful with the tooling that I have barely any time writing any code.

Any other suggestions for editors that aren't IDEA or anything Eclipse based? I guess I could go for the emacs route instead but I don't think I have the time to learn Scala AND Emacs stuff right now.

edit: Installed Ensime (https://atom.io/packages/ensime) integration to Atom and suddenly life feels much better.

Odd, IntelliJ should only build indices for a project once. Maybe an incremental update when a dependency is added, but that shouldn't be too bad.

Another solution if you're not working on a big codebase or don't mind a lack of auto completion is to have sbt running a continuous build or run on your project while you edit it. Every time you change the source it will rebuild or rerun, and you can use whatever editor you want. Pretty swell for tinkering.
 

Quotient

Member
I'm primarily a python (2) dev- anyone have recommendations for a language to look into that

1) Will actually net me jobs
2) Is not java, javascript, c#, c++, perl, ruby

I actually like C a lot, but it's so hard to make myself work on C projects in my free time given how onerous it is to do simple things compared to python.

There are many companies that don't care about the language and rather want smart people. Regardless you should apply for jobs even if they ask for Java, C#, Ruby, Javascript etc. Some HR folk recognize that knowledge is transferable between languages and may schedule a phone interview.
 

Ledbetter

Member
Is Haskell a kind of "intro" language to functional programming or something? I've read some comments about that I should learn Haskell first and when I understand the basics then move on to another FP language. Why is that?

Also, any of you working with FP? I get this feeling that it is rare to find this kind of job in the industry. I'm kind of new to this type of languages, mostly because my school doesn't teach anything about it, so I want to learn by myself.
 

Makai

Member
Is Haskell a kind of "intro" language to functional programming or something? I've read some comments about that I should learn Haskell first and when I understand the basics then move on to another FP language. Why is that?

Also, any of you working with FP? I get this feeling that it is rare to find this kind of job in the industry. I'm kind of new to this type of languages, mostly because my school doesn't teach anything about it, so I want to learn by myself.
You'll be tempted to use OO style unless you use a pure fun language. I did Haskell for 3 weeks then switched to F#.

http://learnyouahaskell.com/
 
Odd, IntelliJ should only build indices for a project once. Maybe an incremental update when a dependency is added, but that shouldn't be too bad.

Another solution if you're not working on a big codebase or don't mind a lack of auto completion is to have sbt running a continuous build or run on your project while you edit it. Every time you change the source it will rebuild or rerun, and you can use whatever editor you want. Pretty swell for tinkering.

Yeah, the current project is pretty large and there's tons of tinkering with the dependencies currently (splicing a part of a bigger service to be a standalone micro-ish service) so the churn is pretty much constant.

Constant building could be an option, but ensime also looks pretty swell option right now.
 
Is Haskell a kind of "intro" language to functional programming or something? I've read some comments about that I should learn Haskell first and when I understand the basics then move on to another FP language. Why is that?

Also, any of you working with FP? I get this feeling that it is rare to find this kind of job in the industry. I'm kind of new to this type of languages, mostly because my school doesn't teach anything about it, so I want to learn by myself.

Haskell is the best language to start with FP. Its not a simple language, especially if you are already used to OOP-style languages, but once you embrace the fact that the compiler wont stop yelling until every single type matches as a good thing its really frustrating going back to a language like javascript or python. I do have to say that i consider F# to be the better language, but picking it up after messing with Haskell for a while isnt hard.

The best haskell book is Haskell Programming from first principles. Problem is its quite expensive, but its worth every single dollar. Im not really a fan of Learn you some haskell, but well, its free so might as well use it for a while to see if you want to continue with Haskell. If you do, buy the Haskell Programming book.


Thanks for the feedback. It wasn't very clear, but I currently have a job as a python dev. I'm just looking broaden my horizons, and I haven't really enjoyed the time I've spent with my arbitrary blacklist of languages. Go seems like a good possibility

If you just want to broaden your horizons, go for Haskell to dive into functional programming, or perhaps Prolog for logic programming. Both wont get you jobs, but will help you see problems in new ways. Go is not really going to teach you that many new things.
 

Koren

Member
You'll be tempted to use OO style unless you use a pure fun language. I did Haskell for 3 weeks then switched to F#.

http://learnyouahaskell.com/
That's a matter of will ^_^

I'm glad I started with ML (forbidding myself to use references as a rule*) and learned Haskell later. I still find a couple things in Haskell a non-intuitive.

But to each its own.


* Caml Light as ML variation, so no OO temptation anyway...


(As for Prolog, I'm not sure I've seen it a lot of use, even for "cultural" reasons... but maybe that's just me. Even the exam I had in my Prolog course when I was a student didn't used a single line of Prolog ^_^)
 
Has anyone ever done capturing UDP packets from Wireshark with a Java program? I am having trouble obtaining the data portion. I can establish the port number, so I am connected.

Just so I am not missing the basic stuff: my port number is the UDP port number and the InetAddress is my local machine. Basically, I want the data to be printed on the console for now. When I use a myPacket.getLength it will print 0 so I think it's not pulling correctly.
 

poweld

Member
Has anyone ever done capturing UDP packets from Wireshark with a Java program? I am having trouble obtaining the data portion. I can establish the port number, so I am connected.

Just so I am not missing the basic stuff: my port number is the UDP port number and the InetAddress is my local machine. Basically, I want the data to be printed on the console for now. When I use a myPacket.getLength it will print 0 so I think it's not pulling correctly.

I'm not quite sure what you mean by "capturing UDP packets from Wireshark with a Java program". Are you using the pcap lib in a Java application, or are you trying to capture traffic generated by a Java application in Wireshark?

If you're trying to capture within your own application, have you tried using Wireshark or tcpdump to verify that the messages are actually coming in as you'd expect them?
 
Thinking of working on an Android application. I am not making a game, but is it possible to do procedurally generated output or is it better to rely on random?
 
Hey does anyone here have the link to a site that did a pretty comprehensive breakdown of programming languages earlier this year? I saw the original post here but couldn't find it. It was rather long as well. Thanks programmerGAF
 

GaimeGuy

Volunteer Deputy Campaign Director, Obama for America '16
Man I feel like an idiot...

So, say I have a number of points, and I draw lines between them:

struct DrawingData
{
int numPts;
int ptDistances[MAX_PTS];
int ptXs[MAX_PTS];
int ptYs[MAX_PTS];
};

the points are ordeered by distances.

And, then I have another set of objectdata;

struct ObjectData
{
int objDistance;
....
....
};

Given a vector of ObjectDatas ordered by their distances:
For each Object:
I want to determine which two points the object lies between (IE: ptDistance[X] <= objectDistance <= ptDistance[X+1]) and then do stuff from there based on dat from both points and the object

Obviously, objects with distances lower than the distance of the first point can be ignored, and once I find an object that has a distance beyond that of the last point, the processing can terminate. And I don't have to look through all the points for every object - I know that each subsequent object will not lie on an earlier segment than the current object, but...

I feel really stupid but I'm having trouble writing the algorithm for this double list traversal. Really rusty on my algorithms X_X
 

GaimeGuy

Volunteer Deputy Campaign Director, Obama for America '16
Jesus christ I'm dumb, I should be doing something similar to a merge comparison

int currentPt = 0;
int nextPt = 1;
int currentObject = 0;
while (nextPt < numPts && currentObject < objectsVector.size()):
if the current object's distance is less than the current point's, skip the current object, move on to the next one (IE: increment currentObject index counter)
else if the the current object's distance is greater than the next point's distance, then increment currentPt and nextPt (Because the object lies beyond both the current and next point)
else the current object's distance is greater than or equal to the current point's and less than or equal to the next point's - doStuff(current object, current point, nextPoint) then move onto the next object.


Bam, O(numPts + numObjects)

... I love and hate this feeling of resolution of a programming roadblock. ._.
 

sgjackson

Member
so i'm doing a problem for programming fundamentals 1 where they're teaching methods in java using a pretty simple problem that validates a credit card number using the sum of even and odd digits (this is slightly more complicated than what i'm describing but it functions in my code so i don't care)/the size of the card/the prefix of the card. the book dictates what function headers you're supposed to use, and i'm confused why the headers for the prefix are set up in this way:

public static boolean prefixMatched(long number, int d)

public static long getPrefix(long number, int k)

valid prefixes are 37, 4, 5, and 6. i wrote the program making k a constant equal to 2, and always spitting out a 2 digit number (even though the book assumes k can change, there's never any input for it. i wrote the code to make the prefix spit out properly if k changed anyway). if you do it like i described, you get a 2 digit number, and can either check if it's 37 or lop the last number off to see if it's 4, 5, or 6, so i used prefixMatched to determine if the result of getPrefix is one of the valid prefixes, confused as to why it passes down the original card number. i e-mailed the teacher about it, and she said that prefixMatched checks if d is a valid prefix of the card number - so if the card number is 4160xxxxxxxxxxxxxxx and your prefix is 41, it spits out true, but if the prefix were 40, it's false. why is this even needed if getPrefix generates the prefix? is it just a defensive coding thing?

update: teacher e-mailed me back and said it's suboptimal and supposed to teach you things - i assume that you can call the size function and getPrefix inside prefixMatched to test whether or not the prefix exists or w/e.
 

JeTmAn81

Member
Jesus christ I'm dumb, I should be doing something similar to a merge comparison

int currentPt = 0;
int nextPt = 1;
int currentObject = 0;
while (nextPt < numPts && currentObject < objectsVector.size()):
if the current object's distance is less than the current point's, skip the current object, move on to the next one (IE: increment currentObject index counter)
else if the the current object's distance is greater than the next point's distance, then increment currentPt and nextPt (Because the object lies beyond both the current and next point)
else the current object's distance is greater than or equal to the current point's and less than or equal to the next point's - doStuff(current object, current point, nextPoint) then move onto the next object.


Bam, O(numPts + numObjects)

... I love and hate this feeling of resolution of a programming roadblock. ._.

Couldn't you improve this by using binary search to locate the point nearest to the object's distance?
 
Alright, so I was able to write some code that finds a Network Interface, aka my Ethernet connection. I am trying to isolate UDP packets, so I am filtering by the particular port. I am receiving packets in my console output. I was wondering how do I go about checking to see if they're correct. I am scoping through Wireshark but I don't think I am printing enough information to the console.

Also, does anyone know how I should go about printing the raw data within a packet to the console? I am using the Jnetpcap library.
 

gblues

Banned
I posted this in the indie developer thread, but I might get a decent answer here, too:

Anyone here familiar with MyGUI?

I've been working on a contribution for OpenMW to make the UI not shit the bed when using a larger-than-default text size, and it's driving me up the goddamn wall. MyGUI gets its configuration from a collection of XML files that are very poorly documented. The skinning system seems to have no concept of text size--e.g. I can't figure out a way to say "make this thing text size +2."

I've had moderate success in dynamically resizing all the widgets at runtime, but that's a pain in the ass for one, and I'm effectively hard-coding the layout (defeating the purpose of the XML format) for two. The runtime resizing seems to be pretty buggy, too.

So, at this point I'm thinking that MyGUI just isn't up to the task, and I'm wondering if anyone else has tried to do something like this and had success, or knows of a different GUI libarary that can do what I want it to do.
 

Koren

Member
Only if there are more than 64 or so points and objects.
Out of curiosity, how do you come with the 64 value?

If n and p are the length of both vectors, the "merge" version is O(n+p), the dichotomic version is O(p ln(n)) if I'm not mistaken (although I suspect you can do better).

I'd say it really depends on the data... If both vectors are about the same length, the merge version would be better, if one is far shorter than the second, the dichotomic approach can shine.

(That being said, if the length of the longest vector is less than 100, I wouldn't bother with a dichotomic solution)
 
Top Bottom