Posts

Showing posts from February, 2013

Android Fragment initialization to various Custom Fragments, but only One at a time -

i trying initialize generic fragment in such manner can used globally no matter instance of is. example: public mainactivity extends activity{ private fragment fragment; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_first_layout); fragmentmanager fragmanager = getfragmentmanager(); fragmenttransaction transaction = fragmanager.begintransaction(); if(condition1){ fragment = new myfirstfragment(); transaction .add(r.id.registrationfragment, fragment); //registrationfragment framelayout transaction.commit(); }else if(condition2){ fragment = new mysecondfragment(); transaction .add(r.id.registrationfragment, fragment); //registrationfragment framelayout transaction.commit(); } //create intent filter //create mybroadca...

sql - How do I exclude top and bottom 5% of annual salary on 18 million records in TSQL, then use the seleced data to calculate average -

i have 18 million rows in column (income), , exclude top & bottom 5% of income calculate more accurate average on income. you didn't provide data structure, grouping , on. proof of concept. calculate percent_rank() , narrow data, calculate average. sqlfiddledemo /* preparing data */ create table tab(id int identity(1,1), income int) ;with nums(number) (select 1 number union select number+1 nums number<100 /* warn here recursive cte */ ) insert tab(income) select number nums; /* main query */ cte(id, income, [percent]) ( select id ,income ,[percent] = percent_rank() over(order income) tab ) select [average_income] = avg(income) cte [percent] > 0.05 , [percent] < 0.95

Bootstrap Modals and .net C# server response -

i working on web application, using .net mvc c#. have bootstrap modal form. after doing post: how can server response same modal, example validate errors using .net validator messages. ? you can use jquery validate on modals same way use on part of dom. remember use @html.editorfor(...) or similar razor methods , link jqueryval javascript with: @section scripts { @scripts.render("~/bundles/jqueryval") } and in bundleconfig: bundles.add(new scriptbundle("~/bundles/jqueryval").include("~/scripts/jquery.validate*"));

Halide internal error issue -

here's code. i'm using halide on vs2013, win64 trunk of aug 5, 2015. when execute diag.compile_to_lowered_stmt("diag.html", {}, html) (with 16mb stack), following error message: "internal error @ e:\code\halide\src\ir.cpp:160 condition failed: a.type() == b.type() lt of mismatched types" i have confirmed error occurs because of line: diag(x, y, c) = select(m135(x, y) > m45(x, y), f45(x, y, c), select(m45(x, y) > m135(x, y), f135(x, y, c), f4x4(x, y, c))); the way i've been able remove error remove both selects (the function unusable in case, of course.) i've tried converting condition expr, , i've checked types of m45 , m135 (by assigning them expr t1, , looking @ t1.type().) note changing ">" "<" or ">=" not change error message "lt". any ideas? code still same previous post: image<uint8_t> orig_uint = tools::load_image("../foo.ppm"); var x, y, c; func orig...

django - Getting Posts and its last comment in a single queryset -

let's assume i've classic blog post multiple related comment s model. i'm trying list of posts each annotated last comment (or @ least single field it). the closest i've gotten via: post.objects.annotate(last_comment=f('comment__text')) but returns body first commend, , explicitly want last. am missing pretty obvious? or there smart way of doing i'm failing see? if want retrieve latest comment, might want specify ordering on meta something this: class comment(models.model): ... class meta: ordering = ('-created_at', ) #or id, or whatever then, query post.objects.annotate(last_comment=f('comment__text')) would retrieve latest post. specifying ordering (in case) equivalent of saying comments.objects.order_by('-created_at') , , work, want latest comment. one caveat here though is, ordering applied default everywhere comments retrieved. also, has database implications ordering not free ...

html - Why is javaScript only working after page refresh? -

i can't seem figure out why code working after second page refresh. var arr = $.makearray() $('#content-height div').each(function(){ arr.push($(this).outerheight()); }); $('#content-height .excerpt').css('height', math.max.apply( math, arr )); inside #content-height 2 divs populated dynamic content height of divs inside vary.. so retrieved height of both contents inside #content-height , used include style in 1 of 2 divs height of content-height both inside divs.. the thing doesn't find height @ first page load.. refresh page once again corrects everything, i'm not sure why is.. question: why javascript code above loading after refreshing loaded page? (load url first -> not full height, refresh page -> gets height of biggest div , applies smallest) <div id="content-height" class="entry-content kd-recipe-content"> <div class="excerpt"> {{ article.excerpt }} <div cla...

java - How to change font on css? -

i'm trying manipulate font in agenda jfxtras (javafx). i have css file linked it. i figured out how make black , bold well. .agendatext { -fx-text-fill: black; -fx-font-weight: bold; } but don't know how change font say, arial. thanks, browser try take first font, second font , if wont able find it serve sans serif system font .agendatext { font-family: arial, helvetica, sans-serif }

ios - NSURLSession in For Loop to Download Image Data then add to NSMutableArray -

my application has uitableview cell contains uicollectionview subview (not reused). collectionview's cells have single uiimageview hold picture. trying download of images @ once, store them in array, , display contents of array in collectionview cell once images downloaded . in objc have done many times using nsurlconnection trying use swift , nsurlconnection achieve i'm running believe may either concurrency or semantics issues. maybe 1 of guys point me in right direction because feel i'm spending time on this. in uitableview's cell subclass contains collectionview calling func downloadphotoswithurls(urls: [string]) { var imagesmutablearray = nsmutablearray() url in urls { nsurlsession.sharedsession().datataskwithurl(nsurl(string: url)!, completionhandler: { (data, repsonse, err) -> void in if let imgdata = data { if let image = uiimage(data: imgdata) { imagesmutablearray.addobject(image...

activerecord - Changing enum value in Rails without saving model -

how change enum value without saving model database yet? the documentation activerecord::enum indicates methods conversation.active! , conversation.status = "archived" equivalent doing conversation.update! status: 1 , whereas i'm getting attributes simple_form form, , don't want save model until of attributes have been set, otherwise model won't valid. the bang version of method - conversation.active! save database immediately. the other way - conversation.status = "archived" not, , require explicit conversation.save! afterwards. so, that's method you're after. (btw, rails console handy testing stuff this, , show exact sql gets executed bang version of method, execute it)

Different themes for different classes in eclipse -

i have spent literally hours looking question , have failed find please me. i want able have different themes different classes in eclipse. may seem vague let me give example. in normal java code love moonrise theme background , dark , code light; easier on eyes. started using opengl 3.2 glsl in code , noticed default font dark , hard see! after lot of searching closest thing find changing text colors of specific things in glsl. nice! however, me being color oriented person love if .glsl files or .fsh .vsh etc in different theme. example: .java moonrise while .glsl classic (white background). if know of or way please me out because feel if have looked everywhere! **update have searched combined of 5 hours week without single hint of how accomplish

docker - How to Host Ghost Blog on Home Web Server -

i running ghost blog inside docker container inside virtual machine running ubuntu snappy core os. virtual machine running on home server, c720 chromebook cracked run lubuntu on bare-metal. i can see blog @ localhost:2368 not know how make accessible outside world? port forwarding router c720, , have verified can host blog native os. trying running inside virtual machine. make vm run in bridge mode , pick address home router. expose port on container this: docker run -ti -p 2368:2368 ghost then able access ghost web site using bridged ip address http://<bridged-ip>:2368

regex - Why are these two urls redirecting to the same page? -

i using rewriterule ^(.*)/?$ index.php?page=a&i=$1 rewriterule ^b/(.*)/?$ index.php?page=b&i=$1 to redirect urls of form mysite/something index.php?page=a&i=something , mysite/b/something index.php?page=b&i=something . however, both urls redirecting index.php?page=a&i=something . why happening? ^[^\/]+\/([^\/]+)$ index.php?page=a&i=$1 ^[^\/]+\/b\/([^\/]+)$ index.php?page=b&i=$1

objective c - what is the meaning of + symbol in iOS file naming? -

Image
this question has answer here: class name “+” 2 answers i have seen examples of ios project, little confused naming rule of file. meaning of + symbol in ios naming rule? in case should use symbol. and mean put draggle within (). hopefully can help. thank much. those categories see here: https://developer.apple.com/library/ios/documentation/cocoa/conceptual/programmingwithobjectivec/customizingexistingclasses/customizingexistingclasses.html the "draggable" category of uicollectionview here's snippent apple: if need add method existing class, perhaps add functionality make easier in own application, easiest way use category. the syntax declare category uses @interface keyword, standard objective-c class description, not indicate inheritance subclass. instead, specifies name of category in parentheses, this: @...

html - JavaScript cookie error -

today trying learn how use cookies, , going pretty well, until tried make cookie save total amount of seconds have been on page, including previous visits. instead of counting 1, 2, 3, counted 1, 11, 111, 1111. here code: <!doctype html> <html> <head> <script> function setcookie(cname,cvalue,exdays) { var d = new date(); d.settime(d.gettime() + (exdays*24*60*60*1000)); var expires = "expires=" + d.togmtstring(); document.cookie = cname+"="+cvalue+"; "+expires; } function getcookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i]; while (c.charat(0)==' ') c = c.substring(1); if (c.indexof(name) == 0) { return c.substring(name.length, c.length); } } return ""; } var value = getcookie('value'); window.setinterval(function(){ valu...

UI design suggestions in android -

i developing android app material design has 2 tab views. each tab contains data arranged categories. i want show categories in left side navigation drawer.on selection of category update list in tab. whenever tab charged change categories in drawer. fine according android ui specifications? i dont know of restrictions regarding design choice. go it!

c# - How to remove FixedPage from FixedDocument? -

i using documentviewer display fixeddocument user before allowing user print or save document. have edited documentviewer panel have checkbox allows user select if want chart in document or not. i able event of checkbox being checked , value cannot figure out way remove chart fixeddocument , not leave blank page @ end. have on checkbox click hide , show chart again leaves blank page. if (value) barchart.visibility = visibility.visible; else barchart.visibility = visibility.collapsed; i have tried rebuilding fixeddocument on checkbox event , use checkbox value decide whether or not include graph page. document renders fine first time, after unchecking checkbox chart page disappears, when rechecking checkbox graph page shows graph has no data (series missing). any ideas? could problem data binding of chart or issue fixeddocument? note: building chart in code behind , adding so: // add other pages reportdocument here if (includegraphpage) { // add graph page ...

bash - Loop for change the column - how not mistake $ of column with $i -

i make loop change columns in awk condition. however, $ symbol making mistake replacement "i". idea how fix it? #!/bin/bash in {2..5} awk '$$i>=10 && $$i<=20' permut1.txt >> out.txt done input: abc 1 1 2 3 4 bbb 0 1 2 0 1 ccc 1 1 0 2 2 ddd 0 1 3 1 3 fff 15 15 4 15 15 ggg 15 15 15 15 15 i want output: ggg 15 15 15 15 15 in awk, $ prefix operator argument must non-negative integer. that's quite different meaning of $ in bash. the easiest way pass variable bash awk use -v var=value command line option in awk command: awk -v field=2 '$field >= 10 && $field <= 20' permut1.txt the above print lines second field between 10 , 20. iterate in bash multiple scans of data, each 1 scanning different column: for in 2 3 4; awk -v field=$i '$field >= 10 && $field <= 20' permut1.txt done but suspect trying iterate in awk on fields, , print lines satisfy 3 tests. again, fact awk $ ...

recursive array for duplicate shell programs -

it appears have done before cant recollect @ right moment. want run 3 instances of same script feeding off of single array traversing dates. in 1..10 bash a.sh $i bash a.sh $i done. i want a.sh grab 1 first script , 2 second 1 , if 1 finishes run grab 3 , 4 etc. 2 identical scrpts working on looping through dates any appreciated.

elasticsearch - Practical usage of keyword analyzer -

what scenario when need use mapping of keyword-analyzer compared marking not_analyzed doc values turned on field. from elasticsearch documentation, seems if field not analyzed , better turn doc_values on field. the elasticsearch documentation states [sic] note, when using mapping definitions, might make more sense mark field not_analyzed i bit confused why keyword analyzer ever used ? according core committer, both equivalent . that wouldn't case of keyword tokenizer , though, can combined other filters (lowercase, etc) , participate in many different ways of tokenizing input.

timer - infinite loop vs boost::asio::deadline_timer C++ performance -

i develop server application handles many connections clients. server sends message each clients periodically(ex: every 1 second), check client's expiry times(each client must disconnected server forcibly when connected time reaches predetermined value) , other timer tasks. consider 2 solutions: use while(true){foreach clients{check time}} for each client, delcare deadline_timer , call async_wait each task, spawn lot of deadline_timer instances which solution better performance? in general, should use infinite loop or declaring many timer instances? , 1 more, can explain how os manages deadline_timer? q. solution better performance? infinite loops bad. exceptions found in cpu-saturating workers thread affinity (but doesn't appear applicable here). q. in general, should use infinite loop no q. or declaring many timer instances? or std::vector<boost::shared_ptr<asio::deadline_timer> > m_timers; or similar :) q. , ...

html - Asp.net Button click inside Jquery Modal popup -

in asp.net application have used modal pop using jquery. inside pop window have asp.net button. in need write server side code inserting data database. when click on button modal pop getting closed. want keep modal pop open when click on button. below html code, <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> </div> <div class="modal-body"> <div class="row route-for-reg"> <div class="routes-container"> <div class="row padding-tb-10"> <div class="col-md-4 col-lg-3"> <asp:dropd...

angularjs - using angular-ui-router with express/node, file structure -

i following this tutorial, , have app structure this. i've tried show relevant bits sort of lot of code. /app /views index.ejs /config express.js /public /external_libs angular.js angular-ui-router.js /js app.js controllers.js /partials home.html server.js inside express.js (relevant bit) app.use(express.static('./public'); i able set angular controllers, know directory being hit. example, index.ejs <html ng-app="myapp"> <head> <script src="external_libs/angular.js"></script> <script src="external_libs/angular-ui-router.js"></script> <script src="js/app.js"></script> <script src="js/controllers.js"</script> </head> <body ng-controller= "mainctrl"> <!-- alert in controller fires, know public directory accessible, @ least...

javascript - Nodejs Q promise catch never called with passport js -

i'm using passport library node assist me in user signup. i'm using 'q' promise library avoid pyramid of doom go through several asynchronous steps. everything works fine, until throw error 1 of promised steps. have assumed execution drop .fail function, handle error , return out of passport failed signup. reason don't understand, .fail function never gets called. instead, stackdump in browser window , in console. the controlling code here: q.fcall(checkemailisfree({'email':email, 'username':username, 'password':password})) .then(checkusernameisfree) .then(registeruser) .then(function (user) { if (user) { logdebug('registered: ' + email); return done(null, user); } else { logdebug('could not register'); return done(null, false); } }) .fail(function (err) { logerror('i never here'); return done(null, false); }) .done(); and here's how i'm throwing, within checkemailisfre...

java - Blank not detecting in XSSFWorksheet code -

i converting xlsx csv , uploading data db using below code, import java.io.*; import java.sql.connection; import java.sql.sqlexception; import java.sql.statement; import java.util.iterator; import org.apache.poi.ss.usermodel.cell; import org.apache.poi.ss.usermodel.row; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssfworkbook; public class xlstocsvconvert { static connectivity conv; static connection con = null; static statement st = null; static string query=null; static void xlsx(file inputfile, file outputfile) { // storing data csv files stringbuffer data = new stringbuffer(); try { fileoutputstream fos = new fileoutputstream(outputfile); // workbook object xlsx file system.out.println("working......"); xssfworkbook wbook = new xssfworkbook(new fileinputstream(inputfile)); // first sheet...

paypal - Steps to create escrow payment integration in android source code -

i want integrate escrow payment integration in our e-commerce android application. please tell me steps create escrow account integration in android application. integrate paytym this.. random randomgenerator = new random(); randomint = randomgenerator.nextint(1000); //for testing environment service = paytmpgservice.getstagingservice(); paytmmerchant merchant = new paytmmerchant("https://pguat.paytm.com/merchant-chksum/checksumgenerator","https://pguat.paytm.com/merchant-chksum/validatechksum"); log.e("value","value"); map<string, string> parammap = new hashmap<string, string>(); //these mandatory parameters parammap.put("request_type", "default"); parammap.put("order_id", string.valueof(randomint)); //mid provided paytm parammap.put("mid", "id provided paytm"); parammap.put("cust_id", "cust123"); parammap.put("ch...

python - Collect calls and save them to csv -

is possible if have list of url parse them in python , take server calls key/values without need open browser manually , save them local file? the library found csv pandas first part. example perfect me. you can investigate use of 1 of built in or available libraries let python perform browser operations , record results, filter them , use built in csv library output results. you need 1 of lower level libraries: urllib/urllib2/urllib3 and may need override, 1 or more, of methods record transaction data looking for.

How to classify times as In and Out for multiple timestamps in a work day in SQL Server -

i have table keeps times of entrance , exit of employee taken fingerprint machine. employees can have many fingerprints same entrance and/or exit within period of time (ex. 3 minutes) let's call a. employees in 2 cases if want make sure machine got fingerprints. , if there many fingerprints machines in company, 1 near main gate second near offices. employees can exit , return many times day may requested so, within period of time must have stayed @ company in order calculated work time , determine next fingerprint exit.(for example 20 minutes ) let's call b the problem: in process of determining entrance , exit times out of records inserted database there 2 regards: if fingerprint entrance should select minimum time within , after b has reached consider next fingerprints exit, selecting maximum time this whole days of month. note work day starts 08:00am , ends in next day @ 07:59am, let's call c. example emp_id edate etime 100 01/01/20...

javascript - How to get specific span's value from div in JQuery -

i have div , want text of specific span div. following div code: '<div class="dvdynamic_' + pid + '"><p hidden="true">'+pid+'</p><span class="count_' + pid + '">' + count + '</span><span id="pname" style = "margin-left:70px;">' + pname + '</span><span id="punitprice" style = "margin-left:150px;">' + uprice + '</span></div>' and want text of following span: <span class="count_' + pid + '">' + count + '</span> please me how . the span element want target have next sibling id. can target element using id selector , traverse required span using .prev() : $('#pname').prev().text()

java - How to open Microsoft Acesss MDB file in centos6? -

i using centos6. how open mdb file microsoft access? in case need see tables , data in file. if in fact asking how open access database java application should have at manipulating access database java without odbc if want open database in gui @ tables libreoffice base (or openoffice base) described in is possible open access 2010 database file without using wine or virtualbox?

php - Need to place variable into dynamic URI -

i need place variable $thecompany end of uri voiceuri on twilio. can see below i've managed create variable can't figure how put uri. when submit page voiceuri field in twilio www.ourdomain.com/.xml . the same true xml file i'm trying create saves $thecompany.xml the code below, appreciated! here's line i'm using populate voiceuri in twilio: 'voiceurl' => "http://www.ourdomain.com/$thecompany.xml", and here's line i'm using save xml file new name/ same name passed previous twilio $doc->save('"$thecompany".xml'); it's simple isn't normal game, i'm more on infusionsoft side of things code , web guy on honeymoon! appreciate assistance! --edit-- thanks answers far, unfortunately don't seem working. here's full code php xml creator: <?php session_start(); ?> <?php $thecompany = $_session['company']; $doc = new domdocument( ); $ele = $doc->createe...

javascript - Do html5 <video> tags perform at the same speed as <img> tags? -

i’m trying figure out if there negative outcomes using <video> tags display images (sometimes in carousel) instead of <img> tags. would best way start bench marking performances? <video> tag html tag <img>. performance of rendering both tag should same, matter on browser accessing this. if using <video> tag, make sure using proper code display video.

chat in android with service -

i want create chat application using service, here service should listen new messages, notifies user if new message arrives server , when user clicks on notification, shows complete message details. again if user wants send message, has send message user. here want start service once , run indefinitely, when activity starts it's starting service each time. consider server chat.socket.io please tell me how achieve solution. in advance :) if service loaded already, won't load again. intent delivered same service. don't have worry that. also, might want use google cloud messaging instead of making services chat notifications.

internet explorer - IE 11 CSS Inches NOT Working -

very simple, i've created report, , use printthis.js jquery plugin, works on browsers , platforms, except when send report via ie, css inch measurements, should inches regardless of browser, sudden 2/3 of normal size. browsers set letter size 8.5 x 11, page setups identical. on firefox, chrome, safari, 1 inch 1 inch. on ie, 1 inch .75in. i've searched on web, given ie has metric tons of problems associated css, results impossible isolate issue. i'm sure there answers out there, can't find them amid legacy issues pile of steaming browser. appreciate help. question: how make 1.0in in css 1.0in in ie printing?

android - how to get the action bar button? findviewbyid seems doesn't work -

suppose have 2 buttons, 1 action button in action bar(@+id/button1). , common button in layout(@+id/button2). how can set button1 disabled when click button2? findviewbyid(button1) seems not work. return null. this menu xml: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/button1" android:title="submit" android:showasaction="always" /> </menu> and mainacticity: @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.my, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if (id == r.id.button1 ) { return true; } return super.onoptionsitemselected(item); } @override protected void oncreate(bundle savedinstancestate) { ...

java - I can't log-in because I used aes_encrypt for my password field -

i'm practicing programming using java , mysql using netbeans ide. can log-in application using code below. if encrypt password using aes_encrypt feature of mysql, don't know how decrypt it. know there aes_decrypt had hard time syntax. private void btnloginactionperformed(java.awt.event.actionevent evt) { if(lblusername.gettext().length()==0) // checking empty field joptionpane.showmessagedialog(null, "empty fields detected ! please fill fields"); else if(password.getpassword().length==0) // checking empty field joptionpane.showmessagedialog(null, "empty fields detected ! please fill fields"); else{ string user = lblusername.gettext(); // collecting input char[] pass = password.getpassword(); string pwd = string.copyvalueof(pass); // converting array string if(validate_login(user,pwd)){ joptionpane.showmessagedialog(null, "correct...

How to set TextOptions for a TextBlock in code behind in c# WPF? -

i adding dynamically generated textblock in code behind in wpf. need set following properties textblock in code behind not able so: textoptions.textformattingmode="display" renderoptions.bitmapscalingmode='nearestneighbor" renderoptions.cleartypehint="enabled" i cannot find them in code behind or way so. can please suggest how these properties can set in code ? i looking same solution ... here :) in case set properties richtextbox richtxteditor.setvalue(textoptions.textrenderingmodeproperty, textrenderingmode.aliased) richtxteditor.setvalue(textoptions.textrenderingmodeproperty, textrenderingmode.auto) richtxteditor.setvalue(textoptions.textrenderingmodeproperty, textrenderingmode.cleartype) richtxteditor.setvalue(textoptions.textrenderingmodeproperty, textrenderingmode.grayscale) richtxteditor.setvalue(textoptions.textformattingmodeproperty, textformattingmode.display) richtxteditor.setvalue(textoptions.textformattingmodeproperty...

swing - How to get users input in a text adventure game (Java/Applet) -

import java.util.scanner; import javax.swing.jframe; import javax.swing.jtextarea; import javax.swing.windowconstants; class dd { public static void main(string[] args){ jframe myframe = new jframe("#########"); myframe.setsize(640,480); myframe.setdefaultcloseoperation(windowconstants.exit_on_close); myframe.setvisible(true); jtextarea textarea = new jtextarea(); myframe.add(textarea); new jtextarea(); textarea.seteditable(false); //system objects scanner in = new scanner(system.in); boolean running = true; textarea.append("\t\n########################################"); textarea.append("\t\n>#############"); textarea.append("\t\n>th#############11!"); textarea.append("\t\n>typ#############enture!"); textarea.append("\t\n########################################"); string input = in.nextline(); if(input.equals("start")){ ...

javascript - How to pass Special characters in URI -

i wanted send special characters in uri without encoding it. possible in firefox or chrome browser. example: http://www.exampple.com/?a=somespecialcharacters >; any idea? thank you without encoding: don't know , how browser interprets it. it's terrible users. characters / , & can make link aberrant. compare: http://foo.com/this/is/my/parameter vs. http://foo.com/this%2fis%2fmy%2fparameter

javascript - AngularJS/HTML - Cannot execute links to same page after introducing interceptor -

would check issue caused <a href> links when after introduced interceptor angular app , has cause links not reload when on same page? below how introduce interceptor add jwt's authentication token web service requests header. app.config(['$httpprovider', function ($httpprovider) { $httpprovider.interceptors.push(['$q', '$localstorage', '$location', function ($q, $localstorage, $location) { return { 'request': function (config) { config.headers = config.headers || {}; if ($localstorage.jwttoken) { config.headers.authorization = 'bearer ' + $localstorage.jwttoken; } return config; }, 'responseerror': function (response) { if (response.status === 401 || response.status === 403) { } return $q.reject(response); } }; }]); }]); not...

excel - How to sort values in column to match with another column VBA? -

list item hi i'm trying figure out how can sort column b in order values in matches of column , delete values in column b not in column a. i'd leave cells empty in column b when values not match of column a. can me codes please? thanks!!! a 132 43 345 35 654 84 26 54 635 b 132 43 24 345 67 35 84 26 79 54 if wish compare each row in column , b, open new column c , enter first line: =if(a1=b1,a1,””) drag down .this should fixed column b. can paste special values (instead of formulas) , erase true column b afterwards. if values unique each column , want make sure value in column found on column b no rows relation: open new c , enter on c1: =ifna(vlookup(a1,b:b,1,0),””) same goes here drag, paste , erase.

javascript - web audio API audiocontext close function is undefined in iOS 7 webview -

i have used audiocontext web audio api , wanted release resources used audiocontext. as per below tutorial have used close() release resources. audiocontext . in ios 7 says close function in undefined. audiocontext.close() relatively new addition webaudio. it's safari has not implemented yet.

java - How do you identify a user in Spring using more than just the username? -

i have spring application allows administrators manage several sub-sections of application, each sub-section having own users. sub-sections loaded depending on url that's being used access app. i've had pretty simple experience using spring security , setting pretty simple custom userdetailsservice, adding roles , granting authority users, etc. what i'd able have users allowed register under different sub-sections same username, , ideally instead of loaduserbyusername in userdetailsservice example, use more "loaduserbyusernameandsubsection". example user 'scott75' registered on subsection1.myapp.com , on subsection2.myapp.com. i'm not looking write solution me, point me in right direction in terms of classes in spring security this. or, alternatively, tell me i'm crazy , go way, building interface around adding/removing sub-section access to/from users, or adding/removing users sub-sections.

javascript - Client Side Routhing with Angular on Node.js & Express -

i'm using node & express on server side, , angular on client side. but can't implement angular client-side routing. angular router looks this: app.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/blogs', { templateurl: 'partials/blogs', controller: 'blogcontroller' }). when('/news', { templateurl: 'partials/news', controller: 'newscontroller' }). otherwise({redirectto: '/'}); }]); this server routes: app.use('/',routes.index); app.use('/partials/:filename',routes.partials); and index.js: exports.partials = function(req, res){ var filename = req.params.filename; if(!filename) return; res.render("partials/" + filename ); }; exports.index = function(req, res){ res.render('index'); }; but instead of presenting partials, index page every url what doing wrong? you have create ...

iOS: Why the animation runs well with CABasicAnimation but looks weird with animateWithDuration? -

Image
here's simple demo rotating image view animation. class viewcontroller: uiviewcontroller { @iboutlet weak var imageview: uiimageview! @ibaction func left() { animatewithtransform(catransform3dmakerotation(cgfloat(m_pi_4), 0, 0, 1)) } @ibaction func right() { animatewithtransform(catransform3dmakerotation(cgfloat(-m_pi_4), 0, 0, 1)) } func animatewithtransform(transform: catransform3d) { uiview.animatewithduration(1) { self.imageview.layer.transform = transform } } } the animation runs smoothly. update right() to: @ibaction func right() { animatewithtransform(catransform3dmakerotation(cgfloat(-m_pi_4), 0, 1, 0)) } tap left right, animation not smooth more. image view jumps angle before starting animation. why's that? update animatewithtransform() use cabasicanimation instead: func animatewithtransform(transform: catransform3d) { let animation = cabasicanimation(keypath: "tr...

How to get Concat comma separated value from mysql stored procedure or function? -

below table , stored procedure list of offdays comma separated value:- offdaystable offdayid |sundayoff| mondayoff|tuesdayoff|wensdayoff|thursdayoff| fridayoff| saturadyoff 1 1 1 1 0 0 0 0 create procedure getoffdays () begin declare offdays varchar(25); set offdays = ''; select offdays = case sundayoff when 1 '1' else '' end, offdays = case mondayoff when 1 case length(ltrim(rtrim(offdays))) when 0 '2' else concat(offdays,',' ,'2') end else offdays end ,offdays = case tuesdayoff when 1 case length(ltrim(rtrim(offdays))) when 0 '3' else concat(offdays,',' ,'3') end else offdays end ,offdays = case wednesdayoff when 1 case length(ltrim(rtrim(offdays))) when 0 '4' else concat(offdays,',' ,'4') end else offdays end ,offdays = case thursdayoff when 1 case length(ltrim(rtrim(offdays))) when 0 ...

php - Disable colors in code coverage output from PHPUnit -

i want automate testing little php project of mine, works far, thing not work code coverage report. in gitlab-ci there option test coverage parsing , accepts regex. far good, found regex @ http://jarretbyrne.com/2015/04/gitlab-ci-phpunit-test-coverage-parsing/ : ^\s*lines:\s*\d+.\d+\% but comment says: doesn't work colors enabled. phpunit has command line switch --colors-[always|never|auto] option applies normal output. how can turn off colors --coverage-text ? can use regex? edit: there open issue @ https://github.com/sebastianbergmann/phpunit/issues/1771 i'm running phpunit strip colors output: php vendor/phpunit/phpunit/phpunit --coverage-text | sed -r "s/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[mgk]//g"

How to subtract a percentage from a number in Javascript? -

here code subtracts 2 var. function calculate() { var mybox1 = document.getelementbyid('ax').value; var mybox2 = document.getelementbyid('by').value; var myresult = mybox1 * mybox2; var mybox3= document.getelementbyid('mybox3'); mybox.value = myresult ; } this take out percentage. function calculate() { var mybox1 = document.getelementbyid('ax').value; var mybox2 = document.getelementbyid('by').value; var myresult = mybox1 * mybox2; var mybox3= document.getelementbyid('mybox3'); var percentage = myresult/mybox3 -2%; mybox3.value = myresult ; } you have several problems in code, apart mixin between subtract , multiplication: in first function using mybox undefined should use mybox3 instead. and in second function, dividing number input type should replace myresult/mybox3-2 myresult/(...

phpunit - CakePHP Unit Testing with edit methods -

i wrote test testedit() . public function testedit() { $result = $this->_testaction('/articles/edit/1', array('return' => 'vars', 'method' => 'get')); debug($result); } why debug($result) show null array? use var_dump instead of debug public function testedit() { $result = $this->testaction('/articles/edit/1', array('return' => 'vars', 'method' => 'get')); var_dump($result); }

Automatically refresh listview on sqlite database change - Chat Application Android -

i building chat application response in broadcastreceiver. send data intentservice insert data sqlite database. refresh listview in fragment according database change automatically. list populated using cursoradapter. my code massageview fragment follows: public class messageview_fragment extends fragment { view rootview; listview lv; chatlistadapter chatadapter; arraylist<message_master> arr; matrixcursor cr; dbhelper db; static string rmob; actionmode actionmode; sharedpreferences prefs; simpledateformat sdf,sdf_old,sdf_today; framelayout attacher; boolean isbottom = true; @suppresslint("defaultlocale") @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub rootview = inflater.inflate(r.layout.fragment_message, container, false); getactivity().getwindow().setbackgrounddrawableresource(r.drawable.chat_back); rmob = getarguments().getstring("rmob...