We use cell.getContents to read the values of a cell, the content contains data (e.g. 10.2327), the data gets read as "10.233". Not sure why we are unable to read the string as it is
I have a books app with a UISearchBar, where the user types any book name and gets search results (from ext API call) below as he types.
I am using a singleton variable in my app called retrievedArray which stores all the books.
@interface Shared : NSObject {
NSMutableArray *books;
}
@property (nonatomic, retain) NSMutableArray *books;
+ (id)sharedManager;
@end
This is accessed in multiple .m files using NSMutableArray *retrievedArray; ...in the header file
retrievedArray = [[Shared sharedManager] books];
My question is how do I ensure that the values inside retrievedArray remain synchronized across all the classes.
Actually the values inside retrievedArray gets added through an NSXMLParser (i.e. through external web service API). There is a separate XMLParser.m file, where I do all the parsing and fill the array. The parsing is done on a separate thread.
- (void) run: (id) param {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL: [self URL]];
[parser setDelegate: self];
[parser parse];
[parser release];
NSString *tmpURLStr = [[self URL]absoluteString];
NSRange range_srch_book = [tmpURLStr rangeOfString:@"v1/books"];
if (range_srch_book.location != NSNotFound)
[delegate performSelectorOnMainThread:@selector(parseDidComplete_srch_book) withObject:nil waitUntilDone:YES];
[pool release];
}
- (void) parseXMLFile: (NSURL *) url
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self setURL: url];
NSThread* myThread = [[NSThread alloc] initWithTarget:self
selector:@selector(run:)
object: nil];
[retrievedArray removeAllObjects];
[myThread start];
[pool release];
}
There seems to be some synchronization issues if the user types very quickly (It seems to be working fine if the user types slowly)....So there are 2 views in which the content of an object in this shared array item is displayed; List and Detail.
If user types fast and clicks on A in List view, he is shown B in detail view...That is the main issue.
I have tried literally all the solutions I could think of, but am still unable to fix the issue.
Please suggest some suitable fixes.
I am accessing the facebook api and using the json.net library (newtonsoft.json.net)
I declare a Jobject to parse the content and look for the specific elements and get their values. Everything works fine for the first few but then I get this unexplained nullexception error " (Object reference not set to an instance of an object)
Now I took a look at the declaration but cannot see how to change it. Any help appreciated:
Dim jobj as JObject = JObject.Parse(responseData)
Dim message as string = string.empty
message = jobj("message").tostring
The error occurs at the last line above.
I'm looking for a Java class with the characteristics of C++ std::map's usual implementation (as I understand it, a self-balancing binary search tree):
O(log n) performance for insertion/removal/search
Each element is composed of a unique key and a mapped value
Keys follow a strict weak ordering
I'm looking for implementations with open source or design documents; I'll probably end up rolling my own support for primitive keys/values.
This question's style is similar to: Java equivalent of std::deque, whose answer was "ArrayDeque from Primitive Collections for Java".
Here is my problem:
Given x, y, z and ratio where z is known and ratio is known and is a float representing a relative value, I need to find x and y.
I know that:
x / y == ratio
y - x == z
What I'm trying to do is make my own scroll pane and I'm figuring out the scrollbar parameters.
So for example,
If the scrollbar must be able to scroll 100 values (z) and the thumb must consume 80% of the bar (ratio = 0.8) then x would be 400 and y would be 500.
Thanks
I'm writing a genetic algorithm for generating timetables.
At the moment I'm using these two heuristics:
Number of holes between lectures in one day (related) (less holes - bigger score)
Each hour has some value, so for each timetable I sum values for hours when lectures are on. (lectures at more appropriate hours - bigger score)
I want to balance these two heuristics, so the algorithm wouldn't favor neither one. What would be the best way to achieve this?
Hey,Guys!
In rails , I met a question!
when i use the multiple select ,i don't know ,how can i get the all parameter values ,it likes
in javaEE,
String[] strs=request.getParameters("aaa");
so,who can tell me the method in rails to realize the function?
Thank you in advance!
How to access value of a variable inside a dataset; outside a dataset or into another dataset.
I have a variable which counts the number of values in a dataset. I want to use this variable outside the list-component which refers to that dataset.
How do I achieve this ?
I have a number of currency values in a form select box (i.e. "£ ;2,500")... when the form is rendered though it keeps the £ as is, is there any way to convert it to an actual pound sign?
Please note, the space before the ; sign is intentional (so that stackoverflow doesnt render it)
Intention is to take a current line which contains commas, store trimmed values of all space and store the line into the array.
Why does this not work?
String[] currentLineArray = currentInputLine.replace("\\s", "").split(",");
I'm interested in people's thoughts comparing storing data in a traditional SQL based Database or utilising a Memory-Mapped File such as the one in the new .Net 4.0 runtime. The data in question would be arrays of simple structures.
Obvious pros and cons:
SQL Database Pros
Adhoc query support
SQL Management Tools
Schema changes (adding more columns and setting default values)
Memory-Mapped Pros
Lighter overhead? (this is an assumption on my part)
Shareable between process threads
Any others?
Is it worth it for performance gains?
I want to write an insert query in Grails. I have tried all possible combinations but cant get the syntax correct. Can anybody please help?
class Person {
int age
int name
}
i tried the following:
Person.executeUpdate("insert into Person values (20,30)")
p.s.:Please do not mention using save()
I want to define a function doSomething(arg1, arg2) with default values to arg1=val and arg2=val
When I write
function doSomething($arg1="value1", $arg2="value2"){
// do something
}
Is it possible now to call doSomething with default arg1 and arg2="new_value2"
hi there,
i have an asp.net mvc app which have quite a few hidden inputs to keep values around and formatting their names so that i can use the Model binding later when i submit the form.
i stumble into a weird bug with chrome which i don't have with IE or Firefox when the user submits the form and click on the back button, i find that chrome will keep my hidden input values as well.
this whole chunk is generated via javascript hence i believe chrome is caching this.
function addProductRow(productId, productName) {
if (productName != "") {
//use guid to ensure that the row never repeats
var guid = $.Guid.New();
var temp = parseFloat($(".tboProductCount").val());
//need the span to workaround for chrome
var szHTML = "<tr valign=\"top\" id=\"productRow\"><td class=\"productIdCol\"><input type=\"hidden\" id=productRegsID" + temp + "\" name=\"productRegs[" + temp + "].productId\" value=\"" + productId + "\"/>"
+ "<span id=\"spanProdID" + temp + "\" name=\"spanProdID" + temp + "\" >" + productId + "</span>"
+ "</td>"
//+ "<td><input type=\"text\" id=\"productRegName\" name=\"productRegs[" + temp + "].productName\" value=\"" + productName + "\" class=\"productRegName\" size=\"50\" readonly=\"readonly\"/></td>"
+ "<td><span id=\"productRegName\" name=\"productRegs[" + temp + "].productName\" class=\"productRegName\">"+ productName + "<\span></td>"
+ "<td id=\"" + guid + "\" class=\"productrowguid\" \>"
+ "<input type=\"text\" size=\"20\" id=\"productSerialNo" + temp + "\" name=\"productRegs[" + temp + "].serialNo\" value=\"" + "\" class=\"productSerialNo\" maxlength=\"18\" />"
+ "<a class=\"fancybox\" id=\"btnImgSerialNo" + temp + "\" href=\"#divSerialNo" + temp + "\"><img class=\"btnImgSerialNo\" src=\"Images/landing_14.gif\" /></a>"
+ "<span id=\"snFlag" + temp + "\" class=\"redWarning\"></span></td>"
+ "<td><input type=\"text\" id=\"productRegDate" + temp + "\" name=\"productRegs[" + temp + "].PurchaseDate\" readonly=\"readonly\" />"
+ "<span id=\"snRegDate" + temp + "\" class=\"redWarning\"></span></td>"
+ "<td align=\"center\"><img style=\"cursor:pointer\" id=\"btnImgDelete\" src=\"Images/btn_remove.gif\" onclick=\"javascript:removeProductRow('" + guid + "')\" /><div style=\"display:none;\"><div id=\"divSerialNo" + temp + "\" style=\"font-family:verdana;font-size:11px;width:600px\">" + serialnumbergeneral + "<br /><br />" + getSNImageByCategory(productId) + "</div></div></td>"
+ "</tr>";
$(".ProductRegistrationTable").append(szHTML);
$("a.fancybox").fancybox();
//initialization
$("#productRegDate" + temp).datepicker({
minDate: new Date(1996, 1 - 1, 1),
maxDate: 0
});
//sanity check
//s7test
alert('1 '+$("#spanProdID" + temp));
alert('2 '+$("#productRegsID" + temp));
} //end function addNewProductRow
i need the id to be refreshed when the user select a new product, but putting another span tag beside it shows that the span will have the new id will the hidden input will still have the previous id.
is there an elegant way to workaround this issue?
thanks
I'm in the process of weeding out all hardcoded values in a java library and was wondering what framework would be the best (in terms of zero- or close-to-zero configuration) to handle run-time configuration? I would prefer xml-based config-files, but it's not essential.
Please do only reply if you have practical experience with a framework. I'm not looking for examples, but experience... Thanks for taking the time.
I am a SQLAlchemy noob.
Let's say I have an user table in declarative mode:
class User(Base):
__tablename__ = 'user'
id = Column(u'id', Integer(), primary_key=True)
name = Column(u'name', String(50))
When I know user's id without object loaded into session, I update such user like this:
ex = update(User.__table__).where(User.id==123).values(name=u"Bob Marley")
Session.execute(ex)
I dislike using User.__table__, should I stop worrying with that?
Is there a better way to do this?
Thanx!
i've been using the following query:
select LEN(columnname) as columnmame
from dbo.amu_datastaging
This works, but is there a way to only return the greatest value instead of all the values?
So if i return 1million records and the longest length is 400, the query would just return the value of 400?
I have 4 tables and i want to join them and extarct 4 values.
I wrote the followig MySql Query, but it does not work.
select `a`.`id`,`a`.`page` xpage,`a`.`action`,
`b`.`header` xheader, `b`.`page_id`,
`c`.`content` xcontent,`b`.`page_id`,
`d`.`footer` xfooter,`d`.`page_id`
join `header` b
on `a`.`id`=`b`.`page_id`
join `content` c
on `a`.`id`=`c`.`page_id` and `a`.`id`=`d`.`page_id`
join `footer` d
on `a`.`id`=`d`.`page_id`
where `a`.`page`='main'
I use this condition to check if the value is alphanumeric values:
$value =~ /^[a-zA-Z0-9]+$/
How can I modify this regex to account for a possible dot . in the value without accepting any other special characters?
ID NAME AMT
1 Name1 1000
2 Name2 500
3 Name3 3000
4 Name1 5000
5 Name2 2000
6 Name1 3000
consider above table as sample.
am having a problem in my sql query, Am using like this.
Select name,amt from sample where amt between 1000 and 5000
it returns all the values in the table between 1000 and 5000, instead I want to get maximum amount record for each name
i.e.,
3 name3 3000
4 name1 5000
5 name2 2000
Hi, I have Start Date and End date parameters that work fine as filters on a query, as follows:
[EMR Reporting].[Appointments].[Appointment Date] between ?Start Date? and ?End Date?
But when I attempt to apply conditional styles to a field based on ?Start Date?, the report blows up.
Should I be able to use parameter values in conditional style expressions, or is this not supported for some reason?
Thanks!
hi i m a newbee to c sharp .net i ve to add values from the datagrid to a table.. any way s ok. sample code or link s fine for me..
pls help me out
thanx in advance..
Hello,
Currently I have an html form - which I call with jquery dialog - to insert new records into a table. But I also would like to update existing records with the same form - using jquery dialog. I'm not sure within the dialog how I access these data values - or pass them in as arguments - and hook them up with the form elements...? Anyone has done this before and knows an agile technique to do this?
kind regards, Patrick
I am resusing ImageViews for my displays, but at some point I don't have values to put it.
So how to clear an ImageView in Android?
I've tried:
mPhotoView.invalidate();
mPhotoView.setImageBitmap(null);
None of them have cleared the view, it still shows previous image.