Posts Tagged ‘quick-tip’

T-SQL: Select / list all tables of a database

USE YourDBName
GO
SELECT *
FROM sys.Tables
Go
 microsoft-sql-00

SQL Server: Delete all tables in a database (T-SQL)

USE MyDB
GO
EXEC sp_MSforeachtable @command1 = “DROP TABLE ?”
GO
microsoft-sql-00

R: Annotate the panels in a multi-panel lattice plot in 1 line

Just use panel.lmline()

Quick-tip: Read a table or other data from your clipboard in R


xxx <- read.delim("clipboard") 
If you want to copy data from an R variable named rdat into the Windows clipboard (for example, to copy into Excel) use:
</div>
<div>
<pre><code>write.table(rdat, "clipboard", sep="\t", row.names=FALSE, col.names=FALSE)

R: Automatic Re-installation of R Packages (Quick Tip)

  1. package_df <-as.data.frame(installed.packages(“/Library/Frameworks/R.framework/Versions/2.15/Resources/library”))
  2. package_list <- as.character(package_df$Package)
  3. install.packages(package_list)
  4. ???????????
  5. PROFIT

Rails: Add data from seeds to db in 1 Line

rake db:seed

R: Escape a period in gsub() or elsewhere

 gsub('\\.',' ', x) 

Rlogo

Python: Get the Directory of a Given File in 1 Line

 os.path.dirname(os.path.realpath(__file__)) 

python1

HTML: How to include JavaScript or jQuery in 1 Line

How to include JavaScript in HTML in 1 Line:

<script src = "app.js"> </script>

How to include jQuery in HTML in 1 Line:

<script src = "jquery.min.js"></script>

Ready, set, go! Waiting on Page Loads in JavaScript

Another JavaScript basic — use $(document).ready() to wait for an HTML document to load completely before running whatever function you put in ready()