Posts

c# - Show XML node value in MVC view by number of similar node? -

is there anyway group xml node value similar number? had tried output value below can't out want. please guide me on this. thanks! my answer_data sample in database: (after extract c1 , c2) question_id | answer_data ============================================== 1 | <answer_data><answer>c1</answer> 2 | <answer_data><answer>c2</answer> 3 | <answer_data><answer>c2</answer> string[] data after extract using linq: ["c1","c2","c2"] able view in mvc: c1 c2 c2 what want is: c1 - 1 c2 - 2 my controller: public actionresult surv_answer_result(int survey_id, string language = "eng") { list<answerquestionviewmodel> viewmodel = new list<answerquestionviewmodel>(); var query = r in db.surv_question_ext_model join s in db.surv_question_model ...

objective c - Getting word from string in iOS -

i getting string separately in loop -> inbox , [gmail]/all mail or [gmail acc]/trash i want find here substring like -> inbox , mail or trash , add array(folderarray). by seeing above words, there strings -> [gmail]/,[gmail acc]/ etc. coming unnecessarily , want remove them if such strings appear , words -> inbox, mail, trash i tried below code doesn't give me word expected following link sample string separator could me solve please? for (mcoimapfolder *fdr in folders) { nsstring *foldertitle = fdr.path; // gives inbox, [gmail]/all mail or [gmail acc]/trash (int i=0; i<[folderlist.defaultfolderarray count];i++) { if ([foldertitle rangeofstring:[folderlist.defaultfolderarray objectatindex:i] options:nscaseinsensitivesearch].location != nsnotfound) { nslog(@"yes contain word"); nsrange range = [foldertitle rangeofstring:[folderlist.defaultfolderarray objectatindex:i] options:nscaseinsensitivesearch]...

ios - Override init method to have singleton instance -

one third party library uses class initialisation: classa *a = [[myclass alloc] init]]; i need myclass shared instance (aka singleton) can't modify 3rd party way of executing myclass initialization i trying override init method following: - (instancetype)init { return [[self class] sharedinstance]; } + (loopmenativeevent *)sharedinstance { static loopmenativeevent *_sharedinstance = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ _sharedinstance = [loopmenativeevent new]; }); return _sharedinstance; } but, unfortunately new causes alloc init executed. simplest way know have 2 separate classes: myclass initialised through alloc init separate mysharedclass singleton is there possibility achieve having 1 class? how inheritance, create new class named childclass inherit myclass , add following 2 methods + (instancetype)sharedinstance { static childclass *sharedinstance = nil; sta...

java - How to make a local JBOSS AS 7 serve static resources? -

as standard, static resources need stay in centralized location, out of ears / wars (so can updated without rolling out new release minor js/css changes). my html imports relative, eg: <script type="text/javascript" src="/resources/myapp/js/bootstrap.min.js"></script> this means urls resources different on every server (development, test, production..): on dev-foobar.com : dev-foobar.com /resources/myapp/js/bootstrap.min.js on tst-foobar.com : tst-foobar.com /resources/myapp/js/bootstrap.min.js on foobar.com : foobar.com /resources/myapp/js/bootstrap.min.js but when i'm on local jboss ( localhost:8080 ), how can instruct serve same static resources achieve following url ? localhost:8080 /resources/myapp/js/bootstrap.min.js jboss handles static resources through folder called welcome-content under $jboss_home : c:\program files\eap-6.2.0\jboss-eap-6.2\ welcome-content simply put there, ,...

java - reverse SetLayeredWindowAttributes -

i using code sharing screen. have air desktop application(transparent backgound) have created. don't want window shared i.e should not visible client. using setlayeredwindowattributes hide window capture desktop , send image clients , unhide window. i using setlayeredwindowattributes make window transparent. how reverse i.e make window visible again. here code private int gwl_exstyle = -20; private int ws_ex_layered = 0x00080000; private int lwa_alpha = 0x00000002; private int lwa_colorkey = 0x00000001; int winlong = user32extra.instance.getwindowlong(hwnd, gwl_exstyle); user32extra.instance.setwindowlong(hwnd, gwl_exstyle, winlong | ws_ex_layered); user32extra.instance.setwindowpos(hwnd, null, 100, 100, 100, 100,(0x0002) | (0x0001) | (0x0004) | (0x0020)); user32extra.instance.setlayeredwindowattributes(hwnd, null, 128,lwa_alpha); /* code*/ user32extra.instance.setwindowlong(hwnd, winlong & ~ws_ex_layered); user32extra.instance.setwindowpos(hwnd, null, 100, 100, 100, ...

How to put ScrollView and OnTouchListener together in Android? -

Image
there scrollview on layout, has textview inside, scrolling text if 1 more field heigth. when implements ontouchlistener scrollview, default scroll of text doesn't work. how can scroll text , handle touchevent? example: swipe left , right - turn next quote, swipe , down - scroll invisible text

Reading multiple .dat files into MatLab -

i having great difficulties reading bunch of .dat files matlab. have tried google problem, after 1 hour still can't code work. in total have 141 .dat files. each file consist of 3 lines of header information (which not want include), , bunch of rows, each 3 columns of numbers. want merge rows .dat files 1 large matrix featuring rows, , 3 columns (since each row in .dat files contains 3 numbers). code have attempted use: d = dir('c:\users\kristian\documents\matlab\polygoner1\'); out = []; n_files = numel(d); = 3:n_files fid = fopen(d(i).name,'r'); data = textscan(fid,'%f%f%f','headerlines',3); out = [out; data]; end however, when try run code error message ??? error using ==> textscan invalid file identifier. use fopen generate valid file identifier. error in ==> readpoly @ 6 data = textscan(fid,'%f%f%f','headerlines',3); if knows how can work, extremely grateful! the problem when use f...