Posts

Showing posts from February, 2014

javascript - Uncaught TypeError: Object has no method 'exec' -

i'm using code below , it's working good, when try use jquery @ same time, i'm getting below error, reading posts , think problem no possible extend object.prototype without checking hasownproperty(), don't know how solve that, can give me hand? code: object.prototype.clone = function () { var i, newobj = (this instanceof array) ? [] : {}; (i in this) { if (i === 'clone') { continue; } if (this[i] && typeof this[i] === "object") { newobj[i] = this[i].clone(); } else { newobj[i] = this[i]; } } return newobj; }; error: uncaught typeerror: object function () { var i, newobj = (this instanceof array) ? [] : {}; (i in this) { if (i === 'clone') { continue; } if (this[i] && typeof this[i] === "object") { newobj[i] = this[i].clone(); } else {

gcc - What is an innermost "if" statement and an enclosing "if"? -

Image
first, please allow me post screenshot of man page of gcc. the sentence above second bundle of demo code confuses me, written "so there no way 'else' belong enclosing 'if'." far try idea of author, innermost if statement if(b) , foo(); . intended refer if(b) when said "enclosing 'if'". if guess right, demo code should this: { if(a) { if(b) foo(); } else bar(); } am right? question turns out "enclosing 'if' " is. the "enclosing if" if in body ("inner") if "enclosed". the sentence confuses correct. paragraph states, should put parenthesis shown in second example achieve same result in first example (but without warning gcc ). if want have code suggested indentation of example 1, example correct. now sentence means is: in example 1 else clause belongs inner if , accident (when behaviour in

r - plm: using fixef() to manually calculate fitted values for a fixed effects twoways model -

please note: trying code work both time & individual fixed effects, , unbalanced dataset. sample code below works balanced dataset. see edit below too, please i trying manually calculate fitted values of fixed effects model (with both individual , time effects) using plm package. more of exercise confirm understand mechanics of model , package, know can fitted values plm object, 2 related questions ( here , here ). from plm vignette (p.2), underlying model is: y _it = alpha + beta _transposed * x _it + ( mu _i + lambda _t + epsilon _it) where mu_i individual component of error term (a.k.a. "individual effect"), , lambda_t "time effect". the fixed effects can extracted using fixef() , thought use them (together independent variables) calculate fitted values model, using (with 2 independent variables) in way: fit _it = alpha + beta _1 * x1 + beta _2 * x2 + mu _i + lambda _t this fail -- values near fitted values (which difference bet

python - Unknown command: 'collectstatic' Django 1.7 -

i want static files. use django 1.7 , python 2.7.5 , openshift hosting. when try run: python manage.py collectstatic i get: unknown command: 'collectstatic' type 'manage.py help' usage. in settings.py: ... installed_apps = ( 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'testapp', ) template_context_processors = ( 'django.core.context_processors.static', ) databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': os.environ['openshift_app_name'], 'user': os.environ['openshift_mysql_db_username'], 'password': os.environ['openshift_mysql_db_password'], 'host': os.environ['openshift_mysql_db_host'],

html - Fiddler shows clicking link to a page sends request to another page instead -

a weird thing has been happening in asp.net website. there asp:hyperlink on aspx page navigateurl set page portal.aspx. page gets rendered correctly, link gets rendered <a href = 'portal.aspx'... the weird thing when in firefox click link supposed take me page portal.aspx, redirected page (the website's error page). checked suspected exception sending me off page , surprise, no server side code ever gets executed when link clicked. i asked fiddler going on, , seems when click link portal.aspx, firefox asking server error.aspx. anyone knows why firefox behaving way? caching responsible part of this? how tell firefox request portal.aspx , not wrong page? edit: know page there, , works fine time. there no error anywhere because no server-side code gets executed. if session expires , page displays error once, on - according fiddler - firefox won't ask for portal.aspx. clicking links sends request url 'error.aspx" server. convinced caching issue.

Clicked on single div of main div container, other divs of main container needs to dont work click event on them.(Jquery) -

i have 12 divs in main div container.they have different ids respectively.each div has 6 buttons. when 1st div button being clicked dont allow click on other div's button untill count equals 6. when count equal 6 next div available click. is there solution in jquery? have tried out didn't how that. thanking in advance. this question highly vague i'm guessing here, want add handler clicks main div itself. so main div has id main , assuming structure this: <div id="main"> <div> <button>a</button> <button>b</button> <!-- ...more buttons --> </div> <div> <button>a</button> <!-- ...more buttons<--> </div> <!-- ...more divs --> </div> you handle click events bubble main, like: $("#main").on("click", function (e) { var data = $(this).data("currentdiv") , btndiv = $(e.target).par

haskell - It works when loaded from file, but not when typed into ghci. Why? -

if put following 2 lines foobar.hs f 1 = 1 f x = f (x-1) then $ ghci > :load foobar.hs > f 5 1 but if do $ ghci > let f 1 = 1 > let f x = f (x-1) > f 5 ^cinterrupted. then not return. why? the latter binding overrides former. use in ghci: prelude> :{ prelude| let f 1 = 1 prelude| f x = f (x-1) prelude| :} prelude> f 5 1 or, without layout: prelude> let f 1 = 1; f x = f (x-1) prelude> f 5 1

objective c - How to I parse pdf from url to text in ObjectiveC? -

i trying fetch pdf-data url , parse nsstring in ios-app. libraries fastpdfkit fetches information , displays in new modal viewcontroller not want. should rather loaded , parsed in same viewcontroller. when trying parse quartz shown here: https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_pdf_scan/dq_pdf_scan.html i don't callback ever though page count 1 should be. so how can in single viewcontroller? :d code tried: static void op_mp (cgpdfscannerref s, void *info) { const char *name; if (!cgpdfscannerpopname(s, &name)) return; printf("mp /%s\n", name); } static void op_dp (cgpdfscannerref s, void *info) { const char *name; if (!cgpdfscannerpopname(s, &name)) return; printf("mp /%s\n", name); } static void op_bmc (cgpdfscannerref s, void *info) { const char *name; if (!cgpdfscannerpopname(s, &name)) return; printf

Inbound email with attached file -

i'm creating new web app , need process files (word, pdf) sent via email message (attached files). that necessary have specific email address route file proper destination (its job application service, each job opening have own email address). i'm lost , have no idea begin. thanks lot! there few options here. can: create system poll existing imap account every x minutes. download message, parse , extract attachment. install own email server, , set server run script emails arrive. use third party service receives email , forwards messages http post (such cloudmailin ). i wrote blog post explaining few of options few years rails pretty of still relevant , relevant other languages.

iis 7.5 - How can i prevent router to rout request to the failed server? -

i'm working iis , arr , load balancing working ,but when server fail arr still rout requests failed server. how can prevent router pass request failed server without using nlb ? you need set health test farm. see step 2 - configure health check monitoring: http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/http-load-balancing-using-application-request-routing

html - Elements of different heights suiting the div -

stackoverflow users. i'm on way create responsive design, here comes 1 problem. design based on list schema: <ul> <li>first element code</li> <li>second element code</li> (and on (up 20-30 elements) </ul> so elments float attribute, next each other, long page width lets them. problem have different heights . example: **first li***** **second li****** *************** ***************** *************** ***************** *************** *************** **third li***** **fourth li****** *************** ***************** *************** ***************** *************** ***************** *************** *************** two column layout. first li element (first column) has bigger height 1 in second column. element below first column right under it, second element doesnt fit in space (which left because first element in second column has lesser height) , located next second ele

Finding address of a C struct inside an ELF file compatible to ARM Architecture -

in project defined: (this not real code - abstraction purpose) typedef struct { ... } my_struct; in c file declared: my_struct my_struct_inst; and in other 2 c files used struct declaring: extern my_struct my_struct_inst; and used it's contents. i compiled code arm rvct2.2 , trying find address of structure: 1) when memory being allocated my_struct_inst? on compilation time? on run time? 2) in disassembly can see in .flash_ram section (probably kind of data belongs) there reference like: my_struct_inst % 0x190 got ida. mean? (that struct instance start @ offset 0x190 beginning of .flash_ram section?) 3) how actual address (where struct sitting in memory) being accessed when write my_struct_inst.some_member (should read abi documentation?) the memory structure allocated @ compilation time. the address defined linker script. see address of structure (assuming global variable), need generated elf file (lets call a.elf, example). run: arm-eabi-o

c++ - Errors Printing posix_time -

i having these weird compile errors when trying compile code. outputhandler.h: #pragma once #include <fstream> #include <boost/thread/mutex.hpp> #include "filenotaccessibleexception.hpp" class outputhandler { public: enum warninglevel {info, warning, error, crash}; outputhandler(std::string const& pathasstring) throw(filenotaccessibleexception); void log(std::string const& message, warninglevel const& warninglevel); void log(std::exception const& exception, warninglevel const& warninglevel); private: std::fstream file; std::string path; boost::mutex mutex; static char const * const errorprefixes[]; }; outputhandler.cpp: #include "outputhandler.h" outputhandler::outputhandler(std::string const& pathasstring) throw(filenotaccessibleexception) : path(pathasstring) { file.open(path, std::ios::app); if(!file.is_open()) throw filenotaccessibleexception("could not ope

java - Splitting on "," but not "\," -

this question has answer here: how split comma separated string while ignoring escaped commas? 5 answers i'm looking regular expression match , ignore \, in java's regex engine. comes close: [^\\], however, matches previous character (in addition comma), won't work. perhaps regular expression approach wrong 1 altogether. intending use string.split() parse simple csv file (can't use external library) escaped commas. you need negative look-behind assertion here: string[] arr = str.split("(?<![^\\\\]\\\\),"); note need 4 backslashes there. first escape backslash java string literal. , again escape both backslashes regex.

Execute PHP on a TMPFS mout -

i trying make prestashop faster, made benchmark ab: (virtualbox debian 7.1 + nginx 1.4 + mysql 5.6) php 5.4 + apc ==> 3 req/sec php 5.5 + zop+ ==> 4,5 req/sec with code inside tmpfs mount : php 5.4 + apc ==> 12 req/sec php 5.5 + zop+ ==> 24 req/sec so gain big ! wondering if thing or not use tmpfs mount execute php? hard guarantee consistency between restarts. db part can crucial. depends on app/situation.

angularjs - Calling external Vimeo API from Angular $http -

i've been trying call external api (vimeo) angularjs code, 304 not modified. code: this.$scope.$safeapply(() => { this.$http.jsonp('http://vimeo.com/api/v2/video/75532980.json?callback=?') .success((r) => { this.$log.info("success: " + r); }) .error((e) => { this.$log.info("error: " + e); }); }); the odd thing when call same url fiddler, seems ok , 200 response correct json. here working plunker: http://plnkr.co/edit/pz7rqxb3gureqgfsodhx?p=preview i took answer from: angularjs caching jsonp default you add timestamp query not cached angular. also, modified value of callback json_callback per doc ( angularjs $http ). relative or absolute url specifying destination of request. should contain json_callback string. $http.jsonp('http://vimeo.com/api/v2/video/75532980.json?callback=json_callback&_=' + (new date().gettime())) .success(function (r) {

html - Site links working in Firefox but not in Chrome or Safari -

i'm having trouble getting site links work in chrome , safari. works fine in firefox don't show links in chrome , safari. have link header , "bio", "view reel" , e-mails. can tell me how fix please? code below. thank you! <!doctype html> <html xmlns="http://www.studiogo.tv"> <body align="center"> <link rel="stylesheet" href="format.css"> <map id="home"> <area shape="rect" coords="134,10,902,151" href="http://www.studiogo.tv" /> </map> <map id="links"> <area shape="rect" coords="325,165,426,188" href="http://www.bradgo.com/edit" alt="view reel" title="view reel" /> <area shape="rect" coords="326,187,362,207" href="http://www.studiogo.tv/bgobio.html" alt="bgobio" title="bgobio" /> <area shape=&quo

capitalization - QML TextField how to capitalize the text -

in qml how can have text input box automatically converts inputted text capitals? following doesn't work: textfield { id: myfield objectname: "myfield" ... font.pixelsize: 20 font.capitalization: font.alluppercase .... } you made typo in name of constant should font.alluppercase lower c . if @ logs should see warning this: tsttxtfield.qml:22: unable assign [undefined] int

Vim mapping works in command mode but not when used in autocmd -

i have autocmd in .vimrc : autocmd filetype markdown inoremap <buffer> <cr> <c-o>:call autoumdlist()<cr> when open markdown file, enter insert mode , press <cr> , following error: e15: invalid expression: ^o:call autoumdlist()^m e15: invalid expression: ^o:call autoumdlist()^m press enter or type command continue but if go in insert mode , type <c-o>:call autoumdlist()<cr> works! also, if type following in command mode works: :inoremap <buffer> <cr> <c-o>:call autoumdlist()<cr> what going on here please?! don't understand why autocmd won't work...

java - Get running total of numbers? -

i desperately trying last column of code add middle column numbers in running total.. seems start @ 1 already. also, side question: when input 12.. 11 results, due "y" starting @ 1. there anyway fix in loop? import javax.swing.joptionpane; public class project { public static void main( string[] args ) { string input = joptionpane.showinputdialog( "how many fibonacci numbers wish see?" + "\n" + "choose 1-50!"); int numfib = integer.parseint( input ); int numbers[] = new int[numfib]; int fibonacci[] = new int[50]; for( int index = 1; index < numbers.length; index++ ) { numbers[index] = index; } for( int x = 0; x < numbers.length; x++ ) { if( x == 0 ) { fibonacci[0] = 0;

c - What is wrong with my implementation for integration using Simpson's Rule -

i creating c program solving integrals using simpsons rule, wrote , runs, after giving program values returns me value definite integral of 0.0000. rechecked every line @ seems well, here's code problem appreciated #include<stdio.h> #include<math.h> float ad(int a, int b, int n) { float f4, f2, z, v, q4=0, q2=0, d, m, fa, fb; int w=2, g=1, k=1, j=1; z=(b-a)/n; fa=6*pow(a,2)+16*pow(a,3); fb=6*pow(b,2)+16*pow(b,3); f4=6*pow(a+z*w,2)+16*pow(a+z*w,3); f2=6*pow(a+z*g,2)+16*pow(a+z*g,3); v=fa+fb; m=v*z; while(k<=n/2) { q4=q4+(z/3)*(4*f4); w=w+2; k++; } while(j<=(n-2)/2) { q2=q2+(z/3)*(2*f2); g=g+2; j++; } d=m+q4+q2; return d; } main() { int x, y, l; float o; printf("enter number x: "); scanf("%d", &x); printf("enter number y: "); scanf("%d", &y); printf("enter number

php - while loop and cleaning code -

i running while loop , pulling data mysql database. the source output looks follows: <li class='list-item'><a itemprop='url' href=/new-years-eve-gossip-bar><div itemscope itemtype='http://schema.org/event'><span datetime='startdate' content=2013-12-31 19:00:00t7:00pm><strong class='highlight'><b>december 31, 2013 @ 7:00pm</b></strong><meta itemprop='enddate' content=2014-01-01 04:00:00:4:00am><meta itemprop='duration' content='0000-00-00t07:00'><img itempromp='image' src=/images/venues/15-4-gossip-bar-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>gossip bar & restaurant</h3><h5><div itemscope itemtype='http://schema.org/postaladdress'><span itemprop='streetaddress'>733 9th avenue</span>, <span itemprop='addressregion'>ny</span>, <sp

python - Dict-like object with no __getitem__, __setitem__ -

if import gdbm db = gdbm.open('foo', 'cs') you object is: <gdbm.gdbm @ 0x7f0982b9aef0> you can set keys , values in database via: db['foo'] = 'bar' print db['foo'] i wanted use these twisted , make wrapper __getitem__ , __setitem__ returns deferreds. however, noticed peculiar: in [42]: dir(db) out[42]: ['close', 'firstkey', 'has_key', 'keys', 'nextkey', 'reorganize', 'sync'] this object hasn't got __getitem__ , __setitem__ . trying either of these gives attribute access error. yet, behaves dictionary. sort of object this? (i suspect c extension object, find odd has dict-like access methods, no __getitem__ , __setitem__ methods. pointer python doc describing behavior helpful.) further: how references db.__getitem__ , db.__setitem__ if wanted wrap them in deferred? solution see wrap db in utility class: class db: def __init__(self, db):

operating system - how are global variables stored differently in memory than local variables -

i'm reading book on operating systems , says "we must set things portion of added space allocated global variables tensions allocated life time of program, portion allocated local variable remains allocated while thread in variables scope" what don't understand when program loaded memory isn't addresses reserved static? it's not when variable goes out of scope operating system sees address space variable (is?) @ can used program now, or it? the book says global variables stored in memory , local variables stored in run time stack. first of run time stack in memory don't see distinction. how operating system know how space allocate run time stack since number of items pushed on can't determined before runtime? when book says "global variables stored in memory", referring heap, different stack. both memory different types of memory. see here more details: http://www-ee.eng.hawaii.edu/~tep/ee160/book/chap14/subsection2.1.1.8.h

python - Detecting if client has disconnected -

i developing web-application on gae using webapp2 web framework. 2 player game multiple instances of game being played simultaneously. server acts path communicate game playing data between 2 computers , validate it. the clients communicate server http request only. to this, make table in store ip address, userid (by using cookies), , username (if user has signed up) of both users , address game instance playing. until , unless game finishes (either player wins) not remove entry in table, realized, if one(or both) of players disconnects before game ends or there network error causing one(or both) of players quit. how come know game no longer active, can remove entry table , notify player still waiting opponent move? you can: add last_action = datetimeproperty(auto_now=true) in user model add ended = datetimeproperty() in game model create method search users last_action < - x minutes , , set ended property of games users create method delete games ended

ios - Runtime error: Unrecognized selector sent to instance -

Image
i'm new using mac , ios development. today followed this tutorial on how bind data table view making use of prototype cells , story board. i've got part of tutorial should able run app bound data shows in uitableview this: my app compiles fine, starts running hits runtime error: [viewcontroller viewcontrollers]: unrecognized selector sent instance i have tried going through tutorial several times now. i've followed tutorial says , have created 3 different projects scratch make sure nothing going wrong. can me fix error? i've spent hours trying work out what's going wrong, , don't want give ios development seems exciting compared other platforms! unrecognized selector means there undefined method being called. one thing see if there compiler warnings. give any? have look, may give clue undefined. the tutorial refers viewcontroller class. looks class used briefly @ start of tutorial replaced class. may remove class later on altogether. ch

Android - Change Layout with an animation -

this first week of android development , having troubles please patient me. this simple other answers weren't clear or detailed enough me apply it. i trying switch "activity_main.xml" second .xml after button click. have connected button , put in setcontentview(r.layout.view) , works want animate. want view come right , opposite when user press back. doing in eclipse if helps. thanks in advance! assuming you're after transition between 2 activities, here's you're going need do: create new activity class. example, lets name mysecondactivity. in new activity class, make sure you're inflating new layout xml. in original activity class, open new activity intent, on new activity, call overridependingtransition animation want: code sample: intent intent = new intent(this, mysecondactivity.class); startactivity(intent); getactivity().overridependingtransition(android.r.anim.slide_in_left, android.r.anim.slide_out_right); in example,

qt4 - Reading from barcode as one input -

i have issue textchanged() signal, basicly reading barcode unfortunately mine reads barcode series of input witch makes textchanged() emitted many times. searching on stackoverflow give me 2 questions: c# winform + barcode scanner input, textchanged error , detecting when barcode scanner ends input , first solution couldn't transfer code make work me(i don't code in c#), , second sounds easy fail read ending line application: connect(ui->matedit, signal(textchanged(qstring)), this, slot(getemployee(qstring))); void employeedaylogger::getemployee(qstring id) { char c = id.toascii(); if(c == '\n') { compilation output: ..\..\..\qt\qt4.8.3\include/qtcore/../../src/corelib/tools/qbytearray.h: in member function 'void employeedaylogger::getemployee(qstring)': ..\..\..\qt\qt4.8.3\include/qtcore/../../src/corelib/tools/qbytearray.h:383: error: 'qbytearray::operator qnoimplicitboolcast() const' private ..\employeedaylogger.cpp:152:

Powerbuilder GET request with request headers -

i'm accessing restful api using powerbuilder. have working fine however, call api , include request headers. reason need because api accepts "content-type" request header, can set either "application/xml" or "application/json". here have done far: inet iinet_base n_ir ir getcontextservice( "internet", iinet_base ) create n_ir li_rc = iinet_base.geturl( "http://api.com/apicall", ir ) ls_result = ir.of_getresultdata_string() the above return data expected. request must request, not post. how add request header geturl request? ended not using inet object , instead using else. long story short, i'm using oleobject this lole_send.connecttonewobject("msxml2.domdocument.6.0") lole_srvhttp.connecttonewobject("msxml2.serverxmlhttp.6.0") lole_srvhttp.open("get", "http://api.com/apicall", false) lole_srvhttp.setrequestheader( "content-type", "application/json&q

vb.net 2010 - Issue with tableadapter.insert -

i new programming , trying learn vb.net through youtube tutorials. tried create separate forms "login" , "create new account". login seems work fine. however, create account becomes difficult me code it. main issue have "insert" code. created "createnewaccount" form , connected database it. write code under "btnsave" when people create new account saved database. keep getting issues. says "userspasswordstableadapter1.insert" underlines time , program wouldn't work. here codes. helpful. imports system imports system.data imports system.data.oledb public class createnewaccount private sub createnewaccount_load(sender object, e eventargs) handles mybase.load me.userspasswordstableadapter1.fill(me.userspasswordsdataset1.userspasswords) end sub private sub btnsavenewaccount_click(sender object, e eventargs) handles btnsavenewaccount.click loginpage.userspasswordstableadapter1.insert(me.textbox1.text, me.t

ios - UIImageView subclass needs to handle resize -

i creating uiimageview subclass display audio waveform. approach load file, math, save png file , self.image = thepng . nice part on resize or repaint uiimageview stretch png , stretch quickly. now if image expanded need recalculate waveform avoid visible pixelation. since know uiimageview not call drawrect , there method called during resize can decide if redrawing necessary? p.s. when recalculating fading in new image after calculated. seamless user google earth. here's solution: - (void)layoutsubviews { [super layoutsubviews]; nslog(@"%@", nsstringfromcgrect(self.frame)); } the trade off is not called each frame of animation, pointed out david jeske in is there uiview resize event? other ideas didn't work: override setframe:(cgrect)frame discussed @ is there uiview resize event? listen key-value observation, discussed @ https://groups.google.com/forum/#!topic/ococoa/uojau8rclwo

java - How to manage Continuous Changing values in an array of strings -

i have array of strings values in array changing continuously changing. there other way of managing array except removing items , changing index locations? public int[] deviceid=null; deviceid=new string[devicecount]; in case devicecount changing new device comes. continuously need change array size , add or remove items java offers handy mechanism known arraylist. it's dynamic array can use you're describing. http://docs.oracle.com/javase/7/docs/api/java/util/arraylist.html

Gruntjs throwing error with requirejs task -

Image
i'm trying setup simple gruntjs task using requirejs on windows 8, when run keeps producing follow command line error. package.json: { "name": "my-app", "version": "0.0.1", "devdependencies": { "grunt": "~0.4.1", "grunt-contrib-requirejs": "~0.4.1" } } gruntfile.js: module.exports = function(grunt) { grunt.initconfig({ pkg: grunt.file.readjson('package.json'), requirejs: { compile: { options: { appdir: "../", dir: "../../build", fileexclusionregexp: /^(r|build)\.js$/, mainconfigfile: "js/main.js", removecombined: true } } } }); grunt.loadnpmtasks('grunt-contrib-requirejs'); grunt.registertask('default', ['requirejs']); }; i used npm install in directory, installed depe

How can replace this using sed? -

i'm using os x, want replace [self.lang getapplanguagestring:@"foo bar"] to localizedstring(@"foo bar", nil) i use sed below: sed -i '' s/[self\.lang getapplanguagestring:@"([a-za-z]+)"]/localizedstring(@"\1", nil)/g somefile but not work, how can that? you've escaped . in pattern, need escape [ , ] . try: sed -i 's/\[self\.lang getapplanguagestring:@\("[^"]*"\)\]/localizedstring(@\1, nil)/' somefile

ios - Obtaining values of an attribute through relationships using Core Data - Currently passing NULL -

i have core data model 3 entities: transaction, occasion, person , when i'm fetching in transaction entity, getting "null" value in database. let me explain. transaction in case, entity has relationships person , occasion. person entity has name attribute , relationship transaction entity. transactions (person entity) < ------ >> whoby (transaction entity). there relationship categories attribute (occasion entity) < ---------------- >> event (transaction entity). i @ basic stages of app. have 1 table view controller , when press plus button, you're asked, in modal view, add name , occasion. both displayed in table view name being main text of cell , occasion being subtitle. when add inserted values user directly person entity, representing name attribute, works , see in table view. same goes occasion (separately person). however, when add data directly transaction entity , use fetchrequest bring that, every time press save pass value ,

javascript - Supersized - choose different set of slides -

i using supersized plugin site , know if possible do following: i have 5 sets of pictures, 2 pictures in set. when page loads, play randomly 1 set , stop. basically, want supersized choose different set of slides each time page reloads. thank help. i figured myself: var setnum; setnum = math.floor((math.random()*5)+1); switch (setnum) { case 1: jquery(function($){ $.supersized({ // functionality slide_interval : 5000, // length between transitions transition : 1, // 0one, 1-fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left, 6-carousel right, 7-carousel left transition_speed : 3000, // speed of transition stop_loop : 1, //pauses slideshow upon reaching last slide. // components slide_links : 'blank', // individual links each slide (options: false, 'num', '

ruby on rails - How to remove default initial second nested field? -

hi im using nested_forms rails. https://github.com/ryanb/nested_form is working great problem every time user edit info, default new field added, need new field added until user clic "add more" in link can see usage of gem documentation dosent this.. here code: <%= f.fields_for :citizens |citizen_form| %> <div> <%= citizen_form.label :citizen, t('generales.citizen') %> <%= citizen_form.select :country_id , country.all.collect {|p| [ t("generales."+p.iso), p.id ] }, { :include_blank => true } , { :class => 'pca33' } %> <div id="delerr"><%= citizen_form.link_to_remove t('generales.delete') %></div> </div> <% end %> <%= f.link_to_add t('generales.add'), :citizens %> ok found answer.. here way this. @project.tasks.build unless @project.tasks.any? wich in case was. @player.

python - pycharm remote project with virtualenv -

i have remote server few virtualenv environments (django projects). how can open, develop , debug these projects remote? shall mount remote directory via sshfs open project? (i can't open project other way local path) working on debian , windows xp. i've found decision , asked support confirmed its: here steps: copy project local directory. configure: tools - deployment, upload local copy remote server make deployment automatic: tools - deployment - "automatic upload" add remote interpreter: file - settings - python interpreters - "+" - "remote.." the remote interpreter virtualenv interpreter packages installed. debug works, can debug remote project on server using local pycharm.

c++ - Type checking template class parameters -

i trying achieve type checking of template class parameters disallowing implicit type conversions such string->bool thereby throwing compile error. specific scenario simple 1 follows: #include <iostream> #include <string> using namespace std; template <class t> class mypair { t a, b; public: mypair(t first, t second ) { = first; b = second; } void test(); }; typedef mypair<bool> boolparm; template<class t> void mypair<t>::test() { if(a == true) { cout << "a true" << endl; } else { cout << "a false" << endl; } if(b == true) { cout << "b true" << endl; } else { cout << "b false" << endl; } } int main() { boolparm myobj(false, "false"); myobj.test(); return 0; } the output of above scenario undesirable since user may inadvertently pass 2 different types: bool , string , receive first 1 false (correct sin