How to Convert a string to the name of an Object - actionscript-2

I am trying to access the "ID's" of the Object data but for the compiler does not like that...
what is the right way to do this.
var objectName:Object = {ID:2, IDName:"this_is_string"};
var target:string="objectName";
trace(target.IDName"); // does not work...
trace("target.ID");
any helps would be greatly appreciated.

Try:
trace( [target].IDName );

That works:
trace (eval(target).IDName)

Related

`new FormControl` Validators not works as expected

I declared a new FormControl like this :
senderCity = new FormControl("", [Validators.required ]);
In future I add some value like :
if(legBet){
let splited = legBet.value.split(',');
this[errorLable].setValidators([ Validators.minLength(splited[0]), Validators.maxLength(splited[1]) ]);
}
But seems not works expected. when max, min length not throws error. is it correct way to add or some wrong here?
any one help me?

C# : Wrong Extension when Upload

I am having a page with Telerik Upload Control.
I want to save the file Extension in database.
I am using GetExtension() Method.
It gives me a wrong Extension when the file has '.' in the name.
Example : Micro.18-7.pdf
When i am trying to get the Extension of the file,it shows ".18-7".
please anyone help me in this to solve this.
Thanks in advance.
Regards,
AGM Raja
Create your own method like such
static string GetFileExtension(string fileName)
{
var result = fileName.Split('.');
return result[result.Length - 1];
}

jmeter vars.put with an object javascript

I'm trying to use vars.put to write the result of the property of an object in a jmeter variable in javascript, but i have an issue...
Here is my code:
eval('var obj = ' + prev.getResponseDataAsString());
var meta_key = vars.get("MetaKey"); //meta_key is a variable
This works fine:
vars.put("content_metakey", obj[meta_key]);
but when i do this, it's doesn't work:
vars.put("taille", obj.meta_key[0].id); //meta_key variable
vars.put("taille", obj.tag[0].id); //tag is the value
Do you have any clue?
Thanks for your help.
i don't know if it's possible, so i used another way to do this: i used another eval.
my code:
obj2 = eval(obj[meta_key]);
vars.put("id_metakey"+meta_type,obj2[0].id);

could not resolve property: Date of: using DateTimeOffset (NHibernate 3.2.0.4000)

I recently got an exception from NHibernate when trying to access the Date property of a DateTimeOffset property.
var v1 = nhSession.Query<MyType>.Where(o => o.DateTimeOffsetProperty.Date == DateTimeOffset.Now.Date).ToList();
I would have thought this would have "just worked." What is the best solution to this problem?
I created an HQL generator that does the following in BuildHql:
return p_treeBuilder.MethodCall(
"date"
, new HqlExpression[] { (HqlExpression) p_visitor.Visit(p_expression) }
);
This seems to be working, but I'd like to know if this is already built in and I missed it. Thanks!

How to use foreach in c++ cli in managed code

Hi how to use foreach loop in managed code c++ using vs2003.
I've never used it, but this MSDN article indicates the general syntax is just:
for each(Type t in IEnumerable)
{
}
Matthew is mostly correct, but here's a working block of code;
///////
array<Type^>^ iterate_me = gcnew array<Type^>(2);
iterate_me[0] = Type::GetType("Type");
iterate_me[1] = Type::GetType("System.Int32");
///////
for each(Type^ t in iterate_me)
Console::WriteLine(t);
The changes were Type is a reference class, so you use "Type^" not "Type" and you need an actual object reference (iterate_me)...
Something like:
String ^ MyString = gcnew String("abcd");
for each ( Char c in MyString )
Console::Write(c);
As of VS2022 for each apparently no longer works. Instead you can do something like this:
IEnumerator^ enumerator = myList->GetEnumerator();
while (enumerator->MoveNext())
{
// Do stuff
}
I don't think that VC++ has foreach