I'm following this tutorial for finding locations on my j2me device. In the default codename1 mechanism, it tries to find it out through GPS. But my phone doesn't have it. So it opens the bluetooth connect screen. I'm using the following code.
com.codename1.location.LocationManager.getLocationManager().getCurrentLocationSync();
In the tutorial mentioned, we could change the retrieval mechanism to CELL-ID or Network, by doing the following.
//Specify the retrieval method to Online/Cell-ID
int[] methods = {(Location.MTA_ASSISTED | Location.MTE_CELLID | Location.MTE_SHORTRANGE | Location.MTY_NETWORKBASED)};
// Retrieve the location provider
provider = LocationUtil.getLocationProvider(methods, null);
Is there any way we could do a similar stuff in codename1 ??
We don't support other methods in J2ME devices at this point in time. You can use native interfaces to implement it.
Related
I was struggling with this for a couple of days now and Google seem to have no information..
I'm trying to interface a DataLogic-QuickScan-QD2131 scanner using OPOS (under windows 10, RS-232 OPOS interface) with nodejs.
I understood that OPOS uses ActiveX controller to communicate, so i use the winax npm-package to create ActiveXObject reference, but I have no idea what is the "class string" i should provide to the constructor.
Here's my code:
require("winax");
const con = new ActiveXObject("OPOSService.OPOSScanner");
console.log(con);
this will fail with the following error:
Uncaught Error: CreateInstance: OPOSService.OPOSScanner Invalid class string
Thanks guys!
You probably should stop using OPOS from Node.js.
As I answered your other question, the current OPOS only supports 32bit.
If you still want to use it, find and specify the programmatic ID string for the scanner OCX in DataLogic's OPOS.
I don't have any information about what it looks like, so you can find it yourself or contact DataLogic.
As an alternative, obtain and install the Common CO from the following page and specify "OPOS.Scanner" as the programmatic ID.
MCS: OPOS Common Control Objects - Current Version
If you have a combination of Node.js and a barcode scanner in serial port mode, it would be better to send commands and receive barcode data directly from Node.js using the serial port instead of OPOS.
I have been looking to find a way for my Qt application to know if a VNC connection is active.
How/can I get a VNC connection status?
This is an embedded Linux application.
A starting point would be to look into the Qt sources at src/plugins/gfxdrivers/vnc/qscreenvnc_p.h; there a class QVNCServer is declared that also defines a isConnected() method which appears to do exactly what you need.
The crucial point, however, is to access that method from your application code; as can be deducted from the filename suffix _p the classes in that header are private (read: internal) to the Qt libs and not part of the public interface. Accordingly they are not documented in the reference, and I haven't found a public method to get the current QVNCServer object, nor any other VNC related instance that could provide a pointer to that object.
My suggestion is that you start with the related public interface in src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h, which incorporates the server class as part of a QProxyScreen subclass, and work onwards from there to get an idea how the VNC server instance is created, and where the pointer to it is handled. You may be able to add a method to the QVNCScreen interface which allows you to get the connection state from your application. However you'll have to patch the Qt sources and rebuild the libraries.
Getting the QScreen object in application code is easy:
foreach(const QScreen* s, QScreen::instance()->subScreens())
{
if(s->classId() == QScreen::VNCClass)
//Here you can cast the screen instance and call a method on it
}
I'm trying to connect to fiscal printer using serial port in xamarin.forms application.
I managed to make it work on android, but I have some troubles with UWP.
I am currently testing it on desktop if it matters.
await DeviceInformation.FindAllAsync() - this line never returns, no matter whether I call it with selector or not.
var sel = SerialDevice.GetDeviceSelector("COM7");
var coll = await DeviceInformation.FindAllAsync(sel);
It just hangs. Anybody knows how to use FindAllSync / has a similar problem? I've found some examples on the web, but they do not seem to work, the method always hangs for me.
I also tried to use a different approach and use devicewatcher, I was able to get the list of all devices and the bluetoothdevice object, however I couldn't create a serialport for it.
We know an iOS app can connect to Wifi with CaptiveNetwork reference. As described in some related post: Connect WiFi Network via App.
Is there any similar library to help a Windows app to view exising wifi around and get connected?
Yes. There's the Windows.Devices.Wifi namespace. (Details here https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.wifi.aspx?f=255&MSPPError=-2147217396 )
It offers Methods to list networks and a method called ConnectAsync() to connect. I once coded a sample here (it also covers other stuff): https://github.com/DanielMeixner/w10demoking/blob/master/Windows10DemoKing/wifi.xaml.cs
The magic lines of code are
using Windows.Devices.WiFi;
// create network adatper instance (see sample code in link above) ...
var nw = nwAdapter.NetworkReport.AvailableNetworks.Where(y => y.Ssid.ToLower() == "myssid").FirstOrDefault();
await nwAdapter.ConnectAsync(nw, WiFiReconnectionKind.Automatic);
We are designing an Azure Website which will allow users to Upload content(MP4,Docx...MSOffice Files) which can then be accessed.
Some video content we will encode to provide several differing quality formats, before it will be streamed (using Azure Media Services).
We need to add an intermediate step so we can scan uploaded files for potential virus risk. Is there functionality built into azure (or third party) which will allow us to call an API to scan content before processing it? We are ideally looking for an API rather than just a background service on a VM, so we can get feedback potentially for use in a web or worker role.
Had a quick look at Symantec Endpoint and Windows Defender but not sure these offer an API
I have successfully done this using the open source ClamAV. You don't specify what languages you are using, but as it's Azure I'll assume .Net.
There is a .Net wrapper that should provide the API that you are looking for:
https://github.com/tekmaven/nClam
Here is some sample code (note: this is copied directly from the nClam GitHub repo page and reproduced here just to protect against link rot)
using System;
using System.Linq;
using nClam;
class Program
{
static void Main(string[] args)
{
var clam = new ClamClient("localhost", 3310);
var scanResult = clam.ScanFileOnServer("C:\\test.txt"); //any file you would like!
switch(scanResult.Result)
{
case ClamScanResults.Clean:
Console.WriteLine("The file is clean!");
break;
case ClamScanResults.VirusDetected:
Console.WriteLine("Virus Found!");
Console.WriteLine("Virus name: {0}", scanResult.InfectedFiles.First().VirusName);
break;
case ClamScanResults.Error:
Console.WriteLine("Woah an error occured! Error: {0}", scanResult.RawResult);
break;
}
}
}
There are also APIs available for refreshing the virus definition database. All the necessary ClamAV files can be included in the deployment package and any configuration can be put into the service start-up code.
ClamAV is a good idea, specially now that 0.99 is about to be released with YARA rule support - it will make it really easy for you to write custom rules and allow clamav to use tons of good YARA rules in the open today.
Another route, and a bit of shameless plugging, is to check out scanii.com, it's a SaaS for malware/virus detection and it integrates quite nicely with AWS and Azures.
There are a number of options to achieve this:
Firstly you can use ClamAV as already mentioned. ClamAV doesn't always receive the best press for its virus databases but as others have pointed out it's easy to use and is expandable.
You can also install a commercial scanner, such as avg, kaspersky etc. Many of these come with a C API that you can talk to directly, although often getting access to this can be expensive from a licensing point of view.
Alternatively you can make calls to the executable directly using something like the following to capture the output:
var proc = new Process {
StartInfo = new ProcessStartInfo {
FileName = "scanner.exe",
Arguments = "arguments needed",
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
while (!proc.StandardOutput.EndOfStream) {
string line = proc.StandardOutput.ReadLine();
}
You would then need to parse the output to get the result and use it within your application.
Finally, now there are some commercial APIs available to do this kind of thing such as attachmentscanner (disclaimer I'm related to this product) or scanii. These will provide you with an API and a more scalable option to scan specific files and receive the response from at least one virus checking engine.
New thing coming Spring / Summer 2020. Advanced threat protection for Azure Storage includes Malware Reputation Screening, which detects malware uploads using hash reputation analysis leveraging the power of Microsoft Threat Intelligence, which includes hashes for Viruses, Trojans, Spyware and Ransomware. Note: cannot guarantee every malware will be detected using hash reputation analysis technique.
https://techcommunity.microsoft.com/t5/Azure-Security-Center/Validating-ATP-for-Azure-Storage-Detections-in-Azure-Security/ba-p/1068131