Flex doesn't export resources to release build - flexbuilder

I'm trying to set image source conditionaly using the following line:
source="{data.muted ? '/assets/audioMuted.gif' : '/assets/audio.gif'}"
Apps run fine when run from Flex builder, but when I try to export release build from Flex builder, those gif files are not exported.
Does anybody have an idea what to do in this case.

You need to embed the assets. Flexbuilder will never add an image to your swf unless you Embed it.
If you looked at a tool such as fiddler to see what called your app is making you'd see one of those images being called and you can't have placed them into an appropriate folder.
[Embed("/assets/picture.gif")]
private const IMAGE1:Class;
[Embed("/assets/picture2.gif")]
private const IMAGE2:Class;
then you would do
source="{data.muted ? IMAGE1: IMAGE2 }"
that should do as long as the embed path is correct (flexbuilder will tell you if it isn't).

Related

How can I load an image to QPixmap without specifying the full path?

I'm using Qt Creator on Windows and trying to add an image to an icon.
The only way I can get it to work is by specifying the full path:
QPixmap newIcon("C:/Users/slipn/Documents/qt/projetos/exemplo/new.png");
newToolBarAction = toolbar->addAction(QIcon(newIcon), "New File");
I tried adding to the project as shown below:
The image and the code files are in the same directory. I have no clue of what path I should use to make it work. Any hints?
The problem you need to solve, is that your source path and the path where you build or maybe later even install your application are not the same. You need to bundle your image resource with your application, either by copying & installing it to your build/install, or by including it directly in your application binary.
The latter is your easiest bet with qmake. Installing files with qmake is (relatively) easy, but making your build result work without a separate make install step is a different thing.
Your easiest bet to solve both "running your build result directly" and "running the installed application" is to use the Qt Resource System.
Create a .qrc file with File > New File > Files and Classes > Qt > Qt Resource File, add a "prefix" (some name), add your image file there, and then use QPixmap newIcon(":/yourprefix/new.png") to access it in your application.

Error while building WSO2 Microgateway project on Windows 10

I’ve been trying to explore WSO2 Microgateway and set up a Microgateway project. Building the project in Windows 10 with the command “micro-gw build project-name” is giving this error: “Could not find or load main class org.wso2.apimgt.gateway.cli.cmd.Main”.
I’ve downloaded the Toolkit and Runtime from https://wso2.com/api-management/api-microgateway/. I've set the Path environment variable to the /bin directory of the Toolkit and Runtime extracted folders, but still the “micro-gw build project-name” command is giving error “Could not find or load main class org.wso2.apimgt.gateway.cli.cmd.Main”. I’ve also cloned the source code from Github (https://github.com/wso2/product-microgateway/) which has the Main.java class and tried setting environment variables to its path.
I also tried setting the environment variables to the path where Toolkit batch file is present. I also followed the steps mentioned here, https://github.com/wso2/product-microgateway/#running-the-microgateway.
I'm assuming the Toolkit batch file (micro-gw) would execute the Main.java class coming up in the error.
These steps did not resolve the error. I'm new to Java based product, and I'm sure I'm missing something here.
Problem is with the init command not the build command. Init command is suppose to setup the TOOLKIT after the first use. It should extract the platform.zip file and copy all of the required resources to relevant places for you.
I hope you get the Project ___ successfully initialized message after running the init command. Just check $TOOLKIT_HOME/logs/ directory to see if there are any information on the log file.
If the log file also doesn't help, as a workaround, copy all the .jar files inside $TOOLKIT_HOME/lib/gateway/platform and $TOOLKIT_HOME/lib/gateway/cli to $TOOLKIT_HOME/lib/platform/bre/lib and try again, that should work.
Also please report this issue at https://github.com/wso2/product-microgateway/issues

How to add and use .zip (or .pak) files to c++ project?

I'm compiling CEF (Chromium Embedded Framework) for our local html5 presentation.
I should say I'm very new for all this (CEF and C++).
I've already optimized cefclient project for the presentation, but I need to embed all html/js/css/etc files into project (reading from local storage is not an option).
As I understood, I should use .zip or .pak (renamed zip) files to embed. But how can I use them inside the project?
Should I use some lib for unzipping (zlib?) or there is another popular way? And how can I be sure that files will be compiled into project?
Sorry for such basic questions but there are very few information about this (or google hates me today).
Thank you for any help!
UPD: found great tool - WBEA (http://asterclick.drclue.net/WBEA.html), it looks like exactly what I want to, but works pretty slow (with JS).
UPD 2: It turns out that there are many ways to make HTML5 desktop application, for example Node-Webkit.
Here is an article that compares some of them http://clintberry.com/2013/html5-apps-desktop-2013/
You need:
Create zip file whitin your resources.
Embed it as win32 resource (after this step you will get correct executable with .zip file inside).
Create custom scheme handler to access this zip file.
CefZipReader class will be handly to implement handler from step 3.
Look around, may be something like what you want already exist somewhere.
This sounds very similar to self extracting installers.
No need to compile anything, just concatenate the zip to the end of the executable. All you need to do is find the offset at runtime from the start of the executable. This can be done easily by writing a large magic number and looking for it later.
Example Linux:
cat app magic_number data > new_app
Example Windows:
copy app.exe /B + magic.dat /B + data.dat /B new_app.exe

How can I make LLVM display graphs in a different viewer?

LLVM can create graphs in Graphviz's "dot" format, and automatically invoke a viewer to display them. By default it uses dotty to display those graphs. I know that I can change it to use a different viewer, but I was not able to find precise instructions on how to do so.
How can I make it open the graphs with a different viewer?
I'm running on Linux but would be interested in an answer for Windows as well.
I found out I'm supposed to change the CMakeCache.txt file in my build folder. For instance, to use XDot instead of dotty, I edited the LLVM_PATH_XDOT_P property in that file to point to the full path of my xdot.py file.
It now opens the alternative viewer successfully, after rebuilding the project.
I just needed to do this.
I managed to do this with a workaround: made a backup of dotty (just in case) and created a link from dotty to XDot.
cp /usr/bin/dotty /usr/bin/dotty_copy
ln -s /usr/bin/dotty /usr/bin/xdot
I believe you could also set some variable during configuration step (possibly LLVM_PATH_DOTTY), but I never tried this as I didn't want to recompile LLVM.
You may try hacking the DisplayGraph function or fidging with the makefiles until you manage to enable one of the #ifdefs in DisplayGraph.

Where to start for writing a shell script for copying elements into main app xcode4

I am looking for some documentation or tutorial for copying files from a given directory into the app created by xcode at build time, before it is run.
At first I have tried to copy files into the derived directory, hoping that everything resides in there would be automatically added to the app, but I was wrong.
So I am looking for a script because the original dir may change its name, second the script could be customized by another xcode 4 user with its src dir path etc.
The things is I don't know how to start, which language etc. I am quite confident with shell script, but maybe there's a better option.
Second, I am trying to figure out which command could add a file in the already built app.
thanks
That answer didn't really help - the BUILT_PRODUCT_DIR isn't where most stuff goes.
Ultimately, I found you just need to do:
Add the following to the very end of your script (or get your script to write directly to the output location):
cp ${DERIVED_FILE_DIR}/[YOUR OUTPUT FILES] ${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
...but there's a lot of other things I tried. More thoughts and ideas here: http://red-glasses.com/index.php/tutorials/xcode4-a-script-that-creates-adds-files-to-your-project/
You want a Run Script or Copy Files build phase. Select your main project in the navigator, then select the app's target. Click the Build Phases tab. Click the Add Build Phase button at the bottom of the window and choose the appropriate phase.
By "appropriate" I mean if you really want to run a script, you'll use a Run Script build phase and use Xcode-provided environment variables like $BUILT_PRODUCT_DIR (see the documentation or hit build and examine the full output of an empty script in the build log) to figure out your target folder. If all you want to do is copy files (no real processing), the Copy Files build phase already knows how to locate the app bundle's proper folders depending on what you're copying (Resources, Frameworks, etc.).