Posts

C# TreeView.EnsureVisible() - how else can I scroll? -

Image
on treeview here: left treeview before ensurevisible(), , right after the icon neglected. can't figure out how show icon after using ensurevisible() , use alternative ensurevisible() can't find way manually scroll. there? maybe nativemethods user32.dll or ? "left: treeview before ensurevisible, , right: after" you'll have use little external wizardry: using system.runtime.interopservices; //.. [dllimport("user32.dll", charset = charset.auto)] public static extern int getscrollpos(intptr hwnd, int nbar); [dllimport("user32.dll")] static extern int setscrollpos(intptr hwnd, int nbar, int npos, bool bredraw); private const int sb_horz = 0x0; private const int sb_vert = 0x1; // bring node display somenode.ensurevisible(); // can scroll way left: setscrollpos(treeview1.handle, sb_horz, 0, true); // ..or few pixels: int spos = getscrollpos( treeview1.handle, sb_horz); setscrollpos(treeview1.handle, sb_horz, spos - 20, true...

r - Reading Data from different locations through a function -

i pretty new r , struggling below scenario : need write function reads data different locations on pc(like downloads,documents,desktop etc). each file in these locations have unique id. function take id , location arguments. : onefunc <- function(directory,id) { y <- read.csv("directory/id") } i need pass directory , id read function. above code throws error - cannot open file 'directory/id': no such file or directory. need pass in read.csv exactly? what have right inside function string (sequence of characters). r not recognize these variables. need variables directory , id string. host of options available that: sprintf('%s/%s', directory, id) paste(directory, id, sep = '/') file.path(directory, id) , meant constructing file paths. other functions generic string building functions. recommend using function in case specific situation, , work across platforms. you can feed string read.csv perform actual ...

proc sql - SAS - summing values down observations -

i sum values set of observations, specific column based on specific identifier. example, suppose have data below a 4 5 6 b 3 3 2 3 4 2 c 3 2 0 b 3 7 3 b 2 4 1 suppose want sum of values identifier in column 1, have totals a, b , c specific column of choice (2, 3 or 4). in separate data set output either a, b or c beyond criteria. for example, want sums of column 4 (based on identifier in column 1) above value of 1, output data set should return = 8, b = 6, , nothing c zero. i open proc sql , or data step, in fact useful know both methods. you can use sql - groupby - sum aggregate function

ios - Sprite Kit game for Iphone 3.5 inch and 4 inch screen size -

i have developed little game in sprite kit xcode 5 4-inch screen, know if , how can use 3.5-inch. when open app iphone 5, ok, if try open iphone 4s simulator, lot of things hidden outside of screen. i read lot of posts , solution seems constraints, best solution? work spritekit? how can use it? for example positioned child this: aasharebubbles *sharebubbles = [[aasharebubbles alloc] initwithpoint:cgpointmake(self.view.frame.size.width/2, (self.view.frame.size.height/2)+170) 170 absolute position. (height/2)+170 ok 4-inch screen, not 3.5-inch screen. there many ways can different device either create different textureatlas different device size or easiest way change skview for eg add line viewcontroller #define is_widescreen ( fabs( ( double )[ [ uiscreen mainscreen ] bounds ].size.height - ( double )568 ) < dbl_epsilon ) -(void)addloadingscene { if (ui_user_interface_idiom() == uiuserinterfaceidiomphone) { if (is_widescreen) { ...

javascript - Jquery Event Handler ".on()" -

i have problem jquery event handler ".on()". i have button favorite on post on home page. if haven't favorited post: li not active event 1 if have favorited post: li active event 2 why when click multiple times (>1) on button, script same method (event) whereas have class .active on li or not? it's .on() doesn't manage dynamic class change... my html: <ul class="post-list"> <li> <a href="#" class="favorite">favorite</a> </li> <li class="active"> <a href="#" class="favorite">favorite</a> </li> </ul> my jquery: $(function(){ $('.post-list li.active .favorite').on('click', function(e){ e.preventdefault; // event 2 }); $('.post-list li:not(.active) .favorite').bind('click', function(e){ e.preventdefault; //...

Dart equivalent of Ruby's instance_eval -

ruby has neat method called instance_eval allows evaluating block of code in context of specific instance. great because 1 can use same block of code in different contexts , different results based on how context defines methods. there equivalent in dart? in other words can take method class , attach , execute on instance in class or define method letting user pass in code corresponding method. know limited form of possible emulate subclassing. it seems there no possibility of doing in dart. use several approaches, depending on needs: creating function context argument of function: somefunction (context, arg1, arg2) { ... } using mixins: https://www.dartlang.org/articles/mixins/ using generics: https://www.dartlang.org/articles/optional-types/#generics

Create MongoDB fields with names based on sub-document values using aggregation pipeline? -

given mongodb collection following document structure: { array_of_subdocs: [ { animal: "cat", count: 10 }, { animal: "dog", count: 20 }, ... ] } where each document contains array of sub-documents, want transform collection documents of structure: { cat: { count: 10 }, dog: { count: 20 }, ... } where each sub-document value of new field in main document named after 1 of values within sub-document (in example, values of animal field used create name of new fields, i.e. cat , dog ). i know how eval javascript snippet. it's slow. question is: how can done using aggregation pipeline? according this feature request , solution, new feature added functionality - function called arraytoobject . db.foo.aggregate([ {$project: { array_of_subdocs: { $arraytoobject: { ...