SQLite with MFC - sqlite

I want to use SQLite within my MFC application.
for that, i'll create an object whose job is to interact directly with the DB(SQLite) to insulate the rest of the app from the DB code.
can anyone point me to a good tutorial ?
i'll need operations such as (create,delete,insert,update,createdb,dropdb and so on...)
Thanks.

There's a page in the SQLite site that lists many available wrappers - here. The C++ wrapper Daniel mentions in his answer is probably the most common one, though it does not support Unicode and the SQLite dll that comes with it is quite dated. There's a Unicode version of that wrapper here, but it's a bit buggy and requires some more work. It could, however, save you the trouble of writing the whole thing from scratch.

Have a look at this. This was really easy to port to MFC classes, but it will get you started.
http://www.codeproject.com/KB/database/CppSQLite.aspx

Or you can just do #include "sqlite3.h", add sqlite3.lib to your linker and use sqlite3.dll directly with the C api. That's what I did in my MFC app.
And you can even statically link sqlite3 into your app. Download the amalgamation and include it! It adds about 400 k.

Please define your problem more clearly.
sqlite can be coding with c, and you can read the sample in their site.

Related

Possible to search through all JSPs in Adobe CQ5 repository with CRXDE?

We have a couple of relatively simple websites running on Adobe CQ 5.5 that were developed by a third party. I'm pretty familiar with how CQ works, but I'm working with somebody else's code here and I need to be able to search through all components in the system for a particular string.
The issue is that I can't seem to find a way to search across all of the various .jsp files stored with the various system components. I would have figured that the query tool in CRXDE Lite would have done the trick with something like this:
/jcr:root//*[jcr:contains(., 'Find this exact string in a JSP')] order by #jcr:score
But I've had no luck.
What I am looking for is some sort of global search that includes JSP files. Is that possible? Were I using a regular Java system, any IDE worth the download would be able to do this.
Thanks.
Might not be easiest way, but you can use the VLT tool to checkout the repository into your filesystem. Then you can lookup using whatever tool you prefer. It might even be faster in the long run
I don't have the actual answer but I suppose the JSPs are indexed via a filter that strips out some of their content.
It should be possible to configure the repository to index them as is instead, based on the info at http://wiki.apache.org/jackrabbit/IndexingConfiguration and http://jackrabbit.apache.org/jackrabbit-text-extractors.html
Sorry about the vagueness of this answer - I know the basic principles but to provide the details I would need more time than I can afford now ;-)

Avalonedit Show syntax error

when I develop a custom language IDE using avalonedit, I encountered a problem. I use regex to check the syntax, and it works as designed. However, I want to show the syntax error with wave text mark. I did search at google, yet the solution is either outdated or not feasible. Any ideas? Thanks ahead.
AvalonEdit does not have this functionality built-in. However it provides all the infrastructure needed to implement it yourself. In the SharpDevelop IDE we have an implementation that should suit your needs.
You'll need some of the code from the SharpDevelop repository (https://github.com/icsharpcode/SharpDevelop/):
TextMarkerService, TextMarker
and its related interfaces and enums.
To make it easier for you, I have created a small sample application:
https://github.com/siegfriedpammer/AvalonEditSamples/tree/master/TextMarkerSample
It uses the AvalonEdit 5 nuget package and contains the classes mentioned above, plus a WPF Window to test it.

How to use FTS in SQLite with Monotouch for iOS

I'm looking to build an iOS app using Monotouch that has a rather large sqlite db full of text. I need to provide fast searching over this text.
My best solution right now is the FTS module (preferably version 4). I have read that the default instance of sqlite on iOS does not support FTS. If this is true what is the recommended way to build a custom instance of sqlite with Monotouch? Or can this be done at all?
I found this site describing how to accomplish this with xcode, but it is not clear how I would accomplish with Monotouch.
http://longweekendmobile.com/2010/06/16/sqlite-full-text-search-for-iphone-ipadyour-own-sqlite-for-iphone-and-ipad/
Any help is much appreciated!
As I mentioned in my comment above I got this working and since Stack Overflow has really helped me out I wanted to contribute a little to give back to the community.
Disclaimer
This is coming from a .NET developer who is a N00B when it comes to iOS/MacOS/XCode/Monotouch.
Although I tested this out on the iPad simulator I have yet to test it out on an actual device.
End disclaimer
This is a quick how-to compile your own version of SQLite and include it in your Monotouch project with the goal of supporting Full text search.
Step 1:
Download the SQLite amalgamation file.
This includes all of SQLite in one file.
http://www.sqlite.org/download.html
Step 2: Compile the SQLite source in Xcode for iOS.
There is a good walkthrough on how to do this here:
http://pp.hillrippers.ch/blog/2009/08/08/Static+SQLite+Library+with+Unicode+Support+for+the+iPhone/
I followed steps 1-5, skipped #6 since we're not adding additional headers.
Instead of using the compile flags used in the walk through I used:
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_ENABLE_FTS4
There may be others you want to add as well.
These compile flags are added in XCode, to the "Build" tab of the project under "Preprocessor Macros".
Once you've compiled this you should have "mylibrary.a".
Step 3: Include this file in your MonoDevelop project
Add mylibrary.a into MonoDevelop as any other file, right click it and make sure the build action is 'Nothing'.
In your project options select "iPhone Build". You need to add additional mtouch arguments. Add the following
-gcc_flags "-L${ProjectDir} -lmylibrary -force_load ${ProjectDir}/mylibrary.a"
Step 4: Build a c# wrapper
You could probably find a good wrapper to include at this point but I just quickly rolled my own.
For a good tutorial on writing an SQLite wrapper in C# check this page out:
http://www.switchonthecode.com/tutorials/csharp-tutorial-writing-a-dotnet-wrapper-for-sqlite
Because your library is a part of the project you don't need to reference the library by name but instead use the "__Internal" keyword. *NOTE THERE ARE TWO UNDERSCORES IN "__INTERNAL" * (Don't ask me how much time I wasted before I realized that)
Here's a sample of one of mine
[DllImport ("__Internal", EntryPoint="sqlite3_open")]
static extern int sqlite3_open_v2(string filename, out IntPtr db);
There's obviously a lot more to putting together a wrapper, but there's lots of info out there on how to do that. One gotcha is to properly marshal the strings you get returned from SQLite. (see http://blog.gebhardtcomputing.com/2007/11/marshal-utf8-strings-in-net.html for more info on Marshaling)
This was intended to be a quick walkthrough on getting a native library compiled in into MonoDevelop/monotouch, and I hope it helps someone.
You would have to do the same thing, build your own libsqlite3.a, and mangle all the public exports so it doesn't conflict with the libsqlite loaded by the system, and then you would need to modify whatever library you want to bind to sqlite to [DllImport ("__Internal")] instead of libsqlite.

Updating a Sharepoint List from flex

I have been trying to find a way to connect Flex to sharepoint in an elegant way that allows me to update lists, build charts, and create widgets with FLEX on the client-side. I have researched this extensively but I am running into circles.
I understand the basics of Flex data connection/webservices/etc... , I just can't seem to get my head around how to use the sharepoint list services.
Does anybody out there have a nice detailed example of what I'm trying to achieve? Simple examples work too! :)
Thanks so much Everyone!
-E.
Look at the "SOAP query example" or the WSDL from the SharePoint web-service (e.g. .../_vti_bin/lists.asmx?op=GetListItems or ../_vti_bin/lists.asmx?op=GetListItems&WSDL) and then look at the corresponding MSDN documentation (such as GetListItems) on how to "use" the web-service.
It takes a little bit of familiarity to "know" to map viewFields with <viewFields>...</viewFields> (most work like this), but... the MSDN documentation (if prodded carefully) says "what" to put in the XML where the WSDL just gives the near-useless outline. There are a number of examples in the tubes (and related SO questions) of hand-rolled SOAP access for SP for various tasks.
Microsoft also has some Open Specifications -- the link is always hard for me to find. Lots of stuff under the SharePoint branch. YMMV and it's mostly white-paper, but a good resource.
Not sure what tools Flex has but because of the limited WSDL support, most of the mapping has to be hand-coded or come from a better definition source -- hopefully "an existing library" which can be used directly or modified-to-suit.
I would highly recommend using a tool for testing the service access -- e.g. soapUI, which actually has a horrid UI -- because even the littlest error will come back with a cryptic error messages. Also, make sure to use SOAP 1.2.
Happy (less than maximal pain) coding.
P.S. A more specific question about a specific web-service would likely yield better responses.

Checkstyle for ActionScript (Flex)

HI,
I'm currently working on a project that uses Flex and Java. In Java we easily enforced a coding standard with Checkstyle, and we want to do this for Flex.
Does anybody know of a tool similar to Checkstyle that would allow coding standard checks?
(I've googled for this but found only one project written in python and it seams abandoned)
Thanks
The long and the short is that there is... kind of, but only for Actionscript, and you have to test it yourself... There is a prototype of an Actionscript 3 version, but it is not even in Beta yet (and I admit that I haven't had the time to test it). I haven't found anything similar for XML, let alone MXML. This is in at least one list of feature requests for Flex 4, however.
I'm working too on a project uses Flex and Java. Like you, in Java, we easily use plugins like checkstyle, findBug, javaNcss or PMD. My personal project is to do this for Flex. I have test the prototype 'checkStyleas3' but it just verify the code source en returns you 0 or -1 as result. So you will have (me too in fact), to implement this prototype if you want to do more than that.
Keep an eye on this : http://blog.joa-ebert.com/2009/05/20/as3v-preview/

Resources