VLC Lua scripting https request - https

I'm writing a small vlc extension for nba league pass, actually i rewrite kodi addon for vlc, and i'm stuck at very beginning with LogIn function, i write working lua script in ZeroBrain Studio
http = require("socket.http")
json = require("dkjson")
ltn12 = require("ltn12")
https = require("ssl/https")
data = "username=user&password=pass"
res, code, response_headers, status = https.request {
response_body = {} ,
method = "POST",
headers= {
["Content-Type"]="application/x-www-form-urlencoded",
["Content-Length"] = data:len()
},
url = 'https://watch.nba.com/nba/secure/login?',
source = ltn12.source.string(data),
sink = ltn12.sink.table(response_body)
}
print (response_headers["set-cookie"])
Problem is that it uses "https". I've tried do this but get error
Error while running script C:\Program Files (x86)\VideoLAN\VLC\lua\extensions\nba_league_pass.lua, function (null)(): error loading module 'socket.core' from file '.\socket\core.dll': dynamic libraries not enabled; check your Lua installation
So, my question is how to make https request in vlc?
Thanks.

error loading module 'socket.core' from file '.\socket\core.dll': dynamic libraries not enabled; check your Lua installation
"dynamic libraries not enabled" usually indicates that your Lua interpreter is compiled without LUA_DL_DLL compilation flag (on Windows); specifying this compilation flag enables loading of dynamic libraries. (The Lua interpreter would be the one packaged with or embedded into VLC if that's what you are running.)

Related

How to Get Response String from HTTP Server using HTTPSRedirect.h (NodeMCU)

The following code is responible for getting a string from HTTP Server
while (client.connected())
{
if (client.available())
{
String line = client.printRedir(url3, host);
Serial.println(line);
}
}`
Error Message:
no matching function for call to 'HTTPSRedirect::printRedir(String&,
const char*&)
How to store the response string from server
The use of HTTPSRedirect library makes the task much simpler by avoiding the need of any third party service. So, the first thing you need to do is to copy the HTTPSRedirect library files from GitHub and install into your Arduino libraries folder. I have also posted the zipped library files at the following link for convenience.
Download HTTPSRedirect Library
Update: The above library is outdated.
Please go to GitHub Sujay Phadke and download the updated library. Thanks Sujay.
from above discussion it must be you are using old version of HTTPSRedirect library,
to get new got to [Updated Library ] and download the library and copy the HTTPSRedirect folder from zip folder into the Arduino Ide libraries.
the above process solved my issue.
Define the host as below
const char* host = "your host";
And for string use
String url = "your complete url";

Perl script compiled as Windows executable does not connect to Oracle

I have a Perl Script that I've written that connects to Oracle. The script works perfectly on my machine with PERL64 installed. I tried to turn this script into an EXE using ActiveState PerlApp. Again, works perfectly on my machine. Once the executable is on a machine that does not contain Perl it is missing DLL's needed to connect to Oracle.
use DBI;
# CONFIG VARIABLES
our $database = "database.app.net";
our $host = "server.app.net";
our $port = "1522";
our $user = "SVC_app";
our $pw = 'Password';
# DATA SOURCE NAME
our $dsn = "dbi:Oracle:$host:$port/$database";
# PERL DBI CONNECT
our $connect = DBI->connect($dsn, $user, $pw);
# PREPARE THE QUERY
our $query = 'SELECT Blah FROM database."table" where "blah" = ?';
our $query_handle = $connect->prepare($query);
# EXECUTE THE QUERY
$query_handle->execute($value);
# BIND TABLE COLUMNS TO VARIABLES
$query_handle->bind_columns(undef, \$return);
# LOOP THROUGH RESULTS
while($query_handle->fetch()) {
#print "$return";
}
The error i receive is :
Can't load 'auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified module could not be found at/DynaLoader.pm line 224.
Thanks in advance
There are two cases:
If you do NOT have the DLL files on the target machine, it's not going to work. DLL files aren't linked into the executables (as the name says, they're Dynamic Link Libraries, not static libraries)
If you DO have the DLL files on the target machine, but they're not found then there are a few possible explanations. The files may not be in the PATH, for instance. Or the files may not have the correct permissions, especially if you're calling your executable from something like a service (which by default runs on a system account which has different permissions).
Also, keep in mind that Window is a bit picky about DLL files. It may say that Oracle.dll is missing, but what is actually missing may be one of its dependencies. Maybe OCI.dll ?
And if you have more than one DLL file with the same name, try and make sure which one is loaded, because it may not be the right version.
If the files are there, there's only one version of them, they're in the PATH and it still cannot find them, you can try registering the files manually by running the regsvr32 command on the required DLL.
You need to separately install the Oracle client on any machine that you are running your EXE on.
PerlApp in the ActiveState's PDK will not wrap Oracle clients into the EXE because doing so will violate Oracle's re-distribution agreement.

File Write - Unauthorized Access Exception

Trying to save a file locally from an app running in the iOS 8 Simulator and I'm continually getting access denied exceptions.
In previous apps I've used the following code to get a valid file path:
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
or
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
But I've read that with iOS 8 this has now got to be written as:
NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory,
NSSearchPathDomain.User)[0]
So I'm using the following code to generate a file path for a .txt file and receiving an access denied exception when trying to save with it:
public void SaveMyFile(string content)
{
NSUrl[] urls;
string filePath;
//
urls = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory,
NSSearchPathDomain.User);
filePath = Path.Combine(urls[0].Path, "MyApp", "myFile.txt");
File.WriteAllText(filePath, content);
}
So the file path that it gives me and also denies access to is /Users/Idox/Library/Developer/CoreSimulator/Devices/92498E38-7D50-4081-8A64-83061DC00A86/data/Containers/Data/Application/C35B3E98-C9E3-4ABA-AA7F-CD8419FA0EA5/Documents/MyApp/myFile.txt.
I'm wondering if there's some setting that needs to be toggled to give the app write access to this directory or if the directory itself is invalid.
I've also done a call to Directory.Exists(string path) to check if the directory is there, which it is.
You're missing the Path property on urls[0].Path
filePath = Path.Combine(urls[0].Path, "MyApp", "myFile.txt");
This was fixed in Xamarin.iOS 8.4, so if you're using a recent version of Xamarin you can use Environment.GetFolderPath without problems (which is useful if you want to share code across platforms).

Get GraphicsMagick to open file from a https url?

I can use GraphicsMagick to download images given a URL, however when the URL starts with a https I get the following error (for https://example.com/image.png):
Unable to open file (//example.com/image.png) [No such file or directory].
I am using the gm driver for node.js with code like so:
gm = require('gm');
gm(url).write(name);
but have also tried the gm directly from the command line with the same issue.
As stated already, it works fine for http URLS, can I get it to work for https?
GraphicsMagick uses the HTTP support from libxml2, which does not currently support HTTPS. Try using an external program like 'wget' or 'curl' (which use OpenSSL to support HTTPS) to retrieve the file. Then you can pass the returned file to GraphicsMagick.
As Bob said, HTTPS is still not supported BUT:
Using the https module you can create a buffer and input it directly into GraphicsMagick.
https.get('https://www.eff.org/files/https-everywhere2.jpg', function(response) {
gm(response, 'image.jpg')
.write('test.jpg', function(err) {
if (err) return handle(err);
console.log('Created an image from a Buffer!');
});
});

Scripted editing of Symfony 2 YAML file breaks the formatting and produces errors

I'm trying to script out our entire installation process of new Symfony 2.1 projects including adding and configuring all our bundles and their dependencies. The end result should be one command that sets up everything so the developer is both forced into our best practices setup, and does not have to spend time on this.
So far this is fairly successful since it is now possible to go from 0 to fully installed CMS in about an hour (mostly due to composer installs). You can see the result here: https://github.com/Kunstmaan/KunstmaanSandbox/blob/feature/update-to-2.1/README.md
The next fase of this project is modifying the Symfony config YAML files. But here I'm stuck.
For the parameters.yml I did this with a ruby script, here is the relevant extract, the full script can be found here: https://github.com/Kunstmaan/KunstmaanSandbox/blob/feature/update-to-2.1/app/Resources/docs/scripts/sandboxinstaller.rb
parametersymlpath = ARGV[1]
projectname = ARGV[2]
parametersyml = YAML.load_file(parametersymlpath)
params = parametersyml["parameters"]
params["searchport"] = 9200
params["searchindexname"] = projectname
params["sentry.dsn"] = "https://XXXXXXXX:XXXXXXXX#app.getsentry.com/XXXX"
params["cdnpath"] = ""
params["requiredlocales"] = "nl|fr|de|en"
params["defaultlocale"] = "nl"
params["websitetitle"] = projectname.capitalize
File.open(parametersymlpath, 'w') {|f| f.write(YAML.dump(parametersyml)) }
So far so good, but the same type of script fails on the config.yml due to these lines:
imports:
- { resource: #KunstmaanMediaBundle/Resources/config/config.yml }
- { resource: #KunstmaanAdminBundle/Resources/config/config.yml }
- { resource: #KunstmaanFormBundle/Resources/config/config.yml }
- { resource: #KunstmaanSearchBundle/Resources/config/config.yml }
- { resource: #KunstmaanAdminListBundle/Resources/config/config.yml }
The # is a reserved character according to the YAML spec and Ruby throws an error.
So I switched to php and the Symfony yaml component since at this point in the install there is a full symfony install and i came up with this standalone command: https://gist.github.com/3526251
But when reading and dumping the config.yml file the lines above for example would turn into
imports:
-
resource: #KunstmaanMediaBundle/Resources/config/config.yml
-
resource: #KunstmaanAdminBundle/Resources/config/config.yml
-
resource: #KunstmaanFormBundle/Resources/config/config.yml
-
resource: #KunstmaanSearchBundle/Resources/config/config.yml
-
resource: #KunstmaanAdminListBundle/Resources/config/config.yml
Which looks like crap and i'm not entirely sure this will even work.
So at this point i'm looking at moving the fully modified config.yml files to the install script and just overwriting the originals. I would rather not go there, since it will take constant maintenance if something changes in the symfony-standard project.
I'm wondering if there is another way?
These two forms are semantically equivalent. They are called the Inline and Indented Blocks, respectively.

Resources