Tag Archives: struct

Checking XML for expected structure

Questions: I am calling a function which returns a string containing XML data. How this function works is not important but the resulting xml can be different depending on the success of the function. Basically the function will return either the expect XML or an error formatted XML. Below are basic samples of what the… Read More »

Illegal Instruction starting Apache -> PEM_read_bio_X509

Questions: I’m working on Ubuntu 13.10 64bits and I built Apache 2.2.17 and openSSL 0.9.8b from source with this configuration : openssl : ./config prefix=/repository no-asm apache : ./configure \ –prefix=/opt/httpd \ –with-included-apr \ –enable-ssl \ –with-ssl=/opt/openssl-1.0.1e \ –enable-ssl-staticlib-deps \ –enable-mods-static=ssl (stactic build !) When I try to start my apache without SSL it works… Read More »

How to add XML processing instructions during JAXB marshal

Questions: I would like to add a processing instruction whenever a collection/array property is serialized to get something like <alice> <? array bob ?> <bob>edgar</bob> <bob>david</bob> </alice> Is this possible with JAXB? Or at least with some specific JAXB implementation? Answers: You could leverage an XMLStreamWriter and an XmlAdapter to do this: BobAdapter Things to… Read More »

Nginx rewrite rules for SEO friendly URL structure – WordPress and another Web application

Questions: I have got WordPress installed on my root example.com/ Website. Also I have another Web application that on example.com/my-app/ which has got ugly links like example.com/my-app/file.php?arg=value to access. How can I make my-app SEO friendly URI structure working as example below?: example.com/my-app/file.php?arg=value to example.com/my-app/value/ Currently, if I access to example.com/my-app/value/ it redirects me to… Read More »

Leaking this in constructor warning

Questions: I’d like to avoid (most of the) warnings of Netbeans 6.9.1, and I have a problem with the ‘Leaking this in constructor’ warning. I understand the problem, calling a method in the constructor and passing “this” is dangerous, since “this” may not have been fully initialized. It was easy to fix the warning in… Read More »

Default constructor vs. inline field initialization

Questions: What’s the difference between a default constructor and just initializing an object’s fields directly? What reasons are there to prefer one of the following examples over the other? Example 1 public class Foo { private int x = 5; private String[] y = new String[10]; } Example 2 public class Foo { private int… Read More »

java.util.zip – Recreating directory structure

Questions: While trying to zip an archive using the java.util.zip I ran into a lot of problems most of which I solved. Now that I finally get some output I struggle with getting the “right” output. I have an extracted ODT file (directory would be more fitting a description) to which I did some modifications.… Read More »

Changing the value of an element in a list of structs

Questions: I have a list of structs and I want to change one element. For example : MyList.Add(new MyStruct(“john”); MyList.Add(new MyStruct(“peter”); Now I want to change one element: MyList[1].Name = “bob” However, whenever I try and do this I get the following error: Cannot modify the return value of System.Collections.Generic.List.this[int]‘ because it is not a… Read More »