Posts

Showing posts from May, 2010

scala - Implicit conversion not working with type-safe builder pattern -

i using scala type-safe builder pattern simple rest request. works great fluent api. sealed abstract class method(name: string) case object extends method("get") case object post extends method("post") abstract class true abstract class false case class builder[hasmethod, hasuri]( method: option[method], uri: option[string]) { def withmethod(method: method): builder[true, hasuri] = copy(method = some(method)) def withuri(uri: string): builder[hasmethod, true] = copy(uri = some(uri)) } implicit val init: builder[false, false] = builder[false, false](none, none) //fluent examples val b1: builder[true, false] = init.withmethod(get) val b2: builder[true, true] = init.withmethod(get).withuri("bar") i make more dsl-like allowing method instance converted builder instance, when add try implicitly include init builder combination of implicit conversion , type parameters confuse compiler. implicit def tomethod[hasuri](m: method) (impli

vhosts - Laravel Pagodabox v-hosts -

ok have site works find locally when set vhosts so: <virtualhost 127.0.0.7> documentroot "c:\xampp\htdocs\mysite\public" servername myserver <directory "c:\xampp\htdocs\mysite\public"> options indexes followsymlinks multiviews allowoverride </directory> however, when push pagodabox page works home page. when try login, register etc 404 error page. have same problem locally if don't set vhosts. know whats wrong?

ios - view doesn't come back after video plays -

i'm running following code. video plays fine after finishes goes black srcreen, original view never comes back. when tap on black screen see message "loading....." can please explain i'm doing wrong. thanks - (ibaction)video:(uibarbuttonitem *)sender { { nsurl *url = [nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"img_0973" oftype:@"mov"]]; movieplayer=[[mpmovieplayercontroller alloc] initwithcontenturl:url]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:movieplayer]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackdonepressed:) name:mpmovieplayerdidexitfullscreennotification object:movieplayer]; movieplayer.controlstyle=mpmoviecontrolstyledefault; //movieplayer.shouldautoplay=no;

d3.js - scale incoming metric data for representation in cubism -

i have data set being returned cubism 's metric such has values 0 = bad 1 = okay 2 = bad i can write d3.scale such var ord = d3.scale.ordinal( [ 0, 1, 2, null ] ).range( [ -2, 2, -1, null ] ); for( var i=0; i<=2; i++ ) { console.log( + ': ' + ord(i) ); } console.log( 'null: ' + ord(null) ); and terminal returns 0: -2 1: 2 2: -1 null: null looks good... however, when try applying scale cubism horizon chart, chart renders fine, except data represented doesn't show bad values negative , positive: d3.select("body").selectall(".horizon") .data( metrics ) .enter().insert("div", ".bottom") .attr("class", "horizon") .call( context.horizon() .scale( d3.scale.ordinal([ 0, 1, 2, null ]).range([ -2, 2, -1, null ]) ) ); what doing wrong? check horizon.extent([extent]) https://github.com/square/cubism/wiki/horizon

c# - Updating data in usercontrol2 from usercontrol1 update button -

i've have usercontrol houses other usercontrols within tab items. made visible , cleared interaction various checkbox's on parent usercontrol (all working). i've validation , writetodatabase functions in place works parent usercontrol. need have happen when "update" (utilizes commandbinding) button on uc1 clicked, relevant child uc data on other tabs saved db well. i've got validation work stumped in saving data of uc2/uc3/uc4 etc. ... pointers welcome. ps i'm trying keep uc's loosely coupled possible... i'm beginner please gentle (step step’s appreciated) thanks in advance. you put save event on each child control, , have parent page/control subscribe events. can ask child controls save themselves.

c++ - Pointer to class -

i have been trying write fraction class , overload of operators (+, -, -, /...). @ first, tried this: fraction& operator+(fraction& rightop) { fraction result; result.num = num * rightop.den + den * rightop.num; result.den = den * rightop.den;; return result; } this produced awkward result. while testing, if used: fraction a(2,3); fraction b(4,5); fraction c = + b; cout << c << endl; it print correctly. however, if used: fraction a(2,3); fraction b(4,5); fraction c; c = + b; cout << c << endl; it print -858993460/-858993460. then, when tried change overloading function to: fraction& operator+(fraction& rightop) { fraction* result = new fraction; result->num = num * rightop.den + den * rightop.num; result->den = den * rightop.den; return *result; } it work well. got me confused pointing classes in c++, not understand why first 1 fails in specific case. appreciate explanation. thanks in

c# - How to remove *Response convention in service stack? -

i trying stand service using service stack. service needs meet soap 1.1 standards. now operation object trying use called sendgetaccountresponse , created no response class async service. when run project operation / message not exist. now if go , rename dto sendgetaccountr_esponse or sendgetaccountnotification operation appears , can call operation. something tells me there kind of convention stops operations response @ end of displayed , used request object. does know / how can turn conventions off? dto naming conventions naming convention: {request dto name} + response example: request dto: deletecustomer --> response dto: deletecustomerresponse. if leave services are, rest endpoint wouldn't exist. need hook them on same url. https://github.com/servicestack/servicestack/wiki/soap-support the {requestdtoname}response convention not removable. it's used guess response of matching request dto should default. response type can overridden specif

algorithm - which android toolkit functions/classes would I need to use to implement a slingshot mechanism in an android game? -

which android toolkit functions/classes need use implement slingshot character control mechanism? (for android game) want character can fly around repeatedly being slingshotted on angry birds (only repeatedly). appreciated. also, implement framework presented in here if possible, since followed tutorial succesfully , completed it. can @ least point me in right direction research? alright i'm sorry asked question, did more research , watching andengine tutorials can try figure out how make slingshot mechanism myself using framework. mind canceling minus' can post correct specific questions again? that require lot of mathematics. also, lot of drawing. for android part, can start view , implement ontouchevent . http://developer.android.com/reference/android/view/view.html#ontouchevent(android.view.motionevent) although, sure there more effective way of creating game android. possibly using type of rapid development kit reduce amount of background code you

ruby - How do you call "contains?" on a MongoMapper Array in Rails 3? -

i want know how check if array element exists inside of mongomapper array. this question closest find, addresses queries rather using document have. my user model contains line key :roles, array the 'roles' array contains strings such 'admin' or 'user.' authorization, need call following method on instance of user: if user.roles.contains?('admin') # administrative stuff. end but when try call 'contains?' ruby complains there no such method: nomethoderror (undefined method `contains?' #<array:0x007fc845cd8948>): app/models/ability.rb:11:in `initialize' app/controllers/settings_controller.rb:5:in `index' if there's no way this, how convert array ruby array call 'contains?'? calling to_a isn't doing it: if user.roles.to_a.contains?('admin') # etc... i'm using rails 3.2.13, ruby-1.9.3-p392, , mongomapper 0.12.0 on mountain lion. the function looking include? ,

if statement - python. if var == False -

in python can write if statement follows var = true if var: print 'i\'m here' is there way opposite without ==, eg var = false if !var: print 'learnt stuff' use not var = false if not var: print 'learnt stuff'

javascript - How to receive an event when selected option is the already selected option of a dropdown? -

motivation: i want dynamically load select values ajax call, , allow user select first item in list once loaded , after gets focus, right now, first item selected item , when click dropdown , click first item nothing happens. can't add placeholder items not valid selections. question: how fire .change event in jquery when selected option reselected / not changed? given following : <select id="myoptions"> <option id="one" >option 1</option> <option id="two">option 2</option> </select> assuming option one selected, , click on dropdown , select one again, event fires? $('#myoptions').change(function() { alert('you selected something!'); } the above code works if select different, if select selected option nothing happens. in other words : if click on dropdown , "select" selected option, how event fire? not answers: all these suggestions trigger not

How to export a C array to Python -

i have file.cc contains array of doubles values, seen here: double values[][4] = { { 0.1234, +0.5678, 0.1222, 0.9683 }, { 0.1631, +0.4678, 0.2122, 0.6643 }, { 0.1332, +0.5678, 0.1322, 0.1683 }, { 0.1636, +0.7678, 0.7122, 0.6283 } ... continue } how can export these values python list? i cannot touch these files because belong external library, subject modification. exactly, want able update library without affecting code. this pretty answered in this other post . but add bit here. need define type use in_dll method. from example made values in values . hope have idea how big or can find out other vars in library, otherwise seg fault waiting happen. import ctypes lib = ctypes.cdll('so.so') da = ctypes.c_double*4*4 da.in_dll(lib, "values")[0][0] # 0.1234 da.in_dll(lib, "values")[0][1] # 0.5678 da.in_dll(lib, "values")[0][2] # 0.1222 from here loop on them reading list.

cakephp Database Design -

my data structure follows: company hasmany regions region hasmany markets market hasmany stores store hasmany employees i have appropriate belongsto necessary. i used foreign keys associations. example, each store has market_id. when delete company record, correct region deleted. however, occurred me need associated markets, stores, , employees deleted. or if deleted market, need stores , employees deleted. what appropriate manner of accomplishing this? would add additional foreign keys tables? example, stores need region_id , company_id in addition market_id? use dependent association: http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasmany dependent : when dependent set true, recursive model deletion possible. in example, comment records deleted when associated user record has been deleted. you don't need add additional foreign keys.

c# - CheckBox All only works first two times -

i put checkbox 'check all', , code works first check , uncheked. after none of checked box follows attribute of checkbox of 'check all' <script type="text/javascript"> $(function () { $('#chkall').click(function () { $('#divchk .chk input:checkbox').attr('checked', function () { return $('#chkall').prop('checked'); }); }); }); </script> <body> <form id="form1" runat="server"> <div class="bigdiv"> <asp:checkbox id="chkall" runat="server" text="check all" /><br /> <div id="divchk"> <asp:checkbox id="checkbox1" runat="server" text="1" cssclass="chk" /><br /> <asp:checkbox id="checkbox2" runat="server

java - Overriding with Superclass Reference for Subclass Object -

i have been moving through couple of books in order teach myself java , have, fortunately, due luck, encountered few difficulties. has changed. i read section on following under inheritance , whole superclass subclass setup -- when new superclass object created, is, objects, assigned reference (superreference in example) -- if new subclass object (with defining subclass extending superclass) created, , superreference reference set refer instead of original object, understanding that, since reference made superclass, members defined superclass may accessed subclass. first - correct? second: if overriding method , therefore have 1 in super , 1 in sub, , create superclass object , assign reference, did above, subclass object, principle called dynamic method dispatch, called overridden method should default accessing subclass method right? well, question is: if reference superclass-object retooled subclass-object , deny direct object.member access subclass-defined members

android - No hardware "Options" button , How to get option menu to appear? -

i using this: android:theme="@android:style/theme.notitlebar.fullscreen" . menu works fine devices comes "hardware options button" @ bottom ,menu items appear expected on bottom of screen . how make "options" button appears device doesn't have "hardware button"? what looking : see screenshot if disabled (fullscreen) style menu show @ upper right corner ,as expected too. that "button" referring in screenshot available if application has target sdk value below 11 in manifest, because compatibility trick applications expect device hardware menu button , haven't been update use action bar menu. if use action bar menu, expectation not hide user (at least no permanently).

c# - Issue with importing tlb into c++ client code -

suppose have following definitions : namespace baseifsnamespace //defined in assembly a1 { [comvisible(true)] [guid("2e6cb2b7-8884-4250-87a5-83bf52ee5d29")] public interface baseifs { void testm(string s1); } } and namespace derivedcom //defined in assembly a2 { [comvisible(true)] [progid("derivedcom.derivedcom")] [guid("ac01fd21-4708-4296-9b2e-b268bc1d880b")] //[classinterface.none] public class derivedcom : baseifs { public void testm(string s1) { //some implementation } } } i generate type libraries a1.tlb , a2.tlb correspondingly. when use a2 in c++ client code following #import "c:\path11\derivedcom.tlb" no_namespace raw_interface_only i got error c1084 typelibrary cannot imported. how correctly should generate tlbs ( checked regasm ) , there need somehow define a2.tlb depends on tlb1 ? saw related post here , know openning ole

Mongoose Schema for hierarchical data like a folder > subfolder > file -

how create hierarchical schema file system var folder = new schema({ 'name' : string, 'isfile' : number, 'children' : [folder] }); can thing ??? the schema you've used embeds children folders inside parents. work, has couple of problems. the first size of each folder document pretty big, depending on size of file system, , might run issues hitting size limits. the other issue makes difficult directly find documents aren't @ top level. a better solution store parent/child relationship references. var folder = new schema({ name: string, isfile: boolean, parent: { type: schema.types.objectid, ref: 'folder' }, children: [{ type: schema.types.objectid, ref: 'folder' }] }); the ref property indicates in collection/model mongoose should looking referenced document, can find if query it. in case reference parent, folder, , list of chilren, documents of type folder.

format - Replace string where it has .rpt -

i want read string in java has like xyz.rpt abcde.img erhteds.doc aqwer.rpt and modify string has .rpt in it. if string has .rpt @ end need change .doc output: xyz.doc abcde.img erhteds.doc aqwer.doc the following code should replace last occurance of '.rpt' '.doc' if read line line stringbuilder b = new stringbuilder(yourstring); b.replace(yourstring.lastindexof(".rpt"), yourstring.lastindexof(".rpt") + 1, ".doc" ); yourstring = b.tostring(); note throw exceptions if string doesn't contain '.rpt'

javascript - jwplayer 360p video takes to load -

i have problem plugin jwplayer has 2 medium 240p , 360p on localhost performs normally. when sending hosting takes long load video in 360p @ 240p loads faster, in fact think he's waiting load whole video play. my code : <script type="text/javascript"> jwplayer("container").setup({ height: "97%", width: "100%", primary: "flash", allowscriptaccess: "always", autostart:true, playlist: [{ image: "uploads/snapshots/374f9c59b58f880c5e68762bde43318a.jpg", sources: [{ file: "uploads/374f9c59b58f880c5e68762bde43318a.mp4", label: "360p" },{ file: "uploads/374f9c59b58f880c5e68762bde43318a.flv", label: "240p" }] }], }); </script>

How to get Selected Row of WPF Devexpress TreeList in .NET? -

i new devexpress controls. have added treelist control on form bind using entity. want selected column value i.e id in .xaml file: <dxg:treelistcontrol name="treelistcontacts" itemssource="{binding data, source={staticresource entityservermodedatasource2}}" autopopulatecolumns="true" horizontalalignment="left" margin="10,19,0,0" verticalalignment="top" height="317" width="180" focusablechanged="treelistcontacts_focusablechanged"> <dxg:treelistcontrol.columns> <dxg:treelistcolumn fieldname="company_id" readonly="true" width="30" visible="false"/> <dxg:treelistcolumn fieldname="companyname" readonly="true"/> </dxg:treelistcontrol.columns> <dxg:treelistcontrol.view> <dxg:treelistview showtotalsummary="true&

postgres, ubuntu how to restart service on startup? get stuck on clustering after instance reboot -

i have postgres db 9.1 running on aws ec2 , ubuntu 12.04 . i messed lot instance (i.e installed kinds of postgres x.x before settled on 9.1). now after month working on db, discovered if restart instance postgres doesn't load correctly, status says "running clusters". last forever until i sudo service postgresql restart from terminal, , works again. how add line, ubuntu startup each time loads, restart service, , solve problem? also other solution might solve this. i guess best fix database startup script itself. work around, can add line /etc/rc.local , executed last in init phase.

c# - Open File Which is already open in window explorer -

i trying open file using openfiledialog . if (openfiledialog1.filename != "" && resultsavedialog == system.windows.forms.dialogresult.ok) { openfiledialog1.openfile(); // throw exception here txtfilename.text = openfiledialog1.safefilename; } but if file opened in window explored throws me following exception the process cannot access file 'd:\projects\cdr_raw_files\groupdata\8859511378.xls' because being used process. is possible open file using openfiledialog if file has opened in window explorer. ok, if need selected file name , path, try below, you... if (openfiledialog1.filename != "" && resultsavedialog == system.windows.forms.dialogresult.ok) { string path = path.getdirectoryname(openfiledialog1.filename); string filename = path.getfilename(openfiledialog1.filename); txtfilename.text = filename; }

Creating SQL Server database with data and log file on synology NAS Server -

i need create new database application. planned put data files on nas server (synology 812). tried create database using different paths 2 days nothing worked. @ bottom can see example path n'\\10.1.1.5\fileserver\... i tried 'n\\10.1.1.5\**volume1\fileserver**\payroll.ldf' because synology admin interface properties dialog shows path fileserver shared directory. fileserver shared folder. can reach folder file explorer. \\10.1.1.5\fileserver\ and can create new file or folders inside using windows explorer. unluckily create statement not work. create database payroll on ( name = payroll_dat, filename = n'\\10.1.1.5\fileserver\payrolldat.mdf', size = 20mb, maxsize = 70mb, filegrowth = 5mb ) log on ( name = 'payroll_log', filename = n'\\10.1.1.5\fileserver\payroll.ldf', size = 10mb, maxsize = 40mb, filegrowth = 5mb ) go i happy if has solution problem. t

drupal - Multilingual site and views -

i have content type: (filed_name1_en, field_name1_de, filed_name2_en, field_name2_de) , want make view if enter site in english view must display (filed_name1_en, filed_name2_en) fields , if enter site in german must display (filed_name1_de, filed_name2_de). how can that? you making complicated. create 'content types' need, 'views' support them, , turn on content translation, , locale modules. keep simple.

iphone - Why can't I change the tag on my UIButton? -

i have nsstring "s21" , trying convert numbers button's tag. i doing: nsstring *temp = [[array objectatindex:0] stringbyreplacingoccurrencesofstring:@"s" withstring:@""]; [_b0 settag: [temp intvalue]]; _b0 uibutton. i running nslog check tag after run settag, button's tag doesn't change , remains 0. what doing wrong? just check iboutlet connection of uibutton if creating through nib file.

sql - Surrogate key 'preference' explanation -

Image
as understand there war going on between purists of natural key , purists of surrogate key. in likes this post (there more) people 'natural key bad you, use surrogate... however, either stupid or blind can not see reason have surrogate key always! say have 3 tables in configuration this: why need surrogate key it?? mean makes perfect sense not have it. also, can please explain why primary keys should never change according surrogate key purists? mean, if have color_id varchar(30) , key black , , no longer need black because changing charcoal , why bad idea change black key charcoal , referencing columns too? edit: noticed dont need change it! create new one, change referencing columns (same have surrogate key) , leave old 1 in peace.... in surrogate key mantra need create additional entry with, say, id=232 , name=black . how benefit me really? have spare key in table don't need more. need join colour name while otherwise can stay in 1 table , merry? pleas

c# - Add string after a specified string -

say have following html string <head> </head> <body> <img src="stickman.gif" width="24" height="39" alt="stickman"> <a href="http://www.w3schools.com">w3schools</a> </body> i want add string in between <head> tags. final html string become <head> <base href="http://www.w3schools.com/images/"> </head> <body> <img src="stickman.gif" width="24" height="39" alt="stickman"> <a href="http://www.w3schools.com">w3schools</a> </body> so have search first occurrence of <head> string insert <base href="http://www.w3schools.com/images/"> right after. how do in c#. another way of doing this: string html = "<head></head><body><img src=\"stickman.gif\" width=\"24\" height=\"39\" alt=\&quo

java - Guava cache memory leak -

i using guava library 14.0.1 implement caching service (a web application containing servlet put , values). web application deployed on machine containing 1gb ram (google backend). number of write , read operations huge (50 queries per second). the amount of ram used on machine keeps on increasing after hitting maximumsize limit. suspect memory leak. following code using create cache cache cache = cachebuilder.newbuilder() .expireafterwrite(1, timeunit.days) .initialcapacity(2000000) .maximumsize(3800000) .concurrencylevel(50) .recordstats() .build(); retrieving values using map result = cache.getallpresent(keys); putting values in cache using cache.put(key, value); is there setting can use stop increase in ram usage beyond limit. the query rate pretty low, try reducing concurrency (possibly 1-4) , reducing maximum size. given limited resources of machine, suspe

javascript - Passing an event to a collection in backbone -

i trying trigger behaviour on collection triggering event elsewhere in app. pretty new backbone, have syntax wrong, seems should work fiddle var test = backbone.model.extend({ }); var tests = backbone.collection.extend({ model: test, events: { "testevent":"testresponce" }, testresponce: function(){ alert('hello world'); } }); var mytest = new test(); mytest.trigger('testevent'); can done? going wrong? if want call particular method of collection using testevent event can take path also. working demo var test = backbone.model.extend({ initialize: function() { this.on('testevent', function() { console.log(this.collection); this.collection.testresponce(); }); } }); var tests = backbone.collection.extend({ model: test, testresponce: function(){ alert('hello world');

c# - umbraco string trim using razor view -

i have umbraco script im using on site, inside there razor script below: <p>@page.getproperty("maincontent")</p> the above in loop, , shows content each post (its being used on landing page blog functionality) i want trim content outputed getpropery() method 300 charectors. anyone have ideas? also, word opposite of concatenate? you write custom helper: public static class htmlextensions { public static string truncate(this htmlhelper html, string value, int count) { if (string.isnullorempty(value)) { return string.empty; } if (value.length > count) { value = value.substring(0, count - 1) + "..."; } return value; } } which used this: <p>@html.truncate(page.getproperty("maincontent"), 300)</p> also, word opposite of concatenate? split

python - How to get tests coverage using Django, Jenkins and Sonar? -

i'm trying test unit coverage sonar. so, have followed these steps : generating report python manage.py jenkins --coverage-html-report=report_coverage setting properties in /sonar/sonar-3.5.1/conf/sonar.properties : sonar.dynamicanalysis=reusereports sonar.cobertura.reportpath=/var/lib/jenkins/workspace/origami/dev/src/origami/reports/coverage.xml when launch tests, reports generated in right place. however, no unit tests detected sonar. missing step or wrong? i think problem there seem no link between sonar , jenkins. easier make plugins. after installing plugins you'd have add build step in jenkins administration. in order see coverage report in sonar should use "jenkins sonar plugin". force create maven project (and pom.xml) , you're using django (which maven does), may not want. i think want seeing code coverage somewhere , maybe should integrate in jenkins instead of sonar. can use 2 plugins, "jenkins cobertura plugin" ,

database - Connecting via JDBC to OpenEdge in Talend -

in "talend data integration" want create connection using jdbc progress openedge database. have no experience whatsoever type of connection. my odbc-connections same resources work fine, talend requires jdbc connection function properly. the connection settings in talend have @ moment are: db type: general jdbc jdbc url: jdbc:sqlserver://db-name:port;databasename= * * driver jar: ??? (which jar-file need openedge?) class name: ??? (which class name need openedge?) user name: * password: * schema: ??? (don't know means...?) mapping file: ??? (which xml-file need progress openedge?) edit: using windows 7 on 64-bit machine, using talend open studio data integration version 5.3.0.r101800. i found solution: what need set of jar-files provided specific installation of progress openedge. these files, located in folder called "java", not commonly available on internet , should meet exact version using. if necessary, need contact database

java - what kind of error this my First AspectJ -

this put package , code spring.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <aop:aspectj-autoproxy></aop:aspectj-autoproxy> <bean name="triangle" class="edu.itmaranatha.model.triangle"> <property name="name" value=&

eclipse - Compile AspectJ code to Java 6 code with a AspectJ 1.7 installation -

i developing using eclipse 4 , aspectj's latest version. in process of replacing java 6 library modified 1 (binary weaving). problem code being woven java 7 code, , need java 6 code. i know there aspectj's compiler switch, i'd know if it's possible set setting through eclipse (other using ant task, of course). i ended downloading aspectj 1.6. switched jre6 , added aspectrt.jar aspectj 1.6 installation (as needed included in generated binary woven jar) , set java compliance level 1.6. it seems work fine.

ios - Refer to a particular UITextField inside a particular UITableViewCell -

i have uitableview created programatically, , have written code programmatically create uitextfield on each , every cell. when user taps on text field, picker appears , user can select item picker, , after selection made, selection should displayed in text field of particular cell. now problem facing is, whenever tap on text field of table view cells, picker appears correctly, after item picked picker, value gets stored in text field of last table view cell. why happen? could please explain me how refer particular text field can perform action on particular text field? create subclass of uitableviewcell , , use cells. add property reference text field: @interface yourtableviewcell : uitableviewcell @property (strong) uitextfield *textfield; @end then, assign text view cell when create it: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cellidentifier";

html performance issue attributes vs css -

this question has answer here: external css vs inline style performance difference? 7 answers in html, faster in terms of performance , page render time? 1) using tag attributes tags (like adding border, valign, width, height tables) 2) using css define them thanks. given tag attributes defining layout deprecated , considered bad coding practice, it's pretty bet browser vendors focusing resources on making css perform better, , not putting effort @ making tag attributes better. in addition, if have layout defined in separate css file html, benefit performance benefits on inline styles or tag attributes when loading multiple pages, since css file can cached browser , doesn't need downloaded multiple times.

jquery - Hover over link, image appears loop -

i'm building site gallery. have table of exhibitions in simple list format, , i'm after when user hovers on title of exhibition, preview image appears, , when hover off disappears. i'm using wordpress , have core structure in place: i have table have 1 single image displayed, absolutely , set display none have added unique post classes both title of exhibition , image i can't seem link both up. this jquery far thought work: $('table#archive-table td a').hover( var classname = $(this).attr('class'); function () { $('body.archive .first-show-image.'classname).fadein('slow'); }, function () { $('body.archive .first-show-image.'classname).fadeout('slow'); } ); example html: <a class="33" href="#">palomar</a> <div class="first-show-image 33"> <div class="grid_2"> <img src="test.png" /> &l

ruby on rails - Boolean toggle using rails_admin on list view -

i have basic rails_admin application , able toggle boolean value in list view of rails_admin. for example, have scale model attribute 'activated'. when log in rails_admin dashboard see scale model , lists of various scales , activated attribute boolean value. how make value editable in list view can change boolean value view don't have go in edit view edit value? thanks! i made gem time ago purpose - rails_admin_toggleable

json - Worklight: JsonStore behaviour on hard install of new version -

i not sure if release new version of app on app store , users installed. in case, existing jsonstore data of previous version of app, there or wiped out ? if remains good, otherwise workaround can here. suggestions, please. thanks please note asking on stackoverflow not replacement rigorous unit , functional , etc. tests , having quality assurance part of development processes. advice test if you're not already: install worklight application app store, upgrade new version , check if still working... before going production. as long don't change collections' metadata (name, search fields, additional search fields, etc.) jsonstore should keep working fine when upgrade.

angularjs - dynamic directive compile passing the right scope -

i have dynamic directive compiles given directive, problem on compile function need provide right scope it, jus thinking how this? example of directive below, 'directive' scope input dynamic, example <display-users data="users"/> user part of controller loads directive. although below compilation works correctly, since not asscociating compilred code right scope (in above case controller one) not diplay users. please can help? theapp.directive('customcompile', function ($compile) { var dir = { replace: true, // replace original html ? required restrict = "m" restrict: 'e', //can 1 or more of e / / c / m scope:{ directive:'=' }, controller: function ($scope, $http, $attrs) // controller directive { }, compile: function compile($element, $tattrs, $transclude) { return{

jquery - How to retrieve elements from sortable into array -

so have been working in this:( http://jsfiddle.net/2phuw/5/ ) last couple hours. me out figure out following: 1) in source sortable abbreviation wat, ura, or mox needs shown 2) when target filled, :params[:ready] = true 3) when target filled following code updates accordingly <ul> <li><i class="icon-edit"></i> not ready </li> <li><i class="icon-check"></i> ready </li> </ul> 4) when target filled, :params[:comp] gets sorted elements of target array: ie-> [:wat,:ura,:mox,:wat,...] thanks in advance

html - Text-align right not working in IE7 -

i have table being generated 1 of columns needs text aligned right. right looks this: <td class="generatedclass" id="generatedid" style="width:20px; text-align:right;"> <label id="generatedrowid"> text here </label> </td> it works in ie9 , ie8, reason not ie7. have idea why might not working? note, inline styles being created json objects. don't having inline styles, wasn't call. your code looks should work. probably, ie7 not updating dom after these inline styles being applied. i recommend opening page in ie10 , going ie7 page mode. should able inspect styles on element , find out if they're being applied, overridden, etc.

python - How to combine two queryset lists in django with first list after the second list -

i have below queryset in code. new_date = date.today() - timedelta(days=7) most_viewd_list = mytable.objects.filter(show_on_website=true).order_by('-most_viewd') new_list = most_viewd_list.filter(date_created__gte=new_date) now, want create new list (results_list) have new_list rows @ beginning followed most_viewed_list. i have tried options mentioned in how combine 2 or more querysets in django view? , none of them working. i tried below option... itertools import chain result_list = list(chain(new_list, most_viewd_list)) but option if use result_list.count(), throwing error. and results_list = new_list | most_viewd_list option, not getting desired result. can tell me how can create list have new_list rows followed most_viewed_list rows. thanks your code creating list (of type want). take length of list len : len(result_list) .

ruby on rails - Savon 2.1 adding attributes to message XML tags -

i trying add atribute 1 of xml elements generating soap request making. i see savon has attributes hash, adds attributes soap message tag. there equivalent feature have not come across generated xml in message body? ie have tag in message body <clientdata></clientdata> i able able like <clientdata id=1></clientdata> is possible using savon hash syntax? well ended digging gyoku(the gem savon uses form xml) , found has special hash called :attributes! key. calling , passing in hash of elements specified attribues , value did needed. ie asked aove :attributes! => { "clientdata => { :id => 1 } } at end of :message option did trick.

FlexSlider: Always show snippet of the next slide -

Image
anybody know how might set flexslider always reveal portion of next slide? example: it always, not when hovered over, etc. essentially, entices viewer continue looking through panels. naturally, i'd set slideshow: false . i figured out; it's not perfect , it's great start: .flex-active-slide + li { left: -1%; position: relative; } this says, "hey, target next <li> adjacent sibling of .flex-active-slide (which active/visible slide), , move left small amount."

c++ - Using DirectInput to receive signal after plugging in joystick -

i have c++ program enumerates input devices (using direct input) @ start of program. if program started, , plug in controller, controller won't recognized until program restarted. know of event can use cause program enumerate of devices after new 1 plugged in? this article discusses how detect game pad changes. first of all, can handle wm_devicechange message , check wparam dbt_devicearrival or dbt_deviceremovecomplete . seems in order receive these wparam s, though, need call registerdevicenotification first. the article's example of how follows: dev_broadcast_deviceinterface notificationfilter; zeromemory(&notificationfilter, sizeof(notificationfilter)); notificationfilter.dbcc_devicetype = dbt_devtyp_deviceinterface; notificationfilter.dbcc_size = sizeof(notificationfilter); hdevnotify hdevnotify; hdevnotify = registerdevicenotification(m_hwnd, &notificationfilter, device_notify_window_handle | device_notify_all_interface_classes); i

android - Draw dash line on a Canvas -

Image
how can draw dash line on canvas. tried this: paint dashpaint = new paint(); dashpaint.setargb(255, 0, 0, 0); dashpaint.setstyle(paint.style.stroke); dashpaint.setpatheffect(new dashpatheffect(new float[]{5, 10, 15, 20}, 0)); canvas.drawline(0, canvas.getheight() / 2, canvas.getwidth(), canvas.getheight() / 2, dashpaint); and gave me not dash line simple one. you drawing line canvas.drawline(0, canvas.getheight() / 2, canvas.getwidth(), canvas.getheight() / 2, dashpaint) this draw line solution private path mpath; mpath = new path(); mpath.moveto(0, h / 2); mpath.quadto(w/2, h/2, w, h/2); h , w height , width of screen paint mpaint = new paint(); mpaint.setargb(255, 0, 0, 0); mpaint.setstyle(paint.style.stroke); mpaint.setpatheffect(new dashpatheffect(new float[]{5, 10, 15, 20}, 0)); in ondraw() canvas.drawpath(mpath, mpaint); snap shot i have background , dashed line drew

branch - Access url using branches in svn -

i have test server http domain pointing repository on server. have different developers working on same code, decided create branches each developer. question is, every 1 commits code own branch, should able test using url. how can make possible have separate url's every branch within same domain. sorry, if repeated, wasn't able find similar, not on stackoverflow or on internet solve issue exactly. you shouldn't running website directly out of repository in first place. subversion isn't meant used in fashion, , encounter problems code not working when compared doing proper deployment. each developer should capable of testing code own workstation, , commit code once working (or @ other logical checkpoints). if need code running on server, perhaps integrate else can't loaded on workstations, best practice deploy server after committing, either via post-commit hook script or continuous integration system. achieve this, each developer need own virtual

url - php script to access multiple web pages -

i need function/method in php access multiple web pages in loop. can manually access web page , load scripts on there. i'm not downloading information want script access php code can run on page. it's hack program i'm working on needs cron jobs running. cron job run 1 script load multiple pages eg. http:// localhost/program/script1, http:// localhost/program/script2. can dynamically add pages database time goes on. here separate code want shared file , use require("/path/to/filename.php"); the path instead of being url filesystem path saved file. good starting points reference file $_server["document_root"] like. require($_server["document_root"]."/program/script1.php");

css - full background image dosnt show full height? -

okay developing app facebook, , using textarea can adjusted in size. when start app whole of background image cannot seen unless pull down text area. is there way make full image can seen @ times? i include css background. i have been looking on google background images scrollbars. .fbbody { fb.canvas.setsize({ width: 2400, height: 1200}); font-family: "lucida grande" ,tahoma,verdana,arial,sans-serif; font-size: 11px; color: #333333; background: url(images/background.png) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } if can help, appreciated you need ensure body , html 100% eg html, body { height:100%; }

jquery - Wrapping text in HTML if condition is true -

i need wrap text inside <a> between <div> .... </div> tags in html markup: <li class="first current"> <a href="http://dts.devserver/">home</a> </li> <li class="last has_children sub-menu"> <a href="http://dts.devserver/blog">blog</a> </li> but if li has has_children class result should be: <li class="first current"> <a href="http://dts.devserver/">home</a> </li> <li class="last has_children sub-menu"> <a href="http://dts.devserver/blog"><div>blog</div></a> </li> which jquery code or method or property should use? can here? .wrappinner combined simple selector it. $('li.has_children a').wrapinner("<div>");

java - Load an image into a JPanel in an applet -

base on thread : java: load image file, edit , add jpanel tried load na image jpanel not painting it,so here s deal, suggested have created new class file named jimagecomponent extends jcomponent, looks : package in.co.sneh; import java.awt.graphics; import java.awt.image.bufferedimage; import javax.swing.jcomponent; private bufferedimage img; public class jimagecomponent extends jcomponent { public jimagecomponent (bufferedimage bi) { img = bi; } @override public void paintcomponent(graphics g) { g.drawimage(img, 0, 0, this); } } then in applet form class ,when click on loadpicture button, action performed looks : jfilechooser chooser = new jfilechooser(); chooser.setfileselectionmode(jfilechooser.files_and_directories); int retval = chooser.showdialog(appletform.this, "attach"); if (retval == jfilechooser.approve_option) { picfile = chooser.getselectedfile(); try { image = imageio.read(picfile);

How to use NSS with Jetty? -

i trying setup jetty use nss cryptographic engine. have gotten point server starts client tries connect seems hang in browser. the setup process / code following follows (32-bit windows 1.6 jvm). nss database creation modutil.exe -create -dbdir c:\nssdb modutil.exe -create -fips true -dbdir c:\nssdb modutil.exe -create -changepw "nss fips 140-2 certificate db" -dbdir c:\nssdb load nss java string config = "name = nss\n"; config += "nsslibrarydirectory = c:\\nss\\lib\n"; config += "nsssecmoddirectory = c:\\nssdb\n"; config += "nssdbmode = readwrite\n"; config += "nssmodule = fips"; inputstream stream = new bytearrayinputstream(config.getbytes("utf-8")); provider nss = new sun.security.pkcs11.sunpkcs11(stream); security.addprovider(nss); int sunjsseposition = -1; int currentindex = 0; (provider provider : security.getproviders()) { if ("sunjsse".equals(provider.getname())) { sunjs

python - django admin page is giving me 500 error in production -

this question has answer here: how fix django_sites table? 4 answers i trying setup django admin page site. local dev server working fine, once pushed code server, , tried open admin page, giving me 500 error page. i saw traceback, saying: doesnotexist: site matching query not exist. but dont know why , happening here. whole traceback, http://pastebin.com/qcdgwtdq can please me? just add site object via django shell on production site: $ python manage.py shell >>> django.contrib.sites.models import site >>> site.objects.create(domain='example.com', name='example.com') where example.com corresponds site's domain name used in production. normally default site object should automatically created when run syncdb command, myself encountered cases when didn't happen reason. see also: django's “site

Error compilation SFML debian -

i have install sfml1.6 on debian school project. on compilation have theses error : g++ -c main.cpp g++ main.o -o bomberman -lsfml-graphics /usr/local/lib/libsfml-graphics.so: undefined reference sf::unicode::text::text()' /usr/local/lib/libsfml-graphics.so: undefined reference to sf::context::getglobal()' /usr/local/lib/libsfml-graphics.so: undefined reference sf::window::onevent(sf::event const&)' /usr/local/lib/libsfml-graphics.so: undefined reference to sf::window::create(sf::videomode, std::basic_string, std::allocator > const&, unsigned long, sf::windowsettings const&)' /usr/local/lib/libsfml-graphics.so: undefined reference sf::context::setactive(bool)' /usr/local/lib/libsfml-graphics.so: undefined reference to typeinfo sf::window' /usr/local/lib/libsfml-graphics.so: undefined reference sf::window::create(unsigned long, sf::windowsettings const&)' /usr/local/lib/libsfml-graphics.so: undefined reference t

c++ - Not the address I want content? -

i'm getting more , more confused wasting more time on code. want content of iterator, not address. here code: peptides temppep; temppep.set_peptide("aabf"); std::vector<peptides>::iterator itpep = std::find_if (this->get_peplist().begin(), this->get_peplist().end(),boost::bind(&peptides::peptide_comparison, _1,temppep)); if (itpep != this->get_peplist().end()) { spectra tempsp; tempsp.set_charge(1127); tempsp.set_snum(1); std::cout << "without iterator "<< this->get_peplist()[0].get_new_s_num() << std::endl; // output -> 0 std::cout << "with iterator" << itpep->get_new_s_num() <<std::endl; //output -> 1129859637 } try changing code following: std::vector<peptides> p = this->get_peplist(); std::vector<peptides>::iterator itpep = std::find_if (p.begin(), p.end(),boost::bind(&peptides::peptide_comparison, _1,temppep));

class - What is the most efficient way to construct a Java hash table related to filespecs -

i'm wondering efficient way make hash containing elements (in java). i want have in hash objects of class node similar representing class file, don't use of functions , fields (i use path, filename , isdirectory), , implement few fields , methods specific objects. important thing add constructors of nodes build basing on file objects. efficient - make node extend file or leave - unrelated moment of construction? is node file ? rare implement base class when aren't specific type of base. it sounds don't need hierarchy in case, doesn't buy when storing metadata.

javascript - Which is the right way to set ExtJS 4.2 in scope CSS mode? -

it seems extjs 4.2 doesn't include scoped css. so, when apply extjs render grid, page gets ruined. i've checked link: how scope reset css applied ext components using scoperesetcss property? i wonder if there way of make scope reset css or method want in extjs 4.2. @sencha explains fix in this link. extjs v4.1.1 or v4.2.1 ext = { buildsettings:{ basecssprefix: 'x-', scoperesetcss: true } }; extjs v4.2.0 ext.define('ext.borderboxfix', { override: 'ext.abstractcomponent', initstyles: function(targetel) { this.callparent(arguments); if (ext.isborderbox && (!me.ownerct || me.floating)) { targetel.addcls(ext.basecssprefix + 'border-box'); } } }); ext.onready(function() { ext.fly(document.documentelement).removecls(ext.basecssprefix + 'border-box');

c# - Spring.NET ObjectDefinitionStoreException using assembly to store configuration files -

i learning spring.net, created class myapplication , library class mylib spring configuration files myapplication needs. i retrieve metadata using: iapplicationcontext ctx = new xmlapplicationcontext("assembly..."); i have 3 different xml files, 1 (springconfiguration.xml) imports 2 other. @ beginning of tries, spring configuration files @ root level of mylib. worked fine. ----- mylib -- properties -- references -- commonspring.xml -- buttonspring.xml -- springconfiguration.xml then created folders in mylib store xml files , fails if use subfolders: the following works: ----- mylib --properties --references --common --commonspring.xml --gui --buttonspring.xml --configuration --springconfiguration.xml my springconfiguration.xml file then: <?xml version="1.0" encoding="utf-8" ?> <objects xmlns="http://www.springframework.net"> <import resource="common/commonspring.xml"/> <import re

adobe - Javascript code to open several files in subdirectories -

i'm new programmer, please bear me. i'm attempting pretty advanced, enjoy challenge. :~) i'm using adobe's estk (extendscript toolkit) write complex script indesign cs6. i've gone through of tutorials , have learned quite bit, have run wall now. i need script detect whether folder meets criteria, , if does, delve folder, count of subfolders, , open each of .indd files in each of subfolders, in turn, performing tasks on each one. have started script today , i've got far: var getdatadialog = app.dialogs.add({name:"job info"}); with(getdatadialog){ // add dialog column. with(dialogcolumns.add()){ // create order number text edit box. var ordernumtexteditbox = texteditboxes.add({minwidth:80}); } } // show dialog box. var dialogresult = getdatadialog.show(); if(dialogresult == true){ // order number , put in variable "ordernum". var ordernum = ordernumtexteditbox.editcontents; // first 3