Posts

Showing posts from January, 2013

javascript - Selenium: How to verify a word in a string inside a variable? -

i'd know how verify if there's word inside string (using variables). for example, have variable called options has string " test,test2,test3 " (without quotes) inside it. want verify if string contains word test2 . i've tried way: command: store // target: test,test2,test3 // value: options command: storeeval // target: javascript{storedvars['options'].contains("test2");} // value: result i want selenium store true or false on variable result if finds or not word test2 on string, i'm getting error: [error] unexpected exception: typeerror: storedvars.options.contains not function. filename -> chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js, linenumber -> 2545 any ideas? screenshoot: http://oi40.tinypic.com/2qibcxf.jpg javascript{storedvars['options'].search("test2");} worked.

jquery - Change background of class only on hover (with javascript) -

i'd piece of javascript change on hover instead of making permanent background. <script type="text/javascript"> $(function () { $('ul.slideshow-menu').find('a').fadeto('slow', 1); $('ul.slideshow-menu').find('a').hover(function () { $(this).fadeto('fast', 1); $('.pikachoose').css({ 'background-image': 'url(' + $(this).attr('src') + ')' }); }, function () { $(this).fadeto('slow', 1); }); }); </script> right looks image set in "a href" tag , takes url class ".pikachoose" , replaces background image. want on hover , when nothing hovered changes original background-image. anyone got ideas? in second function set pikachoose css original url lile : $('ul.slideshow-menu').find('a').hover(function(){ $(this).fadeto('fast', 1); $('.pikachoose...

java - Nanohttpd server in Android -

i developing android app uses nanohttpd create web server , when run it says activity has stopped code please me appriciated.here goes code: package dolphin.developers.com; import java.io.ioexception; import java.io.inputstream; import java.util.map; import android.content.context; import android.os.environment; public class myhttpd extends nanohttpd{ private context ctx; public myhttpd(context ctx) throws ioexception { super(8080); this.ctx = ctx; } @override public response serve( string uri, method method, map<string, string> header, map<string, string> parms, map<string, string> files ) { string html = null; inputstream = null; try { = ctx.getassets().open(environment.getexternalstoragedirectory()+"/index.htm"); } catch (ioexception e1) { // todo auto-generated catch block e1.printstacktrace(); } byte[] b; try { ...

c - How can be size of variable guaranteed -

i have variable must 16 bit long. how should define 16 bit independently on platform? i can define short , depending on platform can 16 bits or more. assuming you're using c99, use uint16_t (or int16_t ) <stdint.h> . these guaranteed exist long compiler has underlying 16-bit type available.

mongoose - MongoDB Aggregation Multiple Keys -

i trying aggregate employees using department , status calculate summ each status. this: { name : "employee_1", department: "hr", status : "exist" }, { name : "employee_2", department: "acme", status : "absent" }, { name : "employee_3", department: "acme", status : "absent" } ... to this: { department: "hr", statuses: { exist: 1, absent: 0 } }, { department: "acme", statuses: { exist: 0, absent: 2 } } ... i try via: employee.aggregate( { $group: { _id: '$department', statuses: { $addtoset: "$status" } }}, { $project: { _id: 1, statuses: 1 }}, function(err, summary) { console.log(summary); } ); i statuses in array, produced "$addtoset": { department: "hr", statuses: [ 'exist', ...

viewmodel - Bind to IReactiveCommand in view code behind -

i have viewmodel has errorcommand. wish subscribe in view code behind time called can display error message passed so: errorcommand.exectute("error occured") in view: this.whenany(view => x.viewmodel.errorcommand, x => x.value).subscribe(error => displayerror(error)); this code doesn't work shows i'm trying acheive. how correctly? i understand use messagebus, have similar scenario messagebus wouldn't appropriate. there's method scenario: this.whenanyobservable(x => x.viewmodel.errorcommand).subscribe(x => /* ... */); will expect , avoid null refs

android - Locking orientation to portrait force close in my phone -

i want app lock portrait mode. used code : <activity android:name="myactivity" android:label="@string/app_name" android:screenorientation="portrait" android:configchanges="orientation|keyboardhidden" > and in myactivity class : public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); setrequestedorientation(activityinfo.screen_orientation_portrait); } this code work correctly in emulator, when install , run in phone, app force closed. how can solve problem? yo use in manifest there no need use pragmatically. remove onconfigurationchanged method code.

javascript - Faster block all routes in Express -

i try var _lock_ = true; // or load config app.all('*', function(req,res,next){ if(_lock_) return res.send(401); next(); }); // place other routes app.get(...); app.post(...); this works well. doubt whether right? app.use more appropriate function want processed on every request. faster since avoids having match route against request url. var _lock_ = true; // or load config app.use(function(req,res,next){ if(_lock_) return res.send(401); next(); }); app.use(app.router); // middleware function must above router

java - How to assign a service to message-driven-adapter in Spring Integration? -

upon received message in receivechannel invoke service work. flow of messages be: jms message -> receivechannel -- message-driven-adapter --> jmsinchannel -> queuechannel (here service should invoked) i achieve either 1) service invoked on queuechannel 2) or message-adapater. in latter case not know how assign service message-driven-adapter in spring integration? service not invoked. this configuration contains both approaches none of them working: <int-jms:channel id="receivechannel" queue-name="forward" connection-factory="connectionfactory" auto-startup="true"> </int-jms:channel> <si:channel id="jmsinchannel"/> <int-jms:message-driven-channel-adapter id="messagedrivenadapter" channel="receivechannel" destination-name="jmsinchannel"/> <si:bridge input-channel="jmsinchannel" output-channel="queuechannel"/> <si:...

java - Appending XML element as a text node (escaped) -

i need take xml element , children, escape xml , append them text node in document. know approach stupid, api requires it. could accomplish using 1 of many xml libraries java? tried using jaxp, code doesn't escape apostrophes , double quotes. … string content = elementtostring(nodetoescape); text text = document.createtextnode(content); node n = document.getelementsbytagname("targetnode").item(0); n.appendchild(text); } string elementtostring(element element) { document document = element.getownerdocument(); domimplementationls domimplls = (domimplementationls) document.getimplementation(); lsserializer serializer = domimplls.createlsserializer(); return serializer.writetostring(element); } resulting document fragment: &lt;dataitem aggregate="none" name="order number"… you don't need escape quotes , apostrophes. according to: http://www.w3schools.com/xml/xml_syntax.asp characters ...

function - Comparison between my day in table and the sysdate in server -

i'm trying write function return day_id after comparing current day name on server , day name on table contents **my code is create or replace function getsysdate return char v_day char(20) ; v_day_id days.day_id%type ; v_day_name days.day_name%type ; begin select day_id, to_char(sysdate, 'day', 'nls_date_language=arabic'), day_name v_day_id,v_day,v_day_name days v_day_name = v_day ; return v_day_id ; end; but unfortunately,it's no data found ! note ! : datatype of day_name varchar (20 byte) **the error connecting database admin. ora-01403: no data found ora-06512: @ "admin.getsysdate", line 9 ora-06512: @ line 5 process exited. disconnecting database admin. ** table day_id number day_name varchar2(20 byte) your filter using local variables have not been initialised; in fact you're trying set them , use them filter @ same time, doesn't make sense. where v_day_name = v_day ... never going ...

django - Coverage test for create view class and update view class -

i'm writing coverage test cases app views. have used createview , updateview classes modelform , used get_success_url() response redirect. when passed data form using self.client.post('/product/add/', data) , response templateresponse , status_code 200, get_success_url() statements not covered test case. how can fill , submit form templateresponse? if client not redirecting success url, data invalid. can access form through response's context, , check errors: print response.context['form'].errors

java - Android VideoView thumbnail refresh after programmatically seeking on certain devices -

in application have programatically skip video position according user input. the problem i'm having when video paused , seek specified value thumbnail not refresh (the videoview still displays image paused). this happens on devices such galaxy s4, htc 1 or nexus 10 (maybe related api or resolution, not sure), while works expected on galaxy s2, nexus 7 , other lower-end devices. i've tried "hacky" approach such starting , pausing video no success (the image in videoview not update). i'm hoping bit more experience can tell me if there way refresh video's thumbnail programmatically. you can use seekoncompletedlistener of underlaying mediaplayer of videoview , pause right after seeked. void seek(int position) { videoview1.start(); videoview1.seekto(position); } videoview1.setonpreparedlistener(new onpreparedlistener() { @override public void onprepared(mediaplayer mp) { // todo auto-genera...

console - How to delete all files in a directory using batch? -

i have simple query. have folder "x" on desktop (windows 7), , want write batch program delete files in it. (all extensions) i've come with: cd c:\users\admin\desktop\x\ del *.* but, when open it, console still asks human input (y/n). can bypass this? always use explicit path flaw not delete current folder, whatever may @ time. all visible files, silently del "c:\users\admin\desktop\x\*.*?" all visible files, silently using /q del /q "c:\users\admin\desktop\x\*.*" all visible files, including subdirectories, silently del /s /q "c:\users\admin\desktop\x\*.*" type del /? full info.

java - Writing and reading ListMultimap<Object, Object> in file -

i tried writing listmultimap file using properties , seems impossible, refer question writing , reading listmultimap file using properties . going ahead, if using properties store listmultimap not correct way, how can store listmultimap file? , how can read file? e.g. lets have: listmultimap<object, object> index = arraylistmultimap.create(); how can write methods write listmultimap file , read file: writetofile(listmultimap multimap, string filepath){ //?? } listmultimap readfromfile(string filepath){ listmultimap multimap; //multimap = read file return multimap; } you need decide how represent each object in file. example, if listmultimap contained string s write string value if you're dealing complex objects need produce representation of object byte[] , if want use properties should base64 encoded. the basic read method should like: public listmultimap<object, object> read(inputstream in) throws ioexception { lis...

(DatabaseError: no such table: django_session) ERROR during Django 1.3 selenium testing -

i'm trying use django selenium testing django1.3 application. database backend testing sqlite3. here snippet of settings file. if 'test' in sys.argv: db_engine = 'django.db.backends.sqlite3' databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'test_name': ':memory:', 'name': 'database_one', }, 'database_two': { 'engine': 'django.db.backends.sqlite3', ] 'test_name': ':memory:', 'name': 'database_two', }, 'database_three': { 'engine': 'django.db.backends.sqlite3', 'test_name': ':memory:', 'name': 'database_three', }, } south_tests_migrate = false when run s...

twitter bootstrap - full width for an input-append element -

i have div row input-append (a field 2 buttons on right) spans width of row itself. in other words, have this: <div class="row"> <div class="span12"> <div class="input-append"> <input class="" id="appendedinputbuttons" type="text"> <button class="btn" type="button">search</button> <button class="btn" type="button">options</button> </div> </div> </div> with <div class="input-append"> takes width available (span 12 of parent). to more pragmatic, transform code in order have input element cover available space row has: http://jsfiddle.net/bertuz/ts6dm/ if set class span12 input element, 2 buttons overflow of course. , that's not want. piece of suggestion appreciated what if add span class 3 elements? that <div class="...

objective c - UITableView accessoryType disappears in last half of UITableView -

i have ipad app (xcode 4.6, arc, storyboards, ios 6.2.3). have uipopover uitableview has 21 rows in it. can set accessorytype in of rows randomly, in first 12 rows accessorytype setting (checkmark) persist can examined in method , processed. don't see difference between first 12 rows , last 9 rows. uitableview scrollable, rows after 11th row, have scroll bottom here code set accessorytype : #pragma mark didselectrowatindexpath - (void) tableview:(uitableview *) tableview didselectrowatindexpath: (nsindexpath *)indexpath { // cell selected uitableviewcell *thecell = [tableview cellforrowatindexpath:indexpath]; if(thecell.accessorytype != uitableviewcellaccessorycheckmark) thecell.accessorytype = uitableviewcellaccessorycheckmark; else thecell.accessorytype = uitableviewcellaccessorynone; } here code check accessorytype , process it: -(void) moveservices { // (moves checked tableviewrows services tableview) nsmutablestring...

View not found in MVC4 / ASP.net 4.5 hybrid application -

our main site asp.net 4.5 , uses ektron (a .net cms) i'm attempting turn mvc4 / webforms hybrid. far can tell have mvc4 needs installed correctly when try hit default home controller classic [invalidoperationexception: view 'index' or master not found or no view engine supports searched locations. following locations searched: ~/views/home/index.aspx ~/views/home/index.ascx ~/views/shared/index.aspx ~/views/shared/index.ascx ~/views/home/index.cshtml ~/views/home/index.vbhtml ~/views/shared/index.cshtml ~/views/shared/index.vbhtml] i installed mvc4 using nuget , copying on default controllers, view , associated app_start , global.asax files default mvc4 application. installed webapi working fine (so tells me routing seems working correctly, i.e. can go api/values , default values api data fine). the site installed main website, i.e. not sub site or sub application. i thought maybe there issue handlers section ektron (our cms) has ton of handlers adds have tor...

neo4j - cypher find relation direction -

how can find relation direction regards containing path? need weighted graph search takes account relation direction (weighing "wrong" direction 0 , see comments). lets say: start a=node({param}) match a-[*]-b a, b match p = allshortestpaths(a-[*]-b) return extract(r in rels(p): flows_with_path(r)) in_flow where flows_with_path = 1 if sp = (a)-[*0..]-[r]->[*0..]-(b) , otherwise 0 edit: corrected query so, here's way existing cypher functions. don't promise it's super performant, give shot. we're building our collection reduce, using accumulator tuple collection , last node looked at, can check it's connected next node. requires 2.0's case/when syntax--there may way in 1.9 it's more complex. start a=node:node_auto_index(name="trinity") match a-[*]-b <> b distinct a,b match p = allshortestpaths(a-[*]-b) return extract(x in nodes(p): x.name?), // concise representation of path we're checking head( ...

fadein - stop fade in out on a movieclip actionscript 2 -

i'm trying stop fading in/out movieclip. i'll explain: i've integrated swf in html page dropdown list. when choose item list javascript function it's called.this function execute callback function in swf file fade in/out image drawn @ runtime (depending on item selected in dropdown list). when choose element want previuos item stops fading , new starts. this fading function: function fadein(h){ if (eval(h)._alpha<100) { eval(h)._alpha += 20; } else { clearinterval(fadeinterval); settimeout(startout, 500, h); } } function fadeout(h) { if (eval(h)._alpha>0) { eval(h)._alpha -= 20; } else { clearinterval(fadeinterval); settimeout(startin, 100, h); } } function startout(h) { fadeinterval = setinterval(fadeout, 1, h); } function startin(h){ fadeinterval = setinterval(fadein, 1, h); } function flashing(h){ var bname; bname = "plangroup.singleobject." + h; eval(bname)._alpha = 0; fadeinterval = setinterval(fadein, 1, bna...

python - Plot 3 figures with common colorbar by using Basemap -

Image
i have been using code plot 3 figures common colorbar: grid_top = imagegrid(fig, 211, nrows_ncols = (1, 3), cbar_location = "right", cbar_mode="single", cbar_pad=.2) n in xrange(3): im1 = grid_top[n].pcolor(data_top[n], interpolation='nearest', vmin=0, vmax=5) plt.show() i want use basemap plot orthographic projection, define as: m=basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution='l', llcrnrx=0.,‌​llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.) when, change code above follow: im1 = grid_top[n].m.pcolor(data_top[n], interpolation='nearest', vmin=0, vmax=5) i error.. what have change make works basemap ? thank you well, it's bit difficult diagnose specific error without seeing error message you're getting, i'll give go. when call basemap() draws map active axes i...

asp.net - session/forms authentication timeout -

i'm trying site go login page after amount of time if there no activity user. in web.config far i've tried: <system.web> <authentication mode="forms"> <forms defaulturl="~/notifications.aspx" loginurl="~/index.aspx" timeout="1" slidingexpiration="true"> </forms> </authentication> <sessionstate mode="inproc" cookieless="false" timeout="2"/> </system.web> but when try load page after few minutes, i'm getting error due session variable not being present - shouldn't go login page if try anything? any deas? thanks,

c# - (wpf) Application.Current.Resources vs FindResource -

Image
so, i'm making gui thingy wpf in c#. looks this: it's not done right now. 2 rows attempt @ making sort of data table, , hard-coded in xaml. now, implementing add new fruit button functionality in c#. have following style in xaml governs background images of rows should like: <style x:key="stretchimage" targettype="{x:type image}"> <setter property="verticalalignment" value="stretch"/> <setter property="horizontalalignment" value="stretch"/> <setter property="stretch" value="fill"/> </style> so, in code, create image each column, col0 , col1 , , col2 , , if use following code, col0.style = (style)application.current.resources["stretchimage"]; col1.style = (style)application.current.resources["stretchimage"]; col2.style = (style)application.current.resources["stretchimage"]; it adds new row looks this: as can...

extjs - CSS of Tabs in a TabPanel -

Image
i have been messing past 2 hours find how change color of icons , respective 'label'. i want set white, i tried find scss variable, not. tried add css class various way, none worked. would have working exemple ? following css trick css .x-tabbar-dark .x-tab { color: #ffffff; } // here change style of active tab if need .x-tabbar-dark.x-docked-bottom .x-tab-active .x-button-icon { background-image: none; background-color: #ffffff; } .x-tabbar-dark.x-docked-bottom .x-tab .x-button-icon { background-image: none; background-color: #ffffff; } update app.scss // following 2 lines import default sencha touch theme. if building // new theme, remove them , add own css on top of base css (which // included in app.json file). @import 'sencha-touch/default'; @import 'sencha-touch/default/all'; // custom code goes here.. // examples of using icon mixin: // @include icon(...

image - Is it possible to change img src attribute using css? -

i'm trying change img src (not background img src) css <img id="btnup" src="img/btnup.png" alt="btnup"/> #btnup{ cursor:pointer; } #btnup:hover{ src:img/btnuphover; /* possible ? elegant way.*/ } no - css can used change css background images, not html content. in general ui elements (not content) should rendered using css backgrounds anyway. swapping classes can swap background images.

api - Is curl of php package included in xampp and guide to use appannie -

i have downloaded latest xampp , first time use curl. have account in appannie , have read 1 of posts here regarding his/her attempt access appannie. here link of post: appannie api basic authentication well, make simpler here code made: <?php $whmusername = "username"; $whmpassword = "password"; $query = "https://api.appannie.com/v1/accounts"; $ch = curl_init(); // sets url curl open curl_setopt($ch, curlopt_url, $query); // here's http auth // 3rd argument twitter username , password joined colon curl_setopt($ch, curlopt_userpwd, $whmusername.":".$whmpassword); // makes curl_exec() return server response curl_setopt($ch, curlopt_returntransfer, true); // , here's result xml $response = curl_exec($ch); curl_close($ch); // inserted: echo 'hello'; print $response; // inserted: echo 'world'; ?> i tried use nothing happened. inserted echo (which have labeled in comment) both before , after response see i...

javascript - Background image Panorama -

i have question regarding scrolling of background image repeats self endlessly. problem having is starts off fast become slower , slower (stuttering etc.). here code: var panoramatimeoutid = null; var panoramaposition = null; $('.panorama-left').mousedown(function() { panoramatimeoutid = setinterval(function(){ panoramamove(8, 1) }, 50); }).bind('mouseup mouseleave', function() { clearinterval(panoramatimeoutid); }); $('.panorama-right').mousedown(function() { panoramatimeoutid = setinterval(function(){ panoramamove(8, 2) }, 50); }).bind('mouseup mouseleave', function() { clearinterval(panoramatimeoutid); }); function panoramamove(amount, direction) { var panorama = document.getelementsbyclassname('panorama_foto')[0]; if(panoramaposition == null) { panoramaposition = panorama.style.backgroundposition; panoramaposition = parseint(panoramaposition[0].replace("px...

javascript - JS plugins conflict -

how can 2 js plugins in same file without conflicting eachothers? problem when add google maps plugin accordions stop working. ideas? please find complete code here: http://jsfiddle.net/bbdsh/ thank you! /*----------------------------------------------- c c o r d o n s ------------------------------------------------*/ $(document).ready(function() { var cur_stus; //close on default $('.accordion .accordion-content').hide(); $('.accordion .accordion-title').attr('stus', ''); $('.accordion .accordion-title').click(function(){ cur_stus = $(this).attr('stus'); if(cur_stus != "active") { //reset everthing - content , attribute $('.accordion .accordion-content').slideup(); $('.accordion .accordion-title').attr('stus', '').removeclass('active...

java - How to cut/copy text in JPasswordField as char array? -

how cut/copy password in jpasswordfield clipboard using non-string api . thereby closing window hacker see password. according link https://stackoverflow.com/a/8885343/2534090 char array different text. public static void main(string[] args) { object pw = "password"; system.out.println("string: " + pw); pw = "password".tochararray(); system.out.println("array: " + pw); } prints: string: password array: [c@5829428e what want in clipboard [c@5829428e not password i tried using stringselection copy contents in clipboard it's constructor takes string immutable , not safe. you can use custom transferhandler this. according section swing tutorial on using , creating data flavor should able use char[] object written clipboard. however, couldn't working , ended writing stringbuilder clipboard. commented out code attempted use char[], maybe else can figure out did wrong. import java.awt.*; imp...

r - ggplot, plot subset of data, ERROR -

i have seemingly simple question nonetheless have not been able solve. plot subset of data.frame in ggplot , keep getting error. here code works (with full data set): ggplot(a2.25, aes(x=v1, y=v2)) + geom_point() + theme(plot.margin = unit(c(0,0,0,0), "lines"), plot.background = element_blank(), axis.title.y = element_blank(), axis.title.x = element_blank()) + ggtitle("a2_25") but when try plot subset of data via: ggplot(a2.25, aes(x=v1[2:24], y=v2[2:24])) + geom_point() + theme(plot.margin = unit(c(0,0,0,0), "lines"), plot.background = element_blank(), axis.title.y = element_blank(), axis.title.x = element_blank()) + ggtitle("a2_25") i following error message: "error in data.frame(x = c(0.04, 0.08, 0.12, 0.16, 0.2, 0.24, 0.28, 0.32, : arguments imply differing number of rows: 23, 26" however, file composed of 26 obs. of 2 variables. when examine length of each co...

c++ - How to convert custom object to QVariant -

i have class called segment contains few qstrings , meant subclassed. i created std::list of segment objects , convert list qvariantlist. begins converting individual segment objects qvariant objects, how can accomplish this? i think you're looking q_declare_metatype(segment);.

php - Unable to action controller method through ajax -

i'm trying send data controller controller pass model. when hit submit button (with fields filled in) success response fires confirmation dropdown brand/save_new_brand() method doesn't fire. have print_r($_post); die(); sure still nothing. the path in request correct , same barring method call redirect on success should fine there. here's have... $.ajax({ url: "<?=sbase_url()?>admin/brands/save_new_brand", global: true, type: "post", data: ({ <?php foreach($languages $lang): if($lang['language_status'] == 'show'): echo "'brand_name_" . $lang['language_id'] . "' : $('#brand_name_" . $lang['language_id'] ."').val(),"; echo "'description_" . $lang['language_id...

javascript - Native tick sound on button clicks with PhoneGap -

i'm handling touchstart , touchend events determine when element clicked. works , responsive, i'm missing default click sound happens in native apps when press button. is there way trigger sound phonegap rather using html5 audio? take @ media class. http://docs.phonegap.com/en/2.9.0/cordova_media_media.md.html#media

Php machine-learning library? -

i studying on machine learning project , want php on web. possible , if is, have suggestion library or ideas? if not , continue project on java weka tool. here's one, haven't tried though, https://github.com/gburtini/learning-library-for-php i don't think there many machine learning libs built using php, in college built expert system using java jess: http://en.wikipedia.org/wiki/jess_(programming_language) hope helps :)

Parsing a .conf file with single function call in c -

is there elegant way of parsing .conf file in c program? say, if have normal text file - param1 = 22 param2 = 99 param34 = 11 param11 = 15 ... it'd nice access in 1 function call, smth like: int c = xfunction(my.conf, param34); and c = 11. many in advance. it better if use linked list follow struct node { char *key; int value; }; and assign key value pair node , can add many node during parsing of conf file linked list . later when search can traverse linked list , check key simple strcmp() , value.

asp.net - Use existing Single Sign-On solution for Active Directory too -

we have client using sso us, post saml assertions 1 of our .aspx pages, decodes assertion , authenticates user. have been asked second customer user sso well, use active directory federation services. having read through documentation, can't figure out how use existing solution ad customers too, don't seem send saml assertions, "claims", @ moment i'm not sure difference between , saml assertion is. shed light on this? if need write new aspx page new ad customer, starting points both ends (customer , our application)? claims saml assertions. adfs returns saml token including assertions (claims) , signature. if have identity provider , want integrate adfs, either federate adfs identity provider (so adfs allows users select authentication source) or vice versa.

node.js - mongodb gridfs encoding picture base64 -

i try readout image, saved in mongodb, via gridfs (without temporary file) should directly sent ajax, injects html when use actual functions large bit string formed , sent client (is saved in ajax response var) but reaches client, bits arent correct anymore so way encode picture before sent (into base64) (or there other way?) serverside - javascript, gridfs exports.readfilefromdb = function(req, res, profile, filename, callback){ console.log('find data profile ' + json.stringify(profile)); var gridreader = new gridstore(db, filename,"r"); gridreader.open(function(err, gs) { var streamfile = gs.stream(true); streamfile.on("end", function(){ }); // pipe out data streamfile.pipe(res); gridreader.close(function(err, result) { }); clientside - javascript ajax call: function imgupload(){ var thumb = $("#previewpic"); $('#uploadform').ajaxsubmit({ ...

python - Change matplotlib Button color when pressed -

i'm running animation using matplotlib's funcanimation display data (live) microprocessor. i'm using buttons send commands processor , color of button change after being clicked, can't find in matplotlib.widgets.button documentation (yet) achieves this. class command: def motor(self, event): serial['serial'].write(' ') plt.draw() write = command() bmotor = button(axmotor, 'motor', color = '0.85', hovercolor = 'g') bmotor.on_clicked(write.motor) #change button color here just set button.color . e.g. import matplotlib.pyplot plt matplotlib.widgets import button import itertools fig, ax = plt.subplots() button = button(ax, 'click me!') colors = itertools.cycle(['red', 'green', 'blue']) def change_color(event): button.color = next(colors) # if want button's color change it's clicked, you'll # need set hovercolor, well, mouse still...

java - Inner class with main method doesn't compile -

abstract class manager { static void test() { system.out.println(12); } class manager1 { public static void main(string args[]) { system.out.println(manager.test()); } } } it's producing compile time error. can abstract class have static method void type? non-static inner classes cannot have static methods - top-level , static classes can (as per jls §8.1.3 ). furthermore: system.out.println(manager.test()); manager.test() void: can't print that.

vb.net - Passing variables between windows forms in VS 2010 -

i have 2 forms. form 1 allows user pick employee dropdown combo box. employee passed onto form 2 user enters additional information regarding employee. data passed sql table. on form 1 have: dim changejobinfo new form2(employee) changejobinfo.show() on form 2 have: public sub new(byval employee string) msgbox(employee) end sub the variable passes fine. issue nothing shows on new form. when setup form2, added combobox, date picker, 2 text boxes, submit button, etc., when form loads blank. no errors, msgbox returns right result, none of gui elements show up. if change code on form 1 form2.show() see form laid out in designer. any ideas on how items show up? change code in form2.vb new sub this: public sub new(byval employee string) ' call required designer. initializecomponent() ' add initialization after initializecomponent() call. msgbox(employee) end sub if don't call initializecomponent() , complete gui not going render. ...

vb.net - WriteStartElement using an Array value -

i have created xml document using visual basic in visual studio 2010. seems not letting me use array values when write start element. arrayvalue = array(ubound(array)) dim xw xmlwriter = xmlwriter.create("xmlfile.xml", xws) xw.writestartdocument() xw.writestartelement(arrayvalue) xw.writeendelement() xw.writeenddocument() xw.flush() xw.close() wont let me gives me error , nothing. "a first chance exception of type 'system.argumentexception' occurred in system.xml.dll" whats going on? you try using xmltextwriter. arrayvalue = array(ubound(array)) dim xwriter new xml.xmltextwriter("c:\users\admin\desktop\mytest.xml", system.text.encoding.utf8) xwriter.formatting = formatting.indented xwriter.indentation = 2 xwriter.writestartdocument(true) xwriter.writestartelement(arrayvalue) xwriter.writeendelement() xwriter.flush() xwriter.close()

Select Next Not Same Data Row in SAS -

i have table 2 columns. wanted select row "less" previous one. eg. a | b 2 | 1 2 | 2 2 | 4 2 | 8 2 | 9 3 | 12 3 | 14 1 | 16 i want select row "1" in a since it's less previous 3. can making new column looking inplace. data want; set have; notsorted; if first.a flag=ifn(a lt lag(a),1,0); *ifn allows lag work here - excel style if; run; that identify rows first row in set, , have value of less previous value of a. can filter want flag=1 .

android - Cancel animation, stop applyTransformation running -

i've created extension animation class in order create background fade out animation. start animation after pressing listview row item. if press 1 after want cancel first animation , start second. bug i'm having when press fast 1 row after animation doesn't stop. after debugging i've noticed applytransformation method keeps running first animation. i've decided override cancel function, how stop transformation? public backgroundanimation(view view, int color){ this.view = view; setduration(4000l); red = color.red(color); blue = color.blue(color); green = color.green(color); } @override public void applytransformation(float interpolatedtime,transformation t){ //super.applytransformation(interpolatedtime, t); view.setbackgroundcolor(color.argb((int) ((1 - interpolatedtime) * 255), red, green, blue)); } i had exact same problem, interpolatedtime run 0 -> 1 infinitely repeat 0. solution clearanimation in animationlist...

user - rails tutorial: cookie doesn't match remember token -

i doing michael hartl's rails tutorial chapter 8. when try find user remember_token stored in browser cookie isn't working. find_by method returns nil. have been trying debug looking @ remember token cookie stored on browser , comparing remember token stored in user database. don't match , don't know why. here code session helper. module sessionshelper def sign_in(user) remember_token = user.new_remember_token cookies.permanent[:remember_token] = remember_token user.update_attribute(:remember_token, user.encrypt(remember_token)) self.current_user = user end def signed_in? !current_user.nil? end def current_user=(user) @current_user = user end def current_user #remember_token = user.encrypt(cookies[:remember_token]) remember_token = "71e45660fbaa69bad9fb55b912f80122a584f6af" #@current_user ||= user.find_by(remember_token: remember_token) @current_user ||= user.find_by_remember_token(remember_token)...

java - What is the best practice on socket programming -- do I do a close every time or leave it open? -

i haven't found clear answer on one. i have client/server application in java 7. server , client on seperate computers. client has short (1 line of 10 characters) command issue server , server responds (120 character string). repeated every x seconds--where x rate in configuration file. short 1 second integer.max_value seconds. every time i've created client/server application, philosophy has been create connection, business, close connection , whatever else data. seems way things should done--especially when using try resources programming. what hiccups leaving socket connection hanging out there x seconds? best practice close down , restart or better practice socket remain connected , send command every x seconds? i think answer depends bit on number of clients expect have. if never have many client connections open, i'd leave connection open , call good, if latency issue - on lans, i've seen connections take several milliseconds initialize....

java - Maven dependency plugin not supported by maven -

im trying download spring/java code book run code , test unfortunately errors, i see common error don't see fix pom file, pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <parent> <groupid>com.apress.springrecipes</groupid> <artifactid>core</artifactid> <version>1.0-snapshot</version> </parent> <artifactid>springintro</artifactid> <name>introduction spring</name> <dependencies> <dependency> <groupid>commons-lang</groupid> <artifactid>commons-lang</artifactid> </dependency> <dependency> <groupid...

Share my google drive data using a website in asp.net -

i have files , folders in google drive.and have website. want show google drive content in 1 page of website.any body can view data. i tried since morning.using javascript did that.but in case show data when login using google account.but other machine or out sign in using account it's not show data.i checked firebug it's giving error login required. can 1 me solve problem.i using asp.net . in advance. share folder public internet, use api key query files under folder api key. gapi.client.setapikey(api_key_here); gapi.client.drive.files.get({ 'q': '"<publicfoldersid>" in parents' }).execute(callback); obtain api key api console generating key browsers [1]. note: i'm using javascript client library, available on [2]. [1] https://developers.google.com/console/help/#generatingdevkeys [2] https://developers.google.com/api-client-library/javascript/

External Javascript file not loading -

i have external third party js file doesn't load in ie 9 or 8. when viewing network tab in developer tools, shows result of aborted. details listed as: download initiated tokenization of 'src' attribute of 'script' element and this download occurred speculative download during html preparsing. i've searched high , low these terms very few results. i've tried adding script dynamically , changing it's location in layout file, nothing allows file load. this problem doesn't occur in other browsers, , i've opened security settings on ie hoping browser setting. any insight or solutions appreciated. edits: no cannot see source code. while script listed in dropdown of scripts, doesn't display code in developer tools. i've tried stripping out meta tags , doctype (using html 5), none have moved bar. script tag: (i'm not including url protect innocent.) <script src="https://www.internetbankingcompany...

parsing - XML parser error handling -

i appreciate this. basically, have php webpage, user chooses city name (by code) , sent script, finds city in database, gets xml file associated it, contains current weather, , displays it. works fine except when user selects code, not exist. happens message: warning: simplexmlelement::__construct() [simplexmlelement.--construct]: entity: line 1: parser error : start tag expected, '<' not found in ... the major problem is, stops loading, not user see this, also, rest of page including html , not loaded. what have sort of check, in case file not found has wrong structure, echoes message "error, city not found" , skips rest of script, loads rest of webpage, html etc. i found solutions on internet not able implement successfully. the code loads actual xml looks this: public function __construct($query, $units = 'imperial', $lang = 'en', $appid = ''){ $xml = new simplexmlelement(openweathermap::getrawdata($query, $units, $lang,...

Not sure how to parse this PHP/JSON object in Javascript/jQuery -

so understand, because created json object in php using json_encode , used echo display it, can access directly object in js, this .done(function(response) { var result = response; $(result).hide().prependto('#messages').fadein('slow'); });` however, how access data within object? object contains error either true or false, , error_message while contains errors formatted <li>error</li> php returns - {"error":true,"error_messages":" <li>name short (minimum of 4 characters)<\/li> <li>name short (minimum of 4 characters)<\/li>"} if server returns correct content-type header ( application/json ), jquery parse response , give object, can use this: console.log(response.error_messages); // "<li>name short... if server not return correct content-type header, can force issue supplying datatype: "json" in $.ajax call. either way, json you've quote...

parsing - Parse very long date format to DateTime in C# -

how parse following string date datetime object in c#: "thursday, 1st january 1970" this coming xml feed , datetime.parse doesnt seem in en-gb locale. feed ever come british server i'm not worried globalization issues my initial brute force approach to: delete , including comma, , trailing space leave "1st january 1970" then remove "st", "nd", "rd" or "th" appropriate leave "1 january 1970" then convert month numeric equivalent leaving "1 1 1970" then replace spaces "/" "1/1/1970" im sure there must far more elegant way though? couldnt datetime.prse or datetime.parseexact work just provide different take on this, , give idea of other options have; can specify format datetime.parse (or tryparse in example) account circumstances this, without trying 'pre format' string else string.replace calls , like; public datetime parseordinaldatetime(string d...

can't loop video using 'ended' event listener with video.js -

i trying video loop using video.js. on android @ least, 'loop' tag doesn't work. found posts online said listen 'ended' event , use set currenttime , play again. but doesn't work me. seems 'ended' function not ever called. sound familiar anyone? thanks oop found this: ended event videojs not working those holes should update fancy-looking api documentation! http://www.videojs.com/docs/api/ now 'ended' function being called -- stupid video still doesn't loop? ideas? here function: var myfunc = function() { var myplayer = this; console.log('ended current time = '+myplayer.currenttime()); console.log(' duration: '+myplayer.duration()); myplayer.currenttime(0); myplayer.play(); }; myplayer.on('ended',myfunc); it reports current time being 0 when ended function called. doesn...

javascript - Memory leak in Firefox with jQuery, AJAX, and HTML5 canvas -

i'm polling server using jquery's ajax function , using data update canvas. poll server once each second (this not done using setinterval(), in case you're wondering... did hear source of these issues. canvas animated, , keep track of frame rate. use data figure out when second has elapsed). isn't issue in chrome, in firefox , maxthon cloud (and much lesser degree opera), performance gradually grows worse , worse. think it's ajax calls, , have no idea how fix issue. here "callserver()" function, if that's of use. thanks! function callserver(action, json) { if(!json) { $.ajax({ type: 'post', url: 'okey.php.', data: 'action=' + action, cache: false, success: function(data) { switch(action) { case 'ptv': tilesvalue = data; bre...