SQLite Database and TLF Text in Flash CS5 - sqlite

I encountered the following problem when working with the built-in sqlite database and using TLF TextFields in Flash CS5
When I tried to use TLF TextFields alone, I don't face any probelem,
but when I start using a database connectivity code, the TLF TextFields placed on the stage are not shown, but instead, the SWF file is showing the built-in preloader with five dots looping.
I tried changing the default Linkage in ActionScript 3 Settings to Merge Mode, but in this case nothing is shown, not the textfields, neither the preloader.
I think the problem is related to loading the TLF Text Engine, but I couldn't figure out what to do.
The following is my code placed in first frame:
==========================================
import flash.data.SQLConnection;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;
import flash.filesystem.File;
var conn:SQLConnection = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, openHandler);
conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
// The database file is in the application directory
var folder:File = File.applicationDirectory;
var dbFile:File = folder.resolvePath("DBSample.db");
conn.openAsync(dbFile);
function openHandler(event:SQLEvent):void
{
trace("the database was created successfully");
}
function errorHandler(event:SQLErrorEvent):void
{
trace("Error message:", event.error.message);
trace("Details:", event.error.details);
}
stop();
==========================================
and I am using one TLF TextField on the stage for later use.
Publish Settings>> Player: AIR 2.6
The file textLayout_2.0.0.232.swz exists in the same appication directory.
and not to forget, when I test the file using Contol Panel >> Test in Air Debug Launcher (Desktop) the file is working correctly.
but when I open the generated SWF file, the problem appears.
I already reviewed many articles but no one is closed to this problem.
I hope that I find some help
Thanks.

Related

'BitmapStub' does not exist in the namespace 'Android.Graphics' Using Xamarin.Forms

I implemented a application for Sunmi T1 mini device in-build printer in Xamarin forms and i want to print a image with some text like billing receipt.
I integrated AIDL file for Sunmi T1 mini device you can see in image.
But i am facing namespacing issue in IWoyouService.cs "the type of namespace name 'BitmapStub' does not exist in the namespace 'Android.Graphics'."
case TransactionPrintBitmap: {
data.EnforceInterface (descriptor);
Android.Graphics.Bitmap arg0 = default (Android.Graphics.Bitmap);
arg0 = Android.Graphics.BitmapStub.AsInterface (data.ReadStrongBinder ());
ICallback arg1 = default (ICallback);
arg1 = ICallbackStub.AsInterface (data.ReadStrongBinder ());
this.PrintBitmap (arg0, arg1);
reply.WriteNoException ();
return true;
}
I attach my AIDL Zip file https://drive.google.com/file/d/1lrCgZwDrfyqs6LAwTP3pQ6nMzYIW4hrY/view?usp=sharing.
How can resolve this error in Xamarin.Forms
I had this exact same problem, and managed to solve it by adding another AIDL file to define what a 'Bitmap' is.
I copied this file from the Android Open Source Project and just added it into my project and set the build action to Android Interface Definition like the other Sunmi AIDL files.
Not sure why Xamarin doesn't manage to handle this automatically, but adding this solved the problem for me and I was able to build and successfully invoke the interface methods that accept bitmap parameters.
In case the link ever goes bad, here is the entire file you need to add - it's very small:
/* Save this in Bitmap.aidl and add to your project alongside the others */
package android.graphics;
parcelable Bitmap;

GUI made using JavaFx that uses File Input/Outstream - Can it be exported as JAR and open .txt file?

I am trying to export a GUI (Student Grade Manager App) I created in eclipse as a JAR file and run it on my desktop. Nothing happens when I double click it (though it does successfully export) at the moment. Here's an screenshot:
GUI Screenshot - Click here
I'm assuming the main issue here is that in my GUI, I am using the File Input stream in the CourseSectionApp.java file (Where the main method is located). It reads a .txt file called "StudentMarks.txt" and that's where it gets all its student data from.:
BufferedReader aFile = new BufferedReader ( new FileReader("Marks.txt"));
model = CourseSection.loadFrom(aFile);
Is there anyway to get this to work? Can I have the .txt file just export with the JAR file so it loads together? OR is there a way to put a sub-window, like modern applications have where the user can go to File->New-> and say, "load from file", and then be allowed to navigate to the .txt file on his computer?
My main goal is to be able to email this to friends and have them use it, but I googled around and only found a few people having similiar issues with not-so-clear answers. And if the JAR file cannot do this, what can? Will making it a .exe change anything?
Screenshot of Marks.txt file
I tried to make this question as legible as possible and if there is any other information I can provide you guys, please let know.
If you don't need to write to the file, including the file as resource in the jar would be your best option. This way you can always be sure the file is available via jar entry name. E.g.
try (InputStream is = getClass().getResourceAsStream("/data/Marks.txt");
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr)){
model = CourseSection.loadFrom(br);
}
If you also need to write to the file, you can use FileChooser to open a dialog for choosing a file:
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Marks File");
fileChooser.getExtensionFilters().add(new ExtensionFilter("Text Files", "*.txt"));
File file = fileChooser.showOpenDialog(null); // you could also pass a owner window here
if (file != null) {
// TODO: handle completed file selection by user
}
The issue described in the comments indicates that there is a problem with the classpath though. You need to make sure all required classes are available when the application is run...

Load Animated gif file using QMovie in Ubuntu

I am new to Ubuntu & Qt. I need to show busy status for other long operations. So, I was just trying to use waiting animation gif files to load instead using Progress bars.
I am using Eclipse Editor for Qt project.
Trolltech/../imageformat folder contains libqgif.so and libqgif.so.debug. I have copied these files in my debug folder too.
loader.gif is added in qrc file and kept in /Resources folder
IN MainWindow class I have added label and after setupUi(this) been called I call my ShowMovie() function as below:
ShowMovie() {
QMovie *movie = NULL;
movie = new QMovie(":/Resources/loader.gif");
if(movie->isValid()) {
ui.label_3->setMovie(movie);
movie->start();
}
else
qDebug()<<"Movie is Invalid";
qDebug()<<QImageReader::supportedImageFormats ();
}
Always isValid() function returns false & I got message that Movie is Invalid.
Last qDebug() returns
("bmp", "gif", "ico", "jpeg", "jpg", "mng", "pbm", "pgm", "png", "ppm",
"svg", "svgz", "tif", "tiff", "xbm", "xpm")
i.e means gif support is available.
I have tried to call ShowMovie() function before loading Main UI and/or on button clicked. Both fails.
Provide help on what is to be corrected.
Thank you.
you don't need to copy librairies files *.so.
Try creating the movie object with the full path to loader.gif. Does it work?
Then you have not setup correctly your resource system.
Either you have a syntax mistake in the qrc file which need to be fixed or you forgot to add it as a resource in the project file (.pro) using
RESOURCES = myqresource.qrc

Saving a file in Flex Air

I'm trying to copy my SQLite file that is used in my Air app to user's selected directory using
var fileSaveDest:FileReference = new FileReference();
fileSaveDest.save(dbWorkedFile,'Inventory.DB');
dbWorkedFile is a File
dbWorkedFile = File.documentsDirectory.resolvePath("Inventory.db");
I tried this but the saved file isn't a valid SQLite file.
Also, I was wondering whether it's possible to embed SQLite to Air? If so how can I import and export the database?
Many thanks
In the end I couldn't get FileReference.save() to work so I go with the regular File's browseForSave()
dbWorkedFile.addEventListener(Event.SELECT, savingDatabase);
dbWorkedFile.browseForSave('Specify save location');
private function savingDatabase(event:Event):void
{
var selectedFile:File = File(event.target);
//To ensure the file is still loaded
dbWorkedFile = File.applicationStorageDirectory.resolvePath("Inventory.db");
dbWorkedFile.copyTo(selectedFile, true);
}
There is a short article describing how to include some SQLLite files in an AIR application on Adobe website (cookbooks section).

Adobe Air upload progress without FileReference

I'm deploying a small application with Adobe Air. My application will do batch upload from filepath which stored in a text file.
For example, in a text file name "list.txt", there is a string "C:\myfiles\IMG_0001.JPG". Now I want to upload this image file, keep tracking of upload progress :-<
I want to use FileReference to get the upload progress, but I don't know how to import from file's path. I also wonder how to use FileReference to upload this file without prompting a dialog for user to select file.
Thank you so much :)
Try the following. I have done a file upload without dialog box using following code.
var uploadURLs:URLRequest = new URLRequest("Your upload URL Here");
var params:URLVariables=new URLVariables();
params.title = "Hello";//URL Parameters if there is any
uploadURLs.data = params;
uploadURLs.method=URLRequestMethod.POST;
file = new File("Path to File");
file.addEventListener(ProgressEvent.PROGRESS , updateProgress);
file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, doneUpload);
file.addEventListener(IOErrorEvent.IO_ERROR,fileError);
file.upload(uploadURLs);
Hope this helps

Resources