Posts

Showing posts from June, 2011

amazon web services - Trying to connect to EC2 mysql from my local machine -

i trying connect ec2 instance localhost machine , getting error "connection failed: no connection made because target machine actively refused it." in security group have opened port mysql 3306 ip address, , in my.conf file have change bind-address 0.0.0.0. please let me know else can try connect server's mysql database. in security group add inbound access rule ssh i think problem should this. because, accessing out ssh rule not possible. , try ping instance ip local cmd.

excel vba - Use of Index funtion in VBA returning run-time error message -

i can't figure out why cog run-time returning run-time error message unable index property worksheet function. below code, function distance() integer distance = application.worksheetfunction.index(workbooks("practice 1.xlsm").worksheets("sheet2").range("i11:p18"), range("k12")) end function the index function needs range, row , column - 3 parameters. in case give two. if start new empty application, , write ?application.worksheetfunction.index(range("a1:c10"), range("d1"),range("d2")).address in immediate window, $a$2:$c$2 , in case write 2 in d2 , 1 in e1. or code this: function distance() integer distance = application.worksheetfunction.index(workbooks("practice 1.xlsm").worksheets("sheet2").range("i11:p18"), range("k12"),1) end function

python - How to convert a boolean array to an int array -

i use scilab, , want convert array of booleans array of integers: >>> x = np.array([4, 3, 2, 1]) >>> y = 2 >= x >>> y array([false, false, true, true], dtype=bool) in scilab can use: >>> bool2s(y) 0. 0. 1. 1. or multiply 1: >>> 1*y 0. 0. 1. 1. is there simple command in python, or have use loop? numpy arrays have astype method. y.astype(int) . note might not necessary this, depending on you're using array for. bool autopromoted int in many cases, can add int arrays without having explicitly convert it: >>> x array([ true, false, true], dtype=bool) >>> x + [1, 2, 3] array([2, 2, 4])

tcl - How to issue commands from inside a loop? -

this basic question. think of tcl command line generator. purpose generate strings tool’s command line interpreter. example, tcl commands: set alpha “run” $alpha $alpha $alpha cause “run” command sent tool 3 times – makes sense. but: set alpha “run” {set 0} {$i<3} {incr i} $alpha does not. question is: how send commands tool inside loop? your problem "funny quotes" in line set alpha “run” to tcl, quotes aren't syntactic markers, text. try set alpha "run" or, better, set alpha run

Project Euler #10 Sum of Primes -

i working on project euler's project #10 in asked find sum of primes below 2,000,000. reason, cannot code work. not understanding data types use, neither int, long, or long long seems working. or advice appreciated. here code. thanks. int main(int argc, char *argv[]) { int primes[100] = {2, 3, 5, 7}; //array of primes have been found int fillcell = 4; //cell looking fill int testnum = 8; //number being tested see if it's prime int divprime; int sum = 17; for(testnum = 8, fillcell = 4 ; testnum < 2000000 ; ++fillcell) { std::cout << "fillcell " << fillcell << std::endl; for( ; primes[fillcell] == 0 ; ++testnum) { std::cout << "testnum " << testnum << std::endl; for(divprime = 0 ; testnum % primes[divprime] != 0 ; ++divprime) { std::cout << "divprime " << divprime << std::endl; if(primes[divprime] >= sqrt(testnum))

mysql - Select one of a row -

select v.id, v.photoid, count(*) cnt, p.photowidth, p.dir `views` v join `photos` p on v.photoid = p.id group v.photoid desc order cnt desc i have above mysql command. works great in photo table each photo linked directory id. what want 1 row each dir id. how can this? you need remove other columns. need apply aggregate function column except directory id below. if need other column apply aggregate function columns in count. have used 1 instead of * improve performance of query. select count(1) cnt, p.dir `photos` p group p.dir desc order cnt desc update: so if photoid views on top following query helpful. select p.id, v.countrec cnt `photos` p join (select photoid, count(1) countrec `views` group photoid) v on p.id= v.photoid order cnt desc

sql - Why SUM(null) is not 0 in Oracle? -

it appreciated explaining internal functionality of sum function in oracle, when encountering null values: result of select sum(null) dual; null but when null value in sequence of values (like sum of null-able column), calculated value of null value 0 select sum(value) ( select case when mod(level , 2) = 0 null else level end value dual connect level <= 10 ) 25 this more interesting when seeing result of select (1 + null) dual null as operation null result null (except is null operator). ========================== some update due comments: create table odd_table select sum(null) some_name dual; will result: create table odd_table ( some_name number ) why some_name column of type number ? sql not treat null values zeros when calculating sum , ignores them: returns sum of values, or distinct values, in expression. null values ignored. this makes difference in 1 case - when sequence being totalled not contain numeric items, null s: if

What is range of Cloudant geospatial point's nearest neighbour search -

i using cloudant db geospatial index. cloudant has nearest neighbor search point. has parameter limit no of results. range of nearest neighbor. have requirement search in 500 mts. how can achieve same in cloudant. you can specify range combining nearest neighbor parameter geometry parameter. example, following query find docs within 500 meters of specified lat/long: https://account.cloudant.com/yourdatabasename /_design/yourdesigndocname/ _geo/yourgeoindexname ?lat=37.41511369 &lon=-122.2099019 &radius=500 &relation=contains &nearest=true more information: https://docs.cloudant.com/geo.html update : sure add &relation=contains ensure results include locations within radius. have updated example above. if relation not included nearest neighbor return "all geojson documents in database order measured distance query point." see documentation other relation types (i.e. contains, crosses, overlaps, etc.)

MSBuild error when creating a build definition in TFS 2013 -

i trying create build definition can publish changes have made database project sql server. whenever queue new build, error: exception message: msbuild error 1 has ended build. can find more specific information cause of error in above messages. (type buildprocessterminateexception) exception stack trace: @ system.activities.statements.throw.execute(codeactivitycontext context) @ system.activities.codeactivity.internalexecute(activityinstance instance, activityexecutor executor, bookmarkmanager bookmarkmanager) @ system.activities.runtime.activityexecutor.executeactivityworkitem.executebody(activityexecutor executor, bookmarkmanager bookmarkmanager, location resultlocation) when create build, more defaults did not change configurations specially in process section. when check drop folder well, error log: build started 4/25/2016 1:16:15 am. project "c:\builds\2\manufacturing intelligence\defaultbuild\src\tfs\database1.sln" on node 1 (default targets). valida

swift - accessibilityPerformEscape does not dismiss UIAlertController -

i'm trying show uialertcontoller , dismiss when voiceover user performs scrub gesture: override func accessibilityperformmagictap() -> bool { showpopup() return true } override func accessibilityperformescape() -> bool { print("close") return true } func showpopup(){ basealert = uialertcontroller(title: "popup", message: "choose option", preferredstyle: .alert) let firstaction = uialertaction(title: "method 1", style: .default) { (alert: uialertaction!) -> void in print("one") } let secondaction = uialertaction(title: "method 2", style: .default) { (alert: uialertaction!) -> void in print("two") } let thirdaction = uialertaction(title: "method 3", style: .default) { (alert: uialertaction!) -> void in print("three") } let

c# - How to convert stringbuilder text and get pdf format file output in asp.net -

i'm using visual studio 2008 , need convert stringbulider text , pdf format output file on button click event.. following sample stringbuilder text. stringbuilder reqreport = new stringbuilder(); reqreport.append("<li>five copies of latest passport size.</li>"); reqreport.append("<li>your certificates, testimonials etc. (in original 1 photocopy)</li>"); reqreport.append("<li>residence & identity proof required in bank account opening process per rbi guidelines.</li>"); i tried using itextsharp.. string html = reqreport.tostring(); document pdfdoc = new document(pagesize.a4, 10f, 10f, 10f, 0f); pdfwriter writer = pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); system.xml.xmltextreader _xmlr = new system.xml.xmltextreader(new stringreader(html)); htmlparser.parse(pdfdoc, _xmlr); response.contenttype = "application/pdf"; response.addheader("content-disposition", &

css - Why does my absolutely positioned table not fill its container div? -

i have table inside div, , table won't fill container div. why not? html: <div class="fill"> <table class="table"> ... </table> </div> css: .fill { position:relative; width:100%; height:100%; } .table { position:absolute !important; left:0 !important; right:10px !important; bottom:0 !important; top:39px !important; } the table fills small portion of container div. why? update: or, if try following, doesn't work in firefox, in chrome. html: <div class="fill"> <div class="wrap"> <table class="table"> ... </table> </div> </div> css: .fill { position:relative; width:100%; height:100%; } .wrap { position:absolute; left:0; right:0; top:39px; bottom:0; } .table { position:relative; height:100%; width:100%; } this second version closer want (since work in chrome). in regards o

css - HTML - Is it possible to uncheck all the other checkboxes when you check one checkbox? -

basically im building gallery, pure css. when press image1 check checkbox1 , div1 appear. have done already, problem is, if press image2 div2 appear, if press image1 again div1 not appear because div2 in front of it. html: <div class="gallery"> <label for="toggle1"><a>1</a></label> <input id="toggle1" type="checkbox"> <label for="toggle2"><a>2</a></label> <input id="toggle2" type="checkbox"> <label for="toggle3"><a>3</a></label> <input id="toggle3" type="checkbox"> <label for="toggle4"><a>4</a></label> <input id="toggle4" type="checkbox"> <label for="toggle5"><a>5</a></label> <input id="toggle5" type="checkbox"> <label for="toggle6"><a>6</a>

.htaccess - apache htaccess map first segment as parameter without disturbing other parameters -

this might classic .htaccess question, still couldn't find question specific case. here's closest found (parameters involve in case). done implementing 2 answers. couldn't work case. my case 1) want access url, mywebsite.com/any-first-segment?param1=a&param2=b&param3=c&paramn=anything will remapped to mywebsite.com/index.php?p=any-first-segment&param1=a&param2=b&param3=c&paramn=anything 2) still working if there's no param. 3) never have more 1 segment. (zero segment still works, mapped index.php usual) could suggest me working rewriterule case? here's last .htaccess, still not working options +followsymlinks rewriteengine on rewritecond %{request_filename} !-l rewriterule ^(.+)$ index.php?p=$1 [qsa,l] [updated!] it's working. found messed options +followsymlinks after reading this here's working .htaccess. exception. rewriteengine on rewritecond $1 !^(index\.php|images|robots\.txt|css) rewriter

sql - postgresql join confusion -

i'm trying make statement work. can't figure out. list names of students never took course databases. i have this: select distinct s1.name, e1.section_id students s1 inner join enrollment e1 on e1.student_id = s1.id e1.course_id != 12 but doesn't remove student took section, i'm stuck. database looks (i'm soo sorry, don't know how insert database here) table students ( id integer primary key, name varchar(255), graduation_date date, major_id integer references departments(id) ); insert students (id, name, graduation_date, major_id) values (1, 'joe', null, 10); insert students (id, name, graduation_date, major_id) values (2, 'amy', '2009-04-22', 20); insert students (id, name, graduation_date, major_id) values (3, 'max', null, 10); create table courses ( id integer primary key, title varchar(255), units

How to rank the data set having multiple columns in Scala? -

i have data set fetching csv file how store in scala processing. +-----------+-----------+----------+ | recent | freq | monitor | +-----------+-----------+----------+ | 1 | 1234| 199090| | 4 | 2553| 198613| | 6 | 3232 | 199090| | 1 | 8823 | 498831| | 7 | 2902 | 890000| | 8 | 7991 | 081097| | 9 | 7391 | 432370| | 12 | 6138 | 864981| | 7 | 6812 | 749821| +-----------+-----------+----------+ actually need sort data , rank it. new scala programming. thanks answering question here solution, code reads csv , order third column object csvdemo extends app { println("recent, freq, monitor") val bufferedsource = io.source.fromfile("./data.csv") val list: array[array[string]] = (bufferedsource.getlines map { line => line.split(",").map(_.trim) }).toarray val newlist = list.sortb

ios - KIF - tests failed on Xcode 7.3 -

my app pass kif tests on xcode 7.2. after upgrade xcode 7.3 fail. reason : app not coming foreground during tests on xcode 7.3 if manually click on app , take foreground good. assume there no issue test cases. if has has encounter similar , has solution please let know. thanks by manually clicking build previous 7.2 build not 7.3 .clean code , build again work.

How to use Django (Class)Views for a particular <div> in the template (through Ajax) ;I am integrating django-chatrooms app in my project -

i relatively new django . want integrate django-chatrooms( https://github.com/qubird/django-chatrooms ) app project . app has 3 different urls (1.available-chatrooms list 2.set-guestname/login 3.room(actual chat interface)) . want make these 3 features (join room,set guestname/login , chatwindow)available user @ same url (which project homepage).so doing through ajax . i need call 3 class views app ; corresponding url's , views files of app : urls.py #encoding=utf8 django.conf.urls.defaults import url, patterns . import views .utils.decorators import room_check_access .ajax import chat urlpatterns = patterns('chatrooms', # room views url(r'^rooms/$', views.roomslistview.as_view(), name="rooms_list"), url(r'^room/(?p<slug>[-\w\d]+)/$', room_check_access(views.roomview.as_view()), name="room_view"), url(r'^setguestname/$', views.guestnameview.as_view(), name="set_gues

svn - Jenkins Build Failure with Workspace -

i getting failure build message jenkins when build project. not sure entails. build has worked multiple times before until 1 of other team members committed new data our svn server. build not "recognize" workspace. there link had same error did not solve problem @ end. started user chris parsons building in workspace c:\program files (x86)\jenkins\jobs\ilaundry - installer builder\workspace checking out fresh workspace because there's no workspace @ c:\program files (x86)\jenkins\jobs\ilaundry - installer builder\workspace cleaning local directory . java.nio.file.filesystemexception: c:\program files (x86)\jenkins\jobs\ilaundry - installer builder\workspace\.\.svn\wc.db: process cannot access file because being used process. @ sun.nio.fs.windowsexception.translatetoioexception(unknown source) @ sun.nio.fs.windowsexception.rethrowasioexception(unknown source) @ sun.nio.fs.windowsexception.rethrowasioexception(unknown source) @ sun.nio.fs.windowsfile

How to prevent mail from Wordpress website from being flagged as spam on Exchange online server -

i have website; let's call abc.com. it's e-mail handled office365. migrated sharepoint environment different webhost (godaddy). have tried using wp mail smtp plugin option send e-mails, fails send. my settings are: smtp: smtp.office365.com port: 587 encryption: use tls authentication: use smtp sending fails error: smtp error: failed connect server: connection refused (111) using default wp mail settings below works send e-mail addresses outside domain, messages flagged spam on addresses within domain. header = 'from: '.get_option('blogname').' <wordpress@abc.com>' i have e-mail routing set remote mail exchanger. i've tried adding address wordpress@abc.com exchange's allowed list/whitelist, , tried adding host ip trusted ips on server - still doesn't work. as far i'm aware, godaddy not let send mail external smtp providers. if you're not able choose host (which i'd recommend if can!), you'll

c# - Find gaps in a List of object with Start/End dates -

i have list of objects hold start , end date rate person charged. public class projectresourcecostdto { public int id { get; set; } public int projectresourceid { get; set; } public datetime startdate { get; set; } public datetime? enddate { get; set; } public decimal cost { get; set; } public bool deleted { get; set; } } i have project start , end date. need return list<> of 'gaps', there no rate set. so, if have project start date "01-jan-2013" , end on "31-dec-2013", inputs. i need go through list, , output list of start/end dates there no payment rates. so, if list of objects have: start=05-jan-2013 end=01-oct-2013 start=15-oct-2013 end=25-dec-2013 then, i'd need return: 01-jan-2013 04-jan-2013 02-oct-2013 14-oct-2013 26-dec-2013 31-dec-2013 those period can't determine rate. it's done in c# code. i'm using entity framework, maybe option view in sql

python - Error in writing a dictionary to a file -

i trying write dictionary invindex text file. found following post: and wrote these lines: import csv f = open('result.csv','wb') w = csv.dictwriter(f,invindex) w.writerow(invindex) f.close() when reach line: w.writerow(invindex) , error: traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python33\lib\csv.py", line 153, in writerow return self.writer.writerow(self._dict_to_list(rowdict)) typeerror: 'str' not support buffer interface how can write dictionary text file correctly. in python 3, csv writers , readers expect text stream, open(.., 'wb') (or more precisely, b creates byte stream). try: import csv invindex = [ {'fruit': 'apple', 'count': '10'}, {'fruit': 'banana', 'count': '42'}] open('result.csv', 'w', encoding='utf-8') f: w = csv.dictwriter(f, invindex[0

linux - mail() in PHP on localhost (fedora 22) not sending emails -

i have problem sending emails in php,i have lampp installed. on linux have postfix, when send terminal works fine. example: works , sends email: /usr/sbin/sendmail -f -t myaddress@gmail.com < message_body.txt in php.ini [mail function] ; win32 only. ; http://php.net/smtp smtp=localhost ; http://php.net/smtp-port smtp_port=25 ; win32 only. ; http://php.net/send-from ;sendmail_from = me@example.com ; unix only. may supply arguments (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path ="/usr/sbin/sendmail -f -t " this mail script... $send = mail("me@gmail.com", "my subject", $msg); if($send) { echo "ok"; } else{ echo "failed send"; } this error log /opt/lamp/logs says when try send /usr/sbin/sendmail: /opt/lampp/lib/libstdc++.so.6: version `cxxabi_1.3.8' not found (required /lib64/libicuuc.so.54) /usr/sbin/sendmail: /opt/lampp/lib/libstdc++

angularjs - ng-switch not working as expected -

instead of having 2 separate ng-if , want combine them , use ng-switch . however, img() functions not switching expected. should differently? turn this: <img ng-src="{{img(mycolor)}}" ng-if="mycolor"> <img ng-src="{{img(mycolor2)}}" ng-if="mycolor2"> into this: <div ng-switch on = "mycolor2"> <div ng-switch-when = "mycolor2"> <img ng-src="{{img(mycolor2)}}"> </div> <div ng-switch-default = "mycolor"> <img ng-src="{{img(mycolor)}}"> </div> </div> here's example ng-switch http://jsfiddle.net/fbg3blac/5/ you might understanding wrong. ng-switch on = "mycolor2" -- means want evaluate value of scope variable mycolor2. ng-switch-when = "mycolor2" -- states if value of mycolor2 equal 'mycolor2' this. ng-switch-default -- should have no = value. pleas

swift - OpenStreetMap tiles in ios Google map SDK not working -

i trying render openstreetmap tiles in google map ios. i have followed instructions here: https://developers.google.com/maps/documentation/ios-sdk/tiles#use_gmsurltilelayer_to_fetch_tiles_from_urls here code class viewcontroller: uiviewcontroller { let urls = { (x: uint, y: uint, zoom: uint) -> nsurl in let url = "http://otile3.mqcdn.com/tiles/1.0.0/osm/\(zoom)/\(x)/\(y).jpg" print(url) return nsurl(string: url)! } override func viewdidload() { super.viewdidload() let camera = gmscameraposition.camerawithlatitude(-33.86, longitude: 151.20, zoom: 2) let mapview = gmsmapview.mapwithframe(cgrectzero, camera: camera) mapview.maptype = kgmstypenone self.view=mapview let layer = gmsurltilelayer(urlconstructor: urls) layer.zindex = 100; layer.map = mapview } but getting blank map, urls in log fine , have valid images. log: http://otile3.mqcdn.com/tiles/1.0.0/osm/3/5/2.jpg http://otile3.mqcdn.com/tiles/1.0.0/osm/

jetbrains - How to set 'Redirect URIs' in the service settings in Hub -

Image
i can access upsource locally using http://pcname:42424/projectname/view . trying access using ip eg. http://192.168.1.42:42424/projectname/view yields oauth 2.0 error unauthorized_client: unregistered redirect uri. client service 'upsource' requests authorization entity uri not registered in hub: http://192.168.3.143:42424/ . if have hub administrator permissions , suspicious uri belong 'upsource', please add uri list of 'redirect uris' in service settings in hub with link https://www.jetbrains.com/help/hub/2.0/oauth-2.0-errors.html#auth.unauthorized_client i not find how set redirecturi though in upsource (went through maybe of settings pages). where can find redirecturi setting can add ip it? update i set instance on different box , set url , port http://192.168.1.42:42424 , works accessed remotely using ip. for reason redirect uri settings area hidden in hub if you're administrator. searching else in jet

javascript - how to change multiple div every 5 seconds -

this question has answer here: calling functions settimeout() 5 answers i tried update posts every 5 seconds, time updated, how many users commented , how many likes. code tried far text1 <div id='poster' class='1'> <input type='hidden' value='1' id='post_id'> text1 </div> <div id='poster' class='2'> <input type='hidden' value='2' id='post_id'> text2 </div> <div id='poster' class='3'> <input type='hidden' value='3' id='post_id'> text3 </div> <div id='poster' class='4'> <input type='hidden' value='4' id='post_id'> text4 </div> in body there onload='refresh()' here what's in java.js: function refresh(){

angular - "has no exported member" Error in my MTL module -

:grinning: me ? have class mdl : materialdesignliteupgradeelements.ts import {directive, afterviewinit} 'angular2/core'; declare var componenthandler; @directive({ selector: '[mdl]' }) export class mdl implements afterviewinit { ngafterviewinit() { componenthandler.upgradeallregistered(); } } and following stack post : material design lite tooltips not working angular 2 added : ngafterviewinit() { componenthandler.upgradedom(); } in class managing view using mtl : materialdesignliteupgradeelements has no exported member "componenthandler" the console error : exception: typeerror: cannot read property 'upgradedom' of undefined any ideas ? i not angular2 but, faced same issue in reactjs material design lite (mdl). the reason why getting exception: typeerror: cannot read property 'upgradedom' of undefined error mdl not export module default. can follow below suggestions export module.

javascript - Prevent unsecure HTTP requests -

i have blog on tumblr, , trying out website ssl. chrome , possibly other browsers, images , scripts not loaded using https automatically blocked, , lose happy little green lock icon in address bar. able edit html of theme, there many external scripts used load images (and other scripts) able weed out , fix every http request. obviously, don't have access web server settings tumblr.com or have configured https redirects or something. i wondering if there way prevent html , other included scripts making http requests through use of javascript. website appears , functions fine without blocked elements, , want lock icon show visitors it's safe website. i have no intention of advertising blog here, i'm sure against user policy on forum. being said, if helpful troubleshooting reasons, can post link if requested.

python - In pandas dataframe handling object data type -

i'm tearing hair out bit one. i've imported 2 csv's pandas dataframes both have column called sitereference want use pd.merge join dataframes using sitereference key. initial merged failed pd.read took different interpretations of sitereference values, in 1 instance 380500145.0 in other 380500145 both stored objects. ran regex clean columns , pd.to_numeric, resulted in 1 value of 380500145.0 , of 3.805001e+10. should both 380500145. attempted; df['sitereference'] = df['sitereference'].astype(int).astype('str') but got back; valueerror: cannot convert float nan integer how can control how pandas dealing these, preferably on import? perharps best solution avoid pd.read affect type of field : df=pd.read_csv('data.csv',sep=',',dtype={'sitereference':str})

nose - How to run multiple python file in a folder one after another -

this question has answer here: run python files in directory 2 answers i have around 20 python files. each time run these files in terminal form 1 after : python a.py python b.py python c.py python d.py python e.py python f.py python g.py . . . (i have provided general file names here) this process takes lot of time. is possible run these file 1 after through script..? if possible, how..? please provide code if possible... i came know through few sites that, using bash script can that.. i don't know how implement it. if can suggest other method, helpful. edits : and need generate report each file using nosetests. the problem facing nosetests that, creates html file name results.html . each time report created, latest html file replaces old html file. beacuse names same. so doing is, renaming report each time run nosetests python file

ruby on rails - Nginx keeps redirecting to HTTPS for no apparent reason? -

i've set ubuntu vps , , running keep getting redirected https don't want. this config: /etc/nginx/nginx.conf : user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; # dropping sslv3, ref: poodle ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini; passenger_ruby /home/deploy/.rvm/wrappers/ruby-2.3.0/ruby; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } /etc/nginx/sites-available/default : server { listen 80 default_server; server_name www.exampl

Typo3 extension for Facebook-like posting and commenting system -

this not (!) question facebook buttons! i searching typo3 extension allows facebook-like posting , commenting following requirements: posts in order of creation small comments underneath inline editing posts , comments (not @ bottom of site or that small avatars aside everything should work facebook status comments — or whatever called — simple, inline , intuitive. i think that extension dialog comes close needs: http://fedext.net/overview/extensions/frontend-plugins.html i not sure inline edit part, should achievable js magic.

android - View background not drawn correctly -

i'm trying create view draws background colour image on top of it. image should transformed matrix. background should not be. the ondraw() method looks this: protected void ondraw(canvas canvas) { canvas.drawrect(0, 0, canvas.getwidth(), canvas.getheight(), paint); drawable drawable = getimagedrawable(); if (drawable == null) { return; } int count = canvas.save(); if (cliprect != null) { canvas.cliprect(cliprect); } canvas.concat(matrix); drawable.draw(canvas); canvas.restoretocount(count); } on of devices i've tested on, background above , left of image not drawn correctly. see video here: https://youtu.be/rno2xxaenua you'll need pause video see what's going on. this problem caused accidentally overriding view.getmatrix()

Objective c : fastest method to overlay a video -

after recording video, want overlay dynamic uiview updated related current video frame timestamp. in fact trying same thing vidometer application. following apple example , able extract video frame buffer , overlay uiimage of uiview. the steps : extract video frame: cmsamplebufferref samplebuffer = [assetreadervideooutput copynextsamplebuffer]; if (cancelled) { completedorfailed = yes; [assetwritervideoinput markasfinished]; } cvpixelbufferref pixelbuffer = cmsamplebuffergetimagebuffer(samplebuffer); update uiview's subviews following frame timestamp: mergetime = cmtimegetseconds(cmsamplebuffergetpresentationtimestamp(samplebuffer)); [self updatewidget:mergetime*1000]; get uiimage of uiview: msurcoucheimage = [self imagefromsurcouche]; with -(uiimage*)imagefromsurcouche{ cgsize msize; msize = cgsizemake(self.msurcouche.bounds.size.width, self.msurcouche.bounds.size.height); uigraphicsbeginimagecontextwithoptions(msize, no, 0.0); if (videoorientation ==

How Wikipedia renders infobox of a language different from English? -

how wikipedia renders information written in english template language? for example, viwiki page tokyo uses english template template:infobox prefecture japan , displayed in vietnamese. this not possible! every wikipedia template available wikipedia in created. so, infobox prefecture japan template created separately in enwiki , in viwiki , because viwiki template bản mẫu:infobox prefecture japan redirected bản mẫu:thông tin tỉnh nhật bản , information thông tin tỉnh nhật bản used when call infobox prefecture japan in viwiki page.

java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2 while remove footerview at the end of listview in Android? -

i'm implementing pagination listview. trying add footer view while loading data , remove footer view @ end of listview when reaches on last page on setonscrolllistener @ end of listview.but getting crash reached on last page getting issue of indexoutofboundsexception: invalid index 2, size 2 i'm adding footerview after initialize list listview listview; int pagecount = 0; view footer;@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); listview = (listview) findviewbyid(r.id.load); // add footer view footer = ((layoutinflater) getsystemservice(context.layout_inflater_service)).inflate(r.layout.prohressbar, null, false); listview.addfooterview(footer); list<all_post> alldesc = dbhelper.getalldescriptions(offset); (all_post all_post : alldesc){ descarray.add(all_post); } if (adapter == null) { adapter = new allpostadapter(this, r.layout.allpostlist, descarray);

javascript - Node.js and Express: How to return response after asynchronous operation -

i'm new node.js, i'm still wrapping head around asynchronous functions , callbacks. struggle how return response after reading data file in asynchronous operation. my understanding sending response works (and works me): app.get('/search', function (req, res) { res.send("request received"); }); however, want read file, perform operations on data, , return results in response. if operations wanted perform on data simple, -- perform them inline, , maintain access res object because it's still within scope. app.get('/search', function (req, res) { fs.readfile("data.txt", function(err, data) { result = process(data.tostring()); res.send(result); }); }); however, file operations need perform long , complicated enough i've separated them out own function in separate file. result, code looks more this: app.get('/search', function (req, res) { searcher.do_search(res.query); // ??? ?

javascript - .prop("checked", false) doesn't work perfectly -

in order uncheck radio button jquery... i use code : $('input[type=radio][name=belvg_customerattributes_particulier]:checked').prop("checked", false); this code works visualy still see button on checked. i tried : $('input[type=radio][name=belvg_customerattributes_particulier]:checked').prop("checked", false).checkboxradio("refresh"); but in vain.. please me ! so works... have investigated , have seen class before imput. so radio checked not visualy. for information have added code remove class in span : $("#uniform-belvg_customerattributes_particulier_0 span.checked").toggleclass("checked"); thanks !

java - Pass data from dialog to activity Android -

i have problem. made method creates dialog own layout. , have no idea how pass values (strings) editext , asing variable in activity. in comments can see how trying solve this. java method public void makedialog(){ // custom dialog final dialog dialog = new dialog(context); dialog.setcontentview(r.layout.dialog_ip); dialog.settitle("ip connection"); // todo passing value dialog activity // final edittext ipvalueconnection = (edittext)findviewbyid(r.id.ipvalueconnection); // ipvalueconnection.setonclicklistener(this); // edittext portvalueconnection = (edittext)findviewbyid(r.id.portvalueconnection); // toast.maketext(context, ipvalueconnection.gettext().tostring(), toast.length_long).show(); button dialogbuttonlogin = (button) dialog.findviewbyid(r.id.dialogbuttonlogin); // if button clicked, close custom dialog dialogbuttonlogin.setonclicklistener(new view.onclicklistener() {

ios - Refresh control with UICollectionView reloadData issue -

i continue refining implementation of uicollectionviewcontroller parse , time i'm dealing issue might related cache or maybe reloaddata method itself. maybe can me identify source of strange behavior better show on short video save time: refreshing issue video - (void)viewdidload { [super viewdidload]; // additional setup after loading view. refreshcontrol = [[uirefreshcontrol alloc] init]; [refreshcontrol addtarget:self action:@selector(refershcontrolaction) forcontrolevents:uicontroleventvaluechanged]; [self.collectionview addsubview:refreshcontrol]; [self queryfortable]; } then on refreshcontrolaction: - (void)refershcontrolaction { nslog(@"reload grid"); // user pulled down collection view. start loading data. [self queryfortable]; [refreshcontrol endrefreshing]; } the query method this: - (void)queryfortable { pfquery *query = [pfquery querywithclassname:@"photo"]; query.limit = 15;

php - Duplicate rows using multiple Doctrine instances -

i have following piece of code import posts database. checks if post exists. if not case, create new one. this script running in cron job. however, has ran manually well. can happen 2 instances of script running simultaniously. when happens, duplicate records made. cannot see why possible. foreach ($posts $post) { $entity = new post(); $entity ->setname($post->name) ->setgender($post->gender()) ->setdate(new \datetime()) ; $em = $this->getcontainer()->get('doctrine')->getmanager(); $checkentity = $em->getrepository('samplebundle:post')->findoneby(array( 'name' => $post->name )); if (!$checkentity) { $em = $this->getcontainer()->get('doctrine')->getmanager(); $em->persist($entity); $em->flush(); } } could shed little light on issue? 1) simplest solution prevents same command runs simultaneously. us

openerp - Edit compute_amount -

i had edit funtion of compute_amount okay problem when pay invoice i'm still getting old amount before change has work on this??? new compute_amount @api.one @api.depends('invoice_line.price_subtotal', 'tax_line.amount','timbre','partner_id') def _compute_amount(self): if self.type == 'out_invoice': if self.partner_id.rs == true: print'rs',self.partner_id.rs self.amount_untaxed = sum(line.price_subtotal line in self.invoice_line) self.amount_tax = sum(line.amount line in self.tax_line) self.amount_rs = (self.amount_untaxed + self.amount_tax) * 0.01 self.amount_total = self.amount_untaxed + self.amount_tax + self.amount_rs + self.timbre else : self.amount_untaxed = sum(line.price_subtotal line in self.invoice_line) self.amount_tax = sum(line.amount line in self.tax_line) self.amount_total = self.amount_untaxed + s

java - List of WebElement find by className return Xpath -

i've got multiple div on webpage have same class attribute. i'm looking way check div of page specific class name, , get, each of div, xpath. actually, can check how many div have on page class name : list<webelements> test = driver.findelements(by.classname("fitter")); int countdiv = test.size(); do have idea, now, elements xpath 1 one ? or have different solution ? my project selenium project , i'm testing web page. test written in java , i'm using webdriver. thanks simply iterate through list of webelements? list<webelement> elements = driver.findelements(by.classname("fitter")); (int = 0; < elements.size(); i++) { webelement element = elements.get(i); // ... whatever need here } the xpath of each element in loop //div[contains(@class, 'fitter')][i]

ResponsiveSlides.js Page jumps on Android when slide changes -

i have implemented slide show using responsiveslides.js v1.54. impressed slideshow have found on samsung galaxy ace phone page jumps top of page when slide changes? works fine on other devices have been able test slideshow on. have development version of slideshow at: http://brixhamgigclub.co.uk/multimedia-new.php?id=9 js in head section of html any ideas fix appreciated. bob i have resolved problem methodically removing bits of code. appears there maybe contention google translate code used on site. have removed meta statement and html <div id="googletranslate"> <div id="google_translate_element"></div> <script type="text/javascript"> function googletranslateelementinit() { new google.translate.translateelement({pagelanguage: 'en', includedlanguages: 'bg,cs,cy,da,de,el,en,es,et,fi,fr,ga,hr,hu,it,lt,nl,no,pl,pt,ru,sk,sl,sr,sv', layout: google.translate.translateelement.inlinelayout.horizont

Show subtitle into another element HTML5 -

i have following code playing video , showing subtitle track. <video id="vtest" class="playr_video" controls preload="metadata"> <source src='upc-tobymanley.theora.ogg' type='video/ogg'> <source src='upc-tobymanley.mp4' type='video/mp4'> <track label="english subtitles" kind="subtitles" srclang="en" src="upc-video-subtitles-en.vtt" default> </video> <div id="subtitle"> </div> is possible show subtitles inside <div id="subtitle"> </div> instead of player? add javascript after <video> element <script> loadtexttrack({videoid:'vtest', // id of video tag kind:'subtitles', // kind of track srclang:'en', // language of source file (optional) targetid:'subtitle'}); // id of element inser

VBA Exporting PDF from Excel in 2 copies -

i'm looking solution export couple of sheets excel 1 file pdf. i've recorded macro creates nice pdf interesting me sheets. need 2 copies of 1 of sheets in same pdf, don't know how it. here code. sub exportpdf() sheets(array("packinglist", "administracyjny", "nadawca", "odbiorca", "przewoźnik")).select sheets("packinglist").activate chdir "c:\users\xxxxxx\desktop" activesheet.exportasfixedformat type:=xltypepdf, filename:= _ "c:\users\xxxxxx\desktop\spools_packinglist.pdf", _ quality:=xlqualitystandard, includedocproperties:=true, _ ignoreprintareas:=false, openafterpublish:= false end sub see here copying worksheet , might workaround copy entire worksheet @ start of code, , can delete @ end ( taken here) : sub sbdeleteasheet() sheet1.delete 'or can mention sheet name sheets("sheet2").delete end sub