In the app I had been working on users had to perform a great amount of scanning. In the first few iterations this was done manually, which, of course, lead to lots of user error (namely scanning documents at high resolutions, which clogged the system). It was decided that it was best if our app to control the scan settings for most users. So we found three possible Active X controllers available to allow for this functionality. , , and . After a little research we found that VintaSoft didn’t quite meet our needs and that CianSoft’s TwainX controller and ChestySoft’s were eerily similar (it turns out that each company is run by a brother and both products were just different flavors of the same one). In the end ChestySoft was the one we went with because it allows you to perform posts of the scanned data to the server (and the guy that runs the company is super responsive when you have questions).
Blog
Merging Adobe PDF’s and generating a table of contents on the fly using ruby
July 21st, 2008 by Joseph JakutaSo let’s say you have some random PDFs and what you want is one PDF that includes all of the original PDF files and a table of contents listing all of the files and the proper page numbers. Well in Ruby it is not too hard to put this together. There are a wealth of plugins, gems, and other ruby software available for manipulating and creating PDFs (a thorough list can be found here – ). To get this project up and running we are going to use two PDF::Writer () and PDFTK () – though if you want to get fancier and also include text, html, or xml documents you can use PDF::Htmldoc () which requires Htmldoc to be installed. Before I do get started though, I also have give thanks to George Anderson over at who wrote a lot of similar code on the project which provided me with some great examples.
Merging a :has_many relationship into one instance
July 10th, 2008 by Joseph JakutaSo the problem is that I have an ActiveRecord model that has a :has_many relationship to another model (we’ll call this one object), but when I am in the view context I didn’t want to have to loop through the object each time to determine which data was being displayed. Object has many attributes (approximately 30) and many are often null for a given instance. So I decided to add a method to my model to loop through all of objects and determine which data should be included. Pretty much the rule was that if there was no data for a particular attribute temporarily save it to a copy of the object and then return that. This is what I came up with.
def object tmp = objects.first objects.each {|o| tmp.attributes.each {|key, value| tmp[key] = o[key] if value.blank? && key != 'id'}} tmp.freeze end
However there was a flaw here. Every time I would view the page all of the data in the objects was getting overwritten with one copy of it. After banging my head on the desk it was realized that tmp[key] = o[key] was actually writing the changes to the database permanently rewriting all of the objects (which still seems counter intuitive to me, because it seems like only the first record should have been the one changing). But the solution was pretty simple. The working method is as follows.
def object tmp = Object.new objects.each {|o| tmp.attributes.each {|key, value| tmp[key] = o[key] if value.blank? && key != 'id'}} tmp.freeze end
Reading and replacing text in Word DocX and Excel XlsX documents using Ruby
July 9th, 2008 by Joseph JakutaSo as you may know. The new Word and Excel formats are similar to open office document formats in that they are just zips of multiple xml documents (well mostly xml documents). So what we wanted to do for our project (the WebDav one mentioned in my last post) is to set up a simple templating system that would do variable replacement in Word/Excel documents. And it turned out to be a piece of cake. I am just going to go through the DocX version of template model, but the only difference between them is the folder structure so there is not too much to change to get this working for both.
Microsoft WebDav opens document as Read-Only when using RailsDav
July 1st, 2008 by Joseph JakutaI had been working on a project in which we wanted to utilize WebDAV (namely for editing Word & Excel Documents that were saved in our application). In order to do this we decided to use a plugin from that can be found . It was pretty easy to hook up after a little direction from a guy over at Benryan Inc [apologies I cannot find a link for them], but there was a major issue. When opening a document through the ActiveX controller for editing it was opening in Read-Only mode.
After a few starts and stops, many hours of reading through the , and browsing through the http traffic using – it was determined that locking was the issue.
SLS Welcomes Joseph Jakuta
May 16th, 2007 by Yair FlickerSmartLogic Solutions welcomes to the team. Joseph bring many years’ experience in software programming to the company. Joseph’s first task will be to learn Ruby on Rails in an effort to continue to build our company’s proficiency in RoR. Joseph spent the last few years working for the .
-
You are currently browsing the archives for the Joseph Jakuta category.