Initial import
brought over all the files from the Jekyll version, fixed categories, reformatted for different markdown processor
This commit is contained in:
35
source/_posts/2007/adding-tags-to-a-wordpress-theme.md
Normal file
35
source/_posts/2007/adding-tags-to-a-wordpress-theme.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
layout: post
|
||||
title: Adding Tags to a WordPress Theme
|
||||
author: Daniel
|
||||
date: 2007-11-25 22:47:28
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- tag
|
||||
- template
|
||||
- theme
|
||||
- wordpress
|
||||
summary: Now that WordPress supports tags, this is how to put them in an existing theme
|
||||
---
|
||||
|
||||
WordPress 2.3 introduced tags, but unless you're using the default theme, your theme (like mine) probably didn't support them. Nowhere did I find a good example of how to add tags to your theme. Then, I was playing around with the theme switcher on my personal blog, and discovered that the default theme had tag support. I looked at it, and it was amazingly simple.
|
||||
|
||||
There is a new template tag called ...drumroll... `the_tags`. It takes three parameters: how to begin the list, how to separate each tag, and how to end the list. The tag does not do any output if a post hasn't been tagged, so it can safely sit in your theme until you need it to be active.
|
||||
|
||||
Here's how I did it in my personal blog.
|
||||
|
||||
{% codeblock lang:php %}
|
||||
<?php the_tags('<div class="tags">Tags » ', ' • ', '</div>'); ?>
|
||||
{% endcodeblock %}
|
||||
|
||||
Of course, you could also do it using an unordered list...
|
||||
|
||||
{% codeblock lang:php %}
|
||||
<?php the_tags('Tags<ul class="tags"><li>', '</li><li>', '</li></ul>'); ?>
|
||||
{% endcodeblock %}
|
||||
|
||||
Drop some styling for the "tags" class in your theme's CSS, and you're good to go!
|
||||
|
||||
(Well, not quite. You'll want to make sure to make the same change in your main index template, single post template,
|
||||
and archive template, so that the tags appear no matter how the user got to the post.)
|
||||
30
source/_posts/2007/category-drop-down-in-wordpress.md
Normal file
30
source/_posts/2007/category-drop-down-in-wordpress.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
layout: post
|
||||
title: Category Drop-Down in WordPress
|
||||
author: Daniel
|
||||
date: 2007-05-24 09:00:15
|
||||
categories:
|
||||
- [ Programming, JavaScript ]
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- category
|
||||
- dropdown
|
||||
- wordpress
|
||||
summary: A category dropdown (select list) in WordPress
|
||||
---
|
||||
|
||||
[WordPress][] provides a [template tag][template], [wp_dropdown_categories][cat], that inserts a drop-down list (the HTML <select> element) of categories, where the value of each item is the ID from the database. This works fine if you are not using rewrite rules (AKA "pretty links") - you can construct a URL using the value (?cat=[number]). However, if you use any sort of rewrite rules, this does not work. I recently converted my [personal site][], which uses the Pool theme, to utilize a JavaScript array to assist with displaying category pages.
|
||||
|
||||
Here's the code...
|
||||
|
||||
_Edit: Code has been moved to [this post][]._
|
||||
|
||||
This works for both "pretty" and standard links, as it uses the template tag [get_category_link][link] to specify the link.
|
||||
|
||||
|
||||
[WordPress]: //wordpress.org "WordPress"
|
||||
[template]: //codex.wordpress.org/Template_Tags "Template Tags - WordPress Codex"
|
||||
[cat]: //codex.wordpress.org/Template_Tags/wp_dropdown_categories "wp_dropdown_categories - WordPress Codex"
|
||||
[personal]: //daniel.summershome.org "Daniel J. Summers"
|
||||
[this post]: /2007/posting-source-code-in-wordpress-take-2.html "Posting Source Code in WordPress, Take 2 • DJS Consulting Tech Blog"
|
||||
[link]: //codex.wordpress.org/Function_Reference/get_category_link "get_category_link - WordPress Codex"
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
layout: post
|
||||
title: Daniel's DropDowns 1.0 - WordPress Plug-In
|
||||
author: Daniel
|
||||
date: 2007-10-02 19:54:56
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- category
|
||||
- dropdown
|
||||
- plug-in
|
||||
- wordpress
|
||||
summary: A WordPress plugin to display category and archive drop-downs
|
||||
---
|
||||
|
||||
I've created a plug-in that I'm now using on my personal site to provide the category and archive drop-down lists. It's called "Daniel's DropDowns", and it will create drop-downs with either a link or a button to go to the selection in the drop-down, and a CSS class can be specified for the button and the drop-down box.
|
||||
|
||||
<del>daniels\_dropdowns.txt - Daniel's DropDowns 1.0</del> _(UPDATE: This functionality is now part of WordPress core.)_
|
||||
|
||||
<del>To install it, download the file, rename it "daniels_dropdowns.php", and upload it to your /wp-content/plugins directory. Then, enable it, and add the template tags to your theme. (The documentation at the top of the file lists all the template tags provided, and the options that can be passed to them.)</del>
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
layout: post
|
||||
title: Daniel's DropDowns 2.0.1 - WordPress Plug-In
|
||||
author: Daniel
|
||||
date: 2007-12-24 10:34:06
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- category
|
||||
- dropdown
|
||||
- plug-in
|
||||
- update
|
||||
- wordpress
|
||||
summary: A quick bug fix
|
||||
---
|
||||
|
||||
I have released version 2.0.1 of Daniel's DropDowns, the [WordPress][] plug-in that provides category and archive dropdown template tags. It is available on [its page at the WordPress Plug-In Directory][pi].
|
||||
|
||||
This was a minor change - the auto-navigating lists added in version 2 needed a slight tweak. There wasn't a "select category" entry, so one could not navigate to the first item in the list without going somewhere else first. The category dropdown now has this entry, and is consistent with the archive dropdown.
|
||||
|
||||
Enjoy!
|
||||
|
||||
_(UPDATE: This plug-in is inactive, as its functionality is now part of WordPress core.)_
|
||||
|
||||
|
||||
[WordPress]: //wordpress.org "WordPress"
|
||||
[pi]: //wordpress.org/extend/plugins/daniels-dropdowns/ "Download Daniel's DropDowns 2.0.1"
|
||||
30
source/_posts/2007/daniels-dropdowns-2-wordpress-plug-in.md
Normal file
30
source/_posts/2007/daniels-dropdowns-2-wordpress-plug-in.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
layout: post
|
||||
title: Daniel's DropDowns 2 - WordPress Plug-In
|
||||
author: Daniel
|
||||
date: 2007-12-23 23:02:49
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- category
|
||||
- dropdown
|
||||
- plug-in
|
||||
- update
|
||||
- wordpress
|
||||
summary: A new version of the category / archive plug-in
|
||||
---
|
||||
|
||||
I have released version 2 of my category and archive drop-down plug-in for [WordPress][]. It is hosted at the WordPress Plug-In Directory - you can [go get it there][pi]. Following are a few of the changes that were made.
|
||||
|
||||
* Both tags now have only 2 parameters - the type of navigation and the text for the link or button. For navigation type, 'button' remains the default, and 'link' is still available. However, a third option of 'auto' has been added, which will render the list as an auto-navigating select box.
|
||||
* The CSS parameters for the select and button elements were dropped. How these elements can be specified using CSS is detail in the top-of-plugin comments, along with an example.
|
||||
* The usage examples in the comments now have an example of how to put the tag in a template in such a way that, if the plug-in is disabled, the template will still render. This could be done with 1.0, but I didn't give an example.
|
||||
* I added PHP Documentor-style comments to both functions.
|
||||
|
||||
Let me know if you have any problems with it, or any ideas for other behavior. Enjoy!
|
||||
|
||||
_(UPDATE: This plug-in is inactive, as its functionality is now part of WordPress core.)_
|
||||
|
||||
|
||||
[WordPress]: //wordpress.org "WordPress"
|
||||
[pi]: //wordpress.org/extend/plugins/daniels-dropdowns/ "Download Daniel's DropDowns 2"
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
layout: post
|
||||
title: HCSB Verse of the Day 1.0 - WordPress Plug-In
|
||||
author: Daniel
|
||||
date: 2007-09-25 22:08:24
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- bible gateway
|
||||
- hcsb
|
||||
- plug-in
|
||||
- wordpress
|
||||
summary: A WordPress plug-in to display a verse or passage each day
|
||||
---
|
||||
|
||||
I have used a hack in the theme of my personal site for a while to obtain the "Verse of the Day" in the Holman Christian Standard Bible (HCSB) version. With things that I've learned about plug-ins, I decided to take a stab at creating a plug-in to do this work. That way, if I changed themes, I wouldn't have to hack the new one they way I've hacked the current one.
|
||||
|
||||
The fruits of my labor is the new HCSB Verse of the Day plug-in for WordPress. It uses the reference from [BibleGateway.com][], then gets the text from their regular website. (They do not provide the service, citing copyright restrictions.) How to use the plug-in, along with my justification on copyright grounds, is in the top of the file's comments. If they're not clear, certainly post comments here and I'll address them. (I do plan to submit the plug-in to [WordPress.org][] - but, they require a specific README file format that it will take me a bit to put together.)
|
||||
|
||||
<del>votd\_hcsb.txt - HCSB Verse of the Day 1.0</del> _(UPDATE: It is in the plugin directory now.)_
|
||||
|
||||
<del>To install it, download the file, rename it "votd_hcsb.php", and upload it to your /wp-content/plugins directory. Then, enable it, and add the template tags to your theme - that's it!</del>
|
||||
|
||||
|
||||
[BibleGateway.com]: //www.biblegateway.com "Bible Gateway"
|
||||
[WordPress.org]: //wordpress.org "WordPress"
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
layout: post
|
||||
title: Incorporating an Akismet Counter Into a WordPress Theme
|
||||
author: Daniel
|
||||
date: 2007-08-06 10:14:00
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- aksimet
|
||||
- counter
|
||||
- spam
|
||||
- theme
|
||||
- wordpress
|
||||
summary: Akismet counts the spam it blocks, and that count can be displayed
|
||||
---
|
||||
|
||||
[Akismet][] is, by far, the most popular anti-spam plug-in for WordPress. (It comes bundled with the download, so that gets it market share. But, it's also very, very good.) It comes with a counter that can be put into a WordPress theme. It's attractive, but its light blue color may not integrate well into a given theme.
|
||||
|
||||
I went digging around in the source code, and found the line that actually pulls the count from the database. Using this parameter, I was able to integrate a spam count into the sidebar that has a look consistent with the rest of the site.
|
||||
|
||||
Here's the code that's in use on the theme on this site.
|
||||
|
||||
{% codeblock lang:php %}
|
||||
<li id="spamstats">
|
||||
<h2><?php _e('Akismet-Eaten Spam:'); ?></h2>
|
||||
<ul>
|
||||
<li><a href="//akismet.com"><?php
|
||||
echo(number_format(get_option("akismet_spam_count"))); ?>
|
||||
and counting...</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endcodeblock %}
|
||||
|
||||
Of course, line 5 is the important one - that's how to get the number, formatted for whatever locale the server is set up for. (On my [personal blog][djs], the number is up over 1,400!)
|
||||
|
||||
|
||||
[Akismet]: //akismet.com "Akismet"
|
||||
[djs]: //daniel.summershome.org "Daniel J. Summers"
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
layout: post
|
||||
title: Lightning Calendar Plug-In for Thunderbird AMD64
|
||||
author: Daniel
|
||||
date: 2007-07-21 09:01:42
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, Lightning Plug-In ]
|
||||
tags:
|
||||
- amd64
|
||||
- lightning
|
||||
- mozilla
|
||||
- plug-in
|
||||
- sunbird
|
||||
- thunderbird
|
||||
summary: A plugin that brings Mozilla Sunbird into Thunderbird
|
||||
comments: []
|
||||
---
|
||||
|
||||
[Mozilla Sunbird][] is a calendar project that's being designed as a sister program to Thunderbird and Firefox. It's now at the 0.5 version, and there is a plug-in that integrates Sunbird with Thunderbird, called [Lightning][]. It allows you to not only have a calendar, but send and receive meeting requests as well.
|
||||
|
||||
I'm running Thunderbird 2 under Ubuntu Feisty Fawn (7.04) on the AMD64 architecture, and could not find a pre-compiled version of this that worked. So, I decided to give it a shot. It was pretty easy, and the result is a plug-in that works with the AMD64 version of Thunderbird! Since I had trouble finding it, I thought I would share it.
|
||||
|
||||
Since I have just started using it, I haven't wrung it out, or tested all the options. Use at your own risk, etc.
|
||||
|
||||
<del>You can download the plug-in here</del> _(UPDATE: See [this post][].)_ Happy storming! ;)
|
||||
|
||||
|
||||
[Mozilla Sunbird]: //www.mozilla.org/projects/calendar/sunbird/ "Mozilla Sunbird Calendar Project"
|
||||
[Lightning]: //www.mozilla.org/projects/calendar/lightning/ "Lightning Plug-in for Thunderbird"
|
||||
[this post]: /2007/mozilla-now-hosting-lightning-64-bit-plug-in.html "Mozilla Now Hosting Lightning 64-bit Plug-In • DJS Consulting Tech Blog"
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
layout: post
|
||||
title: Mozilla Now Hosting Lightning 64-bit Plug-In
|
||||
author: Daniel
|
||||
date: 2007-08-07 12:56:46
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, Lightning Plug-In ]
|
||||
tags:
|
||||
- lightning
|
||||
- mozilla
|
||||
- plug-in
|
||||
summary: Mozilla provides the Lightning plug-in now
|
||||
comments: []
|
||||
---
|
||||
|
||||
Just when I get a nice system set up here, lo and behold, Mozilla now has a 64-bit Linux plug-in available. It can be [obtained from their FTP site][ftp] (link for version 0.5). <del>I'll continue to keep the version I have here available, in case this dries up.</del> _(UPDATE: It's gone.)_ But, unless that does, this is probably the last post you'll see here about the 64-bit Lightning plug-in.
|
||||
|
||||
|
||||
[ftp]: //releases.mozilla.org/pub/mozilla.org/calendar/lightning/releases/0.5/contrib/linux-x86-64/
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
layout: post
|
||||
title: Posting Source Code in WordPress, Take 2
|
||||
author: Daniel
|
||||
date: 2007-06-13 11:33:15
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- geshi
|
||||
- plug-in
|
||||
- source
|
||||
- wordpress
|
||||
- wp-syntax
|
||||
summary: The WP Syntax Plugin is another plugin that simplifies posting source code
|
||||
---
|
||||
|
||||
In my searching, I have found another WordPress source code plugin, called [wp-syntax][]. This one uses [GeSHi][], the Generic Syntax Highlighter. It features many languages, and is extensible to even more. (If I ever post a COBOL snippet, I'll probably add COBOL support to it, and contribute it to the codebase.)
|
||||
|
||||
To use it, you simply put a pre tag, followed by `lang=[language]`. It will also do line numbering. Of course, with a single "language" parameter, the embedded language will not be highlighted as well. In this case, the previous plug-in works better; although the syntax highlighting has to be done manually, it can handle multiple languages.
|
||||
|
||||
_(NOTE: The samples have been removed, as this blog is not running under WordPress. However, since the source code from another post was moved here, it is presented below, using [Jekyll][]'s PHP highlighting mode.)_
|
||||
|
||||
{% codeblock lang:php %}
|
||||
<?php
|
||||
/**
|
||||
* This creates a list of category links that can be used with a category dropdown
|
||||
*/
|
||||
$aCategories = get_all_category_ids();
|
||||
$iMaxCat = 0;
|
||||
foreach($aCategories as $iThisCat) {
|
||||
if ($iMaxCat < $iThisCat) {
|
||||
$iMaxCat = $iThisCat;
|
||||
}
|
||||
}
|
||||
$iMaxCat++;
|
||||
?>
|
||||
<div style="text-align:center;">
|
||||
<form name="categoryform" action="" style="text-align:center;">
|
||||
<script type="text/javascript">
|
||||
var aLink = new Array(<?php echo($iMaxCat); ?>);
|
||||
<?php
|
||||
foreach($aCategories as $iThisCat) {
|
||||
echo("aLink[$iThisCat] = \"" . get_category_link($iThisCat) . "\";\n");
|
||||
} ?>
|
||||
function goCat() {
|
||||
window.location =
|
||||
aLink[document.getElementById('cat')[document.getElementById('cat').selectedIndex].text;
|
||||
}
|
||||
</script>
|
||||
<?php wp_dropdown_categories('class=sidebardropdown&orderby=name&show_count=1&hierarchical=1'); ?>
|
||||
<br /><br />
|
||||
<button class="sidebarbutton" type="button" style="margin-top:5px;" onclick="goCat();">View Category</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endcodeblock %}
|
||||
|
||||
This is another option, and is probably what I'll use for single-language posts, or posts where the embedded language may not be crucial.
|
||||
|
||||
|
||||
[wp-syntax]: //wordpress.org/extend/plugins/wp-syntax/ "WP Syntax Plugin"
|
||||
[GeSHi]: //qbnz.com/highlighter/ "GeSHi"
|
||||
[Jekyll]: //jekyllrb.com "Jekyll"
|
||||
31
source/_posts/2007/posting-source-code-in-wordpress.md
Normal file
31
source/_posts/2007/posting-source-code-in-wordpress.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
layout: post
|
||||
title: Posting Source Code in WordPress
|
||||
author: Daniel
|
||||
date: 2007-05-30 14:45:10
|
||||
categories:
|
||||
- [ Programming, PHP, WordPress ]
|
||||
tags:
|
||||
- bennet mcelwee
|
||||
- plug-in
|
||||
- source
|
||||
- wordpress
|
||||
summary: A plug-in for WordPress makes posting source code samples easy
|
||||
---
|
||||
|
||||
Traditionally, posting source code in a WordPress blog, especially if it were HTML or PHP, was problematic. There are a few reasons for this...
|
||||
|
||||
* WordPress is very good about ensuring that it outputs valid XHTML, so it strips mis-matched and invalid tags. This is usually desirable, but it wreaks havoc with HTML and XML code posts.
|
||||
* Since WordPress is coded in PHP, blocks of PHP will attempt to execute.
|
||||
* White space is collapsed, which can kill any readability that the user has set out; the "visual editor" ([TinyMCE][]) does its best to create efficient HTML. This can actually break spacing-oriented languages such as Python.
|
||||
|
||||
So how do you do it? It's actually pretty easy, using the [Code Markup][] WordPress plugin. You can download the plugin from that link, and upload it to <tt>./wp-content/plugins</tt>. The instructions on the website are critical - the "visual" editor will not allow the code to come through unscathed. However, the visual editor only corrupts the code if you actually save it; what I have done is write the post using the visual editor, then disable it and put the code in. It's the best of both worlds! (Make sure that, once you have the code in, you don't edit the post using the visual editor - unless you have a good backup...)
|
||||
|
||||
<del>The post below this one (about category lists in WordPress) was done using this plugin.</del> _(This isn't running in WordPress any more.)_ In addition, you can use the <tt><span></tt> tag to do the color-coding. I created a few CSS classes ("key" for keywords, "func" for functions, "attr" for attributes, "embed" for embedded language), and used them to accomplish the color coding. It seems that it would be pretty easy to write another plugin that used a list of keywords to do this syntax highlighting; maybe that's a challenge for another day.
|
||||
|
||||
A big "atta boy" to [Bennet McElwee][] for a fantastic plugin!
|
||||
|
||||
|
||||
[TinyMCE]: //tinymce.moxiecode.com "TinyMCE"
|
||||
[Code Markup]: //www.thunderguy.com/semicolon/wordpress/code-markup-wordpress-plugin "Code Markup Plug-in - Semicolon"
|
||||
[Bennet McElwee]: //www.thunderguy.com/semicolon/ "Semicolon - by Bennett McElwee"
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
layout: post
|
||||
title: Releases for Lightning Plug-In and xine RPMs
|
||||
author: Daniel
|
||||
date: 2007-08-06 22:49:08
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, Lightning Plug-In ]
|
||||
- [ Hosted 64-bit Software, xine RPMs ]
|
||||
tags:
|
||||
- category
|
||||
- lightning
|
||||
- xine
|
||||
summary: How to track releases of pre-built open source software hosted by DJS Consulting
|
||||
---
|
||||
|
||||
At DJS Consulting, we maintain 64-bit builds for two software products - xine and the Lightning plug-in for Thunderbird. These are now shown under "Hosted 64-Bit Software" in the sidebar. You can also view links for each of the categories.
|
||||
|
||||
<del>**Lightning Plug-In**</del> _(UPDATE: See [this post][].)_
|
||||
|
||||
<del>Category Link • <del>RSS Feed</del>
|
||||
|
||||
**xine RPMs**
|
||||
|
||||
[Category Link][xine-cat] • [RSS Feed][xine-rss]
|
||||
|
||||
Along these lines, there will hopefully be a new xine (1.1.7) coming soon - stay tuned!
|
||||
|
||||
|
||||
[this post]: /2007/mozilla-now-hosting-lightning-64-bit-plug-in.html "Mozilla Now Hosting Lightning 64-bit Plug-In • DJS Consulting Tech Blog"
|
||||
[xine-cat]: /category/xine-rpms
|
||||
[xine-rss]: /xine-rpms.xml
|
||||
@@ -0,0 +1,133 @@
|
||||
---
|
||||
layout: post
|
||||
title: Transferring CLOBs Across Linked Oracle Databases
|
||||
author: Daniel
|
||||
date: 2007-06-15 14:04:02
|
||||
categories:
|
||||
- [ Databases, Oracle ]
|
||||
- [ Programming, SQL, PL/SQL ]
|
||||
tags:
|
||||
- algorithm
|
||||
- clob
|
||||
- data
|
||||
- linked database
|
||||
- oracle
|
||||
summary: An algorithm to move CLOBs from one database to another
|
||||
---
|
||||
|
||||
Linking databases in Oracle make it easy to share data, and can be useful for replication. However, there is a limitation in Oracle that prevents Character Large Objects (CLOBs) from coming across these links. The following technique uses stored procedures and a temporary table to pull CLOBs across a database link.
|
||||
|
||||
First, you'll need the temporary table, which will hold a sequence number, the primary key for the table where you'll want to reconstruct the CLOB, and some text. This table can reside in the source or destination database, but must be linked from the other one. For our purposes, it looks like this...
|
||||
|
||||
{% codeblock lang:sql %}
|
||||
create table clob_xfer_area
|
||||
(
|
||||
cxa_pk number(12),
|
||||
cxa_number number(12),
|
||||
cxa_text varchar2(4000 byte)
|
||||
);
|
||||
alter table clob_xfer_area add
|
||||
(
|
||||
constraint pk_cxa_id
|
||||
primary key (cxa_pk, cxa_number)
|
||||
);
|
||||
{% endcodeblock %}
|
||||
|
||||
Second, you'll need the procedure in the source database that breaks the CLOB apart and populates the temporary table.
|
||||
|
||||
{% codeblock lang:sql %}
|
||||
set serveroutput on size 1000000
|
||||
set lines 1000
|
||||
set pages 0
|
||||
set tab off
|
||||
set feedback on
|
||||
create or replace
|
||||
procedure break_clobs_apart
|
||||
is
|
||||
v_line_number number(3);
|
||||
v_text_piece varchar2(4000);
|
||||
v_total_length number(12);
|
||||
cursor clob_cur is
|
||||
select twc_pk, twc_clob_field
|
||||
from table_with_clob;
|
||||
begin /* { */
|
||||
for clob_rec in clob_cur loop /* { */
|
||||
v_total_length := 1;
|
||||
v_line_number := 0;
|
||||
while (v_total_length <=
|
||||
DBMS_LOB.GETLENGTH(clob_rec.twc_clob_field)) loop /* { */
|
||||
v_line_number := v_line_number + 1;
|
||||
v_text_piece := DBMS_LOB.SUBSTR(clob_rec.twc_clob_field,
|
||||
3999, v_total_length);
|
||||
v_total_length := v_total_length + 3999;
|
||||
insert into clob_xfer_area (
|
||||
cxa_pk,
|
||||
cxa_number,
|
||||
cxa_text
|
||||
)
|
||||
values (
|
||||
clob_rec.twc_pk, -- cxa_pk
|
||||
v_line_number, -- cxa_number
|
||||
v_text_piece -- cxa_text
|
||||
);
|
||||
end loop; /* } of while */
|
||||
end loop; /* } of clob_cur */
|
||||
end; /* } of procedure break_clobs_apart */
|
||||
{% endcodeblock %}
|
||||
|
||||
Third, you'll need a procedure in the destination database that puts the CLOB back together, and deletes the data from the temporary table.
|
||||
|
||||
{% codeblock lang:sql %}
|
||||
set serveroutput on size 1000000
|
||||
set lines 1000
|
||||
set pages 0
|
||||
set feedback on
|
||||
set tab off
|
||||
create or replace
|
||||
procedure put_clobs_together
|
||||
is
|
||||
v_new_clob clob;
|
||||
cursor pk_cur is
|
||||
select distinct cxa_pk
|
||||
from clob_xfer_area;
|
||||
cursor piece_cur(p_cxa_pk number) is
|
||||
select cxa_text
|
||||
from clob_xfer_area
|
||||
where cxa_pk = p_cxa_pk
|
||||
order by cxa_number;
|
||||
begin /* { */
|
||||
for pk_rec in pk_cur loop /* { */
|
||||
DBMS_LOB.CREATETEMPORARY(v_new_clob, TRUE);
|
||||
DBMS_LOB.OPEN(v_new_clob, DBMS_LOB.LOB_READWRITE);
|
||||
for piece_rec in piece_cur(pk_rec.cxa_pk) loop /* { */
|
||||
DBMS_LOB.WRITEAPPEND(v_new_clob, LENGTH(piece_rec.cxa_text),
|
||||
piece_rec.cxa_text);
|
||||
end loop; /* } of piece_cur */
|
||||
DBMS_LOB.CLOSE(v_new_clob);
|
||||
update dest_table_with_clob
|
||||
set migrated_clob = v_new_clob
|
||||
where dtwc_pk = pk_rec.cxa_pk;
|
||||
end loop; /* } of pk_cur */
|
||||
delete from clob_xfer_area;
|
||||
end; /* } of procedure put_clobs_together */
|
||||
{% endcodeblock %}
|
||||
|
||||
Finally, you'll need a procedure that controls the whole thing. We'll assume that this procedure is loaded in the destination database, and the source database is linked with the name "source".
|
||||
|
||||
{% codeblock lang:sql %}
|
||||
set lines 1000
|
||||
set pages 0
|
||||
set feedback on
|
||||
set tab off
|
||||
create or replace
|
||||
procedure xfer_clobs
|
||||
is
|
||||
begin /* { */
|
||||
break_clobs_apart@source;
|
||||
put_clobs_together;
|
||||
end; /* } */
|
||||
{% endcodeblock %}
|
||||
|
||||
(This does not include a commit - the changes will not be persistent unless they are committed.)
|
||||
|
||||
Of course, these processes could (and, to be useful, likely would) be integrated into other procedures and scripts. But, this framework will successfully transfer CLOBs across linked databases in Oracle.
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
layout: post
|
||||
title: Transferring Data Between Oracle and SQL Server
|
||||
author: Daniel
|
||||
date: 2007-07-09 15:23:10
|
||||
date_gmt: '2007-07-09 21:23:10 +0000'
|
||||
categories:
|
||||
- [ Databases, Oracle ]
|
||||
- [ Databases, SQL Server ]
|
||||
tags:
|
||||
- data
|
||||
- dts
|
||||
- instant client
|
||||
- oracle
|
||||
- sql server
|
||||
summary: Using Oracle's Instant Client for easy SQL Server data exchange
|
||||
---
|
||||
|
||||
There are lots of "how to" articles on sharing data between Oracle and SQL Server. Most of these involve installing Oracle's code base on the SQL Server machine, then using that instance to link tables within Oracle. This technique does not require that, thanks to a product from Oracle called [Oracle Instant Client][ic].
|
||||
|
||||
To set up the Oracle piece, download the packages for "Basic" and "ODBC Supplement", and follow the instructions for installation, on the machine with SQL Server. (This is not an "install" per se - it's basically an unzip.) Next, you'll need to provide a TNSNAMES.ORA file - this can be any valid file, including a simple shell with an "ifile=" statement pointing to a common TNSNAMES.ORA file. Finally, set the environment variable TNS_ADMIN to point to the directory where this TNSNAMES.ORA file resides.
|
||||
|
||||
Now, you can easily create a DTS script through SQL Server to push or pull data however you'd like. Oracle Instant Client will appear in the drop-down list of providers, and you'll be able to specify your connection the way you normally do (i.e., "DB01.WORLD").
|
||||
|
||||
Happy migrating!
|
||||
|
||||
|
||||
[ic]: //www.oracle.com/technology/tech/oci/instantclient/index.html "Download Oracle Instant Client"
|
||||
20
source/_posts/2007/welcome.md
Normal file
20
source/_posts/2007/welcome.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
layout: post
|
||||
title: Welcome!
|
||||
author: Daniel
|
||||
date: 2007-05-17 14:29:32
|
||||
categories:
|
||||
- General Info
|
||||
tags:
|
||||
- blog
|
||||
- welcome
|
||||
---
|
||||
|
||||
Welcome to the DJS Consulting Tech Blog. This blog is a place where I plan to posts tips and other information regarding technology (AKA "geek stuff"). This will allow me to keep [my personal blog][pers] non-technical.
|
||||
|
||||
I have imported my old "My Linux Adventure" posts from 2004 here, to allow the to be indexed and searchable. I noticed, in the process, that some of the information is somewhat dated - take it for what it's worth, which is twice what you paid for it!
|
||||
|
||||
I hope that the information here will be beneficial to you.
|
||||
|
||||
|
||||
[pers]: //daniel.summershome.org "Daniel J. Summers: Charter Member of the VRWC"
|
||||
19
source/_posts/2007/wordpress-2-3-about-to-drop.md
Normal file
19
source/_posts/2007/wordpress-2-3-about-to-drop.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
layout: post
|
||||
title: WordPress 2.3 About to Drop
|
||||
author: Daniel
|
||||
date: 2007-09-24 13:05:27
|
||||
categories:
|
||||
- General Info
|
||||
tags:
|
||||
- update
|
||||
- wordpress
|
||||
summary: A pending WordPress release
|
||||
---
|
||||
|
||||
Version 2.3 of WordPress, the blogging software I use to produce this blog (as well as the other blogs on my site), will be released later today. I'll be upgrading these blogs on Monday evening. There have been major pieces of WordPress that have been re-worked, and those are causing some plug-ins to not work correctly. None of my blogs are all that reliant on plug-ins - the "Share This" plug-in is the main one, and it's been verified in 2.3 already.
|
||||
|
||||
There's lots more information on the [WordPress Development Blog][dev] - I won't go into the details here. I'm confident this will be a smooth upgrade. I just wanted to let you know in case some things look strange, I'm on it.
|
||||
|
||||
|
||||
[dev]: //wordpress.org/development "Development Blog - WordPress.org"
|
||||
25
source/_posts/2007/xine-lib-1-1-7-rpm.md
Normal file
25
source/_posts/2007/xine-lib-1-1-7-rpm.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
layout: post
|
||||
title: xine-lib 1.1.7 RPM
|
||||
author: Daniel
|
||||
date: 2007-08-21 21:10:15
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, xine RPMs ]
|
||||
tags:
|
||||
- rpm
|
||||
- xine-lib
|
||||
---
|
||||
|
||||
Below are the library and development RPMs for xine-lib version 1.1.7. These have been built a little differently. First, these have been built on Ubuntu Linux, and converted to RPM using alien. Second, I could not quickly figure out how to get only the files tagged for the 1.1.7 release, so this is actually the in-work 1.1.8 release. I ran these builds through some paces, and nothing glaring came out. Be sure to check out the [About the xine RPMs][abt] post for more information.
|
||||
|
||||
xine-lib - The main xine library
|
||||
xine-lib-dev - The development xine library (needed if you're building an interface against xine-lib)
|
||||
|
||||
You'll also need a user interface - as of this release, the most current release of [xine-ui is 0.99.5][ui].
|
||||
|
||||
(To save disk space, only the current release and two [prior releases][pri] will be maintained.)
|
||||
|
||||
|
||||
[abt]: /2005/about-the-xine-rpms.html "About the xine RPMs • DJS Consulting Tech Blog"
|
||||
[ui]: /2007/xine-ui-0-99-5-rpm.html
|
||||
[pri]: /2005/xine-lib-1-1-1-rpm.html
|
||||
24
source/_posts/2007/xine-ui-0-99-5-rpm.md
Normal file
24
source/_posts/2007/xine-ui-0-99-5-rpm.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
layout: post
|
||||
title: xine-ui 0.99.5 RPM
|
||||
author: Daniel
|
||||
date: 2007-08-21 21:15:35
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, xine RPMs ]
|
||||
tags:
|
||||
- rpm
|
||||
- xine-ui
|
||||
---
|
||||
|
||||
Below is the RPM for xine-ui version 0.99.5. This RPM has been built a little differently. First, it was built on Ubuntu Linux and converted to RPM using alien. Second, I could not quickly figure out how to get the files tagged for the 0.99.5 release, so this build includes changes committed after the official 0.99.5 release. I ran the UI through some paces, and no glaring errors jumped out. Be sure to check out the [About the xine RPMs][abt] post for more information.
|
||||
|
||||
xine-ui - The user interface
|
||||
|
||||
To use this, you'll also need xine-lib - as of this release, the most recent release of [xine-lib is 1.1.7][lib].
|
||||
|
||||
(To save disk space, only the current release and two [prior releases][pri] will be maintained.)
|
||||
|
||||
|
||||
[abt]: /2005/about-the-xine-rpms.html "About the xine RPMs • DJS Consulting Tech Blog"
|
||||
[lib]: /2007/xine-lib-1-1-7-rpm.html
|
||||
[pri]: /2005/xine-ui-0-99-4-rpm.html
|
||||
Reference in New Issue
Block a user