POSIX API for standard clipbaord access/functions? - unix

Is there an api within the POSIX UNIX API standard for access to clipboard, like fetching current pasted item, changing current pasted item etc?
Also what I see is there does not seem to be any community or atleast that I can find where I might find more resources and posts about people developing stuff using the POSIX APIs (I know its such a niche and probably there aren't many developers working on them everyday to churn out OSes like mcdonalds burgers). Could someone point me to an appropriate place if they know exists?

What's a "clipboard"? Isn't it a concept specific to GUIs? POSIX doesn't do GUIs.
For the POSIX API, go to The Open Group Base Specifications, volume System Interfaces.
POSIX describes the interfaces which the operating system exposes to application programs. It is a tool for application developers, not for operating system developers.

Related

Can I check in unix binaries (compiled executable, libraries, etc) into PVCS

We are starting up a Unix development engagement and evaluating version control options.
Specific question: Does PVCS deployed on a Unix platform support checking in compiled code from a Unix build environment?
If so, example command perhaps?
Not looking to hear about other SCM systems at this point.
I doubt that PVCS would distinguish between binary and text files. Even if it did, it should support the notion of a binary file.
PVCS apparently doesn't do merging (not as a built-in operation), so there really isn't much that it needs to do to "support" checking in of unix binaries.
You may have problems dealing with the file permissions, however I would consider that to be a security feature - the files shouldn't be marked as executable unless you intend them to be executed, a deploy script would more than achieve this.
That said. Semantically, it is problematic asking if it "supports" checking in of unix binaries: Can a system that happens to allow such files to be checked in be claimed to "support" those files if it provides no features that ease management of those specific files, as distinct from other types of files?
Unfortunately their website is so full of marketing information that it is next to impossible to find out this information. Seriously pick a different VCS if at all possible. Heck, even Perforce would be a better choice, they provide tools for almost every current operating system and provide many levels of documentation. (Personally, I'm inclined to recommend Git, although Perforce would be a better choice in this case if you are more interested in versioning many binary files)

Free dictionary / phrasebook for i18n

Is there any free dictionary I can use for i18n?
Free as in open source / creative commons, ideally also for use in a commercial product.
Looking at the KDE i18n projects, they have translated a lot of applications in many languages. Is there a way I can use their dictionaries for a standard Qt (non-KDE) application - and am I allowed to?
You should contact the KDE localization team if you have questions about licensing of their translations.
I don't think that the l10n support of KDE applications will help yoiu directly -- they ship as a catalogue of strings, as appears in a particular context in the original application, and the translated form. There is a long way from that to automatically using the data in the context of another application, and that's also the reason why machine-generated translations have such a low quality. If you cannot speak a language and don't have anyone who could do the work for you, you won't be able to ship a working localized version in that language.

Encrypting R script under MS-Windows

I have a bunch of R scripts which I am running on a Windows machine and want to ensure that the code remains unread by those not intended to see it. On a Linux box, I could wrap the R code in a bash script #! and make an encrypted (and perhaps even a limited-life) executable shell script. What are my options to do something on similar lines under Windows?
My answer is a bit late, but I believe this is a good question. Unfortunately, I don't believe that there is a solution, or at least an easy one, at the present time.
The difficulty is common because, for most interpreted languages, including R, it is often possible to turn on logging and inspection of all commands being run. This can negate many tricks to obfuscate the code.
For those who prefer to think of code being open == good, one should know that a common reason to obfuscate the code is if one is consulting with a client that hires multiple vendors. It is not uncommon for a client to take scripts from vendor A and ask vendor B why it doesn't work with their system. (This may be done by a low-level IT flunkie, rather than someone responsible for the NDA contracts.) If A & B are competitors, A's code has just been handed to B. When scripts == serious programs, then serious code has been given away.
The ways I've seen this addressed are:
Make a call to a compiled language, and use standard protections available there.
Host the executable on a different server, and use calls to the server to execute the calculations. (In R, there are multiple server-side options.)
Use compiled (preprocessed / bytecode) code within the language.
Option 2 is actually easier and better when the code may be widely distributed, not just for IP reasons. A major advantage is that it lets you upgrade the code without having to go through the pain of a site-wide release process. If new libraries are needed, no problem - update the server.
Option 3 is done in Matlab with .p files, and can be done with py2exe for Python on Windows. In R, the new bytecode compilation may be analogous, but I am not familiar enough with it to address any differences between .Rc files in the R context and .p files in the Matlab context. For more info on the compiler, see: http://www.inside-r.org/r-doc/compiler/compile
Hosting computations on the server is great for working with unsophisticated users, because it is easier to iterate quickly in response to bugs or feature requests. The IP protection is simply a benefit.
This is not a specifically R-oriented strategy. (And it's a bit unclear what your constraints or goals really are anyway.) If you want a cross-platform encryption method, you should look into the open-source program TrueCrypt. It supports creating encrypted files that can be mounted as volumes on any machine that supports the volume formatting method. I have tested this across the Mac PC divide , since the Mac can read FAT files, but have no experience with how it might work across the Linux-PC chasm.
(Their TODO list for Windows includes;"Command line options for volume creation (already implemented in Linux and Mac OS X versions)". So I don't see any clear way to use this from within R without you running the program from the OS.)
I don't think this is possible because the R interpreter has to be able to decrypt and read the code in order to execute it which means that whoever is using that interpreter will also be able to decrypt and read the code.
I am by no means an expert, so I reserve the right to be 100% wrong about that statement.
I believe the best solution is to ensure value comes from the expertise and services provided by your company and it's employers---not from keeping secrets.
Failing that, you could try separating the code into a client/server model. That way the client just sends data and receives results---they never have access to the code that runs on the server.
However, the scientist in me just said "that solution sucks and I would never trust results provided under such conditions".

Simulating a TWAIN Device

Our company is using some software that ONLY accepts input from an "Imaging Device" i.e. a TWAIN device (e.g. scanner).
The problem is that we are receiving our files digitally, so using an actual scanner would require us to print, scan, and shred documents that we already have on the computer, but not in the software.
I was curious if anybody has any idea of how we might be able to work around this problem in the meantime. My first thought was to find some way to trick the program into thinking we're using a scanner, via some new 'imaging device' that would just read in the file, and spit it out to the software, but I don't even know where to begin with that.
We put in a feature request, seeing as how this problem should obviously be addressed in the software itself, but the company is notorious for lagging pretty hard when it comes to updates.
The system used by scanners is called TWAIN, so you'd be looking for some sort of virtual twain driver.
A quick google search will produce several hits, I don't have any experience with the software myself so can't advise any further.
Two such providers I found via experts exchange:
http://www.twaintools.de
http://www.scanpoint-usa.com
OK, months late... but in case you are interested, I have a TWAIN driver framework/toolkit that might let you build this fairly easily, depending on just what your scanning app expects, and how hard it is to read images from your digital documents. It's a Microsoft Visual C++ project. No charge but you'd need our permission to redistribute a driver based on it: GenDS
The TWAIN Working Group also has a sample/skeleton driver, I think it's straight C - and used to have some rather bad bugs (Why I wrote mine ;-) but, it might have got better.
Look for the "sample data source and application" on their download page.
And of course I have a 'commercial' version of GenDS that I use to write TWAIN drivers on contract.

OS-independent API to monitor file system?

I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:\docs and setts\user\dirToBeMonitored). So, I could be able to know which filename was added/changed/deleted at every time (or within a reasonable interval).
Is this possible with any high-medium level language?. Do you know some API (and in which language?) to do this?
Thanks.
The APIs are totally different for Windows, Linux, Mac OS X, and any other Unix you can name, it seems. I don't know of any cross-platform library that handles this in a consistent way.
A bonified answer, albeit one that requires a largish library dependency (well-worth it IMO)!
QT provides the QFileSystemwatcher class, which uses the native mechanism of the underlying platform.
Even better, you can use the QT language bindings for Python or Ruby. Here is a simple PyQT4 application which uses QFileSystemWatcher.
Notes
A good reference on on creating deployable PyQT4 apps, especially on OSX but should work for Windows also.
Same solution previously posted here.
Other cross-platform toolkits may also do the trick (for example Gnome's GIO has GFileMonitor, although it is UNIX only and doesn't support OSX's FSEvents mechanism afaik).
In Linux it is called inotify.
And on OS X it's called fsevents. It's an OS-level API, so it's easiest to access from C or C++. It should be accessible from nearly any language, although bindings for your preferred language may not have been written yet.

Resources