Search Results

Search found 889 results on 36 pages for 'andy s'.

Page 17/36 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • iPhone offline reading

    - by Andy
    Hi, first of all - I am quite new to iPhone App development (3 months). I am working for a software company that offers a content management system. Our customers are for the main part publishing houses for magazines. They use our software to write articles to their homepages. Now we want to offer iPhone Applications to go with our cms. What I have accomplished so far is an RSS reader that shows newly published articles in a list view. The user selects one article and is redirected to a specially formatted detail view of this article. The next step is to add offline reading capabilities. I have searched the internet up and down but couldn't find anything like a best practice for that. I get it that there are two possibilities in general: Store the contents of the uiwebview locally on the iPhone/iPad (including css, images, js and so on). There would be the need to rework the basic html to use the downloaded css, images and js. Also I would have to somehow edit hyperlinks to following pages in multipage articles - Sounds like a lot of work ;) Create a PDF on the server side and download that to the mobile device. Rework the RSS Source to point to the locally saved pdf instead of the website on the server. My question is - what is the better way to go? Are there any downsides for either of the possibilities? Are there other (simple ;)) ways to implement offline reading features? Are there possibly any howto's that I could've missed? Thanks y'all!

    Read the article

  • ASP.NET Javascript Error :: sys.webforms.pagerequestmanagerservererrorexception

    - by Andy Evans
    I have an ASP.NET site that uses JQuery and ASP.NET UpdatePanel and ScriptManager. On one page in particular, I get a javascript error: sys.webforms.pagerequestmanagerservererrorexception: Index and length must refer to a location within the string. Parameter name:length ScriptResourse.axd Code: 0 Here's what's in the master page: <asp:ScriptManager runat="server" ID="ScriptMgr"></asp:ScriptManager> <asp:UpdatePanel runat="server" ID="UpdatePanelMaster"> <ContentTemplate> </ContentTemplate> </asp:UpdatePanel> In the page in question: <asp:Content ID="ContentHeadEdit" ContentPlaceHolderID="ContentHeadMaster" Runat="Server"> <script type="text/javascript"> $(document).ready(function() { $('#<%= ButtonSave.ClientID %>').button(); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler(sender, args) { $('#<%= ButtonSave.ClientID %>').button(); } }); </script> </asp:Content>

    Read the article

  • Pros and Cons of automating Excel using VBA vs .Net

    - by Andy
    I've been tasked with creating a financial planning tool in Excel that would benefit from some custom functions/macros. My initial reaction was to use VBA. I've used it to drive Excel before (say 5 years ago). But I then began to wonder if I would be better off using VSTO. Has anyone has experience using both techs and can list the pros and cons so that I can evaluate which course would be best.

    Read the article

  • Cufon Hover & Change of font syntax

    - by Andy
    Could someone help me rewrite this syntax below to get it right. I want the font to be replaced by my font whilst accepting the :hover so my button will change when i hover over it. Cufon.replace('button', { fontFamily: 'Disgrunged A', hover: true });

    Read the article

  • 'template' .SWF that uses other .swf's and .jpg's in it (by xml generated in .php) works only locall

    - by Andy
    My problem is that a .swf I would like to put on my website works only when requested locally. When requested from my home web server or company web server it doesn't work. I believe all files are in the proper folders and all links are well, otherwise it wouldn't work locally. Now, the SWF I place on the html page has several shapes, fonts, texts, buttons, scripts and frames. The scripts are in v1.0 and descrive how the SWF should behave. The SWF uses 2 different JPG's and 3 different SWF's. It also has a .php file with xml in it which tells the main SWF which JPG's and SWF's to use and where to find them. The main script in the main SWF also links to this .php file. So everything works properly when opening the SWF locally in IE like U:\common\templates\dynamic.swf Everythins shows perfectly. When requesting exactly the same file, but with a domain (as I can access the web server folder like a local drive) only the main .swf shows which is black with some test forms etc in it. PHP is enabled on the server. This is my code in the .php I just edited some links to conceal domains and file names: <?xml version="1.0" ?><dynamic_content> <item blurb="Text 1" content_timer="8000" cycle="true" content_border_color="0x" content_bg_image="" tab_hl_color="0x000000" tab_border_color="0x000000" tab_color="0x000000" tab_arrow_color="0xFFFFFF" tab_text_color="0xFFFFFF" tab_image="/template/images/file.jpg" tab_highlight_color="0x" tab_highlight_text_color="0x" tab_highlight_image="" content_url="http://sub.domain.com" content_source="/template/images/file.swf" content_target="_self" ></item> <item blurb="Text 2" content_timer="5000" cycle="true" content_border_color="0x" content_bg_image="" tab_hl_color="0xFFFFFF" tab_border_color="0xFFFFFF" tab_color="0xFFFFFF" tab_arrow_color="0xFFFFFF" tab_text_color="0xFFFFFF" tab_image="/template/images/file.jpg" tab_highlight_color="0x" tab_highlight_text_color="0x" tab_highlight_image="" content_url="http://www.domain.com/" content_source="/template/images/file.swf" content_target="_self" ></item> <item blurb="Text 3" content_timer="5000" cycle="true" content_border_color="0x" content_bg_image="" tab_hl_color="0xFFFFFF" tab_border_color="0xFFFFFF" tab_color="0xFFFFFF" tab_arrow_color="0xFFFFFF" tab_text_color="0xFFFFFF" tab_image="/template/images/file.jpg" tab_highlight_color="0x" tab_highlight_text_color="0x" tab_highlight_image="" content_url="http://www.domain.com/page.html" content_source="/template/images/file.swf" content_target="_self" ></item></dynamic_content> So you understand, it's a dynamic SWF that is built up by other pics and swf's. It's easier to change the php and put new files on the server than build a new flash file everytime etc and it's quite difficult to built some functionality in one swf when using other swf files. What could be the problem here that it works well when incurred locally but not from a server (using the domain etc) Any help is much appreciated. Thanks! EDIT: When I open the .swf in firefox by using the direct link to the .swf, the status bars hangs on 'Waiting for www.domain.com... (domain = mydomain) Maybe this is of any help?

    Read the article

  • Objective C -std=c99 usage

    - by Andy White
    Is there any reason why you shouldn't use the "-std=c99" flag for compiling Objective-C programs on Mac? The one feature in C99 that I really like is the ability to declare variables anywhere in code, rather than just at the top of methods, but does this flag causes any problems or create incompatibilities for iPhone or Cocoa apps?

    Read the article

  • WPF - How to properly reference a class from XAML

    - by Andy T
    OK, this is a super super noob question, one that I'm almost embarrassed to ask... I want to reference a class in my XAML file. It's a DataTemplateSelector for selecting the right edit template for a DataGrid column. Anyway, I've written the class into my code behind, added the local namespace to the top of top of the XAML, but when I try to reference the class from the XAML, it tells me the class does not exist in the local namespace. I must be missing something really really simple but I just can't understand it... Here's my code. XAML: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tk="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:local="clr-namespace:CustomFields" xmlns:col="clr-namespace:System.Collections;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib" x:Class="CustomFields.MainWindow" x:Name="Window" Title="Define Custom Fields" Width="425" Height="400" MinWidth="425" MinHeight="400"> <Window.Resources> <ResourceDictionary> <local:RangeValuesEditTemplateSelector> blah blah blah... </local:RangeValuesEditTemplateSelector> </ResourceDictionary> </Window.Resources> C#: namespace CustomFields { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); // Insert code required on object creation below this point. } } public class RangeValuesEditTemplateSelector : DataTemplateSelector { public RangeValuesEditTemplateSelector(){ MessageBox.Show("hello"); } } } Any ideas what I'm doing wrong? I thought this should be simple as 1-2-3... Thanks! AT

    Read the article

  • Good tools which generate NUnit unit tests for .NET assemblies in Visual Studio 2008

    - by andy
    Hey guys, I'm pretty new to Unit Testing so bare with me. I realize that best best practice is not to auto generate unit tests, however I'd like to use Code Generation to set-up the basic skeleton of the tests. Now, I know Visual Studio 2008 already has the built in "create tests", however, it just creates a flat list of all the classes it's going to test... and it's not for NUnit right? Ideally, I'd like the code generation to follow the folder AND namespace structure of the assembly its generating tests for. Can you guys recommend any good tools which generate NUnit unit tests for .NET assemblies in Visual Studio 2008? cheers!

    Read the article

  • Wildcard searching and highlighting with Solr 1.4

    - by andy
    Hey guys, I've got a pretty much vanilla install of SOLR 1.4 apart from a few small config and schema changes. <requestHandler name="standard" class="solr.SearchHandler" default="true"> <!-- default values for query parameters --> <lst name="defaults"> <str name="defType">dismax</str> <str name="echoParams">explicit</str> <str name="qf"> text </str> <str name="spellcheck.dictionary">default</str> <str name="spellcheck.onlyMorePopular">false</str> <str name="spellcheck.extendedResults">false</str> <str name="spellcheck.count">1</str> </lst> </requestHandler> The main field type I'm using for Indexing is this: <fieldType name="textNoHTML" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <charFilter class="solr.HTMLStripCharFilterFactory" /> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/> </analyzer> </fieldType> now, when I perform a search using "q=search+term&hl=on" I get highlighting, and nice accurate scores. BUT, for wildcard, I'm assuming you need to use "q.alt"? Is that true? If so my query looks like this: "q.alt=search*&hl=on" When I use the above query, highlighting doesn't work, and all the scores are "1.0". What am I doing wrong? is what I want possible without bypassing some of the really cool SOLR optimizations. cheers!

    Read the article

  • Keymap issues with NX from Mac OS X Lion

    - by Andy
    I tried to answer the question from Mark: Keymap issues with NX from Mac OS X Lion to Ubuntu However, it is locked so I figured I would post a new question / answer. I have been trying to answer this for a few days now because I have no issues when connecting through NX Client (technically OpenNX) to FreeNX server from an iMac (with Lion), but if I try to connect with a Macbook Pro I get horrible keyboard binding issues. The fix that is working for me is to go into: ~/.nx/config/HOST.nxs and change: <option key="Current keyboard" value="false"/> <option key="Custom keyboard layout" value="empty"/> <option key="Grab keyboard" value="false"/> I have tried this on three NX Servers and all are fixed. Hope it helps or gets you closer. Always check in the ~/.nx/temp/ for the sshlog and see if --keyboard="empty/empty" instead of "pc105/en" because the Mac is really pc104. 9:05:35: startsession --session="HOST" --type="unix-gnome" --cache="8M" --images="32M" --link="adsl" --geometry="2556\ x1396" --screeninfo="2560x1440x32+render" --keyboard="empty/empty" --backingstore="1" --encryption="1" --composite="1" --\ shmem="1" --shpix="1" --streaming="1" --samba="0" --cups="0" --nodelay="1" --defer="0" --client="macosx" --media="0" --st\ rict="0" --aux="1"

    Read the article

  • Position an icon on the right in the middle of a list item

    - by Andy
    I have the following code which prints an img if the current page is selected. The issue i have is if the list item is a varied height i cant position it in the middle of the list item on the far right... <li><?php echo $child->link($child->title); ?><?php echo (url_start_with($child->url) ? '<img src="images/ico-arrow.png" class="pointer">': null); ?></li> how can i ammend the "TOP" so that it will position itself vertically no matter what the height using css #bf-fest-list li { margin:0; padding:5px 25px; position:relative; } #bf-fest-list li a:hover { color:#ec1c23; text-decoration:none; } #bf-fest-list li.current { background:#a0a1a4; padding:10px 25px; } #bf-fest-list li.current a { color:#FFF; } #bf-fest-list li .pointer { position:absolute; top:10px; left:233px; }

    Read the article

  • Problem deserializing xml file

    - by Andy
    I auto generated an xsd file from the below xml and used xsd2code to get a c# class. The problem is the entire xml doesn't deserialize. Here is how I'm attempting to deserialize: static void Main(string[] args) { using (TextReader textReader = new StreamReader("config.xml")) { // string temp = textReader.ReadToEnd(); XmlSerializer deserializer = new XmlSerializer(typeof(project)); project p = (project)deserializer.Deserialize(textReader); } } here is the actual XML: <?xml version='1.0' encoding='UTF-8'?> <project> <scm class="hudson.scm.SubversionSCM"> <locations> <hudson.scm.SubversionSCM_-ModuleLocation> <remote>https://svn.xxx.com/test/Validation/CPS DRTest DLL/trunk</remote> </hudson.scm.SubversionSCM_-ModuleLocation> </locations> <useUpdate>false</useUpdate> <browser class="hudson.scm.browsers.FishEyeSVN"> <url>http://fisheye.xxxx.net/browse/Test/</url> <rootModule>Test</rootModule> </browser> <excludedCommitMessages></excludedCommitMessages> </scm> <openf>Hello there</openf> <buildWrappers/> </project> When I run the above, the locations node remains null. Here is the xsd that I'm using: <?xml version="1.0" encoding="utf-8"?> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="project"> <xs:complexType> <xs:all> <xs:element name="openf" type="xs:string" minOccurs="0" /> <xs:element name="buildWrappers" type="xs:string" minOccurs="0" /> <xs:element name="scm" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="useUpdate" type="xs:string" minOccurs="0" msdata:Ordinal="1" /> <xs:element name="excludedCommitMessages" type="xs:string" minOccurs="0" msdata:Ordinal="2" /> <xs:element name="locations" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="hudson.scm.SubversionSCM_-ModuleLocation" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="remote" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="browser" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="url" type="xs:string" minOccurs="0" msdata:Ordinal="0" /> <xs:element name="rootModule" type="xs:string" minOccurs="0" msdata:Ordinal="1" /> </xs:sequence> <xs:attribute name="class" type="xs:string" /> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="class" type="xs:string" /> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="project" /> </xs:choice> </xs:complexType> </xs:element> </xs:schema>

    Read the article

  • Best practice? iphone: sync data

    - by Andy Jacobs
    So i'm working on a project where there is data visualization. My ultimate goal is that i have a set of data shipped with the download of the iphone app. But i want it connected to a backend, that if the iphone has a connection with the internet. it can sync the changes from the backend. The syncing is no problem or the connection between the backend & the iphone. But what should i use as data storage on my iphone? what is the best way. my data is purely text and doesn't have to be secure. But it's main feature should be updating certain parts of data ( adding and deleting are not so important ) so what is the easiest (read: least time consuming development ) or the best way? sqlite? plist? ..?

    Read the article

  • Ensuring unique ID attribute for elements within ScriptControl

    - by Andy West
    I'm creating a control based on ScriptControl, and I'm overriding the Render method like this: protected override void Render(HtmlTextWriter writer) { RenderBeginTag(writer); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write("This is a test."); writer.RenderEndTag(); RenderEndTag(writer); } My question is, what if I want to assign the div an ID attribute and have it be unique on the page, even if there are mulitple instances of my control? I've seen other people's code that does this: writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID + "_divTest"); That will prevent naming conflicts between instances of my control, but what if I've already created a div elsewhere on the page that coincidentally has the same ID? I've also heard about implementing INamingContainer. Would that apply here? How could I use it?

    Read the article

  • Tomcat JNDI Connection Pool docs - Random Connection Closed Exceptions

    - by Andy Faibishenko
    I found this in the Tomcat documentation here What I don't understand is why they close all the JDBC objects twice - once in the try{} block and once in the finally{} block. Why not just close them once in the finally{} clause? This is the relevant docs: Random Connection Closed Exceptions These can occur when one request gets a db connection from the connection pool and closes it twice. When using a connection pool, closing the connection just returns it to the pool for reuse by another request, it doesn't close the connection. And Tomcat uses multiple threads to handle concurrent requests. Here is an example of the sequence of events which could cause this error in Tomcat: Request 1 running in Thread 1 gets a db connection. Request 1 closes the db connection. The JVM switches the running thread to Thread 2 Request 2 running in Thread 2 gets a db connection (the same db connection just closed by Request 1). The JVM switches the running thread back to Thread 1 Request 1 closes the db connection a second time in a finally block. The JVM switches the running thread back to Thread 2 Request 2 Thread 2 tries to use the db connection but fails because Request 1 closed it. Here is an example of properly written code to use a db connection obtained from a connection pool: Connection conn = null; Statement stmt = null; // Or PreparedStatement if needed ResultSet rs = null; try { conn = ... get connection from connection pool ... stmt = conn.createStatement("select ..."); rs = stmt.executeQuery(); ... iterate through the result set ... rs.close(); rs = null; stmt.close(); stmt = null; conn.close(); // Return to connection pool conn = null; // Make sure we don't close it twice } catch (SQLException e) { ... deal with errors ... } finally { // Always make sure result sets and statements are closed, // and the connection is returned to the pool if (rs != null) { try { rs.close(); } catch (SQLException e) { ; } rs = null; } if (stmt != null) { try { stmt.close(); } catch (SQLException e) { ; } stmt = null; } if (conn != null) { try { conn.close(); } catch (SQLException e) { ; } conn = null; } }

    Read the article

  • Fluent NHibermate and Polymorphism and a Newbie!

    - by Andy Baker
    I'm a fluent nhibernate newbie and I'm struggling mapping a hierarchy of polymorhophic objects. I've produced the following Model that recreates the essence of what I'm doing in my real application. I have a ProductList and several specialised type of products; public class MyProductList { public virtual int Id { get; set; } public virtual string Name {get;set;} public virtual IList<Product> Products { get; set; } public MyProductList() { Products = new List<Product>(); } } public class Product { public virtual int Id { get; set; } public virtual string ProductDescription {get;set;} } public class SizedProduct : Product { public virtual decimal Size {get;set;} } public class BundleProduct : Product { public virtual Product BundleItem1 {get;set;} public virtual Product BundleItem2 {get;set;} } Note that I have a specialised type of Product called BundleProduct that has two products attached. I can add any of the specialised types of product to MyProductList and a bundle Product can be made up of any of the specialised types of product too. Here is the fluent nhibernate mapping that I'm using; public class MyListMap : ClassMap<MyList> { public MyListMap() { Id(ml => ml.Id); Map(ml => ml.Name); HasManyToMany(ml => ml.Products).Cascade.All(); } } public class ProductMap : ClassMap<Product> { public ProductMap() { Id(prod => prod.Id); Map(prod => prod.ProductDescription); } } public class SizedProductMap : SubclassMap<SizedProduct> { public SizedProductMap() { Map(sp => sp.Size); } } public class BundleProductMap : SubclassMap<BundleProduct> { public BundleProductMap() { References(bp => bp.BundleItem1).Cascade.All(); References(bp => bp.BundleItem2).Cascade.All(); } } I haven't configured have any reverse mappings, so a product doesn't know which Lists it belongs to or which bundles it is part of. Next I add some products to my list; MyList ml = new MyList() { Name = "Example" }; ml.Products.Add(new Product() { ProductDescription = "PSU" }); ml.Products.Add(new SizedProduct() { ProductDescription = "Extension Cable", Size = 2.0M }); ml.Products.Add(new BundleProduct() { ProductDescription = "Fan & Cable", BundleItem1 = new Product() { ProductDescription = "Fan Power Cable" }, BundleItem2 = new SizedProduct() { ProductDescription = "80mm Fan", Size = 80M } }); When I persist my list to the database and reload it, the list itself contains the items I expect ie MyList[0] has a type of Product, MyList[1] has a type of SizedProduct, and MyList[2] has a type of BundleProduct - great! If I navigate to the BundleProduct, I'm not able to see the types of Product attached to the BundleItem1 or BundleItem2 instead they are always proxies to the Product - in this example BundleItem2 should be a SizedProduct. Is there anything I can do to resove this either in my model or the mapping? Thanks in advance for your help.

    Read the article

  • Win32 API P-Invoke to bring a disk online, offline, and set unique ID

    - by Andy Schneider
    I am currently using Diskpart to accomplish these functions, but i would like to be able to use P-Invoke and not have to shell out to an external process in my C# app. The example Diskpart scripts are: //Online a disk Select disk 7 disk online // Reset GPT Identifier select disk 7 UNIQUEID DISK ID=baf784e7-6bbd-4cfb-aaac-e86c96e166ee I tried searching pinvoke.net but could only find functions that dealt with volumes, not disks. Any idea on how to accomplish these diskpart commands using Pinvoke?

    Read the article

  • Android AppWidget maps activity problem

    - by Andy Armstrong
    Right. So I have an app widget. It has 4 buttons, one one of the buttons I want it to show me the current location of the user on the map. So - I make a new activity as below: package com.android.driverwidget; import java.util.List; import android.os.Bundle; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.MyLocationOverlay; import com.google.android.maps.Overlay; public class MyLocation extends MapActivity{ public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); MapView myMapView = (MapView)findViewById(R.id.mapview); MapController mapController = myMapView.getController(); List<Overlay> overlays = myMapView.getOverlays(); MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, myMapView); overlays.add(myLocationOverlay); myLocationOverlay.enableMyLocation(); } protected boolean isRouteDisplayed() { return false; } } And then I added the appropriate uses library line to the manifest <activity android:name=".MyLocation" android:label="myLocation"> </activity> <uses-library android:name="com.google.android.maps" /> Ok yet - when I run the app the following errors occur, looks like it cannot find the MapActivity class, im running it on the GoogleApps 1.5 instead of normal android 1.5 as well. http://pastebin.com/m3ee8dba2 Somebody plz help me - i am now dying.

    Read the article

  • JAXB marshals XML differently to OutputStream vs. StringWriter

    - by Andy
    I apologize if this has been answered, but the search terms I have been using (i.e. JAXB @XmlAttribute condensed or JAXB XML marshal to String different results) aren't coming up with anything. I am using JAXB to un/marshal objects annotated with @XmlElement and @XmlAttribute annotations. I have a formatter class which provides two methods -- one wraps the marshal method and accepts the object to marshal and an OutputStream, the other just accepts the object and returns the XML output as a String. Unfortunately, these methods do not provide the same output for the same objects. When marshaling to a file, simple object fields internally marked with @XmlAttribute are printed as: <element value="VALUE"></element> while when marshaling to a String, they are: <element value="VALUE"/> I would prefer the second format for both cases, but I am curious as to how to control the difference, and would settle for them being the same regardless. I even created one static marshaller that both methods use to eliminate different instance values. The formatting code follows: /** Marker interface for classes which are listed in jaxb.index */ public interface Marshalable {} /** Local exception class */ public class XMLMarshalException extends BaseException {} /** Class which un/marshals objects to XML */ public class XmlFormatter { private static Marshaller marshaller = null; private static Unmarshaller unmarshaller = null; static { try { JAXBContext context = JAXBContext.newInstance("path.to.package"); marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); unmarshaller = context.createUnmarshaller(); } catch (JAXBException e) { throw new RuntimeException("There was a problem creating a JAXBContext object for formatting the object to XML."); } } public void marshal(Marshalable obj, OutputStream os) throws XMLMarshalException { try { marshaller.marshal(obj, os); } catch (JAXBException jaxbe) { throw new XMLMarshalException(jaxbe); } } public String marshalToString(Marshalable obj) throws XMLMarshalException { try { StringWriter sw = new StringWriter(); marshaller.marshal(obj, sw); } catch (JAXBException jaxbe) { throw new XMLMarshalException(jaxbe); } } } /** Example data */ @XmlType @XmlAccessorType(XmlAccessType.FIELD) public class Data { @XmlAttribute(name = value) private String internalString; } /** Example POJO */ @XmlType @XmlRootElement(namespace = "project/schema") @XmlAccessorType(XmlAccessType.FIELD) public class Container implements Marshalable { @XmlElement(required = false, nillable = true) private int number; @XmlElement(required = false, nillable = true) private String word; @XmlElement(required = false, nillable = true) private Data data; } The result of calling marshal(container, new FileOutputStream("output.xml")) and marshalToString(container) are as follows: Output to file <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:container xmlns:ns2="project/schema"> <number>1</number> <word>stackoverflow</word> <data value="This is internal"></data> </ns2:container> and Output to String <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:container xmlns:ns2="project/schema"> <number>1</number> <word>stackoverflow</word> <data value="This is internal"/> </ns2:container>

    Read the article

  • Adding a UINavigationController to a UITabBarController

    - by Andy Jacobs
    I have a set of 10 navigationViewControllers i want to the UITabBarController this all just works fine except the fact when i want to see a UINavigationController that is in the "more" tab it doesn't switch to it. it does nothing. if i change that to a UIViewController it just works fine .. ok in the more tab you automatically have a UINavigationController to you disposal but if the user switches the tab's order and its not anymore in the "more" tab you don't have a UINavigationController .. any tips ?

    Read the article

  • WPF - Setting ComboBox.SelectedItem in XAML based on matching object

    - by Andy T
    Hi, so, I have templated combobox that is basically acting as a simple colour palette. It is populated with a list of SolidColorBrush objects. Fine. Now, I have some data that holds the hex value of the current colour. I have a converter that converts the hex into a SolidColorBrush. Also fine. Now, I want to set the SelectedItem property of the combobox based on the colour from my datasource. Since my combo is populated with objects of type SolidColourBrush, and my binding converter is returning a SolidColorBrush, I assumed it would be as simple as saying: SelectedItem="{Binding Color, Converter={StaticResource StringToBrush}}" However... it doesn't work :( I've tested that the binding is working behind the scenes by using the exact same value for the Background property of the combobox. It works fine. So, clearly I can't just say SelectedItem = [something] where that [something] is basically an object equal to the item I want to be selected. What is the right way to do this? Surely it's possible in a XAML-only styley using binding, and I don't have to do some nasty C# iterating through all items in the combobox trying to find a match (that seems awfully old-school)...? Any help appreciated. Many thanks! AT

    Read the article

  • Add reference to .dll asp.net

    - by Andy
    Hi, I have a simple question about adding references to a .NET project. I'm adding reCAPTCHA to a website and i have downloaded the dll. After setting the reference to the dll i build and run the project and gets this error: [ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.] System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0 System.Reflection.Assembly.GetTypes() +96 StarSuite.Core.Settings.GetSingletonInstancesOfBaseType(Type baseType, String staticMethodName, Type returnType) +149 [ApplicationException: Unable to load types from 'Recaptcha, Version=1.0.5.0, Culture=neutral, PublicKeyToken=9afc4d65b28c38c2'. LoaderExceptions: [FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] ] What am i missing, why do i get this error?

    Read the article

  • How to implement a python REPL that nicely handles asynchronous output?

    - by andy
    I have a Python-based app that can accept a few commands in a simple read-eval-print-loop. I'm using raw_input('> ') to get the input. On Unix-based systems, I also import readline to make things behave a little better. All this is working fine. The problem is that there are asynchronous events coming in, and I'd like to print output as soon as they happen. Unfortunately, this makes things look ugly. The " " string doesn't show up again after the output, and if the user is halfway through typing something, it chops their text in half. It should probably redraw the user's text-in-progress after printing something. This seems like it must be a solved problem. What's the proper way to do this? Also note that some of my users are Windows-based. TIA Edit: The accepted answer works under Unixy platforms (when the readline module is available), but if anyone knows how to make this work under Windows, it would be much appreciated!

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >