Fellow programmers,
I am trying to create a football pool for my friends and me. Now I would like to automate this process, such that I don't want to enter any match statistics and teams. So I found this excellent repository hosted at this github url:
https://github.com/openfootball/build
As indicated in the examples, you need a directory structure like this for building the actual database:
openmundi/ # -> create folder (e.g. mkdir openmundi)
world.db # -> git clone (see github.com/openmundi)
openfootball/ # -> create folder
build # -> git clone
national-teams # ..
world-cup # ..
So I have this directory structure in my application:
public/tmp/openmundi
wordl.db # from https://github.com/openmundi/world.db
public/tmp/openfootball
build # from https://github.com/openfootball/build.git
europe-champions-league # from https://github.com/openfootball/europe-champions-league.git
Now if I go to my build directory situated in public/tmp/openfootball/build, there is a Rakefile which i can run (I only want the Champions League data). So if I do the following in the build directory I'm getting al sorts of errors that the database can't be build:
rake build DATA=cl201314 # is the command I'm running
I can see in the following file what the rake task is doing: public/tmp/openfootball/build/tasks/setups/cl.rake
The contents of the cl.rake are :
################################
# football clubs n leagues
task :cl201314 => :importbuiltin do
SportDb.read_setup( 'setups/teams', CLUBS_INCLUDE_PATH )
SportDb.read_setup( 'setups/teams', AT_INCLUDE_PATH )
SportDb.read_setup( 'setups/teams', DE_INCLUDE_PATH )
SportDb.read_setup( 'setups/teams', EN_INCLUDE_PATH )
SportDb.read_setup( 'setups/teams', ES_INCLUDE_PATH )
SportDb.read_setup( 'setups/teams', IT_INCLUDE_PATH )
SportDb.read_setup( 'setups/2013_14', EUROPE_CHAMPIONS_LEAGUE_INCLUDE_PATH )
end
If I run the above command, the world.db database is building just fine. But when it is trying to import Champions League data into the database, I get the following error:
deprecated manifest/setup format [SportDb.Reader]; use new plain text format
[info] parsing data 'setups/teams' (../clubs/setups/teams.yml)...
rake aborted!
No such file or directory - ../clubs/setups/teams.yml
So I guess i needed to have the clubs repository aswell. So if i clone that repository and try to build it again, I got the same error message. And if I look into the clubs repository, it is true that a file called public/tmp/openfootball/clubs/setups/teams.yml doesn't exist. The only two that are in that directory are public/tmp/openfootball/clubs/setups/all.txt and public/tmp/openfootball/clubs/setups/clubs.txt.
Why doesn't it build out of the box? Am I suppose to change the files myself or am I missing crucial parts?
The next part is reading this sqlite file and importing it into my mysql database. But I guess I save that for another post. I would really like to solve this.
If it does make any difference, this is my Ruby version:
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
thanks for trying football.db - sorry for the trouble - the club repo got reorganized and two new country repos got added e.g. switzerland and france - the build script will get updated shortly so everything will work as expected out-of-the-box. You're welcome to post your question to the opensport/football.db forum for more detailed answers n insights or check back for updates/news. Cheers.
PS:
The next part is reading this sqlite file and importing it into my mysql database.
You can import the data into mysql directly (no need to import into sqlite first). Use the "official" build script - see the /build repo and change the database.yml file using the same syntax for the config like Rails (it's ActiveRecord).
Related
I am using OpenProject as project management software and I am not very familiar with ruby and rails, but using the gitolite-plugin works quite well.
I am looking for a solution to provide a link to the OpenProject users where they can directly download the gitolite-hosted repository as a zipfile.
Is that possible ?
I am willing to put pieces of code together, so even partially solutions and hints are welcome.
thx.
Nothing in oliverguenther/openproject-revisions_git would do a :
git bundle (full repo history in one file)
git archive (latest working tree as one zip file)
You would need to extend that plugin in order to expose that feature, implementing a ruby function to call git-archive on the right project, a bit like in this gist:
(extract)
# Runs the `git archive` command to pull your repository out
# into a tar or tar.gz and writes it to a temporary directory
#
# Args:
# * path - path within the repository to archive, defaults to the root
#
# Returns the path to the tar file
def archive(path=nil)
#archive_path = path || ''
create_tmp_directory
#tar_path = "#{#tmp_directory_path}/archive.tar#{#gzip}"
Dir.chdir #path
puts "Archived repository" if run_shell_cmd "git archive --prefix=#{#archive_path}/ #{#branch}:#{#archive_path} -o #{#tar_path}" and #verbose
Dir.chdir #pwd
#tar_path
end
I am trying to run the oldest Rails project which is developed in 2.3.2 version. The folder structure looks some what different like this:
my_project
|-> scripts -> ex.rb
-> data.rb
|-> MyMonitor -> app
-> config
-> db...
The folder under MyMonitor is having Rails folder structure, I am able to run the application but I need to run the scripts under my_project -> scripts folder.
Please help me what is the command or how to run the scripts?
I tried the following:
user#sachin:-~/Desktop/my_projects/MyMonitor$ load './my_project/scripts/ex.rb'
but didn't helped me..
You are referencing your file path incorrectly. Try this:
load '../scripts/ex.rb'
Or, if it is not working, you can always use absolute path (but with obvious disadvantages).
# If you are on OSX and your username is 'user'
load '/Users/user/Desktop/my_projects/scripts/ex.rb'
Update: Author wants to run the file from command line.
ruby '../scripts/ex.rb'
Users, greetings !
I have installed a flume on my cloudera 4.6, and I am trying to get tweets from twitter.
So I created a HDFS sink and a HBase sink, and they are gathering tweets... But data in HBase is not well structured.
As the data is not structured, I can't make queries on it with impala.
I created a table tweets {NAME => 'tweet'}, {NAME => 'retweet'}, {NAME => 'entities'}, {NAME => 'user'}
and my flume configuration is : http://pastebin.com/4b5d3R8Q
I am following this tutorial, but I don't know what to do with his serializer.
https://github.com/AronMacDonald/Twitter_Hbase_Impala
I have to make it into a jar ?
I have currently this in Hbase: http://pastebin.com/aNGBsvB7
Everything is in the column tweets...
I recompiled and used the flume-sources-1.0-SNAPSHOT.jar from the git:https://github.com/cloudera/cdh-twitter-example and so there were no promblem when using 'TwitterAgent.sources.Twitter.type = com.cloudera.flume.source.TwitterSource'
Install Maven, then download the repository of cdh-twitter-example.
Unzip, then execute inside (as mentionned) :
$ cd flume-sources
$ mvn package
$ cd ..
This problem happened when the twitter4j version updated from 2.2.6 to 3.X, they removed the method setIncludeEntities, and the JAR is not up to date.
PS: Do not download the prebuilt version, it is still the old.
As the title says (and as it may be visible that I am still a beginner). In my rails app, I have implemented an MVC for support pages to my app.
I wanted to show the pages that I created to my mentor, so I committed and pushed to GitHub, but I noticed that only the images were pushed to GitHub! (I use CKeditor to handle images).
Now I am sure that the pages (that consists of a Title and Contents fields) exist, because when I execute the command db.support_pages.find() in the Mongo Shell, it gives me back a list of the pages with their contents and titles. But when I open those pages (localhost) and edit the content I see that git is not even tracking them!
I don't know what more information I should post, I will post the .gitignore file:
*.rbc
*.sassc
*~
.sass-cache
.project
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*
/tmp/*
/public/assets/*
/db/*.sqlite3
/public/system/*
/coverage/
/spec/tmp/*
/spec/coverage/*
**.orig
rerun.txt
pickle-email-*.html
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
.idea
/attic/*
Any tips, leads, advice (or even queries to post more info regarding this issue) are welcomed. :)
Thanks in advance.
Your MongoDB database is composed of multiple data files containing the data and indexes.
If you want to commit the contents of the database to version control you will want to export the data and index definitions using mongodump.
If you want to share your database with your mentor, I would suggest using mongodump to get a full copy of the database, then compress and add that dump into git.
For example (on Linux) .. assuming a database called mydatabase:
cd ~/backup
mongodump -d mydatabase
tar -czvf mydatabase.tgz dump/
git add mydatabase.tgz
Your mentor would need to have MongoDB installed, and could extract the tgz file (tar xzvf mydatabase.tgz) and use mongorestore to load the data. I expect your application might require future configuration, which you would document in a README.
Git will track changes made in its directory. The pages you're talking about are stored in the database which is located somewhere else in your computer. We will need more information to give you some advice as to where you should dig.
In response to this blog post: http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/
I have three questions:
Can anyone confirm if the recipe there works?
Where and how do I put that recipe?
I have two folders need to stay across each revisions: /products and /public/images/site_images what recipe should I run to be able to achieve this?
I have near zero experience with Capistrano and all I have been able to do so far was just cap deploy and cap deploy:cold, so a script which I could just copy-paste would be greatly appreciated.
Thank you
Yes, I'm currently using it in my own projects.
You can just append the code at the end of your deploy.rb file
If products is outside the public folder, you can't link it from the public side. Also, public/images is already expected to be checked into your SCM repository
The recipe assumes you want to have a complete new folder available from public side to host the user uploaded documents.
The folder should be excluded from your SCM configuration to prevent accidental commits. You should avoid to use the public/images folder for external uploaded files or you will have many headaches trying to synchronize your development configuration, managed by a SCM, with the public state.
This is how I did it in the end, by manual approach
I hope this will help all the early coders out there:
1. cd to releases to find out folder to synchronize
cd /home/yourapp/rails_apps/main/releases/
2. find the folder to sync, one level above last folder shown with ls
REMEMBER!
With ls, the folder list goes as follows:
folder1 folder5
folder2 folder6
folder3 folder7
folder4 folder8
So in this case, copy from folder7
3. copy the folders
To copy images
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/public/images/ /home/yourapp/rails_apps/main/current/public/images/
To copy products
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/products/ /home/yourapp/rails_apps/main/current/products/
Wondering if they could be automated somehow?