Posts

Showing posts from March, 2013

plugins - How to change 'this' in jquery callback -

i have written jquery plugin takes number in div , makes count up. i've tried add callback when finishes starts on next div. when starts working on next div first resets number in current div, before carrying on on next div expected. suspect using 'this' inside of plugin. here full (not) working example --> how prevent happening? thanks my plugin: (function( $ ) { $.fn.countup = function(options) { var settings = $.extend( { 'startfrom' : 0, 'countto' : number(this.text()), 'start' : 10, 'frequency' : 200, 'jump' : 1, 'target' : this, 'log' : false, 'callback' : '' }, options); var intregex = /^\d+$/; if(intregex.test(settings.countto) && intregex.test(settings.startfrom) ) { // both settings integers, started: if(settings.star

javascript - A ".on()" action listener seems to stop working -

i guess start out link jsfiddle of project i going explain how should work , main problem. basically has 3 "lines" depicted @ top selector box. each line has varying amount of "parts" show on left sidebar. when part selected, form slides enter information (but can ignored). upon submit, new "job" should added list. works fine far. my problems come when switch lines. reason, whenever switch lines default first line, can no longer add jobs list. .on() listener stops recognizing clicking buttons @ all. basically engineering student working on senior design project , had teach myself of web programming stuff because client wanted (even if not totally within domain expertise). anyways, know long question , people not inclined me out, cannot describe how appreciative be. there few hundred lines of code answer questions can. here parts of code think may relevant: $('ul#parts').find('button').on('click', function(){

Tabs/Windows in Chrome apps -

it appears chrome apps unable render tabs in browser... happen chrome tabbing interface , shame have try , re-implement in html/css/js. there no way tab management @ chrome application level? must new windows shell/panel level windows? i can imagine scenarios applications want contribute extension related features browser... why making more confusing users (who have install app , extension) in order full feature set? is there no room middle-ground here? chrome apps separate browser. deliberate approach, unlikely change. for apps seen apps, opposed websites, available regardless of connectivity, need seen separate browser. have found having apps launched , run outside browser important users conceptualize them apps. there security reasons keep apps out of browser. have access apis websites , extensions not have access to, make possible individually sandboxed , have no access browser. extensions , apps can communicate via messages. less ideal user may need ins

node.js - Using mocha with TDD interface, ReferenceError -

i trying unittesting node via mocha , chai . familiar python's built in unittest framework, using mocha's tdd interface, , chai's tdd style assertions. the issue running mocha's tdd setup function. running, variables declare within undefined within tests. here code: test.js var assert = require('chai').assert; suite('testing unit testing === testception', function(){ setup(function(){ // setup function, y u no define variables? // these work if move them individual tests, // not want :( var foo = 'bar'; }); suite('chai tdd style assertions should work', function(){ test('true === true', function(){ var blaz = true; assert.istrue(blaz,'blaz true'); }); }); suite('chai assertions using setup', function(){ test('variables declared within setup should accessible',function(done){ assert.typeof(foo, 'string', 'foo strin

Business Objects XI Web Intelligence how to reference a list of measures as variables in a prompt? -

the requirement present user list of measure names in 2 prompts. user selects measure name each prompt. based on user selection, actual measures mapped blocks on report. of measures counts , dollar amount sums data type specific formatting applies. the final report gives side side comparison of 2 measures user selects. prompt #1 targets left hand block prompt #2 targets right hand block each list of measure names 10 items long. the idea 1 report can used template number of different side side comparisons 2 measures. how reference list of measures variables in prompt? how map user selections actual measures in data provider? if understand correctly want give user possibility select between e.g. revenue, amount, cost, profitability, average price. each of values represents measure in universe. i create in universe object [promptmeasure]= case @prompt('select measure','a',{'revenue', 'amount', 'cost', 'profitabi

javascript - Treating iPad's `Return` as `Tab` -

how can cause return key on ipad's keyboard behave tab key when in html form? my current solution this: $('input[type=text]').keydown(function(e) { if (e.keycode == 13) { e.preventdefault(); $(this).nextall('input[type=text]:first').focus(); } }); i found solution in link below, works in jsfiddle included in comments of answer. jquery how make enter (return) act tab key through input text fields in end trigger submit button this solution not working in case though (on ipad or pc). based on comments, think might html structure causing trouble though not sure how alter achieve same layout. how else can cause return key jump next input field? my form's html block below (skip avoid long html read): <div class="row"> <div class="span6"> <div class="control-group" id="guestname_group"> <label class="control-label" for="textbox_name">

tcp - send a variable to a TCPHandler in python -

i'm confused how send variable tcphandler using socketserver.tcpserver in python.. host, port = hosts[0], args.port server = socketserver.tcpserver((host, port), metcphandler) server.serve_forever() which calls: class metcphandler(socketserver.baserequesthandler): def handle(self): self.data = self.request.recv(1024).strip() print "{} wrote:".format(self.client_address[0]) r = mexpresshandler(self.data, false) but want pass debug boolean mexpresshandler.. so host, port = hosts[0], args.port server = socketserver.tcpserver((host, port), metcphandler(debug)) server.serve_forever() fails. whats correct way of doing this? have recreate whole tcphandler over-ridding __init__ ? trust instincts, correct way is indeed subclass tcpserver , override __init__ method, python makes easy! import socketserver class debugtcpserver(socketserver.tcpserver): def __init__(self, server_address, requesthandlerclass, bind_

oracle - Does hsqldb provide a function similar to listagg? -

i looking function (or group of functions) in hsqldb similar oracle's listagg. i have part of larger select , keep syntax similar possible in hsqldb: select listagg(owner_nm, ', ') within group (order owner_nm) ownership fk_biz_id = biz.biz_data_id) current_owner the point of we're trying use hsqldb remote work , oracle working on site, prod, etc want change ddls little possible achieve that. looking @ array_agg, doesn't seem similar (as far being able pull separate table we're doing above ownership). suggestions how may accomplish this? group_concat looking for: http://www.hsqldb.org/doc/2.0/guide/dataaccess-chapt.html#dac_aggregate_funcs quote manual: group_concat specialised function derived array_agg. function computes array in same way array_agg, removes null elements, returns string concatenation of elements of array

Java Server: Socket sending HTML code to browser -

i trying write simple java program using serversockets send html code browser. here code: serversocket serversocket = null; try { serversocket = new serversocket(55555); } catch (ioexception e) { system.err.println("could not listen on port: 55555."); system.exit(1); } socket clientsocket = null; try { clientsocket = serversocket.accept(); if(clientsocket != null) system.out.println("connected"); } catch (ioexception e) { system.err.println("accept failed."); system.exit(1); } printwriter out = new printwriter(clientsocket.getoutputstream()); out.println("http/1.1 200 ok"); out.println("content-type: text/html"); out.println("\r\n"); out.println("<p> hello world </p>"); out.flus

wpf - Show default local image while url image is loading -

i wpf newbie. in wpf app, have images load web. avoid gui blocking, followed approach mentioned in how can keep wpf image blocking if imagesource references unreachable url? works great. issue is, until image loads, gui doesn't honor dimensions properties set in image node. end result kind of 'resize' affect - gui(elements) of 1 size , 'readjust' once image loaded. i wish make load 'smooth'. want able specify 'initial default' image. initial image in wpf image control however not able work. may below in imageasynchelper(which wrong) : public static readonly dependencyproperty sourceuriproperty = dependencyproperty.registerattached("sourceuri", typeof(uri), typeof(imageasynchelper), new propertymetadata { propertychangedcallback = (obj,e) => { ((image)obj).setbinding(image.sourceproperty, new binding("defaulturi") { source = new

android - ActionBar shows either all actions or none, putting all into the overflow menu -

my app targets sdk 17, i'm testing android 4.x emulator (with support library , actionbarsherlock actionbar available android 2.x). i've got 6 menu items 1 of activities. there 3 vital , need shown time. remaining 3 can in overflow menu, if there room 4th or 5th icon, want many showing possible. my problem actionbar seems show or none. set android:showasaction="always" first 3 , android:showasaction="ifroom" last 3. however, shows none of them in actionbar, adds overflow menu action (three vertical dots) , shows 6 actions in overflow menu. i've been iterating , testing, trying figure out how decides behave. if of 6 options have ifroom of them put overflow menu, seems stupid. am doing wrong? how can of actions shown , have overflow menu... hold overflow ? <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <group android:id="@+id/g

asp.net mvc - SQL Server Express database file auto-creation error in MVC 4 - But i DON'T want to use SQL Server Express -

i've deployed new application in asp.net mvc 4. use sql server 2008 r2 (not sql express). it worked first 10 minutes, did little change in code , re-deployed it. now, whenever try access page uses simplemembership, error: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified) description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. sqlexpress database file auto-creation error: connection string specifies local sql server express instance using database location within application's app_data directory. provider attempted automatically create application services database because provider determined database not exis

.net - Null exception was unhandled? -

i working on assignment friend. asked on how loop , gave me code part. copied , pasted vb. works him everytime try debug keep getting sign "null exception unhandled". not 1 one line. fist starts on lstinvoice.items.clear() if delete that, goes through lines. going on? used lstinvoice.items.clear() before on other assignments , never had problem before. here code: private sub btnstraight_click(byval sender system.object, byval e system.eventargs) handles btnstraight.click dim cost double cost = txtcost.text dim salvage_value double salvage_value = 0 dim life double life = txtlife.text dim depreciation double depreciation = (cost / life) dim c integer, integer, x integer, y integer, z integer c = cint(cdbl(txtyear.text)) = cint(txtlife.text) x = cint(txtcost.text) y = cint(cdbl(x) / i) z = x - y lstinvoice.items.clear() lstinvoice.items.add(&qu

android - JsonMappingException: No suitable constructor found for type -

given api endpoint @apimethod(name = "sendchallenge", httpmethod = httpmethod.post) public exchangelist sendchallenge(challengedata request) throws exception { return getfromdbthenprocess(request); } and front end (android) call endpoint exchangelist transfers = service.sendchallenge(request).execute(); i following stack trace logcat. note: monitoring server console (localhost) , no call came in. stacktrace: 04-08 14:58:53.261: d/dalvikvm(940): gc_concurrent freed 1394k, 15% free 12495k/14599k, paused 15ms+15ms, total 75ms … //[many of `freed` lines] 04-08 14:58:54.742: d/dalvikvm(940): gc_concurrent freed 1394k, 15% free 12506k/14599k, paused 15ms+16ms, total 85ms 04-08 14:58:55.562: w/system.err(940): com.google.api.client.googleapis.json.googlejsonresponseexception: 400 bad request 04-08 14:58:55.562: w/system.err(940): { 04-08 14:58:55.562: w/system.err(940): "code": 0, 04-08 14:58:55.562: w/system.err(940): "message": "com

sql - Converting an ER diagram to relational model -

Image
i know how convert entity set, relationship, etc. relational model wonder should when entire diagram given? how convert it? create separate table each relationship, , each entity set? example, if given following er diagram: my solution following: //this part includes purchaser relationship , policies entity set create table policies ( policyid integer, cost real, ssn char(11) not null, primary key (policyid). foreign key (ssn) references employees, on delete cascade) //this part includes dependents weak entity set , beneficiary relationship create table dependents ( pname char(20), age integer, policyid integer, primary key (pname, policyid). foreign key (policyid) references policies, on delete cascade) //this part includes employees entity set create table employees( ssn char(11), name char (20), lot integer, primary key (ssn) ) my questions are: 1)is conversion true? 2)what steps converting complete diagram relati

c# - RestSharp deserialize list with a DateTime element as a child -

i have problem deserialize following xml restsharp: <dates> <date>2013-04-30</date> <date>2013-04-16</date> <date>2013-04-05</date> <date>2013-04-20</date> <date>2013-04-06</date> <date>2013-04-13</date> <date>2013-04-04</date> </dates> obviously need deserialize list of datetime objects. i´ve tried like public class dates : list<datetime> { } but not possible because datetime class name not match elements "date" name. of course i´ve set date format follows: request.xmlserializer.dateformat = "yyyy-mm-dd"; so next step public class dates { [serializeas(name="date")] list<datetime> dates; } but not working either, collection still returning empty. understand mixing datetime parsing , lists single element child is...inconvenient. possible parse kind of xml default restsharp xmlparser?

.htaccess - mod_rewrite issue or maybe my server is the issue? -

i'm having bit of fit here. i'm wading vast pool of .htaccess in order rewrite urls seo friendly. i have been researching day. take code snippets various tutorials , posts, yet no results , of time, no errors. i have cpanel dedicated server running apache 2.0. called host, lunarpages, , verified mod_rewrite installed , is, , apparently working fine. where i'd start changing name of index.php /home/ in http://www,website.com/home/ making trailing slash optional home being case insensitive. literally, try doing nothing, it's though request being ignored completely. i'm writing .htaccess file in notepad on pc , uploading filezilla transfer type set ascii. where i'd start changing name of index.php /home/ in http://www,website.com/home/ making trailing slash optional home being case insensitive. try: rewriterule ^/?home/?$ /index.php [l,nc] note if have relative links (like scripts or css) in index.php , go http://www,website

ios - How can I prompt the user to turn on location services after user has denied their use -

i have application explicit user interaction makes use of user's current location. if user denies access location services, still subsequent uses prompt user go settings , re-enable location services app. the behavior want of built-in maps app: reset location warnings in settings > general > reset > reset location warnings. start maps app. tap current location button in lower left corner. maps prompts ""maps" use current location" | "don't allow" | "allow". choose "don't allow" option. tap current location button in lower left corner again. maps prompts "turn on location services allow "maps" determine location" | "settings" | "cancel". in own app, same basic flow results in cllocationmanagerdelegate -locationmanager:didfailwitherror: method being called kclerrordenied error @ final step , user not given option open settings app correct it. i display own al

c# - Localization for security identity in .NET -

i looking implement named pipe service/client communication in .net , came across this code that, while initializing server side of pipe had set security descriptor pipe. did way: pipesecurity pipesecurity = new pipesecurity(); // allow read , write access pipe. pipesecurity.setaccessrule(new pipeaccessrule("authenticated users", pipeaccessrights.readwrite, accesscontroltype.allow)); // allow administrators group full access pipe. pipesecurity.setaccessrule(new pipeaccessrule("administrators", pipeaccessrights.fullcontrol, accesscontroltype.allow)); but i'm looking @ it, , i'm concerned specifying sids strings, or authenticated users , administrators parts. guarantee called that, say, in chinese or other language? (extracted op's original question) i came alternative: pipesecurity pipesecurity = new pipesecurity(); // allow read , write access pipe. pipesecurity.setaccessrule(new pipeaccessrule( "authenticated

iphone - iOS project setup: several apps slightly different between them. Several targets -

i have iphone app , asked create new products (apps) use main code of app apart adding new features. not paid/lite version, want more 2 versions. it's politic app , new products same app new menu option big events (one app big event, 1 different event, , on). apart this, different apps (included original , base one) need work ipad. it not content changes, code change also. different menu, , new option different event depending on app. app works tabcontroller 4 options. first 3 same in applications, 4th 1 gives access specific event, different content , logic. the theme (mainly colors) of apps different. so reading , got solution reuse big part of code setting different targets , using macros execute 1 or section depending on target. lead dirty code full of "if-else". there solution, or kind of design-pattern better this? any appreciated. javier. use multiple targets in xcode can suit needs well, can create multiple targets in xcode right clicking on

java hashCode() function on reference variable and objects -

for example, if create type object, a = new a(); then reference on stack points a type object on heap. question is, if call a.hashcode(), one's hash code returned, hashcode of reference or hashcode of object? if hashcode of object, how can hashcode of reference? kindly give me tips plz? hashcode() non-static method, other non-static method. it's either defined a , or base class of a ( object , in worst case). happens method gets called on instance in question. how can hashcode of reference? you can't, because doesn't make sense.

paperjs - Change mouse cursor while hover over specific canvas paths with Paper.js -

actually (using w3.org doc's example http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas/#dom-context-2d-ispointinpath ) did figured out how done in raw html5canvas/javascript: http://jsfiddle.net/qtu9e/4/ above used ispointinpath(x, y) syntax, according mentioned docs there ispointinpath(path, x, y[, w ]) in path can given check. this 1 problem solver, can't work passing paperjs's path object it! i'll continue searching solution, because else have deadlines, appreciated! ok, here answer! http://jsfiddle.net/fqajm/ <canvas id="mycanvas" width="256" height="128"></canvas> <div id="xycoordinates"></div>   #mycanvas { border: 1px solid #c3c3c3; } #xycoordinates { font: 9pt sans-serif; }   var canvas = document.getelementbyid("mycanvas"); // canvas // initialisation stuff make things work out of paperscript context // have have things done way because jsf

Safely remove all html code from a string in python -

i've been reading many q&a on how remove html code string using python none satisfying. need way remove tags, preserve/convert html entities , work utf-8 strings. apparently beautifulsoup vulnerable specially crafted html strings, built simple parser htmlparser texts losing entities from htmlparser import htmlparser class myhtmlparser(htmlparser): def __init__(self): htmlparser.__init__(self) self.data = [] def handle_data(self, data): self.data.append(data) def handle_charref(self, name): self.data.append(name) def handle_entityref(self, ent): self.data.append(ent) gives me like [u'asia, sp', u'cialiste du voyage ', ... losing entity accented "e" in spécialiste. using 1 of many regexp can find answers similar questions have edge cases not considered. is there module use? bleach excellent task. need. has extensive test suite checks strange edge cases tags slip t

python - How to lock and modify a dictionary safety per unit 'group' -

the following code not real code. made simple asking question. server side code of web application. what want locking group when modified don't know how. example, user belongs 'groupa' posted request server, , want add user_id dictionary of 'groupa' safety. want lock dictionary 'groupa' contains. don't want lock dictionary 'groups' contains. because users belongs 'groupb' never modify dictionary 'groupa' contains please give me advise. # dictionary mutable means new groups added anytime groups = {'groupa': {}, 'groupb': {}, 'groupc': {}} def request_handler(request): # assuming these come user's http post user_id = request.userid user_group = request.user_group group = groups[user_group] # group contains user_id's dictionary if user_id in group: # value of key 'user_id' number of user's post group[user_id] = group[user_id] + 1 else

oracle - SQL, return rows if there is no data in specified date -

have 2 tables in oracle db. 1 containing static data, info_table , , other includes daily updated data, stats_table . info_table contains static data each wcel_id (coordinates etc..), , stats_table being updated automatically everyday. sometimes, possible no data wcel_id, in particular date, wcel_id may missing in stats_tabel. problem is, when query data week example, data days specified wcel_id has entry in stats_table , want null if there no data specific date. below query select * from stats_table full join info_table e on a.wcel_id = e.wcel_id where a.period_start_time >= trunc(sysdate-7) , a.wcel_id = '14000004554984' this return 1 row, since have no data a.wcel_id = '14000004554984' 6 days, want have 1 row + 6 rows nulls. how can implement correct query? thanks in advance... move clause join criteria or add or and and (a.wcel_id null or a.wcel_id = '14....') select * stats_table full join info_table e on a.wcel_id = e

c# - WPF: How to make images scale together -

i dynamically adding images using view boxes uniformgrid . for (int = 0; < count; i++) { var viewbox = new viewbox(); var filepath = "myfilepath"; if (!file.exists(filepath)) continue; var newimage = new image(); var bitmapimage = new bitmapimage(new uri(filepath)); newimage.source = bitmapimage; viewbox.child = newimage; viewbox.setvalue(grid.rowproperty, i); imagegrid.children.add(viewbox); } the problem i'm running images different sizes, horizontally or vertically. a way visualize whats happening. if there's 2 images on screen, first image being wider , shorter second image. when shrink window horizontally, first image shrink independently same width second. now, when shrink window vertically, second image shrink independently until same height first. how make 2 images scale without setting view box stretch property fill?

jQuery Ajax Failure Handler Called, but Form Data Posted Twice, Successfully -

i have prog-enhanced form posts (when javascript enabled) using jquery. when javascript disabled, works fine. <form class="clearfix" action="https://examples.com/api/rest/members/memberidnotshownforsecurity/examples/?on_success=https://examples.com/account/examples?alerts=inserted&amp;on_failure=https://examples.com/error" method="post" onsubmit="return false;"> <input id="url" type="text" name="example_url" placeholder="paste link example it"><br> <button id="insertexample" type="button">create</button> </form> when #insertexample button clicked, jquery handles request. <script type="text/javascript"> $(document).ready(function() { var insertexamplemutex = false; $("#insertexample").on('click', null, function(event) { if ( insertexamplemutex == false ) {

android - Having issues parsing JSON data to TextView the app just crashes -

i cannot anything. once input completed crashes. the commented out section how displayed information want upc , product displayed. ideas? if there question out there, please link it. crash logs: 04-08 21:12:52.416: w/dalvikvm(26817): threadid=12: thread exiting uncaught exception (group=0x40ac4228) 04-08 21:12:52.426: e/androidruntime(26817): fatal exception: thread-48634 04-08 21:12:52.426: e/androidruntime(26817): java.lang.nullpointerexception 04-08 21:12:52.426: e/androidruntime(26817): @ net.example.glutefree.networking.getserverdata(networking.java:113) 04-08 21:12:52.426: e/androidruntime(26817): @ net.example.glutefree.networking.access$0(networking.java:68) 04-08 21:12:52.426: e/androidruntime(26817): @ net.example.glutefree.networking$1.run(networking.java:49) 04-08 21:12:52.727: e/log_tag(26817): result [{"id":"512320","upca":"310742023497","company":"310742","product":&quo

How can I check if a type is a subtype of a type in Python? -

how can check if type subtype of type in python? not referring instances of type, comparing type instances themselves. example: class a(object): ... class b(a): ... class c(object) ... # check instance subclass instance: isinstance(a(), a) --> true isinstance(b(), a) --> true isinstance(c(), a) --> false # comparing types directly? some_function(a, a) --> true some_function(b, a) --> true some_function(c, a) --> false maybe issubclass ? >>> class a(object): pass >>> class b(a): pass >>> class c(object): pass >>> issubclass(a, a) true >>> issubclass(b, a) true >>> issubclass(c, a) false

java - ivy cannot resolve org.springframework dependencies -

i want use ivy eclipse plugin reolve spring-oxm dependency. <dependency org="org.springframework" name="spring-oxm" rev="3.2.2.release" /> but got below error: some projects fail resolved impossible resolve dependencies of my class name unresolved dependency: org.restlet.jee#org.restlet;2.1.1: not found unresolved dependency: org.restlet.jee#org.restlet.ext.servlet;2.1.1: not found i googled, , people restlet-2.1.1 no longer exist. , have no idea how solve problem. its available in repo http://maven.restlet.org/org/restlet/jee/org.restlet/2.1.1/ probably need add repository in ivy settings or repository using.

html - how do i center align images on a mobile device -

i creating basic mobile version website. in contact page have facebook & linkedin logo side side. center aligned when viewed vertically. when screen rotated (in iphone) facebook logo moves left , not centered. below link page. http://www.prithvichandra.com/lennox/mobile/contact.html all appreciated. thanks hope css can fix : /* .social-network-wrapper{ width:95%; margin: 10px 5%; float:left;} .fb-wrapper, .ld-wrapper{ width:29%; float:left; text-align:center;} */ .social-network-wrapper {float: left; width: 100%;} .fb-wrapper, .ld-wrapper{ width:48%;} .fb-wrapper{text-align:right; float: left;} .ld-wrapper{text-align:left; float: right;} and change line : <div class="fb-wrapper" style="margin-left: 72px;"> to <div class="fb-wrapper">

integration - Solving an integral in R gives error "The integral is probably divergent" -

Image
i trying solve integral in r. however, getting error when trying solve integral. the equation trying solve follows: $$ c_m = \frac{{abs{x}}e^{2x}}{\pi^{1/2}}\int_0^t t^{-3/2}e^{-x^2/t-t}dt $$ the code using follows: a <- seq(from=-10, by=0.5,length=100) ## create function compute integration cfun <- function(xx, upper){ integrand <- function(x)x^(-1.5)*exp((-xx^2/x)-x) integrated <- integrate(integrand, lower=0, upper=upper)$value (final <- abs(xx)*pi^(-0.5)*exp(2*xx)*integrated) } b<- sapply(a, cfun, upper=1) the error getting follows: error in integrate(integrand, lower = 0, upper = upper) : integral divergent does mean cannot solve integral ? any possible ways fix problem highly appreciated. thanks. you wrap call cfun in try statement # note using `lapply` errors don't coerce result character b <- lapply(a, function(x,...) try(cfun(x, ...), silent = true), upper = 1) if wanted replace errors na values , prin

php - Call to undefined method DOMDocument::createDocumentType() -

i have following script snippet. did not realize use getelementbyid needed include createdocumenttype, error listed above. doing wrong here? in advance! ... $result = curl_exec($ch); //contains webpage grabbing remotely $dom = new domdocument(); $dom->createdocumenttype('html', '-//w3c//dtd html 4.01 transitional//en', 'http://www.w3.org/tr/html4/loose.dtd'); $elements = $dom->loadhtml($result); $e = $elements->getelementbyid('1'); ... edit: additional note, verified dom correct on remote page. domdocument not have method named createdocumenttype , can see in manual . method belongs domimplemetation class . used (taken manual): // creates instance of domimplementation class $imp = new domimplementation; // creates domdocumenttype instance $dtd = $imp->createdocumenttype('graph', '', 'graph.dtd'); // creates domdocument instance $dom = $imp->createdocument("", "", $dtd); s

objective c - Does performSelector perform right away or is it scheduled to be performed? -

does performselector perform right away or scheduled performed iota later? from doc the performselector: method equivalent sending aselector message directly receiver. so performs right away. also doc, these 2 messages equivalent id myclone = [anobject copy]; id myclone = [anobject performselector:@selector(copy)]; and both of them end compiled into objc_msgsend(anobject, @selector(copy)); edit after discussion originated under anoop's answer, think it's worth specifying not variants of performselector: executed right away. there's bunch of variants defined nsobject cause action scheduled. it's important notice holds true in case of 0 delay, stated documentation : specifying delay of 0 does not cause selector performed immediately . selector still queued on thread’s run loop , performed possible. to wrap up, here's relevant list of variants variants right-away execution: performselector: performselector:withobject:

networking - Open website via computer IP address while running tomcat locally with a router? -

i'm working on website friend, developing using eclipse/tomcat. i'm running locally , trying open via internet port ip address, can't work. computer running connected router, running off of 192.168.1.4, , http://192.168.1.4:8080/mobile_site/index.jsp works. when try , open via internet port ip, http://67.xxx.244.xx:8080/mobile_site/index.jsp doesn't find device, outside local network. there way send link when running locally when connected router? you have configure router port forwarding (or virtual servers depending on router) forward tcp connections 67.xxx.244.xx:nnnn 192.168.1.4:8080 . then give 67.xxx.244.xx:nnnn address friend. note: nnnn @ router doesn't need 8080 , long port forwarding set properly.

vb.net - Function call from Arraylist element not working -

i trying function class assignment work program hits specific line in question dies off , nothing after line execute. program not lock up, current execution path dies. i have tried running debugging same happens. once hit link should call function object stored in arraylist element break point @ actual function should called not hit , nothing further happens. public structure appliances ' create new appliance object public sub new(name string, pusage double) aname = name apusage = pusage end sub ' create new washer object public sub new(name string, pusage double, wusage double) aname = name apusage = pusage awusage = wusage end sub ' functions public function getaname() return aname end function public function getapusage() return apusage end function public function getawusage() return awusage end function dim aname string ' appliance

android - Class from XML layout that can be instantiated in the main activity -

so have xml file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="10sp" android:id="@+id/lengthlayout" android:background="@color/gray2" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" > <edittext android:id="@+id/inputlength" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="0.3" android:hint="@string/temperaturehint" android:inputtype="n

linux - Is it possible to make a link from file A to file B in a different directory within the same SVN repository? -

within same svn repository, have 2 directories, backend/ , product/ , both containing file named test.xml . how can make link product/test.xml backend/test.xml , such after have modified file product/test.xml , done svn commit , modified test.xml doing svn backend/test.xml ? by way, seems svn externals don't work, or have used in wrong way? yes, can use svn externals achieve want ( svn 1.6+ , two-thirds of way down). first, need svn delete test.xml backend\ folder , svn commit . then, in backend\ folder, can set external thus: me@computer:/backend$ svn propset svn:externals "^/projects/someproject/product/test.xml test.xml" . (information special ^ (caret) character here in this answer ). it's worth noting overwrite previous value of svn:externals property on path. if need set multiple externals, save text file of these (named, say, svn.externals ) in format: (path01) (name01) (path02) (name02) (path03) (name03) . . . (pathn) (name

php - Codeigniter -fetching data sitewide with codeigniter hooks -

i trying scroll news in page of website database without having pass variable in every controller of site. decided use hooks instead of passing scroll variable in every controller. i did create class this class scroll { function getscroller() { $data = array(); $ci =& get_instance(); $ci->db->where('a_status','active'); $ci->db->limit(4); $ci->db->order_by('id','desc'); $q = $ci->db->get('news'); if($q->num_rows() > 0){ foreach($q->result_array() $row){ $data[] = $row; } } $q->free_result(); return $data; } } what severity: notice message: trying property of non-object call member function get() on non-object in e:\xampp\htdocs\ can please me how ? want scrollernews in controller's view automatically without having pass in each controller. thanks if defining on view level, there no need that. you can define db requests directly in

what is the meaning of "let x = x in x" and "data Float#" in GHC.Prim in Haskell -

i looked @ module of ghc.prim , found seems datas in ghc.prim defined data float# without =a|b , , functions in ghc.prim defined gtfloat# = let x = x in x . my question whether these definations make sense , mean. i checked header of ghc.prim below {- generated file (generated genprimopcode). not code used. purpose consumed haddock. -} i guess may have relations questions , please explain me. it's magic :) these "primitive operators , operations". hardwired compiler, hence there no data constructors primitives , functions bottom since not expressable in pure haskell. (bottom represents "hole" in haskell program, infinite loop or undefined examples of bottom) to put way these data declarations/functions provide access raw compiler internals. ghc.prim exists export these primitives, doesn't implement them or (eg code isn't useful). of done in compiler. it's meant code needs extremely optimized. if think might need it,

ios - Does Core Data actually save any changes to disk before updating NSFetchedResultsControllers? -

this specific question , i've been bitten now, save others time , agony, here's problem in-depth , solution. when save main context, instance, , triggers nsfetchedresultscontroller delegate callbacks, can depend upon fact save has completed, , safely perform new fetch requests within callbacks assuming saved data included? the answer no. if have active nsfetchedresultscontroller's (nsfrc) in app have delegate set , monitoring changes relevant objects, here's small undocumented caveat core data developers should aware of. if perform save on main context, , have nsfrc's working on main context, calling save: on main context update nsfrc first , call willchangecontent:.. , didchangecontent:.. , etc. callbacks on nsfrc delegate before saving moc contents disk. the reason why problematic if try execute new fetch request using resulttype of nsdictionaryresulttype inside nsfrc callbacks , fetch request won't include current changes. current changes

c - How do I increase the Windows open file open used by _open_osfhandle? -

in windows, how increase open file limit used _open_osfhandle ? the default 512, can change using _setmaxstdio function.

html - how to select the checked checkbox rows -

i have table form mysql in html page, , each row has checkbox, if checked checkboxes , how output rows checked. konw how output rows, don't konw how selected rows checked give check boxes same name , assign each 1 different value, rows primary key. use request.getparametervalues() in servlet , array have checked values

cordova - checking of internet connection of device using phonegap -

trying use cordova 2.0.0 , using code checking of internet connection document.addeventlistener("deviceready", ondeviceready(), false); function ondeviceready() { alert("ready"); db = window.opendatabase("loginintro", "1.0", "loginintro", 1000000); db.transaction(populatedb, errorcb, successcb); checkconnection(); } function checkconnection() { alert("connection"); network = navigator.network.connection.type; alert("fdfd"); var states = {}; states[connection.unknown] = 'unknown connection'; states[connection.ethernet] = 'ethernet connection'; states[connection.wifi] = 'wifi connection'; states[connection.cell_2g] = 'cell 2g connection'; states[connection.cell_3g] = 'cell 3g connection'; states[connection.cell_4g] = 'cell 4g connection'; states[connection.none] = 'no network connection';