This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT [Subject], PostDate, FormattedBody, | |
dbo.old_url(PostDate, [Subject]) AS old_url, | |
dbo.make_slug([Subject]) AS slug | |
FROM dbo.cs_Posts | |
WHERE UserID = 2102 | |
AND SectionID = 4 | |
AND PostLevel = 1 | |
AND IsApproved = 1 | |
AND IsLocked = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[make_slug] | |
( | |
@post_title nvarchar(256) | |
) | |
RETURNS nvarchar(500) | |
AS | |
BEGIN | |
-- Declare the return variable here | |
DECLARE @slug nvarchar(500) | |
DECLARE @clean_title nvarchar(500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[old_url] | |
( | |
@post_date datetime, | |
@post_title nvarchar(256) | |
) | |
RETURNS nvarchar(500) | |
AS | |
BEGIN | |
-- Declare the return variable here | |
DECLARE @url nvarchar(500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[removePunctuation] | |
( | |
@input nvarchar(500) | |
) | |
RETURNS nvarchar(500) | |
AS | |
BEGIN | |
/** | |
* Based on Nigel Rivett's SQL script found: | |
* http://www.nigelrivett.net/SQLTsql/RemoveNonNumericCharacters.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[deDupeSpaces] | |
( | |
@input nvarchar(500) | |
) | |
RETURNS nvarchar(500) | |
AS | |
BEGIN | |
/** | |
* Based on Nigel Rivett's SQL script found: | |
* http://www.nigelrivett.net/SQLTsql/RemoveNonNumericCharacters.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO wp_xxxxx_posts | |
(post_author, | |
post_date, | |
post_date_gmt, | |
post_content, | |
post_title, | |
post_status, | |
post_name, | |
post_modified, | |
post_modified_gmt, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>com.gravity</groupId> | |
<artifactId>gravity-hpaste</artifactId> | |
<version>0.1.11</version> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WebTable extends HbaseTable[WebTable, String, WebPageRow](tableName = "pages", rowKeyClass = classOf[String]) { | |
def rowBuilder(result: DeserializedResult) = new WebPageRow(this, result) | |
val meta = family[String, String, Any]("meta") | |
val title = column(meta, "title", classOf[String]) | |
val lastCrawled = column(meta, "lastCrawled", classOf[DateTime]) | |
val content = family[String, String, Any]("text", compressed = true) | |
val article = column(content, "article", classOf[String]) | |
val attributes = column(content, "attrs", classOf[Map[String, String]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebCrawlingSchema.WebTable | |
.put("http://mycrawledsite.com/crawledpage.html") | |
.value(_.title, "My Crawled Page Title") | |
.value(_.lastCrawled, new DateTime()) | |
.value(_.article, "Jonsie went to the store. She didn't notice the spinning of the Earth, nor did the Earth notice the expansion of the Universe.") | |
.value(_.attributes, Map("foo" -> "bar", "custom" -> "data")) | |
.valueMap(_.searchMetrics, Map(new DateMidnight(2011, 6, 5) -> 3l, new DateMidnight(2011, 6, 4) -> 34l)) | |
.execute() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebCrawlingSchema.WebTable.query2.withKey("http://mycrawledsite.com/crawledpage.html") | |
.withColumns(_.title, _.lastCrawled) | |
.withFamilies(_.searchMetrics) | |
.singleOption() match { | |
case Some(pageRow) => { | |
println("Title: " + pageRow.column(_.title).getOrElse("No Title")) | |
println("Crawled on: " + pageRow.column(_.lastCrawled).getOrElse(new DateTime())) | |
pageRow.family(_.searchMetrics).foreach { | |
case (date: DateMidnight, views: Long) => |
OlderNewer