Posts

Showing posts from June, 2012

ios - CocoaPods update RestKit #import "RKObjectMapping.h" file not found -

i want update of project pods , after run pod update "some_framework" , try build project appear error: import "rkobjectmapping.h" file not found current cocoapod version 0.39.0 have tried downgrade 0.38.2 , lower without success, xcode version 6.4 have tried change configuration of search path in build setting non-recursive recursive again without success. so don't know next, because need updates in project , restkit main framework working server side. podfile: source 'https://github.com/cocoapods/specs.git' platform :ios, '7.1' pod 'restkit', '~> 0.24.1' pod 'ezform', '~> 1.1.0' pod 'ocmock', '~> 3.0' pod 'imodynamictableview', '~> 1.1.273' pod "imodynamicpopup" pod 'masonry', '~> 0.6' this how error looks like, in xcode: error image a little late party,i had same issue cooca pod 0.39.0 , restkit 0.24.1 upd

javascript - hello.js Get facebook friends doesnt seem to be working -

so im using sites example provided in https://adodson.com/hello.js/demos/friends.html#helloapi-mefriends- and cant seem able friend list, facebook. seems work ok google not facebook if go hello.api() section of site , click on play button next me/friends get { data: [], summary: { total_count: 240 } } which seems friends count. broken ? facebook changed way me/friends endpoint works, shows friends using application.

c++ - How to get a custom operator== to work with Google Test? -

i'm having trouble using custom overloaded '==' operator pcl , google test (gtest) #include <pcl/point_types.h> namespace pcl { struct pointxyz; } bool operator==(pcl::pointxyz p1, pcl::pointxyz p2) {return p1.x-p2.x<.1;} #include <gtest/gtest.h> test(foo, bar) { pcl::pointxyz a{2,3,4}; pcl::pointxyzp b{2,3,4}; expect_eq(a,b); // compile error no match operator== } int main(int argc, char **argv){ testing::initgoogletest(&argc, argv); return run_all_tests(); } the error is: || /usr/include/gtest/gtest.h: in instantiation of 'testing::assertionresult testing::internal::cmphelpereq(const char*, const char*, const t1&, const t2&) [with t1 = pcl::pointxyz; t2 = pcl::pointxyz]': /usr/include/gtest/gtest.h|1361 col 23| required 'static testing::assertionresult testing::internal::eqhelper<lhs_is_null_literal>::compare(const char*, const char*, const t1&, const t2&) [with t1 = pcl::pointxyz; t2 = pcl::point

python 2.7 - How to make subclass of QStyledItemDelegate react properly on mouse hover in a QListView in PySide/PyQt? -

on way solve problems stated in earlier questions ( question 1 , question 2 ) alone, succeeded implement custom qstyleditemdelegate meets demands. here minimal working example illustrating current state: import sys import pyside.qtcore core import pyside.qtgui gui class dataref(object): def __init__(self, i): self.i = def upperlabel(self): return u'upperlabel {0}'.format(self.i) def lowerlabel(self): return u'lowerlabel {0}'.format(self.i) def pixmap(self): return gui.qpixmap(90, 90) class mylistmodel(core.qabstractlistmodel): def __init__(self, parent=none): super(mylistmodel, self).__init__(parent) self._items = [dataref(i) in range(20)] def rowcount(self, parent=core.qmodelindex()): return len(self._items) def data(self, index, role=core.qt.displayrole): if not index.isvalid(): return none if role == core.qt.displayrole: retu

Print BIG Words on Console - using python, bit by bit -

Image
i need write big word on console, each character of word should comprise of parts, , each part reveal on screen, pretty attached picture is there python library can me, have searched enough couldn't find far to print ascii-art words, should @ pyfiglet library https://github.com/pwaller/pyfiglet to effect want, simple script be: import os import time pyfiglet import figlet f = figlet(font='slant') word = 'hello' curr_word = '' char in word: os.system('reset') #assuming platform linux, clears screen curr_word += char; print f.rendertext(curr_word) time.sleep(1) (note: haven't tested script, concept should correct)

Java - Make byte array as a download -

i have zip file byte array (byte[]), write file system using, fileoutputstream fos = new fileoutputstream("c:\\test1.zip"); fos.write(decodedbytes); // decodedbytes zip file byte array fos.close(); instead of writing file , reading make download, make byte array download directly, tried this, response.setcontenttype("application/zip"); response.setheader("content-disposition", "attachment; filename=\"file.zip\""); servletoutputstream outstream = response.getoutputstream(); outstream.write(decodedbytes); // decodedbytes zip file byte array this not working, i'm getting empty file. how can make byte array download? update: added clause , closed servletoutputstream , worked. }catch (exception e) { log.error(this, e); } { try{ if (outstream != null) { outstream.close(); } } catch

css - create multicolor icons. Icomoon -

it's been hard find clear information how create icons 2 colors (facebook -white , blue-, google- white , red.....). customer wants able change 2 colors pleases. have been looking around , i've found http://www.programask.com/question_41701651_multicolored-icon-fonts# seems quiet easy , clear client purpose (change color when want, haven't understood procedure...). i use icomoon, can't find how add colors.... so understood need image editor, in case of facebook icon, select "f" , save in .svg , same background "without f", , save svg too, then.... how put them refer 1 icon? i don't need icomoon though (but need free software), can explain me how color icons through css? thank you creating multicolored icon fonts icomoon easy combines them multiple glyphs off course , seems have no knowledge of "default" color (the color can changed parent class) - need define inherit in css : 1) create svgs favorite vector app i

python - sockets block on send for some reason -

trying implement compressed communication on raw sockets using socketserver. handler class read raw_message = [] while true: data = self.request.recv(1024) if not data: break raw_message.append(data) raw_message = ''.join(raw_message) and tries decompress , send me reply. client code goes this try: sock.connect(('myhost', 8075)) except exception e: print('failed connect', e) compressed = zlib.compress(bytes(payload, 'utf-8')) print('payload length: ', len(payload)) print('compressed length: ', len(compressed)) try: sock.sendall(compressed) except exception e: print('failed send', e) print('sent') data = sock.recv(4096) print('data: ', zlib.decompress(data)) somehow server never gets out of "while true:" loop though every tutorial says should work way.

c++ - Binding boost::asio::steady_timer::async_wait -

i want turn call: timer.async_wait(handler); into call: func(handler); so tried using std::bind : #include <functional> #include <boost/asio.hpp> #include <boost/asio/steady_timer.hpp> #include <boost/system/error_code.hpp> using std::bind; using std::function; using boost::asio::io_service; using boost::asio::steady_timer; using boost::system::error_code; int main(int, char**) { using namespace std::placeholders; io_service io_s; steady_timer timer (io_s); // error function<void(function<void(const error_code&)>)> bound = bind(&steady_timer::async_wait, timer, _1); return 0; } but wont compile! when compiled this: g++-4.9 -std=c++11 -wall -i/usr/local/include -l/usr/local/lib -

html5 - Float:right property not producing desired results in CSS3 -

i have html5/css3 code, in want float #rightodwnblock image right. have added float: right property code reason image still floats left. can see nothing within code cause happen, i'm wondering if issue might server-side? it's testing here: http://www.orderofthemouse.co.uk/javascripttesting4client/index.html the in-progress code shown below: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" > <link rel="stylesheet" type="text/css" href="/style.css" /> <title>the end.</title> <style style="text/css"> .marquee { height: 1024px; overflow: hidden; position: relative; } .marquee p { position: absolute; width: 100%; height: 100%; margin: 0; line-height: 50px; text-align: center; font:120pt verdana,arial; /* starting posi

Resizing image with ImageMagick and Ruby on Rails -

i have been trying use imagemagick resize images uploaded user square. currently, using ! - 640x640! this works fine if image feed resolution of 640x640 or bigger - resizes , makes square expected. the problem if either height or width of image smaller 640, wont square out. instance if image 480x600, wont image. if image 680x456 resize 640x456 how can make square image maximum size of 640x640? if image greater 640x640, want resize 640x640. if image smaller 640x640, i.e. 480x600, want resize 480x480 i'm doing in rails, within paperclip attachment definition, this: has_attached_file :avatar, :styles => { :medium => "640x640!", :thumb => "150x150!" }, :default_url => "/images/:style/missing.png"

multithreading - why java stream "reduce()" accumulates the same object -

comparisonresults comparisonresults = requestslist .parallelstream() .map(item -> getresponse(item)) .map(item -> comparetobl(item)) .reduce(new comparisonresults(), (result1, result2) -> { result1.addsingleresult(result2); return result1; }); when private comparisonresults comparetobl(completeroutingresponseshort completeroutingresponseshortfresh) { ... comparisonresults comparisonresults = new comparisonresults(); ... return comparisonresults; } however when debug: .reduce(new comparisonresults(), (result1, result2) -> { result1.addsingleresult(result2); return result1; }); i see result1 , result2 same object (object id in idea) result1 equals result2 addsingleresult should return new obje

Dynamically create objects and setting their attributes using suds lib in python -

i'm using raspberry send sensor data on soap webservice. rpi gets data serial port. format 'date, value1, value2, value3, value4\r\n'. webservice request looks this <sensors> <sensor> <sensorid>int</sensorid> <nodeid>int</nodeid> <sensortypeid>int</sensortypeid> <value>double</value> <status>string</status> <date>datetime</date> <deleted>boolean</deleted> <updated>boolean</updated> <remoteid>int</remoteid> <dateoflastupdate>datetime</dateoflastupdate> <userid>int</userid> <errormessage>string</errormessage> </sensor> <sensor> <sensorid>int</sensorid> <nodeid>int</nodeid> <sensortypeid>int</sensortypeid> <value>double</value> <status>str

ruby - How to use line breaks in a slim variable? -

i have variable in slim : - foo = 'my \n desired multiline <br/> string' #{foo} when parse output using slimrb command line command contents of variable encoded: my \n desired multiline &lt;br/&gt; string how can have slimrb output raw contents in order generate multi-line strings? note neither .html_safe nor .raw available. there 2 issues here. first in ruby strings using single quotes – ' – don’t convert \n newlines, remain literal \ , n . need use double quotes. applies slim too. second, slim html escapes result of interpolation default . avoid use double braces around code. slim html escapes ruby output default (using = ). avoid escaping in case use double equals ( == ) . combining these two, code like: - foo = "my \n desired multiline <br/> string" td #{{foo}} this produces: <td>my desired multiline <br/> string</td>

sh - sed command/shell script to read a specific line and update it if needed -

i have file contents similar below. name: myname age: 25 subject: math this file needs updated : name: myname age: "25" subject: math but condition is, sed command/ shell script can run multiple times. but, double quotes must added once. i wrote script , works. want find simpler solution. #!/bin/bash file="myfile" while ifs='' read -r line || [[ -n "$line" ]]; if [[ $line =~ 'age:' ]] if ! [[ $line =~ 'age: "' ]] sed 's/\(age:[[:blank:]]*\)\(.*\)/\1"\2"/' -i $file fi fi done < $file you can run sed command line altered regex, , have same effect script sed -i 's/\(age:[[:blank:]]\+\)\([^"].*\)/\1"\2"/' file it won't match if first character after blank space double quote, script checks for. tested , works me.

Using format to fill and justify multi-byte Unicode strings in Python 2.7 -

in python, it's easy fill (i.e. pad) strings , justify them left, right, or center using string.format . example: >>> word = "resume" >>> print "123456890\n{0:>{1}}".format(word, 10) >>> print len(name) 1234567890 resume 6 however, if string contains multi-byte unicode characters, string.format doesn't calculate string's width correctly: >>> word = u"résumé" >>> print "123456890\n{0:>{1}}".format(word.encode('utf8'), 10) >>> print len(name.encode('utf8')) 1234567890 résumé 8 the solution not use unicodedata.normalize('nfc', string) , may have read. indeed normalize unicode character sequences (and may necessary in cases!) not cause string.format calculate encoded width of strings output terminal. so how 1 print correctly filled/padded strings string.format in python 2.7? the answer, turns out, dead simple: use

ruby on rails - How to assign a different design to each button with oauth? -

i want allow customers connect facebook , g+ auth. problem don't know how assign different design each button, because link call each provider. how can call them distinctly ? here's view's code : <%- if devise_mapping.omniauthable? %> <%- resource_class.omniauth_providers.each |provider| %> <%= link_to omniauth_authorize_path(resource_name, provider) %> <div class="fb-connect"> <%= image_tag('f-facebook.png', alt: "fb", class: "mini-fb") %>&nbsp;&nbsp;inscription avec facebook</div> <% end %> <% end %> <% end %> as understand, 2 buttons (fb + g+) looks facebook button. here's omniauth_callbacks_controller.rb: class omniauthcallbackscontroller < devise::omniauthcallbackscontroller def self.provides_callback_for(provider) class_eval %q{ def #{provider} @user = user.find_for_oauth(env["omniauth.auth"]

Debugging using makefile flags in C -

i need set way debug program make file. specifically, when type make -b flag=-dndebug need program run normally. when flag not present need few assert() commands throughout code run. to clarify need know how check if flag not present within c code, i'd assume has #ifndef , don't know go there. forgive ignorance, response appreciated! assuming talking assert macro standard library ( #define d in <assert.h> ) don't have anything. library takes care of ndebug flag. if want make own code things if macro / not #define d, use #ifdef suspect in question. for example, might have condition complex put single assert expression want variable it. if assert expands nothing, don't want value computed. might use this. int questionable(const int * numbers, size_t length) { #ifndef ndebug /* assert numbers not same. */ int min = int_max; int max = int_min; size_t i; (i = 0; < length; ++i) { if (numbers[i] < min) min

javascript - trying to submit form with submit button as button -

i trying submit form , not working , want submit button disabled once clicked. <form action="buy" method="post" > <input type="hidden" name="tid" value="${tid}"/> <td align="center" valign="middle"> <button onclick="this.disabled = true; document.getelementbyid('up7913').disabled = false;" type="submit" name="down7913" id="down7913">subscribe now</button></td> </form> bind submit event , disable button. document.getelementbyid('form').addeventlistener('submit', function(event) { event.preventdefault(); this.down7913.disabled = true; // handle post request }); demo: http://jsfiddle.net/jefvw66q/1/

javascript - traverse dynamic number of options in json array -

i building mcq application has multiple questions varying number of options. so, question 1 can have 4 options , question 2 can have 2 options , on. i have generated json array backend gives me data tells me number of options each question has. but stuck on part of displaying options on browser. my json object looks this: [ { "option1": "asdasd", "option2": "ajda", "option3": "hsadb", "option4": "asd", "question": "hello", "quest_id": 32 }, { "option1": "dsf", "option2": "afs", "question": "asdad", "quest_id": 34 } ] i want display dynamically each question corresponding options , radio buttons besides them. also have array tells me number of options in each [4,2] says question 1 has 4 options , question 2 has 2 options. tried apply ng-repeat using angu

c# - Linq Check if a string contains any query from a list -

i have list of strings search queries. want see if string database contains of terms in query. i'd on 1 line of code, doesn't make multiple calls database. should work want more optimized. var queries = searchquery.trim().split(' ', stringsplitoptions.removeemptyentries).distinct(); var query = context.readcontext.divisions.asqueryable(); queries.foreach(q => { query = query.where(d => (d.company.companycode + "-" + d.code).contains(q)); }); is there function can better or more optimal way of writing that? there 2 issues proposed solution: most linq sql providers don't understand string .contains("xyz") provider either throw exception or fetch data machine. right thing use sqlmethods.like explained in using contains() in linq sql also, code show check whether division contains all of specified strings. to implement 'any' behavior need construct custom expression, not possible using plain c#. n

Default JVM Memory -

whenever starting jvm getting started xms 256mb, 1/64 of memory available , default should happen. want change , start every jvm 128mb. there way or have manually specify xms tag while starting jvm. thanks you can provide default arguments every jvm way prevent changing later. simplest solution have startup script sets default values you. btw, default 1/64th on 32-bit client jvm windows. 64-bit versions, default 1/4 of main memory. maximum heap size, not amount used more or less in total.

javascript - Page background doesn't display whole image -

Image
i have website background image, choosen random javascript: document.body.style.background= 'url('+randombgs[num]+')'; i have set background imagefrom randombgs[] array contains 15 backgrounds. background gets cut off, , whole image isn't displayed (see picture below) this see: this should see how can fix this, browser shows whole image , not 95% of it? use css background-size property: body { background-size: contain; } the image fit container.

python - Extract 2 arguments from web page -

i want extract 2 arguments ( title , href ) <a> tag wikipedia page. i want output eg ( https://en.wikipedia.org/wiki/riddley_walker ): canterbury cathedral /wiki/canterbury_cathedral the code: import os, re, lxml.html, urllib def extractplaces(hlink): connection = urllib.urlopen(hlink) places = {} dom = lxml.html.fromstring(connection.read()) name in dom.xpath('//a/@title'): # select url in href tags(links) print name in case @title . you should elements tag a have title attribute (instead of directly getting title attribute).and use .attrib element attributes need. example - for name in dom.xpath('//a[@title]'): print('title :',name.attrib['title']) print('href :',name.attrib['href'])

w2ui - Has this framework been abandoned or what? -

latest activity on framework on july 21, 2014. there hasn't been news or updates framework. community isn't active @ all. have developers stopped , abandoned framework or there else going on? how clean , modern looking framework is. if it's abandoned don't see why use this. he emailed me: i think better evaluate activity github commits: https://github.com/vitmalina/w2ui/commits/master . currently, working on releasing 1.5 version, should out soon.

jboss7.x - ARJUNA012210: Unable to use InetAddress.getLocalHost() to resolve address -

while starting jboss in domain mode (first instance), getting following warn part of server.log in console.... i curious know caused issue...... needs rectified..... implication if didn't go fix warning...... [server:server-two] 13:55:55,198 warn [com.arjuna.ats.arjuna] (transaction expired entry monitor) arjuna012210: unable use inetaddress.getlocalhost() resolve address. host entry missing. make entry in hosts file... if system windows, start->run->drivers ->and make host entry in etc/hosts (need admin rights edit hosts file) if system unix based, ->open file $sudo vim /etc/hosts , make host entry. in present scenario host entry local system, local system ip in unix run $ifconfig , in windows run >ipconfig in command prompt.

python - Letter to Binary -

i'm new python 2.7.10. i'm trying convert not letters binary whole word itself. a = '01100001', b = '01100010', c = '01100011' if typed "a" output "01100001" i'm trying when typed "abcba" should print related "01100001 01100010 01100011 01100010 01100001" is possible? try using ord ascii value of character, bin convert number string of binary representation , join concatenate output: >>> myinput = "abcba" >>> print " ".join(bin(ord(character))[2:] character in myinput) 1100001 1100010 1100011 1100010 1100001

How to sort array of numbers in C -

i'm trying sort array using function findminimumindex in loop, can't seem find it's not sorting correctly. suggestions? function works fine, when try use in loop, doesn't work. suggestions? thanks! int findminimumindex(a[], int a, int b); //finds smallest index of portion of array (a[i] ... a[j]) int main(){ int a[5] = {4,6,7,4,3}; int smallest_index; (int j = 0; j < count; j++){ smallest_index = findminimumindex(a, j, 4); printf("sorted: %d\n", a[smallest_index]); } } int findminimumindex(int a[], int a, int b){ int smallest_value = a[a]; int index = 0; (int k = a; k < j - 1; k++){ if (a[k + 1] < smallest_value){ smallest_value = a[k+1]; index = k + 1; } } return index; } if find minimum value , index, should switch values: look @ example: you have got array: {4,6,7,4,3} at first, find value 3 @ index 4 , have move smallest value (switch val

java - CheckBoxPreference List -

i'm trying write android app. have settings activity, has preferences. currently, i'm want have similar hierarchy this: - group 1 (checkbox): option 1 option 2 - group 2 (simple category, no checkbox): option 3 option 4 in hierarchy, how can categories, if group 1 checkbox isn't checked, both options 1 , 2 disabled, , option 3 disabled too. thanks in advance! i don't need might : if (yourcheckboxview.ischecked()){ youroptionview.setvisibility(view.visible); // or youroptionview.setenabled(true); } else { youroptionview.setenabled(false); // or youroptionview.setvisibility(view.gone); } is want ? if so, want full code ? , type of view options ?

Instagram api profile/users -

i see sites iconosquare/websta , have users/tags appearing in google results, how can done getting list of users put in own database? appreciate help iconosquare uses instagram api user info, using system call endpoints. can request user id using api, , pulls information out of database , transfers iconosquare. use get info. limits scope what's public if user id requested not user id. here's more info api: https://www.instagram.com/developer/endpoints/users/ now iconosquare behind paywall, might want alternatives. can access api token or try paid service crowdbabble.

Does Xcode 7.1 beta 3 support 3D Touch on Simulator? -

according apple documentaion,"xcode 7.0 must develop on device supports 3d touch. simulator in xcode 7.0 not support 3d touch ".now xcode 7.1 beta 3 available.i want know xcode 7.1 beta 3 supports 3d touch on simuator.if supports, how check on simulator. the third party library provided has users complained it's not working on xcode 7.2. however can use flex . it can support 7.1 , above importing framework via cocoapods. but tutorial use in documentation not correct. for peeking, need move bit of mouse cursor let work while holding shift + command, not command + control + shift. for popping, while holding shift + command during peeking, press control 3 times pop out. because 3 times means hardest force applied, document stated, each key contributes 1/3 of maximum possible force.

java - SELECT FOR UPDATE locking -

i'm using hibernate data persistence, , i'm counting on select update sql statement locking system ensure 1 thread working on task, when internet connection interrupted, threads blocked in select update statement. my theory: first thread gets in lock function, executes sql statement, , puts lock, , before committing changes database table, connection gets interrupted thread fails commit, , unlock table, therefor lock keeps living, , when next threads execute sql statement, blocked. in code snippet bellow, task inside while block, have represented "..." code snippet while(lockisok()){ ... } and lockisok() function handles lock. code snippet private boolean lockisok(){ session session = null; transaction transaction = null; try { session = hibernateutil.getsessionfactory().getcurrentsession(); transaction = session.begintransaction(); sqlquery request = daofactory.getcurrentsession().createsq

raspbian - Raspberry Pi FBTFT -

i'm trying install raspberry pi 2.8 tft add-on (iteadstudio). new version of raspbian has fbtft drivers. i add line in /etc/modules fbtft_device name=itdb28 gpios=reset:7,dc:2,wr:3,cs:8,db00:17,db01:18,db02:27,db03:22,db04:23,db05:24,db06:25,db07:4 rotate=90 the problem i'm facing when pi boots up, says "failed start load kernel modules" , lcd still doesn't work (which meant make lcd black). when remove line /etc/modules, goes away. any idea problem is?

jquery - Remove cloned div except for the last one -

how remove last cloned div except first (default) div? http://jsfiddle.net/fj3bpyj2/ $('#addcontact').click(function() { $( "#contactinputs" ).clone().appendto( "#contactwrapper" ); return false; }); $('#removecontact').click(function() { $("#contactwrapper").find("#contactinputs").last().remove(); return false; }); try this $('#removecontact').click(function () { var div = $("#contactwrapper > #contactinputs"); if (div.length > 1) div.last().remove(); return false; }); jsfiddle

java - Which data type should I use? -

i have set of data, lets call them shapes. there 3 types of shapes: 1) circle : x-coordinate y-coordinate r-radius c-color 2) square: x-coordinate y-coordinate s-side c- color 3) line: x-coordinate y-coordinate x1-coordinate y1-coordinate c- color which data type best suited them? should make shape class , make circle, square , line subclasses of shape? if do, can put of them in 1 class file? as side note: when creating each shape, constructor given maxx , maxy. shaped autogenerated random numbers stay inbound within (0,0,maxx,maxy). sizes user-determined. keeping them 1/10 1/3 or width of screen. less-important details. you have super class called shape , have common properties ( x-coordinate , y-coordinate , colour ). you extend class circle , square , line classes, wherein fill in properties each distinct item has. it recommended have separate class file each class. this approach allow to, instance, create list<shape> should need create collecti

c++ - How do I use the `Function Call Operator` to load `rvalue` types to my object? -

i have class this: template<typename t> class myclass { public: // ... t && operator()(uint64_t i, uint64_t j); // want add member function this. t & operator()(uint64_t i, uint64_t j); const t & operator()(uint64_t i, uint64_t j) const; // ... }; while revising code, realized stored object of type t being copied every time tries set object (i,j) position. use move semantics , avoid unnecessary copying if possible? possible solve adding third operator in code above? my aim access myclass instance in code: myclass<element> myclass; // ... element element; // 'element' movable. // ... myclass(2, 3) = std::move(element); // 'element' no longer needed, can moved. how can this? first of can't overload based on return type. however, not problem since don't need overloads of subscript operator. in order avoid unnecessary copies ,

accelerometer - Double Integration of Acceleration into Position using 9-Axis IMU -

first post on forum, hope i'm doing right. know there have been several threads on double integration of acceleration in past, , know errors inherent in accelerometer isn't 200k+ military grade sensor. fortunately purposes need approximately correct (+/- 3 inches) no longer ten seconds. i'm there already. using linear acceleration off bno055 imu. i'm sampling @ rate of 50hz (every 20ms). every time sample, use basic trapezoidal integration move acc velocity , velocity position. have "discrimination window" throw out at-rest error, , "movement end detect" code set velocity 0 after acceleration 0 given amount of counts. it's working after fashion, need work little bit better. i'm seeing odd kickback move accelerometer , position moves pretty correctly until stop, position "kicks back" several inches - started. brought in friend smarter , recommended integrate smarter, using 4 or 5 data points instead of last 2 use in trapezoi

php - mysqli driver not found in xamp when using pdo -

hi trying use pdo connect mysqli database on xamp , keep getting error. php connection code $handler = new pdo('mysqli:host=127.0.0.1;dbname=app','root',''); error message fatal error: uncaught exception 'pdoexception' message 'could not find driver' in remove mysqli: $handler = new pdo('mysql:host=127.0.0.1;dbname=app','root','');

SQL Server and xml -

i pass xml varchar scalar function in sql server: <screenerinfo> <extendexpiryinfo> <extendexpiry> <actionon>2015-05-19 13:31:40.019</actionon> <comments>nikilesh</comments> <approvalstatus>ee</approvalstatus> <newexpirydate>2015/06/25 12:28:59pm</newexpirydate> </extendexpiry> </extendexpiryinfo> </screenerinfo> i want retrieve every thing between comment tag , separate each comment comma store in varchar variable , return how can achieve this...... for eg... nikilesh,manish,done,rejected... how possible? i don't know, "manish" or "done" or "rejected" comes from, asking content of comments-node i'd assume, there more nodes these phrases in comments-node. in following example copied example node 3 times , changed content of comments. if paste empty query window you'l

ios - MPMoviePlayerViewController work fine with debug but crash in release on iOS9 -

mpmovieplayerviewcontroller works fine debug crash in release on ios9 mpmovieplayerviewcontroller *playerviewcontroller = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:url]; self.navigationcontroller presentmovieplayerviewcontrolleranimated:playerviewcontroller]; my url not nil. it's working when debug in ios9 crash when release , xcode7 say: 2015-10-15 14:53:04.808 ********[5110:1680634] nsscanner: nil string argument 2015-10-15 14:53:04.808 ********[5110:1680634] nsscanner: nil string argument libc++abi.dylib: terminate_handler unexpectedly threw exception with ios9, mpmovieplayercontroller deprecated, should use avplayercontroller !

sql - Relational Algebra translation of division -

i came across journal: http://users.dcc.uchile.cl/~cgutierr/cursos/bd/divisionsql.pdf gave method of translating relational algebra division sql. little skeptical if works, given t1 (a,b) , t2(b) select t1 b in ( select b t2 ) group having count(*) = ( select count (*) t2 ); because suppose given row in t1[a,b] such there duplicates satisfied statement where b in (select b t2) , wouldn't cause having clause skip row? or "in" statement remove duplicates? no. relational algebra division takes set of relations (a,b) , , returns set of a such there relation between a , members of given subset of b s. example, in paper linked, a1 , a3 a s have relation b2 , b3 . line where b in ( select b t2 ) filters rows of t1 rows b2 or b3 in b column. equivalent inner join between t1 , t2 on respective b s. note there no duplicate entries in t1 or t2 . few equivalent queries (plus equivalent in journal, though note caveat these queries ret

swift - NSTableView alternative row colors with NSArrayController -

so i'm using nsarraycontroller nstableview , want show custom row color nsarraycontroller doesn't have objects. normally without cocoa bindings can "cheat" numberofrows this: var datastore = [person]() func numberofrowsintableview(tableview: nstableview) -> int { if datastore.count < 20 { return 20 } else { return datastore.count } } and getting custom row colors... func tableview(tableview: nstableview, didaddrowview rowview: nstablerowview, forrow row: int) { if row % 2 == 0 { rowview.backgroundcolor = nscolor.bluecolor() } else { rowview.backgroundcolor = nscolor.recolor() } } how can same effect empty table view cocoa bindings? i don't know code mac app in ios app, can achieve need cellforrowatindexpath . did try it?

python 3.x - PyQt 5.5 QML Combobox -

i'm trying play pyqt 5.5 using qml (installed source). this main.qml : window { ... combobox { objectname: "cmbtypecompression" width: 240 height: 26 model: listmodel { id: cbitems listelement { text: "banana" } listelement { text: "apple" } listelement { text: "coconut" } } ... } this code.py class gui(qapplication): self.app = qapplication([]) self.engine = qqmlapplicationengine() self.ctx = self.engine.rootcontext() self.ctx.setcontextproperty("main", self.engine) self.engine.load(url) self.loadform() self.loadsignal() self.app.exec_() def loadsignal(self): obj = self.win.findchild(qobject, "btnsave") obj.messagerequired.connect(myfunction) def loadform(self): self.setprop("txtcompsub", "text", config.compression.sub_folder) self.setprop("txtnumprotos", "text", config.compression.num_prototype) self.setproplist("cmbtype

amazon web services - How to periodically schedule a same activity when the previous one is still excuting -

my goal have workflow periodically (every 30 seconds) add same activity (doing nothing sleep 1 minute) tasklist. have multiple machines hosting activity workers poll tasklist simultaneously. when activity got scheduled, 1 of workers can poll , execute. i tried use cron decorator create dynamicactivityclient , use dynamicactivityclient.scheduleactivity() schedule activity periodically. however, seems the activity not scheduled until last activity finished. in case, activity got scheduled every 1 minute rather 30 seconds set in cron pattern. the package structure same aws sdk sample code: cron there other structure recommended achieve this? new swf.any suggestion highly appreciated. the cron decorator internally relies on asyncscheduledexecutor design written wait asynchronous code in invoked method complete before calling cron again. behavior witnessing expected. workaround not invoke activity code under cron, code in different scope. like: // field settable<vo

javascript - Only allowing N amount of connections in Node.js -

i started learning node.js on side , though know allow many connections physically possible, i'd know how limit amount of numbers. say, i'm handling http requests , when connection rate goes 4 people, don't want go further others have wait until free spot available again when finishes request. also i'd know how make user try reconnect 4 times before being told server's busy 4 connections.

symfony - Correct way to reference CSS in /vendor in Symfony2 and PHPStorm -

i can correctly reference css in vendor directory so {% stylesheets output='css/compiled/main.css' '@appbundle/resources/public/css/lib/bootstrap.min.css' '../vendor/kartik-v/bootstrap-star-rating/css/star-rating.css' %} <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" /> {% endstylesheets %} this works. phpstorm, ide, shows file @ /vendor/kartik-v/bootstrap-star-rating/css/star-rating.css cannot found. , highlights warning. this raises 2 questions; is best/correct way of referencing css (or javascript) thats in vendor directory symfony2 point of view? e.g. if there other syntax use? can make phpstorm correctly reference file not missing error?

go - How to print struct with String() of fields? -

this code: type struct { t time.time } func main() { := a{time.now()} fmt.println(a) fmt.println(a.t) } prints: {{63393490800 0 0x206da0}} 2009-11-10 23:00:00 +0000 utc a doesn't implement string() , it's not fmt.stringer , prints native representation. tedious implement string() every single struct want print. worse, have update string() s if add or remove fields. there easier way print struct, fields' string() s? this how fmt package implemented, can't change that. but can write helper function uses reflection ( reflect package) iterate on fields of struct, , can call string() method on fields if have such method. example implementation: func printstruct(s interface{}, names bool) string { v := reflect.valueof(s) t := v.type() // avoid panic if s not struct: if t.kind() != reflect.struct { return fmt.sprint(s) } b := &bytes.buffer{} b.writestring("{") := 0; < v.

Arrow keys in perl debugger works in one PuTTy session but not on another -

i have 1 saved session in putty (connecting rhel box) perl -d , arrow keys works nice. i have same putty version, , using session1, cloned connect different similar rhel box , arrows not work? according this question , session1 should have not been working not have term::readline::gnu on first box you don't need term::readline::gnu , other modules may fill same need. use term::readline::perl . may have module (or equivalent) installed on first box not on second. the linked answer claims term::readline::perl not have arrow-key support, may have been true @ 1 time, arrow keys work fine me.

Swift XCTest and asserts -

i'm using swift2. assume have function: func divide(x x:int, y:int) -> double? { assert(y != 0) if (y == 0) { return nil } else { return (double(x)/double(y)) } } for debugging purposes i'd use assert, can see when passes y = 0 in function. i'd have workaround in production (i don't want crash, notify user), cannot divide 0. have test: let res = divide(5, 0) xctassert(res == nil) but instead of finishing test exc_bad_access on assert in divide function. can disable asserts somehow tests? one option add default parameter function used bypass assert: func divide(x x:int, y:int, safe:bool=true) -> double? { if safe { assert(y != 0) } if (y == 0) { return nil } else { return (double(x)/double(y)) } } in app continue call x , y parameters divide(5, 0) and assert. in test call safe parameter false bypass assert , allow use xctassert on result: let

python - Know feature names after imputation -

i run sk-learn classifier on pandas dataframe (x). since data missing, use sk-learn's imputer this: imp=imputer(strategy='mean',axis=0) x=imp.fit_transform(x) after doing however, number of features decreased, presumably because imputer gets rids of empty columns. that's fine, except imputer transforms dataframe numpy ndarray, , lose column/feature names. need them later on identify important features (with clf.feature_importances_ ). how can know names of features in clf.feature_importances_, if of columns of initial dataframe have been dropped imputer? you can this: invalid_mask = np.isnan(imp.statistics_) valid_mask = np.logical_not(invalid_mask) valid_idx, = np.where(valid_mask) now have old indexes (indexes these columns had in matrix x) valid columns. can feature names these indexes list of feature names of old x.

html - Placing div behind two other divs (logo and navbar) -

html: <!doctype html> <html> <head> <title>nightfall gaming</title> <link href="c:\users\cam\desktop\nightfallgaming\css\stylesheet.css" rel="stylesheet" type="text/css"/> </head> <body bgcolor="#ffffff"> <div id="navbar"> <nav> <ul> <li><a href="#">home</a></li> <li><a href="#">game news</a></li> <li><a href="#">game reviews</a> <ul> <li><a href="#">xbox 360</a></li> <li><a href="#">xbox one</a></li> <li><a href="#">ps3</a></li> <li><a href="#">ps4</a></li> <li><a href=&q

c - Why do people declare array size sometimes? -

why there need declare array size example: type "array[50]" while type "array[]" still same thing. , have seen other similar things in code talking arrays in function parameters in function parameters, it's true int array[] , int array[40] exactly same thing (they both transformed compiler int * ); however, i've seen second form being used form of documentation output arrays, show client code @ least how big array expected be. personally, i'm kind of ambivalent use, since is useful documentation, novices think (1) requirement somehow enforced compiler , (2) sizeof(array) works expected. talking array definitions first of all, can int array[] if initializing something, e.g. in int array[] = { 1, 2, 3, 4, 5}; the compiler doing favor counting elements in initializer , making array big enough; cannot do: int array[]; /* not compile */ because compiler wouldn't know how big array allocate. now, people do: int array[

spring mvc - Signature of Methods Returning ModelAndView and Request Mapping by Method Name -

two beginner springmvc questions: 1) there required signature types in springmvc modelandview-returning methods, or it's free-form, whatever params/order want? i've seen these examples: public modelandview action1(httpservletrequest request); public modelandview action2(model m); public modelandview action2(httpservletrequest request, model m); public modelandview action4(); //etc. 2) possible have requestmapping method name, not whole url? have url, /test, can either /test?method=action1 or /test?method=action2 (similar struts). @requestmapping("/test?method=action1") public modelandview action1(model m) { //... }

c++ - ImportError: No module named 'libstdcxx' while debuging project with ncurses -

trying debug project uses ncurses eclipse ide. got error: fff@ubuntu:~/workspace/ttt/debug$ gnu gdb (ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 copyright (c) 2014 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law. type "show copying" , "show warranty" details. gdb configured "x86_64-linux-gnu". type "show configuration" configuration details. bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. find gdb manual , other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. help, type "help". type "apropos word" search commands related "word". traceback (most recent call last): file "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>

haskell - Difference in <$> and fmap -

i have line of code: (++) <$> "hallo" <*> "du" which outputs just "hallodu" in "learn haskell great good" learned <$> , fmap same , indeed ghci outputs same type signature me. nevertheless, when write: fmap (++) "hallo" <*> "du" where difference? yes <$> , fmap same thing using them in different expressions. (++) <$> "hallo" <*> "du" is equivalent to: (++) `fmap` "hallo" <*> "du" moving fmap in infix position yields: fmap (++) (just "hallo") <*> "du" this due operator precedence , why <$> more readable of time. note in expression: fmap (++) "hallo" <*> "du" you passing 3 arguments fmap ( (++) , just , "hallo" ), type doesn't match <*> wants. you want pass 2 arguments: (++) , just "hallo" .

cordova - External bluetooth barcode scanner does not trigger an event in Phonegap iOS application -

i'm building phonegap jqm application, accepts barcodes external bluetooth barcode scanner. i've used library: https://github.com/julien-maurel/jquery-scanner-detection , works fine on android devices. there's problem on ios devices . when barcode scanned, event not triggered . if add text input page , click on it, works fine, event triggered , scanned barcode attached input fields value. there must no input field. how can catch event on ios?

sql - Syntax for multiple cases in MySQL -

i have mysql update statement attempting reset 2 columns: label , perstrcode. (this in coldfusion program.) i'm doing case statements can't seem syntax right -- keep getting error. code: <cfquery name = 'nonull' datasource = "moxart"> update finaggdb set label = case when persactincoutg = 'i' && perstrcode null 'total income' when persactincoutg = 'o' && perstrcode null 'total expense' when persactincoutg null && perstrcode null ' ' else perstrcode end set perstrcode = case when perstrcode null 'total' else perstrcode end </cfquery> the error usual informative statement: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'set perstrcode = case when perstrcode null 'total' else perstrcode ' @ line 8 are multiple case statements not allowed? or can tell me how fix this? an update