Posts

Showing posts from August, 2014

clojure - How to start immutant message queue? -

from immutant documentation @ http://immutant.org/documentation/current/apidoc/guide-installation.html : with dependencies in place, invoke immutant services app’s main entry point, identified :main key in project.clj . immutant's web service can invoked like: (ns my-app.handler ... (:require [immutant.web :as web]) ... ) (def app ... ) (defn -main [& args] (web/run app)) what's equivalent of (web/run app) immutant.messaging ? here answer start queue (ns my-project.name (:require [immutant.messaging :as msg])) (defn call-fn [args] (let [fun (ns-resolve "namespace fun defined" (symbol (first args))) params (rest args)] (if (seq params) (apply fun ) (fun)))) (msg/start "queue") (msg/respond "queue" (fn [args] (call-fn args))) to call queue say @(msg/request "queue" ["fun-name" params])

java - Input - Action Handling in LibGdx -

i'm making libgdx game exercise. pretty simple, "escape" kind of game. screens background, items , go left/right arrows. as libgdx makes easy, wandering if there easy method of handling actions. bunch of "if else" statements in onclick() method. fine, tens or houndreds of items messy , laggy when clicked. public void onclick(int scrx, int scry){ px = (scrx/vieww)*world_w; py = (scry/viewh)*world_h; if (px > 10 && px < 20 && py > 10 && py < 20) { if (stage.getinfo().getleft() == true) { gdx.app.log("click", "left"); stage = new stagegame(stage.getinfo().getleftstage()); } } else if(px > 80 && px < 90 && py > 10 && py < 20) { if (stage.getinfo().getright() == true) { gdx.app.log("click", "right"); stage = new stagegame(stage.getinfo().getrightstage());

Animation for help overlay in Android Application -

Image
is possible create animations implement help layout android applications in figure : desired effect : hand image should move , point icon.then effect ripple created. how implement animations ? yes can using showcase view library github link, works pretty , customizable showcaseview

WebDriver: Why latest versions of Eclipse and Selenium Server is not compatible with latest version of Firefox -

i tried execute script in webdriver following latest versions of eclipse, selenium server , firefox, firefox gets executed , script not execute further: eclipse luna service release 2 (4.4.2) selenium jar selenium-server-standalone-2.45.0 firefox 36.0.4 , firefox 38 beta version however, when used firefox 32.0, scripts runs completely. what technical reason behind non-compatibility of latest firefox version latest eclipse , selenium jar? please see here in changelog. seems mozilla has rewritten of there apis not available selenium relied on this. changelog v2.45.0 important changes in release: native events in firefox relied on api mozilla no longer provides. such, fall synthesized events on recent firefox versions. i have been looking latest firefox version supported. other people have found same problem , rolling using v35.0.1 see here

view - iOS equivalent to Android registerActivityLifecycleCallbacks -

Image
i developed android app used application.registeractivitylifecyclecallbacks ( http://developer.android.com/reference/android/app/application.html ) know when each activity started , stopped , record analytics purposes. developing ios version , cannot find equivalent method monitor uiviewcontrollers or uiview displayed app. anybody has idea ? beginner on ios may not taking right approach, feel free suggest other ideas. edit after first answer felt should more precise. developing sdk other developers include in apps want impact of sdk on code small possible. i first thought doing baseactivity / baseuiviewcontroller developers have extend in activity / uiviewcontroller felt heavy , since both language don't allow multiple inheritance impact code. why registeractivitylifecyclecallbacks method great in android because have give me application or activity object. is there solution ios or have create basecontroller ? thank in advance. i've not run specifi

model view controller - Is MVP a design pattern or an architectural pattern ? What about MvC and MvvM? -

after doing research on android patterns kept finding different answers. people start talking design pattern, architectural or architectural presentation patterns. i'm reaching conclusion architectural presentation pattern mvc architectural pattern while mvp & mvvm design pattern on same rank design pattern observer. correct? design pattern general reusable solution commonly occurring problem within given context. reside in domain of modules , interconnections. connected code. on other hand architectural patterns similar software design patterns have broader scope . describing overall pattern followed entire system. for me mvc, mvp , mvvm architectural patterns other architectural patterns may hear off (the list not exhaustive) : event driven architecture cqrs rest microservices soa pipe & filter architecture you can find examples on wiki : http://en.wikipedia.org/wiki/list_of_software_architecture_styles_and_patterns

login - follow a page redirect using rvest in R -

i new r , rvest. trying use these information website (www.medicinescomplete.com) allows sign in using athens academic login system. in browser, when click on athens login button transfers athens login form. after submitting user credentials form redirects browser original site logged in. i used submit_form() function submit credentials athens form , returns 200 code. however, r not follow redirect browser , if use jump_to() command return original site not logged in. suspect redirected link returned sign in page might contain log in credentials need not know how find link , send using rvest has worked out how log in via athens using rvest or has idea how make follow automatic redirect?? the code have used far (login credentials changed): library(rvest) library(magrittr) url <- "https://www.medicinescomplete.com/about/" mcsession <- html_session(url) mcsession <- jump_to(mcsession, "/mc/athens.htm? uri=https%3a%2f%2fwww.medicinescomplete.com%2fabo

regex - What's the regular expression that matches a square bracket? (Part II) -

this continuation of previous thread because none of answers there produced intended result. getting super wierd behavior using regexes match dates. want match following dates: [month-day] such as: "[01-23]" // january 23rd valid date "[02-31]" // february 31st invalid date "[02-16]" // valid "[ 6-03]" // invalid format here regex: regex = /\[^[0-1][1-9]\-[0-3][0-9]\]/ i tried put both single \ , double \ infront of brackets nothing seems working matching these dates. ideas? thanks! the problem regex placement of start-of-line anchor ^ after initial square bracket. cannot happen, regex never matches anything. move anchor beginning of expression fix problem: regex = /^\[[0-1][1-9]\-[0-3][0-9]\]/

symfony - Clearing form collection entirely -

i have issue symfony 2.6 form collections. removing elements collection works, when @ least 1 present. if last element removed dom (leaving collection container empty), no elements removed collection after handling request. example: i have form collection "children" , 2 children, "a" , "b". remove child "b" dom, save, removechild called, child removed. remove child "a", save, nothing happens - after refreshing form child still present. when dumping main entity after form has handled request, child present in it's collection well. did have similar problem , found solution? you can 2 methods : as in symfony doc : form collection doc or doctrine annotation : doctrine orphanremoval doc but don't forget cascade={"remove"} annotation

c++ - Query number of resources in a Qt Resource Collection (.qrc) -

i compiling multiple qt linguist message files (.qm) qt resource collection file (.qrc). translatons.qrc file compiled application via rcc , can access resources via ":/translations/<locale_name>.qm" . is there way query number of resources specific prefix? in case, when add 2 .qm files .qrc file programmatically obtain result 2 . class qresource not seem fulfill such request, since seems work resources directly. using qt v5.4. you may work resource system in same manner, file system, example: qdir( ":/translations" ).entrylist()

android - An always expanded MvxExpandableListView -

i'm trying develop version of mvxexpandablelistview expanded. the code wrote seems work, i'm pretty sure don't things right way. tried find info android widgets lifecycle, found info activity lifecycle. more specifically, should expandall() method called ? i've tried several places , ended putting ondraw() handler. to prevent collapsing, called expandgroup() method in groupcollapse handler. hmm not sure it's right way either. so, here code : public class mvxexpandedlistview : mvxexpandablelistview { private bool _allexpanded = false; private void expandall() { var nbgroups = thisadapter.groupcount; (int = 0; < nbgroups; i++) { expandgroup(i); } } private void init() { groupcollapse += mvxexpandablelistview_groupcollapse; setselector(android.resource.color.transparent); cachecolorhint = color.transparent; setgroupindicator(null); } public mv

How can I verify a cryptographic hash created by Python's Passlib using Node.js? -

i have backend application written in python used content managers of site. users' passwords hashed using passlib's pbkdf2_sha512 function. began develop frontend application decided use nodejs react ux reasons. now problem can't figure out how can verify passwords hashed passlib using nodejs authenticating users. passlib's implementation seems specific me , i'm not crypto stuff figure out. i have mcf know algorithm , digest type, salt, number of iterations , key length. how can verify output passlib in node? should rather choose algorithm better supported both platforms? ok, turned sha512_crypt instead , found nice library node called sha512crypt-node . readme contains example both python , node, needed. here's little example ppl. using these platforms: python: from passlib.hash import sha512_crypt orig = "password" h = sha512_crypt.encrypt(orig) print("hash", h) # h eg. $6$rounds=100000$5yntxatkh4b1pljp$3qqjvifjrbitak

javascript - Div auto scroll (Mobile) -

i need able make div scroll left right , move start or bounce , loop over. although when 'app' selected scrolling stops. the version want scroll can found @ etreecycle.co.uk on web making page mobile size or viewing site on small device. the basic layout is; <div id="scroll-me"> // scroll when page less 650px wide. <div id="app-wrapper"> // changes width make contence responcive, 3240px wide , 270px high when scrolling. <div id="app"></div> // apps have hover tag, when hovering scrolling needs stop. (or click on mobile device.) <div id="app"></div> <div id="app"></div> <div id="app"></div> <div id="app"></div> <div id="app"></div> </div> </div> is there way make work on mobile device? thank you.

javascript - Changing .innerHTML after a button is clicked -

i using jquery mobile , have collapsible set. when using function change innerhtml works fine. displaying content inside collapsibles. <div id="doro" data-role="collapsibleset" data-iconpos="right" dir="rtl" align="right"> </div> works when using: document.getelementbyid("doro").innerhtml ='<div data-role="collapsible"> <h3>click me - im collapsible!</h3> <p>i'm expanded content.</p> </div>' but when try: <input type="button" data-theme="b" name="submit" id="submit" value="submit" onclick="refreshpage();"> while: function refreshpage(){ var text = "<div data-role='collapsible'><h1>click me - i'm collapsible!</h1><p>i'm expanded content.</p></div>"; document.getelementbyid("doro&q

extjs - Define new xtype fields sencha touch MVC -

i have create new xtype in sencha application don't know have put code. tried create new file , add in views array in app.js doesn't work because new xtype field not view ext.define('dynamo.field.patterntext', { extend : 'ext.field.text', xtype : 'patterntextfield', config : { pattern : '[0-9]*' }, updatepattern : function(pattern) { var component = this.getcomponent(); component.updatefieldattribute('pattern', pattern); }, initialize : function() { this.callparent(); var component = this.getcomponent(); component.input.on({ scope : this, keydown : 'onkeydown' }); }, onkeydown : function(e) { var code = e.browserevent.keycode; if (!(code >= 48 && code <= 57) && !(code >= 97 && code <= 105) && code !== 46 && code !== 8 && code !== 188 && code != 190) { e.stopevent(); } } });

javascript - Json callback single post by id -

i have problem single post page wordpress , show on mobile jquery page. need full list of posts; , on click, need open single post. this code list of posts: $.getjson("http://www.mcaps.at/redesign/api/get_posts/?post_type=reference_member", function posts(data) { var output='<ul data-role="listview" data-inset="true" data-divider-theme="c">'; $.each(data.posts, function(key,ref){ output += '<li class="show-more" >'; output += '<a href="#blog-post" onclick="showpost(' + ref.id + ')">'; output += '<h3>' + ref.title + '</h3>'; output += '<img src=" ' + ref.thumbnail + ' " />'; output += '</a>'; output += '</li>'; }); output+='</ul>'; $('#referenzen-content').html(output); }); how s

ajax - how to include js file using asset on yii2 advanced template -

i have folowoed following guide http://www.yiiplayground.com/yii2/web/index.php?r=ajax/index how can include js file using assets. following file have created under /frontend/assets <?php namespace frontend\assets; use yii\web\assetbundle; class ajaxasset extends assetbundle{ public $basepath = '@frontend'; public $baseurl = '/view'; public $css = [ ]; public $js = [ 'ajax/ajax.js', ]; public $depends = [ 'yii\web\yiiasset', 'yii\bootstrap\bootstrapasset', ]; } ?> i have managed make work updating following //public $basepath = '@webroot'; //public $baseurl = '@web'; public $sourcepath = '@frontend/views/ajax'; however having problem javascript file. views/ajax/ajax.js 'reportsviewdone': function (response) { // called link attribute 'data-on-done' => 'simpledone' console.dir(response); $('#css3buttons&#

c# - Setting nullable TimeSpan in XAML -

i creating style player mediaplayerframework , in xaml style want set 2 properties ( skipaheadinterval , skipbackinterval ) of type timespan? . i tried <setter property="skipaheadinterval" value="00:00:20.00" /> but getting cannot assign nullable type on property skipaheadinterval is there way in xaml? have considered using valueconverter , handling nullable within valueconverter scope?

linux - Unable to get right git branch name in bash -

i'm working on post-receive of git server automatically uploads latest version of website in folder named after branch commit in, somehow doing code doesn't work intended. somehow value branch gets values of branches instead of branch i'm trying get. hash right hash code. have tested outside of program, branch when type right hash. did use wrong syntax in program? #!/bin/sh hash=$(git log -n 1 --pretty=format:"%h") branch=$(git branch --contains $(git log -n 1 --pretty=format:"%h")) if [ branch ] git_work_tree="/data/site/'$branch'" echo "/data/site/'$branch'" git checkout -f $branch fi alright, got work wanted! after hearing post-receive got refname stdin, found out had trim down refname branch name , came bit of code. guys. :) #!/bin/sh while read oldrev newrev refname branch=${refname##*/} if [ branch ] path="/data/site/$branch" mkdir $path

socket error in python 2.7, sending public rsa key to client -

i'm programming client-server communication encrypted rsa, using tcp sockets. generate public , private keys, when want exchange public keys between client , server error: typeerror: must convertible buffer, not publickey this server code: import socket import rsa print "generating keys" (public, private) = rsa.newkeys(1024, poolsize=2) print "keys generated." tcpsocket = socket.socket(socket.af_inet, socket.sock_stream) tcpsocket.setsockopt(socket.sol_socket, socket.so_reuseaddr,1) tcpsocket.bind(("0.0.0.0", 1025)) tcpsocket.listen(1) print "waiting client..." (client, (ip, port)) = tcpsocket.accept() print "connection received from: ", ip client.send(public) #this error i've tried line too: client.send(str(public)) with can send public key, can't use encrypt data (because public key string). thank ! you can use pickle or cpickle: import cpickle to_send=cpickle.dumps(the_key) sock.send(

css - Font Awesome's fa-spin spinning around wrong center -

i'm using toggle menu template: http://bootsnipp.com/snippets/featured/navigation-sidebar-with-toggle . i have replaced bootstraps glyphicon font awesome's fa fa-cog fa-spin but cog spinning out of boundaries if center not on same line text. can see there issue thesizing, cannot figure out where, idea doing wrong? jsfiffle: https://jsfiddle.net/vidriduch/mpw2r8h2/1/ you have problem in text indent .sidebar-nav li { line-height: 40px; text-indent: 20px; //remove rule , use margin } and change class rules .sub_icon { float: right; margin-right: 10px; margin-top: 10px; padding-right: 65px; // remove padding-top: 10px;// remove }

Can PHP PDO Statements accept the table or column name as parameter? -

why can't pass table name prepared pdo statement? $stmt = $dbh->prepare('select * :table 1'); if ($stmt->execute(array(':table' => 'users'))) { var_dump($stmt->fetchall()); } is there safe way insert table name sql query? safe mean don't want do $sql = "select * $table 1" please see following: http://us3.php.net/manual/en/book.pdo.php#69304 table , column names cannot replaced parameters in pdo. in case want filter , sanitize data manually. 1 way pass in shorthand parameters function execute query dynamically , use switch() statement create white list of valid values used table name or column name. way no user input ever goes directly query. example: function buildquery( $get_var ) { switch($get_var) { case 1: $tbl = 'users'; break; } $sql = "select * $tbl"; } by leaving no default case or using default case returns error message ens

c - Redirecting execvp path -

i'm trying write simple code execute program subfolders input file , print thr result output file. my problem when execute program keeps failing on me. since execvp command trying exe named "a.out" on wrong location. in (desktop rather searching correct path address). here's code. please me out :) pid_t runner; char enter[] = "/home/demo/desktop/os/ex1/ex12/code/input.txt"; // input file char path[] = "/home/demo/desktop/os/ex1/ex12/ex1/ronen/"; correct path char *r [] = {"./a.out", null}; int savedfd = dup(0); int sever2fd=dup(1); int fdin = open(enter,o_rdonly); int fdout = open ("output.txt", o_creat | o_rdwr, 0466); dup2(fdin, 0); dup2(fdout, 1); if ((runner = fork()) < 0) {perror("could not make fork");} else if (runner == 0) { if (execvp(r[0],r) < 0 ) {printf("failed!\n");} } else if (runner != 0) { waitpid(runner,0,0); dup2(savedfd, 0); dup2(sever2fd, 1); printf(

Does Maven Mojo have Equivalent to ant's DirSet? -

i'm uplifting ant plugin maven plugin , ant plugin used dirset , see maven has fileset . can use fileset gather directories? should create own dirset class either reviewing ant's patternset - dirset code , implementing similar solution using maven's patternset , or fileset? is there better way gather directories includes , excludes? thanks help peter found on maven's file management examples page. filesetmanager filesetmanager = new filesetmanager(); string[] includedfiles = filesetmanager.getincludedfiles( fileset ); string[] includeddir = filesetmanager.getincludeddirectories( fileset ); string[] excludedfiles = filesetmanager.getexcludedfiles( fileset ); string[] excludeddir = filesetmanager.getexcludeddirectories( fileset ); filesetmanager.delete( fileset );

javafx - Set image on left side of dialog -

Image
i created simple example javafx alert dialog javafx8u40. public class mainapp extends application { public static void main(string[] args) { application.launch(args); } private stage stage; @override public void start(stage primarystage) throws exception { button create = new button("create alert"); create.settooltip(new tooltip("create alert dialog")); create.setonaction(e -> { createalert(); }); primarystage.setscene(new scene(create)); primarystage.show(); stage = primarystage; } protected alert createalert() { alert alert = new alert(alerttype.warning); image image1 = new image("http://www.mcaprojecttraining.com/images/java-big-icon.png"); imageview imageview = new imageview(image1); alert.setgraphic(imageview); alert.initmodality(modality.application_modal); alert.in

linux - Use ldap for auth (via pam) but /etc/passwd for uid and guid -

i newbie on pam , nss please gentle. i have following scenario: i have access ldap database have no control on administration (so please not proper fix fix database, know not happen). however, in database users registred , authenticate against not have maintian own user database. the main problem there no uid or gid information in database , ldap admins refuse add information. my idea: configure pam can authenticate against ldap. if user sucessfully authenticates, pam (via pam-script?) creates local user (in /etc/passwd) local unique uid. local user later used nss find uid , guid. what have done far , question: i can authenticate against ldap , have idea on how create user @ login failing make nss use "local users" getting uid , gid. how can split login use ldap authentication , uses local files finding uid , guid, shell etc ?

arrays - How to implement a map or sorted-set in javascript -

javascript has arrays use numeric indexes ["john", "bob", "joe"] , objects can used associative arrays or "maps" allow string keys object values {"john" : 28, "bob": 34, "joe" : 4} . in php easy both a) sort values (while maintaining key) , b) test existence of value in associative array. $array = ["john" => 28, "bob" => 34, "joe" => 4]; asort($array); // ["joe" => 4, "john" => 28, "bob" => 34]; if(isset($array["will"])) { } how acheive functionality in javascript? this common need things weighted lists or sorted sets need keep single copy of value in data structure (like tag name) , keep weighted value. this best i've come far: function getsortedkeys(obj) { var keys = object.keys(obj); keys = keys.sort(function(a,b){return obj[a]-obj[b]}); var map = {}; (var = keys.length - 1; >= 0; i-

shell - What does `sort +0 -1` do? -

i have old script contains variant of sort +0 -1 , man sort in system not mention existence of these options. from another question , led the wikipedia page sort , says: in old versions of sort, +1 option made program sort using second column of data ( +2 third, etc.). deprecated, , instead -k option can used same thing. but not mention negative argument such -1 supposed do. note that, in "modern" sort (gnu coreutils 8.21), sort +0 -1 works, while of following fail: sort +0 +1 , sort -0 -1 , , sort -0 +1 . i can add pairs of numbers (e.g. sort +0 -1 +2 , sort +0 -1 +2 -3 ), short test case cannot precisely infer meaning. edit : completeness, nowadays invalid command such sort +0 +1 equivalent sort -k1 -k2 . as per gnu info page on sort : on older systems, ‘sort’ supports obsolete origin-zero syntax ‘+pos1 [-pos2]’ specifying sort keys. obsolete sequence ‘sort +a.x -b.y’ equivalent ‘sort -k a+1.x+1,b’ if y ‘0’ or absent, otherw

bayesian - Normalizing constant for beta distribution with discrete prior : R code query -

i going through bayesian thinking r jim albert. have query code example beta likelihood , discrete prior. code calculating posterior is: pdisc <- function (p, prior, data) s = data[1] # successes f = data[2] # failures ############# p1 = p + 0.5 * (p == 0) - 0.5 * (p == 1) = s * log(p1) + f * log(1 - p1) = * (p > 0) * (p < 1) - 999 * ((p == 0) * (s > 0) + (p == 1) * (f > 0)) = exp(like - max(like)) ############# product = * prior post = product/sum(product) return(post) } my query highlighted bit of code calculating likelihood , logic behind (not explained in book). i'm aware of pdf beta distribution, , log likelihood proportional s * log(p1) + f * log(1 - p1) not clear following 2 lines doing - imagine it's normalizing constant, again there isn't explanation in book. the line like = * (p > 0) * (p < 1) - 999 * ((p == 0) * (s > 0) + (p == 1) * (f > 0)) takes care o

xml - Cannot load local css in Spring MVC 4 (eclipse) -

i think have config correctly, cannot load css. seems never work. have googled of results, none of them work me. not sure doing wrong. pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.alias</groupid> <artifactid>yayawine</artifactid> <packaging>war</packaging> <version>0.0.1-snapshot</version> <name>yayawine maven webapp</name> <url>http://maven.apache.org</url> <properties> <spring.version>4.0.1.release</spring.version> </properties> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</vers

How should/could/must I handle the dll that my C++ projects depend on? -

i'm lost here , have no clue how proceed. not question how make program work, question how stop wasting time. my programming environment visual studio 2013 on windows, in c++. i use 3 libraries extensively, namely: boost (using dynamic linking), opencv, , qt. during development, have configured vs @ 3 libraries default include , .lib. have added 3 folders containing dlls path environment variable. it works, sometime painful, let me explain when. first hassle: anytime have lnk error telling me miss function, on opencv since has 1 include file referencing functions. have @ opencv's source code see module function belongs , know must link program to. second hassle: when comes time deploy application, have ship relevant dlls. know 1 need, open dependency walker , try forget nothing, have test on different computer because 102% of time have missed couple, , have configure installer generator include 1 one. third hassle: ease little bit process of configuring new dev

events - jfxtras - CalendarPicker getDisplayedCalendar in EventFilter wrong -

i have calendarpicker eventfilter. in eventfilter want displayedcalendar calendarpicker.getdisplayedcalendar(), wrong date. last date before calendarpicker update displayedcalendar. it seems eventfilter executed before standard events of calendarpicker. and cannot use eventhandler because event consumed calendarpicker. for example: - see march 2015 in calendarpicker. - change month april 2015 - in calendarpiker.addeventfilter() calendarpicker.getdisplayedcalendar() "2015-03-01" - calendarpicker shows april 2015 how can execute standard events before eventfilter? here code: calendarpicker.addeventfilter(mouseevent.mouse_clicked, new eventhandler<mouseevent>() { @override public void handle(mouseevent event) { if (event.getbutton().equals(mousebutton.primary)) { calendar cal = calendarpicker.getcalendar(); if (cal != null) { selecteddate = cal.gettime(); log.debug(string.format("(selecteddate): %s" , selecteddate));

java.util.prefs.Preferences Sharing between two JVMs -

i have 2 java programs ( a , b ) run in separate (local) jvms, access same java.util.prefs.preferences (java.util.prefs.windowspreferences) prefs = preferences.systemnodeforpackage(foo.class) both programs call once @ startup. a gui program allows configuration. changes written preferences node. @ end flush called. b background program doing actual work. a sends notification b configuration has changed. b reads changed configuration. there no concurrent access preferences, since cross-jvm locking (using java.nio.channels.filelock ) used. my question: safe solution? b read a has written?

c++ - Swift Compiler Error 'iostream' not found -

Image
i've tried implement project i've found on github. https://github.com/hossamghareeb/facebook-pop-tutorial while implementing .h , .m files i've got error saying xcode not find 'iostream' file. i'm working in swift, using bridging-headers use framework. when try build original project works, mine fails. how can add iostream file? thanks in advance! swift bridging not support objective c++ files. means headers consume or expose c++ entites (like std::vector ; std::iostream ) cannot added bridging header. the pop bridging header contains: #import "pop.h" you should #import file in own bridging header, rather trying #import .h files. if need consume of api that's defined in .mm files isn't exposed objective c or plain c header, you'll have make own header file exposes (and back-end implements you've exposed). the reason why can use .mm files in library that's being used swift because swift uses in

for loop - awk increment the input field while looping -

i have loop on array. looking on $11 field. however, want check different field every time. when i first element, want @ $11 field. when i second element, want @ $12 field. when i third, want @ $13 field. i using: for in "${array[@]}" awk -v ofs="\t" -v str1="$i" -v thr="$thr" '{ if($11>=thr) print "chr" $1, $2 ,$3 , str1 ;}' comb.txt > $i".bed" done how can this? my variables follows: str1="cd45ra+_naive" str2="cd45ro+_mem" str3="cd127-_treg" str4="il17-_th_stim_macs" str5="il17+_th17_stim" array=($str1 $str2 $str3 $str4 $str5) thr=10 given array names , can loop through values , know index doing: for ((i=0; i<${#names[@]}; i++)) echo "$i, ${names[$i]}" done for example, $ names=('a' 'b' 'c') $ ((i=0; i<${#names[@]}; i++)); echo "$i, ${names[$i]}"; done 0, 1, b

ios - Save objects with many redundant information (with core data) -

i designing app in objective-c uses core data structure. i have following structure : @interface classa : nsmanagedobject @property(nonatomic, strong) sometype1 * property1; .. @property(nonatomic, strong) sometypen * propertyn; @property(nonatomic, strong) nsset * children; @end and @interface classb : classa @property (nonatomic, strong) classa * parent; @end i have following features : 1) each object of classa have many children in classb. (objects in classb don't have children themselves). 2) moreover, objects of classb share many properties in common parent (for instance, can think in cases, property1 differ between object of classb , same property in parent in classa, x in classb x.property2 = x.parent.property2 , on). 3) query database through requests on object of type classa. i looking way reduce disk memory usage of app storing necessary properties of objects of type classb. instance, keep properties of object of classb set nil unless differs 1 of pa

deployment - What options are available for creating multiple cloud instances of a web-app for different customers -

i have web-app, in production, need sold different companies. th idea create new instance of application each customer, example: lets our app has site @ thing.com: a company sing instance of application the system receives signup , (automatically?) creates new instance of web app @ yourcompany.thing.com i wondering options available "system"? how can create multiple instances of web-app when company signs up? an example of looking can seen when signing youtrack in-cloud instance.

python - Show label probability/confidence in NLTK -

i'm using maxent classifier python nltk library. dataset, have many possible labels, , expected, maxent returns 1 label. have trained dataset , 80% accuracy. i've tested model on unknown data items, , results good. however, given unknown input, want able print/display ranking of possible labels based on internal criteria maxent used select one, such confidence/probability. example, suppose had a,b,c possible labels , use maxent.classify(input) , 1 label, let's c . however, want able view a (0.9), b(0.7), c(0.92) , can see why c selected, , possibly choose multiple labels based on parameters. apologies fuzzy terminology, i'm new nlp , machine learning. solution based on accepted answer, here's skeleton code example demonstrate wanted , how can achieved. more classifier examples on nltk website . import nltk contents = read_data('mydataset.csv') data_set = [(feature_sets(input), label) (label, input) in contents] # user-defined feature_sets() func

mysql - How would I right a select statement to query this database? -

how right select statement if wanted find out how many people first name "jim" have passed test? also if wanted instructor forename , surname, client forename , surname , date every test after 9:00 on 10/03/2015? here relational schema database. client ( clientno , forename, surname, gender, address, telno, prolicenceno) instructor ( instructorid , forename, surname, gender, address, telno, licenceno, carno ) car ( carno , regno, model) lesson ( clientno , ondate , attime , instructorid ) test ( clientno , ondate , attime , instructorid , centreid , status, reason) centre ( centreid , name, address) primary keys in bold , foreign keys in italic. no foreign keys allowed null. thanks! :) try joining between client , test table like: select c.forename, count(c.forname) client c inner join test t on c.clientno = t.clientno c.forename = 'jim' , t.status = 'pass' group c.forname

jira - Auto assign to team lead/developer on bug reopen -

in implementation of jira, have custom field called developer gets populated automatically (username) whenever move jira open fixed state. want similar fixed reopen transition. is, whenever tester changes status reopen, should go developer or project lead (in case field isnt populated custom field can overridden). i tried implement post function, there isn't way can use or criteria. or there way? you can post function on transition using script runner plugin if self-hosted jira instance allow great flexibility in logic fill target field in.

javascript - Email Script from server breaks Telerik RadGrid and RadDropDownList -

i using rad grid display information grid checkboxes mark items , using raddropdownlist can pick action , press button it. 1 of items send email emails of checked rows. in button click call enumerate checked rows grid , put emails in string buffer , add script execute email on postback bring email. clientscript.registerstartupscript(this.gettype(), "mailto", "<script type = 'text/javascript'>parent.location='mailto:" + emailtobuffer.tostring() + "'</script>") ; this results in line <script type = 'text/javascript'>parent.location='mailto:dana@here.com; '</script> put in front of telerik rad javascript code in html. somehow innocent little line of javascript causes master checkbox on radgrid header line , raddropdownlist stop functioning completely. dropdown list not drop. value parent.location no else in view source html except inserted email line. i cannot figur

javascript - Detecting if you are on a desktop -

i'm building app touch screens , has on screen keyboard them use. works wonders desktop computers, not mobile devices have built in keyboards. i have been looking around see if there way detect if on desktop or mobile, have seen has been deprecated. there way so? can enable library if on desktop computer. you can accomplish doing: if(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent)){ //your code mobile devices } here fiddle: http://jsfiddle.net/mnbw23gg/

uinavigationcontroller - UITabBarController in UISplitViewController with Storyboard -

Image
i have uisplitviewcontroller uitabbarcontroller master. uitabbarcontroller contains 1 uinavigationcontroller uitableviewcontroller root (it main menu of app). after tapping on cell in main menu , in uisplitviewcontroller 's detail part uitableviewcontroller should presented (let's call detail view ). in landscape mode works ok. but in portrait, whet tap on cell in main menu , detail view presented modally, , not pushed, supposed to. also, when rotating landscape portrait, main menu presented instead of detail view , , after click on main menu 's position show detail view , presented modally no possibility rotate or go back. removing uitabbarcontroller , setting uinavigationcontroller uisplitviewcontroller 's master works want (in landscape mode have menu | detail views side side , in portrait mode controllers behave on regular uinavigationcontroller ). uitabbarcontroller gone. what i've tried: every possible segue type - none of them

Have Foreign Key only in Grails Application GORM but not in the Database -

my grails application using shared legacy database. there no foreign key constraints explicitly defined in table schema. there are, logical foreign key relationships present in many of tables. not allowed change db schema (as shared db, take permission dba... ...). is there way define hasmany, manytomany , other gorm constraints without changing existing database schema? you can have hasmany , belongsto without foreign keys. cascade delete , other things work, wont fk violations errors if code thing violates fk.

Python Splinter Library ImportError: cannot import name Browser -

i'm trying use splinter library in python. when use from splinter import browser in code gives me: file "d:\users\user\desktop\splinter.py", line 1, in importerror: cannot import name browser i trying run file desktop. why looking on desktop splinter.py? there no splinter.py on desktop. fixed: there file named 'splinter.pyc' on desktop before file named correctly. deleting fixed problem.

javascript - How to get percent from an binary int, with every bit representing x percent? -

i have binary bitmap 10bits. every bit represents 10%. there simple math function sum of percent bitmap? sample 0000000000 = 0% 0000000001 = 10% 1000000000 = 10% 0000100000 = 10% 1000000001 = 20% 0000000011 = 20% 0000110000 = 20% 0010000010 = 20% 1010000010 = 30% be aware example of how bits activated. number have int such 0,1 1023. you don't have use loop. don't have math. this: var number = 1000100010; alert(number.tostring().split("1").length - 1); //a little more deep: var number2 = 1100100000; alert((number2.tostring().split("1").length - 1) * 10 + "%");

java - QuickBlox get presence of user which isn't in the contacts -

i'm developing android chat application using quickblox.. app : user logs in , chooses user chat with.. (not in roster).. managed users using following code : retrieveallusersfrompage(1); private void retrieveallusersfrompage(int page){ qbpagedrequestbuilder pagedrequestbuilder = new qbpagedrequestbuilder(); pagedrequestbuilder.setpage(page); pagedrequestbuilder.setperpage(100); qbusers.getusers(pagedrequestbuilder, this); } int usernumber = 1; @override public void onsuccess(arraylist<qbuser> users, bundle params) { for(qbuser user : users){ this.users.add(user); usernumber ++; } int currentpage = params.getint(consts.curr_page); int totalentries = params.getint(consts.total_entries); if(usernumber < totalentries){ retrieveallusersfrompage(currentpage+1); } } but wanna filter them add available(online) users.. can't find way that.. idea ? with no roster can use next trick user.las

oracle - SQL - Error with Sum(Case -

i have searched bunch of examples quite helpful in creating query having trouble 1 part of query... sorry not being able provide complete table structure. here working query... select i.spl_instr_code_1 lw, sum((d.units_ordered/i.std_sub_pack_qty) - (d.units_rcvd/i.std_sub_pack_qty)) "booked" wmdbadmin.item_master i, wmdbadmin.cust_po_appt c, wmdbadmin.po_hdr h, wmdbadmin.po_dtl d, wmdbadmin.appt_sched a, wmdbadmin.vendor_master v, wmdbadmin.sys_code s h.ref_field_2 = 'n' , c.appt_nbr = a.appt_nbr (+) , c.po_nbr = h.po_nbr , h.po_nbr = d.po_nbr , i.sku_id = d.sku_id , h.vendor_master_id = v.vendor_master_id , s.code_id = a.stat_code , s.rec_type = 's' , s.code_type = '628' , s.code_desc<>'scheduled' , a.stat_code <= '90' , ((to_char(a.sched_date_time,'yyyymmdd')>= '20150401' , to_char(a.sched_date_time, 'yyyymmdd')<='20150401')) group i.sp

signature - outlook 2010 including weblink image inline -

i have noticed on laptops once has booted , open outlook compose message, email signature picture takes long time load. 10seconds. during time believe outlook download , trying make local copy within email itsself. how can prevent happening. below code sent outlook email <v:shape id="picture_x0020_2" o:spid="_x0000_s1026" type="#_x0000_t75" alt="https://www.spectrumgeo.com/wp-content/uploads/spectrum_logo_email-171w.jpg" style='position:absolute;margin-left:74.8pt;margin-top:0;width:126pt;height:34.5pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:0;mso-height-percent:0;mso-wrap-distance-left:0;mso-wrap-distance-top:0;mso-wrap-distance-right:0;mso-wrap-distance-bottom:0;mso-position-horizontal:right;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:line;mso-width-percent:0;mso-height-percent:0;mso-width-relative:page;mso-height-relative:page' o:all

Pass a struct parameter to a MATLAB mcc-compiled executable on Windows -

on windows, compiled using mcc matlab script takes struct parameter , writes output file. when try call on windows' cmd using func.exe "struct('field','data')" or func.exe struct('field','data') i get attempt reference field of non-structure array. error in func (line 3) matlab:nonstrucreference passing struct uncompiled script through matlab works, e.g. matlab /nosplash /nodesktop /r "func(struct('field','data')),exit" assuming still wish pass struct , not distinct arguments (so can specify optional arguments run), there workaround? (google didn’t help!) thanks! with info daniel , navan, workaround implemented (given argument called args) is if (ischar(args)); evalc(sprintf('args=%s;',args)); end which works both in compiled executable , calling directly within matlab. assumes user has done sanity checking.

linux - Zip multiple directories into one zip file -

$ cat /home/myapp/properties.csv /document/source/ /downloads/lib/ /home/app/newfiles/ the above simple file holds directories i'm interested in... $ cat /home/myapp/zipup.sh #!/bin/bash folder="/home/myapp/properties.csv" cat $folder| while read dir; //zip directories read in how complete zipup.sh script directories , contents in each of directories defined in properties file included in single zip file i.e. result should this... /result.zip (everything goes in here) /source /hello.class /hello.jar /lib /xml.jar /newfiles /list.doc #!/bin/bash while read dir; dirs="$dirs $dir" done < /home/myapp/properties.csv zip -r result $dirs

regex - C++ regexp to parsing nested struct -

i have string formatted follows permanent way: { first nested string; { second nested string; } } nesting may arbitrary depth. each sub-element formatted closing brace, adding 2 spaces previous level of nesting , closing brace. want receive regular expression allows obtain nested data. example, above example result should be: first nested string; { second nested string; } i wrote following code allows parse strings in 1 line, symbol '.' character except newline. regex regex("\\s*\\{\\s*(.*?)\\s*\\}\\s*"); string testinput = "{\n" " first nested string;\n" " {\n" " second nested string;\n" " }\n" "}\n"; smatch match; if (regex_search(testinput, match, regex)) { auto result = match[1].str(); } what regular expression make can receive nested data? in advance. the regex implementation c++ standard library not support recursion, needed match nested structures. like

ssas - Creating named set -

i trying create named set return sum of selected members measure. when deploy getting error function expects tuple set expression argument. string or numeric expression used. please review code , suggest solution. have dimension named uline , named set should sum selected 4 members of dimension measure sum({[uline].[cu - (46)], [uline].[fru - (45)], [uline].[gl - (38)], [uline].[pu - (44)]},[measures].currentmember) better use aggregate rather sum if wish available measure. also no need include measures hierarchy inside function. so try simpler this: aggregate( { [uline].[cu - (46)], [uline].[fru - (45)], [uline].[gl - (38)], [uline].[pu - (44)] } ) please note though new member in existing hierarchy, this: with member [uline].[aggset] aggregate( { [uline].[cu - (46)], [uline].[fru - (45)], [uline].[gl - (38)], [uline].[pu - (44)] } ) select [measures].[somemeasur

php - data tables showing all records instead of pagination while giving data through server json -

this json output. { "draw": 0, "recordstotal": 130, "recordsfiltered": 130, "data": [ { "order_id": "32", "location_address": "xyz road delhi delhi", "order_status": "0", "created_by": "5", "from_date": "mar-30-2015", "emp_name": " ", "actions": "\r\n\t\t\t\t\t<a onclick=\"show_edit()\" class=\"btn default btn-xs purple \">\r\n <i class=\"fa fa-edit\" ></i> edit </a>" }, { "order_id": "33", "location_address": "xyz road delhi delhi", "order_status": "0", "created_by":