Posts

Showing posts from January, 2013

javascript - Socket.io is not defined -

whenever go http://localhost:8080/search ( search.html ), loads of html, reaches client-side javascript , crashes. first console.log in searchclient.js works, not second. error io not defined. server.js: var http = require('http'); var express = require('express'); var anydb = require('any-db'); var engines = require('consolidate'); var app = express(); var server = http.createserver(app); var io = require('socket.io').listen(server); var conn = anydb.createconnection('sqlite3://riverdata.db'); app.engine('html', engines.hogan); app.set('views', __dirname + '/templates'); app.use(express.static(__dirname + '/public')); app.get("/", function(request, response){ response.render('home.html'); }); app.get("/search", function(request, response){ response.render('search.html'); }); io.on('connection', function(socket){ socket.on('joi...

android - InputStream returns empty file when downloading a PDF -

so i'm trying download pdf file using httpurlconnection , think i've done right input- , outputstreams, yet when open downloaded pdf file (using built in file manager in android and/or adb), or inspect transferring os x, it's empty , size shows 0 bytes. the site i'm trying download pdf is: http://www.pdf995.com/samples/pdf.pdf here's code public static void downloadfile(final string fileurl, final file directory) { thread thread = new thread(new runnable(){ @override public void run() { try { try { fileoutputstream f = new fileoutputstream(directory); url u = new url(fileurl); c = (httpurlconnection) u.openconnection(); c.setrequestmethod("get"); //c.setrequestproperty("content-type", "application/pdf"); //c.setdooutput(true); c.conne...

How to search for a query with more than one word using Ruby HTTParty? -

so have code looks keyword in website: http://www.recipepuppy.com/api . def self.for(keyword) function looks keyword in website. chocolate example below works, however, if have 2 or more words search results comes blank. wondering how can compensate this. appreciated! require 'httparty' class recipe include httparty base_uri 'recipepuppy.com' default_params output: "json" format :json def self.for(keyword) get("/api", query: {q: keyword}) end end puts recipe.for("chocolate") puts puts recipe.for("apple pie") results: {"title"=>"tim , tracy's chocolate cake (boiled)", "href"=>"http://www.recipezaar.com/tim-and-tracys-chocolate-cake-boiled-259680", "ingredients"=>"baking soda, butter, cocoa powder, eggs, flour, sugar, water", "thumbnail"=>"http://img.recipepuppy.com/34464.jpg"} {"title"=>...

css - Vertically align elements between bootstrap rows -

this jsfiddle shows attempt @ positioning 3 buttons @ bottom of 3 columns. have used flexbox make sure 3 columns have same height, in order make buttons positioned @ bottom of each column, had make them absolutely positioned. result, size of buttons, not taken in account column's size. there proper way avoid (without using placeholder elements/margins/etc)? html: <div class="container"> <div class="row row-same-height"> <div class="col-md-4"> <h2>responsive</h2> <!--<h4> εξαρτημένη από το ένα άκρο </h4>--> <p style="text-align: justify">lorem ipsum dolor sit amet, consectetur adipiscing elit. suspendisse id varius leo. aliquam erat volutpat. proin tempor lorem et dolor sollicitudin, in dignissim arcu blandit. nullam consectetur rutrum pretium. vivamus imperdiet elementum neque, vel volutpat leo mattis in. nam luctus pellentesque dui sed vulputate. c...

How to pass a value of a column as a parameter from another column in displaytag using struts2 -

in below code, trying pass 2 parameters <display:column> tag. have pass code , level properties action(as shown below). not able pass value of column parameter column. here not getting value of level property in code property. <s:form action="levelhierarchy"> <display:table id="searchlist" name="searchlist" pagesize="8" export="false" requesturi="/getcomponentdetails" sort="list"> <display:column property="code" title="code" sortable="true" paramid="levelid" href="levelhierarchy.action?level=${searchlist.level}"></display:column> <display:column property="description" title="description" sortable="true" /> <display:column property="level" title="level" sortable="true" /> <display:setpro...

java - access mysql with kubernetes : access denied for user root -

i have 2 pod mysql .jar file(microservice server java) this mysql .yaml file apiversion: v1 kind: pod metadata: name: mysql labels: name: mysql spec: containers: - resources: limits : cpu: 0.5 image: mysql name: mysql env: - name: mysql_root_password # change value: pass ports: - containerport: 3306 name: mysql volumemounts: - name: mysqlkuber mountpath: /var/lib/mysql readonly: false volumes: - name: mysqlkuber hostpath: path: /home/adicipta/mysqlkuber i expose pod mysql service ip 10.0.0.67:3306 the .jar file pod run commend sudo ./kubectl run lingga --image=msf4j and error 2016-02-29 03:11:08 info classpathxmlapplicationcontext:512 - refreshing org.springframework.context.support.classpathxmlapplicationcontext@2401f4c3: startup date [mon feb 29 03:11:08 gmt 2016]; root of context hierarchy 2016-02-29 0...

MongoDB querying by sub-document value not working as expected -

i have 2 schemas, profile , levelofneed . profile { "_id" : objectid("56d35960a695dfa140137fca"), . . . "levelofneedserviced" : objectid("56d35828a695dfa140137fc7") } level of need { "_id" : objectid("56d35828a695dfa140137fc7"), "sortorder" : 2, "description" : "moderate needs", "additionalcost" : 3, "__v" : 0 } i have 4 documents levelofneed . need select of profile documents levelofneedserviced.sortorder >= value. example: db.getcollection('profiles').find({ 'levelofneedserviced.sortorder': { $gte: 2 } }) given data, expect see example profile , returns no results. doing wrong? update 1 previously, running mongodb 3.0.9. i've since upgraded 3.2.3, i'm still getting same results. according docs , should able query on embedded document field value. update 2 the aggregate function solut...

How to convert IMP to NSValue with Swift? -

Image
i want convert implementation nsvalue, it's err. in objective-c, can use line convert: [nsvalue valuewithpointer:implementation] but in swift, how convert? as says, needs unsafepointer , not copaquepointer . convert it: let impvalue = nsvalue(pointer: unsafepointer(imp))

threadpool - Monitor idle threads in Tomcat -

is there quick way monitor total no of idle threads in tomcat thread pool in runtime? something useful : say suppose total of threads in thread pool : (m + n) , see : num of working threads : m num of idle threads : n i understand, if attach agent yourkit, jmx - achieved. other can dump info @ intervals? thanks in advance ! you can use tomcat manager app (in-built) same.

ios - dispatch_barrier_async not word with dispatch_get_global_queue -

there code: dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_default, 0); // dispatch_queue_t queue = dispatch_queue_create("zxc", dispatch_queue_concurrent); dispatch_async(queue, ^{ nslog(@"1"); }); dispatch_async(queue, ^{ nslog(@"3"); }); dispatch_async(queue, ^{ nslog(@"4"); }); dispatch_barrier_async(queue, ^{ nslog(@"write"); }); dispatch_async(queue, ^{ nslog(@"5"); }); dispatch_async(queue, ^{ nslog(@"2"); }); dispatch_async(queue, ^{ nslog(@"7"); }); dispatch_async(queue, ^{ nslog(@"6"); }); dispatch_barrier_async not work dispatch_get_global_queue can work dispatch_queue_create("zxc", dispatch_queue_concurrent); why? correct. cannot put barrier on global queue. can put barriers on private queues create yourself. explained in documentation dispatch_barrier_async : the queue specify should co...

heroku - Redirect Elixir Phoenix request from root domain to www -

we have phoenix app on heroku dns @ route 53. followed blog post set proper http https redirect: http://building.vts.com/blog/2015/11/02/route53-ssl-naked-domain-redirect/ everything works , remaining redirecting root subdomain www. is there recommended way set in phoenix way? simply plug in redirect @ top of app's endpoint. in lib/app/endpoint.ex : defmodule app.endpoint use phoenix.endpoint, otp_app: :app socket "/socket", app.usersocket plug app.plugs.wwwredirect # ... end in lib/app/plugs/www_redirect.ex : defmodule app.plugs.wwwredirect import plug.conn def init(options) options end def call(conn, _options) if bare_domain?(conn.host) conn |> phoenix.controller.redirect(external: www_url(conn)) |> halt else conn # since plugs need return connection end end # returns url www prepended given connection. note # applies hosts contain "www" defp www_url(conn)...

python - Find first item with alphabetical precedence in list with numbers -

say have list object occupied both numbers , strings. if want retrieve first string item highest alphabetical precedence, how so? here example attempt incorrect, corrections needs changed in order achieve desired result appreciated: lst = [12, 4, 2, 15, 3, 'alligator', 'bear', 'anteater', 'dog', 'cat'] lst.sort() in lst: if i[0] == "a": answer = print(answer) first use generator expression filter out non-strings, , use min() select string highest alphabetical presence: >>> min(x x in lst if isinstance(x, str)) 'alligator

c++ - How to signal all listeners -

i have several processes in application. 1 writes shared memory while other listen global named mutex using waitforsingleobject. when call releasemutex in writer process wakes 1 listener. i need somehow signal processes once write operation complete. there way wakeup listeners, pulseall in c#?

java - Can ProgressBar be loaded dynamically? -

when use linearlayout.addview(progressdialog); eclipse gives me error message: the method addview(view) in type viewgroup not applicable arguments (progressdialog) but watch api , find that progressbar extends view java.lang.object android.view.view android.widget.progressbar your question has answer. progressbar extends view java.lang.object android.view.view android.widget.progressbar but adding progressdialog , if add progressbar , allow add view. dialog cannot added view in layout .

Node.js + Angular 2 RxJS Observabes & Change Detection - Best way to utilize Ajax Service with REST API? -

i new angular 2 , not know rxjs or nature of observables. trying achieve functionality however, , looking guide right information should learning achieve , more thorough knowledge. i working on basic web application more of test anything, several of angular 2 routed views need asynchronously getting data rest api endpoint built in node.js. here trying achieve: when route (with angular) site.com/messages there view, component utilizing service pulled in through parent component's providers array. need service data api endpoint site.com/api/messages . it seems me intuitive way have the component needs data setup http.get() on setinterval() when component initialized ( ngoninit life cycle hook). repeatedly poll endpoint need, gets data view can use structural directive iterate through or that. issue feel primitive way handle getting data. using newest , effective , efficient way this. unfortunately new angular 2 , not familiar of technologies , practices behind it. h...

.net - EF5: How to alter the default Delete function to implement my own -

well, here situation: we have tables dont want ever delete data. there column called isdeleted supposed updated instead instead of deleting it. i want develop accompanying web app ef5 have problem there. how implement restriction? i use stored procedures delete , select hoping way use standard functions in ef, changing how work. way less arduous , options have achieve want, since i´m guessing i´m not first person ask this? you can override savechanges method of dbcontext. e.g. want forbid deleting products. can save entities isdeleted flag set true instead of deleting them: public override int savechanges() { var deletedpersonentries = changetracker.entries<person>() .where(e => e.state == entitystate.deleted); foreach (var e in deletedpersonentries) { e.state = entitystate.unchanged; e.entity.isdeleted = true; } return base.savechanges(); } another option - raise exception if trie...

php - Changing text on email notification -

i using rsvp plugin wordpress , have modified can show guests invited event. when go in , rsvp sends email @ moment looks this: if((get_option(option_notify_on_rsvp) == "y") && (get_option(option_notify_email) != "")) { $sql = "select firstname, lastname, rsvpstatus ".attendees_table." id= ".$attendeeid; $attendee = $wpdb->get_results($sql); if(count($attendee) > 0) { $body = "hello, \r\n\r\n"; $body .= stripslashes($attendee[0]->firstname)." ".stripslashes($attendee[0]->lastname). " has submitted rsvp , has rsvp'd '".$attendee[0]->rsvpstatus."'."; wp_mail(get_option(option_notify_email), "new rsvp submission", $body); } } in database have field called rsvpevent , want data , show person's rsvp event. have tried adding it: if((get_option(option_notify_on_rsvp) == "y") &...

Python pattern looping -

i'm having trouble on printing alternate pattern, output suppose this: input height: 7 22 1122 221122 11221122 2211221122 112211221122 22112211221122 but instead came out this: input height: 7 22 1111 222222 11111111 2222222222 111111111111 22222222222222 code: height = int (input ("input height: ")) level in range (1, height+1): num = level x in range (num): if( level%2==0): #even row starts "11" first print ("11",end = "") else: print ("22",end = "") print() by using looping, while, loop, no list. how can this? for inside x loop, level never changes. need alternate based on x while choosing start based on level . height = int (input ("input height: ")) level in range (1, height+1): num = level x in range (num): if( (level+x)%2==0): #even row starts "11" first print ("11",end = ...

sql server 2008 r2 - SQL Like statement is ordering results -

can please explain why simple sql statement cause results ordered column being 'liked'... select * organisation company_name '%marce%' the above cause results ordered company name... select * organisation will show results in index / id order. order not guaranteed without explicitly using order by clause. it's arbitrary. there exist index on field, responsible 'natural' ordering of results, shouldn't relied upon.

javascript - Calculate half of the height of the last list item in an ol with jquery -

Image
the question kinda simple can't seem figure thing out. how can calculate half of height of last list item in ol jquery? need shorten line exact amount of pixels make thing work: try var height_li = $('ol li:last').height()/2; references http://api.jquery.com/height/ http://api.jquery.com/last-selector/

twitter bootstrap - How to toggle column visiblity in table? -

is there simple way toggle visiblity of 1 column in table? know can use jquery , write code this, think there's simplier way this. in bootstrap 3 class .hidden . can add class column, wich shouldn't visible. html <table> <tr> <td>bla1<td> <td>bla1<td> <tr> <tr class="hidden"> //this column hidden <td>bla2<td> <td>bla2<td> <tr> <tr> <td>bla3<td> <td>bla3<td> <tr>

mysql - magento table "sales_flat_order" field "protect_code" explanation -

we working on magento database , tables. magento seems write code in table sales_flat_order field protect_code define if there invoice or shipment done already. like 01b335 or a0a243 but there no key understand protection code means. there explanation of meaning of these codes , how generated? where generated? if in app/code/core/mage/sales/model/order.php on around line 2052 , find following: $this->setdata('protect_code', substr(md5(uniqid(mt_rand(), true) . ':' . microtime(true)), 5, 6)); this protect_code generated order (using combination of md5, uniqid, , random integer. what used for? if in app/code/core/mage/sales/helper/guest.php , find loadvalidorder function. see protect_code used in areas ensure order being loaded correct 1 guest's cookie value. it's used in other areas, such tracking information comparisons. can see several instances of getprotectcode() method being called in shipment models compare order ...

unit testing - Create a combination on input in Spock test -

in spock test current block where: [a,b,c] << [ ["a1","b1","c1"], ["a1","b1","c2"], ] i trying simplify since input , b same. trying use combinations() have been unsuccessful. i want same job code above. where: [[a,b],[c]] << // incorrect [ [["a1","b1"],["c1","c2"]].combinations() // incorrect ] currently npe here 1 solution: where: [a, b, c] << [[["a1","b1"]],["c1","c2"]].combinations()*.flatten()

Could Emacs convert C++ braces to hanging while re-indenting buffer? -

when re-indent c++ buffer, i'd convert code this: void foo(int a) { try { (unsigned int i=0; i<10; ++i) { if (++a) { break; } else { continue; } } } catch (...) { ; } } to code this: void foo(int a) { try { (unsigned int i=0; i<10; ++i) { if (++a) { break; } else { continue; } } } } catch (...) { ; } also, want class definitions , namespaces untouched. functionality exist in emacs? i realize can done bunch of regexps, it'd nicer use ready-made function handles edge cases , all. a simple macro job, like: (setq last-kbd-macro "\c-s{\336\c-e") followed by: m-0 c-x e .

php - Covert comma delimited string to array like a csv string without using str_getcsv function -

this have been asked on , on again have failed best answer allover google. please me. problem am fetching data forex rates rest api , how reply looks when print out. eur/usd,1380039070258,1.34,868,1.34,873,1.34641,1.35193,1.34932 usd/jpy,1380039068699,98.,789,98.,797,98.471,99.180,98.838 gbp/usd,1380039067482,1.60,082,1.60,095,1.59546,1.60500,1.60419 eur/gbp,1380039067816,0.84,245,0.84,256,0.84067,0.84495,0.84127 usd/chf,1380039064893,0.91,161,0.91,172,0.90974,0.91338,0.91097 eur/jpy,1380039066371,133.,236,133.,252,132.697,134.008,133.371 eur/chf,1380039063317,1.22,951,1.22,966,1.22853,1.23050,1.22919 usd/cad,1380039062062,1.02,960,1.02,969,1.02655,1.03111,1.02841 aud/usd,1380039069019,0.93,957,0.93,968,0.93635,0.94329,0.94307 gbp/jpy,1380039066561,158.,149,158.,170,157.342,158.978,158.552 note each line contains comma delimited data , next line on next line. when store data in response variable $resp , use code below $result=str_getcsv($resp, "\n"); pr($resu...

asp.net web api - Webapi with MVP based webform application -

we have web application built using asp .net 4.5 webforms stack , based on mvp pattern. in process of making aspects of application service-oriented can used serve relevant content third party clients. rather doing major overhaul, 1 of options looking out exposing webapi endpoints. aware of codeplex/github hosted sample projects demonstrating use of webapi ends points mvp based webforms application? suggestions/insight/ recommendations helpful? thanks. a sample using web forms + web api can found here: http://aspnet.codeplex.com/sourcecontrol/latest#samples/webapi/webformsample/readme.txt

java - Malformed generated report in Docx format -

Image
i'm trying export docx file through jrdocxexporter. trouble when try print generated document, error page margin. saw exporter not able set margin of word document. i'm exporting document in way: jasperreport reportcompiled = jaspercompilemanager.compilereport(pathjrxmlfile); jasperprint reportfilled = jasperfillmanager.fillreport(reportcompiled, null, datasource); jrdocxexporter exp = new jrdocxexporter(); exporter.setparameter(jrexporterparameter.output_file_name,pathfile); exporter.setparameter(jrexporterparameter.jasper_print,reportfilled); exporter.exportreport(); i'm using jasperreports 5.0.0 , ireport 5.1.0 . when try print document generated ms word message: can me? i found kind of problem bug, , has been reported. margins cause warning when printing docx in word

python - What does this Release Modifier do? -

i programming window manager x11 using python-xlib. far, used myself simplewm sqizit orientation, orientated @ plwm . and in both wms, can find release modifier, defined as release_modifier = xlib.x.anymodifier << 1 but in both, there no further explanation modifier does. haven't found on google either. so, if xlib-expert explain me thing (i think should understandable c programmers well), i'd grateful :) the reference find in sawfish wm programming manual , says there 2 special modifiers: prefix matches set of modifiers; release modifier matches key-release events instead of default key-presses.

Python Input Function -

i wondering if tell me wrong code, when run code shows nothing if take out "elif" work.\ first=input("what first name? "); middle=input("what middle name? "); last=input("what last name? "); test = [first, middle, last]; print (""); print ("firstname: " + test[0]); print ("middlename: " + test[1]); print ("lastname: " + test[2]); print (""); correct=input("this information input, correct? "); if (correct == "yes" or "yes"): print ("good!") elif (correct == "no" or "no"): print ("sorry there must error!"); here's problem: if (correct == "yes" or "yes"): # ... elif (correct == "no" or "no"): # ... it should be: if correct in ("yes", "yes"): # ... elif correct in ("no", "no"): # ... notice right way mak...

javascript - how do i save return values from a .each call into an array -

i have function call: createnode(e,control);// return id. // e leave alone, thinking // pass object function way optionally. function createnode(e, control){ if(!control) control = this; // rest of function, calls object $(control) instead of $(this). //... } i have selector want iterate over: $(control_group).each(createnode); is there way build list of ids this, such as: var arr = []; arr.push($(control_group).each(createnode)); i doing recurive control builder makes controls in controls, , want return identifiers child attribute. going arr . my 1 idea doing simple like: var arr = []; $(control_group).each(function(e){ arr.push(createnode(e,$(this)); }); that's .map() does: var arr = $(control_group).map(createnode).get(); .map() returns jquery object; if want ordinary array, need .get() it.

python - Django form sporadic validation -

i have form accessed class-based generic updateview. validates, among other things, event being updated not on same date another. the trouble is, when updating fields, e.g. location, changes processed without error being raised, updating others, e.g. name, throws validation errors event date clashing event, errors should occur when location edited. why editing fields raise validation errors , not editing other fields? validation should check them all. my view: class eventeditview(updateview): template_name = "edit_event.html" pk_url_kwarg='event_id' model = event form_class = eventeditform which uses form: class eventeditform(forms.modelform): class meta: model = event def __init__(self, *args, **kwargs): self.request = kwargs.pop('request', none) super(eventeditform, self).__init__(*args, **kwargs) name = forms.charfield(max_length=1024, initial="give short, descriptive name...

How to model a mixture of 3 Normals in PyMC? -

there a question on crossvalidated on how use pymc fit 2 normal distributions data. answer of cam.davidson.pilon use bernoulli distribution assign data 1 of 2 normals: size = 10 p = uniform( "p", 0 , 1) #this fraction come mean1 vs mean2 ber = bernoulli( "ber", p = p, size = size) # produces 1 proportion p. precision = gamma('precision', alpha=0.1, beta=0.1) mean1 = normal( "mean1", 0, 0.001 ) mean2 = normal( "mean2", 0, 0.001 ) @deterministic def mean( ber = ber, mean1 = mean1, mean2 = mean2): return ber*mean1 + (1-ber)*mean2 now question is: how three normals? basically, issue can't use bernoulli distribution , 1-bernoulli anymore. how then? edit: cdp's suggestion, wrote following code: import numpy np import pymc mc n = 3 ndata = 500 dd = mc.dirichlet('dd', theta=(1,)*n) category = mc.categorical('category', p=dd, size=ndata) precs = mc.gamma('precs', alpha=0.1, beta=0.1, siz...

javascript - Tracking a users progress during a test/form submission -

i have form/test 20 fields users fill out. user chooses course, enters personal info along test want take. after answer 20 true , false questions , submits answers. coldfusion calculates score , stores score , user information in database. the problem facing due poor user input missing data. users not submitting test , wonder why not in report. need come solution track users progress , logs it. don't need detailed looking see if attempted take test or not. solution have table in database 2 boolean columns. 1 true when user enters , other true when exit. record if user has entered form without submitting properly. identify reporting errors in fact user errors. i can't seem think of other way , wanted others inputs of how handle task. one way can think of use ajax or jquery. on every click in input box, update counter. (you may use keypress() method) http://api.jquery.com/keypress/ when user leaves input box, check if field empty. if yes, keep counter update...

java - If statement trouble on static variable -

this question has answer here: how compare strings in java? 23 answers guys i'm working on android , , have static variable , lets "var" , if it's null if statement executed or else executed , thing , after "var" not null , if restart tab works expected , enlighten me . **protected static string ipath="" , ipath1;** protected onclicklistener selimg = new onclicklistener() // first image { @override public void onclick(view vw) { // todo auto-generated method stub intent = new intent( intent.action_pick, android.provider.mediastore.images.media.internal_content_uri); startactivityforresult(i, result_load_image); } }; protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); ...

phonegap 3.0 facebook login -

i m using phonegap 3.0 , trying install below faceook login plugin: https://github.com/phonegap/phonegap-facebook-plugin i have added following changes in config.xml file <gap:plugin name="com.phonegap.plugins.facebookconnect"> <param name="app_id" value="[app_id]" /> <param name="app_name" value="[app_name]" /> but still when trying install plugin giving me following error: error: variable(s) missing: app_id, app_name can tell me why error might occuring.m missing adding changes in file. thanks it looks plugin hasn't been rewritten phonegap 3.x yet. here issue on github project people discussing it: https://github.com/phonegap/phonegap-facebook-plugin/issues/343 and here fixed android part of code work phonegap 3.x: https://github.com/phonegap/phonegap-facebook-plugin/pull/348 also, here else having trouble using ios phonegap 3.x: phonegap 3.0.0 - facebook sdk 3.6 - fb plugin: fa...

Adding fields to peopleresults.aspx in display templates Sharepoint 2013 -

on people search results page (peopleresults.aspx) need add in work phone , cell phone display when person searched. altered display template , got work phone display, cell phone isn't showing up. idea why might be? can offer appreciated. here code. included relevant code pieces: <mso:managedpropertymapping msdt:dt="string">&#39;aboutme&#39;:&#39;aboutme&#39;,&#39;accountname&#39;:&#39;accountname&#39;,&#39;baseofficelocation&#39;:&#39;baseofficelocation&#39;,&#39;department&#39;:&#39;department&#39;,&#39;hithighlightedproperties&#39;:&#39;hithighlightedproperties&#39;,&#39;interests&#39;:&#39;interests&#39;,&#39;jobtitle&#39;:&#39;jobtitle&#39;,&#39;workphone&#39;:&#39;workphone&#39;,&#39;cellphone&#39;:&#39;cellphone&#39;,&#39;lastmodifiedtime&#39;:&#39;lastmodifiedtime&#39;,&#39;memberships&#...

javascript - Fixed Header and Auto Scrolling To Div's -

i using following script make scroll section within page when clicked on it's link top navigation menu in header so in html have assigned id's each section (sectio1, section2, section3 etc.), , have assigned these section in top navigation href's example <a href="#about">about us</a> . when click on top navigation take div have id of #about. the scrolling bit working, however, because header fixed - when scrolls section top bit of section appears cropped since header overlaying it. click here live preview: www.loaistudio.com can this? can add below javascript make when scroll section gives link navigation class of active? $(document).ready(function () { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname) { var target = $(this.hash); target = target.leng...

Unable to locate element for LABEL with the xpath expression -

i trying below xpath label, not able locate element. driver.findelement(by.xpath("//div[label[contains(text(),'patient's name']]")).isenabled(); ( firepath : .//*[@id='update_patient_profile']/div/div[1]/label) below html source field. <form id="update_patient_profile" action="/subscriber/" method="post" name="update_patient_profile"> <div class="subscriberaddpatient"> <div class="formdata nameinputs"> <label for="first_name">patient's name</label> <input id="first_name" class="left namerule" type="text" onblur="resettxtadd($(this))" onfocus="emptyfieldadd($(this))" onclick="emptyfieldadd($(this))" name="first_name" value="first name" maxlength="24"/> can suggest me xpath label. you should use below xpath //*[@id='up...

python - Django query with an aggregate function -

i have following models: class topiclabel(models.model): name = models.charfield(max_length=256) order = models.integerfield(null=true, blank=true) def __unicode__(self): return self.name def hastopics(): return topiclabelconnection.objects.filter(labelid=self.id).count() > 0 class topiclabelconnection(models.model): topicid = models.foreignkey(topic, related_name='connection_topic') labelid = models.foreignkey(topiclabel, related_name='connection_label') def __unicode__(self): return self.labelid.name + ' / ' + self.topicid.title in view want create list of topiclabel s, have @ least 1 connection (i. e. hastopics returns true ). afaik impossible in django use instance methods in filter expressions (i. e. topiclabel.objects.filter(topiclabel.hastopics).order_by('order') impossible). what correct (django-style) way implement such query (preferably database-independent) ? for...

Parsing JSON with a Javascript Date object in Ruby -

i using soap api returns xml json strings within response envelope. of api calls has not been problem there 1 returns javascript new date objects causing problems when using json.parse . here simplified example of response getting. "{\"history\":[ {\"timestamp\":new date(1380024020923)}]}" when using json.parse following error. json::parsererror: 399: unexpected token @ '{"timestamp":new date(1380024020923)}]}' is there nice way parse string or going have use regex/string trickery? has come across way of returning date object , understand advantage?

if statement - Ember/Handlebars: compare variable with string -

i need display block depending on current views variable in comparison string: pseudo code is: {{#if view.somevariable "desiredvalue"}} hurray desiredvalue exists in view! {{else}} sorry, doesn't match... {{/if}} of course doesn't work if statement allows 1 param. tried custom registerhelper of handlebars, doesn't resolve view.somevariable , instead uses string (although view.somevariable defined , has value). finally tried handlebar's registerboundhelper - resolves params doesn't support handlebar's blocks, what's more tries resolve string object, fail again. pure madness! my views dynamical depends on many factors backend , approach pseudo code perfect resolving it. there way that? edit: there sample of want ... http://jsfiddle.net/biesior/dms2d/ looks quite trivial... [if] statement inside each pseudo code of course you can declare computed property, isdesired on view, compare somevariable string: ...

asp.net - For each statement not being executed in a While statement? -

i trying each statement inside while statement , not executing code within each statment. assuming "value" not being assigned somehow? cmd = new sqlcommand cmd.connection = con cmd.commandtext = "select [physician first name], [physician last name], [recipient primary business street address line 1], [recipient city], [recipient state], [recipient zip code], notes_consultingfee, [total amount of payment] tbldata referencenumber = @referencenumber" cmd.parameters.add(new sqlparameter("@referencenumber", (referencetextbox.text))) dim reader sqldatareader = cmd.executereader() while reader.read() each value object in reader dim firstname = reader.getstring(0) dim lastname = reader.getstring(1) dim address = reader.getstring(2) dim city = reader.getstring(3) dim state = reader.getstring(4) dim zip = reader.getstring(5) dim notes = reader.getstring(6) dim amount decimal = reader(7) ...

javascript - internal ajax call from object is clearing member variables -

i have object var myobject = (function (){ var myobject = function (a,b){ this.a = a; this.b = b; this.c; } myobject.prototype.publicfunction = function(){ var somevariable = 123; //this.a , this.b both fine here. var self = this; $.ajax({ type: "post", url: "default.aspx/pagemethod", data: "{" + args + "}", datatype: "json", async: true, cache: false, contenttype: "application/json; charset=utf-8", success: function (data, status) { //this.a = undefined, this.b = undefined, this.c = data. self.c = data.d }, error: function(xhr, status, error){ alert('tears'); } }); } return myobject; }()); as enter prototype function this.a\b both values constr...

php - How do I access phpMyAdmin? -

Image
i installed phpmyadmin on computer. used apache http server. however, every time go http://localhost/phpmyadmin/ , screen appears: how make login screen appears instead: you may better off install integrated suite, such as: xampp - linux/windows/apple * store web pages in htdocs wamp - windows mamp - apple then, going address localhost give menu, components (apache, phpmyadmin, tomcat, etc etc) they free, why not?

java - How would I take a TextField input, take each letter, and put it into chars? -

i trying make code gui allows user enter word in jtextfield , have check if it's palindrome (i.e ono palindrome, same , forth). how take jtextfield , convert them chars check if sentence palindrome? (and also, how remove spaces, punctuation, etc?) current code set up import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.stack; /** * write description of class palidromania_kevin here. * * @author kevin hy * @version 09/23/13 */ public class palindromania extends jframe { public jpanel panel1,panel2; public jlabel main1; public jbutton check; public jtextfield enterpal; public string inputword,letter; public int num; public char checker; public stack<string> stack = new stack<string>(); public palindromania () { super ("palindromania checker"); setsize (1024,768); container container = getcontentpane(); panel1 = new jpanel(); panel1.set...

ssl - Facebook realtime updates certificate verify failed -

when try test realtime updates, following error message: "callback verification failed: ssl certificate problem, verify ca cert ok. details: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed" any idea, how solve problem? i tried test ssl certificate ( http://www.nsoccer.net ) in http://www.digicert.com/help/ , seems, there aren't problems. facebook provides ssl bundle of required ssl root certificates required php sdk bundle can use establish chain of trust. @ time, can find bundle @ https://github.com/facebook/facebook-php-sdk/blob/master/src/fb_ca_chain_bundle.crt . use modify application use these certificates establish chain of trust.

Reading xml document in xslt -

i have java method return xml string. calling method xslt , trying process xml document. problem facing if try read document varialble xslt treated string want use xpath queries data .here xslt <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:f="functions" xmlns:oracledb="java:com.application.dbmethods.oracledb.taxref" exclude-result-prefixes="xs xd oracledb f" version="2.0" > <xsl:output indent="yes" method="xml"/> <xsl:template match="/"> <oxrefs> <xsl:apply-templates /> </oxrefs> <xsl:variable name="doc"> <xsl:sequence select="oracledb:getmetadatasp()"/> </xsl:variable> <xsl:message> <xsl:value-o...

iphone - How to use `UIKeyInput` protocol with `UIWebView` control? -

how use uikeyinput protocol uiwebview control? (i'm trying fix backspace issue: works on external keyboard, doesn't work on ios keyboard more 1 removed char, , works after char entered on both keyboards.) the problem uiwebview is restricted container view of uiwebdocumentview , private class, 1 need subclass in order implement need. well, it's possible, grey area. our app magic "special" view , on app store. your solution dynamically change subclass of uiwebdocumentview instance class of own, dynamically become subclass of uiwebdocumentview class. in class of own, able implement protocol methods. if scares you, means should not attempt. if in adventure, it's not bad sounds (a little objective c runtime magic). let me know if need help.

sass - Using Compass style library without their command line tool -

i'm working on web application. have build process compiles our .scss files final .css stylesheet. we'd adopt compass, , use semantic blueprint mixins. however, compass seems want "own" project structure. have build tool (brunch), , want use compass' mixins, not whole workflow. is there way access compass' mixins vanilla sass? or, alternatively, is there way limit compass' command line tool only .scss files, , leave images , javascript alone? i'm not sure if need here's do: i have custom compass_config.rb set paths how want them: http_path = '/' sass_dir = 'your/sass/path' css_dir = 'your/css/path' images_dir = 'your/image/path' javascripts_dir = 'your/javascript/path' then use compass command line tool following parameters: compass compile --sass-dir other/sass/path/stylesheets --css-dir other/css/path/stylesheets -c path/to/compass_config.rb it may ...

c# - How to list blog id in blogger -

i have following code title of each blog of blogger account. list title of blogs, need display id of blogs. there way that? feedquery query = new feedquery(); query.uri = new uri("http://www.blogger.com/feeds/default/blogs"); atomfeed feed = null; try { feed = service.query(query); foreach (atomentry entry in feed.entries) { label1.text += "blog id: " + entry.title.text ; } } catch {} thanks in advance.. i blogid using following code. it's kind of dirty job. add null check avoid exceptions. foreach (atomentry entry in feed.entries) { string[] url = entry.selfuri.tostring().split('/'); string blogid = url[url.length - 1]; }