Retrieve the amount of lines in a Flex project - apache-flex

This might sound useless, but just for the sake of information (and for fun to be honest :) )
Is there a way to find in Flash Builder the amount of lines written in a Flex project?

There is a good answer here on how to do the same with IntelliJ and Java: How to count lines of Java code using IntelliJ IDEA?
where the 'Find In Project' feature is used. For IntelliJ this is:
Ctrl+Shift+F -> Text to find = '\n+' -> Find
The search must be set to find based on a regular expression. '\n+' indicates to look for lines that are not empty
So you can adopt this method to FlashBuilder / Eclipse - I am sure it will have a similar feature. Try Ctrl+H.
Alternatively, load your Flex project into IntelliJ.

Related

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.

Flex application versioning

I'm not referring to CVS or SVN! The thing I would like to do is:
I want to have a version number of the application ex. 0.0.120
I want to see this version number only in the About box or similar
This version number should change everityme I hit debug or release. ex. my version was 0.0.120, after I hit debug in the FlexBuilder, the versionNumber should change to 0.0.121, but If I press Release Build, then the version should change to 0.1.0
The first number changes only when I manually change it
Don't know how is this possible but if you have a tip, let me know. Thanks!
Have a look at this article http://www.igorcosta.org/?p=220. I use this method to keep tract of compilation date of my swfs.
Credits goes to Paul Sivtsov.
I think Flex Builder doesn't have this out of the box, but you can build ant script for that and build your application with it:
http://blog.nirav.name/2008/02/how-to-auto-increament-version-build-id.html
This is typically something you support with frameworks such as maven.
There is actually a maven plugin for flex here
mico's trick is nice though

How do I fix an inconsistent linkage error in flex 3?

I was excited to find out that Adobe released the data visualization for free so I can use the fancy charts and all with my projects even though I don't have Flex Builder Professional. So I installed the new 3.4 sdk along with the data visualizations. Most all of my projects did fine except for one. This particular project uses localizations. Are there any new compiler arguments that I need to include? I current have -source-path=locale/{locale} -allow-source-path-overlap=true. I get the inconsistent linkage error below:
Inconsistant linkage in /Applications/Adobe Flex Builder 3/sdks/3.4.0/frameworks/locale/en_US/datavisualization_rb.swc$locale/en_US/core.properties - 'en_US$core_properties' is marked as extern, but 'en_USGBC$core_properties' is not.
Any help would be appreciated.
Try use -locale en_US

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