I would like to create a plist and access it in my MonoTouch app. Plist file contains few values which i would like to access on a view.
I can create a plist but how to add it to Monotouch project and access values?
Put your plist file in the Resource folder, in my example I named it to "Test.plist". Then simply load it as a NSDictionary like this,
NSDictionary dictionary = NSDictionary.FromFile ("Test.plist");
You can of course read the file using,
File.ReadAllText ("Test.plist")
also.
Remember to set the build action for the file to BundleResource.
Related
About writing on the text file, i have a problem to define the path. I m developping with NetBean and I put my txt file in the "nbproject" folder. I can read it by using "this.getClass().getResourceAsStream(fileName)". But for writing i don't know how to define the path.
When you put the file in project folder, it is packaged in the jar file. The jar file is read-only. So your Midlet can not write into it. For security reasons. This is good.
If you need to write data, you can either use RecordStore or FileConnection.
RecordStore is portable. It does not ask for permissions. So for simple things, like settings for your midlet, this is the best option.
You can just define your whole file content as one Record.
For FileConnection, your midlet need to ask for permissions. But you have real files for example on SD-Card, there is no other way.
I am developing an add-on installer using Installshield 2011 and project type is Basic MSI. I got a requirement where i need to update app.config file; the mentioned app.config is not part of current installer; app.config will be available by installing the base product. And on top of this my add-on installer will update the app.config file.
I am using XML File Changes feature provided by Installshield, i have configured it in the following steps:
Import the updated app.config file under XML File changes view.
Create a new element and assign key and value to it.
Repeated 1 and 2 and added 7 to 8 new entries as per the requirement
During testing i am seeing that the app.config file has been updated but entries are in single line instead of one below the other. I cannot enable "Format XML after changes" because one of the service which is referenced to app.config is not working and when i revoke the option services runs perfectly.
Is there any workaround/option to tell/ask installshield insert xml tag one below the other not in sinlge line using XML File Changes?
Thanks,
Chetan
If XML Changes isn't formatting the document in a way that's acceptable, you could consider using the Text File Changes which is just a simpler search and replace without understanding the schema of XML. Otherwise options are to check out Windows Installer XML ( you can use the XmlConfig elements found in the Util extension in a merge module and then use that merge module in InstallShield ) or to just write your own custom actions.
i am using adobe livecycle 8.2 for documents template generation,
i am new to adobe livecycle designer tool.
in my template we are using xsd file to bind data to xdp file.
i have done some changes in schema file.
and want to reflect changes in my designer tool.
if i create new Data Source then all my previous bindings are lost.
i want to keep all my previous binding and also want to bind newly added field.
please help me..
in Data view tab right click on the current schema root node and select Connection Properties.
There you can update the location of the new XSD file and this way you'll preserve all the bindings
I have created a custom xsl file for the Content Query Webpart. I assigned the path of the xsl file to the property "MainXsl" of the CQW. After I put the CQW to a sub sitecollection, it show me the following message: "The web part references an untrusted XSL file. Only XSL files contained in this site's Style Library may be referenced."
I have checked up, there is my xsl file in the sub sitecollection (Style Library/XSL Style Sheets) and is published.
Please tell me how to solve this problem?
Bit of thread necromancy here, but as this is one of the top Google result for the error message...
I was getting this error even with the XSL file in the site collection's Style Library. To fix, when you reference the XSL file (in my case in the .webpart file), use server-relative path, eg. /sites/[site name]/Style Library/[stylesheet].xsl and all will be well!
EDIT: From #MBentley's comment, you can also use URL tokens, such as ~site/Style Library/[stylesheet].xsl to avoid having to use the absolute URL.
After installing my files using WIX 3.5 I would like to changes some values in one of my xml files.
Currently there are multiple entries like this:
<endpoint address="net.tcp://localhost/XYZ" .../>
I would like to change the localhost to the real servername wich is available due to a property. How can I perform this replacement on each entry inside this xml file? Is there a way to do this without writing an own CA?
Thanks in advance!
XmlConfig and/or XmlFile elements are your friends here.
UPDATE: Well, according to the comments below, it turns out that only part of the attribute (or element) value should be changed. This seems not to be supported by either of two referenced elements.
I would take one of the two approaches then:
Use third-party "read XML" actions, like this one
It's better than creating your own because you can rely on deeper testing in this case
Teach your build script to control the string pattern
Let's say you put `net.tcp://localhost/XYZ` to build file and your code is pointed out to take this value as a string pattern to use at install time. For instance, keep the string pattern as a Property in your MSI package. When it changes, e.g. to `net.tcp://localhost/ABC` you'll have to change nothing in your action. In this case from a XMLFile perspective you always know your FROM and TO attribute values.
If your XML configuration file is not large, you can load the file into memory and perform replace using JScript.
var s = "<endpoint address=\"net.tcp://localhost/XYZ\" .../>";
var re = /"net.tcp:\/\/localhost\//g;
var r = s.replace(re, "\"http://newhost.com/");
Here s is your complete XML file, re is the regular expression, and r would contain the result or replace.
You can read and write to public properties of Windows Installer using JScript. Yet there's still one problem: you have to read your XML file and to write it back to disk. To do it, you can use Win32_ReadFile and Win32_WriteFile custom actions from the AppSecInc. MSI Extensions library referenced by Yan in his answer.
However, it could be easier to write a complete Custom Action which will load your XML configuration file, do the replace, and write the file back to disk. To do it you can use XSLT and JScript (see an example code).
InstallShield has a built-in data driven custom action called Text Search. It basically allows for RegEx style replacements like what you are describing.
WiX doesn't have this functionality but you could write a custom action ( say using C#/DTF ) to do it for you.
There nothing in Wix, you can do to change something in a file without using a custom action. If you don't want to use CA, you can consider saving the settings in some other place e.g. User's registry and always read that setting from there