Posts

Showing posts from July, 2015

php - Check if an id exists in a table before adding it to another table -

i'm doing small thing like feature see on facebook. way i'm doing this. have table called products contains products people can like . (stripped down): id | prodname | status (0=clear, 1=blocked) ---------------------------------------------------------- 1 | philips food processor | 0 2 | le sharp knife | 0 3 | ye cool fridge | 0 comes `likes` table this: id | prodname | prodid | userid -------------------------------------------- 1 | philips food processor | 1 | 1 2 | le sharp knife | 2 | 1 3 | ye cool fridge | 3 | 1 4 | ye cool fridge | 3 | 2 i need check, before adding likes table, if product id actually exists in products table , status = 0. lot of php code. way using sql? possible? using foreign keys or that? i'm using innodb table type. you can conditional insert . product 6 , user 7: insert likes (prodname, prodid, userid) select prodname

Zend Db Statement - reset loop -

i'm using zend framework 1.12.2 , build query: $sitessql = 'select * app_sites'; $stmtsites = $db->query($sitessql); and want loop throw rows twice. while ($row = $stmtsites->fetch()) { [...] } dozens of lines below while ($row = $stmtsites->fetch()) { [...] } but unfortunately second loop doesnt loop beginning. above second while must reset statement - how? mysqli_data_seek() can not use fetchall() (which returns array) instead? $sites = $db->fetchall($sitessql); then can loop through results foreach twice: foreach ($sites ...) { }

ember.js - Long polling with EmberJS / Ember-Data? -

i have setup basic first application can add , remove names list, added/removed database using restful api, using ember-data default rest adapter. i'd implement form of polling/long-polling interface remains up-to-date. so example, lets open 'list' in 2 tabs, delete few names in 1 tab - i'd changes (eventually) show in other tab. how can done ember? what want job websockets, allow push changes models server ember app whenever happen. type of approach can take care of keeping thing in sync between tabs. recommend checking out socket.io , has great client-side js library , many server side libraries. default try use websockets, better long-polling, degrade long-polling if needs to. might force change bunch of application set-up, consider "right" way go.

Java, rounding a double to two decimal places -

i'm trying round double nearest 2 decimal places however, rounding nearest full number. for example, 19634.0 instead of 19634.95. this current code use rounding double area = math.round(math.pi*radius()*radius()*100)/100; i can't see going wrong. many help. well, math.round(math.pi*radius()*radius()*100) long . 100 int . so math.round(math.pi*radius()*radius()*100) / 100 become long ( 19634 ). change math.round(math.pi*radius()*radius()*100) / 100.0 . 100.0 double , , result double ( 19634.95 ).

Could not find method android.view.View.getParentForAccessibility -

getting following error onclick of minus remove button: could not find method android.view.view.getparentforaccessibility, referenced method com.wassap.main.userfragment$12.onclick relevant code: /////////////////////// minus remove button click imgremove.setonclicklistener(new onclicklistener() { @suppresslint("newapi") public void onclick(view vv) { view parent = (view) vv.getparentforaccessibility(); } }); getparentforaccessibility available since android 16 . need device @ least api level run it

Eclipse Juno Menu Item missing -

i have weird problem: cant find configure item in popupmenu, if press in eclipse right mouse button on project. tuts that, make eclipse project mvn project, have (right mouse button on existing project , configure) edit: have installed m2e plugin marketplace.. unfortunately, there no -> convert maven project menu item.. don't know do.. thanks in advance downgraded eclipse indigo. fine now. menu item should be.

php - How to Get Array From URL Encoded String? -

i'm sure easy thing couldn't find in google hours. i'm new actionscript , i'm trying obtain array of variables string generated .php file. my php file outputs this: var1=42&var2=6&var3=string and actionscript code is: public function callajax_variables(url:string , the_array:array) { var request:urlrequest = new urlrequest(url); var variables:urlloader = new urlloader(); variables.dataformat = urlloaderdataformat.variables; variables.addeventlistener(event.complete, variables_complete_handler(the_array)); try { variables.load(request); } catch (error:error) { trace("unable load url: " + error); } } function variables_complete_handler(the_array:array):function { return function(event:event):void { var loader:urlloader = urlloader(event.target); //the_array = loader.data; // doesn't work. //the_array = urlvariables.decode(loader); // doesn't work either. //trace(loader.data['var1']

perl - How to retrieve the folder name of a given dir? -

i have dir path c:/server/the/bps_data/the_1 in script , need retrieve folder name 2 dirs above this. in example need retrieve value the i tried fileparse of my($datapath) = "c:/server/the/bps_data/the_1"; print " datapath is: $datapath\n"; my($filename, $bpspath, $suffix) = fileparse($datapath); here returns c:/server/the/bps_data/ any advice? use path::class qw( dir ); dir('c:/server/the/bps_data/the_1')->parent->parent; oh wait, see want "the"? use path::class qw( dir ); dir('c:/server/the/bps_data/the_1')->parent->parent->basename; or use path::class qw( dir ); say( (dir('c:/server/the/bps_data/the_1')->dir_list)[-3] );

Optional part in rails routing path -

i trying create route page can have param1 , param2 . param2 optional part , code take default value if value not present. following trying do match '/school/:dept/:staff/show' => staff#show match '/school/:staff/show' => staff#show i have bunch of statements above seems of repetition. there better way this. this link has approach using third party option. considering older post, looking see if supported rails. as per: http://asciicasts.com/episodes/203-routing-in-rails-3 we can defining route this, directing matching route our info#about action. note can nest parentheses when creating optional parameters. match "/:year(/:month(/:day))" => "info#about"

openstreetmap - How to get point of interest near my point using overpass-api? -

everyone! using overpass api. i have issue find points of interest (cafes, hospitals, schools) near (around in 100-200 miles) point. have latitude , longitude. overpass api gives opportunity pois using place name. don't have it. have coordinates. how can ? thanks use around statement! <query type="node"> <around lat="..." lon="..." radius="..."/> <has-kv k="amenity" v="cafe" /> </query> <print /> try example on overpass turbo !

Returning values from php file to ajax -

i have written ajax engine connect php file. in php file accesing data database. want return array fetched database ajax engine.. how return values.. what can join array in php let's say $return_string=join('||||', $array); then in javascript split response get var response_array=response.split('||||');

indexing - Rebuilding the Screwturn wiki search index -

my wiki started returning incomplete search results. a user search term know part of article , article isn't returned in results. they can browse article , see page contain search term. this has happened frequently, i've been trying find solution. haven't been able find having problem. search index thinks there 300 pages in wiki, though there 1193. i followed directions on screwturn site rebuilding index, including adjusting timeout in web.config. ended several attempted rebuilds , around 70 errors between attempts. saw timeout errors , primary key violations. rebuild wouldn't stay running long, less 10 minutes. has had success rebuilding index? has seen same sort of errors , been able resolve them? does know can expect see when rebuild complete? thinking see new search index referenced 1193 pages, instead of 300. correct? any appreciated. below 3 examples of error messages seeing. system.data.sqlclient.sqlexception: violation of unique key cons

pushstate - jQuery Address appends new deep link to existing deep link -

it's think same issue as here no solution there given. if directly enter jquery address loaded website through deep link http://www.domain.com/deeplink1 and want go next page pressing link, next deep link appended initial deep link http://www.domain.com/deeplink1/deeplink2 . how prevend this? solution simple. this post brought me idea (which bit ironic since it's post jquery address competitor hehehe). had @ initialization following set up $.address.state($.address.baseurl()).init(function(event) this caused entry url root domain. changed $.address.state('/').init(function(event) which causes root (hostname) entry domain. solved problem.

google analytics: what is the difference between referrer path vs previous page path? -

i find out difference in google analytics between "referral path" , "previous page path"? the task number of visits came page section of web site. section contains many pages want regard sole referrer. i made following experiment: 1) setup advanced segment 2 conditions page title contains "x page title" , referral path contains "y-product". 2) compared figures (1) sum of numbers under "previous page path" in "navigation summary". in short, there nothing in common between both numbers. so, "referrer" , "previous page" in google analytics? thanks the "referrer" external referring url of first page visitor lands on in visit. example, if visitor performs google search , site comes , click on link , go site, referrer google.com (assuming site not google.com!). if visitor clicks on random link on site , goes page on site, referrer still google.com. the "previous page&qu

sublimetext2 - Open/Close braces / brackets : highlight the lines that connect them in Sublime -

Image
i miss nice feature of notepad++ connecting opening , closing line of function/bracket highlighted line. sublime connects them too, dotted line doesn't change color... take @ brackethighlighter . little configuration, think give want. configuring highlighting style section. steps after installing brackethighlighter... preferences -> browse packages... create file called bh_core.sublime-settings in user folder. add following code: { "content_highlight_bar": true, "align_content_highlight_bar": true, } here section looking for!

php - strtotime returns 1970 when I remove a month? -

according php documentation , i'm using strtotime correctly, apparently i've managed wrong. the following code: echo date("y,n,j", strtotime($event["startdate"])); outputs: 2013,4,18 (which correct) whereas following code (using exact same data): echo date("y,n,j", strtotime('-1 month', $event["startdate"])); outputs: 1969,12,1 (instead of 2013,3,18 ) why? echo date("y,n,j", strtotime('-1 month', strtotime($event["startdate"])));

internet explorer - Ruby, Watir Classic and IE: Browser stops unless it has focus -

after upgrading our test quite watir 2 wait-classic 3.6 we've discovered unless ie on interactive desktop , has focus our test scripts stop until timeout or gives ie focus. since run 5k tests nightly on our grid, bit of problem. we're running ie8 on windows 7 , have been running suite without issue more year. hopefully else has seen behavior , can provide insight. in past when testing ie watir there actions in browser had resort using 'sendkeys' lot (due rather obstinant custom javascript based controls) noticed ie seems startup focus on url line of browser, , unless shifted, actions failed so 1 of first things our tests did use sendkeys send 'tab' browser object, , seemed serve focus within browser session onto 'window' area of browser , not url field. you might try , see if makes difference you.

asp.net - How can you assign the value Nothing to a control attribute declaratively in a VB.Net ASPX file? -

if have control has read/write property of type nullable(of integer) (or integer? , if prefer shorthand), how can assign nothing value attribute in aspx/ascx definition (as opposed setting in codebehind)? e.g. system.web.ui.webcontrols.textbox control has read/write property called maxlength of type integer . can set in aspx including property name attribute in declaration, this: <asp:textbox id=”mytextbox” runat=”server” maxlength=”30” /> indeed, can set integer? property in same way long i’m assigning integer, want set property nothing . any ideas? try using data binding expression: <my:mycontrol runat="server" id="mine" nullableproperty="<%# nothing %>" />

Python find method in class -

i have defined class called point defines point in x, y coordinate system. definition , methods shown below. created own version of str method return created point in printable form (required). however, when try pass returned point method determine distance between 2 points (p1 , p2), using call p.distanceto(p2), following error attempt parse string (p2) passed method: attributeerror: point instance has no attribute 'find' when pass in string defined p2 should works fine. appreciated. thank you. here code: class point: """ define point """ def __init__(self, x=0, y=0): self.x = x self.y = y def __str__(self): return "(" + str(self.x) + "," + str(self.y) + ")" def __getitem__(self,i): return def __find__(self,j): return j def distanceto(self,p2): idx1 = p2.find("(") idx2 = p2.find(",") idx

javascript - Query performance in minimongo -

i built responsive forum demo rendered topic list on mobile device. unresponsive when collection updated. think reason query. my test html: <template name="index"> <h1 id="mytime"></h1> {{#each foo}} <h1>{{name}}</h1> {{/each}} <input id="t" type="text"></input> <button id="s">submit</button> </template> and js: template.index.foo = function () { return foo.find({}).fetch(); }; template.index.events({ "click #s": function () { foo.insert({name: $("#t").val()}); } }); meteor.startup(function () { meteor.setinterval(function () { $("#mytime").text((new date()).gettime()); }, 1); }); when number of documents small, code works fast. when number of documents larger 300 , rendering stop 3s is possible improve it? :) are doing dom insertions @ every iteration of loop? it's easier create document

scripting - Best/Easiest/Quickest way to get relative path between two files? -

i'm in midst of refactoring c# code , part of redo references, because we're redoing folder structure entirely. i'd go .csproj or .sln file , modify paths. however of references have paths like "../../../../../../thirdparty/somemicrosoftlibrary/bin/debug/somemicrosoftlibrary.dll and since we've moved around need find new relative path. absolutely hate trying (figure out how many slashes , periods need put in) since feels hit or miss science. is there easy way (utility, script, snippet of code) "here's file a, here's file b, relative path of file b in relation file a?" generate relative path it's in java, translatable c#.

c++ - Random characters in stringstream -

i'm writing program searches files. block of code writes folder name stringstream, preceding "./" can used change directory. changes directory , informs user of change. stringstream maindir; maindir << "./" << crntmainfile; maindir.str().copy(maindirectory, 260, 0); _chdir(maindirectory); std::cout << maindirectory; std::cout << "main directory changed: " << maindirectory << "\n"; my problem maindirectory has bunch of characters @ end. i'm assuming has fact it's 260 length array maybe 20 characters in , characters whatever happens occupying unwritten memory. if problem, how fix it? edit: i've determined crntmainfile null terminated, terminator lost when it's written maindir . what's causing this? << not write null characters stringstreams? how fix it? edit: solved problem doing maindir.put(0); after maindir << "./" << crntmainfile; manually nu

best way to select random, corresponding data in javascript? -

i trying have like: category = ("word1","word2","word3") ("definition1","definition2","definition3"); category1 = ("word1","word2","word3") ("definition1","definition2","definition3"); the basic goal select , output (lets 3) random words random category , able call on relevant data develop more (the category name , definition of word chosen randomly). i don't want duplicates, , appreciate suggestions! :) lot! you want structure array of objects: category1 = [ { word: "word1", definition: "def1" }, { word: "word2", definition: "def2" }, { word: "word3", definition: "def3" } ]; then, select value category1 , pick category1[i] @ random , use category1[i].word , category1[i].definition . you can extend each object have additional properties later needed (

toad - PLSQL Viewing output of sys_refcursor -

i'm using toad oracle 11 , pretty new sql. have written proc , trying test , view output. have written following block: declare cur_test sys_refcursor; type t_row record(psh_code varchar2(20) , pattr_end_date varchar2(20), pperf_gross varchar2(20)); r_test t_row; begin procperftr(xxx-xxxx', 'xxxxxxx', 'xxxxxxx', 'xxxxxx', :cur_test); loop fetch cur_test r_test; exit when cur_test%notfound; end loop; close cur_test; end; / however, following error on loop line ora-01001: invalid cursor the error on line 10 line has "loop" on it my proc looks this create or replace procedure procperftr ( paramportfcode varchar2, paramenddate varchar2, paramshare varchar2, paramfreq varchar2, o_cursorperf out sys_refcursor ) i_cursorperf sys_refcursor; begin open i_cursorperf select ps.psh_code, pp.pattr_end_date, pp.pperf_gross portfolio_perfo

Store an array using MongoDB and Java -

i saving basicdbobject in mongodb collection basicdbobject[] abox = new basicdbobject[5]; basicdbobject obj = new basicdbobject(); obj.append("box", abox); for moment void array have [] in collection but when trying array dbobject[] abox = (dbobject[]) obj.get("box"); i have error java.lang.classcastexception: com.mongodb.basicdblist cannot cast [lcom.mongodb.dbobject; do know how have array? basicbdlist list , therefore has toarray method. or keep list. should work: list<basicdbobject> list = (list<basicdbobject>) obj.get("box"); basicdbobject[] abox = list.toarray(new basicdbobject[list.size()]);

jquery - How to create a mouse over or hover, which will trigger a pop up a div with three links? -

how create mouse on or hover, trigger pop div 3 links? see image : http://postimg.org/image/d8lhmhoh7/ a link there "login", when user mouseover rectangular pop box appear 3 links or image link. when user mouse out pop disappear. you can achieve in css well. following: create nested divs, hide div inside (display:none), 1 should contain 3 links. use :hover pseudo selector in css , make hidden div visible setting display block (display:block) when user mouseovers parent div. this high level, looks similar creating dropdown menus may can read how that.

c - Situations when `pthread_join` can fail / not invoked and cause zombie threads -

from: http://man7.org/linux/man-pages/man3/pthread_join.3.html failure join thread joinable (i.e., 1 not detached), produces "zombie thread". avoid doing this, ... how can avoid doing this? don't it, because when try join thread, why deliberately want fail? i suppose man page means if application not join joinable thread after terminates, forgets it, terminated thread becomes zombie thread, , zombies bad. that is, failure here means deliberately not performing .

php - Recover base64 image from a web service in Android -

i'm developing app in android connects web service in php. users can send pictures, or better said, able send pictures cause i'm stuck on it, other users. right image sent web service via soap type xsd:base64binary. user take picture , byte array data converted base64 before sending in way: string img; .... @override public void onpicturetaken(byte[] data, camera camera) { img = base64.encodetostring(data, base64.no_wrap); } in server side, php stores img string in mysql blob column. when user ask picture, server retrieves data mysql in stdclass, not image, id, owner, etc... , encapsulate data json string php function json_encode. return type in wsdl file xsd:string. in android is: jsonarray array = new jsonarray(response); jsonobject row; string imgstr; byte[] img; (int = 0; < array.length(); i++) { row = array.getjsonobject(i); ... imgstr = row.getstring("image"); ... } if (!textutils.isempty(imgstr)) { img = base

mouseevent - OpenGl selection -

i'm creating box , placing "magnets" on bottom. sides see through(alpha somewhere between .2 , .5) , bottom solid. i'm trying use gluunproject() select "magnet" placed, when sides of box rendered, can't magnets box. is there anyway still have sides of wall rendered ignore them sake of mouse clicks? i've tried gl_cull_face @ first glance doesn't seem i'm looking for. so if understand correctly, have semi-transparent boxes , when magnet inside boxes want see magnet in according semi-transparency of boxes. my guess when you're drawing boxes have depth writes turned on, way if boxes happen drawn before magnet, when draw magnet fail depth test , part that's inside won't drawn result. the easiest way is: draw solid objects first disable depth writes: gldepthmask(gl_false); use order-independent blending function when drawing semi-transparent objects, example: glblendfunc(gl_one, gl_one) draw transparent ob

java - read_message in Bluetooth Chat sample -

i'm coding android app, , it's connected cc2540 usb dongle bluetooth. procedure that, when dongle sends string "o\r\n" phone, app must view string on edittext "ef". have changed message_read part in bluetooth chat sample android sdk: private final handler mhandler = new handler() { @override public void handlemessage(message msg) { switch (msg.what) { case message_read: byte[] readbuf = (byte[]) msg.obj; if (readbuf.equals("o\r\n")) { // construct string valid bytes in buffer string readmessage = new string(readbuf, 0, msg.arg1); mconversationarrayadapter.add(mconnecteddevicename+": " + readmessage); } } } }; is code okay requirements ? how implements edittext here in case ? thanks in advance

javascript - Trouble changing Content-Type for POST requests with ngResource (1.0.6 and 1.1.4) -

first, know question has been asked several times. have tried many posted solutions , nothing working me.. here few other places asked: how specify headers parameter custom angular $resource action how can post data form data instead of request payload? setting application wide http headers in angularjs https://groups.google.com/forum/#!msg/angular/mtsf-ydwwwo/p_ui4t_dixkj the attempts: var app = angular.module('theapp', ['app.services']); app .config(['$httpprovider', function ($httpprovider) { // try (1): doesn't work $httpprovider.defaults.headers.common['content-type'] = 'application/json;charset=utf-8'; // try (2): doesn't work either $httpprovider.defaults.headers.post['content-type'] = 'application/json;charset=utf-8'; }]) angular.module('app.services', ['ngresource']) // resource drupal system/connect.post api (via services.module) .factory('systemcon

how to create dynamic links between two cells of 2 html tables in html email using java -

one of our customers has got requirement create html based email html table each automation script part of test automation framework. the second requirement have 1 more html table constructed quick view purpose. table cells in first column should contain hyperlink table header of each html table generated per each automated script, meaning the cell-1 in column-1 of table-2 should point table header of table-1 of automated script-1 . i stuck how create links dynamically between cell , corresponding table header. so wanted seek suggestions , advice gurus , seniors , indeed immense help. check out link html # anchors , explain how can use id attribute , # href create links elements within same or different html pages. lookout section html links - id attribute

javascript - Switch active tab with Bootstrap's Navbar -

i'm using bootstrap's navbar website. i've separated navbar own html page. when page loaded, load navbar.html page jquery. when user clicks on say, page2, "home" link still shown active when should "page2". is there simple way switch class page2 link "active" using javascript, jquery or bootstrap magic? navbar.html <ul class="nav"> <li class="active"><a href="#l">home</a></li> <li><a href="#">page2</a></li> <li><a href="#">page3</a></li> </ul> jquery on page2 <script> jquery(function(){ $('#nav').load('nav.html'); }); jquery(function(){ $('.nav a:contains("page2")').addclass('active'); }); </script> using jquery: $('.nav a:contains("page2")').addclass('active'); or, a

The difference between bash and python pipes -

i have following 3 python scripts: parent1.py import subprocess, os, sys relpath = os.path.dirname(sys.argv[0]) path = os.path.abspath(relpath) child = subprocess.popen([os.path.join(path, 'child.lisp')], stdout = subprocess.pipe) sys.stdin = child.stdout inp = sys.stdin.read() print(inp.decode()) parent2.py: import sys inp = sys.stdin print(inp) child.py: print("this text created in child.py") if call parent1.py with: python3 parent1.py it gives me expected following output: this text created child.py if call parent2.py with: python3 child.py | python3 parent2.py i same output. in first example output of child.py bytes , in second directly string. why this? difference between python , bash pipes or there otherwise avoid this? when python opens stdin , stdout , detects encoding use , uses text i/o give unicode strings. but subprocess not (and can not) detect encoding of subprocess start, it'll return bytes. can use io.t

RPG/DB2 Cursor as a resultset being cleared -

i have rpg program/stored procedure returns resultset .net program. working fine until rpg added code after ... return client cursor c1... // new line of code ... delete <file>... why resultset empty when deleted file? shouldnt resultset in cursor c1? what trying call rpg stored procedure , have procedure return me resultset file delete records int file. thought setting resulset retain data after delete actuall data in db. looks if delete records resultset cleared you put chosen records in temp table, delete them original file, return result set of temp table.

c# - Mitigating suspension and/or termination while encoding video in an app -

i have windows store app option export data in video file format. app in c#, encoding handled dropping c++ library adapted this sample david catuhe , working well. problem have found encoding process can take long time when run @ high quality, , if screen times out (say, on surface rt) or user switches apps, process fails. i'm not entirely sure source of failure , working verify it, if process able survive suspension without changes, don't know how handle being tombstoned. i can live encoding being interrupted in situations. don't want have start on scratch if app goes away reason. as far can tell, isn't feasible close stream without finalizing video , resume writing later. in light of this, have considered few options, can't tell which, if any, might work. i'd grateful direction. 1) if possible, it'd great able close stream , reopen later, picking left off. @ moment haven't been able work, if should work i'd love know. 2) push encode p

actionscript 3 - Action Script 3. How to set background -

i'm creating flash game, here restart button , have function delete objects (children) stage. function restartgame(e:mouseevent):void { while (numchildren > 0) { removechildat(0); } addchild(_cards); //here need add background startmemorygame(); } at normal don't need add background, when game started added automatic. in library called background.jpg, converted graphic , named background added linkage "background" addchild(background); doesn't work me. me? thank you. i assuming set linkage on image, in case go : var background:bitmap = new bitmap(new background); addchild(background); if it's movieclip symbol linkage set, can : var background:background = new background; addchild(background);

flex lexer - Bison, simple calculator program -

i want make parser simple calculator cant uderstand whu error simple input. flex file looks this %{ #include "exp.tab.h" #include <string.h> %} blanks [ \t\n]+ %% {blanks} { /* ignore */ } [0-9]+ {yylval= strtol(yytext, null, 10); return(numb);} %% bison file looks this: %{ #include <stdio.h> %} %token numb %left '+' %% exp: numb { $$ = $1; } | exp '+' exp { $$ = $1 + $3; } %% int yyerror(char *s) { printf("yyerror : %s\n",s); } int main(void) { yyparse(); } for input 123 + 12 i error message.why happening? your lexer missing rule match/return '+' token. try adding @ end: . { return *yytext; } /* other single character returns */ the default lexer action if text doesn't match rule print , skip it. error parser because gets 123 12 input, causes syntax error.

c# - Unable to open/read XML file containing accented characters -

i have xml attribute containers accent characters: <testcase name="canadian addresses - test case" description="canadian addresses - test case" onoff="true" negativetest="false" rollbackdb="false" performance="false" performancesummary="false" timestoexecute="1"> <providerfacilitysearch_findproviderfacility providerinfo="dr marc-andré kärcher samuels senior|10 château du feÿ ave, north building, north sydney, ns b2a 3l7 canada" /> <providerfacilitysearch_viewproviderfacility providerinfo="dr marc-andré kärcher samuels senior|10 château du feÿ ave, north building, north sydney, ns b2a 3l7 canada" /> <viewprovider_locationname expectedlocationname="kärcher health care" /> <viewprovider_servicingaddress expectedservicingaddress="10 château du feÿ ave|central building|north sydney, ns b2a 3l7|canada" /> <viewprovider

node.js - Using everyauth with LinkedIn -

i'm trying use everyauth authenticate app using linkedin. authentication works out of box, object returned everyauth linkedin (req.user) includes linkedin's "basic profile" info only, , not user's primary email address key information i'm after. i've authorised app in linkedin request r_emailaddress, , think (looking @ linkedin api docs) need define scope of login request explicitly request email address. don't know how using everyauth. i'm keen continue using everyauth rather directly linkedin api since a) everyauth looks impressive , comprehensive , b) plan use additional authentication schemes in future. thanks everyauth uses linkedin's oauth api implementation, older current api implementation oauth2. oauth still supported you're reading documentation based on oauth2 , it's easier work with. i suggest using passport , using linkedin oauth2 strategy has worked me. luck!

c# - How to Increase item size in Http Post -

i posting data iis web server using c#. i have used xml , mode , getting 'bad request error' when posting long data in 1 field. example, <field1>ttttttttttttttttttttttttttttttttttttttttttttttttttttttt.......<field1> i have modified web.config <webhttpendpoint> <standardendpoint name="" helpenabled="true" automaticformatselectionenabled="true" maxreceivedmessagesize="21474836" maxbuffersize="21474836" maxbufferpoolsize="21474836" ></standardendpoint> </webhttpendpoint> what else need make work? <system.web> <authentication mode="forms" /> <compilation debug="true" targetframework="4.0"> <assemblies> <add assembly="system.web.datavisualization, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> </assemblies&

c++ - Fstream reading by char with while -

so have code this: fstream abc; abc.open(filename); while(abc.get(currchar)) { if(currchar==' ') ++spaces; } abc.close(); and want count spaces in given .txt file reading 1 char @ moment until eof. however, above code gives me 0s spaces. why? i tried code, , works. believe problem sftrabbit said, path of file incorrect. if text file in same folder main.cpp, path name of text file (e.g. textfile.txt). if it's somewhere else, example, in c drive, path should c:/textfile.txt.

css - javascript and css3 website banners? -

i know if this: http://tympanus.net/tutorials/proximityeffect/index2.html would able made website banner....? let me re-phrase. have ad space on website 200px x 600px. give them animated gifs cinemagraphs make in photoshop , needed included once upload 200px x 600px .gif file. , before .jpg or .png.... know can made banner i'm asking how can save in file can uploaded ad space.. have no access css or html files of theirs... goal of project subdivide space other advertisers because honest can't afford it.. need each 1 of boxes go external url... make sense?? thanks direction can give.... as mentioned iframe best bet. i'm not sure if you're hosting ad content or displaying ads post, either way option hosting artwork on shared cdn, make maintaining , editing content easier. obviously depends on nature of artwork , relationship advertisers.

javascript - Refresh and action button Html -

i add button enables action , refresh current webpage. don't understand why following code doesn't work. in fact action performed not refresh. <form class="form-search" action="@url.routeurl("xx")" method="post"> <button type="submit" class="btn" onclick="window.location.reload();"></button> </form> any advice? that doesn't make sense. action request page. refresh request same page. choose one.

math - Why is this Ruby code far faster than the equivalent C++ code? -

recently i've been going through easy project euler problems , solving them in ruby , c++. problem 14 concerning collatz conjecture, c++ code went on half hour before terminated it, though when translated code ruby, solved in 9 seconds. that difference quite unbelievable me - had been led believe c++ faster ruby, mathematical process. my code follows. c++: #include <iostream> using namespace std; int main () { int = 2; int b = 2; int c = 0; while (b < 1000000) { = b; int d = 2; while (a != 4) { if (a % 2 == 0) /= 2; else = 3*a + 1; d++; } if (d > c) { cout << b << ' ' << d << endl; c=d; } b++; } cout << c; return 0; } run time - don't know, it's really long time. and ruby: #!/usr/bin/ruby -w = 0 b = 2

cron - Cronjob every x hours between 23-16 not working -

partly using stackoverflow search figured out how run cronjob every 3 hours not between 23h-16h. means pause between 16h today untill 23h today. cronjob should start running every 3 hours @ 23h , stop @ 16h, start again @ 23h. this result: 0 23-16/3 * * * /usr/local/bin/flexget -c /media/usb/downloads/flexget/config.yml --cron now question: why not working? not run @ :( i tried: * 23-16/3 * * * /usr/local/bin/flexget -c /media/usb/downloads/flexget/config.yml --cron (not sure difference 0 or * minutes, rounded hours or not?) this work: 0 */3 * * * /usr/local/bin/flexget -c /media/usb/downloads/flexget/config.yml --cron but runs every 3 hours every day, without pause between 16-23. you can list hours explicitly. 0 2,5,8,11,14,23 * * * /usr/local/bin/flexget -c /media/usb/downloads/flexget/config.yml --cron note not same replacing 0 minutes * , like: * 2,5,8,11,14,23 * * * /usr/local/bin/flexget -c /media/usb/downloads/flexget/config.yml --cron th

membership provider - Mapping nJupiter to a internal LDAP server -

i trying use njupiter ldap membership provider internal tivoli based ldap server. i can log on userid, in our case combination of country code , serial #, log in e-mail address instead. (or both if possible). my users config is: <users> <filter value="(objectclass=person)"/> <base value="ou=intranet,o=company.com" /> <rdnattribute value="uid" /> <attributes> <!-- these attributes loaded ldapmembershipuser --> <!-- , used findusersbyname if excludefromnamesearch not set true --> <attribute value="givenname" /> <attribute value="sn" /> <attribute value="mail"/> <attribute value="title" excludefromnamesearch="true" /> <attribute value="callupname" excludefromnamesearch="true" /> </attributes> <descriptionattribute value="cn"

java - How to manage logged in session in spring mvc -

i have login controller autheticates userid , password , set userid in session , legacy can allways check userid key in session ..if present user logged in if not usr not authenticated particular request. now problem approch every time have explicitly check userid field in session in controller (in fact in each function within controller) restricted login , in need not check ..as pages meant have public access. what better ways handle loggedin/loggged out situation?? there spring specific approch?? you can use spring security http://static.springsource.org/spring-security/site/index.html it of requirements out of box free.

Why would Django (1.5.1) call Loader.load_template_source() 69 times? -

my problem manifested "maximum recursion depth exceeded" error in run-of-the-mill listview . after digging around, found ton of cache hits originating in dbtemplates every attempt made load corresponding page. prompted me write own template loader, @ point became apparent django calling load_template_source sixty-nine times every time page loaded. why django call load_template_source multiple times? visitor_index (db template) <!doctype html> <html lang="en"> <head> <title>{{ site.name }}</title> </head> <body id="home"> <pre> starting {% video in videos %} {{ video.headline }} {% endfor %} </pre> </body> </html> urls.py from django.conf.urls import include, url django.conf.urls.defaults import patterns videos.views import * urlpatterns = patterns('', url(r'^$', visitorindex.as_view(),

actionbarsherlock - Android: Enable suggestions programmatically on a SearchView -

hello i'm using example provided actionbarsherlock 4.3.1 demo. want set search view in order show suggestions when there 0 characters inserted , let suggestions disappear when user write something. how can this? thanks package com.actionbarsherlock.sample.demos; import android.app.searchmanager; import android.content.context; import android.database.cursor; import android.database.matrixcursor; import android.os.bundle; import android.provider.basecolumns; import android.support.v4.widget.cursoradapter; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.textview; import android.widget.toast; import com.actionbarsherlock.app.sherlockactivity; import com.actionbarsherlock.view.menu; import com.actionbarsherlock.view.menuitem; import com.actionbarsherlock.widget.searchview; public class searchviews extends sherlockactivity implements searchview.onquerytextlistener, searchview.onsuggestionlistener { private

c# - What is the relationship between domain models and view models? Do they need to be separate? (Does using EF complicate this?) -

so programming background self-taught , sporadic. working on mvc4 project , trying focus on best practices rather functionality. the general sense of project report generator. trying understand domain model vs view model are, , how related models used codefirst entity framework. tips appreciated. from understanding, let's report object has multiple properties, view want user able edit properties, viewmodel maps between report object , user input? sounds you've got right idea. viewmodel view representation of domain entity. can applied both data coming in , data going out of model. but, layer (and mappings) increase complexity of code. need view model class, mapper class, , domain entity (ef). so, if can build need without layer, keep simple. domain models , domain modeling should used business domain complex.

How can I take a Java Set of size X and break into X/Y Sets? -

i have java set (specifically hashset). suppose has size of 10k. how can break 5 sets each of size 2k? this method split elements of set first set contains first 2000, second contains next 2000, etc. public static <t> list<set<t>> split(set<t> original, int count) { // create list of sets return. arraylist<set<t>> result = new arraylist<set<t>>(count); // create iterator original set. iterator<t> = original.iterator(); // calculate required number of elements each set. int each = original.size() / count; // create each new set. (int = 0; < count; i++) { hashset<t> s = new hashset<t>(original.size() / count + 1); result.add(s); (int j = 0; j < each && it.hasnext(); j++) { s.add(it.next()); } } return result; } //as example, in code... set<integer> myintset = new hashset<integer>(); // [fill set

c# - Why casting from SomeClass<T> where T : BaseClass to SomeClass<DerivedClass : BaseClass> is not possible? -

i trying create generic method returns instance of irowmapper<t> . here classes: public abstract class person { public int id { get; set; } protected void person() { } protected void person(int id) { id = id; } } public class employer : person { public int employeeid { get; set; } public void employer() { } public void employer(int id, int employeeid) : base(id) { employeeid = employeeid; } } public class employee : person { public int employerid { get; set; } public void employee() { } public void employee(int id, int employerid) : base(id) { employerid = employerid; } } public static class mapbuilder<tresult> tresult : new() { // ... } public interface irowmapper<tresult> { tresult maprow(idatarecord row); } now following: private irowmapper<t> getrowmapper<t>() t : person, new() { var rowmapper = mapbuilder<t>.mapnoproperties()

c# - ImageResizer error -

i'm using image resizer imageresizing.net. but, when i'm trying upload or resize image, error occurs: the source stream @ end (have read it?). must call stream.seek(0, seekorigin.begin); before re-using stream, or use imagejob resetsourcestream=true first time stream read. using (stream newfile = system.io.file.create(path.combine(_pathresolver.resolvepath(_appsettings.companylogosdirectory), newfilename)) ) { //newfile.seek(0, seekorigin.begin); imageresizer.imagejob = new imagejob(); //i.resetsourcestream = true; = new imageresizer.imagejob(logo.inputstream, newfile, new imageresizer.resizesettings("width=120;height=45;format=jpg;mode=max")); i.createparentdirectory = false; //auto-create uploads directory. i.build(); } you have used logo.inputstream before provided code (maybe other job). can read image again or exception suggested put below code before using statement: logo.inputstream.seek(0, seekorigin.be

creating new column in an R dataframe based on values in multiple columns -

i have following data frame including restaurants (id#), owner , purchase date. restaurant changes ownership, analysis purposes want create column keeps name of latest owner, determined "purchase date". how can create new column? in example restaurant 23 changes hand on 1/1/2013, want include new owner's name (bob) current owner rows restaurant shown below. if restaurant not change hands, keep same name "current owner" column "owner" column. restaurant <- c(23,23,23,23,23,23,23,15,15,15,15,17,17,17,17) owner <- c("chuck","chuck","chuck","chuck","bob","bob","bob", "hazel","hazel","hazel","hazel","pete","pete","pete","pete") purchasedate <- c("3/4/2011","3/4/2011","3/4/2011","3/4/2011", "1/1/2013","1/1/2013",&qu

ISO-88591 charset / text-encoding of jQuery UI / mobile possible? -

searched web, failed find definite explanation. several people reported problems , claimed utf-8 required. therefore: my use jquery ui / mobile charset ? may use iso-88591 ? or jquery ui / mobile require utf-8 ? certainly, site uses meta-tag: <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> certain browser running on operation systems fail display diacritical characters correct, name these characters ö ä ü Ö Ä Ü ß: mac os x ok : safari, firefox, chrome windows xp ok : chrome [26.0.*] partial : firefox [18.0.1], ie [8.*] in case of partial , diacriticals appear fine, appear � or such. as far figured out, if jquery reloads 'partial', diacriticals break. according thread topic on jquery ui forum, check encoding of jquery-ui.min.js. try editing jquery-ui.min.js directly use charset iso-8859-1 , should work. (ref. https://forum.jquery.com/topic/weird-characters-showing-up-in-datepicker )

knockout.js - Breeze + Knockout bindings in graph collections -

i'm having trouble saving updates existing data graph in breezejs using knockoutjs bindings. i began john papa's spa using hottowel & durandal. the symptoms i'm able save updates physician record if update simple property of physician. however, if add new element in 1 of collections contained in physician can save collection element comes server , saved database null properties , without reference physician. i'm using specialty example i'm seeing same behavior collection in physician record add item to. added item comes server nulls in properties. the physician graph displays fine on page , i'm able associate drop-downs fine appropriate values specific fields appropriate. checkboxes etc. show appropriate values. here's segment of html i'm using: <div id="physgraph" class="span10" data-bind="with: currentphysician()[0]"> <!-- more stuff here --> <div id="physspecialties"