descriptors

unsigned char* to const TDesC8 in Symbian C++

Hi I wanna send an unsigned char * over the Socket whereas the RSockt.Send has the following signature: IMPORT_C void Send(const TDesC8 &aDesc, TUint someFlags, TRequestStatus &aStatus); I tried to do it the following way but that gives me an error message: Socket.Send( TPtrC8 ptr((TUint8*)charvariable), 0, iStatus); Error #254: Ty...

TBuf to TInt Symbian

Hi I simply wanna convert a TBuf to TInt in Symbian. I tried to do it the following way: TBuf<2> buf; buf.Copy( _L("10")); TInt valInt; TLex8 lex(buf); lex.Val(valInt); Here I get then the error message: Error: #289: no instance of constructor "TPtrC8::TPtrC8" matches the argument list argument types are: (TBuf<2>) Help ...

Symbian C++: TBuf Question

Hi I have a TBuf variable in my code that looks as follows: TBuf<100> test; test.Copy( _L("02somestringofrandomlength")); What I would like to do now, is to ignore the number (which takes the first two characters). Is there a nice way to extract the variable-length string from the test variable and thereby dismissing the number at th...

Problems with Symbian descriptor assignment

Hi, Once again I am struggeling with Symbians Descriptors... char fileName[128] = "somethingsomething"; Next I have then en TEntry object which has a member iName. To this iName I would like to assign my fileName. I tried to do it as follows: TEntry anEntry; anEntry.iName.Copy((TText8* )rEntity->fileName); - no instance of overl...

Python Data Descriptor With Pass-through __set__ command

I'm having a bit of an issue solving a problem I'm looking at. I have a specialized set of functions which are going to be in use across a program, which are basically dynamic callables which can replace functions and methods. Due to the need to have them work properly to emulate the functionality of methods, these functions override _...

Symbian character printing

I am attempting to construct a very simple proof of concept that I can write a web service and actually call the service from a symbian environment. The service is a simple Hello service which takes a name in the form of a const char* and returns back a greeting of the form "hello " + name in the form of a char*. My question is, how do I...

const char* to TDesC16

Hi I have a const char* that specifies the file that I want to delete. I want to use RF::Delete to delete a file which takes a TDesC16 as input argument. Does anyone know how to easily convert RFs fs; TUint err; const char *pFileToDelete = "c:\\myfile.txt"; if ( fs.Connect () == KErrNone ) { err = fs.Delete(pFileToDelete); fs.Cl...

Parsing variable length descriptors from a byte stream and acting on their type

I'm reading from a byte stream that contains a series of variable length descriptors which I'm representing as various structs/classes in my code. Each descriptor has a fixed length header in common with all the other descriptors, which are used to identify its type. Is there an appropriate model or pattern I can use to best parse and r...

What does .NET add to Windows/Linux processes and threads?

As far as I know, .NET uses Windows processes. What extra state information & functionality does it add to information contained in Windows thread/process descriptors? And what is different in Linux (on Mono)? ...

__get__ can be called by whom. not only __get__ but also __set__ and __del__ .thanks

my code run wrong,i don't know why class a: def __get__(self): return 'xxx' def aa(self): print 'aaaa' b=a() print b.get('aa') Please try to use the code, rather than text, because my English is not very good, thank you # class HideX(object): def __init__(self, x): self.x = x def get_x(self...

file descriptors and open files

Hello, I have two quick questions: When do two file descriptors point to the same open file ? When do two open files point to the same inode ? Also, if you happen to have some good documentation with graphs explaining this, i'll be very grateful if you show me the link to it :) Thanks! ...

Multiple file descriptors to the same file, C

I have a multithreaded application that is opening and reading the same file (not writing). I am opening a different file descriptor for each thread (but they all point to the same file). Each thread then reads the file and may close it and open it again if EOF is reached. Is this ok? If I perform fclose() on a file descriptor does it af...

C: stdin and std* errs

I want to my manipulate Stdin, then Std* but some errs: $ gcc testFd.c testFd.c:9: error: initializer element is not constant testFd.c:9: warning: data definition has no type or storage class testFd.c:10: error: redefinition of `fd' testFd.c:9: error: `fd' previously defin...

shell scripting error logging

Hi all, I'm trying to setup a simple logging framework in my shell scripts. For this I'd like to define a "log" function callable as log "LEVEL" $message Where the message is a variable to which I have previously redirected the outputs of executed commands. My trouble is that I get errors with the following {message=command 2>&3 1>...

Implementing class descriptors by subclassing the `type` class

I'd like to have some data descriptors as part of a class. Meaning that I'd like class attributes to actually be properties, whose access is handled by class methods. It seems that Python doesn't directly support this, but that it can be implemented by subclassing the type class. So adding a property to a subclass of type will cause i...

How to convert 'char' or ''TBuf' to 'TPtrC8'?

I've a question concerning a conversion from char to TPtrC8 on Symbian. How can I transform a char to TPtrC8 or a TBuf to TPtrC8? Is there a simple and quick way to do that? ...

Descriptors in global scope?

The descriptor protocol in Python 2.6 is only defined for class definitions, and thus can only be used by instances. Is there some equivalent for instrumenting get/set of globals? I'm trying to speed up the importing of a module which interacts with the host system, and as such has to perform some expensive probing of the host. The res...

Why isn't this classprop implementation working?

Based on a question I previously asked, I tried to come up with a class property that would allow setting as well as getting. So I wrote this and put it in a module util: class classprop(object): def __init__(self, fget, fset=None): if isinstance(fget, classmethod): self.fget = fget else: sel...

Descriptor that auto-detects the name of another attribute passed to it?

Can a descriptor auto-detect the name of an object passed to it? class MyDecorator( object ): def __init__(self, wrapped): # Detect that wrapped's name is 'some_attr' here pass class SomeClass( object ): some_attr = dict() wrapper = MyDecorator( some_attr ) ...

Abort linux polling

I am porting an audio mixer from directsound on Windows to alsa on Linux. I am polling on, let's say, 16 file descriptors using the system call "poll". Now i need to be able to abort the polling somehow. On Windows i am using the WaitForMultipleObjects using events and when i need to abort the waiting i just SetEvent on one of the events...