Posts

Showing posts from July, 2012

php - Arrow key and mouse navigation for AJAX Live search -

i using below code autocomplete feature in webpage. problem not able navigate through suggestion using mouse pointer. if up/down key pressed once after list item refreshed mouse pointer navigation working fine. could please suggest code change make mouse pointer , keyboard navigation work navigation in html select option? how can improve scrolling of suggestion list using up/down key? html: <div class="field-wrap"> <input type="text" id="college" placeholder="college name" required autocomplete="off"/> <ul id="college_list"></ul> </div> css: .field-wrap ul { width: 93%; margin-top: 1px; border: 1px solid #3498db; position: absolute; z-index: 9; background: #0f0f0f; list-style: none; max-height: 100px; overflow-y:auto; } .field-wrap ul li { padding: 2px; border: solid grey; border-width: 0 0 2px 0; } #college_list { display:

css - Simplifying/combining nested LESS -

i have following less: ul.dropdown-menu { padding-top: 0; z-index: 2010; li:first-child { a.disabled.heading { &.availableaction { border-top: none; margin: 0; } } } } is there way combine li:first-child , a.disabled.heading , , &.availableaction selectors? do mean this? ul.dropdown-menu { padding-top: 0; z-index: 2010; li:first-child a.disabled.heading.availableaction { border-top: none; margin: 0; } } less supports nesting never requires use it. unasked notes :) hope z-index arbitrary-looking , huge reason if possible, design selector names can .dropdown-menu rather ul.dropdown-menu - browser process first 1 more second if possible, it's practice use less specific selector ul.dropdown-menu li:first-child a.disabled.heading.availableaction . again, browsers process .dropdown li:first-child .availableaction more (and li:first-child .availableaction quicker, can imagine might targe

google chrome - how can I get browser profile path with extension -

how can browser (from chrome://version/) executable file , profile path params extension ?? because malicious programs changed chrome profile path (e.g. c:\program files (x86)\eastmy\application\chrome.exe\ instead of c:\program files (x86)\google\chrome\application\chrome.exe)

android - paddingStart/Left and paddingEnd/Right -

in recent code writing times i've seen single element contain paddingleft/right, paddingstart/end, , both. can't seem find on better , why. have insight / when use 1 or other or both? you need new start/end properties create nice right-to-left layout, used in countrys people read right left. there no better version, newer version. if want support android versions prior android 4.2, should use old , new properties together. if want support android 4.2 , newer versions, it's ok use new properties paddingstart (instead of paddingleft ). there nice explanation available on android developers blog : to take advantage of rtl layout mirroring, make following changes app: declare in app manifest app supports rtl mirroring. specifically, add android:supportsrtl="true" element in manifest file. change of app's "left/right" layout properties new "start/end" equivalents. if targeting app and

javascript - Only allowing form to be submitted if from a certain URL? (iframe, Laravel) -

i'm building service in need people able submit form, through iframe they'd have on own site, need domain listed in user model. i know possible, need solution whereby users cannot edit js allow work on domain shouldn't (through inspect element etc.). anyone got solutions? @ appreciated. you can't access parent page iframe unless both iframe , parent on same domain.

windows - How to build video thumbnails sheet using pipe (ffmpeg + imagemagick)? -

Image
how can build video thumbnails sheet using pipe (ffmpeg + imagemagick) on windows without using temporary files? update: here update version of post wrote. the script bellow creates folder named .\thumbnails , store in video thumbnails, same name of video file. fully configurable! no temporary files used! (uses pipe!) requires: ffmpeg , imagemagick. set impath=c:\programs\imagemagick set folder=c:\my videos set frame=320x180 set tile=10x1 set vframes=10 set fps=1/20 rem 1/60 -> 1 shot every 60s set filesize=300 rem max file size in kb set filetypes=*.mp4 pushd "%folder%" if not exist thumbnails md thumbnails /f "usebackq delims=" %%f in (`dir /b %filetypes%`) ( if not exist "thumbnails\%%~nf.jpg" ( ffmpeg.exe -threads 2 -y -i "%%f" -an -qscale:v 1 -vf fps=%fps% -vframes %vframes% -f image2pipe -vcodec ppm - ^ | %impath%\convert - -resize %frame% -background transparent -gravity center -extent %fr

Javascript document.getElementById("name") returning -

this question has answer here: why jquery or dom method such getelementbyid not find element? 6 answers i've searched answer question , haven't been able find hits it, far saw. i have 2 chunks of javascript here using create simple 2d game in web browser. var mygamepiece; var game = { canvas : document.getelementbyid("game-screen"), start : function(){ this.context = this.canvas.getcontext("2d"); } } function startgame(){ game.start(); } and one: var mygamepiece; var game = { start : function(){ this.canvas = document.getelementbyid("game-screen"); this.context = this.canvas.getcontext("2d"); } } function startgame(){ game.start(); } the first code snippet not work. canvas null when try context. i'm wondering why? realize why works in second one

java - Spring application with embedded servlet container run error -

i learning spring , have problem. have created standalone application (web service) run in embedded servlet container. use intellij idea gradle. when run application idea - work fine. when have created jar file , run via console ("java -jar my.jar") have got error (below). load official sample ( https://github.com/spring-guides/gs-rest-service ) , it's not work (via running jar). see link not helped me: spring boot: unable start embeddedwebapplicationcontext due missing embeddedservletcontainerfactory bean please help error log: 18:47:26.079 [main] error o.s.boot.springapplication - application startup faile d org.springframework.context.applicationcontextexception: unable start embedde d container; nested exception org.springframework.context.applicationcontexte xception: unable start embeddedwebapplicationcontext due missing embeddeds ervletcontainerfactory bean. @ org.springframework.boot.context.embedded.embeddedwebapplicationconte xt.onrefresh(embe

html - After creating a <text> element with javascript, why can't I getBBox? -

Image
i have script adds <text> element markup, inside existing <svg> . running getbbox() on new element gives me error. if include <text> in markup begin , run equivalent script, getbbox runs without problems. dom not treating js-built <text> text element… missing "the thing written '<text>' in fact <text> " step? function works() { console.log('start "works"') var svgelem = document.queryselector('.works'); var textelem = svgelem.queryselector('text'); var textbbox = textelem.getbbox(); console.log(textbbox); console.log('end "works"') } works(); function doesntwork() { console.log('start "doesntwork"') var svgelem = document.queryselector('.doesntwork'); var textelem = document.createelement("text"); textelem.appendchild(svgelem.firstchild); svgelem.appendchild(textelem); console.log('"

node.js - How can I use PostgreSQL transactions in SailsJs? -

my problem have complex chain of queries , make rollback if of transactions fail. i've read transactions in sails and, default, sails don't support transactions because each transaction make new connection postgres, so, 1 query have new connection. so, how can use transactions sails? currently transactions not supported waterline. can join discussion here https://github.com/balderdashy/waterline/issues/755 . transactions on roadmap not expected in near future: https://github.com/balderdashy/waterline/blob/master/roadmap.md#pending-proposals as workaround might try https://github.com/shyp/pg-transactions loose flexibility of waterline because code not database agnostic more. also check sails.js best practice in using transactions promises (postgres) , sails.js + postgres: issue transactions

Google Cloud Compute Engine not Migrated Before Power off (Maintenance?) -

Image
i under impression according docs here if vm set "migrate vm instance" "on host maintenance" there no downtime. i have 2 issues: 1) had vm go down weekend , here auth.log shows: sep 10 20:28:07 comp_engine_name systemd-logind[2571]: power key pressed. sep 10 20:28:07 comp_engine_name systemd-logind[2571]: powering off... sep 10 20:28:07 comp_engine_name systemd-logind[2571]: system powering down. sep 10 20:28:07 comp_engine_name sshd[3291]: received signal 15; terminating. sep 10 20:28:07 comp_engine_name systemd: pam_unix(systemd-user:session): session closed user username my google cloud platform logs compute engine show @ 20:28, instance received "gce_api_call" event type "compute.instances.stop." user event "". not helpful. 2) instance not automatically restarted. here screenshot of relevant settings vm. did not shut down myself, , there no scripts running on controls power/restart. not see evidence security c

webview - Android Toolbar in webapp -

Image
i developing web app, , here have problem. i have tool bar(android widget toolbar) logo , search button as can see have login page(webview). want user see search button after users login webpage. how should that? edited: in toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/my_toolbar" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="#000000" android:elevation="3dp" app:theme="@style/themeoverlay.appcompat.dark.actionbar" app:popuptheme="@style/themeoverlay.appcompat.light"> </android.support.v7.widget.toolbar> in menu_main.xml <?xml version="1.0" encoding="utf-8"?> <menu xmln

ruby on rails - How to autolink all words in a rendered text that match an item name in my database? -

i have rails app postgres database articles , items. whenever render text article, can somehow scan text , if finds word matches name of item in database autolinks items show_path. any ideas? appreciated. you can reason out first principles. make little method returns either word, or link article if word in article. def make_link(word) item = item.find_by(text: word.downcase) item ? link_to(word, item_path(item_id) : word end now, map words in article using method above convert linkable ones links. new_article = actioncontroller::base.helpers.sanitize(article).split(' ').map{|word| make_link(word)}.join(' ').html_safe note html_safe method ensure link tags aren't escaped when new_article rendered, , sanitize method ensure unwanted html tags in source removed.

ruby - Unique radio buttons when iterating in rails -

i'm creating application in have list of symptoms (@all_symptoms) on iterating , want have radio buttons each 1 indicating whether presence true or false. the problem keep running against no matter try radio buttons named same, can select true/false once on entire form. i tried changing label to: <%= ff.radio_button "presence_#{s.id}", true %> but there error because there (obviously) no method called "presence_x" symptoms. (for clarity: "presence" is attribute symptom, , accepts boolean value.) the nested attribute part of form because part of appointment accepts attributes symptoms. <%= f.fields_for :symptoms |ff| %> <table> <tr> <th>name</th> <th>presence</th> </tr> <% @all_symptoms.each |s| %> <tr> <td> <%= s.name %> </td> <td> <%= ff.label :presence, "true", :value =&

ruby - Chrome notification with rails - 400 UnauthorizedRegistration -

i`m using rails , https://github.com/zaru/webpush gem , have configured things according guide https://rossta.net/blog/web-push-notifications-from-rails.html i manage register serviceworker , subscription. save in controller endpoint = params[:subscription][:endpoint] p256dh = params[:subscription][:keys][:p256dh] auth = params[:subscription][:keys][:auth] current_user.gcm_endpoint = endpoint current_user.gcm_p256dh = p256dh current_user.gcm_auth = auth later send message this: message = { title: "title", body: "this test notification", icon: "images/my-128.png" } webpush.payload_send( endpoint: current_user.gcm_endpoint, message: json.generate(message), p256dh: current_user.gcm_p256dh, auth: current_user.gcm_auth, ttl: 600, api_key: "<my api key>" ) i have configured , activated account on google console. have turned on gcm api , added correct key. no matter do, receive 400 error code.

excel - Multiple Oracle Smartview Refresh Not Working in a Loop (Works When I Step Through Code) -

i have following code works charm when step-through line-by-line (or when step through 1 or 2 loop iterations fire rest). when run button code not work in sense hyperion retrieve never updated each iteration of department change. department gets changed correctly (as can seen excel , resulting pdf file). so in nutshell, code works no seen or trapped errors, result set of pdfs identical data, though labeled different departments when run button press. i have scoured net quite bit, tried using doevents , application.wait no success. have ideas how ensure refresh happens each loop iteration when running button press? option explicit declare function hypmenuvrefresh lib "hsaddin.dll" () long sub createallpdfs() '... setup code declare variables , loop range ... 'loop through departments dim cel range each cel in rngloop 'rngloop declared , set in setup code 'set department on drivers tab wsdrivers.range("b4").value = "'

debugging - In Chrome debugger, is there a way to "stay in this script"? -

often when debugging interested in program flow within 1 script. it's frustrating when debugger keeps jumping out follow code execution flow branches outside script. the way have found limit blackbox each time jumps new script (which presume works other people not me because use sourcemaps aren't blackboxed in chrome due unfixed chrome bug, that's separate topic). is there way instruct debugger not jump out other script files? thanks

parsing - Argparse: How to disallow some options in the presence of others - Python -

i have following utility: import argparse parser = argparse.argumentparser(description='do action.') parser.add_argument('--foo', '--fo', type=int, default=-1, help='do foo') parser.add_argument('--bar', '--br', type=int, default=-1, help='do bar') parser.add_argument('--baz', '--bz', type=int, default=-1, help='do baz') parser.add_argument('--bat', '--bt', type=int, default=-1, help='do bat') however, if --foo option used, --bat option should disallowed, , conversely, --bat option should used if --bar , --baz present. how can accomplish using argparse ? sure, add bunch of if / else blocks check that, there's built-in argparse me? you can create mutually-exclusive groups of options parser.add_mutually_exclusive_group : group = parser.add_mutually_exclusive_group() group.add_argument('--foo', '--fo', type=int, default=-1, help='do foo

modelica - Non-fatal iteration errors during initialization -

the modelica fluid library attempts have useful attribute of being able initialize either temperature or enthalpy. however, in simulation log several errors show bit mysterious. the logged errors don't seem impact simulation should not appearing because: the values passed temperature_phx should valid use_t_start = true "else" option causing errors should not run below code reproduces error when run "runme" along option not produce error. representative error @ bottom. any insight how solve issue appreciated. model initialvaluessimplified outer modelica.fluid.system system "system wide properties"; replaceable package medium = modelica.media.water.standardwater "medium in component"; parameter medium.absolutepressure p_a_start=system.p_start "pressure @ port a"; parameter boolean use_t_start=true "use t_start if true, otherwise h_start"; // creates error log parameter medium.tem

machine learning - Not uniform feature space -

i'm making machine learning algorithm predicting interest rates. problem i'm dealing consists of different features' format old records. more in detail: old contracts(records), 1 of features, matrix of prices, have 15x12 cells conversely new ones have 14x15 elements. reason due changes in financial markets. now problem doing pca on subset of uniform matrixes in order standardization , dimensionality reduction, , there no problems. of know how can reach same objectives in new context ? thanks suggestion!

batch file for command parsing path -

i trying read file path windows batch file variable set print_nodepath=reg query "hklm\software\node.js" /v installpath /f "skip=2 tokens=3" %%a in ('%print_nodepath%') set nodepath=%%a echo %nodepath% the reg query correctly returns hkey_local_machine\software\node.js installpath reg_sz c:\program files\nodejs\ but don't know how write 'for' command grab file path since contains space (c:\program). suppose need join 3rd , 4th tokens? is there "good" way write this? you need few modification: change tokens=3 tokens=2* ; read variable %%b rather %%a ; here fixed code: set print_nodepath=reg query "hklm\software\node.js" /v installpath /f "skip=2 tokens=2*" %%a in ('%print_nodepath%') set "nodepath=%%b" echo(%nodepath% this works if registry value name not contain white-spaces on own.

python - Getting two Blue DongleRS232s to talk using pyserial -

i new pyserial , trying 2 blue dongle rs232s talk each other i have 1 of them connected /dev/ttyusb0 , other /dev/ttyusb1 both of them configured connected each other when connected using @ commands. sending "hello" message usb0 dongle usb1 dongle on bluetooth link. here code import serial ser0 = serial.serial()` ser0.port = '/dev/ttyusb0' ser0.baudrate = 57600 ser0.bytesize = 8 ser0.parity = serial.parity_none ser0.stopbits = serial.stopbits_one ser1 = serial.serial() ser1.port = '/dev/ttyusb0' ser1.baudrate = 57600 ser1.bytesize = 8 ser1.parity = serial.parity_none ser1.stopbits = serial.stopbits_one try: ser0.open() print "connected usb0" except serial.serialutil.serialexception: print "cannot connect usb0" ser0.close() try: ser1.open() print "connected usb1" except serial.serialutil.serialexception: print "cannot connect usb0" ser1.close() cmd = "hello!!!\r"

How would I convert this excel formula into a MS Access or VBA? -

Image
trying convert ms excel formula =if((d2+c3)>0,0,(d2+c3)) how convert ms access or vba? this dataset table in excel importing access try this: =iif(([rollover]+[bucket])>0,0,([rollover]+[bucket])) although, excel formula references d2 , c3, in different rows. that's going bit tricky in access if that's need do. possible do, if that's want, may need add row number field (or autonumber id field) in order that. blair editted: (since read "see more comments") the quick , dirty way add rownumber field, make query dataset calculated field output nextrownumber: [rownumber]+1. link query , dataset rownumber , nextrownumber. use [rollover] field query ([query]![rollover] , [bucket] field dataset ([dataset]![bucket]) in equation above. there more elegant way in vba, linked query / dataset should work. blair

Replace values in an array in matlab without changing the original array -

my question given array a, how can give array identical except changing negatives 0 (without changing values in a)? my way is: b = a; b(b<0)=0 is there one-line command , not requiring create copy of a? while particular problem does happen have one-liner solution, e.g. pointed out luis , ian's suggestions, in general if want copy of matrix operation performed on it, way how did it. matlab doesn't allow chained operations or compound expressions, have no choice assign temporary variable in manner. however, if makes feel better, b=a efficient not result in new allocated memory, unless / until b or change later on. in other words, before b(b<0)=0 step, b reference a , takes no memory. how matlab works under hood ensure no memory wasted on simple aliases . ps. there nothing efficient one-liners per se; in fact, should avoid them if lead obscure code. it's better have things defined on multiple lines if makes logic , intent of algorithm

angularjs - Microsoft Edge - Angular Input Bug? -

this works on chrome, ff , safari. in edge when left click in input field, seems on mouseup event input loses focus , cursor leaves input random element above. can tab input , can right click bring copy/paste menu, click elsewhere on page, , cursor stays in input. <div class="card" ng-repeat="prod in product" ng-if='ngcart.itemincart(prod.id)'> <div id="{{prod.id}}" count="{{prod.count}}" class="card-info col-md-12" ng-click="showinfo(prod.id)"> <div ng-if="prod.count == 0" class="info-form pink-active col-md-12"> <div ng-if="prod.id == '11'" class="col-md-12"> <input type="text"/> </div> </div> </div> </div> any idea how can troubleshoot this? again, works in other browsers. client using edge, have fix this. update: if left click in input , move mouse outside i

No appearance button in Wordpress -

Image
trying add tracking script site client, i've done others in past. logged wordpress page , there no appearance button. has heard of before? know of way php files typically there? appreciated.

xcode - Android Studio List file methods -

Image
in android studio how list of methods available file? i switch ios android , if feature miss xcode. assume it's feature in android, can't find it. in xcode click drop down @ top of window, shows method signatures of of methods on file. can click on each method jump location in file. thanks you can see structure tab below project tab in android studio. open file in editor , click on structure tab, show methods in class selected. click on method , redirected method. in case can't find tab, can add tab using sequence: view -> tool windows -> structure

php - MySQL query that checks that the logged in user has access to the content? (where the content belongs to a class where the user is enrolled in) -

i have theoretical issue, need translate database query in mysql. i have students can enrolled class. each class have class lectures (content). only students enrolled in class should able access lectures assigned class. each lecture assigned n classes. i have several tables: users table userid field. content table contentid field. class table classid field. users-classes table userid , classid fields contents-classes table classid , contentid fields. i have no idea on how query should formulated check user id of logged in user connected classid of class lecture user wants read belongs (the content). any clue appreciated. this can completed simple inner join select 1 users-classes uc inner join contents-classes cc on cc.classid = uc.classid uc.userid = {userid} if query returns 1, they're authorized view content. if want know userid and classid, add where. select 1 users-classes uc inner join contents-classes cc on cc.classid = uc.cl

office365 - Determining whether the user is Windows Live or Office 365 User in a Office.js Task Pane? -

given oauth urls live , o365 different** (hope i'm right 1 in first place), there way know form office task pane add-in whether current user running live id or office 365 id? we resort showing 2 buttons user login: 1 "login windows live" , "login office 365" initiate respective oauth steps. want make there's 1 login button , preset type of user logged in. you want take @ azure ad converged auth. here's article discusses various approaches https://azure.microsoft.com/en-us/documentation/articles/active-directory-appmodel-v2-overview/ and here's blog post talks same: https://blogs.msdn.microsoft.com/richard_dizeregas_blog/2015/09/04/working-with-the-converged-azure-ad-v2-app-model/ the converged auth supports implict grant ideal task pane add-in also we're building auth helper achieve same within task pane ease. i'll edit response when goes public. edit: you can use officehelpers authenticate microsoft, google, facebo

html - background image cover different on Chrome and Firefox -

this 6-tile-header on page i'm working on looks different in chrome , firefox. http://epicstudios.de/carbonbikes3/index_white.html chrome shows correctly (see screenshot link below) , uses background images cover whole screen make 1 image divided several tiles, while firefox makes 6 small images out of it. how firefox show correctly? how chrome shows (correct): http://epicstudios.de/carbonbikes3/cb.jpg how firefox shows (wrong): http://epicstudios.de/carbonbikes3/cb_firefox.jpg this how each single tile given background: background: url(../img/header_bg_red4.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; thank you!

node.js - Socket.io client does not emit based on available memory/cpu in tab? -

i've discovered odd quirk using socket.io. have simple setup: 2 clients on separate computers , node.js server on 1 of clients. tick rate (time between each message) 100ms (i.e. reasonable). both clients communicate server socket.emit , server sends message both clients. works great. well, here's what's odd ... this webgl web game, mind you, there lot of stuff happening in tab. when things start cook in game , tab thread starts use more system resources, socket ceases emit server. game running fine, perhaps drop in fps no serious crash or that. in addition, can tell socket.emit code being executed (or @ least called) every 100ms normal (by executing console.log directly before it). despite that, server doesn't message, sent client socket.emit. know because console.logging every communication makes server... i can literally increase size of window (which sucks more resources, because webgl renderer has more work) , messages cease received on server when window ge

How to implement an array filled with objects inside a class in VBA -

i have tried implement several different ways , missing something. class cunit includes array of cpanel objects - private ppanel() cpanel public property panel(optional rindex integer) cpanel if rindex = 0 panel = ppanel else panel = ppanel(rindex) end if end property public property let panel(optional rindex integer, value variant) if rindex = 0 ppanel = value else ppanel(rindex) = value end if end property body of module: function unitbom(unit cunit) cunit set unitbom = unit dim panels() cpanel redim panels(1 unitbom.numpanels) dim paneltemp cpanel set paneltemp = new cpanel dim variant = 1 unitbom.numpanels set panels(i) = paneltemp next unitbom.panel = panels() this works panels(1).width = 1 when run "object variable or block variable not set." unitbom.panel(1).width = 2 you guys have forgive me because have not explained well. need array of cpanel objects inside cunit object. probl

loops - looping the data using date variable in python -

i have following dataframe datetime, lon , lat variables. data collected each second means each date repeated 60 times i doing calculations using lat, lon values , @ end need write data postgres table. 2016-07-27 06:43:45 50.62 3.15 2016-07-27 06:43:46 50.67 3.22 2016-07-28 07:23:45 52.32 3.34 2016-07-28 07:24:46 52.67 3.45 currently have 10 million records . taking longer time if use whole dataframe computing. how can loop each date, write db , clear dataframe?? i have converted datetime variable date format df['date'] = df['datetime'].dt.date df = df.sort(['datetime']) computation df.loc[(df['lat'] > 50.10) & (df['lat'] <= 50.62), 'var1'] = 1 df.loc[(df['lan'] > 3.00) & (df['lan'] <= 3.20), 'var2'] = 1 writing db df.to_sql('table1', engine,if_exists = "replace",index = false) have considered using groupby() function? can

javascript - Angularjs Get Json from url -

first time trying json data , show app using angularjs, not show data, code implemented html <div ng-app="myapp" ng-controller="customersctrl"> <table> <td>{{ x.id }}</td> <td>{{ x.title }}</td> </table> </div> </body> </html> script <script> var app = angular.module('myapp', []); app.controller('customersctrl', function($scope, $http) { $http.get("http://example.com/api/get_page_index/") .then(function (response) {$scope.names = response.data.pages;}); }); </script> json content url { "status": "ok", "pages": [ { "id": 2, "type": "page", "slug": "sample-page", "url": "http:\/\/example.com\/", "status": "publish",

python - Use of domain in search of One2many field in List view in Odoo-9 -

i have one2many field product_attributes in product.template , value field in product.attributes.custom class producttemplatecus(models.model): _inherit = 'product.template' product_attributes = fields.one2many('product.attributes.custom','product_id') class productattributes(models.model): _name = 'product.attributes.custom' value = fields.char(string='value') product_id = fields.many2one('product.template',string='product') product 1 product_attributes contains 2 values: value= 'color: red' value= 'others: red' product 2 product_attributes contains 2 values: value= 'color: white' value= 'others: red' i did below in search xml: <field name="product_attributes" string="color" filter_domain="['&amp;',('product_attributes.value','ilike','color'),('product_attributes.value','ilike

Sitecore Redirect module Regex Pattern Matching -

using 301 redirect module sitecore 7, i'm having problem establishing proper requested expression , source values use in sitecore redirect module. have example url typically getting request want redirected home page of site. the example url requests contain excite.com @ end of url: https://www.example.com/products/foods/apples/excite.com https://www.example.com/products/foods/oranges/excite.com https://www.example.com/products/foods/pears/excite.com i these requests contain excite.com @ end redirected home page ( https://www.example.com ) can't life of me figure out. i haven't used 301 redirect module have used similar modules. there 2 issues need resolving. you need create redirect using pattern match redirect. regex need "match request ends /excite.com " .*(/excite.com)$ the other issue sitecore seeing .com part of url extension , filtering request. need add com list of allowed extensions. <configuration xmlns:patch="http:

php - How to remove plain text from a string after using strip_tags() -

so have string , used strip_tags() function remove tags except img still have plain text next img element. here visual example $myvariable = "this text needs removed<a href='blah_blah_blah'>blah</a><img src='blah.jpg'>" so using php strip_tags() able remove tags except <img> tag (which want). thing didn't remove text. how remove left on text? text either before tag or after tag [added more details] $description = 'crazy stuff<a href="https://websta.me/p/1337373806024694030_327078936"><img src="https://scontent.cdninstagram.com/t51.2885-15/e15/14287934_1389514537744146_673363238_n.jpg?ig_cache_key=mtmznzm3mzgwnjayndy5ndazma%3d%3d.2"></a>'; that's variable holding. thanks in advance instead of replacing can extract values want: (<(\w+).+</\2>) to used preg_match() , see a demo on regex101.com . in php : <?php $regex = '~(<(\w+).+&

elasticsearch - Which approach of search is feasible (elastic search + mongoDB) or mongoDB text indexes -

in project have implement text search , and have choose feasible approach among 2 :- synchronising mongodb database elasticsearch. mongodb's own text indexes has elastic search text searching capabilities. i have gone through many articles provide pros of each of cases haven't found relevant document provides comparison between 2 approaches , approach better other or limitation specific approach. note:- using node.js express.js. mongodb general purpose database, elasticsearch distributed text search engine backed lucene. can store data in mongodb , use elasticsearch exclusively its' full-text search capabilities. according use case, can send subset of mongo data fields elastic. synchronization of mongodb elasticsearch can done mongoosastic . can solve data safety concern persisting in mongo , speed search using elasticsearch. can use python script using elasticsearch.py package sync mongo , elasticsearch. mongodb search slow compared elasticsearc

ibm mq - No Bean Spring JMS with IBM MQ -

is possible messages ibm mq (synchronously or asynchronously) using spring jms alone - without using bean? i looking design can messages mq (ibm in case) using spring alone - process message , pass on. kindly suggest if possible. thank you. you can use jmstemplate (synchronous) or defaultmessagelistenercontainer (asynchronous) directly, without declaring them beans; sure call afterpropertiesset() after setting properties , before start() ing container, though.

objective c - How to change Xcode behavior? Change breakpoint setting in Xcode Setting? -

how change breakpoint setting in xcode? i using xcode 7.3.1 , want change breakpoint setting. please check below screen shot. how can change setting? currently display breakpoint on xcode :- i using xcode 7.3.1 , want change breakpoint setting. please check below screen shot. how can change setting? now showing below screen after debug application: i using xcode 7.3.1 , want change breakpoint setting. please check below screen shot. how can change setting? i using xcode 7.3.1 , want change breakpoint setting. please check below screen shot. how can change setting? i using xcode 7.3.1 , want change breakpoint setting. please check below screen shot. how can change setting? i using xcode 7.3.1 , want change breakpoint setting. please check below screen shot. how can change setting?

javascript - How to resize the top div according to the bottom div -

i have top div chart , bottom div contains 4 rows @ end of each row have close icon on click of close icon particular row disappears, remaining rows should go down top div should occupy remaining space how in css or javascript. using concept of ng-repeat angular js rows getting repeated. if number of rows below may change, i'd suggest using flexboxes. on parent div (which wraps both chart , rows): display: flex; flex-direction: column; and on chart-wrapper: flex: 1 0 0%; this make chart-wrapper div take remaining space of parent div. if you'd support older browser, don't forget vendor prefixes: display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-direction: column; -moz-flex-direction: column; -ms-flex-direction: column; flex-direction: column; and: -webkit-box-flex: 1 0 0%; -moz-box-flex: 1 0 0%; -webkit-flex: 1 0 0%; -ms-flex: 1 0 0%; if haven't already, take time read mor

java - AWS Toolkit for Eclipse Mars giving error while startup -

Image
i have installed aws toolkit on eclipse mars. when restarted eclipse, giving me below error. idea issue? "internal error when starting aws toolkit plugin. unable load credentials profile [default]: aws access key id not specified." i tried configure aws toolkit preference. page coming blank. it caused aws access id , secret key not setup. can delete c:\users\uername\.aws folder , restart eclipse, ask again put in credential.

android - Using RxJava to chain request on a single thread -

i'm saving user's location in app local database , send server. once server return success, delete location sent. each time point has been saved in database call method: public void sendpoint(){ amazonretrofit.postamazonpoints(databasehelper.getpoints()) .map(listidssent -> deletedatabasepoints(listidssent)) .dooncompleted(() -> emitstorechange(finalevent)) .observeon(androidschedulers.mainthread()) .subscribeon(androidschedulers.from(backgroundlooper)) .subscribe(); } i query database point send server i received server list of point sent using .map() , gather point sent , delete them local database sometimes, happens call method repeatedly without having wait previous request completed , deleted point sent. so, when call method again, post same point previous request because previous request isn't completed yet haven't deleted point using .map() yet. causing server receive duplicate

sql - How to insert a null value to the database? -

my query doesn't work. says there syntax error near null keyword . dont know how fix it. want insert empty string or null database . how can it? query insert [remarks] values((select top 1 ref_no a_master order ref_no desc ), (select top 1 current_dept a_master order ref_no desc ),'630590', getdate()), null inner queries work without error. you miss placed close brackets,it should this.. insert [remarks] values((select top 1 ref_no a_master order ref_no desc ), (select top 1 current_dept a_master order ref_no desc ),'630590', getdate(), null) in query u referred same table twice 2 column. you can write like.. insert [remarks] select top 1 ref_no,curent_dept '630590',getdate(),null a_master order ref_no desc since both columns same table..

angularjs - ng-filter with filter is not filtering -

hi i'm trying filter list of objects in array , displaying it. filtering based on users input input field. i've had @ number of questions on stackoverflow, feel different- since data in array. html: <body ng-app="myapp"> <div ng-controller="myctrl"> <form class="form-inline"> <input ng-model="search" type="text" placeholder="filter by" autofocus> </form> <div ng-repeat="f in feedbacklist | filter:search "> <div>{{f.jobid}}</div> </div> </div> </body> js: var app = angular.module("myapp", []); app.controller("myctrl", function($scope) { $scope.search = ""; $scope.feedbacklist = [ { jobid: "1432", feedbackid: "342342", profileurl: "assets/img/profiles/avatar_small2

android - Tablayout tab with multiple fragment -

i working on app use tab layout 5 tabs. need navigate multiple fragment inside every tab, , open first fragment when user again reselected tab. please me. tablayout tablayout = (tablayout) findviewbyid(r.id.tablayout); tablayout.addtab(tablayout.newtab().seticon(r.drawable.scene_tab_selector)); tablayout.addtab(tablayout.newtab().seticon(r.drawable.my_scene_tab_selector)); tablayout.addtab(tablayout.newtab().seticon(r.drawable.conversation_tab_selector)); tablayout.addtab(tablayout.newtab().seticon(r.drawable.notification_tab_selector)); tablayout.addtab(tablayout.newtab().seticon(r.drawable.more_tab_selector)); tablayout.settabgravity(tablayout.gravity_fill); final viewpager viewpager = (viewpager) findviewbyid(r.id.pager); final pageradaptor adapter = new pageradaptor (getsupportfragmentmanager(), tablayout.gettabcount()); viewpager.setadapter(adapter); viewpager.addonpagechangelis

javascript - Showing loader.gif with getJSON -

i want use loader gif while retrieving data through ajax getjson. have not found proper solution yet. have used $("#loader").show(); , $("#loader").hide(); starts page loads. want work when click search button. suggestion highly appreciated. here html codes: <div class="container"> <div id="wrapper"> <section id="gallery"> <input type="text" id="kunde" placeholder="search name or id." /> <di id="loader"><img src="loader.gif"/></di> <button id="buton" type="button" class="btn-style" value="search" onclick="find();">search</button> <button id="button" class="btn-style">clean results</button> </section> <ul id="list"><li> </l

ios - I need to fetch a JSON in a URL -

i read url loading system: https://developer.apple.com/library/ios/documentation/cocoa/conceptual/urlloadingsystem/urlloadingsystem.html#//apple_ref/doc/uid/10000165i can't figure out class use , how use it. errorsreenshot i suggest using third party framework alamofire native swift networking rather complicated, beginners, because swift type-safe language , json object can have nesting etc. can seen after fetching of object. the thing alamofire can installed cocoapods , actively being developed. here example of request made alamofire's 4.0 version swift 3 fetch json object url called yoururl: alamofire.request("https://yoururl").responsejson { response in print(response.request) // original url request print(response.response) // http url response print(response.data) // server data print(response.result) // result of response serialization if let json = response.result.value { print("json: \(json)") // json

javascript - Call to a function within $get of Provider modules causes TypeError -

this provider. app.provider('cloudinarydetails', function(cloudinaryprovider){ function setcloudinarydetails(cloudinarydetails){ cloudinaryprovider.configure({ cloud_name: cloudinarydetails.cloud_name, api_key: cloudinarydetails.api_key }); } this.$get = function($http){ return { initialize: function(){ return $http.get('path/to/api').then(function(response){ setcloudinarydetails(response.data); }); } }; }; }); i calling initialize function in config module app.config(function(cloudinarydetailsprovider){ cloudinarydetailsprovider.initialize(); }); console error: [$injector:modulerr] failed instantiate module app due to: typeerror: cloudinarydetailsprovider.initialize not function

SQL: How do you count the number of unique records? -

i'm new sql , sorry if q has been asked before - couldn't phrase properly. say have table looks this: name call id sally 1 sally 2 sally 3 mike 4 mike 5 bob 6 bob 7 i want create new table looks this: name no. of calls sally 3 mike 2 bob 2 attempt i assume like: select name, count(distinct name) no. of calls table thanks. you need group them , that's all. select name count(*) [no. of calls] table group name

Date: Date type in csv is uploaded as integer in R -

i had uploaded csv containing date column. when did read.csv( ) in r , checked typeof columns, displays columns integer type. able convert character types using : as.character(mydata$col3) when trying similar date (values as- 17-jan-95) as: as.date(mydata$col5,"%y%m%d") the values returned are: please suggest correct approach modifying datatype. try this strptime(mydata$col5, '%d-%b-%y')

c - Compilation errors when using GTK2+ with OpenGL? -

i writing c program makes use of fixed pipeline opengl , freeglut. however, use complete toolkit gtk+ instead of freeglut. cannot use gtk3+ not compatible old opengl code, use gtk2+. i found this link example program called simple.c : #include <math.h> #include <gtk/gtk.h> #include <gl/gl.h> #include <gtkgl/gtkglarea.h> int init (gtkwidget *widget) { if (gtk_gl_area_make_current (gtk_gl_area(widget))) { glviewport(0,0, widget->allocation.width, widget->allocation.height); glmatrixmode(gl_projection); glloadidentity(); glortho(0,100, 100,0, -1,1); glmatrixmode(gl_modelview); glloadidentity(); } return true; } int draw (gtkwidget *widget, gdkeventexpose *event) { if (event->count > 0) return true; if (gtk_gl_area_make_current (gtk_gl_area(widget))) { glclearcolor(0,0,0,1); glclear(gl_color_buffer_bit); glcolor3f(1,1,1); glbegin(gl_triangles); glvertex2f(10,10); glvertex2f(10,90); glvertex2f(90,90); glend

Running GDB on C++ application from a Python Script (Automation) -

i'm encountering quite big frustration 1 of tasks. we're automating of our processes , there's step. run gdb command on backed core files. command rather simple: gdb --batch --quiet -ex "set logging overwrite on" -ex "set logging file gdb.out" -ex "set pagination off" -ex "set logging on" -ex "pwd" -ex "run" -ex "backtrace full" -ex "info registers" -ex "info threads" -ex "thread apply backtrace full" -ex "set logging off" -ex "quit" binary core now there echo in there make file more readable -ex "echo \n\nstuff:\n"... can imagine. while command works flawlessly when executed manually terminal window, have perform python script. thought use subprocess module aid: subprocess.popen(['gdb', '--batch', '--quiet', '-ex', '"set logging overwrite on"'...], binary, core) when run however, com