4D mobile: pessimistic locking not working - locking

I'm trying to make use of the entity.lock() method on wakanda to lock a record to my 4D users, as described in the documentation for lock().
Yet, when applying the code given in the doc, the lock() method always return false, and 4D can happily edit the record Wakanda is trying to lock out.
I'm using 4D 14.3 and Wakanda 11.197492.
Anybody else having the same problem?

Related

Extract Text from Response Body in Coded Webtest using vb

I have a Web performance Script in Visual Studio. I have turned this into Coded Webtest in VB by clicking on the Generate Code button.
In my web test there are a 5 functions. Apart from the 1st the others are for SQL Procedures.
Among a few things, I need a web request that does a certain action. Based on that action, In the response body - it generates a Unique Id.
I need this Id to make it accessible across all the functions.
The Response body is something like this :
0x00000000 7B 22 69 64 22 3A 36 35 33 30 36 36 33 7D {"id":2133221}
Now I wanted to know, how do I do it. I just need 2133221.
I tried
using the Context Parameter name and appending it to a .to string...it did not work. I tried doing by looking over the net and trying out a few options. I'm lost now. Can anyone help.
The simplest solution is the below one.
str = "0x00000000 7B 22 69 64 22 3A 36 35 33 30 36 36 33 7D {""id"":2133221}"
arr = Split(str, ":")
strID = Left(arr(1), len(arr(1)) - 1)
msgbox strId
However, If you still need a more robust one, try regex
See access the response from a web coded performance test for how to access the response ina coded test. While it is in C# the VB style is similar.
For your case the displayed string shows a hex dump of the actual body. Th ebody does not include the 0x00000000 7B 22 69 64 22 3A 36 35 33 30 36 36 33 7D part.
A simple approach to getting the wanted Id string is to use a Extract text extraction rule with a Start with of "id": and an Ends with of ". This will need to be done on the ".webtest" file.
I strongly recommend against converting web tests to coded tests. It loses all the high level structure of the ".webtest" format. The Web Test Editor has many facilities for easily enhancing and changing tests, all of them are lost when changing to a coded test. A little learning about extraction and validation rules gives you many facilities. If you are happy working with the VB of a coded test then you should also be happy to write plugins so look at web test request plugins and web test plugins.

Addressing ECUs directly using ELM 327 dongle and ISO 9141

I have a VW Golf 4, which is quite old and talks KWP 2000 (ISO 9141) on its CAN bus. I use a dongle powered by ELM 327, connected to the OBD-2 port of the car.
I am trying to send messages individually to each ECU. I tried to change the header of the messages:
AT SH 48 XX F1 (I hoped XX would be the ECU ID; 48 is the flag for "use physical addressing"). Any command I issue (e.g. tried 3E for "tester present") returns NO DATA (I disabled automatic timeouts and set the timeout to maximum value).
Is there a way to send messages directly to the ECU? I am not interested in the set of data provided via OBD-2, neither do I want to re-flash the ECUs. At the moment I just try to find out which ECUs are available on the bus.
Thanks!
VW works on Transport Protocol TP 2.0, hence you need to initialize with 0x200 header.
https://jazdw.net/tp20
See above link for more info.

XBEE/ZIGBEE Wireless Module API <- VB Express:When I send an ND command to a remote endpoint I get?

when I send an API ND command to a remote endpoint I get ???
When I send an API ND command from a VB program using the following packet;
7E 00 05 08 01 4E 44 00 64
I get;
7E 05 3F 14 E4 41 3F
Its a response -- but not as I know it. Neither the checksum "3F" or command length "05" are comprehensible to me. On the other hand if I wait for more bytes by setting "Serialport1.ReceivedBytesThreshold" (threshold: 10 bytes in buffer > event is fired) to 10 the "SerialPort1.ReadExisting()" statement times out. Any suggestions for decoding? Both coordinator and endpoint are XBEE PRO S2Bs.
I don't think it makes sense to send ATND as a remote AT command, and it will probably be ignored on the remote node, or trigger node discovery at that node with the responses staying local.
It looks like your response is possibly dropping null bytes (0x00), like the MSB of length, and one more in the packet itself. I'm not familiar with a frame type of 0x3F though -- is it documented for that XBee module you're using?
After a node discovery, you should see multiple AT Response frames (type 0x88?) come back over some time (based on ATNT, I believe), until you get one with a short payload (indicating discovery is complete).

Interpret return value (dissenter) when trying to unmount volume in OS X

I'm trying to unmount a volume in my Cocoa application using the Disk Arbitration Framework.
Before calling:
DADiskUnmount(disk,
kDADiskUnmountOptionDefault,
unmountCallback,
self );
I register a callback function that get's called afterwards:
void unmountCallback(DADiskRef disk, DADissenterRef dissenter, void *context )
{
if (dissenter != NULL)
{
DAReturn ret = DADissenterGetStatus(dissenter);
switch (ret) {
case kDAReturnBusy:
printf("kDAReturnBusy\n");
break;
}
}
In this function I try to interpret the dissenter return value but get stuck. I suppose it should be of type DAReturn and have a value like kDAReturnBusy But when e.g. iTunes is using the volume and it can not be unmounted "ret" has a value of 0xc010 that I don't quite understand.
In case unmounting fails I'd like to find out why the volume can't be unmounted and in case another application is using it remind the user of closing this application.
But when e.g. iTunes is using the volume and it can not be unmounted "ret" has a value of 0xc010 that I don't quite understand.
The documentation you linked to, for the DAReturn type, lists all the Disk Arbitration constants as looking like this:
kDAReturnError = err_local | err_local_diskarbitration | 0x01, /* ( 0xF8DA0001 ) */
So, DA's error returns are all made of three components, OR'd together.
If you look at the documentation for DADissenterGetStatus, it says:
A BSD return code, if applicable, is encoded with unix_err().
If you then search the headers for unix_err, you find it in /usr/include/mach/error.h, which says:
/* unix errors get lumped into one subsystem */
#define unix_err(errno) (err_kern|err_sub(3)|errno)
and:
/*
* error number layout as follows:
*
* hi lo
* | system(6) | subsystem(12) | code(14) |
*/
There's those three components again. Some other macros in error.h arrange the system and subsystem values (e.g., err_kern and err_sub(3)) into those positions.
So now, let's open the Calculator, press ⌘3 to put it into programmer mode, switch it to base-16, and type in your error code, and see what it says:
0xC010
0000 0000 0000 0000 1100 0000 0001 0000
31 15 0
Breaking that apart according to the above layout, we find:
0000 00
31
System: 0, which error.h says is err_kern. This error came from the kernel.
00 0000 0000 11
31 15
Subsystem: 3 (0b11). This plus the system code matches the aforementioned definition of unix_err. So this is a BSD return code, as DADissenterGetStatus said.
00 0000 0001 0000
31 15 0
Individual error code: 16 (0x10, 0b10000).
UNIX/BSD errors are defined in <sys/errno.h>, which says:
#define EBUSY 16 /* Device / Resource busy */
This suggests to me that you can't unmount that device because it's in use.
the above post nicely explains how to find out information about the error code which you have seeing.
however, how to actually solve the issue with unmount failing due to EBUSY?
if you don't care about processes that might still be using the mounted volume, you can just force the dismount by changing:
DADiskUnmount(disk, kDADiskUnmountOptionDefault...)
to
DADiskUnmount(disk, kDADiskUnmountOptionForce...)
your idea of "reminding the user of closing this application" is more complicated to implement. if you really want to go that way, i guess you could parse the output of /usr/sbin/lsof to find the 'offending' process names

Trying to make fluent NHibernate work, what's FluentConfiguration.cs?

I'm trying to follow this tutorial, but VS debugger keep asking me for a file named
FluentConfiguration.cs when it gets to this line:
return Fluently.Configure()
.Database(MySQLConfiguration.Standard
.ConnectionString(c => c
.Server("localhost")
.Database("test")
.Username("root")
.Password("w1e2a3r4")))
.Mappings(m => m
.AutoMappings.Add(model))
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
All my code is completely identical to the tutorial's except for this line (I'm using MySql). I triple checked the parameters and it should be ok..
What I get is a dialog box asking me to locate FluentConfiguration.cs, and when it fails to find it it gives:
An invalid or incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.
I tried copying this file from here, but this didn't work as well.
What am I missing out on here?
Technical info- I'm using VS 2010 express, ASP.NET MVC3, MySQL server 5.5 and connector: 6.3.6
Edit:
This is the inner exception's message:
Could not create the driver from NHibernate.Driver.MySqlDataDriver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
Edit 2:
Now I'm getting "checksum doesn't match:
Locating source for 'd:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs'. Checksum: MD5 {94 f4 4c 43 49 bd 48 fb 9a d7 b2 fc 5 e1 4e d8}
Determining whether the checksum matches for the following locations:
1: C:\Users\Oren\Desktop\FluentConfiguration.cs Checksum: MD5 {84 33 30 45 11 da 3d 40 8e 2d 3c a9 e 7c cc 14} Checksum doesn't match.
The file 'd:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs' does not exist.
Looking in script documents for 'd:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs'...
Looking in the projects for 'd:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs'.
The file was found in a project: 'C:\Users\Oren\Desktop\FluentConfiguration.cs'.
Determining whether the checksum matches for the following locations:
1: C:\Users\Oren\Desktop\FluentConfiguration.cs Checksum: MD5 {84 33 30 45 11 da 3d 40 8e 2d 3c a9 e 7c cc 14} Checksum doesn't match.
Looking in directory 'C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\vc7\atlmfc'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\vc7\crt'...
Looking in directory 'C:\Users\Oren\Desktop\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs.
The debugger could not locate the source file 'd:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs'.
Copy-pasted the fluent hibernate dlls and pdbs again, and problem was solved.
to resolve this issue. I had to add a reference to NHibernate.ByteCode.Castle.dll
The debugger is asking for one of the source files for Fluent nHibernate. You could download this because it is open source and debug it in detail, though the answer is in the InnerException.
This is probably due to a class that has not been mapped or possibly properties not being marked as virtual, or simply a database table that does not follow the standard FNH conventions. You need to get to the InnerException and read what it says as nHibernate exceptions are generally very helpful. I had plenty of trouble getting to the inner exception when I was trying to run unit tests running MSTest. I switched back to nUnit and had no trouble.
Another very useful thing to do is to output your .hbm files during the config process (FNH generates these for you behind the scenes). See Generate XML mappings from fluent Nhibernate for details. Note: I usually add a compiler directive to ensure that I only output the .hbm files in debug builds.