Posts

Showing posts from September, 2014

Accessing flash attributes in Spring Web flow -

i use, redirectattributes.addflashattribute("msg","level complete") to access message on redirected jsp. how can use redirect attribute when redirecting webflow ? when flash attribute used send data 1 controller webflow have bind redirected flash attribute (from controller) response jsp page of webflow. purpose can maintain backend formaction class bind value scope of webflow. in flow xml can can call custom method on entry of view state. custom method of formaction class public void setupreferencedata(requestcontext context) throws exception { httpservletrequest request = (httpservletrequest) context.getexternalcontext().getnativerequest(); map<string, ?> inputflashmap = requestcontextutils.getinputflashmap(request); if (inputflashmap != null) { string flash = (string) inputflashmap.get("flash"); context.getrequestscope().put("flash1", flash); } } this

AngularJS directive file upload with progress bar from AngularJS O'Reilly book -

i'm starting angularjs , following book o'reilly, angularjs. in there example of using file upload file upload blueimp. i can upload files, want show progress bar , can not access element contains during "progress" event. in declaration of directive have "element" access container element , once there, show div progress bar, progress event have no access "element" (one passed 2 arguments, e & data) during file upload can not show bar. have looked @ many examples used differently i'm doing so, not serve me. is possible pass "element" function runs on progress event? ecm_directives.directive('fileupload', function(){ return { restrict: 'a', scope: { done: '&', progress: '&', }, link: function(scope, element, attrs) { var optionsobj = { datatype: 'json' }; if (scope.done) { optionsobj.done = function(e, data) { scope.$ap

c++ - How call method from Qt GUI in background worker thread using QThread -

i'm trying add gui in qt code recieving data vrpn server. , need continuously send data server application , call action(method) in interface when receive information. but have problem endless cycle while (running) . found solution use qthread recieving data server, can't figure out how use method qt class in worker when recieve data server. i tried make worker way, i'm not sure, how call method class when recieve data server (or if it's @ possible/or exist better way): #include "worker.h" #include <iostream> #include "vrpn_analog.h" void vrpn_callback vrpn_analog_callback(void* user_data, vrpn_analogcb analog) { (int = 0; < analog.num_channel; i++) { if (analog.channel[i] > 0) { there want call method nextimage(), have in qt class mainwindow } } } // --- constructor --- worker::worker() { } // --- deconstructor --- worker::~worker() { } // --- process -

php - Pause the Flow-player once a JavaScript function is called. -

Image
i using flowplayer display videos in project. using following code: <a href="<?php echo base_url()?>secure/<?php echo $videos->videolink?>" class="fplayer" id="flowplayer"> </a> <script> $(document).ready(function() { $('div[id^="overlay_form"]').css({ left: ($(window).width() - $('div[id^="overlay_form"]').width()) / 2, top: ($(window).width() - $('div[id^="overlay_form"]').width()) / 7, position:'fixed' }); }); </script> <script> $f("flowplayer", "<?php echo base_url()?>js/flowplayer-3.2.18.swf", { clip: { autoplay : "true", autobuffering : "true", onstart: function() { //msgs.innerhtml += "common clip event listener called\n"; return true; }, onpause: function() {

c++ - How to use CGAL::triangulate_polyhedron -

i trying use undocumented function cgal::triangulate_polyhedron. receiving lots of error it. here simple code: #include <cgal/exact_predicates_exact_constructions_kernel_with_sqrt.h> #include <cgal/point_generators_3.h> #include <cgal/algorithm.h> #include <cgal/polyhedron_3.h> #include <cgal/convex_hull_3.h> #include <cgal/triangulate_polyhedron.h> #include <vector> typedef cgal::exact_predicates_exact_constructions_kernel_with_sqrt k; typedef cgal::polyhedron_3<k> polyhedron_3; typedef k::segment_3 segment_3; // define point creator typedef k::point_3 point_3; typedef cgal::creator_uniform_3<double, point_3> pointcreator; int main() { cgal::random_points_in_sphere_3<point_3, pointcreator> gen(100.0); // generate 250 points randomly on sphere of radius 100.0 // , copy them vector std::vector<point_3> points; cgal::cpp11::copy_n(gen, 250, std::back_inserter(points)); // define polyhedr

html - how to stay image constant on hover -

here code using on page html <a href="#" class="bac" data-role="none" style="color:#fff;"> <strong>an&uacute;nciese gratis</strong> </a> css .bac{ background:url("http://wstation.inmomundo.com/static02/costarica/sprites_botones1.png"); background-repeat:no-repeat; display: block; font:15px/18px arial; height: 22px; padding: 6px 18px 4px 4px; text-decoration: none; margin-right:-4px; } .bac:hover{ background-attachment:scroll; background-position:0px -35px; background-image:url("http://wstation.inmomundo.com/static02/costarica/sprites_botones1.png"); background-repeat:no-repeat; height:22px; padding:6px 18px 4px 4px; } here demo http://jsfiddle.net/lc4ky/1/ (open in google chrome browser) when open in google chrome, on hover image going off second showing hover effect.the image going off first time on each refresh. want should stable.is there solution this? i not sur

javascript/jQuery How do I reuse objects in an array for a particle system -

i'm in process of building entity system canvas game. started simple particle emitter/updater altering accommodate multi-particle/entity generator. whilst ok javascript/jquery running limits of experience concerns arrays , gratefully accept on following: when need new particle/entity current system calls function push object array contains variables entity updates. then update function runs loop on array, checking on type variable update particle (position/colour/etc...). [array.splice] particle, based on condition. when needed further particles/entities push new particles. what achieve here is: in makeparticle function, check on particle array "dead" particles , if available resuse them, or push new particle if not have created particlealive var flag purpose. var particles = []; var playing = false; function mousepressed(event) { playing = !playing; } if(playing) { makeparticle(1, 200, 200, 10, "blueflame"); makeparticle(1, 300, 200, 10, "r

stylus string interpolation styntax for :before pseudo selector using a for loop -

i'm trying make #others li .text1:before{ content: "text1"; }... by doing #others li label in text1 text2 text3 .{label}:before content {label} but syntax isn't right seems... gives error expected "indent", got "outdent" the error content {label} bit, because without class selectors ( .text1:before ) prints ok and content '{label}' prints out {label} is. stylus don't have interpolation in strings or idents values, use addition string, convert ident string: #others li label in text1 text2 text3 .{label}:before content ''+label

php - get first and last value form a mysql results array -

how go getting first , last value sql query . want highest , lowest vaue of variable $integer1, have ordered them in ascending order in sql query, need pull them out of array first , last items. tried didn't work: $first = reset($result); $last = end($result); also, in sql query select string1, string2 , integer1 i want order integer1 , print out first , last (both strings) first echo $string 1. " " . /4string2; last echo $string 1. " " . /4string2; asuming want min , max value of field in sql. instead of fetching rows table , take first , last row in php, in sql ! select min(your_field), max(your_field) your_table conditions group field1,field2

Windows Phone 8 append to JSON file -

i'm working on windows phone 8 app. i'm having issue appending json file. works fine if keep app open once close , come in starts writing beginning of file. relevant code: private async void btnsave_click(object sender, routedeventargs e) { // create entry , intialize values textbox... gasinfoentries _entry = null; _entry = new gasinfoentries(); _entry.gallons = txtboxgas.text; _entry.price = txtboxprice.text; _gaslist.add(_entry); //txtblockpricepergallon.text = (double.parse(txtboxgas.text) / double.parse(txtboxprice.text)).tostring(); // serialize our product class string string jsoncontents = jsonconvert.serializeobject(_gaslist); // app data folder , create or open file storing json in. storagefolder localfolder = applicationdata.current.localfolder; storagefile textfile = await localfolder.createfileasync("gasinfo.json", creationcollisionoption.openifexists); //if await operator error

sql - Mysql retrieving range between 2 max values -

i'm trying retrieve range of values between last row in table , row 40 rows above it: 2568, 2567, 2566, etc. query i'm using not getting done: select * posts front_weight between 'max(front_weight)-40' , 'max(front_weight)' from wording assume front_weight unique? if can use: select * posts order front_weight desc limit 40

javaScript object doesn't keep key order giving from php -

i have array use json_encode on looks in php array ( [4] => array ( [numberof] => 60 [date] => 4 ) [3] => array ( [numberof] => 3 [date] => 3 ) [2] => array ( [numberof] => 6 [date] => 2 ) [1] => array ( [numberof] => 5 [date] => 1 ) [12] => array ( [numberof] => 1 [date] => 12 ) [11] => array ( [numberof] => 0 [date] => 11 ) ) however, when accessing via javascript the order following { "1":{"numberof":5,"date":"1"}, "2":{"numberof":6,"date":"2&

I don't understand the concept of Ruby operators. What is the difference between '<' and 'xyz' method? -

class computation def initialize(&block) @action = block end def result @result ||= @action.call end def xyz(other) end def <(other) result < other.result end end = computation.new { 1 + 1 } b = computation.new { 4*5 } p < b #=> true p xyz b #=> `<main>': undefined method `xyz' main:objec i don't understand why '<' method works , 'xyz' method returns error ? in ruby < > + - etc operators, can call operators without dot, , off course can redefine operators (what doing here). in case of xyz string, , when called without dot ruby treats differently. a.xyz b evaluates a.xyz(b) a xyz b evaluates a(xyz(b)) , since global scope object , throw undefined method 'xyz' main:object

python - Local variable referenced before assignement -

this question has answer here: unboundlocalerror in python [duplicate] 8 answers i going crazy. simple callback function doesn't recognize variable assigned right before in it's parent scope. local variable 'elapsed' referenced before assignment error`. why? total = os.path.getsize(filename) elapsed = 0 def progress_print(chunk): elapsed += len(chunk) # elapsed apparently unassigned?? percent = float(elapsed) / float(total) * 100 print ' copied %s%%\033[a' % int(percent) ftp.upload(filename, temp_path, callback=progress_print) you're trying assign global. python makes explicitly that. def progress_print(chunk): global elapsed elapsed += len(chunk) in general pretty sign need refactor code until don't need globals more. note assignment , access different beasts - former requires explicitly

asp.net - MobilePin createuserwizard doesn't work? -

i new asp.net , first time using membership controls in project. here in project while creating new user need mobile number of user, how can enable mobilepin of createuserwizard. because saw mobilepin field in aspnet_membership table thinking can add values mobilepin field front-end while creating new user. can me? i did code doesn't work <asp:label id="mobile" runat="server" associatedcontrolid="mobilepin">mobile no:</asp:label> <asp:textbox id="mobilepin" runat="server" cssclass="textentry"></asp:textbox> <asp:requiredfieldvalidator id="requiredfieldvalidator1" runat="server" controltovalidate="mobilepin" cssclass="failurenotification" errormessage="mobile required." tooltip="mobile required." validationgroup="registeruservalidationgroup">*</asp:requiredfieldvalidator> how make mobilepin in asp.net me

C# Math.Round double .5 -

i have try math.round class. let see math.round(2.5) //2.0 math.round(-2.5) //-2.0 math.round(2.5,midpointrounding.toeven) // 2.0 math.round(2.5,midpointrounding.awayfromzero) //3.0 my simple question if change number -77777777.5 why result -77777778.0 not -77777777.0 math.round(-77777777.5) // -77777778.0 math.round(-77777777.5,midpointrounding.awayfromzero) // -77777778.0 math.round(-77777777.5,midpointrounding.toeven) // -77777778.0 thanks idea , suggestion. the default midpointrounding mode toeven . in mode, explained documentation (where a input value), the integer nearest a. if fractional component of halfway between 2 integers, 1 of , other odd, number returned. -77777777.5 has 2 nearest integers -77777777 , -77777778 latter 1 1 returned. in awayfromzero mode, -77777778 further 0 -77777777 .

c++ - Is it possible to run code on a "reserved" cpu core? -

simplified background: my app runs lot of tasks. of them cpu intensive. 1 task (which single thread running in loop, listening packets network), "realtime" task. make more interesting, thread native code called using pinvoke . the problem: when lot of traffic showing, tasks working hard, , cores maxing out. when happens, "realtime" thread (which runs on 100% cpu core), starts drop packets, because doesn't enough cpu time. the question: it possible somehow "reserve" 1 core "realtime" thread, , limit other threads (tasks) other cores? of course, there other processes running, consuming cpu time well, let's assume consume little , constant resources. this real problem can solved "throw more cpu on it"... not option... edit - answering many useful comments: we use winpcap capture packets, can many (many). the "realtime" thread not "realtime" (i think "realtime" processes - in .

Convert HTML Megamenu to Yii CMenu zii Widget -

i started working yii, , having trouble converting html megamenu yii. html this: <div class="nav-wrapper"> <div class="container"> <ul class="some_class"> <li class="active"><a href="#">parent 1</a> <div class="megamenu"> <div class="row"> <a href="#" class="overview">child 1</a> </div> <div class="row"> <div class="col1"> <ul> <li><a href="#">child 3</a></li> <li><a href="#">child 4</a></li> </ul> </div>

javascript - How to share a dojo widget to the child window which was created by window.open? -

i created widget in parent window , create sub window using window.open . want display widget in sub window without using new. we have tried use public variable pass it, when display it, there undefined error! //the public variable remember widget create parent window common.testpage = null; //the parent window this.wfrmstatistics = new dijit.layout.contentpane({ region : "center", style : "width: 100%;height: 100%;" }); this.mainstack.addchild(this.wfrmstatistics); this.mainstack.selectchild(this.wfrmstatistics); //new widget common.testpage = new gadd.wfrmstatistics({ style : "width:100%;height:100%;" }); this.wfrmstatistics.setcontent(common.testpage.domnode); common.testpage.startup(); //the sub window(actually same js file parent window),create window.open this.wfrmstatistics = new dijit.layout.contentpane({ region : "center", style : "width: 100%;height: 100%;" }); this.mainstack.addchild(this.wf

sockets - How can I set up a Java Server with specific IP and Port with a normal Webhosting Package? -

i want create java webserver existing web hosting/space ip/port can test socket programming features. have webhosting package @ https://alfahosting.de/ possible socket programming webhosting package? if not possible socket programming webhosting package. how possible? special webhosting packages support socket programming own ip , port? i know if tutorial how set java webserver socket in web hosting package. thanks! most webhosting packages allow host static html pages , cgi (php, perl) scripts. provide jsp , jsf support more expensive regular webhosters. if want code own webserver/socket applications in java need root server package (i, example, use vserver €12,99/month) on such server have direct root access machine, can install software want - have install java runtime engine of choice , go (assuming server's firewall set correctly) - dedicated ip address can directly connect servers java programs.

c# - Event on Visual Studio project creation -

i want add functionality when user creates project \ solution in visual studio 2010\2012. i.e. need perform c# code when new project created. i googled lot didn't find event fired on\after project creation. there way that? after research , article mentioned @joe steele, i've managed hook commandevents.afterexecute event, responsible project creation: dte application = this.getservice(typeof(sdte)) dte; string guidvsstd97 = "{5efc7975-14bc-11cf-9b2b-00aa00573819}".toupper(); int cmdidnewproject = 216; this.createcmd = application.events.commandevents[guidvsstd97, cmdidnewproject]; this.createcmd.afterexecute += this.command_afterexecute; and how delegate looks like: void command_afterexecute(string guid, int id, object customin, object customout) { // place code here } notes : probably difficult part find right guid , commandid , this article of help. sometimes, during debugging, event didn't fire @ all, made me baffled, thank

Why is python's word in words iterating on letters instead of words? -

when enter following code: def word_feats(words): return dict([(word, true) word in words]) print(word_feats("i love sandwich.")) i output in letters instead of words {'a': true, ' ': true, 'c': true, 'e': true, 'd': true, 'i': true, 'h': true, 'l': true, 'o': true, 'n': true, 'i': true, 's': true, 't': true, 'w': true, 'v': true, '.': true} what doing wrong? thanks! you need explicitly split string on whitespace: def word_feats(words): return dict([(word, true) word in words.split()]) this uses str.split() without arguments, splitting on arbitrary-width whitespace (including tabs , line separators). string sequence of individual characters otherwise, , direct iteration indeed loop on each character. splitting words, however, has explicit operation need perform yourself, because different use-cases have differen

javascript - Why there is a 'amd' property in 'define' function? -

i learning jquery , backbone source code, , noticed check if there requirejs: jquery 1.9.1 if ( typeof define === "function" && define.amd && define.amd.jquery ) { define( "jquery", [], function () { return jquery; } ); } backbone if (typeof define === 'function' && define.amd) { define(['underscore', 'jquery', 'exports'], function(_, $, exports) { why there have amd property in define function in requirejs? and define.amd object key jquery true ? have not import jquery module? it convention amd loaders should use indicate define export global space define made used amd modules define themselves. if amd loaders did not use convention if random javascript library decided export define function global space has nothing amd, code designed work or without amd loader erroneously believe used in environment amd loader present. there still risk things go askew if random thir

android - How to get score from google play game service's leaderboard of current player? -

currently doing game integrated google game play service , want compression score between score , best of score, easy inform player getting new high score. don't how getscore google game service leaderboard, can please guide me on how it? i able display leaderboard can't find way how score user playing. my code showing leaderboard: if (issignedin()) { if(inscore<=50) { games.leaderboards.submitscore(getapiclient(), getstring(r.string.leaderboard_easy), inscore); } else { games.leaderboards.submitscore(getapiclient(), getstring(r.string.leaderboard_hard), inscore); } } else { log.d("not signed", "not signed in"); } i want score user playing on device, me please. this how i'm fetching score of current player: private void loadscoreofleaderboard() { games.leaderboards.loadcurrentplayerleaderboardscore(getapiclient(), getstring(r.string.y

javascript - CORS request works in a plain HTML file but not under IIS -

i've been developing jquery plugin involves making cors ajax calls. development work started inside of plain html page. able open file (right click, open [browser]) in chrome, firefox, , ie7+ , bring data company's dev server (using https). the issue came when started integrating plugin new web forms page. ran through iis time, , ajax call came "error: access denied" in ie <= 9, worked fine in ie10, 11, chrome, , firefox. in fiddler, compared requests sent out html page opened file , html page run through iis. opening plain file, request contained origin http header set null. under iis, request did not have origin header, had referer header set localhost. i've read ie 8 , 9 have partial support cors, while ie10 has full support. what don't understand why cors ajax calls work in ie 7/8/9 when opened html page plain file , not work when run through iis. has else come across issue? referer header that's making throw access denied error?

c# - Load picture from a .NET assembly resource in a simple HTML file? -

i have .net server control app returns html. need embed several picture files assembly html file can use them src= each of them. we have .html file lives in project embedded resource , server control code read html , serve up. within html, need have picture src links (as css, js, etc) point embedded resource files. does know code put in html file pictures make point embedded picture file? i have on grand scale... hundreds of times. programmatic approach doing can write wrapper , never have touch again when update server control new html, picture files, etc. one might imagine way @ compile time can loop through embedded files getmanifestresourcenames , replace() src links http resource links suppose? thank guidance! hm, question covers quite many aspects. let me repeat see if got it: have assembly, raw html file in it. file references items, found within same assembly, , want have them served client upon request well. one possible solution might this. instead

Parse XML and get elements from it using C# -

i have xml file such below: <host> <status state="up" reason="arp-response" reason_ttl="0"/> <address addr="128.208.188.2" addrtype="ipv4"/> <address addr="00:19:d1:3d:65:85" addrtype="mac" vendor="intel corporate"/> <hostnames> <hostname name="d0slf4.phys.washington.edu" type="ptr"/> </hostnames> <times srtt="1000" rttvar="5000" to="100000"/> </host> <host> <status state="up" reason="arp-response" reason_ttl="0"/> <address addr="128.208.188.3" addrtype="ipv4"/> <address addr="3c:94:d5:ac:18:7d" addrtype="mac" vendor="juniper networks"/> <hostnames> <hostname name="xe-0-3-2-&#45;1378.uwar-atg-1.infra.washington.edu" ty

javascript - How Do I scroll into view on button click and show iframe at the same time? -

i have button when clicked show iframe, want scroll iframe when iframe loads after button cliked don't have scroll view iframe instead me. i've tried approach $(document).ready(function() { $("#bpbutton").click(function() { document.getelementbyid("iframe1").src="http://www.w3schools.com/jsref/prop_frame_src.asp"; $("#iframe1").slidedown(); document.getelementbyid("iframe1").scrollintoview(); }); }); but after click button shows iframe, have click again scroll view. can't seem both @ same time??

linux - Emacs paste doesnt work -

when want paste text in emacs (running in windows+cygwin+console mode emacs) have issue m-x xterm-mouse-mode command make work. , go doing regular things have switch off. what better solution? iirc when in xterm-mouse-mode, can paste shift+middle-button.

vim - What is the reason that Ctrl+I and Tab keys send same codes? -

does can explain reason ctrl + i , tab keys send same code? figure out it's because of "historical reasons". for example, fact can affect on behavior of vim bindings in question . i think has how tab encoded in ascii. if @ ascii table , @ man page ascii (copied below) oct dec hex char oct dec hex char ──────────────────────────────────────────────────────────────────────── 000 0 00 nul '\0' 100 64 40 @ 001 1 01 soh (start of heading) 101 65 41 002 2 02 stx (start of text) 102 66 42 b 003 3 03 etx (end of text) 103 67 43 c 004 4 04 eot (end of transmission) 104 68 44 d 005 5 05 enq (enquiry) 105 69 45 e 006 6 06 ack (acknowledge) 106 70 46 f 007 7 07 bel '\a' (bell) 107 71

Javascript: Hide image before page load then Fade image in, working but not quite right -

first , foremost no jquery. accomplished on jquery running on javascript. window.onload = function () { var target = document.getelementbyid('homeimg'); var opacity = 0; var fader = setinterval(function() { if ( opacity <= 100 ) { target.style.opacity = ( opacity / 100 ); } else { clearinterval(fader); } opacity += .50; }, 100); // end setinterval function } // ends window.onload when hid div in css ( #homeimg {display:none} , {display: hidden} ), image not load @ all.. the function works image visible split second when page loads, image dissappears , fades in. i hide image fades in. thank you it's because first 100 milliseconds, opacity default (1). after 100 milliseconds, setinterval function kicks on , starts fade image in. add right below line set target variable: target.style.opacity = 0; or use css style set opacity 0 without javascript: #homeimg { opacity: 0; }

jquery - dynamically created link click event firing but the delete function is not doing the desired effect -

hi playing gridview , autocomplete function of jqueryui adding rows gridview dynamically after clicking item on autocomplete returned items here code: $("#<%=txtsearch.clientid %>").autocomplete({ source: function (request, response) { $.ajax({ url: '<%=resolveurl("~/web.asmx/hello")%>', data: "{ 'prefix': '" + request.term + "'}", datatype: "json", type: "post", contenttype: "application/json; charset=utf-8", success: function (data) { response($.map(data.d, function (item) { return { label: item.split('-')[0], val: item.split('-')[1]

google bigquery - Parallelizable OVER EACH BY -

i hitting obstacle again , again... join each , group each clauses can't used on output of window functions is there best practice or recommendations how use window functions (over()) large data sets cannot processed on single node? fragmenting data , running same query different filters can work, limiting, takes lot of time (and manual labor) , costly (running same query on same data set 30 times instead of once). referring jeremy's answer bellow... it's better, still doesn't work properly. if take original query sample: select title,count (case when contributor_id<>leadcontributor 1 else null end) different, count (case when contributor_id=leadcontributor 1 else null end) same, count(*) total ( select title,contributor_id,lead(contributor_id)over(partition title order timestamp) leadcontributor [publicdata:samples.wikipedia] regexp_match(title,r'^[a,b]')=true ) group title now works... but select title,count (case when contributor_id

Get Registry Name using powershell -

i wanted loop through registry entries using powershell , uninstall msis. i found answer in this post simillar requirement. have slight different requirement. (i dont want use uninstall string) i list of registries in 'hklm:\software\microsoft\windows\currentversion\uninstall' , want use name (i.e. productcode) of registry itself. my question: how name of registry. you need use get-childitem . for example, gives name of key under uninstall key. get-childitem hklm:\software\microsoft\windows\currentversion\uninstall | select pschildname update based on comment: get-childitem hklm:\software\microsoft\windows\currentversion\uninstall | where-object { $_.pschildname -eq '{d2b9c003-a3cd-44a0-9de5-52fe986c03e5}'} | select pschildname

c# - Getting the parameters of a generic type into a dictionary -

i have written method iterates on generic parameter types of instance... dictionary<string, guid> returns tkey: system.string tvalue: system.guid tuple<guid, bool, stringbuilder> returns t1: system.guid t2: system.boolean t3: system.text.stringbuilder method public static dictionary<string, type> getgenericparameters(type type) { dictionary<string, type> result = new dictionary<string, type>(); type[] tvalues = type.getgenericarguments(); type[] tkeys = type.getgenerictypedefinition().getgenericarguments(); if (tvalues.length == tkeys.length) { (int index = 0; index < tvalues.length; index++) { result.add(tkeys[index].name, tvalues[index]); } } return result; } test: foreach (keyvaluepair<string, type> pair in getgenericparameters(typeof(tuple<string, int, guid, stringbuilder, long, bool, tuple<bool, string>>))) { console

jquery - Checking content with inArray to add class -

so jquery "inarray" new beast me little unsure how this'll work. https://api.jquery.com/jquery.inarray/ i have div content "0 checkout now". i check when 0 changes number, if change add class of "active" containing div. my html looks this: <div class="search-again-panel-top"> <a class="checkout-now" href="#"> 0 checkout </a> </div> this tried do: $('.search-again-panel-top .checkout-now').filter(function() { var text = $(this).text('0'); return $.inarray(text, this) = -1; }).addclass('active'); you try this: var checkelement = $('.search-again-panel-top .checkout-now') var parts = $(checkelement).html().split(" "); if (jquery.inarray("0", parts) == -1) { //do nothing } else { //has changed $(checkelement).addclass("active"); } the jquery.inarray function passes item searching f

How to display images coming from webservice in android -

we working on project data coming webservice.i dispalying data in listview.the data icludes images image path.i have displayed iformation couldt display image.how display images webservices. my code is: package com.example.doctreachapp; import java.util.arraylist; import java.util.hashmap; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import com.example.doctreachapp.jsonparser; import com.example.doctreachapp.r; import android.app.listactivity; import android.app.progressdialog; import android.content.context; import android.graphics.bitmap; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.webkit.webview; import android.widget.baseadapter; import android.widget.imageview; import android.widget.listadapter; import android.widget.listview; import android.widget.simpleadapter;

why are there different results in two scala running environments? -

i reading section 19.3 of book "programming in scala 2nd", there snippet code , description around in page 431: note: fc17 x86_64 scala-2.9.2 class cell[t](init: t) { private[this] var current = init def = current def set(x: t) { current = x } } i modifyed sample in 2 different enviroments: in first one, wrote following code in file cell.scala class class b extends class c extends b class cell[+t](init: t) { private[this] var current = init def = current def set[u >: t](x: u) { current = x.asinstanceof[t] println("current " + current) } } object cell { def main(args: array[string]) { val a1 = new cell[b](new b) a1.set(new b) a1.set(new string("dillon")) a1.get } } and using following command, , got nothing error: [abelard <at> localhost lower-bound]$ scalac cell.scala [abelard <at> localhost lower-bound]$ scala -cp . cell current b <at> 67591ba4 current dillon dillon [abelard <at> loc

android - Multiple ViewPagers in on Activity -

i trying implement more 1 viewpager in 1 activity , not working. what's best way implement that. stuck!! this activity import android.app.activity; import android.os.bundle; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.widget.button; import com.viewpagerindicator.circlepageindicator; public class newworkoutactivity extends activity{ viewpager corepager; viewpager timepager; viewpager equipmentpager; circlepageindicator coreindicator; circlepageindicator timeindicator; circlepageindicator equipmentindicator; button startworkoutbutton; pageradapter coreadapter; pageradapter timeadapter; pageradapter equipmentadapter; string[] timesets; string[] coretargets; string[] equipments; int[] timeimages; int[] coreimages; int[] equipmentimages; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancesta

android - Toggle button not working for navigation drawer -

i implementing navigation drawer android application. got drawer work dragging side, home/toggle button on action bar doesn't change icon want , doesn't respond clicks, thou ondrawerclosed , ondraweropened methods defined in called. code follows: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <fragment android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/loadingfragment" android:name="com.whostr.clients.android.loadingfragment" /> <fragment android:layout_width="match_parent" android:layout_height="match_parent"