rails new rtest -d mysql
Thursday, February 17, 2011
Sunday, February 13, 2011
old notes git
listing git branches.
git branch -a
20 Jan 2009
http://blog.kortina.net/post/71935540/fix-git-not-currently-on-any-branch-problem
Fix git “Not currently on any branch” Problem
This is quite geeky (goodies linked later :), but I want to post so I can find this fix later and because I didn’t see a whole lot of others posting about this problem, so others may find it useful as well.
I did a
git svn rebase
To update a local repo with changes from the master svn repository.
There was a conflict, and after resolving I ended up in the “Not currently on any branch” state.
To resolve,
git commit -a -m “commit merge with svn to head”
git checkout -b merged_with_svn
git checkout original_branch
git merge merged_with_svn
Hopefully someone else will find this useful. Otherwise, fear not—goodies!
Listen:
http://bit.ly/oMaria
http://bit.ly/ericsTrip
also, http://bit.ly/cheatGit
git branch -a
20 Jan 2009
http://blog.kortina.net/post/71935540/fix-git-not-currently-on-any-branch-problem
Fix git “Not currently on any branch” Problem
This is quite geeky (goodies linked later :), but I want to post so I can find this fix later and because I didn’t see a whole lot of others posting about this problem, so others may find it useful as well.
I did a
git svn rebase
To update a local repo with changes from the master svn repository.
There was a conflict, and after resolving I ended up in the “Not currently on any branch” state.
To resolve,
git commit -a -m “commit merge with svn to head”
git checkout -b merged_with_svn
git checkout original_branch
git merge merged_with_svn
Hopefully someone else will find this useful. Otherwise, fear not—goodies!
Listen:
http://bit.ly/oMaria
http://bit.ly/ericsTrip
also, http://bit.ly/cheatGit
Thursday, January 20, 2011
Ruby Simple Statistics adding standard deviation
Ruby Simple Statistics - Standard Deviation
>> data
=> [1, 2, 3, 4, 5, 6]
>> data.class
=> Array
An array of numbers in ruby, (an Array object), can return the size/length, minimum (min) value, maximum (max) value. Missing methods are average, sample_variance, standard_deviation. These can added using an Enumerable module mixins.
Enumerable module mixins - add standard deviation to all arrays etc.
# Add methods to Enumerable, which makes them available to Array
module Enumerable
# sum of an array of numbers
def sum
return self.inject(0){|acc,i|acc +i}
end
# average of an array of numbers
def average
return self.sum/self.length.to_f
end
# variance of an array of numbers
def sample_variance
avg=self.average
sum=self.inject(0){|acc,i|acc +(i-avg)**2}
return(1/self.length.to_f*sum)
end
# standard deviation of an array of numbers
def standard_deviation
return Math.sqrt(self.sample_variance)
end
end # module Enumerable
Example Useage
# enter an interpreted ruby session to play with this:
$ irb
# create a new array called data with six numbers in it
>> data = [1, 2, 3, 4, 5, 6]
=> [1, 2, 3, 4, 5, 6]
>> data.class
=> Array
# try running the following commands. Some will work, some require the module from above.
>> data.sum
=> 21
>> data.size
=> 6
>> data.min
=> 1
>> data.max
=> 6
>> data.average
=> 3.5
>> data.sample_variance
=> 2.91666666666667
>> data.standard_deviation
=> 1.70782512765993
References
- ruby inject blogbackground on inject.
- see notes for mixins for Enumerable adding standard_deviation to Enumerable
- ruby core documentationSee Module Enumerable and Class Enumerable::Enumerator
mysql notes
reminders for some mysql tasks.
Dump a database to a file and compress it.
Select to outputfile
Dump a database to a file and compress it.
mysqldump -u root study_manager_development > study_manager_development.sql
gzip -v study_manager_development.sql
Select to outputfile
select id,sku, from line_items where sku LIKE '%u123%' into outfile '/tmp/u123.txt';
Saturday, January 8, 2011
OS X, iOS, MacOS X - PDF Documents in Teaching Annotations and Full Screen Viewing
in progress 8Jan2011...
Want to be able to teach from a PDF document, click on links in the document, add annotations while presenting, have the PDF displayed full-screen. I am looking at those options now.
Want to be able to teach from a PDF document, click on links in the document, add annotations while presenting, have the PDF displayed full-screen. I am looking at those options now.
- Preview - included with MacOS X, you can present a pdf document full-screen in slideshow mode. View --> Slideshow. Editing is not available in this mode.
- Skim - Presentation and full-screen menu options are available.
- PDF Studio
- PDFPen
- Keynote - You can't present and edit at the same time, However you can place and resize several different pdfs at the same time, adding highlights, building out a page and presenting full screen with different themes available.
- iOS iPad GoodReader is an option with a VGA cable.
Preview Menu:
Skim Menu:
Thursday, December 23, 2010
Rserve
ruby rserve client
>> require 'rserve'
>> a = Rserve::Connection.new
>> y = a.eval('2 + 2').to_ruby
=> 4.0
http://www.rforge.net/Rserve/doc.html
http://www.rforge.net/Rserve/files/
download the current osx binary, then install using a command similar to:
Get the source code, not the OSX binary if you are using R64.
$ sudo gem install rserve-client
$ irb
>> require 'rserve'
>> a = Rserve::Connection.new
>> y = a.eval('2 + 2').to_ruby
=> 4.0
http://www.rforge.net/Rserve/doc.html
http://www.rforge.net/Rserve/files/
download the current osx binary, then install using a command similar to:
$ R CMD INSTALL /Users/eabolden/Downloads/Rserve_0.6-3.tar
Get the source code, not the OSX binary if you are using R64.
$ R CMD INSTALL /Users/eabolden/Downloads/Rserve_0.6-3.tar
Start Rserve with the command
$ R CMD Rserve
R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Rserv started in daemon mode.
View Rserve settings
$ R CMD Rserve --RS-settings
WARNING: ignoring environment value of R_HOME
Rserve v0.6-3
config file: /etc/Rserv.conf
working root: /tmp/Rserv
port: 6311
local socket: [none, TCP/IP used]
authorization required: no
plain text password: not allowed
passwords file: [none]
allow I/O: yes
allow remote access: no
control commands: no
interactive: yes
max.input buffer size: 262144 kB
Note:
If no config file is supplied, Rserve accepts no remote connections, requires no authentication and file transfer is enabled. For more details about how to configure Rserve, see below.
Configuration
Rserve is configured by the configuration file /etc/Rserv.conf (can be changed at compile time by specifying -DCONFIG_FILE=..). Additional configuration files can be added by the --RS-conf command line argument. The possible configuration entries are as follows (all entries are optional; default values are in angled brackets):
Thursday, December 16, 2010
vnc connection from linux to mac
Use the following to connect and see screen with ability to type. the clipboard part keeps the client from freezing:
information from thread on http://forums.macrumors.com/showthread.php?t=1044728
vncviewer -SendClipboard=0
-AcceptClipboard=0 -FullColour <hostname>information from thread on http://forums.macrumors.com/showthread.php?t=1044728
vncviewer -SendClipboard=0 -AcceptClipboard=0 -FullColour -PreferredEncoding=ZRLE <ip>
Subscribe to:
Posts (Atom)