Implementing ACPI function in UEFI - wmi

I'm trying to implement ACPI function that will run in UEFI that will respond to code similar to this:
'executes a WQL query
Set colItems = objWMIService.ExecQuery("Select * from Password where InstanceName='ACPI\\PNP0C14\\0_0'")
'modify the supervisor password
For Each objItem in colItems
'execute the method and obtain the return status
objItem.SetPassword strInParamValue, strReturn Next
Which UEFI protocol/functions are needed to be implemented? please refer me to sample code.
Thanks.

what would you like to development, it is built from BIOS. unless you got source code from project vendor. otherwise, you cannot change it. however, if you are application development. you can get mof to create self-application to do something.

Related

C++ Poco ODBC Transactions - AutoCommit mode

I am currently attempting to use transactions in my C++ app, but I have a problem with the ODBC's auto commit mode.
I am using the POCO libaries to create a connection to a PostgreSQL database on the same machine. Currently, I can send data to this database as single statements, but I cannot get my head around how to use Poco's transaction libraries to be able to send this data more quickly.
As I have several thousand records to insert, and so continuing to use single insert statements is extrememly slow and inpractical - So I am trying to use Poco's transaction to speed this up a bit (a fair bit).
The error I am encountering is a theoretically a simple one - Poco is throwing the following error:
'Invalid access: Session is in auto commit mode.'
I understand, as a result of this, I should somehow set "auto commit" to false - as it only allows me to commit data to the database line by line, rather than as a single transaction.
The problem is how I set this.
Currently, I have a session created from Session.h, that looks alot like this:
session = new Poco::Data::Session(
"ODBC",
connection_data.str()
);
Where connection data is a simple stringstream with the login information, password, database, server and "Driver={PostgreSQL ANSI};" to tell ODBC to utilize PostgreSQL's driver.
I have tried just setting a property "autocommit" to false through the session's setFeature or setProperty settings, this, of course, was to no avail. (it was more of a ditch attempt at this point).
session->setFeature("AUTOCOMMIT", false);
Looking around, I saw a possible alternative method by creating a ODBC sessionImpl directly from ODBC/session/SessionImpl.h instead of using this generic method above, and then creating a new session object from this.
The benefits of this are that ODBC's sessionImpl has references to autocommit mode in the header, which would suggest it would be able to handle this:
void autoCommit(const std::string&, bool val);
/// Sets autocommit property for the session.
However, having not used sessionImpl before, I cannot garuntee if this will work or if can can get this to work with the limited documentation available.
I am using C++ 03 (Not 11), with Visual Studio 2015
Poco 1.7.5
Boost (Where needed)
Would any one know the correct way of setting this feature (above) or a alternative method to achieving this?
edit: Looking at the source of poco, at:
https://github.com/pocoproject/poco/blob/develop/Data/ODBC/src/SessionImpl.cpp#L153
The property seems be named autoCommit, and looking at
https://github.com/pocoproject/poco/blob/develop/Data/include/Poco/Data/AbstractSessionImpl.h#L120
the case of the property names seem to matter. So, does it help if you use session->setFeature("autoCommit", false);?
Cant you just call session->begin(); and session->end(); on the corresponding Session object?
What is returned by session->canTransact()?
According to the doc begin() will start a new transaction, the doc does not mention any property that needs to be set before or after.
See: https://pocoproject.org/docs/Poco.Data.Session.html
Also faced a similar issue.
First of all before begin() need:
m_ses.setFeature("autoCommit", false);
m_ses.begin();
And the second issue is that this feature stays "autoCommit" in false for all other sessions. So don't forget for the next session call
session.setFeature("autoCommit", true);

AS400 with Ruby on Rails

I am trying to access our AS400 database with Ruby on Rails, using the "dbi" gem and the "dbd-odbc" gem.
I have found this code to build off of. When I pass in the server address...
It seems that the original code uses an DSN, but I wanted to pass in the IP, database name, and library in the code to prevent any DSN being needed.
require 'dbi'
dbh = DBI.connect('DBI:ODBC:SYSTEM=<ip_address>;DBQ=<db_name>;DFTPKGLIB=<library_name>;LANGUAGEID=ENU', 'UID=<user_name>', 'PWD=<password>')
sth = dbh.prepare('select count(*) from my_table')
sth.execute
# Print out each row
while row=sth.fetch do
p row
end
sth.finish
dbh.disconnect
it gives me an error of...
DBI::InterfaceError: Unable to load driver 'ODBC'
what would be the correct syntax?
This works for me - also, just put your authentication portion inside of the first argument to the DBI.connect function:
First install the gems: dbi, dbd-odbc, ruby-odbc. I was getting the same error without the ruby-odbc gem
Then:
require 'odbc'
require 'dbi'
dbh = DBI.connect('DBI:ODBC:SYSTEM=MYAS400;DBQ=TABLE_NAME;DFTPKGLIB=SCHEMA_NAME;DRIVER=Client Access ODBC Driver (32-bit);LANGUAGEID=ENU;USERID=SUPERADMIN;PWD=SUPERSECURE')
I don't know exactly how that works in Ruby, but in the connection string I don't see where you mention the driver your trying to use to connect.
Seems like this line:
dbh = DBI.connect('DBI:ODBC:SYSTEM=<ip_address>;DBQ=<db_name>;DFTPKGLIB=<library_name>;LANGUAGEID=ENU', 'UID=<user_name>', 'PWD=<password>')
needs to be something like this to indicate the driver ODBC should use to connect:
dbh = DBI.connect('DBI:ODBC:Driver=iSeries Access ODBC Driver;SYSTEM=<ip_address>;DBQ=<db_name>;DFTPKGLIB=<library_name>;LANGUAGEID=ENU', 'UID=<user_name>', 'PWD=<password>')

R Markdown with Shiny Server change host parameter

I am running RStudio on a server and I created a RMarkdown (.Rmd) file. It works fine if I create it as a static HTML but it does not work if I want it to be interactive (by adding runtime:shiny).
The issue is that when I add runtime:shiny and press the Run Document button the application will try to open at 127.0.0.1:xxxx (here xxxx is a random port). In order to make it work I would have to be able to change the host parameter to '0.0.0.0'. This is an option in the runApp function from the shiny package but I don't know how to add this option in RMarkdown.
Can anyone help me with this?
Thank you.
The ::run command from rmarkdown invokes shiny::runApp internally. You can set the option shiny.host before running the document:
options(shiny.host="0.0.0.0")
rmarkdown::run("myfile.Rmd")
You an also pass arbitrary paramters to runApp, so this should work too:
rmarkdown::run("myfile.Rmd", shiny_args=list(host="0.0.0.0"))
Neither of these will work with the Run Document button; that button starts a new R session in which to render the document. To change the shiny.host option in that session, you'll need to add the option to your .Rprofile.
Set the default values you want to initialize in (~/.Rprofile) under user directory
Sys.setenv(TZ = "UTC") # for Timezone
options(shiny.port = 9999)

Can I programmatically use the OneNote printer driver?

I have a system service that handles print requests, and given a printer name from the user, attaches a DC to that printer. It starts a document, ends it, and detatches.
m_PrinterDC.CreateDC (L"WINSPOOL", _printerName.c_str(), NULL, NULL)
m_DC.Attach(m_hprinter)
m_DC.StartDoc(...)
...
mDc.TextOut(...)
...
m_DC.EndDoc()
m_DC.Detatch()
This works fine for normal printers, but when using the "Print to OneNote" functionality (driver name 'Send To OneNote 2010') it doesn't seem to work. I would like to avoid custom logic just for this feature; ideally all printers would work regardless. Any thoughts what might be going wrong? I've tried updating the printer security settings to include Print rights for group everyone; not sure what else to try.
Unfortunately, I have to guess some points, because you seem to avoid detailed description of error condition.
First, if you check all return values are success, just it may be a problem about onenote itself. Check the condition of onenote by printing using other programmes.
Second, did you check if _printerName is exact? If some of users are using other language OS, the driver name, 'Send To OneNote 2010' will be different or depending on version. Of course, if you check all return values of function calls, it recorded in your log file. However, I'm worrying about you used exact printer name by using 'EnumPrinters'.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162931(v=vs.85).aspx
I hope this helps you a little.

How to find the source of ora-01031 insufficient privileges when executing a test on a ref cursor with utPLSQL?

I'm doing research on unit testing in PLSQL. I set up a test database with some tables and packages with functions and procedures. Currently I'm giving the test framework 'utPLSQL' a try but stumbled upon an error when testing on a ref cursor. I can run all of my tests but the result of the test on the ref cursor says "ora-01031 insufficient privileges", that's all I get. How can I find the source of this error? Or does anyone encountered the same problem? The installation of utPLSQL was successful and all the other functionality of the test framework works.
This is the procedure I want to test:
FUNCTION F_Get_Customers_RefCurs(P_LASTNAME IN VARCHAR2)
RETURN cust_refcur
IS
cust_result cust_refcur;
BEGIN
OPEN cust_result FOR
SELECT *
FROM CUSTOMERS
WHERE LASTNAME = P_LASTNAME
ORDER BY email ASC;
return(cust_result);
END F_Get_Customers_RefCurs;
I have declared cust_refcur in the spec of the package which contains my function as following:
TYPE cust_refcur IS REF CURSOR;
And this is the test:
PROCEDURE ut_F_Get_Customers_RefCurs
IS
params utplsql_util.utplsql_params;
BEGIN
utPLSQL_Util.reg_In_Param (1,
'Tester',
params);
UTASSERT.eq_refc_query ('Get customers on last name is successful (refcursor)',
'PK_ORDERS.F_GET_CUSTOMERS_REFCURS',
params,
0,
'SELECT customerid, firstname, lastname, email, password
FROM CUSTOMERS
WHERE LASTNAME = ''Tester''
ORDER BY email ASC');
END;
I tried getting your example to work, but unfortunately, I got weird errors from utPLSQL.
Since the last version of utPLSQL on Sourceforge is from 2005 and Steven Feuerstein is now working on a commercial product that essentially does the same, I'd recommend looking into other solutions for unit testing your PL/SQL code - some links:
Oracle SQL Developer has some built-in unit test-functionality, and it's free
there's also Quest code tester (this one's commercial)
maybe cause by 'RETURN cust_refcur',the type use by utplsql is store in varchar2(10) ,
try 'return refcur' ?
-zhaozb
When running this assertion (eq_refc_query), utPLSQL needs to temporarily create a table. It does this by using EXECUTE IMMEDIATE which requires that the user have the CREATE TABLE privilege granted to them directly, rather than via a role.
[Full disclosure: I am one of the administrators of the utPLSQL project]