Connect to MySQL directly from an iPad app (not via PHP, etc.) - mysql

Before anyone has a chance: Yes, i know it's a bad idea. Please, don't give me a lecture on how i should use a web service instead. Thanks.
So, how could this be done?
I found this bit http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/ and thought it might do the trick. I got a bunch of ARC error messages, cleaned those out and got this error at runtime:
Detected an attempt to call a symbol in system libraries that is not
present on the iPhone: pthread_cond_init$UNIX2003 called from function
my_thread_init in image oms.
Do i need to use something like ODBC/C?
I know that the solution might be a lengthy one, that's fine. Would be great if someone could at least point me in the right direction.
EDIT:
Since people are keen to know the reason for opting not to use a web service, here it is:
If you're creating an in-house app, the added security of a web service is next to nothing. Working directly with the DB means i need to maintain less code. Plus i don't need to create hacky PHP scripts to get things done.
FINAL CONCLUSION:
I wanted to leave a message for people who're about to do the same thing: Don't :)
Essentially your options are hacky server side scripts or Oracle proprietary mysql client you built yourself (and thus a hacky solution as well). Your choice but i'd strongly advice against it.

This might be the sort of thing that you are looking for:
mysql for iphone and osx
I found it on this iphonedevsdk thread access mysql remote database iphone
Personally I would be only doing this if you really really wanted to.
If you wanted a canned solution, I also found this: Flipper
Or to do it yourself: Build MySql client library for iPhone/iPad
Its not really that hard to find a number of solutions

I needed the same thing (I understand your lecture-pain ;) ) so I wrote this: https://github.com/ciaranj/MySqueakQl it doesn't link to the mysql client libraries so no GPL issues, but it is a very minimal ... very 'fresh' i.e. untested implementation ... just my 2c.

I faced the same problem as you did. I searched and find this.
In http://www.acapela-for-iphone.com/ios-4-2-gm-small-problem-with-simulator
Jean-Michel Reghem Says:
"It seems that Apple changes (again) something into the simulator (as in iOS 4.0)."
Also some people in that page say that this problem didn't show up in device, you can try.
The author has updated his code, and it worked.
Here is the link: http://www.karlkraft.com/index.php/2011/06/07/mysql-for-iphone-and-osx-version-2-0/

Related

AS3-Spod Example or tutorial? or any other AS3 ORM

Does anybody have any experience with as3-spod?
I downloaded the source code from github and as3-signals and started to try it out, but I´ll take ages to get to know the framework by trial and error and probably miss a lot of best practices. The framework looks good but lack's on examples. The git page does't have a lot of info on that...
If anybody knows some other ORM for AIR that I can use on pure AS3 projects that have any bit of documentation, I´m more than thankful!
I was hoping to do a question-comment asking for clarification, but I don't have enough reputation yet! So I will answer as best I may.
I am using as3-spod for my application. It's been pretty reliable and mostly given me what I want. It's not really ideal, though. What I'd really like is something more ActiveRecord-like, or something original that lets you generate queries by concatenating conditions in a fluid syntax.
But if you're not using Flex (as I'm not, and you're not) then your options are pretty thin, as most of the other AS3 ORMs out there rely on some part of the Flex framework. Apart from as3-spod, the only possibility I could find was Christophe Coenraets' proof-of-concept but as he points out, it would need a lot of work to develop it into a fully-fledged ORM:
This is still a simplistic proof of concept and is by no means a production ready ORM solution.
And I haven't had time for that.
You are right that as3-spod is quite poorly documented. I guess the main class you want to look at is SpodTable. It's from that one you do inserts, selects, etc. An update on a single object can be done from the object itself. Look out for the various signals on SpodTable (select, selectAll, etc). To get going with it, just mark up a model class with metadata, then from your SpodDatabase instance call createTable(MyModelClass).
My main gripes with as3-spod are these (I'm listing them so you don't look for features that don't exist, which I wasted a fair bit of time doing!):
It works asynchronously. Doesn't matter if your actual SQLConnection has been opened synchronously or asynchronously; you have to listen to signals. That means you can't retrieve records and then use them straight away in the same method, you have to listen to signals. What I tend to do is to do large selects when the app starts, then filter the data in memory rather than doing complex queries. Pretty annoying.
Be careful with null values for numeric columns. I can't see a way of setting NULL or NOT NULL for columns using as3-spod; it always seems to make them NOT NULL, which will cause errors if you try to insert a row from an object with null fields.
There's no migration system (a la Rails). I am working on rolling my own as that's an essential feature for my purposes (it's a mobile app I'm developing).
Good luck! Let me know in comments if there's anything else specific you'd like me to cover and I can expand this answer.
EDIT
I've just noticed the existence of AS3SQLite. Haven't used it yet but, looks like there are other possibilities out there :)

Reverse engineering a QuickBASIC 3.0 program

I have a program (I own the rights) written in QuickBASIC 3.0, though I do not have anymore the source code.
Anyone know a decompiler that I can use to see what the program does?
Basically it gets some numbers in input and it performs some calculation, showing some results. Nothing too complicated.
Thanks
I haven't seen any publicly available tools but there's a page from a guy who claims to have made one. You could try contacting him.
I wouldn't recommend trying it on your own if you don't have any experience in reversing DOS programs. It seems QuickBASIC 3.0 was compiled into some kind of p-code. I've never seen any research on the DOS-era p-code, but it might bear some relation to the one eventually used in Visual Basic 6.0, and that one has been investigated quite a lot.
If you vaguely remember the idea but don't remember the details (e.g. actual values of coefficients in the formula), one thing you could try is to enter some numbers, read the results, and save them in an Excel sheet. Repeat that a couple of times and try to plot the data. Not much, but might help.
Use the debugger of Borland C++ 3.1, but you are going to need knowledge of assembler...

Arguments for/against using a third party "Rapid development environment"?

I just started working for a company that uses a "Rapid Development Environment" (RDE) supplied by a third party. The idea is that you can specify things like: "display data in grid", "datasource", "sort by" and it generates an a ASP.NET application that does all of those things.
I'm personally not a huge fan for the following reasons:
You are at the mercy of the RDE with
regards to what level of control you
have. For example there is no
try/catch/fail mechanism.
If there is a bug in the RDE there is
nothing you can do, you have to wait
for them to release a fix.
I'm not sure that it speeds things up
all that much.
There is no way you are going to find
someone with X years of experience
using some backwoods RDE. Every new
employee is starting from scratch
You can't integrate many common tools with it. Source control would be an example of this. While i'm sure I could take the EXTREAMLY verbose xml files used to generate the application and manually insert them into Source control there is no way for me to just right click and checkin. Even if I do that there would be nothing meaningful displayed if you do a diff...
Has anyone found these things useful? They seem like a gimic to keep costs down to me...
I don't use any tool/framework/environment/etc that I cannot bypass whenever I want to.
I don't care how good the product looks on paper or what impressing demos I'm shown.
If the product isn't mature and expressive enough to offer the possibility to work around it or hack/plug into it, I'll pass.

Reverse engineering to get answers

So I've spent the last few days looking for a way to create a simple image drawing app with wxPython, and I think the key to doing just that is understanding how to use Device Contexts. The problem is that the wxPython demo program doesn't demonstrate DCs, and the docs for both wxPython and wxWidgets don't explain as much as I'd like to know so I've decided to try and 'reverse engineer' an existing app to see how its done.
The first problem I have is that I don't know of any drawing apps written in wxPython (or any written in Python for that matter o.o), and the second is I don't know how I'd go about doing it. Am I right in saying that I'm going to need a copy of an application's Python source and something like Winpdb? What do professional programmers do when they find themselves in a situation like mine, needing answers that the docs don't provide?
If you need to understand the concepts, but the docs don't cut it, it's worth it to look at docs for similar APIs. In the case of drawing contexts, there are a lot of similar APIs in other languages. Java has Swing for instance.
Reverse engineering is easier in tools that aren't big event-driven GUI things. The converse is that event-driven GUI things tend to copy each other, so you only need to figure them out once or twice before they all make sense.
In .NET world, I have Reflector as indispensable tool.
In my company, we use to program SharePoint websites. There are many "gotchas" we just figure out by reverse engineering that product assemblies, exactly because documentation is plain wrong, just missing or simply doesn't exists.

What is the best way to implement 'Excel like column sizing' for an HTML table?

I want to allow the user to resize columns in an HTML table, using the same method as you would in Excel. Drag the space between columns and size.
I did some research on this last year, and found a few hacks and kludges. Most were pretty bad, and I didn't find anything really good. Now, it looks like I need to implement this functionality, and want to do it right, so before I start this again, I just thought I'd ask if anybody else has done this, and how they did it.
I believe I've seen a FogBugz demo video where they had this implemented. So I know it can be done well.
BTW-I'd prefer not to use any open source frameworks, since my client may sell this app in the future.
I've built a html grid myself in the past and having done so my best advice would be: use someone else's.
I've looked at this jquery grid control in the past but have never got around to trying it out:
http://www.trirand.com/blog/
Google Docs spreadsheet application does what you are looking for. That may be worth looking at, but their code is very dense.
The extjs framework provides the functionality you need. I can not tell (I am no lawyer) whether their license is suitable for your customer or not. However, it appears possible for you to purchase a license from them which allows you to not have to publish your customers code as open source. This may suffice.
I would suggest that you develop your application using extjs in parallel with investigating the license. if the licensing suits your customer, you're done, and you win by using a stable and high-quality platform. If your can't make the license work for your customer, then you have to port to something else, but at least you will already have a high quality first prototype to work from, so the effort to produce the product will be less. And meanwhile you have a very nice prototype while refining the interface