I’m whipping up a CRUD solution with CodeIngiter and KISSing this solution. I want to make use of as much “already in place” functionality as possible. When I built the “C” (create) method, I wanted to merely read out the database fields to create the input form. I had an issue with a TEXT field where I needed to put it at the end of the form, my solution was to redefine ALTER the table and reorder the fields/columns in the db table. My GUI wouldn’t do it and it took a minute to find the SQL. Here ’tis:
ALTER TABLE people_group MODIFY overview TEXT AFTER owner_data;
One of our student assistants here at the university is on the path of becoming a better programmer. He assists us here on the web team with a heckuva lotta HTML editing.
It is my observation that programmers who can think in regular expressions and employ them in code and in the editing process are better programmers because of it. He’s starting to think in regular expressions and asked me for assistance yesterday on one that I didn’t already have in my Evernote code snippet library.
He was looking for something that would kill all of the text between HTML tags, leaving the HTML. Here’s what I came up with.
Matching pattern:
(>)(([A-Za-z0-9-\(\):\/';\.,])*\s*)*(<)
Replacement pattern:
\1\4
When you’re writing your regex matching patterns and you put stuff between unescaped parenthesis, it becomes a regex back reference, to be referred to later with a backslash and a number corresponding to the order in which it was parenthesized (from left to right).
Do you see how \1 & \4 are the greater than and less than symbols representing HTML markup? The stuff that needs to go away are back-referenced as \2 & \3 between \1 & \4. When I replace, I discard \2 & \3 by only replacing \1 & \4.
Here’s that HTML:
<p>Please visit the <a href="http://www.uakron.edu/admissions/graduate/">Graduate School Webpage</a> for information about the application process.</p> <p><strong>English Language Requirements for Graduate Students: Five Alternatives to Demonstrate English Proficiency</strong></p> <p>International students, permanent residents and U.S. citizens whose native language is not English must provide evidence of their English language ability in order to be fully admitted to graduate studies. There are five different measures that you can use to demonstrate your English proficiency; you must meet ONE of these requirements to be fully admitted.</p> <ul> <li><strong>TOEFL: Test of English as a Foreign Language </strong> <p><strong>Specific Requirements: </strong>A minimum score of 500 on the paper-based Test of English as a Foreign Language (TOEFL) or of 61 on the internet-based TOEFL. </p> <p><strong>Conditions: </strong>TOEFL scores more than two years old will not be accepted. </p> <p><strong>For More Information: </strong>See <a href="http://www.toefl.org">http://www.toefl.org</a> for information about the TOEFL. </p> <li><strong>IELTS: International English Language Testing System </strong> <p><strong>Specific Requirements: </strong>A minimum score of 6.0 on the International English Language Testing System (IELTS), which is managed by University of Cambridge ESOL Examinations, British Council, and IDP Education Australia. </p> <p><strong>Conditions: </strong>IELTS scores more than two years old will not be accepted. </p> <p><strong>For More Information: </strong>See <a href="http://www.ielts.org">http://www.ielts.org</a> for information about the IELTS. </p> <li><strong>MELAB: Michigan English Laboratory Assessment Battery </strong> <p><strong>Specific Requirements: </strong>A minimum score of 69 on the MELAB, which is administered only by the University of Michigan and its authorized official examiners in the US and Canada. </p> <p><strong>Conditions: </strong>MELAB scores more than two years old will not be accepted. </p> <p><strong>For More Information: </strong>See <a href="http://www.lsa.umich.edu/eli/testing/melab/">http://www.lsa.umich.edu/eli/testing/melab/</a> for information about the MELAB.</p> <li><strong>SUCCESSFUL COMPLETION of <a href="fixthisshit - eap index">THE ENGLISH LANGUAGE INSTITUTE</a> at The UNIVERSITY OF AKRON </strong> <p><strong>Specific Requirements: </strong>For undergraduate applicants, successful completion is defined as earning a final GPA of 2.7 in a full course of study at the Advanced level or 3.3 in a full course of study at the High Intermediate level AND achieving a minimum score of 480/54 on the TOEFL OR a score of 9 or 10 on the <a href="fixthisshit-asset test index">ELI-ASSET.</a> </p> <p><strong>Conditions: </strong>The English Language Institute is The University of Akron's intensive (20 hour a week) program in English for academic purposes. Courses are offered every Fall, Spring, and Summer according to the university's academic calendar. </p> <p><strong>For More Information: </strong>For details about the English Language Institute, visit the <a href="fixthisshit - eap index">ELI Web Site. </a></p> <li><strong>SUCCESSFUL COMPLETION of ACADEMIC WORK in a US. INSTITUTION of HIGHER EDUCATION </strong> <p><strong>Specific Requirements: </strong>Successful completion is defined as completing 24 credit hours of course work and maintaining good standing in full-time, continuous studies.</p> <p><strong>Conditions: </strong>The credits must be earned at an accredited U.S. university or college in which English is the language of instruction. Applicants must submit original transcripts of their course work and a written request to waive the English language requirement. </p> <li><strong>SUCCESSFUL COMPLETION of a HIGH SCHOOL in OHIO </strong> <p><strong>Specific Requirements: </strong>Successful completion is defined as passing all the sections of the 12th Grade Ohio Proficiency Test. </p> <p><strong>Conditions: </strong>Applicants must submit proficiency test results and a written request to waive the English language requirement. </p> </ul>
I invite your response. If you have anything to share or a question, please feel free to respond in the comments below.
You gotta traverse the TREE table and jump around a little bit on this one. Here’s how I found all of the associated live pages, virtual paths and titles associated with the ‘CBA 2 Column’ template.
SELECT d.title, concat(g.path,d.page_url) as 'path_n_page' FROM template a inner join inode b on a.inode = b.inode inner join tree c on b.identifier = c.parent inner join htmlpage d on c.child = d.inode inner join tree e on d.inode = e.child inner join tree f on e.parent = f.child inner join folder g on f.child = g.inode WHERE a.title = 'CBA 2 Column' and a.live = 1 and a.working = 1 and d.live = 1 and d.working = 1 ORDER BY d.title asc
So we’ve seen in dotCMS 1.9 that UI progress meters aren’t entirely accurate. I was on the horn with Falzone today and he broke off a little nugget that needs to be shared. Let’s say you fire a reindex under the maintenance tab, but you’re suspicious that the UI isn’t responding to you with accurate info regarding your progress. There is a magical database query that will indicate the result of your indexation attempt. By firing the following query, if the count is going down, you’re reindexing!
select count(id) from dist_reindex_journal
In dotCMS 1.7, we were required to hard code a server path describing the location of a Jasper file. Just got some code from Chris Falzone as we move to 1.9 that handles “self discovery” of said file path
String reportsPath = "";
if (UtilMethods.isSet(Config.getStringProperty("ASSET_REAL_PATH"))) {
reportsPath = Config.getStringProperty("ASSET_REAL_PATH") + File.separator + Config.getStringProperty("REPORT_PATH");
} else {
reportsPath = Config.CONTEXT.getRealPath(File.separator + Config.getStringProperty("ASSET_PATH") + File.separator + Config.getStringProperty("REPORT_PATH"));
}
File reportsFolder = new File(reportsPath);
Had a request to pull records from the db for all velocity files modified since Sept 25, 2011.
SELECT
c.identifier as 'identity',
d.mod_date as 'dttm_last_modified',
d.publish_date as 'dttm_published',
d.mod_user as 'user_last_modified',
concat(a.path,d.file_name) as 'file'
FROM
folder a
inner join tree b
on a.inode = b.parent
inner join inode c
on b.child = c.inode
inner join file_asset d
on c.inode = d.inode
WHERE
d.file_name like ('%.vtl')
and d.mod_date >= '2011-09-25 00:00:00'
GROUP BY
concat(a.path,d.file_name)
ORDER BY
d.mod_date desc
We’ve gone through a whole lot doing our dernedest to get the Phone Book importer I built over a year ago in to production and finally it appears we are on the precipice.
Over the past couple of days, I’ve gotten the importer workin in my local env and moved it to our development server. A few things happened on our way in to dev, that gave rise to some work. Pretty much though, I found that the steps I took in the Plugin ReDeployment Gotchas post applied to get this ball rolling with momentum in QA.
Here are the steps we took in getting things going in QA:
- Run through the 2, 4 and 6 in the Plugin Redeployment Gotchas blog post
- SQL to clear out the plugin and plugin_property tables
delete from plugin where id not in ( 'edu.pittstate.plugins.xmltool', 'edu.uakron.plugins.employeeApplication', 'edu.uakron.plugins.gsasearch', 'edu.uakron.plugins.peopleSearchXMLDataMover', 'org.dotcms.frontend.content.submission', 'org.dotcms.plugins.webFormsReporter', 'edu.uakron.conf.viero', 'edu.uakron.conf.warbler', 'edu.uakron.conf.qa1' ) delete from plugin_property where plugin_id not in ( 'edu.akron.plugins.employeeApplication', 'edu.pittstate.plugins.xmltool', 'edu.uakron', 'edu.uakron.custom', 'edu.uakron.plugins.employeeApplication', 'org.dotcms.plugins.webFormsReporter' )
- Confirm java -version is Sun Java 1.6
- Confrim these plugins in /plugins/
- edu.pittstate.plugins.xmltool
- edu.uakron.plugins.employeeApplication
- edu.uakron.plugins.gsasearch
- edu.uakron.plugins.peopleSearchXMLDataMover
- org.dotcms.frontend.content.submission
- org.dotcms.plugins.webFormsReporter
- edu.uakron.conf.viero
- edu.uakron.conf.warbler
- edu.uakron.conf.qa1
- Confirm user jars in /common/lib/ext. These are the jars that get packed up for each plugin. The jars you see in here should match plugins names in /plugins, the plugin and plugin_property tables.
- We communicate with the auth.uakron.edu server to fetch our XML. I discovered that QA1 & QA2 weren’t properly communicating with auth. We found that the ACL (access control list) on auth wasn’t clearing QA1 & QA2 to communicate with it. Systems updated that and we were good to go.
I built a plugin for dotCMS here at UA that eats a 6k record XML document and moves that data in to various dotCMS structures. We were firing the plugin with a JSP, but found that a potential scenario where plugin refiring occurs due to “apache confusion” (which is very bad for how this class is written). Instead we decided to wrap the firing responsibilities up in a Quartz job. I was seeing some difficulties in getting this plugin redployed. We ended up getting with Will down at dotCMS and learned some new steps for plugin redeployment that I thought we might share with the rest of y’all.
Here is the deployer class Java code.
A few notes of how to get that plugin to deploy
- In your plugin conf/MANIFEST.MF file
Manifest-Version: 1.185 Plugin-Name: People Data Mover Plugin-Version: 0.9 Author: Casey Wise Deploy-Class: edu.uakron.plugins.peopleSearchXMLDataMover.PeopleDataMoverDeployer
- You need a line pointing at your fully qualified deloyer class. Note #5 is called out with Deploy-Class not Deployer-Class
- Increment Manifest-Version (#1 above) at whatever decimal point you’re comfortable with.
- Get in to your db and wipe out plugin and plugin_property records referring to your plugin
delete from plugin where id = 'edu.uakron.plugins.peopleSearchXMLDataMover'; delete from plugin_property where plugin_id = 'edu.uakron.plugins.peopleSearchXMLDataMover';
- Wipe out the dotCMS/dotsecure/h2db/ directory from you file system
rm -rf dotCMS/dotsecure/h2db/
- Fire the following ant commands, in the indicated order, from either the command line or your IDE (I use Eclipse)
- ant clean-plugins
- ant deploy-plugins
- start up dotCMS to register your changes
- Write some UPDATE sql to sechdule plugin fire time, like:
Get your unix times with Woldfram Alphaupdate qrtz_triggers set NEXT_FIRE_TIME = '1315621800', START_TIME = '1315621800' where TRIGGER_NAME = 'People Data Mover Job_trigger'