resources

WPF C# XML file added as resource

倖福魔咒の 提交于 2020-01-13 19:05:05
问题 I'm using an XML file added into my project with following properties : Build Action : Resource Copy to output directory : Copy Always Then when the executable is running, I need the users to be able to edit the XML (add, remove and modify nodes). Is it possible ? Or do I need to change the Build Action to Content ? Thanks edit : i've removed it and added again as Content. But now I have another issue : When I add it to the project, it looks for it in the app root directory (WpfApplication1

WPF C# XML file added as resource

北战南征 提交于 2020-01-13 19:04:07
问题 I'm using an XML file added into my project with following properties : Build Action : Resource Copy to output directory : Copy Always Then when the executable is running, I need the users to be able to edit the XML (add, remove and modify nodes). Is it possible ? Or do I need to change the Build Action to Content ? Thanks edit : i've removed it and added again as Content. But now I have another issue : When I add it to the project, it looks for it in the app root directory (WpfApplication1

Java Exception Reading Stream from Resource .wav

情到浓时终转凉″ 提交于 2020-01-13 18:26:29
问题 I guess my code is okay, and my .jar file its okay with the .wav inside it.. But when I try to load it using getResourceAsStream I get a error.. this is my error: java.io.IOException: mark/reset not supported at java.util.zip.InflaterInputStream.reset(Unknown Source) at java.io.FilterInputStream.reset(Unknown Source) at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(Unkno wn Source) at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source) at operation

PHP - Foreach loops and ressources

和自甴很熟 提交于 2020-01-13 03:14:03
问题 I'm using a foreach loop to process a large set of items, unfortunately it's using alot of memory. (probably because It's doing a copy of the array). Apparently there is a way to save some memory with the following code: $items = &$array; Isn't it better to use for loops instead? And is there a way to destroy each item as soon as they have been processed in a foreach loop. eg. $items = &$array; foreach($items as $item) { dosomethingwithmy($item); destroy($item); } I'm just looking for the

eclipse dynamic web project file locations

别来无恙 提交于 2020-01-12 14:32:49
问题 I'm creating a new dynamic web project in Eclipse and was wondering what best practices are for folder taxonomy. Here's what I believe it is <> are folders. Can someone please verify? <Eclipse project name> <src> -- .java files <WebContent> -- .html pages <images> <css> <js> <META-INF> MANIFEST.MF <WEB-INF> web.xml <app name> -- .jsp pages 回答1: Here is a sample folder structure of a dynamic web project: As you can see all static files are placed as sub-folders under the WebContent folder. By

Create file in resources/source folder in java programmatically?

。_饼干妹妹 提交于 2020-01-12 13:51:11
问题 I have two resources folders. src - here are my .java files resources - here are my resources files (images, .properties) organized in folders (packages). Is there a way to programmatically add another .properties file in that resources folder? I tried something like this: public static void savePropertiesToFile(Properties properties, File propertiesFile) throws IOException { FileOutputStream out = new FileOutputStream(propertiesFile); properties.store(out, null); out.close(); } and before

How can one read a text file in a Struts 2 app [duplicate]

倾然丶 夕夏残阳落幕 提交于 2020-01-12 03:41:09
问题 This question already has answers here : Where to place and how to read configuration resource files in servlet based application? (6 answers) Closed 3 years ago . Developing a Struts 2 app I run in a following problem. I need to read a text file that is deployed in web server with my app. How can I access it knowing its relative path. In other words how can I find absolute path if I know relative path inside the deployed directory. When I had similar problem with servlets I used to use this

How to play .mp3 file from resources in C#?

守給你的承諾、 提交于 2020-01-12 02:26:47
问题 I put music.mp3 in resources and then I added Windows Media Player to references. I wrote this code: WindowsMediaPlayer wmp = new WindowsMediaPlayer(); wmp.URL = "music.mp3"; wmp.controls.play(); It doesn't work. How can I play .mp3 file from resources? 回答1: I did it: WindowsMediaPlayer wmp = new WindowsMediaPlayer(); Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PostGen.Resources.Kalimba.mp3"); using (Stream output = new FileStream ("C:\\temp.mp3", FileMode

Shared resource dictionary between several user controls and across assemblies

我们两清 提交于 2020-01-12 01:10:43
问题 I have an assembly that contains several user controls. For this user controls assembly I want to have a resource dictionary. All the user controls within the assembly should be able to access the resource dictionary. Do I have to add <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> ... </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> to every user control that should utilize the resource dictionary, or is there some

What are the best resources for design patterns and their uses?

大兔子大兔子 提交于 2020-01-11 19:51:02
问题 When it comes to the use of design patterns, I am guessing there are three types of shops. Those who wouldn't know a pattern if it hit them in the face - these usually prefer the Ctrl-C / Ctrl-V approach to code-reuse. Those who spend hours a day searching their legacy code in hopes of implementing one more great pattern - these usually spend more time refactoring the code of simple programs than would ever be spent in a hundred years of maintenance. And finally, those who walk the middle