Posts

Showing posts from January, 2013

Excel: count unique values using SUMPRODUCT with multiple conditions -

ok, have sum product working give me count of unique values in column: =sumproduct((f2:f38<>"")/countif(f2:f38,f2:f38)) so if have numbers: 1, 2, 3, 1, 5, 6, 2, 5, 2 return 5 . but want count number of unique values based upon number, e.g.: name: sales: mike 2 bob 1 gary 1 mike 5 bob 6 gary 1 mike 3 bob 4 gary 2 mike 1 bob 2 gary 6 mike 3 bob 1 gary 1 mike 1 bob 3 gary 4 it there 4 unique values "name" mike, 5 unique values "name" bob, and 4 unique values "name" gary. because "name" mike there numbers 2 5 3 1 3 1 , unique numbers are 2 5 3 1 and therefore count return 4`. is there way of doing this? here's 1 solution. insert cell @ bottom value trying

meteor - How do I use {{#autoForm}} for each individual element of [Object] array? -

i similar question: meteor: custom autoform array of objects which say, want manually layout each field within every element of array. the difference is, still want use afarrayfield default template, including buttons add , remove array items. want pass own layout afarrayfield . how do that? if did not make myself clear, please request clarification , i'll rephrase. what need create custom template (doc : https://github.com/aldeed/meteor-autoform#creating-a-custom-template ). you can (not tested) : <template name="your_template"> {{# autoform [...]}} [...] {{> afquickfield name="players" template="custom_players"}} [...] {{/autoform}} </template> <template name="afarrayfield_custom_players"> custom template players field </template> you can take default afarrayfield template inspire : plain : https://github.com/aldeed/meteor-autoform/blob/devel/templa

c# - Is it possible to change CssClass via JavaScript? -

on page_load, use cssclass change classes of tablecells in c#. use javascript change classes of corresponding elements. doesn't change value of cssclass tablecells though. how can new classes in c# after changing them javascript? client-side changes don't affect controls when posting server because control's state stored on viewstate. possible work-around using hidden field store cssclass value client-side , manually update table cells on server hidden field.

android - Read files from USB bulk transfer -

i attempting write chrome app transfer files android or ios device plugged machine through usb. i'm working google nexus 7 , 5 device @ moment. using chrome usb api, can connect device, , have access list of of interfaces, , within each interface have access list of endpoints interface. can claim interface, , bulk transfer. i want find particular directory know name of, , copy directory of files , subdirectories, , files , subdirectories, host machine. but, i'm not sure how go it. interface use? endpoint within interface use? have pass in length of data want read bulk transfer, won't able determine directory/file size before doing transfer. how know length of data read in? once data back, how convert directory/file format can use?

android - How to browse to destination folder when clicking on download notification -

from app, downloading music files , saving them in folder. in notification panel download progress shown. when download completes, if notification clicked, android device should directly browse destination folder, similar "go folder" on pcs after download finishes. i tried below code, not working. opening app. public class temp extends activity { string[] link; string[] items; string song_link; string song_name; int song_index; int link_index; string url_link; exception error; private progressbar mprogress; long total = 0; boolean downloadstatus = false; progressdialog progressbar; private handler progressbarhandler = new handler(); int progressbarstatus = 0; uri selecteduri; intent intent; pendingintent resultpendingintent; notificationcompat.builder mbuilder= new notificationcompat.builder(this) .setsmallicon(r.drawable.ic_launcher) .setcontenttitle(

Apache Wink integration with Spring -

Image
i trying integrate apache wink 1.4 spring on jboss eap 6.4. below pom.xml excerpt. <dependency> <groupid>org.apache.wink</groupid> <artifactid>wink-server</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>org.apache.wink</groupid> <artifactid>wink-spring-support</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>org.apache.wink</groupid> <artifactid>wink-client</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>org.apache.wink</groupid> <artifactid>wink-json4j</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>org.jboss.archetype.eap</groupid> <artifactid>jboss-javaee6-webapp-archetype<

javascript - How to handle multiple getDistanceMatrix calls in the google api? -

i trying make multiple calls google api, function google.maps.distancematrixservice().getdistancematrix list of destination points. each call has point of origin , multiple destinations. how can 'map' result of each call input parameters? mean is, have several requests running, , each request calls callback function on completion. now, callback function unfortunately not receive original destination information (i.e. google.maps.latlng object) string see here ('destinationaddresses'), must again convert google.maps.latlng object... is there other way identify content of 'response' object list of google.maps.latlng objects given google.maps.distancematrixservice().getdistancematrix ?

r - Fill NA values with the trailing row value times a growth rate? -

what way populate na values previous value times (1+growth) ? df <- data.frame(year=0:6, price1=c(1.1, 2.1, 3.2, 4.8, na, na, na), price2=c(1.1, 2.1, 3.2, na, na, na, na)) growth <- .02 in case, want missing values in price1 filled 4.8*1.02 , 4.8*1.02^2 , , 4.8*1.02^3 . similarly, want missing values in price2 filled 3.2*1.02 , 3.2*1.02^2 , 3.2*1.02^3 , , 3.2*1.02^4 . i've tried this, think needs set repeat somehow ( apply ?): library(dplyr) df %>% mutate(price1=ifelse(is.na(price1), lag(price1)*(1+growth), price1)) i'm not using dplyr else (yet), base r or plyr or similar appreciated. it looks dplyr can't handle access newly assigned lag values. here solution should work if na 's in middle of column. df <- apply( df, 2, function(x){ if(sum(is.na(x)) == 0){return(x)} ## updated optimized portion @josilber r <- rle(is.na(x)) na.loc <- which(r$values) b &

scala - Parboiled2 PopRule example -

after reading documentation on https://github.com/sirthias/parboiled2 , discovered pop out of stack rule: type poprule[-l <: hlist] = rule[l, hnil] but not find working example of type of rule when l not string. for example, supose have following rule: case class a() case class b() def foo = rule { push(a) } def pop_rule:poprule[a, hnil] = rule { pop(a)} to justify there general definition of parboiled2 rule: class rule[-i <: hlist, +o <: hlist] where represents rule pops value from stack , puts value o stack. so far, cannot think of example implementation following rule type: def rule_of_interest:rule[a, b] = rule { pops(a) ~> push(b)}

javascript - Changing innerhtml value produces a blank line -

i have toggle link show or hide table. code link. when shown there no blank line between link , table underneath <a id='togglelink' name='togglelink' href='javascript:toggletable();' title='show inactive edb appointments' > <p style='text-align:center'>show inactive edb appointments </a> when link clicked table shows , change link text link.innerhtml = "<p style='text-align: center'>hide inactive edb appointments"; after code executed blank line appears between link , table underneath close off paragraph tag within html , javascript. <a id='togglelink' name='togglelink' href='javascript:toggletable();' title='show inactive edb appointments' > <p style='text-align:center'>show inactive edb appointments</p> </a> link.innerhtml = "<p style='text-align: center'>hide inactive edb

java - Hadoop's Hive/Pig, HDFS and MapReduce relationship -

Image
my understanding of apache hive sql-like tooling layer querying hadoop clusters. understanding of apache pig procedural language querying hadoop clusters. so, if understanding correct, hive , pig seem 2 different ways of solving same problem. my problem, however, don't understand problem both solving in first place! say have db (relational, nosql, doesn't matter) feeds data hdfs particular mapreduce job can run against input data: i'm confused system hive/pig querying! querying database? querying raw input data stored in datanodes on hdfs? running little ad hoc, on-the-fly mr jobs , reporting results/outputs? what relationship between these query tools, mr job input data stored on hdfs, , mr job itself? apache pig , apache hive load data hdfs unless run locally, in case load locally. how data db? not. need other framework export data in traditional db hdfs, such sqoop. once have data in hdfs, can start working pig , hive. never query db. in apa

html - ipython notebook converting to pdf with indent when starting a new paragraph -

Image
i don't want indent, looks ugly , not same in notebook. when converting html, looks in notebook, when converting pdf, new paragraph indent tab width. no indent annoying indent when converting pdf this current nbconvert 4.2.0. doesn't appear using official api seems reasonable expect change between versions. i'll explain process can worked out future versions too. by default pdfs rendered through latex using article.tplx template. found in <site-packages>\nbconvert\templates\latex directory. bit covers markdown rendering in base.tplx . so, create new template extends article.tplx , copy bit out of base.tplx covers markdown rendering. in 4.2.0 started line ((* block markdowncell scoped *)) . add in couple of commands jakob suggests above , use template render pdf notebook. the template file like: ((= line inherits built in template want use. =)) ((* extends 'article.tplx' *)) % markdown mod. copied base.tplx. parindent & pa

java - Drawing a sub-table in a separate window from object within object -

let's have list<string> lstcat contains entire list of categories need in both tables. i have observablelist<objecta> lstobject defined this: public class objecta { string mpid; string date; objectb insideobject; } with object b defined as: public class objectb { string symbol; int age; } so lstobject = [objecta1, objecta2, ...] what goal is have table appear of object a's members, , when click on row in table, table appears corresponding object b's members. i have code first table: private tableview init(stage primarystage) throws exception { group root = new group(); primarystage.setscene(new scene(root)); tableview<objecta> tableview = new tableview<>; list<string> lstcat = ... observablelist<objecta> lstobject = ... (int =0; lstcat.get(i).equals("symbol") == false;i++) { tablecolumn<objecta,string> col = new tablecolumn<>(lstcat.ge

ios - Dismissing presenting modal ViewController -

i have viewcontroller , presents modal viewcontroller. within modal viewcontroller want present mailcomposeviewcontroller . problem during dismissal. want dismiss both displayed viewcontroller @ same time. my predecessor grabbed instance of presentingviewcontroller , send message display mailcomposeviewcontroller , dismissed modal viewcontroller in baseviewcontroller . [self dismissviewcontrolleranimated:yes completion:^{ [self presentviewcontroller:mailviewcontroller animated:yes completion:nil]; }]; i try prevent this, godclass (over 5kloc) , need tear apart. so tried use same pattern in modal viewcontroller, used self.presentingviewcontroller instead. resulted in dismissing modal viewcontroller, not displaying anything. grabbing instance prior dismissal worked, delegate callback dismissal ignored (no wonder, modal viewcontroller not displayed anymore). so going delegate callba

google analytics - Several options for checkout_option in GA Enhanced Ecommerce -

what best way register several options single checkout step ga enhanced ecommerce? as documentation describes: // called when user has completed shipping options. function onshippingcomplete(stepnumber, shippingoption) { ga('ec:setaction', 'checkout_option', { 'step': stepnumber, 'option': shippingoption }); ga('send', 'event', 'checkout', 'option', { hitcallback: function() { // advance next page. } }); } the problem collect shipping , payment option in 1 step, , track both selections. here our initial idea: // called when user has completed shipping , payment options. function onstepcomplete(stepnumber, shippingoption,paymentoption ) { ga('ec:setaction', 'checkout_option', { 'step': stepnumber, 'option': shippingoption }); ga('ec:setaction', 'checkout_option', { 'step': stepnumber, 'option':

java - Trying to add minimum and maximum outputs -

i have read few of suggested answers seem helpfuil complicated me confidently understand , add program. can suggest ways output min , max 1st , 2nd years sales figures? import java.util.scanner; public class assignment2 { public static void main(string[] args) { scanner keyboard = new scanner(system.in); system.out.println("welcome!\n"); system.out.println("month 0 - january"); system.out.println("month 11 - december\n"); system.out.println("monthno(year1)\tsales made\n"); double sales[] = { 60, 54, 62, 67, 54, 67, 51, 50, 62, 55, 49, 70 }; int sum = 0; int average12 = 0; (int counter = 0; counter < sales.length; counter++) { sum += sales[counter]; system.out.println(counter + "\t\t\t\t\t\t" + sales[counter]); } system.out.println("\ntotal year 1 sales " + sum + "\n"); ///

javascript - HttpContext.Current.Request.Url.Host and window.location.host uppercase -

strange question, know, but, in case, can httpcontext.current.request.url.host or window.location.host return value in uppercase? should use .tolowercase , .tolower sure ok? using tolower() work string value effect have on host address? still show 192.xxx.xxx if point system.web.httpcontext.current.request.url.host.tolower();

SDN from (.Net) application programmer's point of view -

i have come across term sdn (software defined network). have gone through related webpages , understood related networking virtualisation. want understand sdn application developer/programmer's perspective. example, if have created set of websites , web services (in .net), things different in sdn in conventional network, in terms of development , deployment. i appreciate if explain example. thanks lot. before should mention here might changed in future. reason field still in research area , might face modifications in future. use cases may removed or added. one thing should maybe add sdn not network visualization. more that. think better 1 of applications/usages of sdn network visualization. let's consider onos : onos implementing controller internet service providers use cerate path , links. isp's specify 2 end points , onos goes , sends flows different switches in order make path between them. onos calls "intent", intent created between 2 po

java - MySQLIntegrityConstraintViolationException on mapping @onetomany unidirectional mapping in hibernate -

i have 2 entities having unidirectional onetomany relationship these are entity 1 public class jeans implements serializable { @id @generatedvalue private int id; @onetomany private list<colorandpattern> colorandpatterns; } entity 2 public class colorandpattern implements serializable { @id @generatedvalue private int id; private string description; private string background; private boolean enabled; private int gender; } i using hibernates default mapping result in generation of seperate table named "jeans+colorandpattern" onetomany mapping bussiness method i using hibernate's save method persist entity @override public int addjeans(jeans jeans) { sessionfactory.getcurrentsession().save(jeans); return jeans.getid(); } however when try add same colorandpattern different jeans getiing com.mysql.jdbc.exceptions.jdbc4.mysqlintegrityconstraintviolationexception: duplicate entry '1' key 'uk_la26iu

if statement - If in if in vb.net -

im making webbrowser , when press enter in textbox want see if there domain in there , if navigate url in textbox this i've done right now if e.keycode = keys.enter if textbox1.text.contains(".com") or textbox1.text.contains(".se") or textbox1.text.contains(".net") or textbox1.text.contains(".org") or textbox1.text.contains(".au") or textbox1.text.contains(".ws") or textbox1.text.contains(".co") or textbox1.text.contains(".biz") or textbox1.text.contains(".tv") or textbox1.text.contains(".info") or textbox1.text.contains(".int") or textbox1.text.contains(".gov") or textbox1.text.contains(".mil") or textbox1.text.contains(".dk") or textbox1.text.contains(".ac") or textbox1.text.contains(".ad") or textbox1.text.contains(".ae") or textbox1.text.contains(".af") or textbox1.text.contains(".ag&

javascript - How to blur only background and not content in Ionic/CSS -

Image
i trying have blurred background content. so far tried this: .background-image { background-image: url('../img/background/image.jpg'); width: 100vw; height: 100vh; -webkit-filter: blur(10px); -moz-filter: blur(10px); -o-filter: blur(10px); -ms-filter: blur(10px); filter: blur(10px); } and then <ion-view class="background-image"> // header, content, footer etc <ion-view> but problem whole screen blurred , not background follows: put content out side blurred div. .background-image { background-image: url('../img/background/image.jpg'); width: 100vw; height: 100vh; -webkit-filter: blur(10px); -moz-filter: blur(10px); -o-filter: blur(10px); -ms-filter: blur(10px); filter: blur(10px); } <div class="background-image"></div> <div>content</div>

matlab - How to multiply matrix having different size (without knowing exactly the size they will have)? -

i have multiply 2 matrices (scalar multiplication) have different sizes. instance, 1st has size n -by- m , 2nd n+1 -by- m+1 . fact is not case. mean, first has size n+1 -by- m+1 , 2nd n -by- m or n+2 -by- m+2 etc... example: a = [ 1 2 3; 4 5 6]; b = [ 1 2 3; 4 5 6; 7 8 9] i matlab check size of each matrix, multiply them using smallest size available between 2 i.e. ignoring last rows , columns of bigger matrix (or similarly, adding rows , columns of 0 smaller matrix). with example inputs obtain: c = [1 4 9; 16 25 36] or c = [1 4 9; 16 25 36; 0 0 0] how can write this? find number of rows , columns of final matrix: n = min(size(a,1), size(b,1)); m = min(size(a,1), size(b,1)); then extract relevant sections of a , b (using : operator) multiplication: c = a(1:n,1:m).*b(1:n,1:m)

php - How to run Behat tests when there are errors of level E_USER_DEPRECATED -

i have symfony 2.7 form type causing errors of level e_user_deprecated . errors not come own code vendor/symfony/symfony/src/symfony/bridge/doctrine/form/type/doctrinetype.php . in dev mode using web browser, can access page using said form fine. wdt show me deprecated messages form work, page returned status 200. using behat 3 (with behat\symfony2extension\driver\kerneldriver , behat\mink\driver\browserkitdriver ), request same url returns status 500 server error. stack trace in response shows deprecated errors causing exception. my behat configuration plain described in http://docs.behat.org/en/v3.0/cookbooks/1.symfony2_integration.html when define('behat_error_reporting', 0); on top of featurecontext.php file suggested https://stackoverflow.com/a/9217606/2342504 there no change in behaviour. after code scanning, guess constant behat_error_reporting removed in behat 3 , runtimecallhandler::errorreportinglevel used instead. yet have no idea how configur

css - Why do I have to use ! important in this case? -

i'm learning css , have result want if use ! important; specification. don't understand why can't override property inheriting 1 class , overriding property. form button.minor-action, #profile-left a.action, .minor-action { display: inline-block; background: @lightblue; color: white; padding: 0 1.2em; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; text-decoration: none; text-align: center; font-weight: bold; border: none; height: 25px; margin-top:1.0em; line-height:25px; white-space: nowrap; &:visited { color: white; } &:hover, &:active, &:focus { background-color: darken(@lightblue, 10%); text-decoration: none; } &.call-to-action { background-color: @pink; &:hover, &:active, &:focus { background-color: darken(@pink, 10%); text-decoration: none; } } } .extra-questions { margin-top: 0em !important; } i

php - laravel 5 : scalable relationship between more than 4 tables -

i'm working on e-learning project , want build scalable relationships between tables stuck on how map them using eloquent relationship. have 5 table 1. boards : id, name(field names) 2. standards: id, board_id, name 3. subjects: id, board_id, standard_id, name 4. chapters: id, board_id, standard_id, subject_id , name 5. questiontypes: id, type(like mcq, t/f, fill in blanks) 6. questions: id,board_id, standard_id, subject_id, chapter_id, question_type_id, question description structure boards represents study board mean state board , all standards represents class example: 1st 2nd etc subjects math , science etc chapters number system of math subject question_types represents type of question in project have 3 types of question can more questions table contains questions of chapter depending upon board , standard , subject . i'm using laravel 5 , i'm newbee in eloquent relationships you need create models each table: php artisan make:mo

angularjs - How to pass `controllers` status to `directive` template function? -

accoding current page, need change template. question is, how pass current page controller directives template method? here try: var myapp = angular.module('myapp', []); myapp.controller('main', function ($scope) { $scope.template = "homepage"; }); var gettemplate = function (page) { //i need $scope.template params if (page == "homepage") { return "<button>one button</button>" } if (page == "servicepage") { return "<button>one button</button><button>two button</button>" } if (page == "homepage") { return "<button>one button</button><button>two button</button><button>three button</button>" } } myapp.directive('gallerymenu', function () { return { template : gettemplate(template), //$scope.template need pass link : function (scope, element, attrs) { console.

linux - Bash: comparing two strings issues -

i have written following bash script: #!/bin/bash value="maria ion gheorghe vasile maria maria ion vasile gheorghe" value2="maria ion gheorghe vasile maria maria ion vasile gheorghe" if [[ "$value"!="$value2" ]]; echo "different" else echo "match" fi the problem script display "different" though strings stored in value , value2 variables not different. bash compare? and, question related issue. let`s have: v1 = grep 'a' a.txt v2 = grep 'a' b.txt can store , compare variables if grep results huge (lets more 50000 line each variabile)? ~ you need space around comparison operator in condition: if [[ "$value" != "$value2" ]]; echo "different" else echo "match" fi if don't this, you're testing string - literally maria ion gheorghe vasile maria maria ion vasile gheorghe!=maria ion ghe

excel - MS-Access 2013 unable to remove .laccdb locking file -

this long shot, 1 know how remove lock file created access 2013 file type ".laccdb". i have excel sheet connected access database via power query. access database on shared drive. when file closed locking file access database not deleted. when trying remove lock file says unable close program using. i've closed down machine, removed temp files, checked nothing running , checked in computer management within administration tools. , checked open files. i know database should split stop happening. not database, , user refuses split. any grateful. you can open , read lock file text editor (i use notepad++); within file should find computer name (or similar identifier) of one(s) have open. take name/number/whatever , see if can identify user is. should able close computer. hope helps.

python - save() takes at least 2 arguments (1 given) -

i'm trying send email out once field changed. i've done research , seen lot of solution similar issues none seems solve problem. it seems issue comes fact define 'user' @ start of save method. please! class countrylist(model.models): score= models.positivesmallintegerfield(null=true, blank = true, choices=zip(range(1, 11), range(1, 11))) country = models.charfield(max_length=100, null =true, blank=true) def save(self, user, *args, **kwargs): old_countrylist = countrylist.objects.get(pk=self.id) if old_countrylist.score!= self.score: send_mail('the user ' + user.username + ' has changed score ' + self.country \ + 'from ' + str(old_countrylist.score) + ' ' \ + str(self.score) + '.\nthis change made @ ' \ + str(datetime.datetime.now())[:19] + '. \n\nlink change: http://'

javascript - WebDriverJS control flow -

protractor uses webdriverjs under hood. webdriverjs uses concept of "control flow" ensure async tasks executed in expected deterministic order. so following work expected: myelement.click(); browser.executescript(...); but, if add function of promise returned 1 of these functions on browser, continue work in expected way? for example: browser.executescript(...).then(function() { browser.navigate(...); }); will control flow maintained above code? should be. it's called framing in webdriverjs' documentation : flow.execute(function() { console.log('a'); }).then(function() { flow.execute(function() { console.log('c'); }); }); flow.execute(function() { console.log('b'); }); // // c // b

Want to lazy load panel data in jsf application -

i have numerous accordionpanel in jsf page. <p:accordionpanel multiple="true" id="homeaddress"> so everytime add new accordion panel , load page, taking long time load panel.so want lazy load panels. @ first load 5 panel , once scroll end load rest of panels. happening in e-commerce site (flipkart, amazon etc..) an accordionpanel 1 componenent , complex pf components, not allow updating 1 of it's children or dynamicaly adding 1 (tabs in case). , dynamicaly loading different thing. can achieve adding an <p:outputpanel deferred="true" deferredmode="visible">... </p:outputpanel> inside each tab , put content in there. adding tab accordionpanel still reload tabs, lazy, ok, still reload them when accessed

python - Sorting list of strings based on substring in each string -

i have list below: = ['e8:04:62:23:57:d0\t2462\t-55\t[wpa2-psk-ccmp][ess]\ttest', '00:1b:2f:48:8b:f2\t2462\t-57\t[wpa2-psk-ccmp-preauth][ess]\tt_test', 'e8:04:62:23:4e:70\t2437\t-61\t[wpa2-psk-ccmp][ess]\tt_guest', 'e8:04:62:23:57:d1\t2462\t-53\t[ess]\t', 'e8:04:62:23:4e:71\t2437\t-56\t[ess]\t'] i want sort list based on numbers after third tab of each element, in case -55, -57, -61, -53 should change list order -53, -55, -57, -61. way have tried seems convoluted (making list of lists , on). should using regex/pattern simplify this? you can pass in custom lambda here sorted function desired result: >>> = ['e8:04:62:23:57:d0\t2462\t-55\t[wpa2-psk-ccmp][ess]\ttest', '00:1b:2f:48:8b:f2\t2462\t-57\t[wpa2-psk-ccmp-preauth][ess]\tt_test', 'e8:04:62:23:4e:70\t2437\t-61\t[wpa2-psk-ccmp][ess]\tt_guest', 'e8:04:62:23:57:d1\t2462\t-53\t[ess]\t', 'e8:04:62:23:4e:71\t2437\t-56\t[ess]\t'] &g

java - JPA Map Query Result to Class -

i want map query result simple pojo , can't figure out how it. for example, i've got following pojo: public class testmapper { private long tableaid; private string tableavalue; private long tablebid; private string tablebvalue; ... } now want simple query mapping class like: list<testmapper> testmappers = entitymanager.createnativequery( "select * tablea a, tableb b a.id = b.id", testmapper.class ).getresultlist(); this query not make sense represents want do. keep getting exception: exception description: missing descriptor [class testmapper] query: readallquery(referenceclass=testmapper sql="select * tablea a, tableb b a.id = b.id") what have do, solve issue?

How to set resultsLimit of jQuery token input plugin? -

how set limit 10 should token input plugin suggest ? want set limit 10 jquery token input plugin can suggest 10 search. i have tried resultslimit: 10 in initialization function still not working. any solution ? i had same issue , got work modifying token input js file. add following pieces of code. line 46 : resultslimit: null, line 680 : in populate_dropdown function //setting search limit if (results.length > settings.resultslimit) { results = results.slice(0, settings.resultslimit); } reference: https://github.com/loopj/jquery-tokeninput/issues/542

ios - Different size in Interface Builder and simulator -

Image
my app shows different sizes in simulator interface builder. there way set simulator show same interface builder? need labels , imageviews stay in same positions in interface builder. there way that? have many multiple classes , had set lot of coordinates don't want redo please see following link link autolayout www.techotopia.com

Removing duplicates out of multiple arrays, php -

i've got multiple arrays, , want remove duplicates. got unique items. array(4) { [0]=> string(14) "bergen op zoom" [1]=> string(9) "jan steen" [2]=> string(7) "culture" [3]=> string(11) "netherlands" } array(8) { [0]=> string(14) "fasion" [1]=> string(9) "conceptial" [2]=> string(7) "industrial" [3]=> string(11) "netherlands" } i want print strings out of array except last netherlands because it's printed. i've tried array_unique() if there duplicates in array itself. no clue how thing working.. try this array_unique( array_merge($array1, $array2) );

django ignores on_delete=Cascade when creating Postgresql-DBs -

i use django 1.7 create postgresql 9.3 db several tables contain foreign-key constraints. db used warehouse in objects have physical location. if object (in table stored_objects) deleted, i'd delete it's position, model location looks like: class object_positions(models.model): obj_id = models.foreignkey(stored_objects, db_column='obj_id',on_delete=models.cascade) (...) the constraint in db (after syncdb) looks this: alter table object_positions add constraint stored_obj_fkey foreign key (obj_id) references "stored_objects" (id) match simple on update no action on delete no action; is there else have constraint right in db? django uses it's own code handle cascades, they're not implemented on database level. main reason maintain consistent behaviour across backends, , allow model signals fire cascaded deletions. if reason want constraint on database level, you'll have edit table yourself. wouldn't recomme

php - Guzzle argument with [] fail to recognize as array -

in example of oficial documentation of guzzle: $request = $client->createrequest('put', 'http://httpbin.org/put', ['body' => 'testing...']); but: "argument 3 passed guzzlehttp\client::request() must of type array, string given" php version: php 5.5.9-1ubuntu4.9 (cli) is version of php or code lack of something? looks argument 3 must array try $request = $client->createrequest('put', 'http://httpbin.org/put', array('body' => 'testing...')); read more here arrays , structuring

How to prevent eclipse-integration-gradle plugin from putting subprojects among filteredResources? -

Image
i using eclipse ide gradle project, eclipse-integration-gradle plugin. when choosing "refresh all" menu item, plugin invokes gradle :eclipse task refresh .classpath , .project files. after gradle terminates, plugin seems automatically add gradle subprojects filteredresources in .project (possibly overwriting other filteredresources generated gradle before). such as: <filteredresources> <filter> <id>1435224149113</id> <name></name> <type>26</type> <matcher> <id>org.eclipse.ui.ide.orfiltermatcher</id> <arguments> <matcher> <id>org.eclipse.ui.ide.multifilter</id> <arguments>1.0-projectrelativepath-equals-true-false-myprojectname</arguments> </matcher> </arguments> </matcher> </filter> <

sql server - SSIS Variable Scope Issues -

Image
i'm trying iterate on few excel files in document using foreach loop. in control flow drag , drop each loop container. create new variable called excelfilepath , put under foreach loops scope: i edit foreach loop , set it's variable mapping map created variable: great. @ stage i'm assuming every iteration foreach loop does, it's going store file path (or whatever) current excel file in variable. next insert data flow task , add excel source. create excel connection manager, point correct sheet in document , specify columns want. test , see preview works nicely. nice. next want change connection manager, doesn't map same file whole time, instead uses variable foreach loop sets, specifying file use. right click on excel connection manager > properties, , add expression. choose 'excelfilepath' 'property' , excelfilepath variable created in foreach loops scope.. nothing. found. what i'm doing wrong here? i've followed var

python - No module named http_client error when trying to run django with django rest framework -

i trying create simple api using django rest framework. in view have following code. django.shortcuts import render moviestash.models import movie moviestash.serializer import movieserializer rest_framework import generics #list movies , add movies class movielist(generics.listcreateapiview): queryset = movie.objects.all() serializer_class = movieserializer #get movie , delete movie class moviedetail(generics.retrievedestroyapiview): queryset = movie.objects.all() serializer_class = movieserializer when run server , try go url following error. request method: request url: http://127.0.0.1:8000/ django version: 1.6 python version: 2.7.0 installed applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'moviestash', 'south', 'rest_framework') installed middl

servlets - Embedded Jetty: How do I call setSessionTrackingModes without a ServletContextListener -

i'm wiring embedded jetty server in main , want enforce cookies session tracking mode. so try do: //in main servletcontexthandler contexthandler = new servletcontexthandler(servletcontexthandler.sessions); contexthandler .getservletcontext() .setsessiontrackingmodes(enumset.of(sessiontrackingmode.cookie)); but following: exception in thread "main" java.lang.illegalstateexception @ org.eclipse.jetty.servlet.servletcontexthandler$context.setsessiontrackingmodes(servletcontexthandler.java:1394) my servlet context not yet initialized. the obvious solution in servletcontextlistener , i'd rather not. want wiring , setup stay in 1 central place without using listeners. is there way? the reason exception servletcontext doesn't exist yet (your server isn't started yet). but there's 2 ways accomplish this. technique 1) explicit session management: server server = new server(8080); // specify session id manage

Circle menu for mapview Marker in Android google maps API V2 -

i'm looking create circle menu markers in app uses google maps. i've found online example of trying do: http://demo-ee.com/index.php/examples/view/circle-menu-for-marker-with-mx-google-maps-for-expressionengine# problem google maps in webview, i'm looking on android. know if possible achieve google maps android , if is, how work involved it? possible rebuild example code in java use in android app? thanks i put answer , not comment, don't think can achieve same. first of all, on android don't have "hover" callback maps, can use onmarkerclick listener. try build custom infowindow (there few tutorial online never followed, can't give trusted one, have try :( ) , check if iw can placed around item. unfortunately on android there limited set of functionalities, honest, explore different ux (cards, dialogfragment or other). check how google maps behaves when clicking on place (a view scrollable bottom details). can think using toolb

android - How do I preserve a web view's display state across activity destruction? -

i'm making android app that's complex javascript app embedded in web view. web view refreshes every time main activity's destroyed (ie due rotation, button press, etc). to preserve state of web page, override onsaveinstancestate , onrestoreinstancestate : @override protected void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); // save state of webview webview.savestate(outstate); } @override protected void onrestoreinstancestate(bundle savedinstancestate) { super.onrestoreinstancestate(savedinstancestate); // restore state of webview webview.restorestate(savedinstancestate); } this prevented refresh, fell short of preserving display state of web page, important me since user loses work in complex js app stored in display state. i tried manually handle configuration changes overriding onconfigurationchanged . method preserved state rotation , other config changes, display state lost when user

php - How to populate the select list by jquery ajax in cakephp -

i using cakephp, , want selected degree id , want display subjects belongs selected degree in drop down list. degree select list below <div class="form-group"> <?php echo $this->form->input('primaryregister.degree', array( 'options'=>$degrees, 'empty'=>'-- select 1 --', 'label' => false, 'class' => 'form-control', 'id' => 'degree', 'required'=>'required') ); ?> </div> and jquery below $('#degree').change(function(){ var degree_id=$(this).val(); var base_url='<?php echo $this->webroot; ?>'; $.ajax({ type:'post', data:'degree_id='+degree_id, datatype:'json', url:base_url+'/pages/bla', async:false, success: function(data){ $(data).each(function() { $('.test')

javascript - Angular ngOptions Slice or ellipse -

i've got long sentences showing in ngoptions populating api.. how can slice em end ( red... or blue...) dots @ end of word..., ummm may should try creating filter should length of str , slice depending how many characters want..any appreciated. $scope.colors = [ {name:'blacksomerandomwords', shade:'dark'}, {name:'whitesomerandomwords', shade:'light', notanoption: true}, {name:'redsomerandomwords', shade:'dark'}, {name:'bluesomerandomwords', shade:'dark', notanoption: true}, {name:'yellowsomerandomwords', shade:'light', notanoption: false} ]; <select ng-model="mycolor" ng-options="color.name color in colors"></select> yourapp.filter('short', function() { // pass in collection, property shorten , max length return function(values, property, length) { angular.foreach(values, function(value) { value[property] = value[property]

c++ - linux shared library to support multi threaded application callbacks -

i need create shared library exposes set of apis used multiple processes might have more 1 thread apis called. this shared library in turn uses 3rd party shared library need register callback. 3rd party library calls registered callback different thread. i want know how block thread on call of api defined in library , release when callback 3rd party library. locking should not block other thread calling same api...! i'm using pthread library create library. psudo code: my library: int lib_init() { register_callback(callback); } int lib_deinit() { unregister_callback(); } int callback(void *) { <unblock functions> } int function1(int, int) { perform_action(); <should block till callback 3rd party library> } int function2(char, char) { perform_action(); <should block till callback 3rd party library> } 3rd party library: int register_callback(callback) { .... launch_thread(); .... } int unregister_callb

c++ - Is there the possibility to set a single component of a boost quaternion? -

i trying set single component of boost quaternion. @ first, in foolishness tried: quat.r_component_1() = 5.0; and of course did not work. had closer @ header file of boost quaternions , seems there no possibility set single component of quaternion. able set whole quaternion constructor, not single component. does know possibility set single component of boost quaternion, without setting whole quaternion constructor?

php - Codeigniter user_model Invalid argument supplied for foreach() -

i have problem user_model.php, below it's errors: a php error encountered severity: warning message: invalid argument supplied foreach() filename: models/user_model.php line number: 18 backtrace: file: \httpdocs\application\models\user_model.php line: 18 function: _error_handler file: \httpdocs\application\controllers\user.php line: 9 function: check_role file: \httpdocs\index.php line: 292 function: require_once user_model.php public function check_role() { $user_id = $this->session->userdata('admin_user_id'); // roles if ($user_id) { $row = $this->db->get_where(tbl_users, array('id' => $user_id))->row(); $roles = $this->db->get_where(tbl_roles, array('id' => $row->role_id))->row_array(); foreach ($roles $key => $value) { $this->session->set_userdata($key, $value); } } } what wrong fore

meteor - TypeError: callback is not a function -

i adding events calendar. ============this code============ events: function (start, end , callback) { var events = []; calevents=events.find(); calevents.foreach(function(evt){ events.push({ id:evt._id, title:evt.title, start:evt.date, }); }); console.log(events); callback(events); }, but in console, getting error , none of events showing on calendar. typeerror: callback not function if @ the docs fullcalendar , can see it's expecting third argument before callback: timezone . function( start, end, timezone, callback ) { } therefore right now, code using timezone (which named callback ) function, , doesn't much. add timezone in code shown above, , callback should work.

Android: get the photo from google place api photo response -

i'm building app requires photo of selected place using google places api. requested photo using https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=my_photo_ref&key=api_key my problem how can contain response , display in imageview. in advance well looks got it. https://maps.googleapis.com/maps/api/place/photo?maxwidth=[imagesize]&photoreference=[referencekey]&sensor=false&key=[yourkeyhere] this return single image based photo_reference key.

iphone - iOS Enterprise Program vs Volume Purchase Program -

Image
our company developed own products , want distribute our clients ( other companies ) personnels. have have ios company account ( similar individual account duns number registered ) . our clients may don’t want see specific apps on market; had distribute in different way. after research come 2 solutions; ios enterprise program custom b2b applications ( downloading volume purchase program ) a) know enterprise program applications should downloaded employees of company working. if bought program, distribute apps server ssl cert. how apple going check downloads ? since devices udid’s distributing not required registered , app can downloaded unlimited devices, how going validation process ? b) tried distribute app custom b2b could’t see option under prices segment. create new app under itunes connect , filled description parts. choose free option under prices tab , if location in turkey ( since verified conditions creating app ) couldn’t see checkbox “custom b2b app” ? missing