Posts

responsive design - Using Jquery Cycle2 can I define a different slide effect for mobile? -

i have nice responsive slideshow going, using nice jquery cycle2 plugin. http://jquery.malsup.com/cycle2/ now, in case of desktop use, use subtle fade effect. setting these attributes on container div: <div class="cycle-slideshow" data-cycle-slides=".slide" data-cycle-swipe="true" data-cycle-pause-on-hover="true" data-cycle-auto-height="container" data-cycle-fx="fade"> but on mobile devices, since slider swipe-enabled, use scrollhorz (horizontally scrolling), since makes better sense when swiping. is possible? here's link api reference: http://jquery.malsup.com/cycle2/api/ thanks in advance. since html tag data-cycle-fx should set before initializing jquery cycle, , using php, looked determining user device server side. i've found $_server['http_user_agent'] reliable (i've heard it's not 100% foolproof, in case that's not problem). i created function, example here...

pygame - Python access variable -

im new python , im trying pygame dont know how should this.. def addrect(x, y, width, height, color, surface): rect = pygame.rect(x, y, width, height) pygame.draw.rect(surface, color, rect) pygame.display.flip() thats creating rectangles question how should access ractangles create ? im trying . r1 = addrect(20, 40, 200, 200, (61, 61, 61), screen) but when try move using r1.move(10,10) i error r1.move(10,10) attributeerror: 'nonetype' object has no attribute 'move' how should access ? thanks- python functions have default return value of none . since, don't have return statement in function, returns none not have attribute move() . from the python docs in fact, functions without return statement return value, albeit rather boring one. value called none (it’s built-in name). >>> def testfunc(num): num += 2 >>> print testfunc(4) none you need add return statement return rect ...

Rails 4 and Leaflet: assets/images not found? -

i having problem should not problem. reason images have in app/assets/images not accessable. when request them 404. ./log/development.log:started "/assets/images/marker-shadow.png" 127.0.0.1 @ 2013-07-20 22:02:38 -0400 ./log/development.log:actioncontroller::routingerror (no route matches [get] "/assets/images/marker-shadow.png"): mike@sleepycat:~/projects/myapp$ ls app/assets/images/ marker-icon-2x.png marker-icon.png marker-shadow.png this should braindead easy fix... restarting server @ most. have restarted server, have checked file permissions make sure files have sane permissions on them... , still 404's when load page. what missing here? using rails 4. just image helper : image_path('marker-shadow.png') the path generated rails "/assets/marker-shadow.png" without 'images' folder.

hibernate - Tomcat connection pool fails, but nothing in log -

my java application running on tomcat 6 has problem caused following exception. uses hibernate , tomcat connection pooling. read problem connection pool, not database itself. right? to debug problem, configured jdbc connection this: <resource name="jdbc/mssqlrepositorycfl" auth="container" type="javax.sql.datasource" maxactive="50" maxidle="5" maxwait="10000" username="updatecfl" password="" validationquery="select 1" defaulttransactionisolation="read_committed" testonborrow="true" removeabandoned="true" removeabandonedtimeout="60" logabandoned="true" driverclassname="net.sourceforge.jtds.jdbc.driver" url="jdbc:jtds:sqlserver://some.server.cz:1433/repository...

javascript - Trying to switch 0 for 1 in the end of the function but it doesnt work -

i having problem witht code. in end of function trying switch 1 0 or 0 1; this button should after each click change words hello or stop clicking me; big in advance function mediadropdown() { var hello="hello"; var stopclicking="stop clicking me"; var notclicked=1; if(notclicked < 1) { document.getelementbyid("mediaarea").innerhtml=hello; } if(notclicked > 0) { document.getelementbyid("mediaarea").innerhtml=stopclicking; } changepolarity(); } function changepolarity() { if(notclicked<1) { notclicked=1; } if(notclicked>0) { notclicked=0; } } the notclicked variable non-persistent; every time run mediadropdown function being redefined , set 1 see text "stop clicking". move outside of function retains value. var notclicked=1; function mediadr...

python - New column based on conditional selection from the values of 2 other columns in a Pandas DataFrame -

i've got dataframe contains stock values. it looks this: >>>data open high low close volume adj close date 2013-07-08 76.91 77.81 76.85 77.04 5106200 77.04 when try make conditional new column following if statement: data['test'] =data['close'] if data['close'] > data['open'] else data['open'] i following error: traceback (most recent call last): file "<pyshell#116>", line 1, in <module> data[1]['test'] =data[1]['close'] if data[1]['close'] > data[1]['open'] else data[1]['open'] valueerror: truth value of array more 1 element ambiguous. use a.any() or a.all() i used a.all() : data[1]['test'] =data[1]['close'] if all(data[1]['close'] > data[1]['open']) else data[1]['open'] the result entire ['open'] column selected. didn't ...

package opencv was not found in the pkg-config search path for centos -

when go command: pkg-config --cflags opencv i following message: package opencv not found in pkg-config search path. perhaps should add directory containing `opencv.pc' pkg_config_path environment variable no package 'opencv' found i'm on cent os 6, have found solution linux ubuntu on internet , here on stack not cent os i tried under opencv specifications with pkg_config_path=/usr/share/opencv/lib/pkgconfig:${pkg_config_path} export pkg_config_path still doesn't work. how can sure opencv installed in directory, used whereis opencv , triggered me /usr/share/ hi first of use 'synaptic package manager'. need goto ubuntu software center , search synaptic package manager.. beauty of packages need available here. second automatically configures paths. install search opencv packages on there if found package green box installed else package not in right place need reinstall package manager time. if installed can only, need fill opencv_d...