DataTable.AsEnumerable().ToList(); min/max return invalid if data is int
var list = ProcessedInformationTable.AsEnumerable().ToList();
var minValue = list.Min(v => v["Rank"]);
var maxValue = list.Max(v => v["Rank"]);
In the code above if I had the values of
ColumnA|Rank
Heart|9
Lung|10
minValue will return as 10 and maxvalue will return as 9. My guess is
because it's treated as a string even though every value is an int. Is
there a way around this?
Friday, 13 September 2013
How do I take an entire columns worth of data and put it into anther column using a WHERE clause?
How do I take an entire columns worth of data and put it into anther
column using a WHERE clause?
I have two extremely similar tables in the same database. I want to take
the entire 'visual' column from the table p992_cq31n06-cm16-x and put it
into the 'visual' column of the table p992_cq31n06-cu67-x where the
columns 'print' and 'id3' match up.
Here is the query I was going to run:
UPDATE `p992_cq31n06-cu67-x`
SET visual = (
SELECT visual
FROM `p992_cq31n06-cm16-x`
WHERE
`p992_cq31n06-cu67-x`.print = `p992_cq31n06-cm16-x`.print
AND
`p992_cq31n06-cu67-x`.id3 = `p992_cq31n06-cm16-x`.id3);
Is this going to work the way I want it to?
column using a WHERE clause?
I have two extremely similar tables in the same database. I want to take
the entire 'visual' column from the table p992_cq31n06-cm16-x and put it
into the 'visual' column of the table p992_cq31n06-cu67-x where the
columns 'print' and 'id3' match up.
Here is the query I was going to run:
UPDATE `p992_cq31n06-cu67-x`
SET visual = (
SELECT visual
FROM `p992_cq31n06-cm16-x`
WHERE
`p992_cq31n06-cu67-x`.print = `p992_cq31n06-cm16-x`.print
AND
`p992_cq31n06-cu67-x`.id3 = `p992_cq31n06-cm16-x`.id3);
Is this going to work the way I want it to?
Is PhD from UK a better option?
Is PhD from UK a better option?
I would like to ask if PhD from United Kingdom a good option for
International Students?
I would like to know from someone who has already experienced studying
from UK, like How much savings can be made from PhD funding or Research
assistant-ships ? And How does things work there?
I am Masters student in Computer Sciences here in Germany, though I'm
non-European, but still I find German universities to be good enough where
International Students don't need to pay any amount and can get like
1800-2200 Euros a month during PhD positions ! I don't know anything about
UK, can someone guide me through ?
With Best Wishes
I would like to ask if PhD from United Kingdom a good option for
International Students?
I would like to know from someone who has already experienced studying
from UK, like How much savings can be made from PhD funding or Research
assistant-ships ? And How does things work there?
I am Masters student in Computer Sciences here in Germany, though I'm
non-European, but still I find German universities to be good enough where
International Students don't need to pay any amount and can get like
1800-2200 Euros a month during PhD positions ! I don't know anything about
UK, can someone guide me through ?
With Best Wishes
Create paginated Drupal form. (Drupal 6)
Create paginated Drupal form. (Drupal 6)
I am trying to create a form which provide a checkbox element on each row.
Problem is that I have 2000 rows which takes some time to load and also it
is not easy to navigate through whole list.
Is there a way to create some kind of pagination in Drupal form ?
I am trying to create a form which provide a checkbox element on each row.
Problem is that I have 2000 rows which takes some time to load and also it
is not easy to navigate through whole list.
Is there a way to create some kind of pagination in Drupal form ?
Thursday, 12 September 2013
How to use deferred.when with eventlistner and eventhandler?
How to use deferred.when with eventlistner and eventhandler?
I am trying to use one Deferred.when statement which can return an object
after the completion of an eventhandler. My code looks like something
below. Can someone guide me how to make it work? I am using dojo 1.7.
define(["dojo/_base/declare","dojo/_base/lang", "dojo/_base/xhr",
"dojo/_base/json","dojo/_base/Deferred","dijit/registry","dojo/_base/connect",
"dojo/query","dojo/on","dojo/dom-attr","dojo/dom","dojo/has","dojo/json","dojo/dom-style"],
function(declare,lang,xhr,json,Deferred,registry,connect,$,on,attr,dom,has,json,domStyle)
{
declare("model.Item", [],
{
deferred:null,
item:null,
Load: function(){
this.deferred = new Deferred();
var overlay = registry.byId("readFromStore");
overlay.show();
Deferred.when(connect.connect(registry.byId("storeReadOK"),"onClick",this,this.loadFromStorage),
(return (this.deferred)));
// I want modification for the above line.
}
loadFromStorage:function()
{
// Do something here
this.deferred.callback(this.item);
}
return model.Item;
}
);
I am trying to use one Deferred.when statement which can return an object
after the completion of an eventhandler. My code looks like something
below. Can someone guide me how to make it work? I am using dojo 1.7.
define(["dojo/_base/declare","dojo/_base/lang", "dojo/_base/xhr",
"dojo/_base/json","dojo/_base/Deferred","dijit/registry","dojo/_base/connect",
"dojo/query","dojo/on","dojo/dom-attr","dojo/dom","dojo/has","dojo/json","dojo/dom-style"],
function(declare,lang,xhr,json,Deferred,registry,connect,$,on,attr,dom,has,json,domStyle)
{
declare("model.Item", [],
{
deferred:null,
item:null,
Load: function(){
this.deferred = new Deferred();
var overlay = registry.byId("readFromStore");
overlay.show();
Deferred.when(connect.connect(registry.byId("storeReadOK"),"onClick",this,this.loadFromStorage),
(return (this.deferred)));
// I want modification for the above line.
}
loadFromStorage:function()
{
// Do something here
this.deferred.callback(this.item);
}
return model.Item;
}
);
How can I pagination when I use solr facet stats?
How can I pagination when I use solr facet stats?
I have select all records from solr by solr facet stats, but I can't
pagination them, How can I pagination by the pageSize and pageNum?
I have select all records from solr by solr facet stats, but I can't
pagination them, How can I pagination by the pageSize and pageNum?
How to calculate the frame of a modal view on iPad?
How to calculate the frame of a modal view on iPad?
When a user taps a UITextField, the keyboard will come up. I scroll up the
UITextField to sit just above the keyboard. This is working fine on
iPhone:
- (void) someWhere
{
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(onKeyboardShow:)
name:UIKeyboardWillShowNotification
object:nil];
}
- (void) onKeyboardShow:(NSNotification *)notification
{
CGRect keyboardRect = [[[notification userInfo]
objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue
];
if (keyboardRect.size.height >= IPAD_KEYBOARD_PORTRAIT_HEIGHT) {
self.containerView.y = self.containerView.y -
keyboardRect.size.width;
} else {
self.containerView.y = self.containerView.y -
keyboardRect.size.height;
}
}
However, it is broken on iPad. On iPad, modal view controllers can be
presented as a sheet that takes up only a portion of the screen. You can
see that there is a gap between the last UITextField and the keyboard on
iPad.
UINavigationController* nav = [[UINavigationController alloc]
initWithRootViewController:someRootViewController];
nav.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:nav animated:YES completion:nil];
I need to detect the offset of the modal view from the bottom of the
screen and add that to the Y coordinate of the UITextField. This will make
the UITextField flush with the top of the keyboard. I attempted to get the
frame of the modal view by doing this:
- (void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// describe is a category function on UIView that prints out the frame
[self.viewController.view.superview.superview.superview.superview
describe];
}
I did indeed get the frame:
x: 114.000000,
y: 192.000000,
w: 540.000000,
h: 620.000000
But as you can see from my code, it is extremely fragile. Since the view
hierarchy of modal view controllers on iPad is not documented, I had to
reverse engineer the hierarchy by slower traversing up the tree to see
which would be the right one. Is there are less fragile way to get the
frame that I actually care about?
When a user taps a UITextField, the keyboard will come up. I scroll up the
UITextField to sit just above the keyboard. This is working fine on
iPhone:
- (void) someWhere
{
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(onKeyboardShow:)
name:UIKeyboardWillShowNotification
object:nil];
}
- (void) onKeyboardShow:(NSNotification *)notification
{
CGRect keyboardRect = [[[notification userInfo]
objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue
];
if (keyboardRect.size.height >= IPAD_KEYBOARD_PORTRAIT_HEIGHT) {
self.containerView.y = self.containerView.y -
keyboardRect.size.width;
} else {
self.containerView.y = self.containerView.y -
keyboardRect.size.height;
}
}
However, it is broken on iPad. On iPad, modal view controllers can be
presented as a sheet that takes up only a portion of the screen. You can
see that there is a gap between the last UITextField and the keyboard on
iPad.
UINavigationController* nav = [[UINavigationController alloc]
initWithRootViewController:someRootViewController];
nav.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:nav animated:YES completion:nil];
I need to detect the offset of the modal view from the bottom of the
screen and add that to the Y coordinate of the UITextField. This will make
the UITextField flush with the top of the keyboard. I attempted to get the
frame of the modal view by doing this:
- (void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// describe is a category function on UIView that prints out the frame
[self.viewController.view.superview.superview.superview.superview
describe];
}
I did indeed get the frame:
x: 114.000000,
y: 192.000000,
w: 540.000000,
h: 620.000000
But as you can see from my code, it is extremely fragile. Since the view
hierarchy of modal view controllers on iPad is not documented, I had to
reverse engineer the hierarchy by slower traversing up the tree to see
which would be the right one. Is there are less fragile way to get the
frame that I actually care about?
Subscribe to:
Posts (Atom)