Accessing MDB file from Rails 3 - ruby-on-rails

Just wondering what the best way to access read only information form a Microsoft Access file in a Rails 3 application would be, I know I could convert the data to CSV and then do a manual import into Postgres or SQLite but this data is ever changing as it is used in a business application at my work place and this would mean doing an import a few times a day.
If anyone could point me to a solution then it would be much appreciated.

There are commercial cross-platform odbc drivers for MS-Access I think, but nothing open-source that can reliably read/write (and I could have used them once or twice in the last few years).
If you are on Windows you should presumably be able to use ODBC with a .MDB compatible driver. If not, you might be able to use MS-SQL server as a proxy (there's the "express" free version) or perhaps a java/perl proxy (jackess / DBD::Proxy) but none of these are going to be a simple plug+play solution.
If you're committed to Access then something like EasySoft's driver might be the simplest solution. Worth the money if it works well, but I've no direct experience with it myself.

Although this is an old question, I ran into this problem myself this week and managed to resolve access to an .mdb database from rails using the mdb gem as per:
https://github.com/jkotchoff/heroku_rails_microsoft_access_mdb_example

Related

iPhone app, data layers, & database servers

I found a lot of similar questions out there but none that really answered specifically some of the questions I have. I will be working on an iPhone app shortly that will be accessing data from a database server running windows sql server. I'm not sure what language would be best do write the API in. I prefer Ruby on Rails, but I've read that there are hurdles setting it up with sql server. We could do the API in .net, but I've heard that setting up JSON is a bit of a pain.
What do you suggest? And if I'm doing this the wrong way, let me know the best way. I'm sure most of this is just up to personal preference but I'd love some input.
I dont have much idea about building a JSON api in .NET, but if you are planning to use rails there are couple of options to connect to a SQL Server database from Rails.
a) Use JRuby and a jdbc driver like jTDS . I do want to mention that JRuby is a tad slow when running specs as bootstrapping the rails environment every time takes longer compared to MRI. (this experience based on working in a project couple of years ago, so please try it on your own).
b) Use the MRI ruby with tiny_tds

Desktop Application For Centralized Database Server

I am planning to create a library related desktop application using Delphi 5, for which there would be a single database kept at one place and this application would be installed at different places more over in different cities.
Here, my doubt is Using Delphi 5, is it possible for all the instances of this application which are installed at different cities could access one centralized database? If yes then how?
If anybody is having any other ideas kindly feel free to share it. Because I have familiar to only desktop application development, that is the reason I am asking how these different instances of an application could access only one centralized database ?
So, all the screens and coding would be done using Delphi 5, moreover it would be a desktop application only the difference would be database access would be from different places.
That depends upon back-end database technology. By "desktop application development" u probably mean ISAM databases like Paradox, DBF-family, etc.
If so, then you should quickly learn about SQL, its concepts, ACID principles, etc.
I believe there is a lot of good books in English about SQL in general and SQL with Delphi link in particular. For staring u may try something like http://www.firebirdsql.org/en/books/, but basically you would have to cover three areas:
SQL in general, principles, patterns, etc
Details about Delphi wrt SQL designs.
Details about chosen database server, including components to connect it to Delphi, bugs, gotchas, etc
I think you'd hardly find all that in one book and would have to get two or three.
Then you would have make a network connection between clients and server.
That splits to two questions.
How to find server
How to connect to it
VPN are reliable solution, you may try Windows built-in methods, or simplier methods like TeamViewer, Comodo, Hamachi, etc
But that can make you whole server computer exposed to your clients.
You'd better find not whole-featured network, but a tunnel that would connect clients for database server and nothing else. In russian comunity classic solution to Firebird/Interbase family is http://sf.net/projects/zebedee for Windows. For Linux SSH is usually used.
You probably can find a lot of FAQ in English if you google for "tunneling" and you database server of Choice.

Are there any good Ruby FTP libraries for Ubuntu?

After spending some time on Google all that I've found so far is ChilKat which only runs on Windows. I'm looking for something similar that'll run on Ubuntu. Obviously there's NET::FTP, Net::SSH and Net::SFTP so I could roll my own and that may be what I'll do, but I'm hoping to save a lot of time by using something else that's already been written.
I've asked a similar question:
How to transfer a binary file or any file to a remote server? - Ruby
and my conclusion is pretty similar to yours, the only currently available methods are using the Net::FTP, Net::SSH, Net::SCP (being the easiest solution) and the standard TCP, UDP protocol.
The problem with the latter (TCP, UDP) is that you have to write custom code to slice and dice the binary file and package it in such a way you can send it as a "packet", and on the receiving end you have to authorize it, validate it and unpack the damn packet. This is all very low level computing, and can take time. Unless your willing to spend alot of time experimenting, I would suggest using NET::SSH or SCP, they are the easiest/ simplest solution to date. (Note: At the reciving end an SSH server is required! - Duh.. but just in case you didn't know)
Plus an SSH server is pretty standard, you should have no problems installing it.
There is one last solution, you can use ruby-torrent. Its a beautiful idea, sharing bits and bobs, it can actually make updating a systems a lot quicker (See Here). But do be warned, the project is not very updated, the last release was back in 2005.
Hope that helps
If it is ubuntu, why not make a bash call to sftp from within ruby?

Offline database access under Silverlight-3

As the Silverlight team worked through the betas, one glaring pain point that is existing in the realm of Silverlight 3 is the ability to have an offline database, so that you can right-click on the SL application, install it locally, and then be able to manipulate data in a local setting, without the Internet.
I've read a few articles where items such as Google Gears with SQLite had been used, but so far, no one has come up with a decent method by which someone can do the same thing with a SQL CE database.
I'm theorizing, and wanted to gain feedback... So many times, with LOB applications, you have the need for installing a "driver" into your system, which winds up being some sort of data access component or other monitoring device used by the LOB application. What I'm thinking about is to use a ClickOnce strategy and build a driver that would get installed on the local machine, and then make a "local" webservice for when the user is offline.
Has anyone tried this scenario, and if so, what were the pros/cons of the method? If you didn't finalize on this method, then what was your final decision based on experience, and what would you advise going forward for someone trying to crack this nut for their project?
Here's the best I could find for a SQLite-ish experience:
http://silverdb.codeplex.com/
I've been trying for supporting the direct database access in Silverlight since five or six months back. After exploring quite a few different to port the database to Silverlight, we got one POC working with one object database but it's a bit far for us to release it... I may probably write about this in my blog soon.
I dont think that making a "local" webservice is a good idea since the clients may not have any web service installed on their machine.
Thanks to Jeremy Likeness, there seems to be a great open-source project that he developed which may indeed solve most of my problems... just need to figure out how to render reports without a callback to the server, and then I'm golden, when it's time to revive this project (if all goes well, that'll be sometime in 2012)

Can you Distribute a Ruby on Rails Application without Source?

I'm wondering if it's possible to distribute a RoR app for production use without source code? I've seen this post on SO, but my situation is a little different. This would be an app administered by people with some clue, so I'm cool with still requiring an Apache/Mongrel/MySQL setup on the customer end. All I really want is for the source to be protected. Encoding seems a popular way to go for distributing PHP apps (eg: Helpspot).
I've found these potential solutions:
Zenobfuscate - not all types of Ruby code is supported however, so that counts that out
Ruby Encoder - may be the best option, as their PHP encoder looks alright (I haven't tried it however) but it's not available yet. I've used IONcube for PHP before and it worked well, but it doesn't seem that IONcube is interested yet.
Slingshot - it was mentioned in the other SO post, but it solves a different problem to mine and the source is still visible.
RubyScript2Exe - from the doco, it's not production ready, so that counts that out.
I've heard that potentially using JRuby and distributing bytecode might be a way to achieve this, but I've never used JRuby so I'm not sure what's involved.
Can anyone offer any ideas and/or known examples? Ideally I'd love to have some kind of automated build scenario as well.
Your best option right now is to use JRuby. A little bit of background: My company (BitRock) works with many proprietary and commercial open source vendors. We help them package their server software, which is typically based on PHP, Java or Ruby together with a web server or application server (Apache, Tomcat), the language runtime and a database (typically Postgres, MySQL) into a self-contained, easy to use installer. We have a large number of PHP-based customers (including HelpSpot, which you mention) but also several Rails-based ones. In the case of the RoR customers the norm is to use JRuby together with Tomcat or Glassfish although in some cases we also bundle a native Ruby interpreter to run specific scripts that rely on libraries not yet ported to JRuby (usually not core to the application). JRuby has matured quickly and in many cases it actually runs their code faster than regular Ruby. You will need to also consider that although porting your code to JRuby is fairly straightforward, you will need to invest some time on that. You may want to check JRuby Stack which is a free installer of everything you need to get started. Good luck!
If you release the source, obfuscated or otherwise, your app will be pirated. See, for example, Mint. It depends on what you're building, but you may find that you're better off releasing the app as a hybrid of sorts: A hosted app with a well-defined API, and a component that runs on the customer's server. As long as the true value of your product lives on the server side, you don't need to obfuscate your code, and you can just release the source code unmodified. Additionally, this may also give you the opportunity to reach clients running, say, PHP rather than Ruby. See, for example, Google Analytics, HopToad, Scout, etc, etc.
You can, but it wouldn't do anything to prevent somebody from reverse-engineering or modifying it. I remember there was an article about similar attempts to obfusticate Perl and how they could be effectively bypassed by a debugger and 5 minutes of effort.
If you can't wait for the delivery of RubyEncoder, then I think ZenObfuscate is the most promising. Though it may require some modifications to your source code, they do say this on their site:
ZenObfuscate costs $2500 for a site license or is individually negotiable for other licensing schemes. Yes, that is expensive. That was on purpose. But don't let that thwart you too much. If your product is really cool and we want to see it succeed, we'll make it work. "Really cool" is not freecell.
Of course, for $2500 (or more), you'd hope to get a few tweaks to the compiler that'd make your codebase fully supported. It might be worth engaging them in the conversation.
You can also take a look at Mingle from ThoughtWorks studios as an example of using JRuby for this.
It's a Ruby on Rails app, they run it using JRuby. They've customized jruby to load encrypted .rb files.
Take a look at JumpBox.
I've had conversations with them on the topic, and they seem to have a solution that will work soon for Rails apps.
I'm wondering if you could just "compile" the ruby code into an executable using something like RubyScript2Exe ?
To be honest I haven't used it but it seems like it could be what you want, even if it just packages up the scripts with the interpreter into a single executable.

Resources