Open Side Menu Go to the Top

05-05-2013 , 11:07 PM
Quote:
Originally Posted by Slick Strawberry
I've taught myself a reasonable amount of python with online resources, mostly starting out with the google classes and codeacademy, and that went pretty well so that I can do some simple scripting to make parts of my job easier.

However, now I'm going to have to get acquainted with R for my job as that's what a lot of bioinformatics uses, but I can't find any ready to go resources like codeacademy for it. Am I missing something, or does someone know of a good learning tool?
What's wrong with the manuals on the R website?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
05-05-2013 , 11:46 PM
Quote:
Originally Posted by Slick Strawberry
I've taught myself a reasonable amount of python with online resources, mostly starting out with the google classes and codeacademy, and that went pretty well so that I can do some simple scripting to make parts of my job easier.

However, now I'm going to have to get acquainted with R for my job as that's what a lot of bioinformatics uses, but I can't find any ready to go resources like codeacademy for it. Am I missing something, or does someone know of a good learning tool?
As to R: I've done a fair bit of reading (and coding) in the space.

I recommend:

-Building Bioinformatics Solutions (the R chapter is a very good intro)

-Rob J. Hyndman's time series library(intro at):

-http://www.youtube.com/watch?v=1Lh1HlBUf8k&list=FLwV3flruoH44Vy5cZi_aWLA& index=7

-How to use R for sentiment analysis at:

http://www.inside-r.org/howto/mining...umer-sentiment

-R in a Nutshell by Joseph Adler (Adler is a Data Scientist for Linkedin)

-The Art of R Programming by Norman Matloff (considered the go-to for advanced R)

-Visualize This by Nathan Yau (large sections of the book use R for visualization)

Some sections you can find for free at Nathan Yau's blog http://flowingdata.com/

There isn't a centralized place I've found either for R. I was considering writing a series this year, but I'm not using it as much as I was before (using more python and java than R), but that's likely to change in the next few weeks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 06:43 AM
I've been looking at some of the + and - of HTML5, and came across this site whilst looking into WebAudio. It's fun especially if you like music. However, it's using a specific set of HTML5 tags, and I think the only browser it works on is Chrome (didn't work on IE - no surpise, but also didn't work in firefox, which did surprise me).

It's called ToneMatrix
http://carlbarrdahl.se/tm/


It really is fun. I'm just peeved my soundcard doesn't allow recording of system sounds as I can use it in mah podcasting to make some reasonable ambient background I think.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 07:41 AM
Quote:
Originally Posted by daveT
I'm not entirely sure what it is you are attempting, but I would think that you could create a better schema:

Suppose you start with:

AssignmentGrades:

Student_ID; Assignement_ID; Grade

Then you have a table that totals up the grades:

ClassGrades

Student_ID; Grade

Now you can insert into AssignmentGrades, then after insertion, update the grades on the ClassGrades table. You would be able to update ClassGrades with an avg() function and you can place a foreign-key constraint on ClassGrades or whatever. I'm not entirely sure what your project entails, but it looks like you are trying to do way too much on way too few tables, thus you ought to reconsider your design.
I'm on my phone and don't have a ton of time (always a recipe for a quality post...) but I suspect you should just drop the class grade table. Just calculate it every time from the assignments. Potentially you could have a class grade table that records the grade given to the student if that was necessary.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 07:56 AM
Quote:
Originally Posted by jjshabado
I'm on my phone and don't have a ton of time (always a recipe for a quality post...) but I suspect you should just drop the class grade table. Just calculate it every time from the assignments. Potentially you could have a class grade table that records the grade given to the student if that was necessary.
+1

especially since the calculation of overall class grade from individual grades is a piece of business logic that is likely to change. the only reason to precalculate it and save it in its own table would be for performance, like if you had an online class with a hundred thousand students or something. but in a typical teaching scenario this wouldn't apply.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 08:16 AM
I agree with both of you.

I don't know what he is ultimately attempting to accomplish, but doing in-place updates like what he appears to be attempting didn't seem like a good idea to me.

Yes, it would be much better, no matter what format he wishes to extract and present information from the table, to just run a query on the grades table and extract the results that way. Much less likely to blow up and its far more flexible.

Thanks for setting the record straight on that.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 09:56 AM
Quote:
Originally Posted by diebitter
I've been looking at some of the + and - of HTML5, and came across this site whilst looking into WebAudio. It's fun especially if you like music. However, it's using a specific set of HTML5 tags, and I think the only browser it works on is Chrome (didn't work on IE - no surpise, but also didn't work in firefox, which did surprise me).

It's called ToneMatrix
http://carlbarrdahl.se/tm/


It really is fun. I'm just peeved my soundcard doesn't allow recording of system sounds as I can use it in mah podcasting to make some reasonable ambient background I think.
Using this as an excuse to post this again: http://www.youtube.com/watch?v=HvF8Hpx9YYk
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 09:59 AM
Quote:
Originally Posted by Urinal Mint
What sort of scripting have you done to make your job easier? I'm interested in automating some repetitive desktop tasks, such as reading and typing into other programs, but am not sure how to go about doing it.
I generate a lot of data that's very similar, and needs to be parsed in someway so I can analyze it and make it human-readable. It's all fairly simple stuff, but it makes my job less tedious.

Any time I was doing something repetitive for the third of fourth time that seemed scriptable, I just tried writing something for it. Usually it wasn't really worth the time investment until far down the road, but it's much more fun and it helped me learning about python.

Quote:
Originally Posted by daveT
What's wrong with the manuals on the R website?
Probably nothing, but it's not the best way for me to learn. I really like the interactive way of codeacademy. And especially since what I need to do in R for my job is going to be fairly hard it would be nice to have some exercises to work on that are somewhat easier until I can try to tackle that.

Quote:
Originally Posted by LA_Price
As to R: I've done a fair bit of reading (and coding) in the space.

... resources ...
Thank you, I will check those out.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 10:12 AM
Quote:
Originally Posted by NoahSD
Using this as an excuse to post this again: http://www.youtube.com/watch?v=HvF8Hpx9YYk
hah, am I the only person to not heard of this already?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 12:32 PM
S. Strawberry, I'd crosspost your request for R learning material on the Probability forum, lots of R experts over there that may be able to help
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 07:22 PM
So we're about to launch our site this week that I've basically built from the ground up in rails over the past 2 months. Should be fun to see it in action... just need to hammer out the weird issues we're having with the production server where some requests are randomly getting throttled and taking a couple of seconds to be served. It's lightning fast otherwise.

We're using heroku with unicorn, pgres, 4 dynos/4 workers. We have new relic pro free for a few months so we're trying to pinpoint exactly what's causing the issue... I want to figure it out before we launch though. Randomly having a minute of 4 second requests is not good.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-06-2013 , 08:41 PM
I need some mega help on a Java programming assignment, it's probably easy enough (Collections) but I've been stuck on question for 4 hours now. Willing to pay for any help cheers.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 06:05 AM
Quote:
Originally Posted by ADK
I need some mega help on a Java programming assignment, it's probably easy enough (Collections) but I've been stuck on question for 4 hours now. Willing to pay for any help cheers.
you are welcome to post things like this as a thread in this forum, include your code in [code] tags and people can help. Or just post the code / problems in this thread.

Good chances someone helped you out by now already, but yeah posting the code you're having trouble with is a good way to get help
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 06:19 AM
Quote:
Originally Posted by Nchabazam
So we're about to launch our site this week that I've basically built from the ground up in rails over the past 2 months. Should be fun to see it in action... just need to hammer out the weird issues we're having with the production server where some requests are randomly getting throttled and taking a couple of seconds to be served. It's lightning fast otherwise.

We're using heroku with unicorn, pgres, 4 dynos/4 workers. We have new relic pro free for a few months so we're trying to pinpoint exactly what's causing the issue... I want to figure it out before we launch though. Randomly having a minute of 4 second requests is not good.
Good luck

Startup type of business?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 06:47 AM
Cool.

Basically in Java I need to implement a class that has a zero-argument constructor that initialises an empty collection.
This empty collection needs to be suitable for holding data such as a specific word and what pages they occur on (index of a book basically).

It has to make use of atleast 2 collections.

So here I make use of 2 collections, which will store the words as String followed by the page numbers as a Set of integers, and initialise it to be empty in the constructor.
Code:
// instance variables 
public Map<String, Set<Integer>> bookMap;

//Constructor
public BookIndex()
{
    this.bookMap = new TreeMap<String, Set<Integer>>();
    Set<Integer> pageNumbers = new TreeSet<>();
    bookMap.put("", pageNumbers);
}

The problem is when I try to make a new method addData() it doesn't work at runtime.

Code:
public void addData(String aWord, Integer aPage)
  {
       
       pageNumbers.add(aPage);
       bookMap.put(aWord,pageNumbers);
        
}
I am trying to pass the formal arguments from the addData method to the Set referenced by pageNumbers, and then adding this and the string to the Map.
Can't figure out what I am doing wrong here! I've tried about 5 other ways and I get some sort of error everytime.

Any help appreciated!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:00 AM
The problem is that your "pageNumbers" variable in addData doesn't refer to anything. In your constructor you initialize the bookMap object as an instance variable (so available in all of your instance methods) but you don't do the same thing with the pageNumbers variable.

Now, you actually probably don't want to make pageNumbers an instance variable but you need to think through how you plan on adding data. Start with thinking about what you'd do the first time you see a new word.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:02 AM
Shouldn't you see if there is already an entry in bookMap for aWord?

If there is an entry for aWord: add aPage to the entries existing set of integers (might have to check for dupes here too depending how Set<Integer> feels about such things). You would not do bookMap.put in this case.

If there is not an entry for aWord: create a new Set<Integer> and initialize it with aPage. Then add aWord and the new Set<Integer> to bookMap.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:05 AM
@jjshabado
Yeah I did have pageNumbers as an instance variable at the start, but when I created a new instance of the class and inspected it, it didn't look right as the Set wasn't nested within the map.

The only thing I can think of is that I might need an instance variable for the "Words", which I'll try now.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:25 AM
Chips Ahoy is pointing you in the right direction. The only instance variable you need is the map.

It's going to hold all of your set variables.

It's often easiest to do these things in pieces. So start with just trying to figure out what you should do (and making it work) the first time you add a page.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:30 AM
Quote:
Originally Posted by clowntable
Good luck

Startup type of business?
Thanks!

We're building a platform to crowdsource security vulnerability testing in, initially, web applications.

Similar to how google/facebook have programs to disclose vulnerabilities for money (if done responsibly), we're trying to bring that to the masses.

Excited to see it launch.

edit: Also, since I built this site from scratch, and we're going to be our first listing, it'll be funny to see if I screwed up at all. Let's hope not
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:40 AM
Ok thanks guys, heres what I got:

Code:
public void addData(String aWord, Integer aPage)
{
     Set<Integer> pageNumbers = new TreeSet<>(); 
     pageNumbers = bookMap.get(aWord);
     if ( pageNumbers == null )  
        {
          pageNumbers = new TreeSet();
          bookMap.put(aWord, pageNumbers);
         }
     pageNumbers.add(aPage);
        
}
This seems to work (finally) now but the only problem is that the if statement is giving me a compilation warning about unchecked errors.

It's a bit annoying as my text books didn't show me any examples like this but it works. Does it look ok or is there more efficient ways to do this?

Thanks again
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:53 AM
you construct a new TreeSet, put a reference to it in pageNumbers, then you immediately abandon it and replace the value of pageNumbers with whatever bookMap.get returns.

That's not good. It works, but why build something and then immediately throw it in the trash?

bookMap.get will give you a perfectly fine Set. You only need to declare -- not construct -- before the get.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:53 AM
Nice!

You can combine:

Code:
Set<Integer> pageNumbers = new TreeSet<>(); 
pageNumbers = bookMap.get(aWord);
Notice how you're not doing anything with the new TreeSet. You're just throwing it away when you get the value out of bookMap.

The unchecked errors is because you're building a collection without saying what's in it and then assigning it to the Set<Integer> where you're saying it'll only have integers in it. You should tell the compiler that your newly constructed TreeSet will only be containing Integers.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 07:57 AM
Also, while probably not useful for homework, this pattern is super common. So you can make life a bit easier by using: http://google-collections.googlecode...tMultimap.html
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-07-2013 , 08:11 AM
Ahhhh okay I see, makes sense.
I changed it to
Code:
Set<Integer> pageNumbers = bookMap.get(addName);
Quote:
You should tell the compiler that your newly constructed TreeSet will only be containing Integers.
I just tried to do this within the if statement but it didn't work either, am I missing something really obvious?

Thanks for the link I'm going to read up on it now as this textbook uni gave me is useless! lol
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m