Posts

Showing posts from July, 2014

html - Trapezium span with CSS -

is there way draw trapezium span thing text in it? doesn't matter if corners rounded, in fact, i'd prefer if were. i know how make oval/circle border-radius , i'm stuck on trapezium. please! i did pure css using pseudo-elements , skew css property support border-radius : demo on dabblet.com http://img135.imageshack.us/img135/9683/eedea21cb3bc438fb33c80c.png html: <span>trapezium</span> css: span { display: block; z-index: 1; position: relative; /* custom sizes */ width: 200px; height: 50px; } span:before, span:after { content: ''; position: absolute; top: 0; left: 0; width: 100%; bottom: 0; z-index: -1; } span:before { transform: skew(25deg); left: 25px; } span:after { transform: skew(-25deg); right: 25px; left: auto; } upd: demo without pseudo-elements

winapi - 2D graph drawing in windows with unmanaged code callable from excel -

i want able input list of nodes excel spreadsheet , pop zoomable window graph of nodes. requirements are: graph quite large (typically 40+ nodes, 200+ edges). project distributed minimum of dependencies. project run in minimum privilege environment. zooming , scaling of rendered graph "smooth". targeting win7 / vista sp2. i know how build layout of graph unsure of best way render it. need render comes down list of cubic splines , rectangles. i leaning away using excel shapes or drawings using vb6/userform performance reasons. my current plan build render code dll (coded in c or c++) shipped spreadsheet , lives in same folder, calling dll , marshalling data no problem. the bit unsure of best technology use in dll render graph. options see them are: 1. gdi 2. gdi+ 3. direct2d 4. direct3d my understanding in latest version of windows gdi , gdi plus un-accelerated , relativity slow. direct2d appears needlessly complicated. direct3d appears in principal easier direct...

HTML : play a video inside an image -

i'm trying play video inside png image of tv tv serves frame video. i tried that, pushes tv image , plays video underneath. <img class="tv" src="images/tv.png" alt="tv"> <video width="320" height="240"> <source src="video/video.mp4" type="video/mp4" /> </video> </img> can me finding way in there ? because i'm sure there easy solution, don't know look. thank ! first of all, can't use <img> way, because it's element can't contain other elements. all have put image background div , display video correct position: <div id="tv_container"> <video width="320" height="240"> <source src="video/video.mp4" type="video/mp4" /> </video> </div> <style> #tv_container { background: url('images/tv.png') no-repeat top left tran...

Can't figure out how to fix a word replace javascript -

i want change words on page below script. m not sure how fix ... can help? http://jsfiddle.net/cip691/yums7/ var dict = { "not": " not ", "is not": " not ", "like": " likeeee ", "like": "lllike", "job": "job" }, terms = [], term; (term in dict) { terms.push(term); var search = new regexp('\\b(' + terms.join('|') + ')\\b', 'g'); }; // every text node: textnode.data = textnode.data.replace(search, function(full, match) { return dict[match] || match; });​ you should define textnode like in example link example <head> <script type="text/javascript"> function gettextnode () { var textcontainer = document.getelementbyid ("textcontainer"); var textnode = textcontainer.firstchild; alert (textnode.data); } ...

android - Set ImageView layout_gravity programmatically -

i need position imageview element on right side of framelayout element of it's child. here's i've done far: framelayout parentlayout; imageview checkimage = new imageview(anchor.getcontext()); linearlayout.layoutparams params = new linearlayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content); params.weight = 1.0f; params.gravity= 5; checkimage.setlayoutparams(params); checkimage.setimagedrawable(anchor.getcontext().getresources().getdrawable(r.drawable.checkpoint)); parentlayout.addview(checkimage); <framelayout android:layout_width="match_parent" android:layout_height="wrap_content" > <button android:id="@+id/popular_type" android:layout_width="200dp" android:layout_height="wrap_content" android:background="@android:color/transparent" android:gravity="left" android:paddingbottom="10dp" ...

ruby - Watir-WebDriver won't work when hosts file redirects localhost -

hello i'am using windows 7 , wish use watir-webdriver ruby 1.9.2. please tell me why this: c:\>irb irb(main):001:0> require "watir-webdriver" => true irb(main):002:0> browser = watir::browser.new :ff errno::eaddrnotavail: ??dany adres jest nieprawid?owy w tym kontek?cie. - bind(2 ) c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s elenium/webdriver/firefox/socket_lock.rb:45:in `initialize' c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s elenium/webdriver/firefox/socket_lock.rb:45:in `new' c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s elenium/webdriver/firefox/socket_lock.rb:45:in `can_lock?' c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s elenium/webdriver/firefox/socket_lock.rb:31:in `lock' c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s elenium/webdriver/firefox/socket_lock.rb:17:in `locked'...

Compile protobuf-2.4.1 code on NDK, version (android-ndk-r8-windows.) -

hi trying compile protobuf-2.4.1 code on ndk version (android-ndk-r8-windows.) i have set below: prebuilt=/cygdrive/d/d_drive/project/pr/ccore/code/ndk/android-ndk-r8-windows/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3 platform=/cygdrive/d/d_drive/project/pr/ccore/code/ndk/android-ndk-r8-windows/android-ndk-r8/platforms/android-4/arch-arm/ export cc="/cygdrive/d/d_drive/project/pr/ccore/code/ndk/android-ndk-r8-windows/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-gcc" export cflags="-fpic -dandroid -nostdlib" export android_root="/cygdrive/d/d_drive/project/pr/ccore/code/ndk/android-ndk-r8-windows/android-ndk-r8" export ldflags="-wl,-rpath-link=$android_root/platforms/android-4/arch-arm/usr/lib/ -l$android_root/platforms/android-4/arch-arm/usr/lib/" export cppflags="-i$android_root/platforms/android-4/arch-arm/usr/include/" cppflags="-i$android_root/platfor...

android - How to make Shape like this? -

Image
i want shape similar can see below. thing missing header color (the color behind anonymous text). i've reproduced wanted moving mouse on second textview highlighted , makes effect :) current code: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="2dp" android:color="#000000" /> <gradient android:startcolor="#898989" android:endcolor="#b5b5b5" android:angle="270"/> <corners android:bottomrightradius="7dp" android:bottomleftradius="7dp" android:topleftradius="7dp" android:toprightradius="7dp"/> </shape> you need use layer list contains 2 drawables. for example, first cover whole shape, , second overlay android:top="10dp" set, create offset showing underlying first shape edit...

redirect - Magento redirected to other URL after order editting -

currently i'm experiencing problem after editing orders in magento admin. page redirected url, base of belongs store view order belongs to. , page requires re-login admin. for example, have 2 base urls, each belongs 1 store view: www.example.old.com //old store view (default) www.example.new.com //new store view the system uses www.example.old.com default base url. under www.example.old.com create order new store , invoice it. on submitting invoice, page redirected from http://www.example.old.com/index.php/admin/sales_order_invoice/new/order_id/1234/ to http://www.example.new.com/admin/sales_order/view/order_id/1234/ and requires login time. i traced redirection code mage_core_model_url public function getrouteurl($routepath=null, $routeparams=null) ... $url = $this->getbaseurl().$this->getroutepath($routeparams); public function getbaseurl($params = array()) .... if (isset($params['_store'])) { $this->setstore($para...

sql server - Will SQL update a record if the new values are the same? -

will sql update record if there no change record? for examople, more efficient replace update table mytable set col1 = isnull(col1,'') ... set col100 = isnull(col30,'') with update table mytable set col1 = isnull(col1,'') ... set col100 = isnull(col30,'') col1 null or ... col30 null yes, attempt overwrite.

WebSocket request-response subprotocol -

websocket provide bi-directional communication human being talks. client can send data server , server can send data client @ anytime. question ? request-response behavior ? client ask server , wait response. seems websocket doesn't provide link client data (request) server data (response). it's work of subprotocol , have ideas on how (send id request , wait reponse same id until timeout period). in order not remake wheel , save time, looked on internet existing solution haven't found related (maybe bad keywords). so there aware kind of work or missing ? the websocket application messaging protocol (wamp) http://wamp.ws/ provides rpc (remote procedure call) , pubsub (publish & subscribe) messaging patterns on top of raw websocket purpose. wamp proper websocket subprotocol, uses websocket transport , json payload format. rpc implemented using 3 messages, , messages contain "call id" correlate asynchronous rpc server responses client initia...

php - $_SERVER['HTTP_HOST'] shows only domain name without www -

even if in url write "www.", $_server['http_host'] have domain.com without "www." i can't redirect non-www www because of this. how fix issue? ["http_host"]=> string(8) "ca-fi.ru" ["http_cookie"]=> string(120) "d7b6b86aae18e551749a9da9d54f3daf=floar2lr37318dc76ask49bii5; 849c6485c12558d081c065b4d94a566b=d9iqj8s6oqo41kipg3qaefq497" ["http_user_agent"]=> string(99) "mozilla/5.0 (windows nt 6.1) applewebkit/536.5 (khtml, gecko) chrome/19.0.1084.52 safari/536.5" ["path"]=> string(28) "/usr/local/bin:/usr/bin:/bin" ["server_signature"]=> string(69) " apache/2.2.20 (ubuntu) server @ ca-fi.ru port 80 " ["server_software"]=> string(22) "apache/2.2.20 (ubuntu)" ["server_name"]=> string(8) "ca-fi.ru" ...

iphone - How to Add sound to created Video From Images -

this code using creating video images further need put soundtrack video..any appriciated. - (ibaction)savemovietolibrary { imagevideopath = [nshomedirectory() stringbyappendingpathcomponent:[nsstring stringwithformat:@"documents/movie.mp4"]]; nslog(@"<><><><>=%@",imagevideopath); testimagearray = [[nsarray alloc] initwithobjects: [uiimage imagenamed:@"image1.png"], [uiimage imagenamed:@"image2.png"], [uiimage imagenamed:@"image3.png"], [uiimage imagenamed:@"image4.png"], [uiimage imagenamed:@"image5.png"], [uiimage imagenamed:@"image6.png"], [uiimage imagenamed:@"image7.png"], [uiimage imagenamed:@"image9.png"], [uiimage imagenamed:@"imag...

asp.net - How to create multiple Repository object inside a Repository class using Unit Of Work? -

i newbie mvc3 application development, currently, need following application technologies requirement mvc3 framework ioc framework – autofac manage object creation dynamically moq – unit testing entity framework repository , unit of work pattern of model class i have gone through many article explore basic idea above points still little bit confused on “repository , unit of work pattern “. understand unit of work pattern followed along repository pattern in order share single db context among repository object, here design : iunitofwork.cs public interface iunitofwork : idisposable { ipermitrepository permit_repository{ get; } irebaterepository rebate_repository { get; } ibuildingtyperepository buildingtype_repository { get; } ieeprojectrepository eeproject_repository { get; } irebatelookuprepository rebatelookup_repository { get; } ieeprojecttyperepository eeprojecttype_repository { get; } void save(); } unitofwork.cs public class u...

actionscript 3 - as3 Font size for drop down list inside ComboBox -

Image
how reduce font size of drop down list in order fit contents. thanks, your title says combobox write-up says dropdownlist provided examples both: <s:dropdownlist fontsize="8"/> <s:combobox fontsize="8"/> edit: added below based on new info: var dropdown:dropdownlist = new dropdownlist(); dropdown.setstyle("fontsize", "8");

java - regex replacing URL for image file extension; replace spaces with plus -

i learning regex , looking search url possible image extension (jpg, jpeg, png, gif .. etc) , if file extension of url image. i want replace %20 or spaces plus signs + how can done? www.test.com/this/is/an/image&20with%20spaces.jpg www.test.com/this/is/an/image+with+spaces.jpg you'll have in 2 lines, way see it. pattern imagepattern = pattern.compile("\\.(png|gif|jpg|jpeg)$", pattern.case_insensitive); if (imagepattern.matcher(input).find()) input = input.replaceall("(%20)|\\s", "+");

Wordpress blog URL redirect -

two questions only: i have website including section of blog in wordpress. requirements changed , client wants me make blog section on different domain. wants website , blog on different domains. yesterday setup blog on different server problem when click on post takes me post on old domain. idea how can fix issue? also have sent out many newsletters our customers in have posted urls of old domain. possible redirect them post on new domain , process? i appreciate if give me articles or tutorial links can me in not php guy. that's interesting stuff, here's how should proceed - solution first question replace old domain new 1 in mysql dump file. before proceed, please take backup of database, in case mess around. solution works best, since transfer client's websites devserver live servers ever & then. follow these steps - open new hosting's cpanel or dump mysql file using mysqldump command shell open dump file in favorite text editor , find...

sql - Create a view that shows from which table content comes -

i have little problem postgresql view have create school project. i have 5 tables named: input(inputid , distributorid , date) inputline(inputid, objectid, ammount) output(outputid, clientid, date) outputline(outputid, objectid, ammount) stock(objectid, ammount) now need view shows me changes (per objectid) made in chronological order this: | date | type | ammount in | ammount out | +------------+--------+------------+-------------+ | 10-10-2007 | input | 10 | | | 11-10-2007 | output | | 5 | | 12-10-2007 | input | 20 | | i have absolutely no clue on how appreciate help. if more details needed, don't hesitate ask =) select o.date, 'output' type, ol.amount amount_out, null amount_in outputline ol join output o using (outputid) union select i.date, 'input', null, il.amount inputline il join input using (inputid) order date, type; the order by clause ...

Rails 3 - association according own table column -

i have these 2 tables: colors - id - name - name_code cars - id - manufacturer - color_code_name (in columns colors.name_code , cars.color_code_name same values) i cars respective color. tried set these associations: class color < activerecord::base has_many :cars, :primary_key => "name_code" end class car < activerecord::base belongs_to :color, :primary_key => "color_code_name" end but unfortunately doesn't working... didn't specify yet kind of association, not sure, if it's possible it... i gonna grateful every advise try this: class color < activerecord::base self.primary_key :name_code has_many :cars, :foreign_key => :color_code_name end class car < activerecord::base self.primary_key :color_code_name belongs_to :color, :foreign_key => :color_code_name end

java - Processing, mouse control through Kinect, Telling processing to left click -

i wondering if guys can help. i've made processing sketch takes skeleton data , position gives them robot class , can control mouse pretty nicley. only problem cant find out how tell processing leftclick, or stay leftclicked while if statement in hold. kinect.drawlimb(calibrateduserid, simpleopenni.skel_left_shoulder, simpleopenni.skel_left_elbow); //right hand above right elbow // , // right hand right of right elbow if(lefthand.y > leftelbow.y && lefthand.x > leftelbow.x) { stroke(255); mousepressed = true; **this being section cant figure out!** println("did work?"); }else{ stroke(355, 0, 0); } kinect.drawlimb(calibrateduserid, simpleopenni.skel_left_hand, simpleopenni.skel_left_elbow); } } if r instance of robot ...

java - SuppressWarnings not working on FindBugs -

i ran findbugs on eclipse project , got potential bug warning suppress specific reason (outside context of question). here's code: public class logitem { private string name; private void setname(final string nm) { name = nm; } } when run findbugs on class gives warning on name = nm assignment operation, stating: unread field: com.me.myorg.logitem.name . so tried adding this: private void setname(final string nm) { @edu.umd.cs.findbugs.annotations.suppresswarnings(value = "np", justification = "because can") name = nm; } when syntax (compile) error in eclipse, stating: duplicate local variable nm; name cannot resolved type. so tried adding findbugs' suppresswarnings on field itself, after re-running findbugs on class, findbugs still complaining same line of code , same reason. tried adding suppresswarnings setname method, , still no difference. how ( exactly !) use annotation quiet find...

Java Http request on api.stackexchange with json response -

i'm trying use api-stackexchange java when request , try parse response json parser have error. public arraylist<question> readjsonstream(inputstream in) throws ioexception { jsonreader reader = new jsonreader(new inputstreamreader(in, "utf-8")); reader.setlenient(true); try { system.out.println(reader.nextstring()); // � special character return readitem(reader); } { reader.close(); } } public arraylist<question> readitem(jsonreader reader) throws ioexception { arraylist<question> questions = new arraylist<question>(); reader.beginobject(); while (reader.hasnext()) { system.out.println("here");//not print error before string name = reader.nextname(); if (name.equals("items")) { questions = readquestionsarray(reader); } } reader.endobject(); return questions; } public final static void main(string...

java - OPTICS Clustering algorithm. How to get the best epsilon -

i implementing project needs cluster geographical points. optics algorithm seems nice solution. needs 2 parameters input(minpts , epsilon), are, respectively, minimum number of points needed consider them cluster, , distance value used compare if 2 points in can placed in same cluster. my problem that, due extreme variety of points, can't set fixed epsilon. @ image below. the problem http://s13.postimage.org/u5a08nwvb/immagine.png the same points structure in different scale result different. suppose set minpts=2 , epsilon = 1km. on left, algorithm create 2 clusters(red , blue), on right create 1 single cluster containing of points(red), obtain 2 clusters on right. so question is: there kind of way calculate dynamically epsilon value result? edit 05 june 2012 3.15pm: thought using optics algorithm implementation javaml library, seems dbscan algorithm implementation. question is: know java based implementation of optics algorithm? thank , excuse my poor english. m...

shutdown - Stop MySQL service windows -

i developing website , need refresh data. therefore mysql must stopped. how can stop service? when @ control panel services started without stop or restart option. on windows if using windows open command prompt , type to stop mysql service net stop mysql to start mysql service net start mysql. on linux expand|select|wrap|line numbers # /etc/init.d/mysqld start # /etc/init.d/mysqld stop # /etc/init.d/mysqld restart fedora / red hat support this: expand|select|wrap|line numbers # service mysqld start # service mysqld stop # service mysqld restart i know answer late hope helps one.

iphone - location based local notification -

i wondering if can invoke app based on current location or when device gets near geographic coordinates. went through uilocalnotification class reference. work base on date. regards, yes, app can notified (even if it's not running) when device enters region you've defined. see monitoring shape-based regions .

PHP+Cookies: Show message once only -

i'm having problem short piece of code cannot work. basically, want display 2 different messages, depending on whether user new or returning. <?php if(isset($_cookie['visit']) && ($_cookie['visit'] == "true")) { echo 'cookie set, welcome back'; }else{ echo 'cookie not set, welcome new user'; } setcookie("visit", "true", time()+60*60*24*600); ?> the problem cookie not being set. don't know wrong, can me? you need move setcookie condition: <?php if(isset($_cookie['visit']) && $_cookie['visit'] == "true"){ echo 'cookie set, welcome back'; }else{ echo 'cookie not set, welcome new user'; setcookie("visit", "true", time()+60*60*24*600); } ?> if not working should check cookie being sent script. eg browser or browser addon interfering. be aware there new law if server based in eu, require...

c# - Text scroll inside WPF datagrid cell in template column -

my text long in template column, trimming text , ends dots. showing full text in tooltip. how can when mouse scrolled on cell longer text, text should scroll right left. using wpf, , wpf toolkit datagrid perhaps i'm reading question wrong, instance make cell datatemplate wraps scrollviewer around text , set scrollbar visibilities auto?

c# - What is this piece of code doing with RegEx -

Image
have been studying sample source code , can't understand part, piece of code doing? regex part... in parameters used, "code" string, c# source code passing in. match m = null; if ((m = regex.match(code, "(?ims)^[/']{2}refdll (?<ref>.+?)$")).success) { foreach (string refdll in m.groups["ref"].value.split(new char[] { ';', ',' })) { //2008-06-18 jeffrey, remove redundant \r string mdfyrefdll = refdll.replace("\r", "").replace("\n", ""); //trim ending .dll if exists if (mdfyrefdll.tolower().endswith(".dll")) mdfyrefdll = mdfyrefdll.substring(0, mdfyrefdll.length - 4); string lcrefdll = mdfyrefdll.tolower(); if (lcrefdll == "system.data.linq" || lcrefdll == "system" || lcrefdll == "system.xml.linq" || lcrefdll == "system.core") continue; cp.referenced...

css - Why are my submenus being covered? -

what in css covering sub-menus drop down menu? here template. hovering on "bar" supposed produce sub-menu. http://dl.dropbox.com/u/1531353/misc/menubarcovered/index.html i tried altering z-index of submenus no avail. no need use overflow:hidden on every element. if remove property header css declaration you'll able see submenu on hover. by using overflow:hidden, clipping , making invisible falls below boundaries of element.

php - I am new to CakePHP. Is this site menu sensible and conventional? -

i need bit of feedback make sure i'm not missing point of cakephp/mvc. i'm designing mini-cms in cakephp--essentially photo album. i'm looking have standard, boiler-plate drop down menu on every page. naturally, menu needs dynamic user deletes , adds albums. my goal: build moves in opposite direction of view::actionrequest() (ie, instead of view calling controller, have controller push set variable view class before renders.) understanding view::requestaction() not graceful , quite slow. this model table containing menu keywords. app/model/modelitem.php class menuitem extends appmodel { public function buildmainmenu() { return $this->find('all'); } } since want everywhere, put call in appcontroller class appcontroller extends controller { public function beforefilter() { $this->loadmodel('menuitem'); $this->set('mainmenuitems',$this->menuitem->buildmainmenu()); } } and element...

apache camel - How does Timer component polls? -

let's have following time component: from("timer://foo?period=1000").setbody(constant("select * customer")).to("jdbc:testdb").to("beanref:processresult"); how timer component work here? reads database in every 1 sec or waits bean finish processing? if bean still processing earlier result , timer keep polling database create bottleneck. there way avoid it? okay, update: looking @ source code, timer component relies on java timertask implementation. , question answered here: is java's timer task guarenteed not run concurrently? short answer: 1 single thread executes trigger , routes connected it, there no concurrent execution. that said, might want controll execution bit. recommended timer tasks (and hence camel timers) have margin between period in timer , max task execution time. you can use seda component (with concurrentconsumers=[num threads]) in between fine grain controll execution work queue. timer finish it...

html5 - JavaScript network visualization? -

i'm looking library visualize network. i need add nodes(node has text on them), add edges between them, (edges directed , have text on them).i don't want set position of hand. i'd api simple as: var node1 = x.addnode(1, "hello"), node2 = x.addnode(2, "world"); x.addedge(node1, node2, "helloworld"); i've searched hours, looked after arborjs, sigma.js, d3.js, javascript infovis toolkit, none of them satisfied me. is there else can try? check out vivagraphjs . amazon visualization sample vivagraphjs. layout configuration sample , uses webgl renderer.

Editing files in place with perl from powershell -

i have list of files files.txt in directory. want run text substitution through each file. $f = (get-content files.txt) foreach ($i in $f) { perl -pi -we "s/(\d{0,4})- /$1 - /g" $i } but perl doesn't without making backup. can't inplace edit without backup. so added .bak -i: $f = (get-content files.txt) foreach ($i in $f) { perl -pi.bak -we "s/(\d{0,4})- /$1 - /g" $i } and complains: can't open perl script ".bak": no such file or directory what missing? update: what prefer way without shell entirely. can loop in perl $^i somehow? my $qfn = 'files.txt'; open(my $fh, '<', $qfn) or die("can't open file list \"$qfn\": $!\n"); local @argv = <$fh>; local $^i = '.bak'; local $_; while (<>) { s/(\d{0,4})- /$1 - /g; print; } \d matches more 0-9 when /a isn't used, want s/(\d{0,4})- /$1 - /ag; -or- s/([0-9]{0,4})- /$1 - /g;...

save - saving a model from a strongly typed view -

imagine have sent model view... attempting save model once edit it. if don't write out of fields (that identity object instance), somehow reset 0 or empty (if string). did though, write out hidden field when attempt save object, able identify object is... is form? or missing step? if you've specified model type view on header of file, , using html.beginform helper method, i'm pretty sure take care of sending id you. edit: tested it, , it's right. html.beginform method created output <form action="/product/edit/1" method="post"> that's why sends id. here's controller used test it: using system.web.mvc; using mvcapplication2.models; namespace mvcapplication2.controllers { public class productcontroller : controller { public actionresult edit(int id) { return view(new product { id = 1, name = "test"}); } [httppost] public actionres...

objective c - Cocos2d, rotated (transparent) sprite collision -

is there inbuilt method let's me detect intersection between 2 rotated sprites? i know it's second question, there (maybe) pixel perfect detection method exclude transparent parts of 2 sprites? thank you. maybe. there this: http://www.learn-cocos2d.com/2011/12/fast-pixelperfect-collision-detection-cocos2d-code-1of2/ fast pixel-perfect collision detection cocos2d example code (1/2)

Pass parameter from xquery to xslt -

i transform xml using xslt important variable comes request. have such xquery: let $transform := doc("projekt.xsl") let $serialization-options := 'method=xml media-type=text/xml omit-xml-declaration=yes indent=no' let $params := <parameters> <param name="output.omit-xml-declaration" value="yes"/> <param name="output.indent" value="yes"/> <param name="output.media-type" value="text/html"/> <param name="output.method" value="xhtml"/> <param name="param.name" value="topicid" /> <param name="param.select" value="{$topid}"/> </parameters> return transform:transform($doc, $transform, $params, $serialization-options) file project.xsl here: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://...

php - How can I count how many times a controller action is called in CakePHP? -

what's best way find out how many times controller action in cakephp application called? if don't need inside application, debugging (which sounds like) i'd set xdebug , webgrind which give invocation count along cost of function.

maven - How to specify Spring propertyPlaceHolderConfig values in Gradle build? -

i migrating existing maven build gralde , facing issue. in maven pom.xml ,spring propertyplaceholderconfig values specified in maven profiles. maven build specifies 3 types of profiles dev,test , prod i want achieve same thing in gradle build till not able figure out how in gradle thanks, manoj i think there different options how can model existing mvn profiles gradle. i'll give 1 example here: given have property file looks that: property1=$prop1 //prop1 , prop2 placeholder environment specific values property2=$prop2 now can model profiles in build.gradle file: def profileproperties = [ test:[prop1:"testvalue1", prop2:"testvalue2"], dev:[prop1:"devvalue1", prop2:"devvalue2"], prod:[prop1:"prodvalue1", prop2:"prodvalue2"] ] this ordinary nested map defined in groovy. by passing commandline option 'profile' gradle call gradle clean build -pprofile=dev you can pass gradl...

web services - C# - Unable to Obtain WebException Response from Inner Exception -

i'm catching exception, i've done in 2 ways. first method, i'm catching full exception, checking see if inner exception of type webexception, , if is, obtain response stream. below first example, zero-string response: catch (exception e) { if (e.innerexception webexception) { webexception webex = (webexception)e.innerexception; httpwebresponse myresponse = webex.response httpwebresponse; string response = string.empty; if (myresponse != null) { streamreader strm = new streamreader(myresponse.getresponsestream(), encoding.utf8); response = strm.readtoend(); //empty response } } } however, if catch web exception, , pretty same thing, obtain response fine: catch (webexception e) { httpwebresponse myresponse = e.response httpwebresponse; string response = string.empty; if (myresponse != null) { streamreader strm = new streamreader(myresponse.getres...

android - onMeasure(...) being passed MeasureSpec.EXACTLY, apparently wrongly -

i've created custom view implements onmeasure : @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { float width = measurespec.getsize(widthmeasurespec); final int widthmode = measurespec.getmode(widthmeasurespec); float height = measurespec.getsize(heightmeasurespec); final int heightmode = measurespec.getmode(heightmeasurespec); float nominalheight = getresources().getinteger(r.integer.nominalheight); float nominalwidth = getresources().getinteger(r.integer.nominalwidth); float aspectratio = nominalwidth / nominalheight; if( width / height > aspectratio //too wide && ( widthmode == measurespec.at_most || widthmode == measurespec.unspecified ) ) { width -= (width - height * aspectratio); } if( width / height < aspectratio //too tall && ( heightmode == measurespec.at...

case class overloading in Scala -

i have legacy message in system, , able map new version message in system. why can't overload case class? case class message(a:int, b:int) case class newmessage(a:int, b:int, c:int) { def this(msg : message) = this(a = msg.a, b = msg.b, c = 0) } val msg = message(1,2) val converted = newmessage(msg) this code doesn't seem compile. :( you must explicitly call constructor using new operator: val converted = new newmessage(msg) it works because defining second constructor in newmessage while ordinary: newmessage(1, 2, 3) is translated to: newmessage.apply(1, 2, 3)

iphone - How to get Facebook Photo Albums for iOS? -

i'm making following simple request facebook. goal grab names of user's photo albums: [[appdelegate shareddelegate].facebook requestwithgraphpath:@"me/albums" anddelegate:[appdelegate shareddelegate]]; then, json response server such: data = ( { "can_upload" = 1; count = 4; "cover_photo" = 321491374598618; "created_time" = "2012-06-04t21:46:23+0000"; = { id = 100002132746588; name = "owner...."; }; id = 321491371265285; link = "http://www.facebook.com/album.php?fbid=321491371265285&id=100002132746588&aid=73680"; name = "photos"; privacy = custom; type = normal; "updated_time" = "2012-06-04t22:08:39+0000"; }, { "can_upload" = 0; count = 1; "cover_photo" = 31...

java - UnsupportedOperationException when merging an existing Hibernate model object? -

after upgrade hibernate 3 4, we're working through few kinks popped along way. 1 has particularly stumped unsupportedoperationexception, existing object pulled database, tweaked, , merged. the problem hibernate appears adding object abstractlist this seems happen 1 particular object type, when saved in our dao, best can tell: we're not using sublist() or aslist() methods cause immutable instance created. examining object that's being saved (which enormous , has many children) don't think of children items abstractlist types. here code snippets around stack points: hibernatedao.save(): @transactional public void save(t item) { try { getsessionfactory().getcurrentsession().merge(item); } catch (exception ex) { logger.debug("unable merge", ex); logger.warn("unable merge item, saving instead. (of type " + item.getclass() + ")"); getsessionfactory().getcurrentsession().saveorupdate(it...