Thursday, July 23, 2009

Apache mod_proxy and tomcat

If you use apache to forward request to a local running tomcat, you may encounter this error message in the error.log:

[error] (13)Permission denied: proxy: HTTP: attempt to connect to 127.0.0.1:8080 (*) failed


If you have SELinux running you have to check if it allows local connections, by running:



getsebool -a | grep httpd


you have to check that the following is written:



httpd_can_network_connect –> on


if it is off, you have to enable it:



setsebool -P httpd_can_network_connect=1


and restart your apache.



This tip has been taken from: http://swapyourbooks.com/welcome/knowledgebase/misc/selinux-allow-httpd-tomcat-proxy.html

Friday, June 13, 2008

C++ member template function

With Visual Studio 2003 you can use member template functions, for example:

class Foo {

    template <class T> void bar(T* t) {}

};

that you can call in this way:

void main() {
  int a = 10;
  Foo obj;
  obj.bar(a);

}

Make sure that when you declare the bar method you include also the method definition otherwise you will end-up with a linker error.

Saturday, May 31, 2008

Sunday, September 16, 2007

Python Soap Server and ASP.Net Web Services - Part 1

I had a soap server built in python with SOAPpy and I wanted to use it from an ASP.Net application using the visual studio 2005 built in web services tool. I encountered several problems:

  • Visual Studio wants to read the WSDL from the soap server;
  • Namespaces matter.

For the WSDL problem you have just to define a function like:

def wsdl(self):
  wsdl_text = ''
  f = open('service.wsdl', 'r')
  for l in f.readlines():
    wsdl_text += l f.close()
  return wsdl_text

for the namespece part, suppose you ns is 'http://localhost/MyServer/2007/09/Services/MyService/01', you server will be:

class MySoapServer(SOAPServer):
  def __init__(self, ip = "localhost", port = 8080):
  from SOAPpy import NS

  # visual studio want's the soap envelope defined as 's'
  NS.ENV_T = "s"
  self.ns = 'http://localhost/MyServer/2007/09/Services/MyService/01'
  SOAPServer.__init__(self, (ip, port))
  self.registerFunction('wsdl')
  self.registerFunction('soap_myFunction', 'myFunction', namespace = self.ns)

In this way Visual Studio will be able to correctly call your exposed methods. Later we will see how to let Visual Studio correctly understand your results.

Technorati Tags: , ,

Monday, January 10, 2005

Adobe SDK - K2Vector

I had problem with a copy of a K2Vector, basically I had
an interface's method like:


class fooInterface {

  virtual void setVector(const K2Vector<fooObject>& src) { fVec =
src; };

protected:

  K2Vector<fooObject> fVec;

}


The linker's error I had was like "no operator= was
defined for K2Vector<fooObject>"...I had the K2Vector.h included but it
didn't solved my problem. It was not the first copy between vectors in the
plugin so I was a bit shooked by this error, after tries I include
"K2Vector.tpp" and that solved the problem. Really strange.
If you look at
the bottom of K2Vector.h you can see that it include "K2Vector.tpp".


Anyway, that's solved my problem and another lesson learned.


 

Thursday, December 16, 2004

Adobe SDK - plugin conflict

I had a problem with an InDesign plugin I was developing lately, the problem occours when you run InDesign and InDesign tell you that the plugin will conflicts with itself.
After a lot of tries (the plugin was pretty empty) I found out that the problem was a command that was something like:

Class
{
kSampleCmdBoss,
kInvalidClass,
{
IID_ICOMMAND, kSampleCmdImpl,
IID_ISTRINGDATA, kStringDataImpl,
IID_ISAMPLENAMEDATA, kStringDataImpl,
}
},

The culprit is the IID_ISAMPLENAMEDATA, it seems like a commands cannot have two standard kStringDataImpl, so the solution is to replace the second kStringDataImpl, to do this we need to simply define an implementation alias like this:


resource ImplementationAlias(1)
{
{
kSampleNameDataImpl, kStringDataImpl,
}
};


so now we can modify our command in this way:

Class
{
kSampleCmdBoss,
kInvalidClass,
{
IID_ICOMMAND, kSampleCmdImpl,
IID_ISTRINGDATA, kStringDataImpl,
IID_ISAMPLENAMEDATA, kSampleNameDataImpl,
}
},


and don't forget to add the kSampleNameDataImpl implementation if the xxxID.h


Friday, November 19, 2004

CControlView

If you are compiling a custom widget that derives from CControlView and the linker fails saying that it cannot find some methods of CControlView, it is high probable that you have remove NO_STRICT from the project preprocessor options.

Wednesday, September 15, 2004

How to import an Image with InCopy

Just look at the InDesign knowledge base (http://support.adobe.com/devsup/devsup.nsf/docs/50352.htm).

Hint: use the stream Luke.

Monday, August 02, 2004


Last night I didn't sleep to much...here it is a photo of the moon shooted at 4am. Posted by Hello

Monday, July 26, 2004


Me anche Chiara having fun in Stresa Posted by Hello

Wednesday, July 07, 2004

Indesign SDK

I was trying to understand how to catch a menu action for a standard Indesign menu item. Looking trough the indesign forum I found out a couple of messages that points to the knowledge base, in particular to "How To: Intercept the File>Open menu event" and "How To: Get the filename from File>New or File>Open menu dialogs".

Adobe Indesign web pages

There are some really useful pages in the adobe web site regarding incopy/indesign development:

Indesign Developer Knowledgebase

Indesign user to user forum

 

Tuesday, July 06, 2004

Food

I found out this site that contains a lot of useful information for who cooks rarely (like me).

Friday, July 02, 2004

Indesign SDK - plugin ID

Don't forget to register you plugin with Adobe in order to have an unique Plugin ID. Adobe provided an How to explaining all the necessary steps. The registration page is here.

Thursday, July 01, 2004

Indesign SDK - Front Document

When you want to obtain a pointer to the current front document (the one the user is editing) you could use

InterfacePtr doc(Utils()->GetFrontDocument(), UseDefaultIID());
but when you are inside an action component it may not work, instead you should use
InterfacePtr doc(ac->GetContextDocument(), UseDefaultIID());
where ac is the IActiveContext* passed in the DoAction.

Thursday, June 24, 2004

Source code mismatch during debugging

When you are debugging an application, if the source executed by the debugger is different than the actual source code (i.e. the code executed is not the code showed in the source code) and you are sure the pdb is absolutely right for that dll/exe, it means one of these 2 things:

1. your source code is not up to date;

2. you may have non-dos line ending mixed in the file.

I did have this problem in the past days with code I've written pretty much from scratch, it turned up to be case number 2. Probably I copy-pasted a small portion from a mac code. A full conversion to DOS endings of the source file solved the problem. I was plagued by it since two weeks ago, but only in two files, that I didn't change very much in the last days, so I let the problem remain, but today I decided I had to solve the problem because there weren't any reasonable explanation of this weird problem. Fortunately I had the idea of checking the line endings of the file and that solved my problems.

Thursday, June 17, 2004

Indesign SDK - Query story metadata

How to query for story's metadata?

Simple, assuming storyRef is the UIDRef of the story:

    Utils inCopyWorkFlowUtils;

InterfacePtr model(storyRef, IID_ITEXTMODEL);
ASSERT(model);
InterfacePtr iMetaData(inCopyWorkFlowUtils->QueryTextMetaDataBoss(model, kTrue));
if (iMetaData) {
InterfacePtr mdAcc(iMetaData, UseDefaultIID());
if (mdAcc) {
InterfacePtr mdPaths(mdAcc->Enumerate(0));
if (mdPaths) {
// iterate thru all paths
while (mdPaths->HasMorePaths()) {
PMString nspace, path;
// get the next path (by namespace and path)
mdPaths->GetNextPath(nspace, path);
PMString value;
MetaDataFeatures metaDataFeatures;
// inspect the node
if (mdAcc->Get(nspace, path, value, metaDataFeatures))
{
}
}
}
}
}

 

Wednesday, June 09, 2004

Indesign menus

It took me a while to figure it out how to add a submenu in the main File menu and position it whereever I want. The solution came from a Ken Sadahiro answer to a forum post, which point out to a Q & A session (login ASN web account required) on user interface.

I tried to do something similar, but the culprit is the 0 as the actionID for the sub-menu and the use of the delimiter ":" when adding the submenu.

Tuesday, June 08, 2004

NEP

I used to work for Tera until March 2003, recently I discovered a guy, Derek Lakin, who worked for NEP.

Nep (or I should say Nep's "this is" project) is a fantastic project that delivers all the regional news trough one big site, I was in charge of the part of the project that allow to transfer editorial content (pics and stories) from the editorial system to Nep's CMS.