Posts

Showing posts from May, 2014

Does creating a Twilio Capability Token require a request to Twilio's servers? -

does creating twilio capability token require request twilio's servers? if understand correctly, creating twilio capability token involves kind of encryption process happens exclusively on own server. when call library create one, not making call twilio's servers, correct? if purely encryption process, encryption process that's designed "slow". if so, how slow? i believe creation of token according c# api, happens on own server. process creates json web token , returned generatetoken call. cannot see cause above call slow @ all. i know server side code, process blindingly fast, in our production servers, when token expires twilio client, requests new 1 server , initialises again, process takes less 2 seconds complete , client once again able either make or receive calls, depending on allowed capabilities. perhaps if share more experiencing slow, 1 able more? i hope helps.

ios - How to write UIImage to NSOutputStream with complete data -

how send uiimage nsoutputstream complete data. have try code output not write complete image. how send output complete data of image. - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingimage:(uiimage *)image editinginfo:(nsdictionary *)editinginfo { nsdata *imgdata = uiimagejpegrepresentation(image, 0.2); nsmutabledata *completedata = [[nsmutabledata alloc] initwithbytes:[stringdata bytes] length:[stringdata length]]; [completedata appenddata:imgdata]; nsinteger byteswritten = 0; while ( imgdata.length > byteswritten ) { while ( ! self.outputstream.hasspaceavailable ) [nsthread sleepfortimeinterval:0.05]; //sending nsdata on server nsinteger writeresult = [self.outputstream write:[imgdata bytes]+byteswritten maxlength:[imgdata length]-byteswritten]; if ( writeresult == -1 ) nslog(@"error code here"); else byteswritte

plot - plotting a text file with 4 columns in matlab -

i want plot text file 4 columns first column in longitude,second in latitude, third depth , forth amount of displacement in each point.(it's related fualt) -114.903874 41.207504 1.446784 2.323745 i want plot show amount of displacement in each point (like images plot imagesc),unfortunately "imagesc" command doesn't work it. how can plot it? attention a simple way use scatter3 , assign displacements colours. note have supply size work - i'm using [] (empty matrix) set default. if 4 sets of values 4 vectors of same size, it's like: scatter3(lat,lon,depth,[],displacement, 'filled') values in displacement linearly mapped current colormap. 'filled' gives filled markers rather open ones (default marker circle can changed).

sql - XML Parsing in Stored procedure -

Image
i have xml shown below <studentdata> <student id ="1" rollno ="15" /> </studentdata> one of stored procedure accepts xml input shown below create procedure [dbo].[fetchstudentdata] @xml xml begin set nocount on; select st.value('@id','int') id, st.value('@rollno','int') rollno @xml.nodes('/studentdata/student')as temptable(st) end here want save id , rollno in variable can use them in further queries in stored procedure. don't know exact syntax fetch id , rollno node , store in variable. can suggest me way it? this query helpful. create procedure [dbo].[fetchstudentdata] @xml xml begin set nocount on; declare @sid int, @srollno int select @sid = xmldata.student.value('@id','int'), @srollno = xmldata.student.value('@rollno','int') @xml.nodes('//studentda

android - Bluetooth disconnecting -

i'm developing app pair smartphone evaluation board via bluetooth. find board in phone , pair them, when happens, conection gets lost. have tried pair them other app , works well, must in code. these steps app follows make conection. mainactivity: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); /*gets bluetooth adapter*/ globalvar.mbluetoothadapter = bluetoothadapter.getdefaultadapter(); /*resgisters receiver*/ registerreceiver(bluetoothdeviceselectedreceiver, new intentfilter( "android.bluetooth.devicepicker.action.device_selected")); /*calls method make conection , pair devices*/ newconection(); } public void newconection() { /*our device not support bt*/ if (globalvar.mbluetoothadapter == null) { toast.maketext(this, r.string.bluetooth_not_available, toast.length_long).show(); finish(); return; }

Use Spring Security with Oracle & Grails -

i ask plugin should use achievie following functionality: user send http post contains json username & password data (to grails web service) ask oracle db these data , receive true or false if true generate token , keep somewhere information user&token (could domain class) check every other request if contains valid token , allow user custom webservice. so far, tried 2 plugins: spring-security-rest & spring-security-core. both worked fine (spring security rest alvaro sanchez offer functionality listed above), both force on me 2 domain classes : user , role (currently dont want store kind of data there). do have solutions? or should functionality myself? thanks in advance! the spring security plugin not force store user , role data in user , role domain classes. doesn't force store them in database @ all. can data anywhere (a web service, memory, text file, etc.) if you're not storing in domain classes you'll need provide custom userde

service - Autofac.Extras.Quartz with ConcurrentExecutionDisallowed not working -

in windows service using quartz.net autofac. assist me here using nuget autofac.extras.quartz. far good, when try apply disallowconcurrencyexecution attribute ignored , multiple jobs spawned. i using follows: registration builder.registermodule(new quartzautofacfactorymodule()); builder.registertype<companydatabaseprocessor>().as<ijob>().instanceperlifetimescope(); setup var fact = container.resolve<ijobfactory>(); _scheduler = stdschedulerfactory.getdefaultscheduler(); _scheduler.jobfactory = fact; _scheduler.start(); var job = jobbuilder.create<ijob>() .withidentity("qprocjob", "a3group") .build(); var trigger = triggerbuilder.create() .withidentity("qproctrigger", "a3group") .startnow() .withsimpleschedule(x => x .withintervalinseconds(executeevery) .repeatforever()) .build(); _scheduler.schedulejob(job, trigger); and when in ijob, check context.jobdetail.co

r - Incrementation with multiple conditions -

this question add-on this one. thought additional condition substantial enough create new question. i have dataframe of date s , event s below. data <- data.frame( date= as.date(c(rep("24.07.2012",12), rep("25.07.2012",8)), format="%d.%m.%y"), event=rep(0,20) ) data$event[10] <- 1 data$event[15] <- 1 i want add start counter column increments in 10's , reset: 1) right after event=1 observed. 2) when date has changed previous row. so desired output additional start column be: date event start 1 2012-07-24 0 0 2 2012-07-24 0 10 3 2012-07-24 0 20 4 2012-07-24 0 30 5 2012-07-24 0 40 6 2012-07-24 0 50 7 2012-07-24 0 60 8 2012-07-24 0 70 9 2012-07-24 0 80 10 2012-07-24 1 90 11 2012-07-24 0 0 12 2012-07-24 0 10 13 2012-07-25 0 0 14 2012-07-25 0 10 15 2012-07-25 1 20 16 2012-07-2

javascript - jQuery Datepicker Show Current Date -

datepicker script: $(function(){ $( "#task_start_date").datepicker({ dateformat: 'dd-m-yy', showon: 'button', buttonimage :image_us, buttonimageonly: true }); html input: <input type="text" class="form-control validate[required,custom[date]]" name="task_start_date" id="task_start_date" /> when clicked in calendar icon, dateformat: 'dd-m-yy', outputs 27-nov-2014 , shows current date highlighted, but dateformat: 'dd-m-y', outputs 01-mar-12 , shows 01-mar-12 highlighted instead of current. i using jquery validation engine validate date format. below fiddle works fine not expected date format. js fiddle: fiddle thanks. i saw js fiddle. think, have mistake on regexp result null. i tried change regexp. new regexp(/([12]\d|0[1-9]|3[0-1])-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)-(\d{4})/); change to ne

android - Navigation with Tabhost and viewpager, data lost issue -

Image
i build app sliding menu , has tabs created using viewpager. i'm getting issue. first time when run app, data getting on first screen on tabs. when change screen using sliding menu, takes me other fragment , when come home screen, data on tabs goes away. used setretaininstance(true); store view when change orientation. when change orientation, data appears strangly. not able find problem. here code. mainactivity public class mainactivity extends fragmentactivity { private drawerlayout mdrawerlayout; private listview mdrawerlist; private actionbardrawertoggle mdrawertoggle; // nav drawer title private charsequence mdrawertitle; // used store app title private charsequence mtitle; // slide menu items private string[] navmenutitles; private typedarray navmenuicons; private arraylist<navdraweritem> navdraweritems; private navdrawerlistadapter adapter; viewpager tab; tabpageradapter tabadapter; actionbar ac

count elements falling within certain thresholds in array in matlab? -

i have huge vector. have count values falling within ranges. ranges 0-10, 10-20 etc. have count number of values fall in range. i did : for i=1:numel(m1) if (0<m1(i)<=10)==1 k=k+1; end end also: if not(isnan(m1))==1 x=(0<m1<=10); end but both times gives array contains 1s. wrong doing? you can (also works non integers) k = sum(m1>0 & m1<=10)

ios - limit input options in init() in swift -

i'm making simple dice class in swift. i dice initializer called desired amount of eyes/sides dice should have. have 2 variables set min , max of number of sides should able give dice upon init... however, i'm not quite sure of how make init fail if dice being initialized number outside of range, when can't make sue of try/catch in swift. my code follows: class dice : skspritenode { let sides : uint32 var score : int init(sides : int){ let min_sides = 2 let max_sides = 6 self.sides = uint32(sides) self.score = 1 let imagename = "1.png" let cardtexture = sktexture(imagenamed: imagename) super.init(texture: cardtexture, color: nil, size: cgsize(width: 100, height: 100)) userinteractionenabled = true } use failable initializer instead. can return nil value if condition doesnt satisfied init?(sides : int){ if sides > max_sides{ return ni

java - converting resultset to RDF/XML in Jena -

i'm trying convert resultset in xml/rdf format code: resultset result = rmparliament.selectquery(select); system.out.println(resultsetformatter.astext(result)); resultsetformatter.outputasrdf(system.out, "rdf/xml", result); the second line of code verify correct behaviour of query (it works!), in console following output: <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/xmlschema#" xmlns:rs="http://www.w3.org/2001/sw/dataaccess/tests/result-set#" > <rdf:description rdf:nodeid="a0"> <rs:size rdf:datatype="http://www.w3.org/2001/xmlschema#int">0</rs:size> <rs:resultvariable>value</rs:resultvariable> <rs:resultvariable>property</rs:resultvariable> <rs:resultvariable>name</rs:resultvariable> <rdf:type rdf:resource="http://www.w3.org/2001/sw/dataaccess/tests/result-se

osx - Mercurial: Meld launching issues in Mac OS X and Meld not detected in Mercurial -

i installed meld using macports following instructions in here . installed xquartz well. problem is : every time tried launch meld command line, received bunch of errors warning messages below, , somehow meld window still launched. rid of these error messages because make me feel unsafe using meld if these error msgs pop every time try launch. there solution ? couldn't bind translation domain. translations won't work. 'module' object has no attribute 'bind_textdomain_codeset' ** (process:622): warning **: trying register gtype 'gmountmountflags' enum when in fact of type 'gflags' ** (process:622): warning **: trying register gtype 'gdrivestartflags' enum when in fact of type 'gflags' ** (process:622): warning **: trying register gtype 'gsocketmsgflags' enum when in fact of type 'gflags' /opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/gobject/__init__.py:115: war

javascript - Using polyfill for input type 'range' in IE9 -

i'm trying use html5 input type 'range'. not supported in ie8 & ie9 , replaced input type 'text'. make field work i'm using polyfill input type 'range'. polyfill i'm using is: rangeslider.js ( http://andreruffert.github.io/rangeslider.js/ ) the html of inputfield looks this: <input type="range" id="somefield" name="somefield" required="required" min="0" max="100" step="1" class="classname" value="10"> the javascript runs polyfill called on input[type="range"]. example: $('input[type="range"]').rangeslider(); somehow polyfill works correctly if call on input element, , not on element class. calling below not work (it render, value of range not stored in input element): $('.classname').rangeslider(); however, ie replaces input in dom following html: <input name="somefield" class="

css - height:auto after div position -

Image
there frame consisting of 3 sections top bottom. bottom covering section 3 relative area in 1 part absolute height 100px 2 sections height of non-auto in section 3 2 after auto replace div want place absolute location data 2 auto not mean 3 how think should part div css? friendly speaking, question not clear... far understand picture, want put red div under 2 absolutely positioned divs (green , yellow). you can absolutely position red div inside yellow div , make top value more 100%, so: .red-div { position: absolute; left: 0; top: 100%; margin-top: 20px; width: 100%; height: 40px; } or if know height of yellow , green divs together, can just .red-div { margin-top: (sum of yellow , green heights , there margins) px; }

Spring WebFlow (seemingly) randomly stops working in Spring Boot app -

i have flow seemed working fine until yesterday, when started getting following exception in html page maps first state in flow: org.springframework.expression.spel.spelevaluationexception: el1007e:(pos 0): property or field 'flowscope' cannot found on null the offending line of code was: <h3 th:text="${flowrequestcontext.flowscope}"/> further investigation showed none of flow variables available anymore. furthermore if put print statements service flow makes various calls to, can see none of these methods being called anymore - it's flow isn't running @ all. this was working fine previously. reverted of local changes stable version of code, , same issue happening there well. thing seemed temporarily around problem restart computer - problem disappeared short while came back. to honest i'm out of ideas have started causing such intermittent problem. thinking along lines of stale java process running in background interfering future r

excel - Identifying a worksheet other than by its name -

a worksheet can identified name such in example: dim mysheet worksheet set mysheet = thisworkbook.sheets("my sheetname") now wonder if worksheet can identified other name, example unique id or property or whatever. my problem following: referring code snippet above: if user changes name of worksheet (e.g. "my sheetname" "your sheetname"), snippet won't work anymore. this article explains better use sheetid (also called codename) instead of sheet name. quoting: the codename property internal name excel uses identify each sheet. unlike worksheet.name property, codename remains same regardless of sheet name, or sheet order. the code name can changed more descriptive: thisworkbook.vbproject.vbcomponents("sheet1").name = "revenue_actuals" and then revenue_actuals.range("c2").value = 10 works fine. using codenames (such sheet1.range("c1").value ) idea, changing code name

Test transaction management in TokuMX -

i new tokumx. since tokumx supports transaction managament , want test same. how test it? there use case/ sample code test same? please guide. tokumx's transactional semantics, including multi-statement transactions, documented here , here , , there more examples in blog post .

java - sqlite-jdbc for SQLite v2.X -

we having lot of sqlite databases (of version 2.x) in cent os linux servers. there need read database content using java , operations on it. i couldn't find sqlite jdbc compatible sqlite v2.x version. if try use latest jars available here ( http://mvnrepository.com/artifact/org.xerial/sqlite-jdbc ), got error, error :[sqlite_notadb] file opened not database file (file encrypted or not database) where can find jdbc driver jar sqlite v2.x or there other work around ? to convert database file sqlite 2 sqlite 3, can use command-line shells of both versions dump database sql commands, , recreate it: sqlite db2.sqlite .dump | sqlite3 db3.sqlite there no sqlite 2 driver modern language (except perl , php).

c# - Condition using File::Exists not working -

i create first msbuild-script. i've tag "folders" findes directories in given root path: <?xml version="1.0" encoding="utf-8"?> <project defaulttargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" toolsversion="4.0"> <target name="build"> <propertygroup> <rootfolder>tmp</rootfolder> </propertygroup> <itemgroup> <folders include="$([system.io.directory]::getdirectories(&quot;$(rootfolder)&quot;))"/> </itemgroup> <message text="@(folders -> '%(fullpath)\bin\debug\%(filename)%(extension).dll', ';')"/> </target> </project> that works perfect. problem need directories specified file exists. tried condition that condition="$([system.io.file]::exists(&quot;%(fullpath)\\bin\\debug\\%(filename)%(extension).dll&quot;)

google chrome - window.print is blocking the javascript execution in the source window -

in web app want integrate print functionality. when user clicks print button, new window opening , print dialog appears. code want achieve this: var win = window.open(url, '_blank'); win.print(); it working, problem in chrome source window stops javascript execution while print dialog open. how possible prevent this?

jquery validation remote validation rule depending if body has a class name -

i using jquery validate plugin validate form. one field has remote rule checks make sure value entered isn't in database. rule used 2 different pages , both have different body class identifies them validation rule. the problem it's failing on depends rule remote validation never happens. if remove depends part, remote validation works. what wrong depends part make fail? $("form").validate({ errorclass: "autherror", errorelement: "div", rules: { some_field: { required: true, remote: { depends: function() { return $('body').hasclass('some-class'); }, type: 'post', url: '/check.php', data: { 'something': $('#some_field').val() } }

angularjs - Angular with CouchDB Cookie Authentication 401 -

i login angular app couchdb cookie authentication. the first step make admin account try curl if cookie authentication works. i post curl curl -vx post 127.0.0.1:5984/_session -h 'content-type: application/x-www-form-urlencoded' -d 'name=foo&password=bar' and comes out " http://i.stack.imgur.com/j23hu.jpg " yes username , password correct user made "setup admin of futon" (is there different username , password should looking for?) cors enabled origins set * advance thanks on screenshot take on last line: 'password' not recognizes external or internal command... . on windows need use double quotes escape special characters, not single ones, or write & ^& .

swift - difference between implicitly unwrapped optionals and non-optionals -

if implicitly unwrapped optionals said in swift programming apple supposed have value why not use non-optionals instead ? know know non-optionals can't assigned nil there other difference? is there other difference? impilicitly unwrapped optional can compared nil . var a:string! if == nil { // nil }

sql - Is there any chance to rearrange the execution plan manually? -

Image
i have 2 tables, need needcategory need table has clusted index on needid column, , needcategory have composite clustered index on needid , categoryid. now take on following query , execution plan query. select n.needid,n.needname,n.providername dbo.need n join dbo.needcategory nc on nc.needid = n.needid isactive=1 , categoryid= 2 order needname clustered index scan on need table happens isactive= 1. clustered index scan on needcategory table happens categoryid=2 my question is, why scan happens before join occurs? if happens after join filter lighter. if optimizer chooses scan execute first. is there chance rearrange execution plan manually? thanks in advance no not lighter after join. why think lighter after join? why think better match on nc.needid = n.needid then filter? if filter first never have match nc.needid = n.needid going eliminated anyway. that relatively cheap merge join thing. lets

how to call a parameterized constructor in java -

i new java ,i want call default parameterized constructor code not working java code public class sample{ public static void main(string args[]){ 1 o=new one(25); } } class one{ public void one(string a){ system.out.println(a); } } there mistake in code. remove void constructor. more specific replace class with class one{ public void one(string a){ system.out.println(a); } } if adding return type, java consider method, instead constructor, though class name , method name (class name) similar. also please not trying call constructor new one(25) , incorrect. should pass argument string new one("25")

actionscript 3 - How Can I distinguish user is login from Web or Android or IOS? -

i using air 14 , flash cs6 , actionscript3.i developed 1 game.now want play game in web,android,ios.but problem whenever user login want know he/she login means (web,android,ios).how can know.any suggestion. the class flash.system.capablities has os property give string representation of operating system user has.

activeperl - Combine multiple statements into an expression in Perl? -

is possible combine multiple statements single expression? block wondering whether packaged expression. that's do block 's purpose. for example, my $file = { open(my $fh, '<', $qfn) or die $!; local $/; <$fh> };

Javascript - callback with objects -

i have problem callback function. want write function, can iterate object (i want use callback method), it's not working , don't know wrong this. i'll glad help. services = [ { name: "a", }, { name: "b" } ] function service (data) { this.name = data.name } function getdata (i) { sample = new service(services[i]) console.log(sample) } getdata(0) /* function work*/ function getall(index, count, callback) { service = new service(services[index]); console.log(service) if (index < count) { callback(index + 1, count, getall) } } getall (0, services.length, getall) /* function not working */ the error due calling services[2] doesn't exists. getall function below solves problem function getall(index, count, callback) { if (index < count) { service = new service(services[index]); console.log(ser

sql server - Need help optimizing a simple query -

let's have following query: select count(id) numrows, sum(value) totsum sometable foo= @bar simple enough. sums values column foo equals passed parameter, , counts how many rows involved in sum. now, in program have logic evaluates value if resultant count below, let's say, 4. i want optimize query empty result set if count above 4. first idea slap condition on query (where numrows < 4), wouldn't work because numrows isn't column defined in sometable. second idea make query subquery, , filter results through subquery's table, so: select * ( select count(id) numrows, sum(value) totsum sometable foo= @bar ) subquery subquery.numrows < 4 my main question solution whether or not subquery computed, or if main query halts numrows hits 4. you can add original query. more easy-to-read , (not sure) better performance. having count(id) < 4

c# - How do I extract and replace a substring with a different value -

i have following string: "using following data [environmentvar][testaccount] status connected" what want replace [environmentvar][testaccount] data retrieved xml file. need first extract [environmentvar][testaccount] own string , have method query xml, furthermore need once i've retrieved value replace original string. there's curve ball, structure wont be: [environmentvar][testaccount] it might have "nodes" like: [systemtest][environmentvar][testaccount] or [region][systemtest][environmentvar][testaccount] as long can extract pattern original string can grab data it. mentioned above need able replace "[systemtest][environmentvar][testaccount]" data i've retrieved. example might simple "ukuser" gets returned new string end being "using following data ukuser status connected" any guidance appreciated, i'm sure there many ways of doing this. update heres , example string myquery = "using f

sql - How to avoid this NOT IN clause? -

i have 3 tables: the scenario | users | | teams_users | | teams | -------- ------------- ------- | id | | user_id | | id | | team_id | | begin_date | | end_date | so. if user assigned team, new team_users registry id created, , end_date null. if user pulled of team, end_date filled current date. why way? because there's need keep history of user in team. the problem when i'm creating/editing team, want present list of available users team. list should follow these rules: the user can't in current team the user can on team the user can have team_user registry, end_date != null the solution far i'm using rails 2.3.14 (don't ask!). solution far is: #team_id current team users_on_this_team = teamuser.all( :conditions => {:team_id => team_id, :end_date => nil} ).collect { |team_user| team_user.user_id }

html5 - Can title tag be used as attribute in html tag? -

is valid use title attribute of html tag, example: ? w3c says supported in html5, not getting expected result on chrome 38.x. i think may misunderstanding purpose of title attribute, merely used define information element browser typically render tool tip when hover over. not intended used set page title, title tag still used that. while, according html5 spec, title attribute valid on html tag (it's valid on tags) i'd wager it's pretty useless.

apache - How to rewrite a directory to a 404 page? -

i have hosting account, has website on it. let's call it: www.example.com in cpanel, i've set addon domain: www.example2.com, points folder on www.example.com: www.example.com/example2 how can throw 404 error if directly visits www.example.com/example2 ? i've tried in .htaccess file: options -indexes rewriteengine on options +followsymlinks rewriterule ^example2(.*) - [r=404,l,nc] but didn't work. still shows index.php of example2 folder. both www.example.com , www.example2.com websites have own .htaccess file. if disable .htaccess file on www.example2.com, above mentioned redirect works. inside /example2/.htaccess have rule first rule: rewriteengine on # if host name not example2 throw 404 rewritecond %{http_host} !^(www\.)?example2\.com$ [nc] rewriterule ^ - [l,r=404]

How to get elements of first array of hashes that not present in second array of hashes in Perl -

how elements of first array of hashes not present in second array of hashes. example, have 2 arrays of hashes: my $arr1 = [ { id => 1, name => 'element 1'}, { id => 2, name => 'element 2'}, { id => 3, name => 'element 3'}, { id => 4, name => 'element 4'}, { id => 5, name => 'element 5'}, ]; $arr2 = [ { id => 1, name => 'element 1'}, { id => 3, name => 'element 3'}, { id => 5, name => 'element 5'}, ]; result should be: my $arr3 = [ { id => 2, name => 'element 2'}, { id => 4, name => 'element 4'}, ]; you can build hash look-up , filter @$arr1 elements, my %seen; @seen{ map $_->{id}, @$arr2 } = (); # $seen{$_->{id}} = undef @$arr2; # or foreach instead of hash slice $arr3 = [ grep{ !exists $seen{$_->{id}} } @$arr1 ];

How to refresh UItableViewCell Auto Layout in UItableViewController when I change Height or Width in Swift? -

i'm working on swift project use uitableview. fill tableview using delegate methods : override func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int override func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell dequeuereusablecellwithreuseidentifier etc, and un use collectionview.reloaddata() when model change (add/remove item). my cells, inside tableview can have different size in function number of item inside model. lie : func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitematindexpath indexpath: nsindexpath) -> cgsize{ var size = cgsize(width: 0,height: 0) if timermanager.sharedinstance.timers.count < 2 { size = collectionview.frame.size } else if timermanager.sharedinstance.timers.count == 2 { size = cgsize(width: collectionview.frame.size.

xampp - Error in configuring ffmpeg in Windows 8 , 5.3 PHP -

i trying configure ffmpeg using tutorial - http://myownhomeserver.com/2012/12/how-to-install-ffmpeg-php-php-5-4-on-windows-8-xampp-1-8-1/ after had done initial configuration, throwing error. i copied php_ffmpeg.dll in ext folder added in php.ini file extension=php_ffmpeg.dll copied other files system32 folder. throwing error while restarting apache. throwing below errow --------------------------- httpd.exe - system error --------------------------- program can't start because avcodec-52.dll missing computer. try reinstalling program fix problem. --------------------------- ok --------------------------- i can see above tutorial php 5.4 , above found tutorial http://myownhomeserver.com/2012/02/how-to-install-ffmpeg-php-for-windows-apache-http-server/ this php 5.3 still seems show same error me i cant understand went wrong can me please. in guide looking @ says need php 5.4 or higher. should first have installed php 5.4 , download files link , plac

ruby on rails - Cross-Origin Request Blocked with Ajax after taking site to SSL -

we using ruby 2.1.2 rails 3.2.14. getting following error on browser's console ajax requests after moved our site ssl. cross-origin request blocked: same origin policy disallows reading remote resource @ https://sitename.com/xxx/xx?id=xx. can fixed moving resource same domain or enabling cors. we've tried adding headers: { 'access-control-allow-origin': '*' }, crossdomain: true but no effect. here ajax code : $.ajax({ type: "get", data: {id: id}, url: path+id, headers: { 'access-control-allow-origin': '*' }, crossdomain: true, success: function(data) { } }); any other suggestions?? you have set headers on server side. not on client. simplest way use in applicationcontroller: after_filter :set_access_control_headers def set_access_control_headers headers['access-control-allow-origin'] = '*' end

if statement and visible statement dont work but the things inside it work? ACTIONSCRIPT 3 -

yeah here's code if(defaultmeter.visible = true) { meter1.visible = true; meter1.x = 124.10; meter.y = 63.10; jizz.visible = false; } thing things inside { } work the if statement doesnt apply when defaultmeter not visible, stuff inside {} still applies :c please if mc.visible = true assign true value mc.visible make mc visible true . to compare in level, use == (equal) operator check if 2 values equal or != (not equal, different ) check if 2 values not equal. so in case can : if(defaultmeter.visible == true){ // instructions here } or if(defaultmeter.visible != false){ // instructions here } or simply if(defaultmeter.visible){ // instructions here }

regex - regular expression minimum word count -

what regex should use minimum word count? dating website user has describe himself in minimum 50 words. can allow punctuation characters, new lines, question marks, numbers , user types in long has on 50 words. i have (\b[a-za-z0-9 '-_]+\b.*){50,} not let new line characters thanks if it's website so, don't need regex. though not tagged javascript , suppose you'll find helpful. can is var elem = document.getelementbyid("id of text input element here"); if(elem.value.split(" ").length < 50) { alert("minimum 50 words please!!"); }

java - Continuous testing with IntelliJ Idea -

i'm looking intellij idea plugin run tests each time change code. looked such solution , found: infinitest , works, inconvenient because need add facet each module, , opens new tool window each module (which means 15 tool windows me). fireworks - didn't work me, maybe doesn't work idea 14 (in its repo can see last changes made in 2009). intellij reports throws exceptions. there lots of ways run tests (including writing simple script this), i'm looking tool smart enough rerun failed tests first, , understand module dependencies (so after change in module run tests of dependent modules). i prefer free options, if there's paid reasonable price, accept well. intellij has toggle auto-test in run dialog. run run-configuration , select toggle auto-test in run dialog. it's not intelligent have hoped. reruns when detects changes.

html - Bootstrap site, I can either have the menu item resposive OR look correct but not both -

i'm trying create menu login "username/password/sign in" buttons appear on desktop site in mobile responsive version jut want "sign in" option directs sign in page. i've used bootstrap-responsive.css make login-in boxes disappear when not in desktop, works treat "sign in" menu item either responsive or correctly formatted not both here code <span class="visible-phone visible-tablet" > <li class="dropdown"> <li> <a href="sign_in.html">sign in</a> </li> </li> </span> <li class="dropdown visible-desktop"> <div class="form-group"> <form class="form-inline" role="form"> <label class="sr-only" for="exampleinputemail2">email address</label> <input type="email" class="form-control" id="exampleinputemail2" placeholder="enter email"&

c# - I cannot get projects to load into Visual Studio 2013 with the same name as their directory and I cannot rename the projects in Solution Explorer -

i had 2 problems don't seem addressed anywhere. a website project directory i'd renamed projectb projecta kept loading vs 2013 solution projectb after rename. f2, rt-click , long clicking project name did not enable me rename it. have no csproj file. deleted non-source files imported new, empty solution. full text search of directory showed name in .suo file, i'd deleted. i fixed (solution below), imported website in directory projectb solution. when did, given name projectb(2) , projectb(3) , projectb(4) , despite there nothing called projectb more. again couldn't manually rename projectb . there no folder or file conflicted. restarted windows after deleting temporary files, next time imported project, came in projectb(8) . solution below. i re-opened same solution on computer, , projectb (in directory projectb ) renamed projecta(2) , despite having never been named anywhere. solution below. [later edit: if getting these problems, first thing i

insert - F# Tree: Node Insertion -

this question extends f# recursive tree validation , had nicely answered yesterday. this question concerns inserting child in existing tree. updated type i'd use: type name = string type birthyear = int type familytree = person of name * birthyear * children , children = familytree list my last question concerned checking validity of tree, solution decided go with: let rec checkages minbirth = function | person(_,b,_) :: t -> b >= minbirth && checkages b t | [] -> true let rec validate (person(_,b,c)) = list.forall iswf c && checkages (b + 16) c now able insert person simon child of specific person hans in following form insertchildof "hans" simon:person casperfamily:familytree;; so, input should parent name , child , family tree . ideally should return modified family tree, familytree option what struggling incorporating validate function make sure legal, , way insert in list of childr