• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 09:20
CET 15:20
KST 23:20
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband Information Request Regarding Chinese Ladder
Tourneys
$5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Data analysis on 70 million replays Which season is the best in ASL? [ASL20] Ask the mapmakers — Drop your questions BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread The Perfect Game Path of Exile Should offensive tower rushing be viable in RTS games?
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1256 users

The Big Programming Thread - Page 438

Forum Index > General Forum
Post a Reply
Prev 1 436 437 438 439 440 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
Last Edited: 2014-02-05 09:43:19
February 05 2014 09:38 GMT
#8741
On February 05 2014 16:14 icystorage wrote:
in the future, what do you guys think of a stay-home programmer dad? like just do freelance or similar-work in the house?


I thought it would be cool to work at home as a contractor but the reality can be quite different.

The most important thing I think is to only care about yourself, most of the guys that hire you are just out there to get a buck and don't give a crap about you. Also be absolutely 100% clear about EVERYTHING, if there's ever a time to be OCD, now is the time.

Only do the work that is outlined. If he asks you for more work after the scope has been signed, amend the scope/contract and charge more or reject it. Otherwise you will end up doing more work, and he will expect you to have no delays on the original work as well and then may tear the contract if you slow down too much.

The last contractor I worked with I felt used and abused. I was still in university but I had a good CV honestly I just wanted some work experience. I thought that if I didn't charge a lot and worked hard he would be happy (and I would be happy), nope, he just gave me more work to do and if I didn't do it he'd call me up.

He ended up giving me a weeks notice to do a lot of things that he never mentioned that he wanted (e.g full test coverage, when I asked him about tests and said I would charge more if he said yes, he didn't reply that he wanted them only that they were important but were secondary to time-frame, basically if the time allows for it and he kept the charge the same).

I ended up leaving the project halfway through, and he tried his best to pay me the minimal amount of money possible. At one point he said he owed me $2,000, and then when I said this was unfair because this assumes we aren't up to QA yet which means the features hes asking me to do aren't valid yet.

He was basically trying to get rid of me because I hadn't finished QA features, but then he's paying me for phases before that point. Then he said ok we will pay you $1,500 because as you said, not up to QA phase yet. Wowwww really? He knew I was young and was charging almost nothing in the first place, literally like stealing candy from a baby. What a fucking tool.

I made LOTS of mistakes in this project, as you can see but I was young and naive. There were lots of warning signs, the contract needed amending 3 times through a lawyer before it was satisfactory, I could have been fucked over big time with the original contract (originally I was liable for more than what the project was worth, so I could lose $50k even though they would only pay me $6k for the full job).

Another is even though I asked him a lot of stuff up front he gave me a lot of vague answers (e.g tests are "important", only do them if "time allows"). This is never good, always confirm an absolute YES or NO with a straight up binding hollar dollar cash money figure on every single feature.

If the contract needs fixing, don't even bother with that company, its literally not worth the pain that will inevitably follow. If they're willing to give you a shitty contract, they're probably shitty people.

On February 05 2014 18:02 WolfintheSheep wrote:
Show nested quote +
On February 05 2014 16:14 icystorage wrote:
in the future, what do you guys think of a stay-home programmer dad? like just do freelance or similar-work in the house?

Far more viable for positions like Web Designers or UI Designers, where you create something to a client's liking and then hand it over 100%.

The more you become involved in software or other back-end development, the more your role involves maintenance and upkeep, which inevitably leads to demand for physical presence.

Like all careers, though, anything's possible if there's a demand, and if you sell yourself properly.


This as well, if you do lots of freelance projects eventually you are going to be overwhelmed with maintaining all of them.

You have two options,
In the contract you should assume no responsibility for the project after it is finished
Or know that they are willing to pay bucket loads of cash for easy maintenance
Or both
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
AKnopf
Profile Blog Joined March 2011
Germany259 Posts
February 05 2014 10:43 GMT
#8742
I've been working for a company that had a lot of freelancers in its developer team (not because they didn't want to "properly" employ them but because the guys preferred to be freelancers). It seemed to me as it was very relaxed for the freelancers as the company and them trusted each other. Basically they just had to show up and do their work as everyone else and the employer trusted them to do their best. And they actually did, because we worked very closely together as a team.

What I'm trying to say is: Yes, you can end up like sluggaslamoo (indeed a friend of mine stopped freelancing because he ran into that kind of project too often) and have terrible contract partners. But there are also nicer opportunities. I believe the best is to ask friends and colleges if they have experience with this person/company. You wont always have that luxury though and then its good to have a clear contract and to communicate that extra service will cost extra.
The world - its a funny place
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2014-02-05 11:50:30
February 05 2014 11:16 GMT
#8743
On February 05 2014 16:14 icystorage wrote:
in the future, what do you guys think of a stay-home programmer dad? like just do freelance or similar-work in the house?


As a dad, I'm thinking this is pretty much the most miserable thing I can think of. It might be possible once your kids are grown, but when you are taking care of your kid you don't have the attention to be able to focus on your programming -- and I only have one.

So I think to pull this off your day would look something like, get up at like 5 am and work until the kid gets up. Then wait until your kid goes to bed and then put in the rest of your day. You might be able to get an hour or two in when they are napping, assuming there isn't any work to do around the house since you're the stay at home parent. Maybe you could have your wife watch the kid when she gets off work, but then when are you going to spend any time with her? So now you're working (yes taking care of the kid is work) like 15 hour days, if your wife only works 8 hours and you only work 8 hours. You could work on the weekend, but now you're working weekends.

This does assume that you want to progress in your career, and not just pick up an odd job to make a few bucks here or there. Hopefully you find a sugar momma or don't really mind living week to week.

Put the kid in daycare for a half day, get a nanny, or just be a stay at home dad.

If you have kids already, then you're insane, if you don't have kids already, please come back in the future and let us know how crazy you were
berated-
Profile Blog Joined February 2007
United States1134 Posts
February 05 2014 12:10 GMT
#8744
On February 05 2014 14:14 sluggaslamoo wrote:
Show nested quote +
On February 05 2014 05:03 Vorenius wrote:
On February 05 2014 03:40 Animzor wrote:
On February 05 2014 03:21 ThatGuy wrote:
Of course, there could be a ton of other things happening here. Maybe you don't set the stock value on a newly created stock. Maybe you're using a copy constructor and another Stock with an empty Stock value. You'll either need to debug deeper or be more open with the question to actually isolate whether that block of code is indeed causing your issues.


Sorry, I didn't want to be an asshole and post too much code. Anyway, what I have is a Person class and a Stock class. Every Person includes an arraylist which can contain a bunch of items, like Stock. In the Stock class I have a method setStockValue that looks like this

+ Show Spoiler +
public void setStockValue(int price) {

this.price = price;
}


I assume that by changing the price in the Stock class, I am changing it permanently. But I can't think of another way to do it.

A small tip unrelated to your question:
+ Show Spoiler +

If your function sets the price, then name it setPrice.
If the price is actually the stock value, then rename that variable to stockValue or something similar.

Having a function called setStockValue that doesn't modify anything called stockValue is quite confusing


As for your problem, feel free to post more of your code. Where are you creating your stocks? When are you running your for-loop?


I disagree. Programs should model the Business Rules, in this case it is more correct this way.

In the future the prices may change but the stock values may be slightly different (or vice-versa), but in the end we want the list of stock prices not values (or vice-versa). However stock price may mostly rely on the value given, so the stock price right now would be the value of the stock, but maybe not later.

From a maintenance and design perspective the way he has done it is actually better. Although there still could be some improvement, so it is not as side-effect prone.

Be careful not to carpet bomb your's and other's code with conventions purely for the sake of convention. Every convention has a context, be aware of the context, in many contexts you would be correct, but not in this one. I see it all the time in this thread.

When you model the business rules with your logic, the code is much easier to maintain, than faux clean code because you followed all the conventions. The latter will cause all sorts of headaches for you when your client decides he wants some "simple changes". When your code aligns with the business rules, the clients suggestions become much simpler to understand and implement.


I think you're over thinking this a bit. While I agree that convention for the sake of convention is a bad thing, we all had to start somewhere and learn. I'm guessing the guy who posted his code can't be more than a year (maybe two) into his development experience. You have to understand the conventions first to be able to make informed decisions about breaking them or when to use them.

The original post of his shows that he had the method named setStockValue(int price) that was setting the price, but then a getStockValue() that was returning amount * price.

If I'm a developer working on this code, I'm going to be confused as hell when I see a domain object that has a matching getter/setter that doesn't return the same value with the getter after I call the setter. That isn't encapsulating business logic, it's some guy learning how to program.

The changed version that he posted later on with a setStockPrice(int price) and getStockValue() { return amount * price } makes a lot more sense.
Rannasha
Profile Blog Joined August 2010
Netherlands2398 Posts
February 05 2014 16:39 GMT
#8745
On February 05 2014 20:16 berated- wrote:
Show nested quote +
On February 05 2014 16:14 icystorage wrote:
in the future, what do you guys think of a stay-home programmer dad? like just do freelance or similar-work in the house?


As a dad, I'm thinking this is pretty much the most miserable thing I can think of. It might be possible once your kids are grown, but when you are taking care of your kid you don't have the attention to be able to focus on your programming -- and I only have one.

So I think to pull this off your day would look something like, get up at like 5 am and work until the kid gets up. Then wait until your kid goes to bed and then put in the rest of your day. You might be able to get an hour or two in when they are napping, assuming there isn't any work to do around the house since you're the stay at home parent. Maybe you could have your wife watch the kid when she gets off work, but then when are you going to spend any time with her? So now you're working (yes taking care of the kid is work) like 15 hour days, if your wife only works 8 hours and you only work 8 hours. You could work on the weekend, but now you're working weekends.

This does assume that you want to progress in your career, and not just pick up an odd job to make a few bucks here or there. Hopefully you find a sugar momma or don't really mind living week to week.

Put the kid in daycare for a half day, get a nanny, or just be a stay at home dad.

If you have kids already, then you're insane, if you don't have kids already, please come back in the future and let us know how crazy you were


I fully agree with this.

I'm a stay-at-home-dad at the moment (1yr old daughter) and I like to do hobby-programming in my free time, but between taking care of my daughter and doing general household chores there is very little time for focussed work. My kid sleeps 3-4 hours during the day in 1-2 naps, which allow for some time, but other than that it's only after she's gone to bed for the night. Sure there are plenty of moments while she's awake where she's playing on her own and I can get some time on the computer, but these are highly irregular and you don't really have time to properly focus on a project.

I like being a stay-at-home-dad (for now at least). I like working on software development related things. I'd go crazy if I tried both at the same time.
Such flammable little insects!
supereddie
Profile Joined March 2011
Netherlands151 Posts
February 05 2014 18:24 GMT
#8746
I want to create a new website with Java. When I was messing around a bit with Java in 2008 it was with JSP and JPA and trying to use MVC. What technologies and/or frameworks are hip nowadays? And where can I find some tutorials? I read something about JSF being the 'successor' of JSP, but are there other/better things out there? I also read something about AOP. Is that useful for a fairly simple website?

(I have 10+ years experience in C# ASP.Net programming and would like to try Java. And I don't care about PHP/Ruby/Python/Perl/everythingelsenotJava).
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
February 05 2014 18:38 GMT
#8747
On February 06 2014 03:24 supereddie wrote:
I want to create a new website with Java. When I was messing around a bit with Java in 2008 it was with JSP and JPA and trying to use MVC. What technologies and/or frameworks are hip nowadays? And where can I find some tutorials? I read something about JSF being the 'successor' of JSP, but are there other/better things out there? I also read something about AOP. Is that useful for a fairly simple website?

(I have 10+ years experience in C# ASP.Net programming and would like to try Java. And I don't care about PHP/Ruby/Python/Perl/everythingelsenotJava).

I wasn't aware Java programming was a thing until a few weeks ago. Google hasn't been too helpful but I hear Amazon's website runs on Java backend. Can anyone add details about this?
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
February 05 2014 19:01 GMT
#8748
On February 06 2014 03:24 supereddie wrote:
I want to create a new website with Java. When I was messing around a bit with Java in 2008 it was with JSP and JPA and trying to use MVC. What technologies and/or frameworks are hip nowadays? And where can I find some tutorials? I read something about JSF being the 'successor' of JSP, but are there other/better things out there? I also read something about AOP. Is that useful for a fairly simple website?

(I have 10+ years experience in C# ASP.Net programming and would like to try Java. And I don't care about PHP/Ruby/Python/Perl/everythingelsenotJava).

JSF is pretty much the MVC of Java server backends. JSF is the MVC server framework, which uses Facelets for views, but you can also use JSP for views if you want (it's a much older technology though). JSF is probably the way to go.
Isualin
Profile Joined March 2011
Germany1903 Posts
February 05 2014 19:57 GMT
#8749
We are using java backend at where i work. We use eclipse with maven and SVN for development, spring framework for backing beans, spring data with mongodb for our data, solr for indexing, spring security for our security/roles/acl, jsf/primefaces for our webpages and tomcat server to deploy the project. It works nice, but i don't have much experience with other stuff so i can't compare. For simple stuff, mkyong and krams915 has a lot of tutorials and spring has good documentation
| INnoVation | The literal god TY | ByuNjwa | LRSL when? |
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
February 05 2014 20:08 GMT
#8750
On February 05 2014 21:10 berated- wrote:
Show nested quote +
On February 05 2014 14:14 sluggaslamoo wrote:
On February 05 2014 05:03 Vorenius wrote:
On February 05 2014 03:40 Animzor wrote:
On February 05 2014 03:21 ThatGuy wrote:
Of course, there could be a ton of other things happening here. Maybe you don't set the stock value on a newly created stock. Maybe you're using a copy constructor and another Stock with an empty Stock value. You'll either need to debug deeper or be more open with the question to actually isolate whether that block of code is indeed causing your issues.


Sorry, I didn't want to be an asshole and post too much code. Anyway, what I have is a Person class and a Stock class. Every Person includes an arraylist which can contain a bunch of items, like Stock. In the Stock class I have a method setStockValue that looks like this

+ Show Spoiler +
public void setStockValue(int price) {

this.price = price;
}


I assume that by changing the price in the Stock class, I am changing it permanently. But I can't think of another way to do it.

A small tip unrelated to your question:
+ Show Spoiler +

If your function sets the price, then name it setPrice.
If the price is actually the stock value, then rename that variable to stockValue or something similar.

Having a function called setStockValue that doesn't modify anything called stockValue is quite confusing


As for your problem, feel free to post more of your code. Where are you creating your stocks? When are you running your for-loop?


I disagree. Programs should model the Business Rules, in this case it is more correct this way.

In the future the prices may change but the stock values may be slightly different (or vice-versa), but in the end we want the list of stock prices not values (or vice-versa). However stock price may mostly rely on the value given, so the stock price right now would be the value of the stock, but maybe not later.

From a maintenance and design perspective the way he has done it is actually better. Although there still could be some improvement, so it is not as side-effect prone.

Be careful not to carpet bomb your's and other's code with conventions purely for the sake of convention. Every convention has a context, be aware of the context, in many contexts you would be correct, but not in this one. I see it all the time in this thread.

When you model the business rules with your logic, the code is much easier to maintain, than faux clean code because you followed all the conventions. The latter will cause all sorts of headaches for you when your client decides he wants some "simple changes". When your code aligns with the business rules, the clients suggestions become much simpler to understand and implement.


I think you're over thinking this a bit. While I agree that convention for the sake of convention is a bad thing, we all had to start somewhere and learn. I'm guessing the guy who posted his code can't be more than a year (maybe two) into his development experience. You have to understand the conventions first to be able to make informed decisions about breaking them or when to use them.

The original post of his shows that he had the method named setStockValue(int price) that was setting the price, but then a getStockValue() that was returning amount * price.

If I'm a developer working on this code, I'm going to be confused as hell when I see a domain object that has a matching getter/setter that doesn't return the same value with the getter after I call the setter. That isn't encapsulating business logic, it's some guy learning how to program.

The changed version that he posted later on with a setStockPrice(int price) and getStockValue() { return amount * price } makes a lot more sense.


You're right. I guess because I was replying to your reply I didn't know the context.
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
February 05 2014 20:25 GMT
#8751
On February 06 2014 03:24 supereddie wrote:
I want to create a new website with Java. When I was messing around a bit with Java in 2008 it was with JSP and JPA and trying to use MVC. What technologies and/or frameworks are hip nowadays? And where can I find some tutorials? I read something about JSF being the 'successor' of JSP, but are there other/better things out there? I also read something about AOP. Is that useful for a fairly simple website?

(I have 10+ years experience in C# ASP.Net programming and would like to try Java. And I don't care about PHP/Ruby/Python/Perl/everythingelsenotJava).


I can't really compare with other frameworks but this is a thing: http://www.playframework.com/

I've only worked with it in Scala though and that worked out somewhat ok.
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
February 05 2014 23:54 GMT
#8752
@the dad replies

what if the kids are at school? like going to elementary or highschool? that gives you more time to work at home right?
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
berated-
Profile Blog Joined February 2007
United States1134 Posts
February 06 2014 02:14 GMT
#8753
On February 06 2014 08:54 icystorage wrote:
@the dad replies

what if the kids are at school? like going to elementary or highschool? that gives you more time to work at home right?


sure it makes it much more feasible, but for me personally I need the office time. I enjoy human interaction. I find working from home I'm able to rationalize why I need a break much more often. others thrive I guess, it's just not for me.

I think when you work in the office you're more likely to separate work life and home life. you're able to give work all you have when you're there and all to your family when you're home. when I work from home I always feel like I have something to do for both sides so I'm not really giving my full attention to either.
Sub40APM
Profile Joined August 2010
6336 Posts
Last Edited: 2014-02-07 03:30:12
February 07 2014 03:22 GMT
#8754
Hey guys: I am trying to do a quick analysis in pandas. Its that Kaggle question, how to predict if you live or die in the Titanic sinking.
So here are the steps I took:
import data into a data frame
scan data frame for gender and class
if gender is female and class is 1 and 2, survived
if gender is female and class is 3, 50/50 chance using randomint to see if you survive or not
if male, dead.

survived/dead is 1/0. Prior to the scan I create an empty dictionary, the key is each individual's Id and the value is the 1/0 that I add in after the scan through.
Seems reasonable?
wozzot
Profile Joined July 2012
United States1227 Posts
February 07 2014 09:32 GMT
#8755
Did a quick implementation of merge sort in Perl, it sometimes works but bugs out unpredictably, randomly merging the subarrays into two sorted mini-lists instead of one continuous list and adding superfluous elements. I know that it only happens when $index1 overflows past $mid+1, but I'm not sure what in turn causes that or how to fix it. Any ideas?

+ Show Spoiler +

#!perl

use strict;

sub mergesort {
# Pointer to main array, pointer to work array, start index, ending index
my ($array, $work_array, $start, $end) = @_;
die "Error: need array and work_array as arguments\n" unless @_ >= 2;

($start, $end) = (0, $#$array) if !defined($start) or !defined($end);

if ($end - $start > 0) {

my $mid = int(($start + $end) / 2);

&mergesort($array, $work_array, $start, $mid);
&mergesort($array, $work_array, $mid+1, $end);

my ($index1, $index2, $indexm) = ($start, $mid+1, 0);

while ($index1 <= $mid or $index2 <= $end) {

if ($index2 > $end or $$array[$index1] < $$array[$index2]) {
$$work_array[$indexm] = $$array[$index1];
++$index1;

} elsif ($index1 > $mid or $$array[$index1] >= $$array[$index2]) {
$$work_array[$indexm] = $$array[$index2];
++$index2;

} else { die "Error\n"; }

++$indexm;
}

$$array[$start+$_] = $$work_array[$_] for (0..$indexm-1);

}
}

my @array1 = ();
my @array2 = ();
push @array1, int rand(100) - 3 for 1..10;

print "Pre-sort:\n@array1\n";
mergesort(\@array1, \@array2);
print "Final results:\n@array1";
(ノ´∀`*)ノ ♪ ♫ ヽ(´ー`)ノ ♪ ♫ (✌゚∀゚)☞ ♪ ♫ ヽ(´ー`)ノ ♫ ♫ (ノ´_ゝ`)ノ彡 ┻━┻
Manit0u
Profile Blog Joined August 2004
Poland17493 Posts
Last Edited: 2014-02-07 13:31:00
February 07 2014 13:21 GMT
#8756
On February 07 2014 12:22 Sub40APM wrote:
Hey guys: I am trying to do a quick analysis in pandas. Its that Kaggle question, how to predict if you live or die in the Titanic sinking.
So here are the steps I took:
import data into a data frame
scan data frame for gender and class
if gender is female and class is 1 and 2, survived
if gender is female and class is 3, 50/50 chance using randomint to see if you survive or not
if male, dead.

survived/dead is 1/0. Prior to the scan I create an empty dictionary, the key is each individual's Id and the value is the 1/0 that I add in after the scan through.
Seems reasonable?


Seems fine. Although I'd possibly add more randomness to it by shuffling the array before selecting a random entry from it (to simulate the chaos of people rushing to the lifeboats while being at different locations of the ship).

Just one more easy step and it adds a whole new dimension:


srand((unsigned int) time(0)); // generate random seed

mixed arr[] = { stuff, goes, here, ... };
int n = sizeof(arr);

for (int i = 0; i < n; i += 1)
{
int s = random(n);
mixed tmp = arr[i];

arr[i] = arr[s];
arr[s] = tmp;
}
Time is precious. Waste it wisely.
Zocat
Profile Joined April 2010
Germany2229 Posts
Last Edited: 2014-02-07 14:08:13
February 07 2014 14:07 GMT
#8757
On February 07 2014 22:21 Manit0u wrote:
Show nested quote +
On February 07 2014 12:22 Sub40APM wrote:
Hey guys: I am trying to do a quick analysis in pandas. Its that Kaggle question, how to predict if you live or die in the Titanic sinking.
So here are the steps I took:
import data into a data frame
scan data frame for gender and class
if gender is female and class is 1 and 2, survived
if gender is female and class is 3, 50/50 chance using randomint to see if you survive or not
if male, dead.

survived/dead is 1/0. Prior to the scan I create an empty dictionary, the key is each individual's Id and the value is the 1/0 that I add in after the scan through.
Seems reasonable?


Seems fine. Although I'd possibly add more randomness to it by shuffling the array before selecting a random entry from it (to simulate the chaos of people rushing to the lifeboats while being at different locations of the ship).+ Show Spoiler +


Just one more easy step and it adds a whole new dimension:


srand((unsigned int) time(0)); // generate random seed

mixed arr[] = { stuff, goes, here, ... };
int n = sizeof(arr);

for (int i = 0; i < n; i += 1)
{
int s = random(n);
mixed tmp = arr[i];

arr[i] = arr[s];
arr[s] = tmp;
}


Can you explain that?
Assuming an uniform distribution (off the PRNG) shuffling the array before selecting a random entry shouldn't add any randomness.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
February 07 2014 17:34 GMT
#8758
On February 05 2014 11:37 WarSame wrote:
On Ubuntu one of the recent updates apparently messed up gcc(or I may have messed it up when I was trying to get an old version of gcc for something that required it). I am trying to compile and link together a skeleton assembly file. I can compile all the files with gcc no problem. However, when I go to link them together into an executable it complains that it "Cannot find crt1.o". Looking online suggests that this was moved in a recent update, and gcc doesn't know where it is.

The 2 suggestions I saw were this workaround which doesn't work for me and this one which I don't trust.

So I would like some advice on how to handle this. So far I have tried the first workaround, and have also tried reinstalling gcc(which states all 11 were unchanged) using the command sudo apt-get install gcc. If anyone can give me advice on what else would be worth trying I would appreciate it. Alternatively, I may move to using g++ in order to compile/link the files, but this is partly for an assignment due in a week so I'd rather not have to do that. Thank you for reading.

A classmate told me about this fix: use sudo apt-get install gcc-multilib.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
BisuDagger
Profile Blog Joined October 2009
Bisutopia19299 Posts
February 07 2014 17:39 GMT
#8759
Every time I see this thread title I think we should put a project on SVN and give everyone access. Then we can all just jump in and add to the game whenever we have free time. C++ of course (my preference) and built from the ground up. I'd totally put together a frame for a game to jump start this.
ModeratorFormer Afreeca Starleague Caster: http://afreeca.tv/ASL2ENG2
nunez
Profile Blog Joined February 2011
Norway4003 Posts
February 07 2014 17:44 GMT
#8760
it's in glibc i think warsame.
conspired against by a confederacy of dunces.
Prev 1 436 437 438 439 440 1032 Next
Please log in or register to reply.
Live Events Refresh
Wardi Open
12:00
Qualifier #4
WardiTV908
TKL 198
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Reynor 389
TKL 198
ProTech124
StarCraft: Brood War
Calm 5190
Horang2 2160
Shuttle 2115
Jaedong 1125
actioN 782
Mini 736
Mong 442
EffOrt 435
ZerO 385
Light 339
[ Show more ]
Hyun 239
Snow 192
Rush 165
Last 141
hero 83
Sharp 61
JYJ54
sorry 33
yabsab 31
Icarus 29
ToSsGirL 29
Aegong 24
scan(afreeca) 17
Terrorterran 16
soO 8
Hm[arnc] 5
Rock 3
Dota 2
Gorgc3045
singsing2546
qojqva1815
Dendi413
boxi98115
syndereN22
Counter-Strike
x6flipin781
allub280
oskar174
Other Games
olofmeister1167
B2W.Neo1109
hiko591
Fuzer 270
Hui .233
XaKoH 218
QueenE72
nookyyy 37
ZerO(Twitch)17
Organizations
StarCraft: Brood War
lovetv 11
Kim Chul Min (afreeca) 2
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 82
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 3867
• WagamamaTV372
League of Legends
• TFBlade705
Upcoming Events
StarCraft2.fi
2h 40m
Replay Cast
9h 40m
The PondCast
19h 40m
OSC
1d 1h
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 9h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
[ Show More ]
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
WardiTV 2025
3 days
OSC
4 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
5 days
Monday Night Weeklies
5 days
Replay Cast
5 days
WardiTV 2025
5 days
StarCraft2.fi
6 days
PiGosaur Monday
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.