Posts

Showing posts from August, 2013

html - Freemarker converts < to &lt; -

so have issue there variable {item.item} item.item contains string 'abc < 5'. < getting converted &_lt; while template runs in browser. tried work escape no luck. worked me using code snippet below: <#assign x = "${item.item}" /> ${x} this returning string correctly, struggling accept solution. inputs ?

require once - require_once in PHP giving errors on new server, but not on original -

i in process of moving php website shared hosting server digitalocean server. have come across issue i'm not sure how debug. there page has log-in form action=2/login.php . form located in /var/www/html/calendar.php (it ubuntu 14.04 droplet). when submitting form, there 500 internal server error . i've found error in question not sure how debug (because runs fine on other server). /var/www/html/2/login.php <?php require_once('../db_connect.php'); ... db_connect.php located @ /var/www/html/db_connect.php when $php 2/login.php following error: login_error.txt php warning: require_once(../db_connect.php): failed open stream: no such file or directory in /var/www/html/2/login.php on line 4 php fatal error: require_once(): failed opening required '../db_connect.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/2/login.php on line 4 when run $php login.php when in directory /var/www/html/2 works fine (which g...

html - Horizontally Align Tworesponsive Images -

still learning responsive web design , ran snag. is there way can make these 2 linked images horizontally aligned instead of being on top of each other while still maintaining responsiveness? need these images horizontally on same line while still being responsive. would best have 2 div tags each image? or 2 images in single div? im not sure. you can see i'm doing jsfiddle . #header { padding-top: 1%; padding-bottom: .5%; background-color: white; } #header img { display: block; margin-left: auto; margin-right: auto; height: 20%; width: 20%; } here's fiddle: https://jsfiddle.net/odw3vru8/8/ add: #header { /* if want center align images horizontally */ text-align:center } #header img { display: inline-block; vertical-align:middle; }

ruby - Multiple method calling -

this returns original name . name = "george" name.reverse.upcase! puts(name) i'm wondering why , if there way tried above. reverse returns new string. upcase! upcases string called on in-place. creating new reversed string, upcasing new string, , never using again. if wanted reverse , upcase original string name.reverse!.upcase!

sql - What kind of query do I need? -

i have table called physical_exam_tool_and_body_parts has: id physical_exam_tool_id body_part_id the body_parts table has: name_tid the physical_exam_tools table has: name_tid the translation table looks like: id lang text i'm trying query: select physical_exam_tool_text, body_part_text physical_exam_tool_and_body_parts translation.lang = 'fr' i want names of body part , physical exam tool lang 'fr'. how can this. i'm new joins. body_parts , physical_exam_tools tables have: id name_tid name_tid id in translation table. translation table has id lang text. primary key translations composite key (id,lang). in physical_exam_body_part_and_tool id's in ids (foreign keys) body_parts , physical_exam_tools table. join translation table twice lang = 'fr'. select t.[text] [examtool], t2.[text] [bodypart] physical_exam_tool_and_body_parts p inner join physical_exam_tool pet on p.physical_exam_tool_id =...

automation - Automatically uploading text files to an FTP site -

i'm looking automate upload of text file ftp site. upload need occur daily, , have access server run whatever script needed upload. i've looked around solution , found information on howtogeek, neither idea there seemed automatic. i'm looking without third-party software if possible. appreciate pointers. if you're on windows i'd use vbscript (more functionality can added easily) or .bat files (if don't need functionality) call on windows ftp.(provided don't need super secure) build .bat file call on ftp , append connection information accordingly. link here should out. in order make automatic need use "task scheduler" schedule how want script run.

node.js - Azure Websockets connection stuck between connecting and disconnecting -

i'm working on project uses websockets, i've deployed heroku , works fine when deploy same project on azure websockets turned on socket keeps connecting , disconnecting gap of split second. ideas? i suspect haven't enabled websockets in application settings of web app. go portal , find web app. on web app blade, click on "settings" top , "application settings" on blade open. there option called "web sockets". turn "on" , "save". i restart web app, on safe side, although it's not required. try again , should work.

android - TextInputLayout not showing EditText hint before user focus on it -

i using released android design support library show floating label edittexts. facing problem hint on edittext not showing when ui rendered, see hint after focus on edittexts. my layout follows: <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <framelayout android:layout_width="match_parent" android:layout_height="match_parent"> <scrollview android:id="@+id/scrollview01" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation=...

html - Pricing table: <div>'s do not align when an <li> element is removed -

i creating pricing table 4 sections. div 's created work fine until li element removed. whole box shifts down , not align. it's worth mentioning using bootstrap. i have tried: forcing position removing margins/padding setting width/height leaving empty <li></li> (sort of works, doesn't align property) here code: http://cssdeck.com/labs/full/xlaibrry your appreciated! add vertical-align:top boxes: .whole{ vertical-align:top; }

ruby on rails - ActiveRecord Survey Model ActiveRecord Associations for Doctor -> Patient -

i'm trying build survey form user can select survey template, , form rendered questions specific template. class survey < activerecord::base belongs_to :template belongs_to :patient has_many :questions, :through=> :template has_many :answers, :through=> :questions end class template < activerecord::base has_many :surveys has_many :questions end class question < activerecord::base belongs_to :template has_many :answers end class answer < activerecord::base belongs_to :question belongs_to :survey end the questions table has list of 30 pre-seeded questions go each template: create_table "questions", force: :cascade |t| t.integer "template_id" t.text "content" t.string "field_type" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "category" t.string "options" t.boolean ...

how to configure jquery file upload plugin -

i trying use jquery file upload plugin ruby on rails upload files. below things objectives. able drag , drop multiple files i can send single file @ time. having 10 files means plugin should send 1 one file name filedata. after selecting files, can removed before sending server. and should show file upload progress but using sample code, when try drag , drop files, sending 1 file server , not showing file name in filepreview. if autoupload enabled, sending selected file. still not showing filename in filepreview. remove selected file got suggestion here . after clicking start upload button getting javascript error. says "ncaught typeerror: cannot read property 'size' of undefined". please on issue. in advance. sample code here. <%= javascript_include_tag 'application/jquery.ui.widget' %> <%= javascript_include_tag 'application/jquery.iframe-transport' %> <%= javascript_include_tag 'application/jquery.fileuploa...

ember.js - Populate a select box with results generated from another select box -

another new-to-ember question - have component contains select (call type) object. when type selected, want take selected type, make rest call using selected type return records, , populate second select object in component returned records. there many subtypes during initialization (the type list retrieved during initialization). process is: 1) select value type chosen 2) type chosen sent parent route , set there 3) value chosen used rest service list of subtypes. works now, have been unable set the component select subtypes retrieved rest service. been beating head against while now, appreciated. thanks. basically when rest call returns, set result prop on controller. then, bind prop second select's content . // some/route.js fetchblah(param) { return ember.$.getjson('/some/path', {some: param}).then(result => { this.controller.set('fetcheddata', result); }); } // some/template.hbs {{view 'select' content=fetcheddata}} ...

matlab - How to segment out the region of interest in this mask -

Image
hi got mask following, , try segment out left panel. i used watershed method, hope return 1 single value left panel. d = bwdist(~mask); imshow(d,[],'initialmagnification','fit'); di = -d; di(~mask) = -inf; l = watershed(di); lrgb = label2rgb(l,'jet'); imshow(lrgb); but instead got this, can me or have better suggestions in terms of segmentation. referencing answer, using bwconncomp valid approach, problem here left , right pages connected if @ spine of book. therefore, if tried suggested, entire book labelled single object, , that's not want. such, suggest separate pages first, apply labelling algorithm after you're done. a simple morphological opening filter vertical line structuring element should trick. results, used line of length 100. have unnecessary border pixels , image rgb. therefore, i'm going convert image binary clear border: mask = imclearborder(im2bw(imread('http://i.stack.imgur.com/xuydq.png...

oracle11g - visual Studio .net 2013 won't load Oracle.Dataacess dll -

i have vb.net 2005 application trying upgrade vb.net 2013, else has worked when try add reference dll oracle.dataacess doesn't seem work. i don't visible errors, check box select reference, hit ok , window closes. my calls items within dll still show in error, when open references again see dll not selected. the dll 32 bit dll, vs studio looks running 32 bit, ran admin. if open vs 2008 , reference dll works fine. so not sure going on. edit: dll shown on references oracle.dataaccess version 2.112.2.0 i found issue, reason had old references locked in, had go solution explorer , under references delete old one, go in , add new one. this worked.

excel - Execute a subroutine when a user enters a trigger into a cell -

example data in excel: b c 1 9 5 2 4 y 3 3 1 9 4 66 4 5 5 9 what want when enter y in column b, want " somestuff " execute. i don't think if active.cell = y work here, because when enter y , press enter, active.cell not 1 entered y in. looping through column b not work because a. there multiple y s in column b. need execute " somestuff " right after entering y cell. could please suggest should try? as siddarth suggested, worksheet_change() looking for. here how may achieve task without leaks. paste code inside sheet in editing y value. private sub worksheet_change(byval target range) dim myrng range set myrng = range("b:b") dim pierng range 'intersect ensure current cell lies on column b set pierng = intersect(target, myrng) 'if conditions ensure trigger code 1 cell edited on col b , 'y/y'. if target.columns.count = 1 , target.rows.cou...

git - Mercurial clone should prefer heads without bookmarks -

i attempting reproduce git branching workflow in mercurial. everything works well, except when user clones repository ends on feature bookmark because latest commit on "default" branch. how "hg clone" update latest non-bookmarked changeset on "default" branch? according http://mercurial.808500.n3.nabble.com/hg-update-should-prefer-heads-without-bookmarks-td4023171.html#a4023313 : [you] should investigate using @ bookmark if you're using bookmarks. plays same role bookmarks default branches. this worked me. bookmark latest non-bookmarked changeset @ , subsequent clone operations work expected.

maven - Java parsing issue on cast method reference? -

if parser encounters method reference cast, i.e. ... .stream().map(myclass.class::cast). ... it fails "unable parse source file". [error] [15:58:25.853] unable parse source file : ... [error] [15:58:25.855] parse error @ line .. column .. failed match of: spacing dot @ lbrk inc dec star div mod plus minus sl bsr sr ge gt le lt instanceof equal notequal , hat or andand oror query equ plusequ minusequ starequ divequ andequ orequ hatequ modequ slequ srequ bsrequ comma rpar when changing pre java 8 code works. this looks bug in sonarqube maven plugin parser, doesn't it? can point me place or give me hint fix issue? as side note: i've created issue in codehaus jira , told wasn't right place...

c# - HTML form post to asp.net controller across domains -

i've created asp.net mvc 5 web application must receive post external site (within same corporate intranet). i've set controller method , created web application simulate post. posting page form looks this: <form action="http://localhost:12345/home/methodname" method="post"> <input type="text" id="fullname" value="joseph b. blow" /> <input type="text" id="dateofbirth" value="3/4/1977" /> <input type="submit" value="submit" /> </form> i start "receiver" app in debug mode , set break point on first line in "/home/methodname" , breakpoint hit. methodname looks this: [httppost] [validateinput(false)] public actionresult methodname() { ...code here } when check request.form object in methodname , it's empty. using developer tools in browser content-length 0. i've tried creating custom model cl...

javascript - File upload using input type=file not working in IE for first file, works on subsequent uploads -

upload functionality works fine in chrome, doesn't work on ie 11. i'm trying implement upload functionality using following dom element: <input type="file" id="file-upload" class="hidden-inputs"/> i'm triggering click when user clicks else, input hidden. code that: $("#file-upload").click();//triggering click input.change(function(){//when file selected var file = this.files[0]; api.file.upload(path, file, function(err){//upload server //do in callback }); }); when tried debugging code, adding breakpoint shows not go function being called on change. occurs first attempt make @ uploading while, , if keep trying on , on upload same file. however, if attempt upload file once (doesn't work), select difference file, works perfectly. same thing happens if trigger upload functionality, instead of selecting item first time, hit cancel, try upload again, time select file, work perfectly. on change...

active directory - Java how to get get an Attribute from ldap using the DN? -

i have java application use search groups. works pretty search based on group name (cn) more 1 result since same cn used in other branches. have dn of group , wondering how search based on dn or if it's possible access attribute directly since have full path. here code use : public group getgroup( string groupname) throws exception { list<user> memberlist = new arraylist<user>(); // create search controls searchcontrols searchctls = new searchcontrols(); // specify search scope searchctls.setsearchscope( searchcontrols.subtree_scope ); // specify attributes return string returnedatts[] = { member_field }; searchctls.setreturningattributes( returnedatts ); // specify ldap search filter string searchfilter = "(&(objectclass=group)(cn=" + groupname + "))"; // search objects using filter namingenumeration<searchresult> answer = ctxmap.ge...

c# - Sending SignalR Broadcasts that is running within ASP.NET MVC Application from a Windows Service on the same server -

i have asp.net website uses signalr hubs send messages website users. i have code calls hubs within business layer , use dependency injection inject instances of hubs asp.net application business layer. the problem have come against when i've come use business layer within windows service, don't know how instance of hubs. is possible 'hook' existing signalr hubs server, running within asp.net application , send broadcasts windows service? i realise can connect client within windows service using following code, wrong way around, want send broadcasts from server... // code enables client connection var connection = new hubconnection("http://localhost:3537/"); ihubproxy myhub = connection.createhubproxy("notificationhub"); connection.start().wait(); myhub.invoke("setnotificationcount", "5"); your hubs hosted in asp.net application. no, there no way can broadcast directly windows service...without using sca...

java - JPanel disappearing when changing the text of a JButton added to it -

i add jbutton jpanel subclass quiz, , if change either text or font of button, quiz object disappears, showing panel underneath it. however, if change text or font before adding button, works fine. setupgraphics() gets called after quiz added view hierarchy public void setupgraphics() { this.setbackground(color.red); setlayout(null); a.setbounds(20, 20, 200, 200); add(a); a.settext("hi"); } if change code this: public void setupgraphics() { this.setbackground(color.red); setlayout(null); a.setbounds(20, 20, 200, 200); a.settext("hi"); add(a); } then works. any ideas? add(a); a.settext("hi"); --> adding button panel , setting text. that's y not displaying text. second setting text , other attributes , adding button panel.

given certain date, how to get the first day of previous month with the same weekday in mysql -

i'm noob using mysql, , search here , in google didn't me this. i need obtain first day of previous month of date same weekday example: given date: may 29th of 2015 (friday), need first friday of april (april 3rd of 2015). (bear in mind, need value inside update (specifically, inside where)) thanks help! have nice day. this shows 1 way there. if can't use or don't want intermediate variables, replace them repeated sql. set @startdate= '2015-04-06'; set @firstdayofprevmon = concat(year(date_add(@startdate, interval -1 month)),'-',lpad(month(date_add(@startdate, interval -1 month)),2,'0'),'-01' ) ; select case when dayofweek(@firstdayofprevmon) < dayofweek(@startdate) /* if day of week first day of previous month less target day of week,simply increment difference */ date_add(@firstdayofprevmon, interval (dayofweek(@startdate)-dayofweek(@firstdayofprevmon)) day) when dayofweek(@firstdayofprevmon) > d...

PHP Mysql echoing data in one column from multiple rows -

Image
my mysql table looks this: and want retrieve data column 'host' uid equal twenty. i have code connect database , return row when uid equal twenty db.php: public function query($sql, $params = array()){ $this->_error = false; if($this->_query = $this->_pdo->prepare($sql)){ $x = 1; if(count($params)){ foreach($params $param){ $this->_query->bindvalue($x, $param); $x++; } } if($this->_query->execute()){ $this->_results = $this->_query->fetchall(pdo::fetch_obj); $this->_count = $this->_query->rowcount(); } else { $this->_error = true; } } return $this; } public function results(){ return $this->_results; } server.php: public static function get($uid){ $_db = db::getinstance(); $data = $_db->get('servers', array('uid', '=',...

build - Typescript export syntax & code structuring -

i'm building typescript library, , following way: one class ( interface ) / file in dev sources since whole library "belongs together", can go under 1 namespace when building, want able create single output js , d.ts file, relevant exports/definitions. the way tried following: i used /// <reference path="..." /> syntax, reference other files foo.ts class foo { // stuff } bar.ts /// <reference path="foo" /> class bar extends foo { // example referencing compilation unit } create tsconfig.json file, uses out option, concatenated single file: { "compileroptions": { "module": "commonjs", "target": "es5", "out": "src-gen/app.js" /* other options ... */ } } and add single file, exports stuff, want able import other files, this: exports.ts /// <reference path="bar" /> export ...

Setting items from a list to another list (both containing class instances) in random groups in python -

i have 2 lists containing instances 2 classes. want assign groups of items first list second. have right method add_agent. don't know how iterate , exhaust both lists in right order. for example: 20 agents assigned 5 families in random groups of 0, 1, 2, 3 or 4. my code far: def allocate_to_family(families, agents): dummy_agent in agents: dummy_family in families: num_members = numpy.random.choice(4) while num_members != 0: dummy_family.add_agent(dummy_agent) num_members -= 1 thanks bunch! you can use random.sample choose random group of families assign agents : def allocate_to_family(families, agents): dummy_family in families: dummy_agent in random.sample(agents, 4): dummy_family.add_agent(dummy_agent)

How to set custom fonts in JavaFX Scene Builder using CSS -

i'm making gui in javafx scene builder , text (labels, text fields, comboboxes) use same font. problem it's custom font won't on every client's computer. i've tried css: @font-face { font-family: din; src: url(din.tff); } .text { -fx-font-family: din; -fx-font-style: bold; } saved above code file font.css , tried applying each gui element through scene builder's javafx css fields, it's not working. have made mistake in css? or there better way go this? i'd prefer not have load font , set every element in java code if don't have to. make sure use font.loadfont load font on application startup. should able use font css. careful use font's name, not font file's name. that's common mistake. i have used following before load , use custom font: font.loadfont(getclass().getresourceasstream("/resources/fonts/marck.ttf"), 14); and: -fx-font-family: "marck script"; fyi: quotes neede...

ruby - Rails Bundle Install Not Finding Gem -

i'm having problem rails bundle install command not being able find local gemfile. the gem located here:: ~/.gem/ruby/2.1.5/gems/mygemname-1.5.0.snapshot i included gem in gemfile. when try bundle application, error:: could not find gem 'mygemname-1.5.0.snapshot' (>= 0) ruby' in gems available on machine. i can see gem sitting on hardrive, bundle install command says doesn't exist. have ideas on may going on here? thanks time. as can´t comment yet... i check: - .gem folder holding gem or symlinked (i not confident symlinks work on bundle install) - rbenv or rvm in game , installed gem installed 1 of or globally?

ios - adding credit card scanning with camera -

ios8 has built in features in safari , apple pay scan credit cards video cam, user not have manually punch in number. knows there api call or out of box controller available swift allow add feature ios application? this you're looking for: what need card.io: download latest version of sdk. simply open sampleapp folder or sampleapp-swift folder , follow instructions in readme.md file find there. implement simple viewcontroller card io reader: - (ibaction)scancard:(id)sender { cardiopaymentviewcontroller *scanviewcontroller = [[cardiopaymentviewcontroller alloc] initwithpaymentdelegate:self]; [self presentviewcontroller:scanviewcontroller animated:yes completion:nil]; } and delegate methods retrieve card information: - (void)userdidcancelpaymentviewcontroller:(cardiopaymentviewcontroller *)scanviewcontroller { nslog(@"user canceled payment info"); // handle user cancellation here... [scanviewcontroller dismissviewcontrolleranimated:yes...

javascript - How to refresh or redirect users after they allowed to get chrome browser notifications? -

is possible in chrome using javascript or php refresh page or redirect users specific page, after user pushed [allow] button in notification pop-up (example of notification request popup: http://prntscr.com/7ataxu )? https://developer.mozilla.org/en-us/docs/web/api/notification notification.requestpermission(function (permission) { // if user accepts, let's create notification if (permission === "granted") { //redirect using javascript here window.location } });

ios - Fullscreen background-image with jQuery and Animation -

i using background-size: cover on ipad display fullscreen background-image. on .click(function(){ $(this).addclass('example') }); div changes size. first got: position: absolute; height: 100%; width: 100%; and afterwards got like height: 50%; width: 50%; then, on click sizes changes to height: 100%; width: 100%; but background not scale anymore. how can fix this? you can see video error ipad right here. works fine on desktops. live version (div containing background-image named .start-img for wants dig deeper: on click class .second added div.start-img transforms image. @ first its .start-img { background-size: cover; background-repeat: no-repeat; background-position: bottom left; z-index: 1; transition: 0.5s ease-in-out; height: 100%; width: 100%; position: absolute; } the class added or removed clicking has following attributes: .start-img.second { width: 100%; height: 40%; } i guess problem is, background-image s...

php - Laravel IoC outside Laravel -

i using repo basis new cli php project using eloquent orm. when create new eloquent capsule have option setasglobal makes db capsule accessible anywhere in code. does mean there's laravel container being used? or affecting db object? i'd been using pimple container, if laravel has container can bind via eloquent, lot simpler-- want bind log writer, eloquent capsule, , settings object global container can access anywhere. no not use laravels container. if @ method in trait: ( github.com ) public function setasglobal() { static::$instance = $this; } you can see sets static property on class containing current instance reused subsequent calls.

javascript - JSON.parse() breaks object function -

i have objects 'stringify'd json.stringify(), saved localstorage.setitem(), retrieved localstorage.getitem(), parsed json.parse(), , returned array of objects used within program. code: var exampleobjects = []; function objectexample() { this.examplefunction = function() { return this.otherobjectcreatedelsewhere.value; } this.otherobjectcreatedelsewhere; } function main() { exampleobjects[ 0 ] = new objectexample(); exampleobjects[ 0 ].otherobjectcreatedelsewhere = otherobjectcreatedelsewhere; exampleobjects[ 0 ].examplefunction(); //works var save0 = json.stringify( exampleobjects[ 0 ] ); localstorage.setitem( 'key', save0 ); save0 = localstorage.getitem( 'key' ); exampleobjects[ 0 ] = json.parse( save0 ); exampleobjects[ 0 ].examplefunction(); //no longer works, instead throws error exampleobjects[ 0 ].examplefunction not function } main(); now i've looked json.parse reviver methods, cannot...

Having problems getting my JSON from iOS to post to my php file & insert into mySQL -

i have looked on numerous threads , unable me code work, have php file have used receive json android device , insert values mysql <?php include_once './db_functions.php'; //create object db_functions clas $db = new db_functions(); //get json posted android application $json = $_post["usersjson"]; //remove slashes if (get_magic_quotes_gpc()){ $json = stripslashes($json); } //decode json array $data = json_decode($json); //util arrays create response json $a=array(); $b=array(); //loop through array , insert data read json mysql db for($i=0; $i<count($data) ; $i++) { //store user mysql db $res = $db->storechecklist($data[$i]->customername, $data[$i]->address, $data[$i]->date,$data[$i]->device,$data[$i]->operator,$data[$i]->installer,$data[$i]->complete,$data[$i]->check1,$data[$i]->check2,$data[$i]->check3,$data[$i]->check4,$data[$i]->column_check5,$data[$i]->check6,$data[$i]->check7,$data[$i]->check8,$data...

MarkLogic Path Range Indexes as App Builder facets -

i setting path range indexes in marklogic document database. goal have them available facets in app builder generated application. these indexes created successfully, can query them using cts:path-range-query function. however don't see how add them facets using app builder. strange because other range indexes such element range work fine, seems path range indexes don't show source index . is known limitation or forgot specific path range indexes ? should configured through "custom xml options"? the ui doesn't know path range indexes. may able define constraint in custom xml options, still won't show on first panel. you'll need edit code add 1 yourself. did blog post on capturing code & config working roxy deployer . once have code, take through extending applications built application builder chapter of app builder developer's guide .

ios - Audio Queue is playing too fast when the buffer size is small -

i able stream , play m4a files using audio file services + audio queue services. bitrate information of file not available audio queue because of file type. after downloading of audio packets feed them player. when choose buffer size around 32768 or 16384 since callbacks called less , and each buffer size big, seems playing @ regular speed. problem have play small files when choose small buffer size -512 or 1024 or 2048 8192- audio plays fast , occasional glitches. i know calling objective-c function in c callback not great idea readability , easiness that. regardless think not problem. // allocate buffers , prime queue data before starting audioqueuebufferref buffers[xmnumberplaybackbuffers]; int i; (i = 0; < xmnumberplaybackbuffers; ++i) { err=audioqueueallocatebuffer(queue, xmaqdefaultbufsize, &buffers[i]); if (err) { [self failwitherrorcode:err customerror:ap_audio_queue_buffer_allocation_failed]; } @synchronized(self) { stat...

python - Howto use scrapy to crawl a website which hides the url as href="javascript:;" in the next button -

Image
i learning python , scrapy lately. googled , searched around few days, don't seem find instruction on how crawl multiple pages on website hidden urls - <a href="javascript:;" . each page contains 20 listings, each time click on ">>" button, load next 20 items. can't figure out how find actual urls, below source code reference. pointers , appreciated. visiting site web-browser , activated web-developer-tools (the following screenshots made firefox , add-on firebug) should able analyze network requests , responses. show sites pagination buttons send requests following: so url seems be: http://rent.591.com.hk/?m=home&c=search&a=rslist&type=1&shtype=list&p=2&searchtype=1 but it's not normal request. it's xmlhttprequest . indicated unter header tab. , response in json: so don't need grab data complicated nested html-structures, can directly json dict. i ended scrapy code (with room impro...

angularjs - Does ngClick attach a click handler to every item if put in an ngRepeat -

i displaying 500+ rows of data in table , using ngclick on every row display more info each row: <tr ng-repeat="row in displaydata.rows track $index"> <td><span ng-click="orderdetails(row.ordernumber)" class="glyphicon glyphicon-plus"></span></td><td>{{row.ordernumber}}</td><td>{{row.shiptocompany}}</td><td>{{row.ordertime}}</td><td>{{row.clientid}}</td><td>{{row.shiptoattention}}</td><td>{{row.shipmethod}}</td><td>{{row.whenlastshipped}}</td> </tr> with vanilla js put click handler on whole table , use event figure out row clicked. there way same thing angular, or angular doing already? don't want attaching 500+ click handlers on page if doing and/or there better way same result. you can use single ng-click on whole table rather each row http://jsfiddle.net/x2jjdo88/1/ html: <body ng...

jquery - Progress bar query -

i created progress bar i'm facing new problems: i want once span clicked turn circle green tick 1 - green: i suppose jquery - once click span (circles) - progress bar turns white grey - need white: if posible byt clicking asd tag make progress process fiddles http://jsfiddle.net/awayf/490/ http://jsfiddle.net/balkics/wxelhzs7/ javascript $(document).ready(function() { var value=$('#progress-bar').val('0'); $('span').click(function() { if ($(this).hasclass('first')) { $('#progress-bar').val('0'); $(this).nextall().removeclass('border-change'); $('.percent').html("0% complete"); } else if ($(this).hasclass('second')) { $(this).nextall().removeclass('border-change'); $('#progress-bar').val('34'); $(this).find('div').addclass(...

Pages not in directory showing up on google analytic -

i've been using google analytics website awhile , haven't had problems. today though checked pages tab under behavior->site content , found strange. bunch of pages aren't on in websites directory appearing there , saying have traffic (albeit little). here's link image of pages: http://imgur.com/kexaqzd i've verified non of these pages exist on live server or in directory on local machine. know might causing this? or how can rid of these pages on website? i've searched around on google have had no luck figuring out whats going on. thanks in advance! timothy looks seeing referral/referrer spam. here couple of favorite links on subject: definitive guide removing referral spam what referrer spam , how stop it 4 things must know spam in google analytics

haskell - Best practices for talking to an API -

i'm trying create bindings api in haskell. noticed functions have tremendous number of arguments, e.g. myapifunction :: key -> account -> int -> string -> int -> int -> io (mytype) it's not bad, per se, have many arguments. user don't long argument functions. however, each of these args absolutely 100% necessary. is there more haskell-ish way abstract on common parts of these functions? past account here used build url, need available, , stands depends entirely on function. things consistent though, key , account , , i'm wondering best abstract on these arguments is. thank you! you can combine these more descriptive data types: data config = config { ckey :: key , caccount :: account } then maybe have type s or newtypes make other arguments more descriptive: -- have no idea these should be, i'm making type count = int type name = string type position = (int, int) myapifunction :: config -> count -> n...

linux - Error While running Rscript (R version 3.2 and Rstudio version 0.99.441 ) through Scilab5.4.1 using unix_w() -

in scilab using unix_w() run rscript , r code executing fine while on terminal gives error while using unix_w() inside scilab. (note: code runs in scilab in laptop has 64 bit ubuntu 14.04 gives me error in desktop has 32 bit ubuntu 14.04) i have tried debugging code writing file before , after r command seems culprit. library("cluster", lib.loc="/usr/lib/r/library") or library("cluster") the error seeing : !--error 10000 unix_w: command failed error code "1" , following message: error in dyn.load(file, dllpath = dllpath, ...) : unable load shared object '/usr/lib/r/library/stats/libs/stats.so': /home/binilab/scilab-5.4.1/lib/thirdparty/libgcc_s.so.1: version `gcc_4.4.0' not found (required /usr/lib/i386-linux-gnu/libgfortran.so.3) during startup - warning message: package ‘stats’ in options("defaultpackages") not found loading required package: stats error in dyn.load(file, dllpath = dllpath, ......

mysql - How to convert this SQL query to an Elasticsearch query? -

i'm new elasticsearch querying, i'm little lost on how convert sql query elasticsearch query: select time_interval, type, sum(count) test (&start_date <= t_date <= &end_date) group time_interval, type i know can use " range " query set parameters gte , lte , if there's clearer way this, better. in advance! edit: my elasticsearch setup have index: "test" type: "summary" , contains json documents have few fields: t_datetime t_date count type *t_id** the ids these json documents t_date concatenated t_id values assuming, t_datetime same time_interval , can use query below: post trans/summary/_search?search_type=count { "aggs": { "filtered_results": { "filter": { "range": { "t_date": { "gte": "2015-05-01", "lte": "2015-05-30...

c# - Https upload MultipartForm returns 401 unauthorized -

i’m trying upload coverity scan result coverity. this code: public static void main( string[] args ) { var client = new httpclient { timeout = timespan.fromminutes( 20 ) }; var form = new multipartformdatacontent { { new stringcontent( "my tooken" ), "token" }, { new stringcontent( "my email" ), "email" }, { new stringcontent( "1.1.1.1" ), "version" }, { new stringcontent( "test..." ), "description" } }; var fs = new filestream( @"cov-int.zip", filemode.open, fileaccess.read ); form.add(new streamcontent(fs), "file", "cov-int.zip"); var task = client.postasync("https://scan.coverity.com/builds?project=name/porject", form); try { task.wait(); } catch ( aggregateexception ex ) { throw ex.innerexception; } var result = task.result; fs.cl...

amazon web services - Viewing console.log's of lambda function -

does know how console.log's when running aws lambda function? its fine when run function in test environment, want see logs when run in production environment. you can see output console in cloudwatch logs. take @ accessing amazon cloudwatch logs aws lambda .

jquery - Multiple canvas, reusable gradients -

i trying write dry code multiple canvas. applying gradients chartjs charts , don't want rewrite same gradient each chart instance. var ctx1 = $("#softwarechart").get(0).getcontext("2d"); var ctx2 = $("#webchart").get(0).getcontext("2d"); var gradient1 = ctx1.createlineargradient(0, 0, 0, 400); gradient1.addcolorstop(0, '#ff9170'); gradient1.addcolorstop(1, '#ff3f05'); var gradient2 = ctx1.createlineargradient(0, 0, 0, 400); gradient3.addcolorstop(0, '#f5d147'); gradient3.addcolorstop(1, '#dfb30c'); var gradient1 = ctx2.createlineargradient(0, 0, 0, 400); gradient1.addcolorstop(0, '#ff9170'); gradient1.addcolorstop(1, '#ff3f05'); var gradient2 = ctx2.createlineargradient(0, 0, 0, 400); gradient3.addcolorstop(0, '#f5d147'); gradient3.addcolorstop(1, '#dfb30c'); as can see, not dry, , hate it. there way .getcontext on canvas want use , apply gradients of them...

java - How to enable Weblogic 12.1.2 JPA 2.1 -

i have been deploying our web application weblogic server. however, although able deploy application in new version, app not start , users cannot login. log is: may 29, 2015 4:38:47 pm org.springframework.web.context.contextloader initwebapplicationcontext severe: context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in class path resource [applicationcontext.xml]: invocation of init method failed; nested exception java.lang.nosuchmethoderror: javax.persistence.joincolumn.foreignkey()ljavax/persistence/foreignkey; @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1566) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:539) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbea...