Posts

c# - Sort ArrayList with custom comparison -

i trying sort arraylist using c#. when arraylist contains comparable objects, possible sort using list.sort() need sort arraylist contains non-comparable objects. example, let's object ring , has attribute property price . need sort arraylist price order. if is possible select ascending or descending more helpful. thank you! blockquote arratdmon = **(arraylist)**hashtb[unixmon]; if (arratdmon != null) moncount = arratdmon.count; int[] arraymax = { moncount, tuecount, wedcount, thucount, fricount }; int maxvalue = arraymax.max(); kidattendance valmon = null; string montagname = string.empty; blockquote above array list sorted self. you can implementing icomparer interface:- public class ring : icomparer { public decimal price { get; set; } public int compare(object x, object y) { return ((ring)x).price.compareto(((ring)y).price); } } working fiddle .

java - Set Security Context within AuthenticationSuccessEvent Listener -

i working on web application uses spring security. using legacy database system, necessary write custom authenticationprovide r. after successful authentication, can load info on user, e.g. roles, available domains, etc. while logic can contained within authenticationprovider , have reasons factor out external location. so, wrote listener spring security authenticationsuccessevent : public void onapplicationevent(authenticationsuccessevent event) { authentication auth = event.getauthentication(); user user = (user)auth.getprincipal(); //custom userdetails implementation list<grantedauthority> newauthorities; //do stuff user , new authorities securitycontextholder.getcontext().setauthentication( new usernamepasswordauthenticationtoken(user, null, newauthorities); } the securitycontext changed within method, seem lose new authorities afterwards. in particular, within method, securitycontext contains usernamepasswordauthenticationt...

vb.net - How to connect Mysql server from another computer? -

i have created application in vb (visual express 2013). have connected application mysql localhost (same computer). can't connect computer in same network. please me connect... just replace databse connection string localhost server's pc name or ip address

c - how to call a function having pointers as arguments -

i trying call function int db5_disk_header(struct db5_raw_internal *rip, const unsigned. char *cp) { fprintf(openfile, "these headers %d b %d c %d", rip->a, rip->b, rip->c); ... } how call function in main() in c? read basic pointer operations in case: #include <stdio.h> struct db5_raw_internal { int a, b, c; }; int db5_disk_header(struct db5_raw_internal *rip) { fprintf(stdout, "these headers %d b %d c %d", rip->a, rip->b, rip->c); return 0; } int main(void) { struct db5_raw_internal x = {1, 2, 3}; db5_disk_header(&x); // pointer x using address-of operator (&) struct db5_raw_internal *y = &x; db5_disk_header(y); // y pointer (don't use &) return 0; }

jquery - jQM ui-hidden-accessible doesn't hide parent div -

<div id="foo"> <input type="text" id="myinput" class="ui-hidden-accessible"> <a href="#" onclick="myfunc()" data-role="button">bar</a> <ul id="search" data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="search 1" ></ul> <ul id="search2" data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="search2" ></ul> </div> i'm trying hide input field, jquery mobile adds ugly div around 100% width of page , 2px high (grey). possible hide css? use data-wrapper-class attribute apply custom classes input type. <input type="text" data-wrapper-class="ui-hidden-accessible custom-style"> the classes added parent div of input.

robotframework - On Ubuntu, How can I uninstall or remove the lower version of selenium? -

while using appiumlibrary robotframework, getting below error. error: importing test library 'appiumlibrary' failed: importerror: no module named switch_to here,pythonpath: /usr/local/lib/python2.7/dist-packages/selenium-2.44.0-py2.7.egg to resolve above error want try solution mentioned @ link " https://github.com/appium/appium/issues/2625 " asks remove lower version of selenium. i have 2 selenium folders @ below location. selenium folders: 1)/usr/local/lib/python2.7/dist-packages/selenium 2)/usr/local/lib/python2.7/dist-packages/selenium-2.44.0.egg-info how can remove the selenium other 2.44? no process required uninstall selenium. i deleted directory "/usr/local/lib/python2.7/dist-packages/selenium". resolved error robot framework.

objective c - IOS 8 ScrollView fixed content -

Image
hi developing ios application. using scrollview. encountered problem on ios version 8. added in following way scroll content inside. scroll in first picture looks steady. other images scrolling. nsarray *aimageurls = (nsarray *)[_datasource arraywithimageurlstrings]; if([aimageurls count] > 0) { [_scrollview setcontentsize:cgsizemake(_scrollview.frame.size.width * [aimageurls count], _scrollview.frame.size.height)]; (int = 0; < [aimageurls count]; i++) { cgrect imageframe = cgrectmake(_scrollview.frame.size.width * i, 0, _scrollview.frame.size.width, _scrollview.frame.size.height); uiimageview *imageview = [[uiimageview alloc] initwithframe:imageframe]; [imageview setbackgroundcolor:[uicolor clearcolor]]; [imageview setcontentmode:[_datasource contentmodeforimage:i]]; [imageview settag:i]; [imageview setimagewithurl:[nsurl u...