Posts

Showing posts from July, 2014

twitter bootstrap - Responsive Background Image for body -

i design web page using bootstrap 3.3.7 . i want use image body responsive. when user change window size, size of image change. thanks you can try following on body. background-image:url('image.png'); background-repeat:no-repeat; background-size:contain; background-position:center; and not set height or width image.

Android get layout name where string is used -

is there way layout string used. example: "submit" string used in registration layout. how can know it? you've asked half question i'm making assumptions that talking in code , ide - not runtime that correctly store strings in strings.xml that using android studio (and windows) open strings.xml, click key (name) part of resource , press alt + f7 find usages. alternatively if need full text search press ctrl + shift + f7 search whole project find in path edit address comment to find view "submit" text using espresso can use either of these lines onview(withtext("submit")); onview(withtext(r.string.submit));

ssl - cipher suite specs using TLSv1.2 only and no SSLv3 TLSv1.2:!aNULL:!eNULL -

when using vpn-like connection between 2 servers (not web servers or it), besides authentication enable encryption. the authentication portion working, wanted @ encryption level. i know tlsv1.2 , v1.1 supported alongside wih sslv3. i use tlsv1.2 , nothing else. tlsv1.2:!anull:!enull is the correct cipher suite use? information https://www.openssl.org/docs/manmaster/apps/ciphers.html seems not helpful... can this matter? i use tlsv1.2 , nothing else. if want use tls 1.2 have configure protocol , not ciphers. limiting ciphers tls 1.2 ciphers drops support ciphers available since ssl 3.0 , still supported tls 1.2. depending on peer might end no shared ciphers way. if still want restrict ciphers might try string tlsv1.2:!anull:!enull . make use ciphers newly introduced in tls 1.2 , implicitly enforce protocol. again, no guarantee server supports these ciphers if server can tls 1.2 protocol.

javascript - Get number of image files and switching between them -

i've directory containing few image files [for example 4 files], want number of images existing in directory , show first image , allow users switch between images using controller elements , show number of image showing between it. example: i've 4 images , page shows first image , text " << 1/4 >> " , when user clicks on next button shows next image , text changes " << 2/4 >> " , ... can show me foundation of work? mean can tell me i've (not needed attach codes). use angularjs in page now, if it's needed can use jquery ( if it's not possible using angularjs ). this html page although think it's not helpful: <?php require ('functions.php');mob_check(); ?> <!doctype html> <html lang="fa-ir" data-ng-app="projects" data-ng-controller="projects_controller"> <!-- website design mohsen_nirouzad --> <head> <!-- adding meta...

revert - Git: Reset to old commit -

i know question has been answered couple of times, far, every posted solution tried did not work me :( the situation is: have working commit in master branch want go to. unfortunately, multiple changes (including merges other branches) have been pushed master since then. so need master branch last working commit again - or checkout last working commit , "overwrite" last commits on master - on server (github) repo. don't care if changes made last working commit lost, wouldnt hurt if kept intact. important other branches not touched!!! git revert did not job in multiple ways... we can try replacing master branch new branch, fishy :) create new branch working commit know if commit nth level down head use git branch master-temp head~n . replace n level. if have commit hash use git branch master-temp <sha1> rename current master branch new name master-old or master-deprecated rename new branch master-temp master this remain changes, c...

sql - Matching cells that contain hexadecimal range -

i trying query rows column 1 contains string of pretty random elements. however, last two-three elements of string hexadecimal value or decimal (0-255), like: column 1 | column 2 00000587-8bb4-4360-9b0b-79012c14aa6d | 1 00000541-1895-4b13-9de2-7be77dda5de6 | 2 000005db-da97-483d-9efb-69222bbc7b57 | 3 i need rows column 1 contains string ends hexadecimal values ranging e6 f2 or 0-255 normally use where acc.accountid ilike '%e6' , repeat values in range there has more efficient way? the hardcore way be: select * my_table ('x' || substring (col1 length(col1) - 1))::bit(8)::integer between 50 , 200

MySQL CREATE TRIGGER using php -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers i have read other posts mine, none of them solve problem, have 2 tables, user , purchase, when user signup, want add same user_id purchase table well. try right php code this: $query = "create trigger `purchase_insert` after insert on `user` each row begin insert purchase (user_id) values (new.user_id)"; $result = mysqli_query($connection, $query); if($result){echo "<br>trigger success!";} else {die("<br>database query failed. " . mysqli_error($connection));} this error get: database query failed. have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 1 i'm sorry if question repetitious. it should tick not single quotes create trigger `purchase_i...

plone - HTTP redirect after check in event -

i using plone 5.0 plone.app.iterate addon checkout option , intranet/extranet workflow. fuse these 2 concepts idea is: after every workflow transition event handler checks, whether page working copy , if published page. if page automatically should checked in. after review of working copy checked in. in order accomplish wrote following event handler: from acquisition import aq_inner plone import api plone.app.iterate.interfaces import iworkingcopy, icheckincheckoutpolicy plone.app.iterate import plonemessagefactory _ products.cmfcore.utils import gettoolbyname products.statusmessages.interfaces import istatusmessage def checkinifneeded(document, event): context = aq_inner(document) workflowtool = gettoolbyname(context, "portal_workflow") status = workflowtool.getstatusof("intranet_workflow", document) if iworkingcopy.providedby(context) , status["review_state"] == "internally_published": policy = icheckincheckoutpoli...

notifications - Warning in Xcode 8: Instance method nearly matches optional requirement -

Image
i trying implement local notifications in ios10, , far it not working . i warning around delegate methods: instance method 'usernotificationcenter(_:didreceive:withcompletionhandler:)' matches optional requirement 'usernotificationcenter(_:didreceive:withcompletionhandler:)' of protocol 'unusernotificationcenterdelegate' as solution xcode suggests 2 options: 1.make private 2.make @nonobjc why that? why need it? , important, how make these methods work? xcode 8 beta 6 introduced many swift 3 changes, 1 of @escaping keyword mark closures might used after method returns. completion handlers escaping closures, because might show information user, wait feedback, , then call completion handler – method return , keep reference closure, rather blocking. i expect there xcode 8 gm issued in next few hours, right xcode doesn't insert @escaping attribute it's needed, what's causing error. 2 fix-its being offered red herrings, i...

rust - Unable to create hyper::Client because the compiler cannot infer enough type information -

to experiment hyper, started the example . aside fact example doesn't compile ( no method `get` in `client` ) have distilled problem single line: fn temp() { let client = client::new(); } this code won't compile: unable infer enough type information `_`; type annotations or generic parameter binding required [e0282] in general error mean client has generic parameter , compiler can not infer it's value. have tell somehow. here example std::vec::vec : use std::vec::vec; fn problem() { let v = vec::new(); // problem, vec<???> want? } fn solution_1() { let mut v = vec::<i32>::new(); // tell compiler directly } fn solution_2() { let mut v: vec<i32> = vec::new(); // tell compiler specifying type } fn solution_3() { let mut v = vec::new(); v.push(1); // tell compiler using } but hyper::client::client doesn't have generic parameters. sure client trying instantiate 1 hyper?

c++ - Calculation of euler angles -

i need understanding math behind code. x component of returned vec2 , y component of returned vec2. can explain me represent. know function determinate position of vector in sphere coordinates. glm::vec2 calceulerangles(const glm::vec3& vec) { glm::vec3 v = glm::normalize(vec); glm::vec2 result(acos(v.z), atan2(v.y, v.x)); while (result.y < 0.0) result.y += twopi; return glm::vec2(glm::degrees(result.x), glm::degrees(result.y)); } it calculating spherical coordinates phi , theta unit vector. the first component ( phi ) angle between vector , z-axis. second component ( theta ) angle on xy-plane. assumes vector can expressed follows: x = cos theta sin phi y = sin theta sin phi z = cos phi if solve this, calculations in function. adding 2 pi y ensures angle between 0 , 2 pi .

facebook - Why are my FB API posts not reaching an audience? -

Image
i created app uses fb api post page. however, posts published later not shown audience , not seen fans. in screenshot see posts reached audience , posts did not reach audience. ones reached audience posted manually me. posts reached 0 people posted api application. i found answer: apps not sent review not have visible posts. the solution go "app review" menu , submit app review

aikau - customize simple search alfresco community 5 -

alfresco simple search field searches on document content , folders default. because i'm thinking of using tag taxonomy default simple search field search on tags without using "tag:" prefix , exclude content , folders. content , folders can stay search option in advanced search. the default query looks this: cm:name cm:title cm:description my:authorisedby ia:whatevent ia:descriptionevent lnk:title lnk:description text tag can give me idea how query can modified search on tags? i'm going assume "simple search" you're referring search box in header bar displayed in share. rendered aikau widget alfresco/header/searchbox , provides number of options customizations. i think best option going to extend default widget own version , override generatesearchterm function. allow take term provided (e.g. whatever user has entered search box) , manipulate additional advanced search text before used in calls search rest apis. this...

symfony - How to list entity in form -

i have entity hall can either welcome hall (subhall), or stand . i'm stuck hall form (or @ least it's think needs edited). can't figure out how have display <select> of hall parent=0 need default option blank 0 value here files: hall entity: <?php namespace salonbundle\entity; use doctrine\orm\mapping orm; /** * hall * * @orm\table(name="hall") * @orm\entity(repositoryclass="salonbundle\repository\hallrepository") */ class hall { /** * @var int * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $idhall; /** * @var string * @orm\column(name="name", type="string", length=255) */ private $name; /** * @var integer * @orm\column(name="parent", type="integer", options={"default":0}) */ private $parent; /** * @var * @orm\onetomany(targetentity=...

Constructing a string that does not include integer if it is 0 in Java? -

let's have: int hours = 0; int minutes = 0; int seconds = 5; system.out.println("simplified time: " + hours + ":" + minutes + ":" + seconds + ":"); it print out: simplified time: 0:0:5: does have idea make print out like: simplified time: 5: without using if else statements? of course if (hours>0) print out whole print statement if (hours=3) want print out: simplified time: 3:0:5: it looks trying remove leading zeroes , : after them. if case can apply replaceall(regex,replacement) x:x:x: part remove 1 or 2 of 0: placed @ start (we don't want remove last 0: ). "simplified time: " + (hours + ":" + minutes + ":" + seconds + ":").replaceall("^(0:){1,2}", ""); ^(0:){1,2} regex means ^ represents start of string (in our case start of x:x:x: since replaceall applied part), prevents matching 0: in middle of string if there no 0: before it,...

multithreading - How does RAM is shared in multi core environment? -

i learnt multi core processors have more 1 processing units( i.e. main executing units alu etc.) , better @ performance. want know how share physical memory. i'll take following example make question clearer - say, there memory location m in physical memory , 2 threads t1 , t2 running on different cores. possible t1 , t2 access m @ same instance of time or have wait 1 other complete access i.e. share same memory bus have wait, 1 or can read m @ same instance of time 2 different memory buses? if former case, there not performance gain right, have wait memory bus free? summarising, memory operations independent of other cores or each core can make physical memory access when memory bus free? memory access depends on ram module , not on cpu , cpu cores can request access access given first , depends on ram itself!

Joining two tables in ORM Django -

there 3 models person, author , singer. class person(models.model): name = models.charfield(max_length=256, null=true) class meta: db_table = "person" class author(models.model): person = models.foreignkey(person) rating = models.inegerfield(null=true) class meta: db_table = "author" class singer(models.model): person = models.foreignkey(person) rating = models.integerfield(null=true) class meta: db_table = "singer" i have perform joining between author , singer in orm mysql select s.* singer s join author on s.person_id=p.person_id; the simpler solution according database model be author_objects = author.objects.filter(person=singer_object.person) # singer_object # author_objects

iPython with Django : CommandError: No notebook (Python) kernel specs found -

i'm new jupyter/ipython , django . have django 1.9.5 installed on ubuntu 16.04 , application running fine. want configure ipython(version 5.1.0) used django application. trying call ipython notebook (browser) django later can used extensively in application through user interface. when try run command below $./manage.py shell_plus --notebook i error: [w 13:46:39.247 notebookapp] unrecognized json config file version, assuming version 1 [i 13:46:41.082 notebookapp] [nb_conda_kernels] enabled, 2 kernels found [i 13:46:41.114 notebookapp] writing notebook server cookie secret /run/user/1000/jupyter/notebook_cookie_secret [i 13:46:41.399 notebookapp] ✓ nbpresent html export enabled [w 13:46:41.399 notebookapp] ✗ nbpresent pdf export disabled: no module named nbbrowserpdf.exporters.pdf [i 13:46:41.409 notebookapp] [nb_conda] enabled [i 13:46:41.507 notebookapp] [nb_anacondacloud] enabled **commanderror: no notebook (python) kernel specs found** to resolve tried: ipyth...

php - Wordpress query based on ACF Datepicker values results in no posts -

so added custom fields post posttype, namely event_startdate , event_enddate. goal show events ongoing (so current date between start , enddate). however, no posts showing current code. this i've got: <?php $today = date('ymd'); $args = array ( 'posts_per_page' => '9', 'order' => 'asc', 'orderby' => 'id', 'meta_query' => array( array( 'key' => 'event_startdate', 'compare' => '>=', 'value' => $today ), array( 'key' => 'event_enddate', 'compare' => '<=', 'value' => $today ) ) ); $query = new wp...

c# - Error while Generating Windows 10 Build in Visual Studio 2015 Update 3 -

Image
i have developed windows 10 app , when create app packages x86/x64/arm. generates .appx package x86 others following error error cs0029 cannot implicitly convert type 'windows.ui.xaml.controls.image' 'coding4fun.toolkit.controls.superimage' mcs f:\company\windows 10\mcs\mcs\obj\x64\release\views\questions_answerspage.g.cs i got same error @ start solved , after when try generate .appxupload, above error x64, build generates x86. while generating build, configuration selected following can suggest, doing wrong? have 1 common project , 2 background task(push notification , timer) i'm experiencing similar problems. manually rebuild solution (x84, x64, arm) platforms release configuration. i'm able generate .appxupload package.

sql - Count of distinct groups that have a value of > 0 in any of its records for a given column -

the 2 columns: a) company name. there can multiple records company: 1 record per company per month. b) sales. given company given month, sales value 0 or greater. what want query return: a count of distinct companies had sales of > 0 one or more months thanks in advance help! something similar to: select count(distinct companyid) salestable sales > 0 simply count number of distinct companyid's have sales > 0.

javascript - Angular search for combined key -

say have following object: var user: {firstname: 'marc', lastname:'ras', age:30}; you have alot of these objects in array called: user_array now wish display them in table create table: <table> <thead> <th>full name</th> <th>age</th> </thead> <tbody> <tr ng-repeat="user in user_array"> <td>{{user.firstname + ' '+user.lastname}}</td> <td>{{user.age}}</td> </tr> </tbody> </table> now wish create input field can search user's full name: and here kinda ends me :s how possible search combinded key? have: <input type="text" ng-model="search.fieldname" /> however cant here since field combined of 2 fieldnames ? add controller $scope.filternamelastname = function (user) { var fullname = user.firstname + ' '+ user.lastname; if(fullname == $sco...

asp.net - Community 2015 IIS doesn't authenticate automatically (unique case) -

Image
i've read absolutely solutions on web, not applicable. question not possible duplicate since there no questions accepted answers work here. the problem when start project in visual studio community 2015 (new ones or made in vs 2012), requires user credentials. vs 2012 doesn't require it. environment windows 7, vs community 2015, ie 11, iis 10 express, web forms intranet application. solutions tried properties of project set disable anonymous auth , enable windows auth. additionally applied possible solutions web.config , applicationhost.config files regarding anonymous , windows authentication. installed windows iis services , set same settings, moved ntlm , negotiate down. disabled windows firewall, disabled comodo firewall, set ie intranet settings lowest security level , checked integrated windows authentication. keeps requiring authorization. google chrome doesn't authenticate well. how force automatic authentication? maybe vs iis has config files ...

java - Navigation drawer item doesn't take proper paddin in the left side -

Image
i'm using android material design drawer layout. working perfectly. i'm fetching little bit problem drawer layout item padding left in android api lever <= 19. it works in android api level >= 21. @ screenshot : but in android api level <= 19, drawer layout items don't take proper padding in left side. @ screenshot: my xml files following: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start" style="@style/styleactivity"> <include layout="@layout/app_bar_ma...

.htaccess - htaccess block referers with keyword -

i have site getting hit had referer spam sites domain always: http://scanner-{somethin-unique-here}.top how can use htaccess file block referers scanner-xxx.top? in site root .htaccess can use rule based on http_referer variable block remember sites can change http_referer @ point well: rewriteengine on rewritecond %{http_referer} https?://scanner-.*\.top [nc] rewriterule ^ - [f] make sure rule right @ top first rule.

elixir - How to Render Raw JavaScript Data in Phoenix Framework -

i got list in controller: data = ["one", "two"] i love render in eex template as: <script> var data = ["one", "two"] </script> how can make it, tried var data = <%= raw(@data) %> , got var data = [one, two] . got answer post , this how make in last: <%= raw(poison.encode!(@data)) %>

javascript - Aurelia - custom element does not inherit binding context by default. Is it okay? -

each view-model gets 2 parameters in bind() method: bindingcontext , overridecontext . first 1 describes current scope, second outer scope(s): parent, parent's parent, etc. looks that: overridecontext: { bindingcontext: {...}, //current level parentoverridecontext: { bindingcontext: {...}, //parent's binding context parentoverridecontext: {...} //and on } } this lets view-model access methods , fields parents' scopes well. if custom element created, receives expected bindingcontext , overridecontext parameters in bind() . when passes them child(ren), not in expected format, but: overridecontext: { bindingcontext: {...}, //current level, ok parentoverridecontext: null, __parentoverridecontext: {...}, //this real } note original parentoverridecontext has been moved __parentoverridecontext . in way, templating engine won't able resolve parents' scope. let's have concrete example: page.html: <templat...

java - JavaFX capture screen using Robot -

Image
i using transparent stage in javafx contains canvas . the user can draw rectangle in canvas dragging mouse. when hits enter saving image using: try { imageio.write(bufferedimage,extension,outputfile); } catch (ioexception e) { e.printstacktrace(); } to capture image screen using: gc.clearrect(0, 0, getwidth(), getheight()); // [gc] graphicscontext2d of canvas // start thread new thread(() -> { try { // sleep time thread.sleep(100); // capture image bufferedimage image; int[] rect = calculaterect(); try { image = new robot().createscreencapture(new rectangle(rect[0], rect[1], rect[2], rect[3])); } catch (awtexception e) { e.printstacktrace(); return; } } catch (exception ex) { ex.pr...

sorting - Sort a Map<Key, Value> by values (Java) -

i relatively new java, , find need sort map<key, value> on values. since values not unique, find myself converting keyset array , , sorting array through array sort custom comparator sorts on value associated key. there easier way? here's generic-friendly version you're free use: import java.util.*; public class maputil { public static <k, v extends comparable<? super v>> map<k, v> sortbyvalue(map<k, v> map) { list<map.entry<k, v>> list = new linkedlist<map.entry<k, v>>(map.entryset()); collections.sort( list, new comparator<map.entry<k, v>>() { public int compare(map.entry<k, v> o1, map.entry<k, v> o2) { return (o1.getvalue()).compareto( o2.getvalue() ); } }); map<k, v> result = new linkedhashmap<k, v>(); (map.entry<k, v> entry : list) { result.put(entry.getk...

Django admin change_list: Change multiple column names -

i want change multiple column names in list_display . attribute function using short_description shown here: django admin listview customize column name . however, sounds not practical if want change around 25 column headers. is there more efficient way? first workable approach generate 25 attribute functions in admin init method. implemented easier approach using mapping dictionary , for -loop in javascript: function shorten_column_headers() { var headers = { 'list_display_field_name_1': 'shortened description_1', 'list_display_field_name_2': 'shortened description_2', ... } (var field in headers) { var $col = $('th.column-' + field + '> div.text > a:nth-child(1)'); $col.text(headers[field]); } } $(document).ready(function() { shorten_column_headers(); });

unix - awk command is working in the console but not working inside shell script -

i'm filtering fourth column in file using below command. it's working fine in console [user@ipaddress now]$ creationtime="8:15 pm" [user@ipaddress now]$ awk -f, -v var="$creationtime" '{if($4==var) print}' input.txt serial1,tech,eu,8:15 pm,gan added same command in shell script it's not working. $ cat test.sh creationtime=$(date -d '330 minutes' +"%l:%m %p") echo $creationtime awk -f, -v var="$creationtime" '{if($4==var) print}' input.txt output while execting script [user@ipaddress now]$ sh test.sh 8:15 pm input.txt serial1,tech,apac,8:09 pm,anz serial1,tech,eu,8:15 pm,gan the problem might $creation_time contains leading spaces. when inspect echo , might not visible, not match $4 in awk . example: $ creationtime=$(date -d '330 minutes' +"%l:%m %p") $ echo ">${creationtime}<" > 4:50 pm< try instead: creationtime=$(date -d '330 m...

java - TabLayout's tabIndicator custom width can be changed? -

Image
let's got this: but want this: is there chance cause cannot find tabindicator 's width... i have founded library you: https://github.com/h07000223/flycotablayout

python 2.7 - cv2 getTrackbarPos not working -

working opencv3.1 cv2 in python 2.7.12. problem i'm having right that, though following multiple sets of instructions seem use same setup myself or @ least similar one. going these 2 examples: opencv.org , codegenerater's blogspot tutorial . did not forget make callback function or use cv2.gettrackbarpos . feel there must wrong specific order in or image display loop. here have, diaplays image initial trackbar threshold, not update image trackbar callback: import cv2 #write simple callback function pass trackbar position *arg def callback(*arg): pass #create display window image cv2.namedwindow('frame') #read in image img = cv2.imread(r'/home/usr/documents/aerial-images/images_with_targets/flight_4/target_10.jpg',0) #instantiate trackbar goes in our named window , uses callback function cv2.createtrackbar('thresh2','frame',5,15,callback) #initialize thresholds thresh1=11 thresh2=5 #loop runs until escape key causes break w...

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -

i new programming please pardon me if rookie mistake. i writing python script have defined functions create subplots of distributions. i have slider widget end user change value of variables(mu , sigma) , see effect on distribution. here's code import numpy np print np.__version__ import scipy print scipy.__version__ scipy.stats import norm, lognorm, uniform import matplotlib print matplotlib.__version__ import matplotlib.pyplot plt matplotlib.widgets import slider, button, radiobuttons, checkbuttons #####calculating mean , standard deviation##### global mu_a1 mu_a1 = 1 global mu_b1 mu_b1 = 10 global mu_c1 mu_c1 = -13 global sigma_a1 sigma_a1 = 0.14 global sigma_b1 sigma_b1 = 1.16 global sigma_c1 sigma_c1 = 2.87 mu_x01 = -11 sigma_x01 = 1.9 #####_____##### #####generating random data##### a1 = 0.75*mu_a1 + (1.25 - 0.75)*sigma_a1*np.random.sample(10000) b1 = 8*mu_b1 + (12 - 8)*sigma_b1*np.random.sample(10000) c1 = -12*mu_c1 + 2*sigma_c1*np.random.sample(10000)...

spring - Symmetric DS and Java -

i need extend symmetric ds functionality extending interfaces provides. has idea development process should be? in documentation explains put jar file (containing classes extending interfaces) , how add them spring context doesnt explain how develop them. i.e. libraries needed interfaces , process should followed develop/test. seems cumbersome each time modify , build jar file copy symmetricds server folder test. does has experience please? thanks extend class databasewriterfilteradapter in default package, i.e. no package ...; @ top of implementation. if need access db implement interface isymmetricengineaware , override setter void setsymmetricengine(isymmetricengine) called spring upon initialization. name writer filter implementation example mywriterfilter . override either 1 or both methods boolean beforewrite(datacontext, table, csvdata) or boolean afterwrite(datacontext, table, csvdata) implementing whatever transformation necessary. find file ftp-extens...

angularjs - UI-Router and Query Parameters in a Redirect -

using angular's ui-router, there way write redirects, such query parameters populated target state. example, here's state: .state('me.profile', { url: '/profile?action', templateurl: '/app/components/account/profile/profile.html', controller: 'profilectrl', authenticate: true }) specific actions can passing in via query parameter. example: examplesite.com/profile?action=editprofile however, wish able provide pretty urls user. example: examplesite.com/profile/edit can write redirect statement, populates desired query parameters on route. following code not working , since query param ?action=editpayment gets lost when user redirected target state. $urlrouterprovider.when('/profile/edit', '/profile?action=editprofile'); inplace of ?action change to: url: '/profile/:action', inject $stateparams , read action in controller var action = $stateparams.action;

jquery - Select2 filter values disappear when search returns no results -

i using serverside implementation of datatables yadcf , select2 added functionality. data used populate table acquired via ajax request django view, data select2 autocomplete functionality, separate django view. my issue 1 follows. if search query, not return results, values in select2 search fields disappear , cannot reset in datatables - must instead refresh page. values in non-select2 fields remain visible , can reset. the filter types within problematic columns multi_select select type of select2 . filter types within non-problematic columns range_date , range_date using bootstrap-datetimepicker datepicker type. below select2 column parameters. { "column_number": 3, "filter_type": "multi_select", "select_type": "select2", "select_type_options": { dropdowncssclass : 'bigdrop', multiple: true, minimuminputlength: 1, ajax: { url: '{% url 'fftestapp:searchdata' ...

JavaFX Android port Listen for volume button presses -

i'm trying develop android app javafx. there way listen volume button presses on phone can launch code whenever press volume buttons? you can listen various key codes, e.g. keycode.escape == back-button keycode.volume_up / keycode.volume_down keycode.home - i'm not sure, haven't tested it keycode.context_menu - i'm not sure, haven't tested it in application-extending main class this: @override public void start(stage stage) throws exception { // init scene , ui scene.addeventfilter(keyevent.any, this::handleglobalkeyevents); // whatever want } private void handleglobalkeyevents(keyevent event) { // use more specific key event type // --> keyevent.key_released == event.geteventtype() // --> keyevent.key_pressed == event.geteventtype() // without it, react on both events, doing 1 operation if (event.getcode().equals(keycode.escape) && keyevent.key_released == event.geteventtype()) { if ...

python - Check if strings from a list in a text and return first longest match -

i'm trying design application binds phrase or word item, example image, , saves phrase-item pair in database. receives text, , if contains binded phrase, corresponding item should returned. should return 1 item whole text, , longest substrings should take precedence. i wrote function, returns expected values: from operator import itemgetter def get_item(text, bindings): text = text.lower() matches = [] phrase, item in bindings: phrase = phrase.lower() index = text.find(phrase) if index != -1: matches.append((phrase, item, index)) if matches: matches.sort(key=lambda x: len(x[0]), reverse=true) matches.sort(key=itemgetter(2)) item_id = matches[0][1] else: item_id = none return item_id example: bindings = [ ('i', 'item1'), ('like', 'item2'), ('i like', 'item3'), ('turtles', 'item4'), ] text = 'i turtles!' pri...

bosun - Not getting networking metrics from scollector on Centos 7.1 -

we have bosun running on centos 6.4 , many nodes on os also. added centos 7.1 nodes , while basic metrics os.cpu, no network-related metrics appear. i recompiled latest scollector on 7.1 , pushed out, didn't help. need recompile bosun on 6.4 also, or backwards compatible? thanks ken right interfaces collect restricted regular expression: https://github.com/bosun-monitor/bosun/blob/master/cmd/scollector/collectors/ifstat_linux.go var ifstatre = regexp.mustcompile(`\s+(eth\d+|em\d+_\d+/\d+|em\d+_\d+|em\d+|` + `bond\d+|team\d+|` + `p\d+p\d+_\d+/\d+|p\d+p\d+_\d+|p\d+p\d+):(.*)`) the problem due aggregation need clear if interface physical interface, tunnel, team/bond etc. don't want accidently virtual interfaces in os.net.bytes messes aggregation. there couple prs , need address categorization issue , not have yet. immediate workarounds can edit code have need, work on pr make configurable category, or rename interfaces.

skyscanner - Getting the error "ApiKey invalid" for hotel live prices -

i'm trying list of current hotel prices can't api key work. i've had couple days know isn't new. tried example in docs (after fixing dates): http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2/uk/eur/en-gb/27539733/2016-12-04/2016-12-10/2/1?apikey=mykey while worked demo key wouldn't work mine. tried on ec2 micro i'm using testing python , response u'{"errors":["apikey invalid"]}': sky_scan_url = "http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2/" sky_key = get_sky_scan_key() def get_hotels(request): entityid = request.get['entityid'] checkindate = date_formatter(request.get['start']) checkoutdate = date_formatter(request.get['end']) rooms = request.get['rooms'] guests = request.get['guests'] final_sky_url = "%s/%s/%s/%s/%s/%s/%s/%s/%s/?apikey=%s" % ( sky_scan_url, 'us...

html - Aligning Bootstrap Radio Buttons with text -

Image
i trying radio buttons align having difficulty doing this. trying have buttons align indentation because going display caret if option has been selected. want text come bit because it's not inline actual radio button. input[type=radio] { z-index: 3; width: 26px; height: 26px; -moz-appearance: none; } label { font-weight: normal; font-size: 1.5em; cursor: pointer; } .question-label { margin-left: 15px; } <div class="radio"> <label> <span class="button"><input type="radio" name="optionsradios" value="20"></span> <span class="question-label">true</span> </label> </div> <div class="radio"> <label> <span><i class="fa fa-caret-right fa-2x correct-answer" aria-hidden="true"></i></span> <span class="button"><input type=...

c++ - Where and why do I have to put the "template" and "typename" keywords? -

in templates, , why have put typename , template on dependent names? dependent names anyway? have following code: template <typename t, typename tail> // tail unionnode too. struct unionnode : public tail { // ... template<typename u> struct inunion { // q: add typename/template here? typedef tail::inunion<u> dummy; }; template< > struct inunion<t> { }; }; template <typename t> // last node tn. struct unionnode<t, void> { // ... template<typename u> struct inunion { char fail[ -2 + (sizeof(u)%2) ]; // cannot instantiated u }; template< > struct inunion<t> { }; }; the problem have in typedef tail::inunion<u> dummy line. i'm inunion dependent name, , vc++ quite right in choking on it. know should able add template somewhere tell compiler inunion template-id. exactly? , should assume inunion class template, i.e. inunion<u> names type , ...