How do I make a PNG resource?

Example text file (named myres.rc): MYPNG RCDATA mypng.png Added to project: {$R ‘myres.res’ ‘myres.rc’} Example of loading at runtime: uses PngImage; var Png: TPngImage; begin Png := TPngImage.Create; try Png.LoadFromResourceName(HInstance, ‘MYPNG’); Image1.Picture.Graphic := Png; // Image1: TImage on the form finally Png.Free; end; end;

VC++ resources in a static library

The only thing you need to do to use resources (images, dialogs, etc…) in a static library in Visual C++ (2008), is include the static library’s associated .res file in your project. This can be done at “Project settings/Linker/Input/Additional dependencies”. With this solution, the resources of the static library are packed into the .exe, so … Read more

Class.getResource and ClassLoader.getSystemResource: is there a reason to prefer one to another?

There are several ways to load resources, each with a slightly different meaning – ClassLoader::getSystemResource() uses the system classloader. This uses the classpath that was used to start the program. If you are in a web container such as tomcat, this will NOT pick up resources from your WAR file. Class<T>#getResource() prepends the package name … Read more

Android compiled resources – resources.arsc

TL;DR: With the help of android asset packagin tool(aapt), xml nodes get translated to Java classes and the corresponding xml attributes get translated to numerical Ids. Android run-time works with these numeric ids to instantiate classes and create the views TL;R Run this command to dump the binary xml aapt d xmltree apk_file_name res/layout/activity_main.xml(aapt can … Read more

Genetic algorithm resource [closed]

Best references for me so far: Genetic Algorithms in Search, Optimization, and Machine Learning by David E. Goldberg: a classic, still considered as the bible of GAs by many. An Introduction to Genetic Algorithms by Melanie Mitchell: more recent than the previous reference and packed with probably more interesting examples. A Field Guide to Genetic … Read more

Maven (Surefire): copy test resources from src/test/java

bmargulies gave the answer, but let me fill in some details. <testresources> can be added to the <build> node of the project’s POM, like this: <testResources> <testResource> <directory>${project.basedir}/src/test/java</directory> </testResource> </testResources> That copies everything in src/test/java — including the .java source code, which we don’t want. It also (as bmargulies only hinted at) overrides and replaces … Read more

How to reference JSF image resource as CSS background image url

When importing CSS stylesheets by <h:outputStylesheet>, the stylesheet is imported and processed by the FacesServlet through /javax.faces.resource/*. Look at the generated <link> element pointing to the stylesheet in question and you’ll understand. You have to change all url() dependencies to use #{resource[‘library:location’]} instead. JSF will then auto-substitute it with the right path. Given your folder … Read more