How to set V$SESSION.PROGRAM via OCI? - c

Using the JDBC thin client, it is possible for the client to configure what is displayed in the PROGRAM column of the V$SESSION view (this is done by setting the CONNECTION_PROPERTY_THIN_VSESSION_PROGRAM connection property).
Is there a similar capability for a C program using OCI?
There are ways to set CLIENT_INFO, MODULE and ACTION as well as V$SESSION_CONNECT_INFO.DRIVER_INFO using the session handle, but I could find nothing for PROGRAM.

I haven't tried it, but here's an archived blog post (with example C code) on the topic. The author says you can do it by overwriting argv[0] early in your program, and OCI will send that program name to the server, e.g.
prglen = strlen(argv[0]);
strncpy(argv[0], "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", prglen);

Related

Obfuscation options - intelilock

I’m using Intellilock in order to obfuscate and lock my SW.
I tried to use “simple” obfuscation options with following params:
and when decompiling the code (using JetBrain.dot peek) I got the following code:
Since the code IS runnable and since any idiot can understand that the second parm is the password – a breakpoint gives us the password which the SW uses in order to encrypt some files.
So I tried to check the two circled checkboxes (public types/all parameters). When Opening JetBrain.DotPeek – the result is fantastic – nothing is understandable.
But now the SW doesn’t open at all….
When looking into windows event viewer I get the following log:
.
Which means the static main couldn’t start even…
Any simple guidlines for how to normaly obfuscate my code?
Thanks!
So - I got a reply from IntelliLock support.
Obfuscating a public class requires obfuscating all dlls calling this class, such that all will get the new, obfuscated name.
So just adding all dlls is required.
I'm not sure yet [and will update hopefully] if skipping ignoring them will be sufficient.

Is this a bug in the Log class in CodenameOne?

I've been trying to use the log class to capture some strange device-specific failures using local storage. When I went into the Log class and traced the code I noticed what seems to be a bug.
when I call the p(String) method, it calls getWriter() to get the 'output' instance of the Writer. It will notice output is null so it calls createWriter() create it. Since I haven't set a File URL, the following code gets executed:
if(getFileURL() == null) {
return new OutputStreamWriter(Storage.getInstance().createOutputStream("CN1Log__$"));
}
On the Simulator, I notice this file is created and contains log info.
so in my app I want to display the logs after an error is detected (to debug). I call getLogContent() to retrieve it as a string but it does some strange things:
if(instance.isFileWriteEnabled()) {
if(instance.getFileURL() == null) {
instance.setFileURL("file:///" + FileSystemStorage.getInstance().getRoots()[0] + "/codenameOne.log");
}
Reader r = new InputStreamReader(FileSystemStorage.getInstance().openInputStream(instance.getFileURL()));
The main problem I see is that it's using a different file URL than the default writer location. and since the creation of the Writer didn't set the File URL, the getLogContent method will never see the logged data. (The other issue I have is a style issue that a method getting content shouldn't be setting the location for that content persistently for the instance, but that's another story).
As a workaround I think I can just call "getLogContent()" at the beginning of the application which should set the file url correctly in a place that it will retrieve it from later. I'll test that next.
In the mean time, is this a Bug, or is it functionality I don't understand from my user perspective?
It's more like "unimplemented functionality". This specific API dates back to LWUIT.
The main problem with that method is that we are currently writing into a log file and getting its contents which we might currently be in the middle of writing into can be a problem and might actually cause a failure. So this approach was mostly abandoned in favor of the more robust crash protection approach.

Reading FILEOBJECTs of Saved Note

I am involved in using the C API to interact with Lotus Notes and Lotus Domino. I'm running into issues when reading existing Notes out of an NSF. Specifically, reading TYPE_OBJECT fields and even more specifically, $FILE fields (though I'm sure all TYPE_OBJECT fields would fail if I had any others).
I'm using NSFItemInfo to get the summary data on the $FILE field (so I don't need the saved file, I need information about it such as its size, name, etc...).
If I create the Note in memory, Commit it, then read the $FILE field, everything works. If I change my unit test to read an existing Note (instead of creating it in memory), Lotus PANICS with an Invalid Handle Lookup message.
So I'm left feeling like there is something different about loading those fields when I create a Note from scratch Vs opening one already created. Even reading in an already created Note that my own code created gives me the same error, so I think I'm creating the Notes correctly.
I've explored the NSFNoteOpenExt's flags options and have attempted to open the Note with every possible flag described in OPEN_xxx and I always get the panics except when I open the Note with OPEN_ABSTRACT or OPEN_NOOBJECTS. The reason those don't error though, is because they open the Note without the $FILE fields at all, so when I see if the field exists I get a false and the code to read in TYPE_OBJECT fields is never executed.
Any ideas what I'm missing?
I'd provide code, but I'm actually using .NET interop to accomplish all this, and the code is spread across multiple files, etc.... If you have any questions please ask and I'll provide as much detail as I can.
Craig
I figured out the issue. It came from the fact that when using interop in C#, you can't call C macros. OSLockBlock is defined as a macro to another macro to a function. Essentially, it locks the BlockId.Pool pointer, then increments the pointer by BlockId.BlockHandle. I was mis-interpreting that macro logic to be first increment BlockId.Pool by BlockId.BlockHandle, then lock.
Essentially:
Lock(BlockId.Pool)+BlockId.BlockHandle Vs Lock(BlockId.Pool+BlockId.BlockHandle)
It's interesting that the latter would work when creating a new note with new attachments. I finally figured that out as well, BlockId.BlockHandle was always zero when doing that. So that's why that always worked.

Error converting 0 to double on user's machine with Silverlight

I have a Silverlight application that gets down data from the server in the form of an XML string, opens it as a document, and parses through things.
This works on all other machines, but we have client with a user who's machine is unable to run things properly. Her box gives her an InvalidCastException that looks like it's trying to convert 0 to a Double.
This seems like an environmental issue, but I can't figure out what the cause of this would be or how to fix it. Her cultural settings appeared okay, at least for the numeric settings.
Anyone bumped into anything similar or have any next steps for diagnosis or possible fixes? I don't think we can attach to the machine or anything.
Relevant stack trace included below:
[InvalidCast_FromStringTo]
Arguments: 0,Double
Debugging resource strings are unavailable. Often the key and arguments
provide sufficient information to diagnose the problem. See
http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.10411.0&File=Microsoft.VisualBasic.dll&Key=InvalidCast_FromStringTo
Type: System.InvalidCastException
at
Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String
Value, NumberFormatInfo NumberFormat)
at MyNamespace.MyLoader.LoadXml(String xml)

how to Open a new instance of jEdit?

I'm new to jedit, and I haven't yet found out how to open a new window. For example, I want to be editing one set of files in one space on my Mac, and edit a different set of files in another. Does anyone know how to open a new instance/window of jedit to make this possible?
Thanks
You should set Buffer Sets scope to "View"
See also: Buffer Sets
It is possible to really Open a new instance of jEdit, and not only to open a new set of buffers in the same instance.
You have to launch jEdit with the -noserver option.
"Do not attempt to connect to a running edit server, and do not start one either."
Please see documentation here :
http://www.jedit.org/users-guide/cli-usage.html#d0e471
On Windows, to set this option you have to add it to the command line of the shortcut which launches jEdit.
It's a new feature to 4.3. It's under View | Buffer Sets. You click on either the "View Scope" or "EditPane Scope" buffer sets checkbox.
When you open a new View, it's a separate window instance. It has a buffer set and an edit pane. With more than one View open, you can decide to share buffer sets (global scope) or each keep their own (View scope). When you split the View, you add another Edit pane. Each can use the View's buffer set, or have their own (EditPane scope)
Global scope: All Views and EditPanes share a common buffer set
View Scope: EditPanes in the same view share the same buffer set
EditPane Scope: Each EditPane can have it's own independent buffer set.
The editpane scope works when you have split the view (view | splitting). You can look at files side-by-side, and each side can have their own buffer set. Very useful in comparing files in two different directories (one set per side), for example.
I wish there was an answer for this, since I'm constantly trying to open new instances of JEdit (despite being a daily user for several years now). But, as far as I can tell, you can't.
I have to assume this is another example of a good project getting over-architected.
Instead of allowing separate instances which logically associate different buffer behaviors using the built-in OS mnemonics, the JEdit crew have decided to create their own UI concepts. What OS lacks the concept of software instances and a task bar? Was it necessary to force a single-instance mode, and then re-create basic OS UI functionality in an obscure manner?
A hint for budding developers out there: if you're creating new terminology to handle UI concepts in your application, you're probably doing it wrong.
The following command line invocation will solve your problem:
jedit -noserver
You can create an alias for jedit that contains the above.
In the Jedit help, see Chapter 2, "Starting Jedit", in the section on Command Line Usage, Edit Server Options, and you will find the -noserver description.

Resources