Posts

Showing posts from August, 2011

c++ - Fit string inside specified rectangle -

i have string needs drawn inside rectangle. the problem lies in fact string can big fit inside. how can adjust font size string can fit inside? i have read docs gdi , found nothing. still keep searching on internet, hoping find or idea of own... gdi + option too... the following code posted in response comment user jonathan potter: #include <windows.h> #include <windowsx.h> #include <commctrl.h> #include <stdio.h> // swprintf_s() #include <math.h> #include <gdiplus.h> #include <string> using namespace gdiplus; // enable visual styles #pragma comment( linker, "/manifestdependency:\"type='win32' \ name='microsoft.windows.common-controls' version='6.0.0.0' \ processorarchitecture='*' publickeytoken='6595b64144ccf1df' \ language='*'\"") // link common controls library #pragma comme...

python - Pylab Piechart display 3 elements -

3 elements = 3 keys in dictionary 2 elements = 2 keys in dictionary when trying display 2 elements working fine . when trying same thing 3 , nothing happens ( picture wont generate) from pylab import * binnames_tuple = () binresult_list = [] dic = {'7.2': '2', '7.1': '1', '7.3': '3'} item in dic: #append tuple ( labels pi chart) binnames_tuple = binnames_tuple + (item,) #append list (the results display ) binresult_list.append(dic[item]) print binresult_list print binnames_tuple mycolors=['#9d1507', '#71c42c','#0099cc'] try : figure(1, figsize=(3, 3), dpi=70,) ax = axes([0.1, 0.1, 0.8, 0.8]) # slices ordered , plotted counter-clockwise. fracs = binresult_list explode=(0, 0) pie(fracs, explode=explode,labels = binnames_tuple , autopct='%1.1f%%', shadow=true, startangle=90,colors=mycolors) savefig(('abcd.png'), transparent=true) close()...

python - Sqlalchemy column_property math -

i'm working invoice , payment models, trying determine how money due paid invoice based on payments invoice. i have come following, making use of sqlalchemy's column_proprty: # total amount invoice invoice.total_rands = column_property( select([func.sum(invoiceproduct.sub_total_rands)]).where(invoiceproduct.invoice_id==invoice.id).correlate(invoice) ) # total amount needs paid. invoice.amount_due_rands = column_property( invoice.total_rands - select([func.sum(payment.amount_rands)]).where(payment.invoice_id==invoice.id).correlate(invoice) ) this issue above code if there no payments invoice, invoice's 'amount_due_rands' none , not equal invoice.total_rands. so guess have 2 questions: how (using current solution) have invoice.amount_due_rands column_proprty return invoice.total_rands if there no payments invoice. how else approach problem? invoice.amount_due_rands = column_property( invoice.total_rands - select([func.coalesce(fu...

html - Soundcloud embed ignores height -

i'm using featured video plus plugin on wordpress theme in order set more types of thumbnails. youtube , vimeo works fine when try put classic soundcloud embed height of widget ignored. the plugin says supports soundcloud , height 166. here how looks: http://i.imgur.com/cd2ajlr.png i don't know what's causing problem, plugin, souncloud or code. thank you.

apache - Rewrite rules cause infinite redirect loop -

my folder structure looks this: /var/www/.htaccess /var/www/site/index.php /var/www/site/images/test.png where .htaccess file looks this: rewriteengine on rewritecond /site/%{request_filename} -f rewriterule ^(.*)$ /site/%{request_filename} [l] rewriterule ^(.*)$ /site/index.php [l,qsa] essentially, want rewrite urls /site/ directory, , have existing files rewrite paths in site folder, while making file not exist rewrite /site/index.php instead. the .htaccess file above works /images/test.png , / causes infinite loop, reported in apache error log: [sat jun 13 21:42:04.003016 2015] [core:error] [pid 12949] [client 127.0.0.1:50560] ah00124: request exceeded limit of 10 internal redirects due probable configuration error. use 'limitinternalrecursion' increase limit if necessary. use 'loglevel debug' backtrace. [sat jun 13 21:42:04.003020 2015] [core:debug] [pid 12949] core.c(3533): [client 127.0.0.1:50560] ah00121: r->uri = /site/index.php [sat jun ...

regex - How to use PHP to echo entire word with occurance of character sequence? -

i have php scraper scrapes urls , echos out material inside given div. want modify scraper check html on page occurence of string, , echo out entire word string occurs in. my current scraper this: <?php $urls = array( "http://www.sample1.html", "http://www.sample2.html", "http://www.sample3.html", ); foreach($urls $url){ $content = file_get_contents($url); $first_step = explode( '<div class="div1">' , $content ); $second_step = explode("</div>" , $first_step[1] ); echo $second_step[0]."<br>"; }; ?> i want more this, working: $first_step = explode( 'eac' , $content ); with results being: teacher preacher each etc... you can use following regex preg_match instead of explode : (\w*eac\w*) code: preg_match('(\w*eac\w*)', $content , $first_step , preg_offset_capture); echo $first_step[1];

iphone - How to add multiple pages in AIR for Android -

i want add multiple pages in android app, similar home screen on phone, want able swipe left , right see multiple pages. i'm developing app in adobe flash cc 2014 using "air 16.0 android". anyone know how can this? you can go different approaches problem. create swipegestures detect or go way flash went since 1999, setup movieclip (or many) , listen onmousedown (ontouchstart) events , mc. startdrag (); (you want limit drag-movement to x axis ). onmouseup (ontouchend) can determine if current mc relativly cented , tween middle of screen, or if page far left/right , therefore page next page. there touch drag implementation out of box ontouchmove . basicly looking kind of coverflow as3 ... or lot less fancy. please make comfortable startdrag , stopdrag , see how there doing.

css - Border to margin in HTML -

i new html programming. possible make border margin instead of padding? need design purposes only. make padding size your current padding + margin, set margin 0 pixels. have same effect.

python - Join throws startswith error after using os.walk -

just test script loop entire home directory recursively. on test server, join command throws strange error. file "print_idv3.py", line 20, in <module> listdirs("/home/jelmer/") file "print_idv3.py", line 7, in listdirs list_of_files=os.path.join(root,files) file "/usr/lib/python2.7/posixpath.py", line 66, in join if b.startswith('/'): attributeerror: 'list' object has no attribute 'startswith' the code follows. files , root not empty @ all, should work. def listdirs(dir): root, subfolders,files in os.walk(dir,topdown=false): list_of_files=os.path.join(root,files) print files print root return return def main(): #mainrunroutine return if __name__=="__main__": listdirs("/home/jelmer/") rather joining string array using os.path.join() , should 2 strings in loop or list comprehension: list_of_files = [o...

Getting directory of input file (Applescript) -

i'm confused - i've been googling hour , have tried ten different forms of set posixdirectory posix path of (parent of (path afile) string) can't seem right. i'm getting full posix path (including filename) doing set posixfilepath posix path of afile now, how posix path of directory?? i'm getting various errors depending on do... can't make alias.. can't parent of alias... i think should work it's not... set posixdirectory posix path of ((parent of afile)) there couple of ways if have initial path. from posix path format set thepath "/users/username/documents/test/selectedtextcolour.css" set textnumber1 characters 1 thru -((offset of "/" in (reverse of items of thepath string)) + 1) of thepath string or using shell set thepath "/users/username/documents/test/selectedtextcolour.css" set parentpath shell script "dirname " & quoted form of thepath result: "/users/userna...

PHP delete values from Session Array -

i want delete items shopping cart, stored in session variable named $_session["products"] the deleting part working fine until there different sizes of products same product code, when request delete called specific size items gets deleted same product code. instead, should deleted item requested. this php code delete if(isset($_get["removep"]) && isset($_get["return_url"]) && isset($_session["products"])) { $product_code = $_get["removep"]; //get product code remove $product_size = filter_var($_post["product_size"], filter_sanitize_number_int); //product size $return_url = base64_decode($_get["return_url"]); //get return url foreach ($_session["products"] $cart_itm) //loop through session array var { if($cart_itm["code"]!=$product_code && $cart_itm["size"]!=$product_size){ //item does,t exist in list $...

When i try to add a JSON Array, it removes the previous array. (PHP) -

edit: trying merge 2 arrays together, saying want add new array json data without removing json data in value. example: $chatjson = [] has json data in this: $chatjson = [{"sender":"testing","message":"hi"}] and want keep data when adds array $chatjson = [{"sender":"testing","message":"hi"},{"sender":"testing","message":"message 2!"}] should support question. <?php include '../filter.php'; $chatjson = []; $sender = securepost($_post["sender"]); $message = securepost($_post["message"]); if ($sender || $message) { $chatarray = array('sender' => $sender, 'message' => $message); $decodejson = json_decode($chatjson, true); $merge = array_merge((array)$chatarray, (array)$decodejson); $chatjson = json_encode($merge); echo $chatjson; } ?> you need ch...

Referencing URLs for other views in Django 1.8 with no arguments -

i working on simple django 1.8 application template referencesa url points view. views class-based generic views. when attempting load page, following error: noreversematch @ / reverse 'add' arguments '()' , keyword arguments '{}' not found. 1 pattern(s) tried: [u'$add/$'] <form action="{% url 'movies:add' %}" method="post">{% csrf_token %} my app's url.py: urlpatterns = [ url(r'^$', views.movielist.as_view(), name="index"), url(r'^add/$', views.moviecreate.as_view(), name="add"), url(r'^(?p<pk>\d+)/delete/$', views.moviedelete.as_view(), name="delete"), url(r'^(?p<pk>\d+)/update/$', views.movieupdate.as_view(), name="update") ] the template being used: <table> <tr> <td><a href="?sort=title">title</a></td> <td><a href="?sor...

android - GC overhead limit exceeded with google play services -

Image
i trying run android project on eclipse , platform ubuntu 64 bit. goes when add google play services project appear big problem. 1.running android app, hight cpu load. eclipse show wrong message "gc overhead limit exceeded". finally close eclipse. when remove google play prject, can running well. i suggest using android studio instead of eclipse https://developer.android.com/sdk/index.html . but also, try launching eclipse more memory: how can give eclipse more memory 512m?

java - Putting ArrayList of ArrayList into a bundle, parcelable -

hi need put arraylist < arraylist< string>> in class yet retain parcebility private arraylist<arraylist<string>> quotes; i have tried bundle.putparcelablearraylist(quote_array, quotes); i 'quotes' underlined in red , says "required: java.util.arraylist< ?extends android.os.parcel able>" how can make arraylist inside parent arraylist parcelable since arraylist not parcelable, suggest encapsulating arraylist of strings in class implements parcelable. use arraylist containing object type.

android - How to draw a line over a GridView programmatically -

i new posting on stack overflow, best descriptive here. right playing around android studio. have set gridview (i built own custom image adapter) contains square images form 5 6 grid padding in-between each grid space. want able draw line (using canvas , paint) on top of gridview programatically. i have looked @ quite few posts on stack overflow in order try , solve issue, such one: draw line on top of existing layout programmatically when following instructions link above ^^^, able create program draws line on imageview. but when use similar code in program tries draw line on gridview, draws line , nothing else. here code snippets of i'm trying do. xml file: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <!-- ga...

jquery - Server side validation on multiple step form with AJAX PHP? -

i have multi-step form (4 steps) has client side validation using jquery , uses ajax process form inputs. on every next button click js validation run. but client side validation not enough. setup server side validation too. so prefer using ajax server side validate form allows same ux client side validation. use instructions here: http://fearlessflyer.com/how-to-ajax-validate-forms/ but how can follow similar scripts post multi-step wizard form rather simple form? should every next button of step post server side validation , process field's inline error in current step? or should form posted server side validation @ final confirmation 4th step? how can relevant form steps inline errors shown when validating form fields right @ last step? i'm using plain php on server side without frameworks. your post request should @ 4th , final step of validation. steps should loaded onto html page, can use javascript show section section. you can have "inl...

database - Android listview filter without pressing search button issue -

i have listview work fine. have put edittext @ top of listview. want when enters letter "a", names starting "a" should appear in list . have try nothing happen please check code , tell me doing wrong. this code of data list. public class datalistactivity extends activity { listview listview; sqlitedatabase sqlitedatabase; fooddbhelper fooddbhelper; cursor cursor; listdataadapter listdataadapter; private button button1; listdataadapter dataadapter = null; button button; dataprovider dataprovider; arraylist<hashmap<string, string>> namesslist; edittext inputsearch; string search_name; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.data_list_layout); inputsearch = (edittext)findviewbyid(r.id.inputsearch); inputsearch.addtextchangedlistener(new textwatcher() { @override public void ont...

bluetooth lowenergy - Nordic nrf51822 and S130 never gets to my application code -

i trying run nrf51822 chip using emblocks , openocd, debugger interface st-link discovery board, supports swd. when program blank device works fine, program flow reaches main function. however, when flash s130, program flow never reaches main function (i don't have other application code). i have checked assembly code , s130 stuck on (arm asm incoming) wfe , b.n instruction, knowledge, seems waiting interrupt, event or wake happen before doing anything... expected behaviour or doing wrong? the pins have connected swd lines (2 pins) gnd , vdd (3 volts). i solved long time ago, forgot post solution. problem script file provided emblocks, needed modified. i got working modifying sections in linker file this: memory { softd (rx) : origin = 0x00000000, length = 0x20000 flash (rx) : origin = 0x00020000, length = 0x20000 ram (rwx) : origin = 0x20002800, length = 0x1800 } to this: memory { softd (rx) : origin = 0x00000000, length = 0x1c000 flash (rx) : origin = 0...

netlogo - Volunteer coordination system for modelling natural disaster emergencies -

this model system model of centralized coordination of volunteers response phase of volcanic eruption. agent (volunteers) placed randomly try reach point of barracks (red colored patches). each agent (volunteers) has energy capacity channelled point barracks if volunteer has been able achieve. point barracks have demand reduced capacity of volunteers if volunteer able reach point of refugee camps. problems on program created volunteer movement not run in accordance predetermined color patch , move , forth. volunteers can’t choose turn left or turn right if color patch in front of instead of specified color. there solution movement of agents (volunteers) model? besides how volunteers can measure shortest distance agent reach point barracks? furthermore, there way volunteers can perform search evacuation point must reached in advance if demand of each point varies barracks or upon priorities? this code: to go if ticks = 180 [ stop] ask volunteers [ifelse capacit...

ios - How do I increment and save a int value in Swift? -

im trying keep track of how many times user loses in game. every loss goes 1. want save user see how many total times lost. right code have works first time , goes 1 if lose in game after stays @ 1. doing wrong? thanks! class level1: skscene, skphysicscontactdelegate, gkgamecentercontrollerdelegate { var deathscore = 0 override func didmovetoview(view: skview) { var deathlabel = sklabelnode() deathlabel = sklabelnode(fontnamed: "ladyice-3d") deathlabel.text = "100" deathlabel.zposition = 14 deathlabel.fontsize = 100 deathlabel.fontcolor = skcolor.darktextcolor() deathlabel.position = cgpointmake(self.size.width / 1.1, self.size.height / 1.4) deathlabel.hidden = true self.addchild(deathlabel) } if firstbody.categorybitmask == herocategory && fourthbody.categorybitmask == gameovercategory { deathscore++ deathlabel.hidden = false let defaults = nsuserdef...

forms - How can I clear a TextBox in Form1 from Form2? C# -

this question has answer here: how access form control form? 4 answers i have textbox (let's call textbox1) inside form1. when user presses "new" clear screen, after accepting work lost (from within form2), how make textbox1 clear? can't access directly second form , can't think of feasible way this. thanks in advance help! add public flag of success in form2 , check afterwards. or can use built-in functionality of showdialog , dialogresult . more proper in terms of oop , logic changing value of form1 form2 . if change value of hardcoded form unable reuse form again. with approach can reuse form again in place. using simple custom variable: public class form2 : form { public bool result { get; set; } public void buttonyes_click(object sender, eventargs e) { result = true; this.close(); } ...

css - Adding things above and below bootstrap fixed navbar -

i trying add banner above fixed-top navbar. have looked around , understand basic concepts on how example little more complex , getting little lost. user can add custom banner top of page. if happens need push (including fixed navbar) down height of banner (say 20 px). i have created class can apply nav element: .top-banner-nav { top: 20px; } navbar: <nav class="navbar navbar-default navbar-fixed-top" ng-class="{'top-banner-nav': banner == true}"> that works great push static navbar down 20px if there banner. have problems. when have static navbar have add top padding body push body content below banner. of sudden need push body content down 70px. not sure if there way make happen dynamically. i have static navbar directly underneath top navbar. when move top navbar down 20px need move other navbar down 20px well. unfortunately lower nav fixed top: 50px place right below upper navbar. i have plunker here demonstrates p...

serialization - Overriding class signature in java -

i have class follows in .jar file (library file): class a{ //someimplementation } i make implements serializable interface follows: class implements serializable { //the same implementation present in classa } i not want decompile jar file, changing class signature , archiving again after compilation. is there way writing hooks achieve this? kindly provide pointers/suggestions. ultimate aim achieve implementing serializable interface without modifying jar file. you can achieve using serialization proxy pattern (effective java 2nd edition item 78) a few links pattern : http://jtechies.blogspot.com/2012/07/item-78-consider-serialization-proxies.html http://java.dzone.com/articles/serialization-proxy-pattern follow up: instance control in java without enum make new class extends a , serializable . in order avoid serialization errors, however, because a isn't serializable, need make serializationproxy creates new instance via constructor or factory ...

javascript - How angular is polluting the global space? -

i new in angularjs, practising on angularjs http://curran.github.io/screencasts/introtoangular/exampleviewer/ in following example polluting global space, didn't understand how polluting global space in example 1 in example 2 not. example 1 <html ng-app> <head> <meta charset="utf-8"> <title>angular.js example</title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"></script> <script> function namectrl($scope){ $scope.firstname = 'john'; $scope.lastname = 'smith'; } </script> </head> <body ng-controller="namectrl"> first name:<input ng-model="firstname" type="text"/> <br> last name:<input ng-model="lastname" type="text"/> <br> hello {{firstname}} {{lastname}} </body> </html> exa...

virtualhost - PHP absolute path not working -

i have set simple virtual host. just added these lines @ bottom <virtualhost *:80> serveradmin webmaster@yourdomain.com documentroot "/var/www/reminder/" <directory "/var/www/reminder"> allowoverride require granted php_admin_value open_basedir "/var/www/reminder/" </directory> php_admin_value open_basedir "/var/www/reminder/" servername test.mydomain.com errorlog "logs/yourdomain.com-error_log" customlog "logs/yourdomain.com-access_log" common </virtualhost> what want is, while including files in php files inside reminder folder, if give absolute path , "/test/" , should consider reminder folder root, , search test folder inside reminder. right now, when type echo dir , shown /var/www/reminder. my file structure is: /var/www/reminder/database/db_connect.php /var/www/reminder/registration/registration_handler.php this db_connect.php has : <?php define(...

java - Would building a max heap from an Unsorted array would follow Binary Tree properties? -

given unsorted array of size 10 int[] arr={∞,1,2,3,4,5,6,7,8,9,10}; if execute code public void build_heap(){ for(int i=size/2;i>=1;i--) max_heapify(i); } the resulting array in what case follow binary tree properties ( ie left subtree < root & root < right subtree ) ? how generate such array ? is right approach : instead of using build_heap , keep keep inserting element heap ? (is there better solution?) no, confused on data structures. heaps not guarantee ordering in way bst(binary search tree) does. heaps guarantee given node's children satisfy heap property (ie. either less given subtree root max heap, or greater min heap). bst's on other hand, guarantee given subtree's root has keys less root's key on left subtree, , keys greater on right subtree. edit : run heapsort on heap generate sorted array in nlogn time, construct balanced bst in linear time.

javascript - CSS - returning different values from different browsers -

when using jquery grab css values objects, each of browsers (ie, mozilla, chrome, etc) returns different values. for example, in chrome, background image (.css("background-image")) returns: url(http://i41.tinypic.com/f01zsy.jpg) where in mozilla, returns: url("http://i41.tinypic.com/f01zsy.jpg") i having same problem on other aspects, such background-size. in chrome returns: 50% 50% but mozilla returns: 50%+50% my problem is, have functions split css (background-size), example based on space .split(" "), not work on mozilla because uses + instead. is there way can fix problem , make browsers use 1 standard? is there function write grabs , splits values, based on type of browser user using? different browsers use different css standards , may have write full-blown parser make them 1 standard. workaround should split or use css values taking account different browsers standards. css(background-size) problem can solved ...

html form required attribute field -

my form not honoring required attribute of "comments" field. want when user submits form, shows "please fill field", instead user can submit form straight away. <form class="form-part" method="post" action="contact_form.php" name="contactform" id="contactform" onsubmit="return checkform1();"> <input id="name" type="text" name="name" size="30" title="name" required> <input id="email" type="text" name="email" size="30" title="email" required> <textarea rows="3" id="comments" name="comments" cols="40" title="tell think!" required></textarea> <input type="submit" name="submit" alt="send"> </form> a simple check function might be: function checkform1(frm){ ...

loops - Continuously moving an image in Java -

i'm trying recreate digdug game in java computer science class. as i'm beginner, i'm going have monsters move , down, instead of chasing player. i'm having difficulties making monsters continuously move though. go up, not go down, , doesn't repeat. previously fly off screen if player reached point, or wouldn't move @ all. have tried for-loop, while-loop , do-while loop. tried delay stopped entire program. goal make of monsters move , down when player reaches point (340, 270). import java.applet.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.awt.font; import java.awt.event.*; import javax.swing.timer; import java.util.arraylist; import java.awt.event.keyadapter; public class digdug extends applet implements mousemotionlistener, mouselistener, keylistener { private final color c_background = new color(32, 73, 150); private final color c_first = new color(230, 185, 9); private final color c_second...

css - align transparent div over carousel background image in bootstrap -

Image
i trying place transparent div on background image. on transparent div there blue color div has drop down list , icons right aligned , caption. it's been day , tried different method achieve giving background image container, using jumbotron , finally trying carousel , want align contents now, current look: my page: <div class="container"> // code nav bar , logo etc <div id="mycarousel" class="carousel slide" data-ride="carousel"> <div class="carousel-inner"> <div class="item active"> <img src="~/img/backimage.jpg" alt="chania"> <div class="container"> <div class="carousel-caption"> <div class="row" id="ddselect"> <div class="col-md-6"> <select name=...

python - how to calculate a 2D array with numpy mask -

i have 2 dimension array , based if value greater 0 want operation (example x+1). in plain python this: a = [[2,5], [4,0], [0,2]] x in range(3): y in range(2): if a[x][y] > 0: a[x][y] = a[x][y] + 1 result [[3, 6], [5, 0], [0, 3]] . want. now want prevent nested loop , tried numpy this: a = np.array([[2,5], [4,0], [0,2]]) mask = (a > 0) a[mask] + 1 the result 1 dimension , shape of array [3 6 5 3] . how can operation , don't loose dimension in plain python example before? if a numpy array, can - a[a>0] +=1 sample run - in [335]: = np.array([[2,5], [4,0], [0,2]]) in [336]: out[336]: array([[2, 5], [4, 0], [0, 2]]) in [337]: a[a>0] +=1 in [338]: out[338]: array([[3, 6], [5, 0], [0, 3]])

javascript - add key value pair of objects in an array -

function person (name, age) { this.name = name; this.age = age; } var family = [] var people = {alice:40, bob:42, michelle:8, timmy:6}; (var key in people) { family.push({key:people[key]}) } console.log(family); this not giving me keys. giving 'key' each key. proper way add {key:value} pair of objects in array? update based on k3n solution below, understood works best if declaring constructor each time: keys = object.keys(people); (var = 0; < keys.length; i++) { family.push(new person(keys[i], people[keys[i]])); } since people arrays contains name of person key, , value being age (be careful if 2 persons same name nuclear reaction in time-space happens...!). you can this: function person (name, age) { this.name = name; this.age = age; } var family = [] var people = {alice:40, bob:42, michelle:8, timmy:6}; var keys = object.keys(people); // list (ownproperty) keys in object for(var = 0, key; key = keys[i]...

Get build output into TeamCity Build log from Xamarin mdtool via Rake script -

i building xamarin.mac application os x build agent via xamarin studio. build script writtenw in rake , simple: task :default => [:build] task :build `/applications/xamarin\\ studio.app/contents/macos/mdtool -v build -p:"eyeloe.main" -t:build "eyeleo.mac.sln"` end whenever teamcity running rakefile withing rakerunner build step, following in build log: step 1/1: run build (rake) (3s) [13:32:26][step 1/1] starting: /usr/bin/ruby /applications/buildagent/plugins/rake-runner/rb/runner/rakerunner.rb --rakefile /applications/buildagent/work/bc2e9e29fc298503/rakefile [13:32:26][step 1/1] in directory: /applications/buildagent/work/bc2e9e29fc298503 [13:32:26][step 1/1] [13:32:26][step 1/1] invoke default (2s) [13:32:26][invoke default] [13:32:26][invoke default] (first_time) [13:32:26][invoke default] [13:32:26][invoke default] execute build (2s) [13:32:28][execute build] [13:32:28][invoke default] [13:32:28][invoke default] execute default [13:32:2...

how to watermark mp4 video with ffmpeg php -

i need watermark mp4 video , using code, not working , please solve this <? exec('ffmpeg -i movie.mp4 -i logo.png -filter_complex overlay output.mp4');?> you need put filter code within double quotes. if share more error you're facing, i'll able better. <? exec('ffmpeg -i movie.mp4 -i logo.png -filter_complex "overlay" output.mp4');?>

Weird blank character behaviour in regex C -

i have problem using regex in c. want collect command (get, put or del) , filepath, send right command server. if compile ' [[:blank:]]*(get|put|del|help) ' , code works , collect right thing. however, when add expression, such : '[[:blank:]]*(get|put|del|help)[[:blank:]]+([a-z])' , regexec returns reg_nomatch. do have solution or know why? this code: #include <regex.h> #include "dgb.h" #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <stdio_ext.h> define mode "client" int main(int argc, char *argv[]) { regex_t preg; const char *str_regex = "[[:blank:]]*(get|put|del|help)[[:blank:]]+([a-z])"; char str_request[51]; int reg_init; int reg_request; size_t nmatch = 0; regmatch_t *pmatch = null; reg_init = regcomp(&preg, str_regex, reg_icase); if (reg_init != 0) { printf("error\n"); exit(exit_failure); ...

Rails validation - maximum database entries -

i have rails project, using active record , wondering if there validation helper max number of individual entries. example, if had form submission , wanted, 2, , wanted first 2 persisted table, how this? i have read manual , had @ numericality etc it's not i'm looking for. have tried write own validation method in model, assuming there validation helper makes easier: def validatepassengernumber if self.passengers.length > 2 # unsure on how refuse new data access database end end add error base after check return true, , prohibit save database. def validate_passenger_number self.errors.add(:base, "exceed maximum entry") if self.passengers.length > 2 end call custom validation in respective model.   validate :validate_passenger_number, on: :create

He's dead, Jim: is there a memory limit on the number of circles that can be drawn on a Google map? -

on map of usa, have been asked draw 50,000 circles each 5000-yard radius. the lat-lon locations scattered throughout country, large number of these circles overlap. opacity set 0.05; regions many superimposed circles become more opaque. the circles start appear, after 30 seconds chrome crashes, displaying "he's dead, jim" message. about error message: according error: "he's dead, jim!" : you might see “he’s dead, jim!” message in tab if: you don’t have enough memory available run tab. computers rely on memory run apps, extensions, , programs. low memory can cause them run or stop working. you stopped process using google chrome's task manager, system's task manager, or command line tool. it evidently occurs since trying render 50k objects. in order render such amount of objects recommend consider overlay approach . in case performance improved considerably since city icons ve rendered via canvas...

c++ class template can be instantiated but a function template instantiation with the same template parameters fails -

i have wrapper class binded function calls (a helper class fight legacy code issues): template <class result, class... args> class functionwrapper { std::function<result()> func_; public: functionwrapper(std::function<result(args...)> f, args&&... args) : func_(std::bind(f, std::forward<args>(args)...)) { } //...some methods using func_ }; i can write following code, compiles , works fine: double f(int i, double d) { return i*d; } //... functionwrapper<double, int, double> w(f, 2, 4.5); //calling methods of w ... now want save me typing when defining wrapper instance, i've introduced make_wrapper function: template <class result, class... args> functionwrapper<result, args...> make_wrapper(std::function<result(args...)> f, args&&... args) { return functionwrapper<result, args...>(f, std::forward<args>(args)...); } although template parameter list function...

java - Error with receiving strings to list -

it's program receive n strings list , find duplicate's count each string , print string , number of duplicates in map. i error , can't find problem! exception in thread "main" java.lang.indexoutofboundsexception: index: 5, size: 5 @ java.util.arraylist.rangecheck(unknown source) @ java.util.arraylist.get(unknown source) @ q1.main(q1.java:16) here's code: import java.util.*; public class q1 { public static void main(string[] args) { scanner sc = new scanner(system.in); map<string,integer> m = new hashmap<string,integer>(); list<string> l = new arraylist<string>(); int n = sc.nextint(); for(int = 1; <= n; i++) { l.add(sc.nextline()); } int count=1; for(int = 0; < l.size(); count = 1) { for(int j = 1; < l.size(); j++){ if(l.get(j)==l.get(i)){ l.remove(j); coun...