Posts

Showing posts from September, 2010

Vim key mapping for emmet-vim -

ok here want accomplish: in insert mode emmet autocomplete tab key here have tried let g:user_emmet_expandabbr_key = '<tab>' (only works in normal mode) though above code useful, need work in insert mode i transferring on sublime text vim , miss having emmet functionality accessible. ideas how can achieve this? thanks in advance. solved problem including following lines in .vimrc file. let g:user_emmet_expandabbr_key='<tab>' imap <expr> <tab> emmet#expandabbrintelligent("\<tab>") now can use tab key both indent , activate emmet snippets in insert mode :d

javascript - How do I delete a key-value pair using Cradle in CouchDB/Node.js? -

i've been working lot cradle, couchdb client. however, have document filled key-value pairs, , i'm trying delete specific row in there. in documentation, cannot find way deletion doesn't include deleting entire document or updating null value. can point me in right direction? feel simple issue lots of people run into. in couchdb, there no support partial document updates (support discussed every once in while, since there no accepted way patch json, never gets far), have update entire document copy unwanted key/value pair removed.

mysql - Find all employee who have worked on at least two projects -

table: projectressources idproject idemployee numhours priceperhr 1 1876 500 65 1 4354 2000 31 2 2231 250 55 3 2231 500 65 3 1212 3000 35 3 1876 2000 35 i come following research syntax can't figure how filter indicate 2231 , 1876: select idemployee, count (*) ‘number of projects’ projectressources group idemployee; you're headed in right direction. missing piece having clause allows filter aggregate expression, such count(*) : select idemployee, count (*) ‘number of projects’ projectressources group idemployee having count(*) > 1 -- here!

c++ - Cartesian to quaternion glm -

i have vector pointing in direction need rotate, need convert quaternion first. cannot find converting cartesian coordinates quaternions in glm. such function exist? maybe these out. can found on website in api documents v0.9.6: glm_func_decl tvec4<t, p> glm::rotate( tquat<t,p> const &q, tvec4<t,p> const &v ) rotates 4 components vector quaternion. see glm_gtx_quaternion glm_func_decl tquat<t, p> glm::rotation( tvec3<t,p> const &orig, tvec3<t,p> const &dest ) compute rotation between 2 vectors. param orig vector, needs normalized param dest vector, needs normalized see glm_gtx_quaternion and template<typename t, precision p> glm_func_decl tvec3<t,p> rotate( tquat<t,p> const &q, tvec3<t,p> const &v ) template<typename t, precision p> glm_func_decl tvec4<t,p> rotate( tquat<t,p> const &q, tvec4<t,p> const &v ) template<t...

cmake - How to use clang to generate all ast files for a project with makefile or cmakelist? -

i have developed static analyze tool based on clang reads ast files generated clang -emit-ast option , analysis on them. when testing tool, it's convenient generate ast files multiple c or cpp files. can use command 1 one: clang -emit-ast test.c -o test.ast but when comes large project build make or cmake, don't know how can generate ast files. there convenient way manage that? you can use add_custom_target cmake. something this: add_custom_target(ast) foreach(sourcefile ${sourcefiles}) add_custom_command(target ast pre_build command clang -emit-ast ${sourcefile} -o ${cmake_binary_dir}/${sourcefile}.ast)

How to update URL in redux simple router from action? -

according redux simple router docs, can update route action. don't see how in documentation. have example of this? you can import history singleton passed root component action , operate on directly, or, if you've installed router middleware, can use action creators provided react-router-redux . from docs : what if want issue navigation events via redux actions? react router provides singleton versions of history (browserhistory , hashhistory) can import , use anywhere in application. however, if prefer redux style actions, library provides set of action creators , middleware capture them , redirect them history instance. import { routermiddleware, push } 'react-router-redux' // apply middleware store const middleware = routermiddleware(browserhistory) const store = createstore( reducers, applymiddleware(middleware) ) // dispatch anywhere normal. store.dispatch(push('/foo')) the following actions supported : push(l...

php - Array push to end keeping format -

i'm making automated system send out emails. have array containing info registered users: email , forum name/nickname: $array = [ ['jane.apples@gmail.com', 'jane apples'], ['jdoe@gmail.com', 'john doe'], ]; to send emails uses each loop: foreach ($array list($email, $name)) { echo "$email&nbsp;&nbsp;&nbsp;$name<br>"; } this yield: jane.apples@gmail.com jane apples jdoes@gmail.com john doe in final code this: foreach ($array list($email, $name)) { email($email, $name); } also, please note array in different file like: array.php , include file. please me this, , in advance. update: i've found solution while messing around little bit here code: <?php $result = array(); $file = fopen("mail.txt", "r"); while(!feof($file)){ $line = fgets($file); list($email, $name) = explode(":", $line); echo $email . ':' . $name .'...

php - Codeigniter ajax get data from mysql and display in html form -

i have list of names display , when user clicks on edit, opens dialog html form. form show values of data retrieved mysql table. confused how can achieve that. have far. view <table class="table"> <thead> <tr> <th>no.</th> <th>organisation</th> <th>first name</th> <th>last name</th> <th>privilege level</th> <th>date added</th> <th></th> <th></th> </tr> </thead> <tbody> <?php $offset = $this->uri->segment(4,0)+1; ?> <?php foreach($user $row): ?> <tr data-id="<?php echo $row->id; ?>"> <td><?php echo $offset++; ?></td> <td><?php echo $row->company; ?></td> <td><?php echo $row->firstname; ?></td> <td><?php echo $row->lastname; ?></td> <td><?php echo $row->privilege; ?></t...

java - jdb stop at given line or method -

as cli-inclined programmer, i'd ask if java command line debugger jdb capable of running current position , stopping @ given line? for instance, 200 public trade create(tradecreatereq req) { 201 validatepayments(req); 202 => trade t = new trade(outbiztype.of(req.getoutbiztype()), req.getouterid()); 203 204 builditem 205 .andthen(buildbuyer) 206 .andthen(buildtoaddress) 207 .andthen(buildinvoice) 208 .andthen(buildpaytools) 209 .accept(req, t); 210 211 if (!t.issecured()) 212 t.setsecured(true); 213 214 return t; 215 } i'd advance line 211 single jdb command rather typing 7 'next' commands or set break point @ 211. cursory @ 'step', 'next', 'cont' not give me answer. i know perl cli debugger can job nicely 'c' command. thanks! read documentation: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb...

math - Java method Point rot90() -

i trying figure out how implement following method in java; ** point rot90()** query new cartesian point equivalent cartesian point rotated 90 degrees i have no idea how go creating method. however, believe pulling point (x,y) , outputting new point (y,x*-1) equivalent rotating 90 degrees. old y coordinate becomes nee x coordinate , new y coordinate old x coordinate multiplied negative 1. thoughts on how set method appreciated. thanks. this have far public point rot90(){ point rotated = new point(); rotated.ycoord = xcoord*-1; rotated.xcoord = ycoord; return rotated; } i know doesn't work pointed out when try compile it. suggestions? your method needs argument. public point rot90(point p){ point rotated = new point(); rotated.ycoord = -p.xcoord; rotated.xcoord = p.ycoord; return rotated; } if point class has constructor can take coordinates can make shorter. public point rot90(point p){ return new point(p.ycoord, -p.xco...

node.js - How do I upgrade my npm installation? -

i've been unable upgrade npm installation. i tried installing new version of npm : 1.step npm install npm -g npm install npm --save-dev 2.step npm outdated package current wanted latest npm 3.5.3 3.5.4 3.5.3 package.json { "name": "tiko", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"error: no test specified\" && exit 1" }, "author": "", "license": "isc", "devdependencies": { } } npm update npm warn ebundleoverride replacing bundled node_modules\npm\node_modules\init-pa ckage-json new installed version npm warn ebundleoverride replacing bundled node_modules\npm\node_modules\npm-ins tall-checks new installed version npm warn ebundleoverride replacing bundled node_modules\npm\node_modules\node-gy p n...

design - SQL - Chat database schema to delete conversation for one side or both -

i designing chat database next requirements: only private messages, b. no groups nor rooms. when user send message b, if user deletes conversation, user b still able view conversation until user b deletes it. messages not erasable individually. able delete full history conversation. and have this: when user send message user b, 1 message register created, id. foreign key conversation table. in conversation table, 2 registers created same message id. 1 user sends message, , other user receives message. each register has field called in-out, specify if message send or received. example: /* conversation_table messages_table +--------------------------------------------+ +----------------------------------------+ | user_id | participant_id | in-out | msg_id | | msg_id | body | +--------------------------------------------+ +----------------------------------------+ | | b | 0 | 101...

how to get currency sign to display in a view panel xpages -

i have column in xpage want display currency symbol value. in underlying notes view displaying. have tried both view panel , dynamic view neither display $ symbol. displays number. if integer number ($100.00) displays 100. want display trailing zeros after decimal place along currency symbol in view control can set view column's "display type" "number" , "display format" "currency". enable set currency symbol of choice , format accordingly. view column's code this: <xp:viewcolumn columnname="price" id="viewcolumn4"> <xp:this.converter> <xp:convertnumber currencysymbol="$" minfractiondigits="2" type="currency"></xp:convertnumber> </xp:this.converter> <xp:viewcolumnheader value="price" id="viewcolumnheader4"></xp:viewcolumnheader> </xp:viewcolumn> in above example price stored number. ...

terminal - Vim: Difference between t_Co=256 and term=xterm-256color in conjunction with TMUX -

i testing various different terminals tend use ssh linux boxes have tmux set on. basically noticed behavior, , hoping offer explanation of what's going on. may case specific behavior affects prompt app. i using vim within tmux, , on panic's prompt app on iphone5 having behavior 256 colors not enabling when .vimrc set colors using set t_co=256 directive. here, vim correctly displaying colors when not run through tmux. also, os x's terminal.app correctly rendered colors (i did not test putty on windows unfortunately) vim in tmux. then swapped out set t_co=256 set term=xterm-256color , colors work when using vim through tmux. note tested both set -g default-terminal "xterm-256color" , set -g default-terminal "screen-256color" settings tmux , change had no effect on behavior. when don't use tmux or screen , need configure terminal emulators advertise "capable of displaying 256 colors" setting term xterm-256color or...

About moving transparent, boderless wpf c# -

Image
i making window windowstyle="none" allowstransparency="true" background="transparent" windowstartuplocation="centerscreen" resizemode="noresize" then made button other move window, using this.dragmove(); , put event: mousedown (of button), leftbutondown (of button) , leftbutondown (of form), still can not move form. function: private void btcurdate_mousedown(object sender, mousebuttoneventargs e) { this.dragmove(); } (the button defined click event else). running form:

memory - Accessing the vm areas of a process -

i trying write lkm have read vm areas address process. using pid_task() pointer task_struct, getting compiling error when try use start address of vmarea. struct task_struct *ts; ts = pid_task(find_vpid(pid_t)pid,pidtype_pid); printk(kern_info "%lu",ts->mm->mmap->start); and getting error "error: dereferencing pointer incomplete type" i linux noob , noob in lkm. i'd appreciate help. thank i have test on kernel source tree(2.6.35) following codes, compilation okey: struct task_struct *ts; pid_t pid; ts = pid_task(find_vpid(pid),pidtype_pid); printk(kern_info "%lu",ts->mm->mmap->vm_start); could try above codes in kernel source tree? think maybe have include header files needed, such as: #include <asm/uaccess.h> #include <linux/errno.h> #include <linux/time.h> #include <linux/proc_fs.h> #include <linux/stat.h> #include <linux/init.h> #include <linux/capability.h> #i...

angular - Angular2 Exception: TypeError el.createShadowRoot is not a function (Safari/Edge) -

Image
i have angular2 app works great in chrome , firefox, in safari error: typeerror el.createshadowroot not function and in edge: object doesn't support property or method 'createshadowroot' @ browserdomadapter.prototype.createshadowroot ( http://localhost:5000/lib/angular2/bundles/angular2.dev.js:22893:7 ) more edge: is there shim or polymer missing? createshadowroot() should called if use viewencapsulation.native . either use viewencapsulation.emulated or ensure polyfills loaded (i can't guide how, because don't use ts toolchain, dart)

php - How to change the wordpress footer background color? -

i creating website in wordpress. using lifeline webanine charity theme. header style using header social icon.i trying change both background color of top bar , footer black other color. can me out? code of header , footer given bellow header.php <?php $settings = get_option( sh_name ); ?> <!doctype html> <html <?php language_attributes(); ?>> <head> <?php echo ( sh_set( $settings, 'site_favicon' ) ) ? '<link rel="icon" type="image/png" href="' . sh_set( $settings, 'site_favicon' ) . '">' : ''; ?> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title> <?php if ( is_home() || is_front_page() ) { echo get_bloginfo( 'name' ); } else { wp_title( '' ); } ?> </title> <meta name="viewport" content=...

How can I format a negative currency using a Thymeleaf attribute processor? -

i need display negative currency-formatted values in table, using thymeleaf. currently, i'm using #numbers.formatdecimal achieve this, follows: <td th:text="${'$' + #numbers.formatdecimal(value, 1, 'default', 2, 'default)}" /> for value greater zero, works fine: <td>$34.50</td> but negative value , get: <td>$-12.75</td> this isn't correct - need currency symbol moved right of minus sign. how can achieve this? personally i'd use decimalformat apply formatting need: <td th:text="${new java.text.decimalformat('$#,##0.00;$-#,##0.00').format(value)}" />

javascript - Hide clicked element and show the element right after it using jQuery -

i want put questions in html text, answers hidden until user clicks on button/link/etc, disappears, , showing answer. answer replaces space used disappearing button/link. have questions go down page in article, not one. so example, "[my thoughts]" button or link: text text text abc need anything? [my thoughts] text text text, text, text. clicking on [my thoughts] becomes: text text text abc need anything? abc needs a lot of def, , abc if things taken slowly. additionally, abc needs lot of sleep. text text text, text, text. per comment: closest thing found, isn't right, want keep using going down page: thanks per gothdo, i'm working with: <!doctype html> <html> <head> <title>test3</title> <script> $("button").click(function() { $(this).hide(); $(this).next().css("visibility", "visible"); }); </script> <style typ...

java - for(i=center && j=center;i>=center && i<n- 1 && j>=center && j<n-1;i++ && j--) -

please tell if can give multiple condition in loop. in above statement giving error as: for(i=center && j=center;i>=center && i=center && j ^ 1 error: java.lang.runtimeexception: /eightieskids4.java:23: error: not statement if i & j aren't defined: for(int i=center, j=center; // pre-condition >= center && < n- 1 && j < n-1; // condition i++, j--) // post-condition

excel - Get Worksheet_change event to execute macro automatically -

i have macro (applyfilter) filters through many worksheets based on date enter cell b1 on worksheet (grand totals). macro is: sub applyfilter() 'filters worksheets except worksheet1 date entered _ 'grand totals!b1 dim ws_count integer dim integer dim filterrange variant filterrange = range("'grand totals'!b1") ' set ws_count equal number of worksheets in active ' workbook. ws_count = activeworkbook.worksheets.count ' begin loop. = 2 ws_count sheets(i).select activesheet.autofiltermode = false 'remove existing filters worksheets(i).range("a2").autofilter field:=1, criteria1:=range("'grand totals'!b1").text next sheet1.activate end sub when execute macro manually, executes , filters should. however, when call macro sub: sub worksheet_change(byval target range) if not intersect(target, me.range("b1")) nothing _ call applyfilter end sub i "macros" ...

ruby on rails - What are the methods to ask user continue to fill the missing information contact -

i installed facebook omniauth sign , when can subscribe no informations stocked in computer. wanna asked people complete subscribe send directly user @ contact form fill complementary information. i don't know method call right link? thank answer. enter image description here its calling validation check link below in model validates :name, presence: true more info validation in rails

css - what is my mistake about making responsive? -

i started making html code responsive, face white problems, example footer has background white 4 columns,i think problem used background footer don't know how make responsive. h4 { font-size: 16px !important; font-family: 'open sans', sans-serif; font-weight: bold; color: white; } .font-icon { float: left; color: white !important; padding: 0 15px 0 0; font-size: 25px !important; } .font-icon:hover { color: #80878e !important; } .footercol p { color: white; } .footercol:nth-child(2) span { display: block; } .footercol { float: left; } .footercol li, .footercol span, .footercol { color: #80878e; font-...

Javascript ELSE statement running regardless of IF statement -

very simple snippet of code (i'm new programming), , i'm stumped. why console returning 0 each iteration through loop, regardless of whether if statement true or not? for example, if statement runs, finds match , writes 1 console, else statement runs too, resetting variable "count". //snippet of array of objects, program searches through var students = [ { name: 'dave', track: 'front end development', achievements: 158, points: 14730 }, { name: 'john', track: 'full stack', achievements: '24', points: '2450' } ]; //declaring variables var message = ''; var student; var count = 0; var name; var search; while (true) { search = prompt("enter name see report, or type 'quit' exit."); if (search.touppercase() == 'quit' || search.touppercase() == null) { console.log(8); break; } for (i = 0; < stud...

java - Android querying data from azure mobile services -

i fine inserting data azure mobile services, having trouble querying data once input it. this how inserting data azure mobile services , works fine: public class register extends activity implements onclicklistener{ @override protected void oncreate(bundle savedinstancestate) { success = json.getint(tag_success); if (success == 1 && password.equals(con)) { log.d("user created!", json.tostring()); // save new user data parse.com data storage parseuser user = new parseuser(); user.setusername(username); user.setpassword(password); user.setemail(email); final item myitem = new item(); myitem.id = username; myitem.text = "test program"; myitem.complete = false; ...

Using - in REGEX mySQL query -

i'm trying create query in mysql , can match: a-z 0-9 _ - . / thus far, have: update errors set been_checked = 1 binary(request) regexp "^[a-z0-9_./]+$" , been_checked = 0 this works, don't have - 1 of characters. so, i'm trying: update errors set been_checked = 1 binary(request) regexp "^[a-z0-9_-./]+$" , been_checked = 0 ...but gives me error: error: not execute query: failed execute query: 'update errors set been_checked = 1 binary(request) regexp "^[a-z0-9_-./]+$" , been_checked = 0': got error 'invalid character range' regexp i've tried using \- , doesn't work either. how use - part of matching string? thanks you need put hyphen @ start or end of character class or escape it. [-a-z0-9_./] else hyphen indicates character range inside class.

nginx location with multiple subdirectories (django i18n) -

i got server, use django i18n few languages, can't make nginx serve directories using same location thing. location /(fr|en|ko|de)/ { proxy_pass http://127.0.0.1:8005; proxy_set_header x-forwarded-host $server_name; proxy_set_header x-real-ip $remote_addr; add_header p3p 'cp=all dsp cor psaa psda our nor onl uni com nav"'; } but doens't work , doesn't serve request urls. the solution seems work 1 make 4 location block, can't best solution... so, real solution ? you have confused syntax prefix location , regular expression location. you need specify group of languages , therefore require regular expression. the correct expression this: location ~* ^/(fr|en|ko|de)/ { ... } see this document details.

javascript - how to set a default value(dollar or euros) in input text -

i need put measuring unit (€, $) in text field default, targets number , appear. how can it? there default value this? thank you example is expect.try this. <input type="text" value="$"/> if want both use this <input type="text" value="$,&euro;"/> hope you

sms - how to fetch draft in android programmatically -

i want fetch draft in android phone. i find sample draft massages use below address. getcontentresolver().query(uri.parse("content://mms-sms/canonical-address"), null, null, null, null); i hadn't result below uri , had exception: content://sms/draft i've tested on android 5.1 , had iillegalexception don't know wrong. i've tested in lg g4(android 5.1) , nexus 4 avd(android 4.2.2) how can access drafts columns in android , body , number? is there problem android version? thanks tips.

ios - how to move view upside while entering any text in input field -

i have app want when user enters data view should slide up. writing code code works fine in app not working in app.i following same way. -(void)showanimationback{ nslog(@"back animation working"); [uiview animatewithduration:0.5 animations:^{ self.subviewland.frame = cgrectmake(0,-10,1024,768); }]; } -(void) showanimationpests{ nslog(@" animation working"); [uiview animatewithduration:0.5 animations:^{ self.subviewland.frame = cgrectmake(0,-200,1024,768); }]; } - (void)textfielddidbeginediting:(uitextfield *)textfield { [uiview beginanimations:nil context:null]; [uiview setanimationduration:0.5]; self.subviewland.frame = cgrectmake(0,-200,1024,768); // or self.view.frame = cgrectmake(0,-200,1024,768); [uiview commitanimations]; } - (void)textfielddidendediting:(uitext...

c++ - Converting member function pointer to string -

i have class consists of function. need call function periodically. 1 timer callback api there of form mentioned below: timer(&obj,&class::func,time) so if attach member function api, called periodically. there wrapper api accepts arguments string. need pass every argument string , necessary parsing , call actual api. so want first convert object address , member function address string , use in project. can me giving sample code this. you cannot convert member function string , use @ all. there few way convert type or expression string, typeid , works in way, not in opposite. there no native way in c++ convert string member function address. however, can make associative container (like std::map ) associating strings member function pointers, , use wrapping , unwrapping.

jquery - Copy <img> from a <ul> to a <div> -

i want grab images <ul> . <ul class="tslider"> <li> <div class="user_img"><img src="01.png" /> </div> </li> <li> <div class="user_img"><img src="02.png" /> </div> </li> <li> <div class="user_img"><img src="03.jpg" /> </div> </li> </ul> and put them in corresponding <div> class bx-pager-item . <div class="bx-pager bx-default-pager"> <div class="bx-pager-item"><a class="bx-pager-link" data-slide-index="0" href="">1</a></div> <div class="bx-pager-item"><a class="bx-pager-link" data-slide-index="1" href="">2</a></div> <div class="bx-pager-item"><a class="bx-pager-link" ...

How to go to the last pagination page in CakePHP 3 -

in cakephp 1.3 go last pagination page adding parameter page:last . i tried use ?page=last in cakephp 3.0 not work. how can accomplish this? the functionality mention removed in cakephp 2.0. in cakephp 3.x, create link within view, can call $this->paginator->last($last = 'last >>', $options =[]) to obtain last page within controller, can access following property: $this->request->params['paging']['pagecount'] edit a possible workaround accept page:last add following @ beginning of action: public function index() { // detect page:last if (!empty($this->request->params['named']['page'] && @$this->request->params['named']['page']=='last')) { $this->paginator->paginate(); $this->request->params['named']['page']=$this->request['paging'][$this->modelclass]['pagecount']; } //rest ...

ios - How to stop multiple method callings on tap of first push notification (multiple push notifications coming)? -

when multiple messages sent device, push notifications received. case 1: single message sent, single notification received , single calling of method handling notification. works fine. case 2: multiple notifications received , multiple calling of method occurs on tap of first notification (on quick tap of first notification). how prevent method getting called multiple times when notification tapped? - (void)application:(uiapplication*)application didreceiveremotenotification:(nonnull nsdictionary *)userinfo { nsdictionary *dicttopass = userinfo[@"aps"]; if([dicttopass[@"oid"] isequaltostring @"callmethod1"]) { // call method 1 } else if([dicttopass[@"oid"] isequaltostring @"callmethod2"]) { // call method 2 } }

javascript - How to get Parse objectId of clicked item on ion-item -

hi i'm new ionic framework , angularjs. i've learnt use parse storing data. have made code displaying items parse query ion-item using ion-item ng-repeat. here view code : <ion-item ng-repeat="trip in trips.results" ng-click="getdetail()"> <h2 >{{trip.attributes.title}}</h2 > <p><span am-time-ago="trip.attributes.created"></span></p> <p>{{trip.attributes.owner}}</p> </br> <p>{{trip.attributes.location}}</p> <p>{{trip.attributes.price}} <!--| currency:"rp"--></p> </ion-item > service trip : app.service("tripservice", function ($q, authservice) { var self={ 'load': function () { self.isloading = true; var d = $q.defer(); // initialise query var trip = parse.object.extend("trip"); var tripquery = new parse.query(trip); tripquery.descending('created'); ...

curl - FindCURL doesn't support using CURL_ROOT variable -

when used gtest library on cmake, use gtest_root finding root path of gtest. however, cannot use curl_root use curl, because findcurl.cmake doesn't variable. how can do? use cmake_prefix_path variable. may use semicolon( ; ) multiple paths. on script: set (cmake_prefix_path c:/libraries/gtest;c:/libraries/curl) find_package (gtest required) include_directories (${gtest_include_dirs}) find_package (curl required) include_directories (${curl_include_dirs}) on console: cmake .. -dcmake_prefix_path=c:/libraries/gtest;c:/libraries/curl

wordpress - Could not locate API; are you sure it's enabled? - WP REST API oAuth1 -

i getting: "could not locate api; sure it's enabled?" when try link client wordpress via wp rest api . i have installed & activated necessary plugins , dependencies, including (wp-rest api, oauth1 etc). when try head http://mywebsitelink , returns link wp-json indicates wp-api working. also, when try wp oauth1 add , works fine , generates key , secret. any suggestion on how fix issue? in advance. if using client cli package connect client wp rest api please informed latest version of oauth1.0a plugin doesn't work client cli package. however, can use http client generate token credentials , connect server using oauth1.0a plugin.

python - Importing third-party modules within a virtualenv -

following trouble described here trying install older wpython inside virtualenv, downloaded dmg directly in browser, , (after needing right-click on .pkg), got installed. when open intepreter, confirm can import wx . yet when recreate virtualenv , activate it, , open intepreter: (venv)macbook-pro-de-pyderman:projet pyderman$ python python 2.6.6 (r266:84374, aug 31 2010, 11:00:51) [gcc 4.0.1 (apple inc. build 5493)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import wx traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named wx is there step missing respect being able import third-party modules within virtualenv ? you should try creating virtualenv --system-site-packages option. allow access packages installed @ system level, ones install dmg image.

simple form - Add character counter in simple_form in Ruby on Rails -

i use simple_form gem , want simple character counter on text field. told, might work: add form: <%= f.input :body, id: "body-field" %> <span id="body-count">0 characters</span> and javascript: $("#body-field").on("keyup", function(){ length = $(this).val().length; $("#body-count").html(length); }); i got information here (attention: full of advertisement): http://www.sohua.xyz/questions-full/4320915/how-do-i-implement-a-basic-character-counter-in-a-simple-form i did this, nothing happens. here actual code chapters/new.html.erb: <%= simple_form_for([@book, @book.chapters.build]) |f| %> <%= f.input :chaptertitle %> mininmum amount of characters: <%= @book.min_length %> maximum amount of characters: <%= @book.max_length %> <%= f.input :chaptercontent, id: "body-field" %> <span id="body-count">0 characters</span> <%=...

ruby on rails - Form_for "First argument in form cannot contain nil or be empty" error -

i cannot figure out why i'm getting error, , means. first argument in form cannot contain nil or empty(line 3) add new post <%= form_for @post |f| %> //error here <p> <%= f.label :title, 'title' %><br/> <%= f.text_field :title %><br/> </p> <p> <%= f.label :content, 'content'%><br/> <%= f.text_area :content %><br/> </p> <p> <%= f.submit "add new post" %> </p> <% end %> controller: class postscontroller < applicationcontroller def index @posts = post.all end def show @post = post.find(params[:id]) end def new @post = post.new end def create @post = post.new(params[:post]) if @post.save redirect_to posts_path, :notice => "your post saved" else render "new" end end def edit ...

mysql - My php loop is looping 11 times, instead of one. Cant find the bug -

here php code. functions require, query , render given us. <?php // configuration require("../includes/config.php"); $rows = cs50::query("select `symbol`, `shares`, `cash` `portfolios`, `users` ?", $_session["id"]); $positions = []; foreach ($rows $row) { $stock = lookup($row["symbol"]); $total = ($stock["price"] * $row["shares"]); if ($stock !== false) { $positions[] = [ "name" => $stock["name"], "price" => $stock["price"], "shares" => $row["shares"], "symbol" => $row["symbol"], "total" => $total, "cash" => $row["cash"] ]; } } // render portfolio render("portfolio.php", ["positions" => $positions, "title" => "portfolio"]); here html...

php - User Online Remains 1 -

everything working , communicating database regardless of how many users online stays 1 i have helper functions created num rows , query online users function users_online(){ $session = session_id(); $time = time(); $time_out_in_seconds = 60; $time_out = $time = $time_out_in_seconds; $sql = "select * users_online session = '$session'"; $result = query($sql); $count = row_count($result); if ($count == null) { $sql= "insert users_online(session, time) values ('$session','$time')"; query($sql); } else { $sql= "update users_online set time = '$time' session = '$session'"; query($sql); } $sql = "select * users_online time > '$time_out'"; return $count_user = row_count($result); } db config helper functions $connection = mysqli_connect('localhost', 'root', '', 'da...

php - Storing Session data Fails, due to a following redirect -

i want store session data right before 302 redirect occurs, same page, without of original request parameters. for example: visitor goes domain.com/?ab_saveme=hey hey value stored visitor redirected domain.com/ page output hey this code came with, redirect, doesn't manage store value ( hey not being outputed). without redirect block, store correct. <?php session_start(); session_name("hello"); $_session['cache']=$_get['ab_saveme']; // store `saveme` value // begin self redirect code function unparse_url($parsed_url) { $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; $pass ...

c++ - How to check the compiler settings are correct or not in windows? -

i need check weather compiler has correct settings or not , purpose using cpp unit test cases , verifying settings correct or not.compiler settings concerned e.g 64 bit compiler 64 bit code exist , 32 bit compiler 32 bit code exists should not code supposed have 64bit compiler , executed on 32 bit compiler , if happens,a cpp unit test case shall check , fail. there can other condition version of compiler needs , code opened on different compiler version , cppunit test case shall fail. idea if in case of compiler related failure 1 should know , more clearity issue. @ runtime code not executed throwing errors e.g the application unable start correctly (0xc000007b). its because code actualy has executed 64 bit configurations , executed 32 bit configurations in such case there shall test case checking configurations , hence fail , user have ease know actualy went wrong such errors @ runtime quite pain analyze , resolve. so, whole idea make ease in getting knowing runtime error ca...

c# - How to get a MenuItem from within its CanExecute handler? -

how can access related menuitem ? has been created on fly, cannot use name in xaml file. private void menuitem_canexecute(object sender, canexecuteroutedeventargs e) { var snd = sender; // main window var orgsource = e.originalsource; // richtextbox; var src = e.source; // usercontrol // think must use command, how? routedcommand routedcommand = e.command routedcommand; } you can pass commanding ui element command binding commandparameter property, like <menuitem ... commandparameter="{binding relativesource={relativesource self}}"/> now can access menuitem parameter property of canexecuteroutedeventargs: private void menuitem_canexecute(object sender, canexecuteroutedeventargs e) { var menuitem = e.parameter menuitem; ... }

python - Find a value in a dictionary by searching using an inexact / not complete string -

hi i'm learning python , i'm facing problem dictionaries: i made dictionary contains shows , number of seasons have all_shows = {'modern family': 3 , 'how met mother': 9 , "modern world" : 12 } and made possible user number of season searching name of show showname = input('<<enter show: >>') season = (all_shows.get(showname)) print (season) the problem number of season returned if user writes exact name of show. i'm trying fix if user write "modern" shows "modern" in title ( if write in lower case) , can select show 1 wants. i looked online , found fuzzywuzzy. think me achieving want? thought using similar show title 1 selected, if wrote " how met mother " result still " 9 " , if wrote " modern " list follow select shows contains "modern" 1 wants. is fuzzywuzzy looking or there other ways that? regular expressions friends. import re all_s...

C syntax understanding - parameter passing to function -

here header of function: int* matrixmult(const int*ap[], const int* bp[], int* cp[]) and working call of function: matrixmult(ap, bp, cp); why doesn't call work?: matrixmult(ap[0], bp[0], cp[0]); why doesn't call work?: matrixmult(ap[0], bp[0], cp[0]); here, values (first item of array - int ) passed function, while pointers expected: int* matrixmult(const int*ap[], const int* bp[], int* cp[]) this: matrixmult(ap, bp, cp); works because 3 pointers. ap same &ap[0] .

sql - How to change only first string of multiple same value on mysql row -

i have mysql query replace string on row below; update users set user_online = user_online - 1, connectedsrv= case when connectedsrv= '1.1.1.1' replace (connectedsrv, '1.1.1.1', '') else replace(connectedsrv, ';1.1.1.1', '') end username='$common_name' however, may use same value multiple times in row ; 1.1.1.1;1.1.1.1;1.1.1.1 once tried execute update sentence , replaces '1.1.1.1' values want delete one. result should be; 1.1.1.1;1.1.1.1 thanks in advance, correct way: normalize schema , ensure every column contains atomic data (first normal form). csv column violation of simple rule. should avoid it. workaround way use simple string manipulation: update users set user_online = user_online - 1, connectedsrv= case when connectedsrv= '1.1.1.1' '' when connectedsrv '%1...