Posts

Showing posts from March, 2010

symfony - An error in submit form registration FOSUserBundle -

Image
when have submit form in registration fosuserbundle have error : any apreciated. far vague determine answer you. if inspect normalizerformatter.php file @ lines 77 , 82 can see it's doing , problems occuring. normalizerformatter.php: 76 $count = 1; 77 foreach ($data $key => $value) { 78 if ($count++ >= 1000) { 79 $normalized['...'] = 'over 1000 items, aborting normalization'; 80 break; 81 } 82 $normalized[$key] = $this->normalize($value); 83 }

javascript - Angular Material: md-select-header inside tab not working -

i having trouble regarding problem. i using: angular material 1.1.0 angular 1.5.5 the problem occurs when put md-select inside md-tabs md-select-header(search box) doesn't work anymore. not @ explaining things see codepen below. http://codepen.io/aldesabido/pen/gzgrbr it works when this. <md-select multiple=""> <md-select-header> <input type="search"> </md-select-header> <md-optgroup label="vegetables"> <md-option></md-option> </md-optgroup> </md-select> but not when this. <md-tabs md-dynamic-height md-border-bottom> <md-tab label="vegetable tabs"> <md-subheader class="subheader"> <md-select multiple=""> <md-select-header> <input type="search"> </md-select-header> <md-optgroup label="vegetables">

xcode - How to load images from Images.xcassets into a UIImage -

i trying code images uiimage having trouble. not sure how code each different image per list item. app building list pictures attached each list item. below mywhatsit class: class mywhatsit { var name: string { didset { postdidchangenotification() } } var location: string { didset { postdidchangenotification() } } var image: uiimage? { didset { postdidchangenotification() } } var viewimage: uiimage { return image ?? uiimage(named: "camera")! } init( name: string, position: string = "" ) { self.name = name self.location = location } func postdidchangenotification() { let center = nsnotificationcenter.defaultcenter() center.postnotificationname(whatsitdidchangenotification, object: self) } } below table view: override func numberofsectionsintableview(tableview: uitableview) -> int { return 1 } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -

Tortoise SVN Merge Multiple Branches into Trunk -

i know merging tortoise snv has been discussed (at length) cannot find answer situation. understand can merge dev branch trunk using merge wizard, proper workflow if want merge multiple branches trunk? in situation, created 3 dev branches (one each developer) project trunk. initially, dev branches , trunk identical. developers working in separate areas of project, multiple people not working same files. so, example, have trunk, b1, b2, , b3 trunk = b1 = b2 = b3 . now, after development, want merge changes each dev branch trunk. getting confused. have read can merge each branch trunk, 1 @ time (committing changes each branch before merging next one) since share same ancestory , tortoise smart enough know should changed. so: b1 -> merge trunk -> commit trunk (now trunk has b1 changes) b2 -> merge trunk -> commit trunk (now trunk has b1 , b2 changes) b3 -> merge trunk -> commit trunk (now trunk has b1, b2, , b3 changes) i have read should merge dev branch ch

javascript - Plot.ly js wind rose chart -

Image
can me how generate different color in 1 wind rose area of plotly js? having hard time on solving different colors in 1 area because know in every area of wind rose, should have 1 color each area. below image on trying inform of you. wind rose chart and also, how can overlap lines/radius lines color on every area in visible rather lines. , how can remove label axis names. in right section, manually put color color should same chart dynamic colors.

android - Is it possible to detect nearest Bluetooth device? -

hello building app in android , need scan bluetooth devices , show nearest one. looked android's bt api , page http://code.tutsplus.com/tutorials/create-a-bluetooth-scanner-with-androids-bluetooth-api--cms-24084 . still can't find solution possible? an example of me standing , 2 more persons standing next me 1 one meter me , other 2 meters me, both phone , bluetooth on. need detect person 1 meter me. clarify need filter nearest device pool of devices bluetooth search returns me, not calculate distance between paired devices. grateful. i it's not possible on android, @ least not bluetooth. @ signal strength each device, it's possible signal strength stronger far away object close one.

bootstrapper - Wix doesn't remove previous version of burn exe during major upgrade -

i have created wix exe using burn bootstrapper. when try major upgrade on it, new version gets installed. features missing in new upgrade removed existing folder structure. in "add or remove programs" can still find both installations. have incremented version 1.0.0.0 1.0.1.0 in bootstrapper project's bundle.wxs file. have incremented version in setup project's product element 1.0.0.0 1.0.1.0. didn't change upgrade code in either of these files. created new guid product id in setup project's product.wxs. doing wrong here? why previous version still there in add or remove programs? please advice. below bootstrapper project's bundle.wxs. <wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/utilextension" xmlns:bal="http://schemas.microsoft.com/wix/balextension"> <bundle name="kube installer" version="1.0.0.0" manufacturer="zone24x7" up

Google Compute Engine FTP Firewall -

i have ftp working on localhost on google compute engine. added firewall rule allow port 21 still cannot connect world ftp. any ideas? ftp complex protocol uses multiple tcp connections, feature causing trouble. port 21 used command channel data transfer done using new tcp connection necessary endpoints (i.e. port numbers) gets dynamically allocated , communicated inside command channel. this behavior makes impossible use securely simple firewalls, i.e. need have wide range of ports open time. more intelligent firewalls provide helpers watch command connection , dynamically open ports. these loose if use encryption, i.e. ftp tls (ftps), because can no longer inspect command connection. thus if there direct connection between client , server without firewalls in between ftp works fine. if 1 side behind firewall or nat (like home users) might have success after playing around active or passive ftp mode. if both sides behind firewall or nat have lost. instead of usin

android - How to call notifydatasetchanged in PagerAdapter? -

i have 1 listview each item contains 1 viewpager. , every time scroll viewpage got error said pageradapter changed adapter's contents without calling pageradapter#notifydatasetchanged! i tried set notifydatasetchanged in list adapter , pager adapter too, doesn't work. here listadapter: @override public view getview(final int position, view convertview, viewgroup parent) { final viewholder holder; if (convertview == null || convertview.gettag() == null) { convertview = inflater.inflate(r.layout.activity_detail_item, parent, false); holder = new viewholder(convertview); convertview.settag(holder); } else{ holder = (viewholder) convertview.gettag(); } item = data.get(position); holder.tv_bill_nm.settext(item.getbill_nm()); holder.tv_use_intt_nm.settext(item.getuse_intt_nm()); holder.tv_cust_nm.settext(item.getcust_nm()); //item.getitem_rec() arraylist of object pageadapter = new mypager_adapt

c# - How to match complete word to complete word seperated by space -

i want perform search operation on string. e.g have following string hi name babar , .net developer now if want search if word present in string or not using following code. if(str.contains("am")) { return true; } there problem in method return 2 word matched am , name . result am correct want result should complete word separated space. should not return name result. should match complete word not part of it. kindly me in problem i think best solution regular expressions. look here: c#, regex.match whole words regular expressions more efficient , more versatile. of course, cannon sparrow , better use contains() or similar.

cordova - Upload file to google drive using api with phonegap -

correct me if wrong per faqs went through, read javascript client library https://developers.google.com/api-client-library/javascript/reference/referencedocs used web applications. making mobile app using phonegap wherein user should able upload picture google drive. going through these links: https://developers.google.com/drive/v2/reference/files/insert an can see, uses javascript client library uploading file. there way can without using library. if how can using pure js or jquery? thanks thanks junyoung ... able finish part in log in , authorize. trying upload file drive. examples see use js client library. https://developers.google.com/drive/quickstart-js want execute same without use of gapi.client.request . want use simple post. here code const boundary = '-------314159265358979323846'; const delimiter = "\r\n--" + boundary + "\r\n"; const close_delim = "\r\n--" + boundary + "--";

android - Dynamic replacing of a fragment is not working -

i know there lot of posts cant find solution. i'm trying replace fragments on activity dynamically, have followed lots of tutorials , posts here , got stuck in 1 exception: " must implement onfragmentinteractionlistener" i have looked i'm getting tired of this. more exception occurs in fragmenttransaction.replace(r.id.content_frame,fragment); line, must missed on main activity cant see it. here of code.. public class loggedactivity extends appcompatactivity implements navigationview.onnavigationitemselectedlistener { private framelayout fragment; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_logged); this.settitle(r.string.app_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); actionbardrawertoggle toggle = new actionbardr

c++ - audio recording and real-time playing in windows using waveIn and waveOut -

i want record microphone audio input and, small time delay, play recorded sound immediately. done continuously using queue of buffers. i got code running point continuously plays microphone audio input, there short still noticeable repeated pauses throughout whole audio output using waveout. causing these annoying pauses? , how remove them? another question is, i'm not using thing mutex, i'm relying on fact wavein , waveout have same sampling rate , same amount of data, waveout follows wavein , wavein not write buffer being played. problem? here's code, should compile , run. made code run, , it's far being written. comment on improving code highly welcome. #include "stdafx.h" #include <windows.h> #pragma comment(lib, "winmm.lib") #include <iostream> #include <fstream> #include <sstream> using namespace std; handle hevent_bufferready; handle hevent_finishedplaying; #define sa

sql server - Updating table values with value from another table -

i'm trying update blank column values in table same column name. i've written statement values select p.[id] ,[patientid] ,p.[clinicid] ,[currentplannumber], pin.clinicid [productcheckout] p inner join patients pin on p.patientid=pin.id when try update columns error: only 1 expression can specified in select list when subquery not introduced exists. update [productcheckout] set clinicid = (select p.[id] ,[patientid] ,p.[clinicid] ,[currentplannumber], pin.clinicid [productcheckout] p inner join patients pin on p.patientid=pin.id) try this update pin set pin.clinicid = p.[id] [productcheckout] pin inner join patients p on pin.patientid=p.id

java - Why garbage collector stops all the threads before reclaiming the memory -

i reading performance related post, , encountered sentence " java's garbage collector stops threads before reclaiming memory, performance issue ". tried find on google, not. could please share can clear this? in principle don't have to. writing , using concurrent garbage collector is incredibly complex requires more breathing room operate efficiently, may not acceptable on memory-constrained devices incurs significant performance overhead. end trading throughput (cpu cycles spent in mutators vs. cpu cycles spent in collector threads) improved (zeroish) pause times. may acceptable deal on large heaps , many-core machines provide interactive services, may not acceptable on small devices or services batch processing. conversely implementation using stop world pauses simpler , more efficient in terms of cpu utilization downside there pauses. additionally have consider pause times can low on small heaps if we're using humans yardsticks. low-pau

bash - Write command that outputs all JPG images in directory with specific word in file name -

how write command outputs of jpeg images in directory contain word “red” file named “red_photos.txt”. generating files containing red easy; can pattern *red* . tricky part finding out whether jpeg file or not. like for f in *red* if file $f | fgrep -q ' jpeg ' echo $f >>red_photos.txt fi done two issues improvement left exercise (because not directly related question): if there many files containing red , might "arg list long" error. if there no file containing red , might error message saying wildcard not match files (depending on settings in bash scripts).

mergesort - Merge sort in java and copying array, still nlogn? -

i've taken @ few implementations of merge sort in java, , seems splitting part commonly done creating 2 new arrays, left , right , copying left , right parts arrays respectively. my question is: still gives nlogn time right? because each split have n+n time (n time splitting array, n time merging array) , there logn splits, have 2nlogn still nlogn. correct? which implementations looking at? primary sorting algorithms used jdk dualpivotquicksort (for primitive arrays), timsort , comparabletimsort (for object arrays/collections), , incomprehensible wizardy in arraysparallelsorthelpers concurrent sorts. all of these classes provide highly-tuned implementations of quicksort or mergesort (or in parallel case "cilksort" , sounds concurrency-friendly mergesort). these algorithms o(n log(n)) - it's impossible better o(n log(n)) without additional constraints on inputs. as whether these algorithms spend o(n) time copying values back-and-forth between t

geometry - Describe a plane with z = ax + by + c -

i have 3 points in 3-d space. want describe plane defined these 3 points equation z = ax + + c . how can find values of a, b, , c so? said way: have plane described equation z = ax + + c . have 2 points want remain in plane, , third point not yet lie in plane. want rotate plane axis described first 2 points, third point in plane, , find a , b , , c describe new plane using same formula. i've looked how rotate point in plane axis (and how find correct angle of rotation given new point want plane pass through), i'm not sure how work ax + + c there. said yet way (this convenient way me think it): have function f(x,y) = ax + + c , , want change value of f(x 1 ,y 1 ) amount without changing f(x 2 ,y 2 ) or f(x 3 ,y 3 ). substitute coordinates of points (xi,yi,zi) plane equations, , solve system of linear equations unknown a,b,c. cramer's rule suitable three-unknowns system. if have math library ready-to-use gauss elimination, lu method or solving methods

c# - The request failed with an empty response. Calling ASMX service behind Loadbalancer -

i have webservice https enabled in loadbalancer . external url appears this: https://www.domain.com/webservice.asmx?wsdl . http disabled webservice loadbalancer , http requests converted https load balancer. when try consume using soapui or application , run, throws error request failed empty response. now, when check soapaddress in wsdl http instead of https. changed https. getting same error. after lot of research, tried capturing traffic using fiddler , found strange. when method called applicaiton or soapui, protocol http , result 302 in fiddler.this must reason why failing. now, can done run https? why gets converted http though browser cannot call using http , have consumed service using https://xyz ... you need make sure binding client uses has security mode="transport" set (and client binding matches server binding), example: <binding name="yourclientsecurebinding"> <security mode="transport"&g

sql server - aging structure using sql query -

i have table structure following tno date netamt chq cash party --------------------------------------------- t1 01/04/2016 100 10 0 test1 t2 15/04/2016 50 0 0 test2 t3 18/04/2016 100 100 0 test3 now want make sql query give me aging report of transactions lying outstanding in slabs. i want see result in following format party 0-3 days 4-6 days 7-15 days --------------------------------------------- test1 0 0 90 test2 0 50 0 test3 0 0 0 try this select party, sum(case when datediff(day,[date],getdate()) between 0 , 3 (netamt - chq) else 0 end) [0_3_days], sum(case when datediff(day,[date],getdate()) between 4 , 6 (netamt - chq) else 0 end) [4_6_days], sum(case when datediff(day,[date],getdate()) between 7 , 15 (netamt - chq) else 0 end) [7_15_days], table1 group party

javascript - What is "=*" in AngularJS -

i've come across way of isolate binding specification: scope: { property: "=*" } what asterisk mean here? can please provide example? the isolate binding =* shallow watch change in collection. let me explain bit: normally watchcollection variables use in scripts below: $scope.arr = ['foo', 'bar', 'lorem', 'ipsum']; $scope.arrcount = 4; $scope.$watchcollection('arr', function(new, old) { $scope.arrcount = new.length; }); but if want object binding in html attribute itself? <my-directive my-attr="arr"><!--$scope.arr--> and, if this: scope: { myattr: "=*" } now, directive attributes assigned should shallow watch. , use of watchcollection of use time. so, =* used when need shallow watch changes (i.e. $watchcollection instead of $watch) can use =* or = attr (= ? or =*?attr if property optional) described in docs . although, can use = watchcollection wa

ios - Reorder dynamic UITableView by NSDate -

in app have uitableview fill core date items. as can see in post, have asked sorting function: https://stackoverflow.com/a/36703648/6012187 func resort() { coredataitems.sortinplace({sortascending ? $0.rowname < $1.rowname : $0.rowname > $1.rowname}) sortascending = !sortascending tableview.reloaddata() } now question is, how can set dynamically rowname value? example. save the rowname in user defaults. but $0.defaults.objectforkey("xx") doesn't work without syntax error next question is: how can sort row, value nsdate? you can sort nsarray contains nsdate using code: // objective-c code nssortdescriptor *datedescriptor = [nssortdescriptor sortdescriptorwithkey:@"startdatetime" ascending:yes]; nsarray *sortdescriptors = [nsarray arraywithobject:datedescriptor]; nsarray *sortedeventarray = [nodeeventarray sortedarrayusingdescriptors:sortdescriptors];

swift - Protocol method and default values -

Image
i have protocol method , when implementing class, want method have default values. because protocol can't have default values, don't know how use default values. class foo: bar { func addtext(text: string, alignment: int = 0, newline: bool = true) { print(text, alignment, newline) } } protocol bar { func addtext(text: string, alignment: int, newline: bool) } let a: bar = foo() let b: foo = foo() a.addtext("sometext") // results in error (missing argument...) b.addtext("sometext") // works is possible use default values without having cast class or overloading method manually? edit: works when add extension protocol bar extension bar { func addtext(text: string, alignment: int = 0, newline: bool = true) { } } is way? screenshot of playground: this seeing in playground. not sure causing issues.

git - Spring MVC issues in STS 3.7.3 -

i getting error on importing https://github.com/spring-projects/spring-mvc-showcase in sts 3.7.3:--- description resource path location type failure transfer org.codehaus.mojo:aspectj-maven-plugin:pom:1.2 https://repo.maven.apache.org/maven2 cached in local repository, resolution not reattempted until update interval of central has elapsed or updates forced. original error: not transfer artifact org.codehaus.mojo:aspectj-maven-plugin:pom:1.2 from/to central: connect timed out pom.xml /spring-mvc-showcase line 1 maven pom loading problem edit mvn ok pom.xml error still persists if remove errors , maven clean errors as: [info] https://repo.maven.apache.org/maven2/org/codehaus/mojo/aspectj-maven-plugin/1.2/aspectj-maven-plugin-1.2.pom [info] ------------------------------------------------------------------------ [info] build failure [error] plugin org.codehaus.mojo:aspectj-maven-plugin:1.2 or 1 of dependencies not resolved: failed read artifact descriptor org

Total seconds since midnight, Java -

i new programming. doing assignment intro java. in assignment, need find total number of seconds since midnight , changed number hours, minutes , seconds show current time. have small problem. when test code, totalseconds show 0! appreciated. sorry code chaos package clock; import java.text.decimalformat; import java.util.calendar; // current time public class clock { public static int totalseconds; public static int seconds; public static int minutes; public static int hours; public static int test; public clock(int hours, int minutes, int seconds ) { sethours(hours); setminutes(minutes); setseconds(seconds); } // use current time public clock() { calendar c = calendar.getinstance(); long = c.gettimeinmillis(); c.set(calendar.hour_of_day, 0); c.set(calendar.minute, 0); c.set(calendar.second, 0); c.set(calendar.millisecond, 0); long passed = - c.getti

mysql - How to drop table when a colum was setted cascade -

i have issue mariadb query. have 2 tables below create table kayttaja ( kayttaja_id integer not null auto_increment primary key, kayttaja_tunnus varchar(255) not null unique, kayttaja_salasana_encrypted varchar(255) not null, kayttaja_enabled tinyint not null, kayttaja_suku varchar(255) default null, kayttaja_etu varchar(255) default null, constraint fk_rooli_id foreign key(fk_rooli_id) references rooli(rooli_id) ) engine=innodb default charset=utf8; create table kayttaja_rooli ( id integer not null auto_increment primary key, fk_kayttaja_id integer not null, fk_rooli_id integer not null, foreign key (fk_kayttaja_id) references kayttaja(kayttaja_id) on delete no action on update no action, foreign key (fk_rooli_id) references rooli(rooli_id) on delete no action on update no action ) engine=innodb default charset=utf8; now want drop kayttaja table, how can do? i've drop kayttaja_rooli table, thanks. you can d

jquery - Display "End Date" based on datepicker "Start Date" and inputted date -

need answer possible! how end date based on inputted day interval , start date if have start date has value of 4/19/2015 , inputted day interval 10 how in jquery , event trigger if value inside datepicker input box changed. guys appreciate t_t. you may refer answer how add number of days today's date? assuming, using jqueryui datepicker. if so, use following code selected date, date selected datepicker. <script> $(function() { $( "#from" ).datepicker({ onselect: function( selecteddate ) { var startdate = selecteddate; // got startdate here } }); }); </script>

How to find and remove part of a string in Rails Console - ActiveRecord -

i'm looking way in rails console find values finish particular string , remove string value. something along lines of: model.all.each{|x| x.duration.slice!(" weeks")}.where("duration not null") so values such "47 weeks" become "47" , there isn't slice method activerecord/activemodel , don't know equivalent. any ideas?? thanks in advance... you can use where("column_name <matcher>") syntax search models column having matching substring: matching_models = model.where("duration '% weeks'") then iterate on result, using gsub replace column value matching_models.find_each |model| model.update_column(:duration, model.duration.gsub(/ weeks$/, "") end some relevant points: use find_each instead of each load data in batches better use memory. gsub used replace existing string. / weeks$/ regex matches strings ending in " weeks". model.update_col

cloud9 ide - How install php 5.6 in cloud 9? -

i using ide cloud 9. using version there 5.5.9. need 5.6. cant undestand how me install verison php 5.6. wich commands need use. can me step step how? thank never used cloud9 before. so, might want take @ https://community.c9.io/t/phpbrew-on-php-workspaces/621/2

javascript - AddEventListener with Angular and remove it -

i needed add event listener angular application. external plugin listening event trigger action. i did : $window.addeventlistener('itemloaded', itemloaded, false); it works don't find way remove event when change state (i use ui-router). do know better way angular add event , remove it, if state change ? thanks help. if code being called inside of controller, listen $scope.$destroy() event , remove listener when controller unloads. where calling from?

c++ - Structured Data: Nesting Triangles using structs and calculating -

problem description:write code of function takes triangle input , returns area. expected figure out how access data, understanding abstract data types defined.you may use method compute area vertices you required write function: function name : cal_area this function has 1 parameter triangle atriangle: contains 3 vertices of triangle in x-y plane. expected figure out how access data. function should following it should return area of triangle "atriangle" float. well question need fill following //-----include required headers here----- #include <iostream.h> #include <cmath> //-----end of headers----- //-----don't change/delete structs----- struct vertex{ float x; float y; }; struct triangle{ vertex vertices[3]; }; struct linesegment { point endpoint1; point endpoint2; }; //-----structs end here //-----add new functions here(if any)----- double eval (linesegment line, point p) { point p_a = p - line.endpoint1; point l_dir = line.

r - Push values to the left, replace NAs with zeros -

i have kind of data.frame mydata <- data.frame(matrix(seq(20*3), 5, 6)) mydata[1,1:3] <- na mydata[2,1:1] <- na mydata[2,4] <- na mydata[3,1:3] <- na mydata[3,5:6] <- na mydata[4,2:4] <- na mydata[5,1:2] <- na that looks this: userid x1 x2 x3 x4 x5 x6 1 na na na 16 21 26 2 na 7 12 na 22 27 3 na na na 18 na na 4 4 na na na 24 29 5 na na 15 20 25 30 i run code locates first non na value, , pushes sequence there, , replaces na 0. data going this: userid x1 x2 x3 x4 x5 x6 1 16 21 26 0 0 0 2 7 12 0 22 27 0 3 18 0 0 0 0 0 4 4 0 0 0 24 29 5 15 20 25 30 0 0 we can use apply margin=1 loop on rows, identify index of first non-na value ('i1'), v

JNI is crashing the java in windows 7 -

i porting code linux windows , since there no support linux shared memory segments in java. hence, using java native interface (jni) access shared memory.it working fine on linux platform . code shmget: jniexport jint jnicall java_emulatorinterface_communication_shm_sharedmem_shmget (jnienv * env, jobject jobj, jint count,jint maxnumjavathreads,jint emuthreadsperjavathread, jlong coremap, jint pid) { uint64_t mask = coremap; int size;//=sizeof(packet)*(count+5)*maxnumjavathreads*emuthreadsperjavathread; char str[50]; int ptr; #ifdef _win32 handle hmapfile; #endif printf("hello"); size=sizeof(packet)*(count+5)*maxnumjavathreads*emuthreadsperjavathread; /*if (sched_setaffinity(0, sizeof(mask), (cpu_set_t *)&mask) <0) { perror("sched_setaffinity"); }*/ //set global variables gcount = count; gmaxnumjavathreads = maxnumjavathreads; gemuthreadsperjavathread = emuthreadsperjavathread;