if user enter string value in the textbox and press button, i should see error message in label about entered string value.. How can i do that? and what is the code?
how to get a Dictionary key by value in C#?
Dictionary<string, string> types = new Dictionary<string, string>()
{
{"1", "one"},
{"2", "two"},
{"3", "three"}
};
I want simething like this:
getByValueKey(string value);
getByValueKey("one") must be return "1".
What is the best way do this? may be HashTable, SortedLists?
So I have a view controller with a single UITableView that shows a string to the user. But I needed a way to have the user select this object by id using a normal UIButton so I added it as a subview and the click event works as expected.
The issue is this - how can I pass an int value to this click event? I've tried using attributes of the button like button.tag or button.accessibilityhint without much success. How do the professionals pass an int value like this?
Also it's important that I can get the actual [x intValue] from the int later in the process. A while back I thought I could do this with a simple
NSLog(@"the actual selected hat was %d", [obj.idValue intValue]);
But this doesn't appear to work (any idea how I can pull the actual int value directly from the variable?).
The working code I have is below
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if ([self.hats count] > 0) {
Hat* obj = [self.hats objectAtIndex: [indexPath row]];
NSMutableString* fullName = [[NSMutableString alloc] init];
[fullName appendFormat:@"%@", obj.name];
[fullName appendFormat:@" %@", obj.type];
cell.textLabel.text = fullName;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
//add the button to subview hack
UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(50, 5, 50, 25);
[button setTitle:@"Select" forState:UIControlStateNormal];
button.backgroundColor = [UIColor clearColor];
button.adjustsImageWhenHighlighted = YES;
button.tag = obj.idValue; //this is my current hack to add the id but no dice :(
[button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:button];
//hack
}
return cell;
}
- (void)action:(id)sender {
int* hatId = ((UIButton *)sender).tag; //try to pull the id value I added above ...
//do something w/ the hatId
}
i've a table c_const
code | nvalue
--------------
1 | 10000
2 | 20000
and i've another table t_anytable
rec_id | s_id | n_code
---------------------
2 | x | 1
now i want to calculate the x value with computed column, based on
rec_id*(select nvalue from c_const where code=ncode)
but i get error "Subqueries are not allowed in this context. Only scalar expressions are allowed."
how can i calculate the value in this computed column ?
thanks.
I create a directory listing and came across this issue.
what value does mysql_query($query1) return if there is no value
My script received this message from $result, would it be alright to pass array(0)?
Warning: mysql_fetch_array($result) expects parameter 1 to be resource, array given in
I am trying to use the below in my app.config
<add key="InstanceID" value="HID\VID_413C&PID_3200\6&227E6ED3&0&0000" />
It shows error in app.config, what is the problem ? i want to use this value as string in my c# code.
i want to overide value in datagridviewcell.
I have Dropdownlist.when i select the dropdown item. textbox value should overide in datagridview cell. any suggestion.
thanks in advance.
I have so store a very long value of type integer that can't be stored in a variable of long type. how can i store such a long integer value in a c programme.
Please illustrate it through an example/ programme if possible.
Hi I have the Drop down with values as "One year ", "Two year",...etc.. Ok? also i have two ajax textbox with calender extender . I want to popup alert message if dropdown selected value is "One year" and duration between the both textbox value Means dates not matches. getting what i mean ? please help me.
How can i get this scenario in javascript ??
When storing a value in a cookie using C#, what is the best way to encode (or escape) the value so that it can be retrieved and decoded/unescaped reliably?
I'm not talking about encryption.
I am sending login status = fail, back to my login page.Here is my code-
header("location:index.php?login=fail");
but that is sending through URL like-
http://localhost/303/index.php?login=fail
is there any way to pass value without showing in URL? And how to get this value on the second page?
Hello,
When the value is entered, I want an alert, its a copy/paste text box, using jquery
('#test).bind('onblur',function(){
var h = ('#test).attr('value');
alert(h);
});
<input type=text id=test>
Thanks
Jean
When I look at an NSDate value in the debugger, I get something like this:
1.4.2010 22:01:47 +0100
I don't get it what this +0100 is good for. Sometimes it is +0200. Is that supposed to be the time zone or something like that? What's it exactly? How does it affect the "since reference date" value?
on a test for Java-MySQL-Restlet application, I write to database at 4reqs/second for 120 seconds.
In this write I insert a row that has foreign key which has the same value for all rows, and this exception occurs:
Could not recover transaction. Original exception follows. com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'idPxxx' at row 1
Only 5% of requests fails to this exceptions, others works.
Regards
I have attribute value as:
<div id = "zone-3a-2f-2f-2fPortal-2fPages-2fHome-2fZones-2fLeft-2f-7ccomponent-3a-2f-2f-2fSpm-2fComponents-2fPromotion-2f" class = "promotion">
Now I want to get only portion of it, say Promotion and its value 2f, how can I get this using jquery ? Do we have built in function for it ?
var responseFromServer = "{\"flag\":true,\"message\":\"\",\"result\":{\"ServicePermission\":true,\"UserGroupPermission\":true}}";
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
var responseValue = serializer.DeserializeObject(responseFromServer);
responseFromServer value is get a webservice, and then how to get the json string value, such as "flag","Servicepermission"??
hey,
I have two-dimension array
List<List<int>> boardArray
How can I enumerate throw this array to check that it contains other value than 0 ?
I think about boardArray.Contains and ForEach ,cause it return bool value but I don't have too much experience with lambda expression :/
Please help :)
I have come in a situation where I need to create a hiperlink for each entry in collection
following is my code..
<td><a href="#" onclick="javascript:openWindow(--------)">Click
How can i get ${current.product_id} value in blank space... so that i can pass my value to next jsp for internal processing....
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Save();
}
I used Application Settings and When
Form was load i see value in control
but i can't use its when Form load
event.
how to use value that bind from
Application Settings when event
Form1_Load ?
hi,
I have a funtion like this
<script type="text/javascript">
funtion result()
{
return "string";
}
</script>
I need to get this string value in to var
var gotresult= ???? how to get here that result value
I have very little programming knowledge; only a fair bit in Visual Basic.
How do I take a value from a text field, then do some simple math such as divide the value by two, then display it back to the user in the same field?
In Visual Basic you could just do txtBoxOne.text = txtBoxOne.text / 2
I understand this question is more than one question and is very basic stuff, but I need to get my head out of Visual Basic and into where I should be :)
I have a java primitive type at hand:
Class c = int.class; // or long.class, or boolean.class
I'd like to get a 'default value' for this class - specifically the value is assigned to fields of this type if they are not initialized. E.g., '0' for a number, 'false' for a boolean.
Is there a generic way to do this? I tried
c.newInstance()
But I'm getting an InstantiationException, and not a default instance.
Hi all,
Assume I have the following style table, col1 col2 and col3 have same value scopes, I want to select the records when two of the 3 columns have a value combination such as ('ab' and 'bc'), in the following example, the first 3 records should be selected. Any good way to do this? I am using Sybase.
| id | col1 | col2 | col3 |
1 ab bc null
2 null ab bc
3 ab ab bc
4 de ab xy
Thanks.
I've figured out how to assign a rotation value (element.RenderTransform = new RotateTransform(x)), but how do I get the rotation value the element?
For example, if I wanted to make one ui element have the same rotation angle as another ui element, how would I do that?
i am passing values from a textbox into a sql statement in ACCESS
i do not understand the difference in the usage of these two properties
when i set the the .text property to something, how does the .value property get affected?
when i do want something to be displayed in the textbox should i be using the value or text property?