Posts

Showing posts from April, 2013

iphone - sqlite insert putting values into wrong fields -

i'm trying insert this - (void)insertblogstory:(nsstring *)storytitle link:(nsstring *)link storydescription:(nsstring *)storydescription storyhtml:(nsstring *)storyhtml pubdate:(nsstring *)pubdate blog:(nsstring *)blog { nslog(@"storytitle %@",storytitle); nslog(@"link %@",link); nslog(@"storydescription %@",storydescription); nslog(@"storyhtml %@",storyhtml); nslog(@"pubdate %@",pubdate); nslog(@"blog %@",blog); if(addstmt == nil) { const char *sql = "insert contents (storytitle, link, storydescription, storyhtml, pubdate, blog, read) values (?, ?, ?, ?, ?, ?, ?)"; if(sqlite3_prepare_v2(_database, sql, -1, &addstmt, null) != sqlite_ok) nsassert1(0, @"error while creating add statement. '%s'", sqlite3_errmsg(_database)); } sqlite3_bind_text(addstmt, 1, [storytitle utf8string], -1, sqlite_transient); sqlite3_

On specific key press event in chrome extension -

i want make google chrome extension, in there simple index.html . on page when i'll press alt + ctrl + a mouse focus should on first text box. i'm having difficulties how implement code keyboard shortcuts. you might want accesskey syntax: http://www.cs.tut.fi/~jkorpela/forms/accesskey.html#ex hth :) edit : right, page example wasn't here's reference implementation. basically, want add accesskey="f" c-a-f call attention input field. slightly modified example wikipedia's basic search form: <form action="http://en.wikipedia.org/w/index.php" id="searchform"> <div id="simplesearch"> <input type="text" name="search" value="example text" title="search wikipedia [f]" accesskey="f" id="searchinput" /> <button type="submit" name="button" title="search wikipedia text" id="searchbutton&quo

javascript - Date formatting -

using following: var date = new date(parseint(jsondate.substr(6))); i get: mon feb 22 1993 00:00:00 gmt+0000 (gmt standard time) how format too 22-02-1993 ? you use getfullyear , getmonth (note values start 0 ), , getdate functions on date instance, assemble string. (those links specification, can hard read; mdc bit better.) or use library datejs (although hasn't been maintained in quite time) or joidegn mentions , moment.js .

telerik - Layout Problems with JavaScript / Kendo UI -

i'm working on project requires kendo ui. working q1'12 beta. appliction must have footer visible. content of application in remaining space above footer. please note not want footer on top of content. want 2 distinct sections (content , footer). for reason, when use kendo grid larger data set, grid grows larger space alotted it. while footer need be, grid appears grow behind footer. because of this, users cannot interact scroll bar. have included code below. how fix this? keep spinning wheels on , seems easy/common problem. can't find solution. <body> <div id="mylayout" class="k-content" style="background-color:gray; height:100%;"> <div id="contentarea" style="background-color:silver;"> <div id="mylist"></div> <script type="text/javascript"> var mydatasource = new kendo.data.datasource({ type: "json", pag

ASP.NET Web Api metadata exchange? -

does knows if there way expose new asp.net web api rest interface metadata wcf (/help)? <standardendpoints> <webhttpendpoint> <standardendpoint name="" helpenabled="true" automaticformatselectionenabled="true" /> </webhttpendpoint> </standardendpoints> help page generation not supported in first drop of asp.net web api (in asp.net mvc 4 beta) planned supported in later versions. generation of test client website planned supported.

java - missing feature in lucene 4.0 snapshot -

i'm trying use lucene 4.0 snapshot version, standardanalyzer missing in version :(. knows on how replace this? in sample code given in lucene summary the standardanalyzer used, no found.. thanks in advance. looks standardanalyzer moved under org.apache.lucene.modules.analysis.standard.* can find standardanalyzer in svn trunk the reason here

java - Aspects are not executed -

i'm trying test simple aspect. app compiles , runs fine, not aspect executed. or @ least, not output aspect should produce. (my aim write exception logger ex occures in app. first test aspect should run...) maybe has more experience in aspects see's i'm doing wrong? package business; public interface customer { void addcustomer(); } import org.springframework.stereotype.component; @component public class customerimpl implements customer { public void addcustomer() { system.out.println("addcustomer() running "); } } @requestscoped @named //this backing bean jsf page public class service { @inject customer cust; add() { system.out.println("service running "); cust.addcustomer(); } } @aspect public class aspectcomp { @before("within(business..*)") public void out() { system.out.println("system out works!!"); } } spring: <beans xmlns="http

groovy - How do I group the results in Grails? -

i have project class : class project { static hasmany = [ tasks : tasks , users : user ] static belongsto = user string name string tostring() { this.name } } user class : class user { static hasmany = [ project: project ] profile profile string username string password string tostring() { this.username } } and tasks class : class tasks { static belongsto = [ user : user, project: project ] boolean completed string tostring(){ this.title } } user having many project , project having many tasks . now need way query db find, tasks completed , belongs project . example there 2 projects, p1 , p2 . in p1 has 4 completed tasks , p2 has 1 completed tasks . code need return : [p1:[t1,t2,t3,t4],p2:[t5]] i know easy find tasks completed, return : [t1,t2,t3,t4,t5] but find difficult group them according project . how can this? thanks in advance. you can use groupby

javascript - Why calculation code doesnt work? -

so basically, please check code - full code - <script type="text/javascript"> $(document).ready(function() { var seasonlookup = [ {startday: 1, startmonth:1, endday: 10, endmonth: 6, season:1}, {startday: 21, startmonth:9, endday: 31, endmonth: 12, season:1}, {startday: 11, startmonth:6, endday: 30, endmonth: 6, season:2}, {startday: 1, startmonth:9, endday: 20, endmonth: 9, season:2}, {startday: 1, startmonth:7, endday: 31, endmonth: 8, season:3}, ]; var cars = $('#cars_input').val(); var priceone = ($('#cars_input option[value="'+cars+'"]').attr('priceone')); var pricetwo = ($('#cars_input option[value="'+cars+'"]').attr('pricetwo')); var pricethree = ($('#cars_input option[value="'+cars+'"]').attr('pricethree')); var pricefour = ($('#cars_input option[value="'+cars+'"]

Moving back and forth strings in assembly -

given matrix 25 rows , 80 columns attributes 160 columns have write program in assembly move 4 letter string "fool" (say) move across matrix , forth. what have done till now: mov bx,0b800h mov ds, bx mov si, 1760 mov cx,80 fool: add si,-6 mov [si], " " add si, 2 mov [si], "f" add si, 2 mov [si], "o" add si, 2 mov [si], "o" add si,2 mov [si],"l" loop fool mov cx, 80 foool: add si,-6 mov [si], "f" add si, -2 mov [si], "o" add si, 2 mov [si], "o" add si,2 mov [si],"l" add si,2 mov [si], " " loop foool mov ah,9 int 21h but code, when reversed, last letter comes before first. newbie in assembly, have tried 8085 before first attempt 8086. i grateful if me fix problem. this works: ; compile nasm: ; nasm.exe fool.asm -f bin -o fool.com bits 16 org 100h mov bx,0b800h mov ds, bx mov si, 80*11*2 ; 1760 mov cx, 80+1-5 fool: mov [si], byte " " add si,

wpf - Giving a button in a textbox functionality, without using a custom control but overiding the textbox template -

i implemented button textbox overriding template code below: <style x:key="{x:type textbox}" targettype="{x:type textboxbase}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type textboxbase}"> <border name="border" cornerradius="2" padding="2" background="{staticresource windowbackgroundbrush}" borderbrush="{staticresource solidborderbrush}" borderthickness="1"> <grid x:name="layoutgrid"> <grid.columndefinitions> <columndefinition width="*" /> <columndefinition width="auto" /> <columndefinition width=

pdo - OOP PHP error for non-object when trying to get user info from database -

this question has answer here: call member function on non-object [duplicate] 8 answers i'm trying make oop class user info error fatal error: call member function prepare() on non-object in functions.php user.php - > include_once 'functions.php'; $user = new user(); echo $user->get_fullname(5); functions.php -> include_once 'database.php'; class user { public function connect() { $dbh = new db_class(); } public function get_fullname($uid) { $getname = $dbh->prepare("select emailaddress users userid =:username"); $getname->bindparam(':username', $uid); $getname->execute(); $rowname = $getname->fetch(); $email = $rowname['emailaddress']; return $email; } } database.php - > class db_class { publ

linq - LinqKit and Filter a subquery -

i have 1 many relation (ef) , want write query filters 1 relation , filters many relation. for instance: company has many employees write query filters on company.name = "zonsoft" , company.employees has @ least 1 employee name "hesius" from comp in data.companies.include("employees") comp.name = "zonsoft" andalso comp.employees.any(function(em) em.name = "hesius") select comp this works fine, if filters not known @ compile time? user can select out of many filters (name, age, ...) , don't want write code that. i experimenting expression , linqkit cannot make filter work on employees relation. ' exp1 expression(of func(of company, boolean) = function(comp) comp.name = "zonsoft" exp2 expression(of func(of employee, boolean) = function(emp) emp.name = "hesius" how combine these 2 filters in 1 query? or how desired result? this works: ' from comp in data.companies.include("empl

java - Android Simple HTTP Request? -

i have code android application i'm trying create interact php website. have android.permission.internet permission activated , keeps creating toast says "error." instead of contents of website. here java file: package com.http.request; import java.io.ioexception; import org.apache.http.httpresponse; import org.apache.http.httpstatus; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.util.entityutils; import android.app.activity; import android.os.bundle; import android.widget.toast; public class httprequestactivity extends activity { /** called when activity first created. */ private string dohttprequest(string url){ string results = "error"; try { httpclient hc = new defaulthttpclient(); httppost post = new httppost(url); httpresponse rp = hc.execute(post);

What are some good ways to implement breadcrumbs on a Jekyll site? -

i'm aware there single-level breadcrumbs in http://raphinou.github.com/jekyll-base/ i'm looking ways have breadcrumbs on jekyll site when directories depth of 4 or 5 levels . (yes, i'm aware jekyll blogging engine , perhaps shouldn't use general purpose website, many directory levels. i'm aware of http://octopress.org haven't found suitable plugin.) based heavily on http://forums.shopify.com/categories/2/posts/22172 came following jekyll layout breadcrumbs, variation of can see in action @ http://crimsonfu.github.com/members/pdurbin . should see breadcrumbs " home » members » " @ top. here's layout. yes, it's ugly. haven't studied liquid much. can suggest better way? <html> <head> <title>{{ page.title }}</title> <style type="text/css"> #bread ul { padding-left: 0; margin-top: 2px; margin-bottom: 2px; } #bread ul li { display: inline; font-size: 70%; } </style> <

Splitting an arbitrary range of numbers into rougly equal size partitions in C using OpenMP -

i split range of numbers equal size in c using openmp. example, if have range 7 through 24 , number of threads 8. first thread begin 7 , end @ 9. second thread begin 10 , end @ 12. third thread begin 13 , end @ 14. fourth thread begin @ 15 , end @ 16 , forth... until last thread begins @ 23 , ends @ 24. code wrote follows, not getting explained results. wondering if there missed can or there more efficient way of doing this? appreciated. note of predefined declaration of variables based on example given above: first = 7 last = 24 size = 2 (which signifies amount of numbers per thread) r = 2 (r signifies remainder) nthreads = 8 myid = thread id in range of 0 7 if (r > 0) { if (myid == 0) { start = first + myid*size; end = start + size; } else if (myid == nthreads - 1) { start = first + myid*size + myid; end = last; } else { start

ios - theos complains <dispatch/dispatch.h> could not be found on iPhone -

i've followed tips thebigboss install theos on iphone. when try make tweak gcd support, theos compiler say: "tweak.xm:2:31: error: dispatch/dispatch.h: no such file or directory". any idea solve it? i've used compile same code on mac have theos installed, no problem.

iOS in app purchase, how to determine if app store user account has changed -

i'm building app requires in app purchase. works ok, have problem. i have list of products can purchased. when purchasing product, keep product's identifier in user defaults, can provide content though there no internet connection. problem: user1 buys products. user1 logs out appstore (in settings). user 2 logs in appstore. open app. user 2 able see content user1 unlocked. how prevent this? thanks

Will history be preserverd when doing a destroy in tfs? -

say have 2 branches; master , child. make changes in child , merges them master. when doing destroy on child branch, history of changes made in child branch lost or merged master branch? have specify /keephistory parameter? any branch or item "deleted" remains in history. branch or item destroyed removed database , therefore not in history. there not /keephistory option on delete because deletes keep history. have not personnally used /keephistory destroy command can't give recommendation on it. reading documentation here guess difference between regular delete , destroy /keephistory on destroy can't reversed. in situation describe not recommend destrying branch because history changed lives. when merge there single check-in includes changes merged , associated checked in merge. before tfs 2010 history merges difficult follow possible if took time figure out. in tfs 2010 easier see flow of change through branches. i answer better if knew reasoning

c - Static vs Non Static functions - Debugging embedded systems context -

i puzzled following question: how keep advantage of "static" label still able debug production code on site? not once happens unintended behavior occurring @ customer site, , there . in many cases, having option perform debug can save lot of effort , provide quick response. such debug involves checking function behavior, brings "static" definition. static functions cannot debugged debug shell, putting breakpoints or executing it. on other hand, defining functions public causes code structure , optimization grief. i'm aware of options compiling @ least 2 different builds, 1 static , 1 without, fits automation tests, not final production build goes out eventually. will appreciated insights side, on how resolved (if any) dilemma. or rephrasing question to: " what more important? " a discussion on "static" in c here . i think fundamental question not " do ship 'static' or not? ", " do test ship ?&qu

javascript pausing a script changes order of appearance -

i have following script: posting(); pause(time); postsent(posturl, fields); function postsent(posturl, fields) { $.ajax( { url : posturl, type : "post", data : fields, cache : false, error : function(xhr, textstatus, errorthrown) { var answer = xhr.responsetext; answer = answer.split(":"); answer = answer[0].replace(/}/g,"").replace(/{/g,"").replace(/"/g,""); if (answer == "id") { ispostsent = true; } else { ispostsent = false; } } }); } function pause(milliseconds) { var dt = new date(); while ((new date()) - dt <= milliseconds) { /* nothing */ } } function posting() { var table = ''; table += '<table border="0" rules="none" cellpadding="5" style="z-index:+10; position:fixed; top:35%; l

asp.net mvc 3 - MySql with MVC3 gives an error when calling context.savechanges -

i'm trying mvc3 application use mysql database instead of sql server 2008. have created associated database , objects in mysql. , updated connection string in web.config file reference mysql.data.mysqlclient. when run application , try login, getting error store update, insert, or delete statement affected unexpected number of rows (0). entities may have been modified or deleted since entities loaded. refresh objectstatemanager entries. i have custom membershipprovider , within validation process have following using (mycontext context= new mycontext()) { --some checks here --- if (verificationsucceeded) { user.passwordfailuressincelastsuccess = 0; } else { int failures = user.passwordfailuressincelastsuccess; if (failures != -1) { user.passwordfailuressincelastsuccess += 1; user.lastpasswordfailuredate = datetime.utcnow; }

java - how can I pass value from textfield to object or file(serializable file)? -

ive got layout codes ready(i have 3 classes). after inputed first name, last name, address, age , salary clicked button "save", should save on employee.ser file , should not overwrite every time save input information. import javax.swing.*; import java.awt.*; import java.io.*; import java.util.*; public class employeeapp extends jframe { private arraylist <employee> list; public employeeapp() { list = new arraylist<employee>(); } jpanel panel; jlabel label; jtextfield field; jframe frame; jbutton save; public void initialize() { panel = new jpanel(); frame = new jframe("mark"); save = new jbutton("save"); frame.add(borderlayout.south, save); getcontentpane().setlayout(new flowlayout()); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setsize(350,350); frame.setvisible(true); panel.setlayout(new gridlayout(12,0)); jlabel label = new jlabel("en

Executing load test of a WCF service using JMeter -

i'm trying running load tests using jmeter v2.5.1. wcf service published in iis wcf-customisolated. if follow instructions especified in url http://twenty6-jc.blogspot.com/2011/11/performance-and-loading-testing-wcf.html , requests sent tool, obtain following error code: response code:415 response message:cannot process message because content type 'text/xml' not expected type 'application/soap+xml; charset=utf-8'. cabeceras de respuesta: http/1.1 415 cannot process message because content type 'text/xml' not expected type 'application/soap+xml; charset=utf-8'. server: microsoft-iis/7.5 x-powered-by: asp.net date: thu, 08 mar 2012 13:33:17 gmt connection: close content-length: 0 httpsampleresult campos: contenttype: text/xml dataencoding: utf-8 the xml message have established in soap/xml-rpc textbox following: <soap:envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xun="http://xunta.ifrt.servicios.f

selenium - Browser profile which includes the proxy username and password -

i creating , running automated test scripts web application. in 1 of scenarios have, have work proxy. way, using robot framework plus selenium test scripts. did, created separate browser profile selenium runs. problem can't interact credentials pop-up (asking username , password) using robot framework , selenium. there way can configure proxy username , password included in browser profile? or there way robot framework , selenium can interact authentication window? suggestions in solving or ending workaround issue anyone? thanks! robot framework seleniumlibrary uses selenium rc internally. proxy authentication can defined when selenium server started, see http://seleniumhq.org/docs/05_selenium_rc.html#proxy-configuration details. so, if start server manually, follow above instructions. if using start selenium server keyword, can give parameters arguments: | start selenium server | -dhttp.proxyhost=proxy.com | -dhttp.proxyport=8080 | -dhttp.proxyuser=username | -

actionscript 3 - Duplicating extenal items into an array -

if loading external content, such images or not array load items twice example: load = array(){ load images( "local/folder/www.example.com/" ); items("car.jpeg","bike.jpeg","bike.jpeg"); } the above in theory, if notice twice have "bike.jpeg" image in array; key value either items[1] or items [2] . so above idea in mind bike image loaded twice or referenced in array first initial load. yes images going cached flash. can check in firebug example subsequent requests appear grayed out (pulled cache). can load same image several times without hit on app's performance.

python - how do I compute a weighted moving average using pandas -

using pandas can compute simple moving average sma using pandas.stats.moments.rolling_mean exponential moving average ema using pandas.stats.moments.ewma but how compute weighted moving average (wma) described in wikipedia http://en.wikipedia.org/wiki/exponential_smoothing ... using pandas? is there pandas function compute wma? no, there no implementation of exact algorithm. created github issue here: https://github.com/pydata/pandas/issues/886 i'd happy take pull request this-- implementation should straightforward cython coding , can integrated pandas.stats.moments

Limit number of records using trigger and constraints in MySQL -

i have table called bffs, stores userid, , best friend's userid , restrict table have 3 number of best friends each different user. i mean if table structre is: bffs(userid, userid) and records are: (3286, 1212) (3286, 4545) (3286, 7878) and in case, if user id 3286 should not allowed have new record such (3286, xyzt). i wrote trigger i'm not sure: create trigger bffcontrol before insert on bffs each row declare numberofbffs integer; max_bffs integer := 3; begin select count(*) numberofbffs bffs sender =: new.sender if :old.sender =: new.sender return; else if numberofbffs >= max_bffs raise_application_error(-20000, 'users allowed have @ thre friends.'); end if; end if; end; / how should restrich on relational tables through assertions or triggers ? thanks add column, friendnumber , foreign key constraint reference table 3 rows: create table 3 ( friendnumber tinyint

opengl - Java JOGL2 and Mouse Listeners -

i've been using jogl2 java , i'm having issue mouse event listeners. can mouse listener update x , y position if use public void mousedragged(mouseevent e), not redraw on public void display(glautodrawable gldrawable) here's how code works: main method window , listeners constructed import java.awt.event.windowadapter; import java.awt.event.windowevent; import javax.media.opengl.gl2; import javax.media.opengl.glcapabilities; import javax.media.opengl.gleventlistener; import javax.media.opengl.glprofile; import javax.media.opengl.awt.glcanvas; import javax.swing.jframe; import javax.media.opengl.glautodrawable; public class helloworld { public static void main(string[] args) { // setup opengl version 2 glprofile profile = glprofile.get(glprofile.gl2); glcapabilities capabilities = new glcapabilities(profile); renderer render = new renderer(); // canvas widget that's drawn in jframe glcanvas glcanvas = new glca

coldfusion - Getting complex object error when trying to output query values -

my goal output column data specified in "fieldlist". getting following error: complex object types cannot converted simple values. expression has requested variable or intermediate expression result simple value, however, result cannot converted simple value. simple values strings, numbers, boolean values, , date/time values. queries, arrays, , com objects examples of complex values. cause of error trying use complex value simple one. example, might trying use query variable in cfif tag. error occurred on line 20. when trying following: <cfquery datasource="retailers" name="myquery"> select * retailer retailer_id = '#url.id#' </cfquery> <cfset fieldlist = "company,phone,phone_secondary,fax,email,website"> <cfloop list="#fieldlist#" index="i"> #myquery[i]# </cfloop> shouldn't work without giving me error? feel i'm overlooking simple can't find answer an

scala - Implementing snapshot in FRP -

i'm implementing frp framework in scala , seem have run problem. motivated thinking, question decided restrict public interface of framework behaviours evaluated in 'present' i.e.: behaviour.at(now) this falls in line conal's assumption in fran paper behaviours ever evaluated/sampled @ increasing times. restrict transformations on behaviours otherwise find ourselves in huge problems behaviours represent input: val slider = stepper(0, sliderchangeevent) with behaviour, evaluating future values incorrect , evaluating past values require unbounded amount of memory (all occurrences used in 'slider' event have stored). i having trouble specification 'snapshot' operation on behaviours given restriction. problem best explained example (using slider mentioned above): val event = mouseb // event occurs when mouse pressed val sampler = slider.snapshot(event) val stepper = stepper(0, sampler) my problem here if 'mouseb' event has occu

python - Problems installing South with Django (south_migrationhistory tables do not get created) -

i cannot seem working. i need south migrations bunch of apps. downloaded south 0.7.3 unzipped, ran setup.py develop (as says in turorial) double checked see if south should going python interpreter , doing (no errors) import south i c:\users\j\imicode\imi_admin>python ./manage.py syncdb syncing... no fixtures found. synced: > django.contrib.auth > django.contrib.contenttypes > django.contrib.sessions > django.contrib.sites > django.contrib.messages > django.contrib.admin not synced (use migrations): - south (use ./manage.py migrate migrate these) -at point understand south should have been synced correct? else after this, complains have no south_migrationhistory tables in database. ps. working django 1.2.7, python 2.6, on windows7 it seems me bug in south. also may cause doing wrong thigs like: running schemamigration --auto south , etc. suggestion install running python setup.py install or through easy_insta

Rails 3.2.0 - Redirecting after a JSON call is made -

i have controller action handles json requests handling datatables grid redrawing. have before_filter checks if session has been destroyed , should redirect logout action. when request ajax request, redirect happens fine. if request json, logs shows "filter chain halted :authorize rendered or redirected" not redirect page @ all. clues? i see logs show it's processing action json: processing usercontroller#datatable_redrawings json my contoller method: before_filter :auth def auth if session[:username].blank? flash[:error] = "please login." if request.xhr? render :js => "window.location = '/logout'" else respond_to |format| format.html { redirect_to :action => "logout" } end end end end a redirection isn't restful, nor sending js when client expecting json response. should send unauthorized (401) http status code or similar. before_filter :auth def auth

joomla1.7 - How to using OpenId in joomla 2.5 or 1.7 -

in joomla 1.5 have plugin authentication - openid , in joomla 2.5, plugin not see, how config open id in joomla 2.5 you can using oneall social login

php - year dropdown section being stored as null -

i couldn't think of decent title - it's clear enough. right, having problem creating year dropdown selector in registration form - work value stored in database remains null when selecting year (i have left optional registrations). here code: echo $this->form->input('graduation1', array('label' => 'year of graduation:', 'type' => 'date', 'dateformat' => 'y', 'empty' => true, 'minyear' => 1960, // start year 'maxyear' => date('y') // current ) ); thanks communit

javascript - Backbone.JS view renders, but not displayed on page -

i'm working on converting single-page app backbone.js. view below uses body tag it's tagname - ie, want view occupy entire content of page. don't want use container divs or other hacks. var thingview = backbone.view.extend({ tagname : "body", ... // show html view render : function() { console.log('displaying thing') $(this.el).append('<h1>test</h1>'); console.log('finished') console.log($(this.el)) return this; // chaining when rendering, see finished [ <body>​ <h1>​test​</h1>​ </body>​ ] but after inspect dom, body no longer has text. tagname indicates tag backbone should use create el if no el provided constructor. created element not automatically inserted dom. the simplest way create view el set body : new thingview({el:'body'})

rspec2 - How does rspec-rails detects folders? -

for example if have ./views/*_spec can use render function. if want use render function ./integrations/*_spec ? how can this? the solution include module rspec describe block include rspec::rails::viewexamplegroup

c# - Recursive linq query -

i have following object structure. public class study { public guid? previousstudyversionid { get; set; } public guid studyid { get; set; } //other members left brevity } it persisted using entity framework code first. it results in table this previousstudyversionid studyid ef90f9dc-c588-4136-8aae-a00e010ce87b e4315cfd-9638-4225-998e-a00e010ceeec null 1c965285-788a-4b67-9894-3d0d46949f11 1c965285-788a-4b67-9894-3d0d46949f11 7095b746-8d32-4cc5-80a9-a00e010ce0ea 7095b746-8d32-4cc5-80a9-a00e010ce0ea ef90f9dc-c588-4136-8aae-a00e010ce87b now want query studyid's recursive. came following solution: so when call method in repository getallstudyversionids(new guid("7095b746-8d32-4cc5-80a9-a00e010ce0ea")) returns me 4 studyid's. public ienumerable<guid> getallstudyversionids(guid studyid) { return searchpairsforward(studyid).select(s => s.item1) .uni

ios5 - UIScrollView. How Can I Tell Zoom Out From Zoom In? -

on ios have uiscrollview subclass. during zoom gesture need distinguish zoom-out zoom-in. best way this? thanks, doug in uiscrollviewdelegate 's scrollviewwillbeginzooming:withview: , store current zoomscale of uiscrollview ; compare stored value zoomscale in scrollviewdidendzooming:withview:atscale: determine if zoom in or zoom out. if value has increased, zoom in; otherwise, zoom out.

javascript - How to prepend a string to a string variable in a for loop without changing the loop structure? -

if have loop this: var rows; var len = z[0].length; ( var = len; i--; ) { rows += "<tr><td>" + z[0].marketer + "</td><td>"; } how can prepend instead of append current row string without changing loop structure? var rows; var len = z[0].length; ( var = len; i--; ) { rows (prepend) "<tr><td>" + z[0].marketer + "</td><td>"; } like this: rows = "<tr><td>" + z[0].marketer + "</td><td>" + rows;

Is there a way to integrate a better discussions solution with Rally? -

the discussion feature of rally limited. not support attachments or discussion threads. these required teams. there solution integrates better discussion solution rally? if not, take find third party dicussion/forum solution , integrate rally, in such way have information displayed part of correct user story/defect/task , able support attachments , discussion threads? jonathan, at moment, hard incorporate 3rd party discussion functionality rally ui. working towards more configurable , extensible ui more accessible discussions. see posted request on our ideas.rallydev.com site prioritize increasing visibility , functionality of discussions. mark

freepascal - Returning a value in Pascal -

for function return value in pascal assignment functionname := someval; used. assume doesn't stop function execution in exact place return in c does. there similar c return in pascal? (i'm using freepascal compiler) you can use exit procedure. function foo (value : integer) : integer; begin exit(value*2); dosomethingelse(); // never execute end;

android bound service with scala - cant get Binder.getService working -

i trying android app developed in scala work. error during compile [error] testservice.scala:49: error: type mismatch; [info] found : .services.testservice.type (with underlying type object .services.testservice) [info] required: .services.testservice service class testservice extends service { val mbinder: ibinder = new testservice.testservicebinder val list = list("linux", "android", "ios", "wp") override def oncreate { toast.maketext(this, tag + " created", toast.length_long).show; log.d(tag, "oncreate"); } override def ondestroy { toast.maketext(this, tag + " destroyed", toast.length_long).show; log.d(tag, "oncreate"); } override def onstart(intent: intent, startid: int) { toast.maketext(this, tag + " started", toast.length_long).show; log.d(tag, "onstart"); } override def onbind(intent: intent): ibinder = mbin

redirect - Default Content on failed require_once -

just started learning php today. , though moved through of problems quickly, got stumped one. i have main page page.php dynamic require_once pull content. got main part working, page.php?id=1 page.php?id=2 etc load fine, if goes page.php without id, there errors ruin page. figured out how repress errors @ , can set links page page?if=default, need solution having page.php load content specific without errors. or, perhaps, automatically redirect page.php page.php?id=default should no id provided. the code current using require_once is: <?php require_once('folder/' . $_get['id'] . '.html');?> thank help! well easiest way check if have id , if not, set default one, that: $default = 1; $id = ($_get['id'] && is_numeric($_get['id'])) ? $_get['id'] : $default; require_once('folder/' . $id . '.html');

performance - Speedy search for JAXB object -

in own benchmark , in other web links, jaxb faster parsing xml files compared dom library. however, when tried search jaxb object root object, speed disappointing compared dom. for search jaxb, used apache jxpath library, i.e., jxpathcontext class , getvalue() method. comparatively, search dom, used document class , getelementsbytagname() method. benchmark shows former slower later. so here dilema, if want parse xml files fast, want use jaxb, if want search node object quickly, have use dom. wondering whether there optimal way both, example, faster method jaxb object search or jaxb tree traveling jxpath. thanks in advance! am missing obvious here? jaxb marshals java objects. java objects can carry methods. such search method. lot faster having rely on heap of introspection sniff out annotations generic method, since, can skip irrelevant parts of xml default. better: can optimise data structures (the java objects) specific search queries.

python - Zipping files in Django view and serving them -

first of want know bad serve files django situation can handled django chose serve zipped files.in models.py have model class documents(models.model): filename = models.charfield(max_length=100) document = models.filefield(upload_to='docs') allowedgroup = models.manytomanyfield(group) so when normal user log-in displayed documents has permission according his/her group.i want user able download multiple documents(files) @ 1 go.so did added handler downloading multiple files zip file: i used django snippet creating view def download_selected_document(self, request, queryset): if len(queryset)>1: temp = tempfile.temporaryfile() archive = zipfile.zipfile(temp, 'w', zipfile.zip_deflated) in queryset: ##reading file content content = open(settings.media_root+str(i.document),'rb').read() ##name name of file "abc.docx" name = str(queryset[0].docume