Open Side Menu Go to the Top

06-22-2012 , 05:08 PM
question. when i use urllib2 and beautifulsoup i keep getting unicode from the website. do i want unicode or ascii does it matter?
** 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 **
06-22-2012 , 05:48 PM
wowthis is really annoying. trying to use beautifulsoup to get info from a page, each game is organized like this:

<span id='info'></span><div> SOME INFO ON GAME</div><div> SOME INFO ON GAME</div>
<span id='info'></span><div> SOME INFO ON GAME2</div><div> SOME INFO ON GAME2</div>


so an entire game is not actually enclosed by a single span or div tag. wtf
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 08:28 PM
All,
This is my favorite thread on 2+2. Keep up the good posting.

unlucky,
So you haven't figured out how to use the data you have for the NFL and yet you're already moving on to NCAAF? Good luck, Grasshopper.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:18 PM
n00b they are both football so i can use them both. how do you calculate the 1st q derivative ? i am gotten stuck on that a bit.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:23 PM
I'm really stuck and irritated.

The idea is to do this:

Quote:
lein plugin install lein-noir 1.2.1
lein noir new my-website
cd my-website
lein run
The last step is mystifying me. I can't figure out how to get the path set for "lein"

Yeah, I changed the path variables and that didn't work out.

Command line stuff:

Code:
>cd c:\lein

c:\lein>lein
Leiningen is a build tool for Clojure.

Several tasks are available:
classpath   Show the classpath of the current project.
clean       Remove compiled artifacts and jars from project.
compile     Compile Clojure source into .class files.
deps        Download all dependencies and place them in the :library-path.
help        Display a list of tasks or help for a given task.
install     Install the current project or download the project specified.
interactive Enter interactive shell for calling tasks without relaunching JVM.
jar         Package up all the project's files into a jar file.
javac       Compile Java source files.
new         Create a new project skeleton.
noir
plugin      Manage user-level plugins.
pom         Write a pom.xml file to disk for Maven interop.
repl        Start a repl session either with the current project or standalone.
run         Run a -main function with optional command-line arguments.
test        Run the project's tests.
test!       Run a project's tests after cleaning and fetching dependencies.
uberjar     Package up all the project's files and dependencies into a jar file.

upgrade     Upgrade Leiningen to the latest stable release.
version     Print version for Leiningen and the current JVM.

Run lein help $TASK for details.
Also available: readme, tutorial, copying, and news.

c:\lein>cd c:\lein\lein
The system cannot find the path specified.

c:\lein>dir
 Volume in drive C has no label.
 Volume Serial Number is 583D-93F4

 Directory of c:\lein

06/22/2012  06:16 PM    <DIR>          .
06/22/2012  06:16 PM    <DIR>          ..
06/22/2012  02:43 PM             4,710 lein.bat
06/22/2012  04:13 PM         6,953,831 leiningen-1.4.1-standalone.jar
06/22/2012  06:16 PM    <DIR>          my-website
06/22/2012  02:43 PM           401,408 wget.exe
               3 File(s)      7,359,949 bytes
               3 Dir(s)  411,775,848,448 bytes free

c:\lein>cd c:\lein\lein.bat
The directory name is invalid.

c:\lein>cd c:\lein\leiningen-1.4.1-standalone.jar
The directory name is invalid.

c:\lein>cd c:\lein\leiningen-1.4.1-standalone
The system cannot find the path specified.

c:\lein>cd c:\lein\wget.exe
The directory name is invalid.

c:\lein>cd c:\lein\wget
The system cannot find the path specified.

c:\lein>
What the hell am I supposed to do? And how is anyone supposed to use [favorite search engine] to figure this out?

How do I get lien to work just like java does here:

Quote:
java -cp clojure-1.4.0.jar clojure.main
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:26 PM
Quote:
Originally Posted by n00b590
All,
This is my favorite thread on 2+2. Keep up the good posting.

unlucky,
So you haven't figured out how to use the data you have for the NFL and yet you're already moving on to NCAAF? Good luck, Grasshopper.
Well he went quickly beyond identifying fundamental market inefficiencies to move on straight to creating his own model from scratch, so yeah.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:32 PM
Quote:
Originally Posted by Neil S
Well he went quickly beyond identifying fundamental market inefficiencies to move on straight to creating his own model from scratch, so yeah.
sorry neil i dont understnad what do youmean
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:33 PM
Quote:
Originally Posted by unluckyboy
sorry neil i dont understnad what do youmean
You were getting hints over in SB about things you can do that don't require massive data mining and statistical analysis.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:35 PM
neil that stuff is boring i am not some clown steam chaser i will be a pro betting derivatives
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:44 PM
notsureifsrs.jpg
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 09:45 PM
Quote:
Originally Posted by unluckyboy
neil that stuff is boring i am not some clown steam chaser i will be a pro betting derivatives
That's kinda like saying you're going to play poker without caring about concepts like pot odds and table selection.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-22-2012 , 11:59 PM
Quote:
Originally Posted by daveT
I'm really stuck and irritated.
I figured it out:

>>>>> lein deps

Which imports the lein dependencies into the folder.

Then you head on over to localhost8080 and find a page that says "Noir is up and running... time to start building some websites!"

Except you would have absolutely no idea where that came from because it has zero connection to anything you have written.

Then it says "click here and see you site!" and that finally gives a little hint.

Feels like I'm dealing with David Bowie in the Labyrinth.

Actually, when I think about it, this makes perfect sense, except that the file I need to modify is at c:\lien\my-website\src\my-website\views\welcome.clj

I think that's how it works so far.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 03:20 AM
Okay, now I'm getting tired of this.

So, two issues seem to creep up.

1- Apparently some other program likes to listen in on port 8080, which is easy enough to fix.

2- Error: java.io.FileNotFoundException: C:\lein\my-website\resources\public (Access is de
nied)


Quote:
c:\lein\my-website>lein run
Warning: *classpath* not declared dynamic and thus is not dynamically rebindable
, but its name suggests otherwise. Please either indicate ^:dynamic *classpath*
or change the name.
Starting server...
2012-06-23 00:20:33.291:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2012-06-23 00:20:33.307:INFO::jetty-6.1.25
2012-06-23 00:20:33.400:INFO::Started [email protected]:8778
Server started on port [8778].
You can view the site at http://localhost:8778
#<Server Server@6bedd91b>
2012-06-23 00:21:01.905:WARN::/
java.io.FileNotFoundException: C:\lein\my-website\resources\public (Access is de
nied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.jav a:138)
at ring.util.servlet$set_body.invoke(servlet.clj:96)
at ring.util.servlet$update_servlet_response.invoke(s ervlet.clj:124)
at ring.adapter.jetty$proxy_handler$fn__707.invoke(je tty.clj:18)
at ring.adapter.jetty.proxy$org.mortbay.jetty.handler .AbstractHandler$0.
handle(Unknown Source)
at org.mortbay.jetty.handler.HandlerWrapper.handle(Ha ndlerWrapper.java:1
52)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(Htt pConnection.java:54
2)
at org.mortbay.jetty.HttpConnection$RequestHandler.he aderComplete(HttpCo
nnection.java:926)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser. java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpPa rser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnec tion.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.r un(SocketConnector.
java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run (QueuedThreadPool.j
ava:582)
I can't find anything useful on this issue. I've been searching for hours on this one.

The only thing that caused all of this to start is changing or adding files to the file system (not hacking core). If I do the default installation, everything works fine, but go through what the site says to do, and the whole thing bugs out and throws errors.

I though the drupal documentation and "how to" was bad when I first started using it: Noir / Clojure is specifically made to crush your soul and make you quit.

Last edited by daveT; 06-23-2012 at 03:22 AM. Reason: guess this will be my first post on SO. :(
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 03:53 AM
damn that was a grind. done.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 05:51 AM
Okay, figured that one out, and of course it was my fault. I sort of rushed through the initial starter tutorial and was deleting the boiler-plate-shoe-string-reactive-clj-boot-gem-strap-off-include line of code that kind of makes everything function correctly.

Now it works as planned and is a pure joy to work with. The lesson is once again re-learned until next time. Of course, the default boiler-- is not always correct, so with every step there is some work to do as far as looking through the include files and other stuff to make sure there's nothing amiss. Zero room for errors at all in this program.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 07:19 AM
daveT using this thread as a rubber duck like a pro
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 10:39 AM
Rubber Ducking FTW!!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 02:27 PM
Quote:
Hello Ryan,
By the sounds of it we'd love to have you on the team!
And we've taking it out of open source and are only using Codeplex to find developers!
Is this a no-go then for the perks you guys have been talking about of working on an open source project? (bump)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 09:23 PM
The implications of this toy programming is mind-blowing:


Code:
(ns webby.views.welcome
  (:require [webby.views.common :as common])
  
  (:use [noir.core :only [defpage]]
        [hiccup.core]
		[hiccup.form-helpers]))

(defpage "/:page" {:keys [page]}
         (common/layout
           [:h1 "Hello!"]
		   [:p "you are on page " page]
		   [:p "see ya!"]))
			   
(def page {:1 1 :2 2 :3 3})
The output is:

go to this page: http://localhost:8080/1

and see:

Quote:
Hello!
you are on page 1
see ya!
then go to this page: http://localhost:8080/2

and see:

Quote:
Hello!
you are on page 2
see ya!
then go to this page: http://localhost:8080/3

and see:

Quote:
Hello!
you are on page 3
see ya!
Not sure how special this is. This must be available for PHP, Ruby, etc..?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 09:59 PM
Programmatic routing is nifty the first time you run into it in any language, yes!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2012 , 10:34 PM
Thread idea: post random, helpful code snippets that could be of use to others.

Any interest?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2012 , 12:22 AM
I have an idea for an app that I want to build. The first thing I need is a database of sports teams, rosters, and (if possible) player salaries. Preferably this would be pulled from some kind of api so I wouldn't need to manually keep the database up to date. Is this kind of data expensive? Has anyone used the ESPN api?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2012 , 12:40 AM
Quote:
Originally Posted by splashpot
I have an idea for an app that I want to build. The first thing I need is a database of sports teams, rosters, and (if possible) player salaries. Preferably this would be pulled from some kind of api so I wouldn't need to manually keep the database up to date. Is this kind of data expensive? Has anyone used the ESPN api?
There might be better ways, but you can get this data for free from Wikipedia if you're willing to work for it a bit.

Basically:

1) Download all of wikipedia for free as an xml file (http://en.wikipedia.org/wiki/Wikiped...abase_download)
2) Look through wiki pages of various teams to see where the data you need is and how it's formatted.
3) Use a fast xml library (I used Python lxml) to dig through the data. It should take hours--not minutes or days--to go through all of Wikipedia.
4) Find all the annoying special cases where formatting is slightly different and fix it.

I dunno if that's really suitable for your project--depends on how the data is on Wikipedia and how accurate you need to be--but thought I'd share because I did the same for a few fun projects. And, obviously, if you're going to be using this to make money you should read their license first.

Edit: After writing this up I realized it probably doesn't fit that well. But, whatever, I'll leave it up because a lot of people don't know that you can easily mine data from Wikipedia, and that's really cool.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2012 , 01:09 AM
While definitely cool, downloading all of wikipedia is a bit overkill for my purposes I think.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2012 , 01:14 AM
lol, yeah.
** 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