How to open File Descriptor (3) from a Dart program - dart

I'm creating a Dart program that communicate outside using File Descriptor 3.
Using let's say ruby I would do something like
out = IO.new(3)
What's the equivalent operation using Dart ?
Thank you.

Vyacheslav Egorov aka #mraleph clarified this :
you can't communicate with raw file descriptors using dart:io, this is not exposes through the APIs.

Related

How to call NSPasteboard withUniqueName from Python using PyObjC

I am attempting to create a new pasteboard using the NSPasteboard class-level function withUniqueName from Python via PyObjC, however I get the error "AttributeError: No attribute withUniqueName".
This is my first use of PyObjC. I did read the PyObjC intro but I could very easily be calling it wrong.
This code yields the error:
from AppKit import *
pb = NSPasteboard.withUniqueName()
Based on the discussion of selectors in the intro, I also tried:
from AppKit import *
pb = NSPasteboard.withUniqueName_()
but that also gave an AttributeError.
This code (excerpted from http://www.macdrifter.com/2011/12/python-and-the-mac-clipboard.html works:
from AppKit import *
pb = NSPasteboard.generalPasteboard()
From the NSPasteboard docs I see that withUniqueName is a class function whereas general is a class variable, so my attempt to invoke withUniqueName in the same way may be errant.
In attempting to determine whether I was just calling withUniqueName wrong or whether PyObjC didn't implement it, I did dir(NSPasteboard). withUniqueName was not in the list, but neither was "general" nor "generalPasteboard". Even grepping through the installed modules, I could not find "general" nor "generalPasteboard", and I know the latter works, so that was frustrating my attempt at discovery. Also I don't understand why the Python code needs to call the variable as generalPasteboard when the name in the Apple docs is just general.
I'm using PyObjC 5.2 installed from PyPI with Python 3.7.0 on Sierra 10.12.6.
Does PyObjC 5.2 support NSPasteboard withUniqueName? If so, what is the correct way to call it? If not, how would I inspect the module/class to know that?
The name withUniqueName is the Swift name of this method, the Objective-C selector is +[NSPasteboard pasteboardWithUniqueName]. This means it can be called like this:
pboard = NSPasteboard.pasteboardWithUniqueName()

Dataflow GroupBy -> multiple outputs based on keys

Is there any simple way that I can redirect the output of GroupBy into multiple output files based on Group keys?
Bin.apply(GroupByKey.<String, KV<Long,Iterable<TableRow>>>create())
.apply(ParDo.named("Print Bins").of( ... )
.apply(TextIO.Write.to(*Output file based on key*))
If Sink is the solution, would you please share a sample code w/ me?
Thanks!
Beam 2.2 will include an API to do just that - TextIO.write().to(DynamicDestinations), see source. For now, if you'd like to use this API, you can use the 2.2.0-SNAPSHOT version. Note that this API is experimental and might change in Beam 2.3 or onwards.

Error when using global variables from es5-library in typescript

I am developing an app using Angular 2 and Ionic. I am using a bluetooth library for Cordova, so not writing using ES6-modules and exports.
The library defines a global variable called 'bluetoothle', and it works as expected when I run it. However, I get a lot of complaints from the typescript compiler. I would like to either:
(Preferred) Have some better way to import the ES5-library to my typescript-project.
Tell the compiler to ignore this error.
Declare the variable, and then let the library assign value to it(however, I don't know how to declare globals in typescript the way it was possible in ES6.
Thanks in advance,
Markus
You have two options there which depend on how much work you want to put in them.
The first and easy option is to just declare the variable at the top. This will tell TypeScript that this is a variable of type any and that it doesn't need to care about where it came from or which members it has:
declare var bluetoothle;
The other route, which would be cleaner but is way more work is writing a type definition file.

XQuery: How to get system path separator?

I would like to know if there is a possibility to get the system path separator inside my XQuery code without special libraries?
No. There's nothing defined in the XQuery 1.0 or XQuery 3.0 specs to identify details of the filesystem.
However, using fn:doc(), you should be able to reference filesystem URIs generally by preceding the file name with file:/// and using / as a separator for directory.
As already mentioned, I don't think it is possible to achieve this by using standard XQuery functionality. However, depending on what processor you are using, it is quite likely that you can use Java bindings. I am aware that at least BaseX, eXist and Saxon support this.
By using this technique you can get the separator
declare namespace system="java:java.lang.System";
system:getProperty("file.separator")
Or if your processor supports the expanded QName notation you can also write
Q{java:java.lang.System}getProperty("file.separator")

How do I Make an executable Lua script using srlua?

My main goal is to either make my lua file into executable or make it into a bite code.
preferably both of them.
I am trying srlua,but in readme file it tells me to do:
"For Windows, you need to create srlua.exe and glue.exe first. Then for each
Lua program that you want to turn into a stand-alone program, do
glue srlua.exe prog.lua prog.exe
Of course, you can use any name instead of prog.exe."
and when I am trying to compile it using codebluck to get(srlua.exe),I get this :
and what dose it mean by this?
glue srlua.exe prog.lua prog.exe
where should I type that it.
Thanks in advance.
Type it into your shell. Once you have the binary of srlua, that takes "prog.lua" and glues it to "srlua.exe" making "prog.exe". Of course, you need glue as well. You can get an srlua binary and a glue binary for Lua 5.1 here. http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#srlua

Resources