_key.key
I have been making some changes to a program that I didn't
develop. I'm
using Director MX. I have opened the program probably 30
times, added code,
tested it. It ran fine without errors.
I'm doing some more work now on one behavior. I have made
some code changes
in that behavior and have run it several times. All of a
sudden I'm getting
an error on _key.key Handler not Defined. This code is not in
any behaviors
I've modified and I checked to see in the backup version if I
accidentally
type an odd char while this behavior might have been open,
but the code
matches the original version so that didn't happen.
I'm sure this is because MX doesn't recognize the new OOP
structure that MX
2004 implemented.
1) Why did this all of a sudden pop up when for a week it's
been running
perfectly?
2) Is _key.key in MX 2004 EXACTLY the same as the key in MX,
so if I do a
global replace on _key.key, I won't have a problem?
I could update the movie to MX2004 but I prefer to leave as
much of the
project as it was when I received it.
Craig
Thanks
Craig
"Mike Blaustein" <[email protected]> wrote in
message
news:gmsgrs$g53$[email protected]..
> In Director 9 and earlier "the key" is the command to
use. In fact, I
> still use it in Director 10 and 11 because it makes more
sense to me than
> _key.key which seems silly and redundant. I think you
can safely
> find/replace it without problems, even if you upgrade
the project to a
> newer version of Director.
Similar Messages
-
Multiple key presses I'm stuck!!
i want to make a hidden navigation thingy so that if the user
types a word, but only the whole word it goes to next marker,
i know the keyUp and KeyDown navigation but how do i make it
only work when all have been pressed?
Thank youHow about storing the keystrokes in a global string?
Something like this:
on startMovie
global gKeyString
gKeyString = “”
end
on keyDown
global gKeyString
password = “abracadabra”
gKeyString = gKeyString & _key.key
if gKeyString.length > password.length then
gKeyString = chars (gKeyString,
gKeyString.length-password.length, gKeyString.length)
end if
if gKeyString = password then
go frame “secretPlace”
end if
end
I've not tested this code but it should work with little or
no modification. -
Cannot use multiple database in my application
I have written a C++/CLI wrapper for use berkeleydb without lost performance. This wrapper run perfectly with one database but when i open a second database ( i create a new instance of the wrapper ) the application crash.
I have written a minimal pure C++ application that use the pure C++ classe of my wrapper, when a open and use only one database the code run perfectly but with two databases, the application be crazy.
infos : compiler VC++ 2008, OS : Vista 32bit
this the code of my berkeleydb class :
#pragma comment (lib, "libdb47.lib")
#if defined(WIN32) || defined(WIN64)
#include <windows.h>
#include <list>
#endif
#ifndef ParamsStructCpp
#include "ParamsStruct.h"
#endif
#include <db_cxx.h>
#include "BerkeleyMethods.h"
using namespace std;
using namespace stdext;
// type
//typedef list<ParamsStructCpp>::iterator it;
typedef list<ParamsStructCpp> fetchbuffer;
// Db objects
Db * db; // Database object
DbEnv env(0); // Environment for transaction
u_int32_t oFlags = DB_CREATE|DB_AUTO_COMMIT|DB_READ_UNCOMMITTED; // Open flags; //
u_int32_t env_oFlags = DB_CREATE |
DB_THREAD |
DB_INIT_LOCK |
DB_INIT_LOG |
DB_INIT_MPOOL |
DB_INIT_TXN |
DB_MULTIVERSION; // Flags for environement
// Constructeurs
BerkeleyMethods::BerkeleyMethods()
BerkeleyMethods::BerkeleyMethods(char * dbname, unsigned int db_cache_gbyte, unsigned int db_cache_size,
int db_cache_number, int db_type, char * dberr_file, char * envdir, unsigned int dbtxn_timeout,
unsigned int dbtxn_max)
strcpy_s(this->db_name, strlen(_db_name)+1, dbname);
this->db_cache_gbyte = db_cache_gbyte;
this->db_cache_size = db_cache_size;
this->db_cache_number = db_cache_number;
this->db_type = db_type;
this->db_txn_timeout = dbtxn_timeout;
this->db_txn_max = dbtxn_max;
strcpy_s(this->db_err_file, strlen(_db_err_file)+1, dberr_file);
strcpy_s(this->env_dir, strlen(_env_dir)+1, envdir);
this->Set_restoremode(false);
// ==========
// Fonctions
// http://www.codeproject.com/KB/string/UtfConverter.aspx
bool BerkeleyMethods::OpenDatabase()
try
std::cout << "Dbname " << this->db_name << std::endl;
if (strlen(this->db_name) < 2) {
throw new std::exception("Database name is unset");
// Set database cache
env.set_cachesize(this->db_cache_gbyte, this->db_cache_size, this->db_cache_number);
// Set transaction timeout
if (this->db_txn_timeout > 0) {
env.set_timeout(this->db_txn_timeout, DB_SET_TXN_TIMEOUT);
// Set max opened transactions
if (this->db_txn_max > 0) {
env.set_tx_max(this->db_txn_max);
// Dupplicate key support;
if (this->Get_dup_support()) {
env_oFlags = env_oFlags|DB_DUPSORT;
// Deadlokcs gesture
env.set_lk_detect(DB_LOCK_MINWRITE);
// Set the error file
env.set_errfile(fopen(this->db_err_file, "w+"));
// Error prefix
env.set_errpfx("Error > ");
// Open environement
env.open(this->env_dir, env_oFlags, 0);
// Create database object
db = new Db(&env, 0);
// Open the database
switch(this->db_type)
case 1:
db->open(NULL, this->db_name, NULL, DB_BTREE, oFlags, 0);
break;
case 2:
db->open(NULL, this->db_name, NULL, DB_HASH, oFlags, 0);
break;
case 3:
db->open(NULL, this->db_name, NULL, DB_QUEUE, oFlags, 0);
break;
case 4:
db->open(NULL, this->db_name, NULL, DB_RECNO, oFlags, 0);
break;
default:
throw new std::exception("Database name is unset");
break;
u_int32_t gbcacheSize = 0;
u_int32_t bytecacheSize=0;
int ncache=0;
env.get_cachesize(&gbcacheSize,&bytecacheSize,&ncache);
std::cerr << "Taille du cache est:" << gbcacheSize << "Go plus " << bytecacheSize << " octets." << std::endl;
std::cerr << "Number of caches : " << ncache << std::endl;
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
catch(std::exception &e)
std::cout << e.what() << std::endl;
return false;
bool BerkeleyMethods::CloseDatabase()
try
db->close(0);
env.close(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
catch(std::exception &e)
std::cout << e.what() << std::endl;
return false;
bool BerkeleyMethods::AddData(char * key, unsigned long int value)
if (this->Get_restoremode())
return false;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, 0); // Bebin transaction
// Set datas
Dbt _key(key, strlen(key)+1);
Dbt _value(&value, sizeof(unsigned long int));
env.txn_checkpoint(512, 2, 0);
int exist = db->put(txn, &_key, &_value, DB_NOOVERWRITE);
if (exist == DB_KEYEXIST) {
std::cout << "This record already exist" << std::endl;
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
std::cout << "Error" << std::endl;
txn->abort();
return false;
bool BerkeleyMethods::AddData(unsigned long int key, char * value)
if (this->Get_restoremode())
return false;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, 0); // Bebin transaction
Dbt _key(&key, sizeof(unsigned long int));
Dbt _value(value, strlen(value)+1);
env.txn_checkpoint(512, 2, 0);
int exist = db->put(txn, &_key, &_value, DB_NOOVERWRITE);
if (exist == DB_KEYEXIST) {
std::cout << "This record already exist" << std::endl;
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
bool BerkeleyMethods::AddData(char * key, char * value)
if (this->Get_restoremode())
return false;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, 0); // Bebin transaction
Dbt _key(key, strlen(key)+1);
Dbt _value(value, strlen(value)+1);
env.txn_checkpoint(512, 2, 0);
int exist = db->put(txn, &_key, &_value, DB_NOOVERWRITE);
if (exist == DB_KEYEXIST) {
std::cout << "This record already exist" << std::endl;
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
bool BerkeleyMethods::AddData(unsigned long int key, unsigned long int value)
if (this->Get_restoremode())
return false;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, 0); // Bebin transaction
Dbt _key(&key, sizeof(unsigned long int));
Dbt _value(&value, sizeof(unsigned long int));
env.txn_checkpoint(512, 2, 0);
int exist = db->put(txn, &_key, &_value, DB_NOOVERWRITE);
if (exist == DB_KEYEXIST) {
std::cout << "This record already exist" << std::endl;
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
bool BerkeleyMethods::AddData(char * key, ParamsStructCpp value)
if (this->Get_restoremode())
return false;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, 0); // Bebin transaction
Dbt _key(key, strlen(key)+1);
Dbt _value(&value, sizeof(ParamsStructCpp));
env.txn_checkpoint(512, 2, 0);
int exist = db->put(txn, &_key, &_value, DB_NOOVERWRITE);
if (exist == DB_KEYEXIST) {
std::cout << "This record already exist" << std::endl;
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
bool BerkeleyMethods::AddData(unsigned long int key, struct ParamsStructCpp value)
if (this->Get_restoremode())
return false;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, 0); // Bebin transaction
Dbt _key(&key, sizeof(unsigned long int));
Dbt _value(&value, sizeof(ParamsStructCpp));
env.txn_checkpoint(512, 2, 0);
int exist = db->put(txn, &_key, &_value, DB_NOOVERWRITE);
if (exist == DB_KEYEXIST) {
std::cout << "This record already exist" << std::endl;
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
bool BerkeleyMethods::Exist(unsigned long int key)
if (this->Get_restoremode())
return true;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, DB_TXN_SNAPSHOT); // Bebin transaction
Dbt _key(&key, sizeof(unsigned long int));
int state = db->exists(txn, &_key, DB_READ_COMMITTED);
txn->commit(0);
if (state == 0) {
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
bool BerkeleyMethods::Exist(char * key)
if (this->Get_restoremode())
return true;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, DB_TXN_SNAPSHOT); // Bebin transaction
Dbt _key(key, strlen(key)+1);
int state = db->exists(txn, &_key,DB_READ_COMMITTED);
txn->commit(0);
if (state == 0) {
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
void BerkeleyMethods::GetData (char * pData, int nbr, unsigned long int key)
if (this->Get_restoremode())
return;
DbTxn * txn;
Dbc *dbcp;
try
env.txn_begin(NULL, &txn, DB_TXN_SNAPSHOT); // Bebin transaction
db->cursor(txn, &dbcp, 0);
Dbt _key;
Dbt data;
key.setdata(&key);
key.setsize(sizeof(unsigned long int));
dbcp->get(&_key, &data, DB_FIRST);
char * temp = (char *)data.get_data();
strcpy_s(pData, strlen(temp)+1, temp);
dbcp->close();
txn->commit(0);
catch(DbException &e)
std::cout << e.what() << std::endl;
if (dbcp != NULL)
dbcp->close();
if (txn != NULL)
txn->abort();
catch(...)
if (dbcp != NULL)
dbcp->close();
if (txn != NULL)
txn->abort();
unsigned long int BerkeleyMethods::GetData(char * key)
if (this->Get_restoremode())
return 0;
DbTxn * txn;
Dbc *dbcp;
try
env.txn_begin(NULL, &txn, DB_TXN_SNAPSHOT); // Bebin transaction
db->cursor(txn, &dbcp, 0);
Dbt _key;
Dbt data;
key.setdata(key);
key.setulen(strlen(key)+1);
dbcp->get(&_key, &data, DB_FIRST);
unsigned long int xdata = *((unsigned long int *)data.get_data());
dbcp->close();
txn->commit(0);
return xdata;
catch(DbException &e)
std::cout << e.what() << std::endl;
dbcp->close();
txn->abort();
catch(...)
dbcp->close();
txn->abort();
return 0;
ParamsStructCpp * BerkeleyMethods::GetData(unsigned long int key, bool null)
if (this->Get_restoremode()) {
return new ParamsStructCpp();
DbTxn * txn;
Dbc *dbcp;
try
env.txn_begin(NULL, &txn, DB_TXN_SNAPSHOT); // Bebin transaction
db->cursor(txn, &dbcp, 0);
Dbt _key;
Dbt data;
key.setdata(&key);
key.setsize(sizeof(unsigned long int));
dbcp->get(&_key, &data, DB_FIRST);
ParamsStructCpp * temp = (ParamsStructCpp *)data.get_data();
dbcp->close();
txn->commit(0);
return temp;
catch(DbException &e)
std::cout << e.what() << std::endl;
dbcp->close();
txn->abort();
catch(...)
dbcp->close();
txn->abort();
return new ParamsStructCpp();
ParamsStructCpp * BerkeleyMethods::GetData(char * key, bool null)
if (this->Get_restoremode()) {
return new ParamsStructCpp();
DbTxn * txn;
Dbc *dbcp;
try
env.txn_begin(NULL, &txn, DB_TXN_SNAPSHOT); // Bebin transaction
db->cursor(txn, &dbcp, 0);
Dbt _key;
Dbt data;
key.setdata(key);
key.setulen(strlen(key)+1);
dbcp->get(&_key, &data, DB_FIRST);
ParamsStructCpp * xdata = (ParamsStructCpp *)data.get_data();
dbcp->close();
txn->commit(0);
return xdata;
catch(DbException &e)
std::cout << e.what() << std::endl;
dbcp->close();
txn->abort();
catch(...)
dbcp->close();
txn->abort();
return new ParamsStructCpp();
list<ParamsStruct> BerkeleyMethods::FetchAllDatabase ()
list<ParamsStruct> temp;
Dbc *dbcp;
try
db->cursor(NULL, &dbcp, 0);
Dbt _key;
Dbt data;
while(dbcp->get(&_key, &data, DB_NEXT))
unsigned long int key = *((unsigned long int *)_key.get_data());
char * datetime = (char *)data.get_data();
ParamsStruct p;
strcpy_s(p.lastaccess, strlen(datetime)+1, datetime);
p.downloaded
temp.push_back(
//temp.insert(Tuple(datetime, key));
catch(DbException &e)
std::cout << e.what() << std::endl;
catch(...)
return temp;
bool BerkeleyMethods::DeleteData(unsigned long int key)
if (this->Get_restoremode())
return true;
DbTxn * txn;
try
env.txn_checkpoint(128, 1, 0);
env.txn_begin(NULL, &txn, 0); // Bebin transaction
Dbt _key;
key.setdata(&key);
key.setsize(sizeof(unsigned long int));
db->del(txn, &_key, 0);
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;;
bool BerkeleyMethods::DeleteData(char * key)
if (this->Get_restoremode())
return true;
DbTxn * txn;
try
env.txn_begin(NULL, &txn, 0); // Bebin transaction
Dbt _key;
key.setdata(key);
key.setulen(strlen(key)+1);
db->del(txn, &_key, 0);
txn->commit(0);
return true;
catch(DbException &e)
std::cout << e.what() << std::endl;
txn->abort();
catch(...)
txn->abort();
return false;
int BerkeleyMethods::Sync()
if (this->Get_restoremode())
return -1;
try
return db->sync(0);
catch(...)
return -1;
int BerkeleyMethods::Count()
if (this->Get_restoremode())
return -1;
Dbc *dbcp;
int count = 0;
try
Dbt key;
Dbt data;
db->cursor(NULL, &dbcp, 0);
while (dbcp->get(&key, &data, DB_NEXT) == 0) {
count++;
dbcp->close();
return count;
catch(...)
return -1;
BerkeleyMethods::~BerkeleyMethods()
if (db) {
db->sync(0);
db->close(0);
env.close(0);
=====
The code the use this class :
BerkeleyMethods db("test.db", 0, 524288000, 1, 1, "log.txt", "./Env_dir", 1000000 * 5, 600000);
BerkeleyMethods db1("test2.db", 0, 524288000, 1, 1, "log2.txt", "./Env_dir2", 1000000 * 5, 600000);
bool z = db.OpenDatabase();
db1.OpenDatabase();
if (z)
std::cout << "Base de données ouverte" << std::endl;
for (unsigned int i = 0; i < 1000; i++)
ParamsStructCpp p = { 10, "02/08/2008 14:46:23", 789 };
bool a = db.AddData(i, p);
db1.AddData(i, p);
if (a)
std::cout << "Ajout de données ok" << std::endl;
for (unsigned int i = 0; i < 1000; i++)
ParamsStructCpp * c = db.GetData(i, false);
ParamsStructCpp * c1 = db1.GetData(i, false);
std::cout << "Donné récupéré " << c->downloaded << " : " << c->lastaccess << " : " << c->waittime << std::endl;
std::cout << "Donné récupéré " << c1->downloaded << " : " << c1->lastaccess << " : " << c1->waittime << std::endl;
/ ====
The application output show that when using two database the data is not correctly set. It seems that db and db1 is the same object :|.
For example in db i insert a key => toto with value 4, and in db1 i insert the same value nomaly have no problem. But berkeleydb say the the key toto in db1 already exist while not
I don't understand.
NB : sorry for my englishMichael Cahill wrote:
As a side note, it is unlikely that you want both
DB_READ_UNCOMMITTED and DB_MULTIVERSION to be set.
This combination pays a price during updates for
maintaining multiple versions, but still requires
(short term) locks to be held during reads. The BDB/XML Transaction Processing Guide states the following:
[...]in addition to BDB XML's normal degrees of isolation, you can also use snapshot isolation. This allows you to avoid the read locks that serializable isolation requires.
http://www.oracle.com/technology/documentation/berkeley-db/xml/gsg_xml_txn/cxx/isolation.html
This seems to contradict what you're saying here.
Is there a general guideline on whether or not to use MVCC together with a relaxed isolation degree like DB_READ_UNCOMMITTED? Should the statement in the BDB/XML TP Guide rather have "as an alternative to" instead of "in addition to"?
Michael Ludwig -
Triggering keyDown while commandDown in OSX
I use the keyDown event to trigger various conventional keyboard shortcuts such as ctrl-c to copy, ctrl-v to paste. The problem is that in OSX the command key blocks the keyDown event in Director so instead of the OSX convention of command-c I have to instead use control-c. I can test the key events in a frame script and verify the _key.commandDown flag but the normal keyDown event is never triggered while the command key is pressed. Is there some workaround or setting to get this to work as expected? Or perhaps a different event which will work the same as the keyDown?
Hmm. I just created a new movie with nothing in it except for the following script, and it worked as expected. I am using OSX version 10.7.5 and Director 11.5, what about you? Also, are you familiar with the _movie.editShortCutsEnabled? Are you sure that the script you are writing is necessary?
My test script:
on exitFrame me
go to the frame
end
on keyDown
if _key.commandDown then
case _key.key of
"c": alert "command-c"
"x": alert "command-x"
end case
end if
end keydown -
Simple example of a combobox displaying data from a CF datasource
Can anyone point me to a simple example of a Flex 3 combobox that displays data from a ColdFusion datasource? I cannot seem to find a simple example. As always, thanks!
Thanks for the response, but the example you provided is more complex than I need. For example, I have a simple table accessed through ColdFusion. The table has one filed with 7 records. I need a flex page to display that data in DataGrid, ComboBox and List controls. The Datagrid displays the 7 records but the ComboBox and List are blank. How do I get the values from the database to display in the BomboBox and List controls?
Below is my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initComponent()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
private var currentIndex:int = 0;
private var _key:Object;
[Bindable]
public function get key():Object
return this._key;
public function set key(key:Object):void
this._key = key;
private function initComponent():void
refreshList(null);
public function refreshList(event:Event):void
this.dataManager.getRoles(this.key);
private function getRoles_result(event:ResultEvent):void
this.roleList.dataProvider = event.result as ArrayCollection;
this.roleList.selectedIndex = this.currentIndex;
]]>
</mx:Script>
<mx:RemoteObject
id="dataManager"
showBusyCursor="true"
destination="ColdFusion"
source="ifqgtfuses.com.vwRoles">
<mx:method name="getRoles" result="getRoles_result(event)" />
</mx:RemoteObject>
<mx:Canvas width="100%" height="100%" x="0" y="0">
<mx:DataGrid id="roleList"
x="10" y="10">
<mx:columns>
<mx:DataGridColumn dataField="vchar_role" headerText="Role" />
</mx:columns>
</mx:DataGrid>
<mx:ComboBox x="10" y="160" id="rolesComboBox" dataProvider="{roleList.selectedIndex}"/>
<mx:List x="120" y="10" id="rolesList" dataProvider="{roleList.selectedIndex}"/>
</mx:Canvas>
</mx:Canvas> -
Thoughts on adding ConcurrentMap methods to StoredMap?
as far as i can tell, StoredMap has the potential to implement the extra methods in the jdk 1.5 ConcurrentMap interface. Database already has a putNoOverwrite method which would be the implementation of putIfAbsent. Personally, however, i am more interested in the other methods, all of which basically do their work only if the current value matches a given old value. this enables safe concurrent updates to a StoredMap even outside of transactions, basically using an optimistic scenario:
- read existing key,value (hold no locks)
- copy current value and modify the copy
- write modified value only if current value matches what is now in the database (this line within the context of a RMW lock)
any idea if this could be incorporated in the je codebase anytime soon? i may end up implementing it in our codebase, although the je api is not easy to extend as most classes/useful methods are package protected (arg!).hey,
just wanted to follow up on this a little. after using the concurrent implementation for a while (with transactions enabled), i experimented with extending the api to add a "transaction-like" extension to the concurrentmap api. this basically blends the concurrentmap api with the option of better performance when transactions are enabled in the underlying bdb. there are three methods added, which basically allow for "locking" a given key and "committing" or "rolling back" the updates as appropriate (if transactions are not enabled, the new methods are largely no-ops, and you get normal concurrent map behavior). thought i'd post the new code in case you were interested in providing this facility to other users (or, you could just stick with the original version posted above).
Example usage:
Object key;
try {
Object value = map.getForUpdate(key);
// ... run concurrent ops on value ...
map.replace(key, value, newValue);
map.completeUpdate(key);
} finally {
map.closeUpdate(key);
}New implementation:
public class StoredConcurrentMap extends StoredMap
private final ThreadLocal<UpdateState> _updateState =
new ThreadLocal<UpdateState>();
public StoredConcurrentMap(
Database database, EntryBinding keyBinding,
EntryBinding valueEntityBinding, boolean writeAllowed)
super(database, keyBinding, valueEntityBinding, writeAllowed);
public Object getForUpdate(Object key)
if(_updateState.get() != null) {
throw new IllegalStateException(
"previous update still outstanding for key " +
_updateState.get()._key);
UpdateState updateState = new UpdateState(key, beginAutoCommit());
_updateState.set(updateState);
DataCursor cursor = null;
Object value = null;
try {
cursor = new DataCursor(view, true, key);
if(OperationStatus.SUCCESS == cursor.getNextNoDup(true)) {
// takeover ownership of the cursor
value = updateState.loadCurrentValue(cursor);
cursor = null;
closeCursor(cursor);
} catch (Exception e) {
closeCursor(cursor);
throw handleException(e, false);
return value;
public void completeUpdate(Object key)
UpdateState updateState = getUpdateState(key);
if(updateState != null) {
try {
updateState.clearCurrentValue(this);
commitAutoCommit(updateState._doAutoCommit);
// only clear the reference if everything succeeds
_updateState.set(null);
} catch(DatabaseException e) {
throw new RuntimeExceptionWrapper(e);
public void closeUpdate(Object key)
UpdateState updateState = getUpdateState(key);
if(updateState != null) {
// this op failed, abort (clear the reference regardless of what happens
// below)
_updateState.set(null);
try {
updateState.clearCurrentValue(this);
view.getCurrentTxn().abortTransaction();
} catch(DatabaseException ignored) {
public Object putIfAbsent(Object key, Object value)
UpdateState updateState = getUpdateState(key);
if(valueExists(updateState)) {
return updateState._curValue;
Object oldValue = null;
DataCursor cursor = null;
boolean doAutoCommit = beginAutoCommit();
try {
cursor = new DataCursor(view, true);
while(true) {
if(OperationStatus.SUCCESS ==
cursor.putNoOverwrite(key, value, false)) {
// we succeeded
break;
} else if(OperationStatus.SUCCESS ==
cursor.getSearchKey(key, null, false)) {
// someone else beat us to it
oldValue = cursor.getCurrentValue();
break;
// we couldn't put and we couldn't get, try again
closeCursor(cursor);
commitAutoCommit(doAutoCommit);
} catch (Exception e) {
closeCursor(cursor);
throw handleException(e, doAutoCommit);
return oldValue;
public boolean remove(Object key, Object value)
UpdateState updateState = getUpdateState(key);
if(valueExists(updateState)) {
if(ObjectUtils.equals(updateState._curValue, value)) {
try {
updateState._cursor.delete();
updateState.clearCurrentValue(this);
return true;
} catch (Exception e) {
throw handleException(e, false);
} else {
return false;
boolean removed = false;
DataCursor cursor = null;
boolean doAutoCommit = beginAutoCommit();
try {
cursor = new DataCursor(view, true, key);
if(OperationStatus.SUCCESS == cursor.getNextNoDup(true)) {
Object curValue = cursor.getCurrentValue();
if(ObjectUtils.equals(curValue, value)) {
cursor.delete();
removed = true;
closeCursor(cursor);
commitAutoCommit(doAutoCommit);
} catch (Exception e) {
closeCursor(cursor);
throw handleException(e, doAutoCommit);
return removed;
public boolean replace(Object key, Object oldValue, Object newValue)
UpdateState updateState = getUpdateState(key);
if(valueExists(updateState)) {
if(ObjectUtils.equals(updateState._curValue, oldValue)) {
try {
updateState.replaceCurrentValue(newValue);
return true;
} catch (Exception e) {
throw handleException(e, false);
} else {
return false;
boolean replaced = false;
DataCursor cursor = null;
boolean doAutoCommit = beginAutoCommit();
try {
cursor = new DataCursor(view, true, key);
if(OperationStatus.SUCCESS == cursor.getNextNoDup(true)) {
Object curValue = cursor.getCurrentValue();
if(ObjectUtils.equals(curValue, oldValue)) {
cursor.putCurrent(newValue);
replaced = true;
closeCursor(cursor);
commitAutoCommit(doAutoCommit);
} catch (Exception e) {
closeCursor(cursor);
throw handleException(e, doAutoCommit);
return replaced;
public Object replace(Object key, Object value)
UpdateState updateState = getUpdateState(key);
if(valueExists(updateState)) {
try {
return updateState.replaceCurrentValue(value);
} catch (Exception e) {
throw handleException(e, false);
Object curValue = null;
DataCursor cursor = null;
boolean doAutoCommit = beginAutoCommit();
try {
cursor = new DataCursor(view, true, key);
if(OperationStatus.SUCCESS == cursor.getNextNoDup(true)) {
curValue = cursor.getCurrentValue();
cursor.putCurrent(value);
closeCursor(cursor);
commitAutoCommit(doAutoCommit);
} catch (Exception e) {
closeCursor(cursor);
throw handleException(e, doAutoCommit);
return curValue;
* @return the current UpdateState for the given key, if any, {@code null}
* otherwise.
private UpdateState getUpdateState(Object key)
UpdateState updateState = _updateState.get();
if((updateState != null) && (ObjectUtils.equals(updateState._key, key))) {
return updateState;
return null;
* @return {@code true} if the update state exists and found a value (which
* is currently locked)
private boolean valueExists(UpdateState updateState)
return((updateState != null) && (updateState._cursor != null));
* Maintains state about an object loaded in a
* {@link StoredConcurrentMap#getForUpdate} call.
private static class UpdateState
public final Object _key;
public final boolean _doAutoCommit;
public DataCursor _cursor;
public Object _curValue;
private UpdateState(Object key, boolean doAutoCommit) {
_key = key;
_doAutoCommit = doAutoCommit;
* Loads the current value from the given cursor, and maintains a
* reference to the given cursor and the loaded value.
public Object loadCurrentValue(DataCursor cursor)
throws DatabaseException
_cursor = cursor;
_curValue = _cursor.getCurrentValue();
return _curValue;
* Replaces the current value in the current cursor with the given value.
* @return the old value
public Object replaceCurrentValue(Object newValue)
throws DatabaseException
Object oldValue = _curValue;
_cursor.putCurrent(newValue);
_curValue = newValue;
return oldValue;
* Closes the current curstor and clears the references to the cursor and
* current value.
public void clearCurrentValue(StoredConcurrentMap map) {
try {
map.closeCursor(_cursor);
} finally {
_cursor = null;
_curValue = null;
} -
Good Lingo Coders Check this out!
I want to make a Naruto game for mac and pc that allows you
to play as many characters that I have collected. I have created
custom chakra bars and all lot of stuff! I need good coders since I
am new to director and I don't know how to code. At one point, I
made a flash and I thought this would be the same so I tried it and
found out it was different. If you can help, first tell me please
how I can make my character controlled by arrows as I have searched
many articles for it. Also, how can I set other keys or make a key
configuration window?your project is interesting.
Is it commercial game?
I'm pretty sure someone out there will be interested if you
give out more details.
you can use the following code. It is basic. you'll need to
adjust it to your needs.
-- example on how to use keyDown
on keyDown
if(_key.key = SPACE)then
-- your code to respond to SPACE key
end if
end -
B32 compiler bug: varargs with anonymous class
Environment
SunOS bart 5.10 s10_48 i86pc i386 i86pc Solaris
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32, mixed mode)
javac 1.5.0-beta
Javac command produces NullPointerException
javac -source 1.5 -target 1.5 Quick.java (source follows)
Description
The problem seems to be use of a varargs constructor while defining
an anonymous class. Work around is for caller to manually box the
(varargs) into an array, bypassing convenience of varargs support.
class Quick
Quick() {
Fox fox1 = new Fox(1) {}; // compiles
Fox fox2 = new Fox(new String[] { "hello" }) {}; // compiles
// NullPointerException not thrown when following 4 lines are
// commented out.
Fox fox3 = new Fox(null) {}; // compiles, but ambiguous?
Fox fox4 = new Fox() {}; // javac NullPointerException
Fox fox5 = new Fox("hello") {}; // javac NullPointerException
Fox fox6 = new Fox("hello", "bye") {}; // javac NullPointerException
class Fox
Fox(int a) {
_keys = new String[0];
Fox(String... keys) {
_keys = keys;
final String[] _keys;
}reported as 4986231
-
JMS destination key used for message ordering not working
Hi there,
i'm using Weblogic 10.3. I've been trying to implement ordering of messages using a destination key assigned to a JMS message queue. The default ordering is FIFO (it uses the JMSMessageID in ascending order for this).
According to documentation (http://download.oracle.com/docs/cd/E12840_01/wls/docs103/ConsoleHelp/taskhelp/jms_modules/destination_keys/ConfigureDestinationKeys.html) one can also configure the queue to behave in a LIFO manner by creating a destination which sorts on the JMSMessageID in a descending order.
I have tried this, it does not work. I have also played with different message priority settings and tried to sort on the JMSPriority field of the messages in ascending and descending order, it changes nothing. Messages keep being processed in a FIFO manner.
Has anyone been able accomplish message ordering other than FIFO? Am I missing something?
Any assistance would be highly appreciated!Why not try
if (_key.keyPressed(TAB)) then
-- DO WHATEVER CONDITION
end if
im not sure if that is the correct way of telling the system
to use the TAB key but this works for RETURN when the user hits the
enter key, so if u substitute the TAB for the command to use the
TAB key im sure it will work
im sorry if it doesnt tho, but its worth a try if your still
struggling -
Why KEY PRESS for TAB is not working?
Hello
How to enable "Tab" key event in director exe. I heard that
accessability behaviours need to be used. But not clear how to do
that. Please can any one send solution for this.
Thanks
Suresh BabuWhy not try
if (_key.keyPressed(TAB)) then
-- DO WHATEVER CONDITION
end if
im not sure if that is the correct way of telling the system
to use the TAB key but this works for RETURN when the user hits the
enter key, so if u substitute the TAB for the command to use the
TAB key im sure it will work
im sorry if it doesnt tho, but its worth a try if your still
struggling -
Capture ENTER key on numeric keypad
I have several chemistry tutorials where users type something and then have it evaluated by pressing the ENTER key. This works fine for the ENTER key on the main part of the keyboard, but does not work for the ENTER key for the numeric keypad on keyboards with the two ENTER keys. How do I capture the ENTER key on the numeric keypad? In other words, how do I do the equivalent of the following for that key?
if the key = RETURN then
ThanksTry checking:
if _key.keyCode = 36 then ... -
Key down, Key up, Key code problems
I've been having problems putting a key down handler
together, which is weird because it's pretty basic.
on keydown
if (_key.keycode = 4) then baOpenFile( the moviepath &
"help\help.pdf" , "maximised" )
end keydown
doesn't seem to do anything, key up the same. I know this is
a pretty basic thing, and in MX 2004 which is the Director version
I'm using, they've done it a little different but I can't seem to
see why it's not working.
help?!Key functions operate in several different ways in Director.
If you have
an editable field or text member, then you can attach a
behavior to that
field or text sprite and include an on keyDown me and/or on
keyUp me
function. Because there is an editable sprite on the stage,
Director
will route key events to that sprite. If there is a function
to handle
the event, then something will happen. This sort of thing is
usually
done if you need to read and/or filter the user's input. You
don't need
a behavior at all if you just want the user to input
something.
If you are using key events for some other action, like
navigation or
game element control, then you need to tell Director to pay
attention to
the keyboard input. This is done by assigning a function as
the
keyDownScript or the keyUpScript. The assignment may be done
in a movie
event function, like startMovie, or it may be done in a
behavior.
Here's one example in a movie script window:
on startMovie
the keyDownScript = "readKeys"
end
on readKeys
case the keyCode of
4: baOpenFile(the moviePath &
"help\help.pdf","maximised")
end case
end
Here's an example in a behavior:
property thisSprite
on beginSprite me
thisSprite = me.spriteNum
the keyDownScript = "readKeys"
end
on endSprite me
the keyDownScript = ""
end
In the second example, the behavior could be attached to any
sprite that
will be available when you want the key events to be
interpreted.
Setting the keyDownScript to "" will stop Director from
paying attention
to key events.
Rob
Rob Dillon
Adobe Community Expert
http://www.ddg-designs.com
412-243-9119
http://www.macromedia.com/software/trial/ -
Replacing default keys with GPShell
I'm trying to replace default keys for a JCOP20 card using GPShell,
but after opening secure channel, and running this line:
put_sc_key -keyver 0 -newkeyver 1 -mac_key 00112233445566778899aabbccddeeff -enc_key 00112233445566778899aabbccddeeff -kek_key 00112233445566778899aabbccddeeff(assuming that I want to change those three keys to "00112233445566778899aabbccddeeff")
I get (6A80: Wrong data / Incorrect values in command data.)
Am I doing something wrong?So let's assume you have a GP 2.1.1 compliant card. The following script worked for putting a new key with key version 1:
mode_211
enable_trace
establish_context
card_connect -readerNumber 3
select -AID a0000000030000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f // Open secure channel
put_sc_key -keyver 0 -newkeyver 1 -mac_key 00112233445566778899aabbccddeeff -enc_key 00112233445566778899aabbccddeeff -kek_key 00112233445566778899aabbccddeeff
card_disconnect
release_contextcorrsponding log
mode_211
enable_trace
establish_context
card_connect -readerNumber 3
* reader name OMNIKEY CardMan 3x21 0
select -AID a0000000030000
Command --> 00A4040007A0000000030000
Wrapped command --> 00A4040007A0000000030000--
--Response <-- 6F658408A000000003000000A5599F6501FF9F6E06479173512E00734A06072A864
886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640B06092A864886FC6B0
40215650B06092B8510864864020103660C060A2B060104012A026E01029000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4
f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4
d4e4f // Open secure channel
Command --> 80CA006600
Wrapped command --> 80CA006600--
--Response <-- 664C734A06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864
886FC6B03640B06092A864886FC6B040215650B06092B8510864864020103660C060A2B060104012
A026E01029000
Command --> 80500000086C29C97DFABB81D500
Wrapped command --> 80500000086C29C97DFABB81D500--
--Response <-- 00008031002007913283FF020016F1CD25161DF8FB817DEB67B8EF079000
Command --> 848201001010354C201858AFFB8DD553C490C68D8F
Wrapped command --> 848201001010354C201858AFFB8DD553C490C68D8F--
--Response <-- 9000
put_sc_key -keyver 0 -newkeyver 1 -mac_key 00112233445566778899aabbccddeeff -enc
_key 00112233445566778899aabbccddeeff -kek_key 00112233445566778899aabbccddeeff
Command --> 80D80081430180106555E3DEF3F002CFE6BA482AE6E56A0F03FB097580106555E3DE
F3F002CFE6BA482AE6E56A0F03FB097580106555E3DEF3F002CFE6BA482AE6E56A0F03FB097500
Wrapped command --> 84D800814B0180106555E3DEF3F002CFE6BA482AE6E56A0F03FB09758010--
--6555E3DEF3F002CFE6BA482AE6E56A0F03FB097580106555E3DEF3F002CFE6BA482AE6E56A0F03FB--
--097563C7642EBB003E5C00--
--Response <-- 01FB0975FB0975FB09759000
card_disconnect
release_contextand then to change the existing key version 1 with a new key, change the put_sc_key to
put_sc_key -keyver 1 -newkeyver 1 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f
..and the log
mode_211
enable_trace
establish_context
card_connect -readerNumber 3
* reader name OMNIKEY CardMan 3x21 0
select -AID a0000000030000
Command --> 00A4040007A0000000030000
Wrapped command --> 00A4040007A0000000030000--
--Response <-- 6F658408A000000003000000A5599F6501FF9F6E06479173512E00734A06072A86
886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640B06092A864886FC6B
40215650B06092B8510864864020103660C060A2B060104012A026E01029000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 00112233445566778899aabbccddee
f -enc_key 00112233445566778899aabbccddeeff -kek_key 00112233445566778899aabbcc
deeff // Open secure channel
Command --> 80CA006600
Wrapped command --> 80CA006600--
--Response <-- 664C734A06072A864886FC6B01600C060A2A864886FC6B02020101630906072A86
886FC6B03640B06092A864886FC6B040215650B06092B8510864864020103660C060A2B06010401
A026E01029000
Command --> 8050000008EB28207C1654542200
Wrapped command --> 8050000008EB28207C1654542200--
--Response <-- 000080310020079132830102000027B1EF595D1421BCE4831BC94FD69000
Command --> 8482010010E1DF9A452975BF3ECA5232A0E4B46811
Wrapped command --> 8482010010E1DF9A452975BF3ECA5232A0E4B46811--
--Response <-- 9000
put_sc_key -keyver 1 -newkeyver 1 -mac_key 404142434445464748494a4b4c4d4e4f -en
_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f
Command --> 80D801814301801076DABB6CCD7EB8B9D5CE8B5510E124E7038BAF47801076DABB6
CD7EB8B9D5CE8B5510E124E7038BAF47801076DABB6CCD7EB8B9D5CE8B5510E124E7038BAF4700
Wrapped command --> 84D801814B01801076DABB6CCD7EB8B9D5CE8B5510E124E7038BAF47801--
--76DABB6CCD7EB8B9D5CE8B5510E124E7038BAF47801076DABB6CCD7EB8B9D5CE8B5510E124E7038--
--AF473E70D0A25AC301CF00--
--Response <-- 018BAF478BAF478BAF479000
card_disconnect
release_context -
PrintScreen key causes problems
Hi
My movie reacts to space key to perform some action
on keyUp
if (_key.keycode = 49) then sendallsprites(#SpacePressed)
end
But when the user press after that printScreen key, keyUp
event is executed,
but _key.keycode is still 49 that responds to space-key. and
the application
reacts to printscreen as to space-key.
Keydown event is not executed on pressing printScreen key, so
using
_key.keyPressed() function I can not check if really space is
pressed,
In on keyUp handler _key.keyPressed(49) is false even if user
pressd space
(because key is already up)
_key.keycode is readOnly so can not get reed of value 49,
until another key
with some value is pressed
Is there any way to avoid this?
Thanx in advance
Orest"Jacks007" <[email protected]> wrote in
message
news:goka0j$1m8$[email protected]..
> In a New Authorware file set up an INTERACTION ICON with
a CALC ICON
> hanging of it using KEYPRESS with a "?" (without the "")
as the CALC ICONS
> name. The CALC ICON contains "MyKey = Key" (again
without the ""). On
> the INTERACTIONS DISPLAY WINDOW I typed the text
> "MyKey = {MyKey}" (without the ""). INTERACTION ICON set
to update
> Displayed Variables. Just keep pressing keys to see.
A single display icon (set to 'Update Displayed Variables')
containing {Key}
will suffice. Why do it the hard way!
Chris Forecast -
Hi everyone,
I'll go straight to the point - I can't change java card keys via GPShell no matter what I try.
Secure channel opening works, as applet loads (other script with identical begining) without issues.
Script:
mode_211
enable_trace
establish_context
card_connect -readerNumber 2
select -AID a0000000030000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 62DFCEC11C2F1358D01CA2855E257C38 -enc_key 62DFCEC11C2F1358D01CA2855E257C38 -kek_key 62DFCEC11C2F1358D01CA2855E257C38
put_sc_key -keyver 1 -newkeyver 1 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f
card_disconnect
release_context
Trace:
mode_211
enable_trace
establish_context
card_connect -readerNumber 2
* reader name OMNIKEY ICCD 0
select -AID a0000000030000
Command --> 00A4040007A0000000030000
Wrapped command --> 00A4040007A0000000030000
Response <-- 6F658408A000000003000000A5599F6501FF9F6E06405163452900734A06072A864
886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640B06092A864886FC6B0
40215650B06092B8510864864020103660C060A2B060104012A026E01029000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 62DFCEC11C2F1358D01CA2855E257C3
8 -enc_key 62DFCEC11C2F1358D01CA2855E257C38 -kek_key 62DFCEC11C2F1358D01CA2855E2
57C38
Command --> 80CA006600
Wrapped command --> 80CA006600
Response <-- 664C734A06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864
886FC6B03640B06092A864886FC6B040215650B06092B8510864864020103660C060A2B060104012
A026E01029000
Command --> 80500000080DB7179A3E7E6C9800
Wrapped command --> 80500000080DB7179A3E7E6C9800
Response <-- 00009323010103915488FF020005BA23507BA445E06411FB62A5C50F9000
Command --> 8482010010C0BB5F2FB8045FAAAF7999946A8E7FB2
Wrapped command --> 8482010010C0BB5F2FB8045FAAAF7999946A8E7FB2
Response <-- 9000
put_sc_key -keyver 1 -newkeyver 1 -mac_key 404142434445464748494a4b4c4d4e4f -enc
_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f
Command --> 80D80181430180107E46E7D26AC048FC38716DB36F645E78038BAF4780107E46E7D2
6AC048FC38716DB36F645E78038BAF4780107E46E7D26AC048FC38716DB36F645E78038BAF4700
Wrapped command --> 84D801814B0180107E46E7D26AC048FC38716DB36F645E78038BAF478010
7E46E7D26AC048FC38716DB36F645E78038BAF4780107E46E7D26AC048FC38716DB36F645E78038B
AF4741C2F853D460A86D00
Response <-- 6A88
put_secure_channel_keys() returns 0x80206A88 (6A88: Referenced data not found.)Any help appreciatedhi
for me that looks simple: you're trying to change a non-existent key version/index.
did you try
put_sc_key -keyver *0* -newkeyver 1 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f
the key version may start at zero and should be incremented.
isn't there any indication of the key index? I don't know the command.
hth
Sebastien
Maybe you are looking for
-
Unable to copy and paste a phote from my photo library to another photo album
iphoto 6.0.6 unable to copy and paste a photo from my main library album to another photo album. why does the copy and paste function not work for these albums. I have tried to drag it and drop it into the album, but nothing works. it this a bug?
-
i cannot call some methods from the classes that i have packaged
-
Range of Variable in Web Interface Builder
Hi, I have created a Web Interface Builder in BW-BPS. I have created Cost Center as a Variable. However, I am unable to get this range of cost centers say 1001 to 1005 in Web Inteface Builder. Whereas, in the Planning Folder, this works fine and I am
-
FM derivation rule - ??? client copy
Hi Expert, I have encountered a strange problem on FM derviation rule (TCODE FMDERIVE). I tried to client copy a "gold copy" client to a seperate client using using SAP_ALL but found that all the details derviation rule were missing.... I tried in my
-
Is it possible to generate a mouse click at specific coordinates on the stage?
Let's say x = 100 and y = 100. So, I have my main swf file that contains an external swf file with a button. Would it be possible to generate a mouse click on that button? Any help would be greately appreciated.