Posts

Showing posts from August, 2011

string - How to print @ symbol in Ocaml -

i print symbol @ in ocaml omitted content. can body guide me solution this? thanks! i assume you're using printf or similar. "@" character has special meaning in format strings. literal "@" in string, use %@ .

c++ - opengl dynamic bezier curve has gaps - glEvalCoord1f(); -

Image
i have program can pick ten points , bezier curve calculated points. seems work pretty perfect, shown curve has gaps. used gl_line_strip how possible points not connected? i figured out, small u in glevalcoord1f(u); makes gaps smaller. how u depending on controlpoints , window propperties in glevalcoord1f(u); ? [edit] added screen thicker lines: #include <iostream> #include <stdlib.h> #include <string> #include <fstream> #include <math.h> #include <time.h> #include <gl/glut.h> //added gl prefix ubuntu compatibility #define maxp 10 glint nnumpoints = 0; glfloat ctrlpoints[10][3]; gldouble mouseogl[3] = {0.0,0.0,0.0}; glint mousex, mousey; bool mousepressed = false; void getoglpos(int x, int y); void init(void) { glclearcolor(1.0, 1.0, 1.0, 0.0); glshademodel(gl_flat); // enable evaluator glenable(gl_map1_vertex_3); glenable(gl_depth); } void display(void) { int i; glclear(gl_color_buffer_bit | gl_de

oracle sqldeveloper - How do you read data like tables from SQL Developer using Grails? -

i have fair amount of knowledge of grails cannot find way how read data table sql developers using grails. how can this? by default when use run-app , database in-memory (the url "jdbc:h2:mem:devdb"), there's no way connect outside jvm. if change "real" database can connect both grails , client. to h2, 1 option start standalone server. requires find h2 jar - under $home/.m2/repository or $home/.grails/ivy-cache. example on machine command start on port 9092 (the default) is java -cp /home/burt/.m2/repository/com/h2database/h2/1.3.170/h2-1.3.170.jar org.h2.tools.server -tcp -tcpport 9092 then change url in grails-app/conf/datasource to url = 'jdbc:h2:tcp://localhost:9092/dbname' where "dbname" arbitrary - h2 supports creating multiple databases per server. can start grails , connect server, , can connect client too. a simpler way use h2's auto-server mode, e.g. url url = 'jdbc:h2:./dbname;auto_server=true;auto

Summing regions of a matrix that do not over lap in matlab -

i trying sum vector in groups of twenty length of vector e.g. 7628. can't figure out way output vector sums of sets of twenty or ans = [sum(a(1:20) sum(a(21:30)....]. since 7600 evenly divisible 20, can reshape , sum: a = rand(7600,1); sum(reshape(a,20,7600/20)) edit addressing comment non evenly divisible lengths b = 20; sz = size(a); % last elements exclude excl = mod(sz(1),b); % sum reshape , sum excluded separately [sum(reshape(a(1:end-excl), b, fix(sz(1)/b))), sum(a(end-excl+1:end))]

apache - Problems importing .htaccess into IIS URL Rewrite Web.Config -

i'm trying import .htaccess file url rewrite rule in iis 7. the current file in symfony 2 fails importing iis. need of knows syntax translate file usable iis, appealing fact work future user of symfony 2 in iis. i apologize not know syntax in iis. , append original file /web/.htaccess , excluding comments convenience. thanks in advance directoryindex app.php <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_uri}::$1 ^(/.+)/(.*)::\2$ rewriterule ^(.*) - [e=base:%1] rewritecond %{env:redirect_status} ^$ rewriterule ^app\.php(/(.*)|$) %{env:base}/$2 [r=301,l] rewritecond %{request_filename} -f rewriterule .? - [l] rewriterule .? %{env:base}/app.php [l] </ifmodule> <ifmodule !mod_rewrite.c> <ifmodule mod_alias.c> redirectmatch 302 ^/$ /app.php/ </ifmodule> </ifmodule> the current error output this: <rewrite> <rules> <!--the rule cannot converted

php - How do I test contact form in Windows XP using XAMPP through localhost? -

i have coded web site scratch xhtml, using windows xp pro, , includes contact form in php. web site in xampp folder on c drive , being run under localhost on computer @ home. i want test form sending email test message live email address. have tried changing smtp = localhost in php .ini file isp server address, activating line, sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t" and adding semicolon beginning of line below, sendmail_path = "c:\xampp\mailtodisk\mailtodisk.exe" i have placed live email address in contact form code so: <?php //send email if(mail('my@emailaddress.net','contact form',$msg, 'from:postmaster@localhost')) { ?> then tried way placing email address under if(post) function instead: <?php if($_post) { $fname = $_post['fname']; $femail = $_post['femail']; $fcomments = $_post['fcomments']; $fcaptcha = $_post['fcaptcha']; $

java - log4j warning after `homebrew install zookeeper` -

i'm running mac os x 10. did brew install zookeeper . then created /usr/local/etc/zookeeper/zoo.cfg based on /usr/local/etc/zookeeper/zoo_sample.cfg . then zkserver start works fine. but, when trying connect zookeeper clojure, uses zookeeper java client, error: log4j:warn no appenders found logger (org.apache.zookeeper.zookeeper). log4j:warn please initialize log4j system properly. log4j:warn see http://logging.apache.org/log4j/1.2/faq.html#noconfig more info. my log4j.properties file: log4j.rootcategory=warn, zklog log4j.appender.zklog = org.apache.log4j.fileappender log4j.appender.zklog.file = /usr/local/var/log/zookeeper/zookeeper.log log4j.appender.zklog.append = true log4j.appender.zklog.layout = org.apache.log4j.patternlayout log4j.appender.zklog.layout.conversionpattern = %d{yyyy-mm-dd hh:mm:ss} %c{1} [%p] %m%n so, questions are: what reasonable log4j configuration situation? what homebrew do, out of box, prevent warning happening? to clear

javascript - How to dynamically append JS/CSS files in order -

so, have load these in main page jquery.js jquerymobile.css jquerymobile.js mainscript.js but if user enters anywhere else need load them dynamically. have scriptcheck.js if scripts not present //create array of elements containing above files scriptsarray.foreach |script| head.append(script) end foreach end if my question is, there way make loading synchronous operation, waits each script load , interpreted before loading next one? you set onload handler of each script element function loads next script: var counter = 0 scriptpaths = [...] function loadnextscript(){ var el = document.createelement("script"); el.onload = loadnextscript; el.src = scriptpaths[counter]; document.head.appendchild(el); counter++; } you can invoke using: if (scriptsnotpresent) { loadnextscript(); }

python - PyPy vs Cpython, will either one drop GIL and support POSIX Threads? -

given gil limits pythons ability support true threads, possible strip out of current python implementations language can support true multithreading. furthermore, assuming gil dropped, mean multi-core threading come scripting/interpreted languages such python , ruby? your question flawed. python supports threads fine. in fact, when create thread in python program running under *nix creates 1 additional pthreads thread, no questions asked. restriction python code won't run in parallel (but run concurrently, interleaved, etc.). code that's not under gil, such i/o, doesn't prevent other threads running python code. as removing gil ... it's hard . like, really hard . , me can assume it's infeasible (hey, @ least we'll pleasantly surprised if superhuman does succeed). other implementations (jython, ironpython) don't have gil, approaches aren't practical cpython (and not easy pypy either, hear) , can't replace cpython lag behind lot, don&

java - Android Spinner not showing up -

can tell me why spinners not showing up? i'm doing exercise , don't understand why spinners show no items @ all. suggestions? import android.app.activity; import android.os.bundle; import android.widget.adapterview.onitemselectedlistener; import android.widget.arrayadapter; import android.widget.edittext; import android.widget.spinner; import android.widget.textview; import android.view.menu; import android.view.view; import android.widget.adapterview; import java.util.*; public class length extends activity{ private spinner spi1,spi2,cmbopciones; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.length); //spinner1 list<string> imperialunits = new arraylist<string>(); imperialunits.add("inch"); imperialunits.add("foot"); imperialunits.add("yard"); imperialunits.add("mile"); arrayadapter<string>

python - apply fromiter over matrix -

why fromiter fail if want apply function on entire matrix? >>> aaa = np.matrix([[2],[23]]) >>> np.fromiter( [x/2 x in aaa], np.float) array([ 1., 11.]) this works fine, if matrix 2d, following error: >>> aaa = np.matrix([[2,2],[1,23]]) >>> aaa matrix([[ 2, 2], [ 1, 23]]) >>> np.fromiter( [x/2 x in aaa], np.float) traceback (most recent call last): file "<stdin>", line 1, in <module> valueerror: setting array element sequence. what alternate can use? know can write 2 loops rows , columns, seems slow , not pythonic. in advance. iterating on multidimensional matrix iterates on rows, not cells. iterate on each value, iterate on aaa.flat . note fromiter (as documented) creates one-dimensional arrays, why have iterate on cells , not rows. if want create new matrix of other shape, you'll have reshape resulting 1d array. also, of course, in many cases don't need iterate @ all. examp

java - AbstractMap.SimpleImmutableEntry cannot be resolved to a type -

Image
i running: os x v10.8.4 eclipse 3.7.2 java 1.6 android minsdkversion 17 android targetsdkversion 17 but no dice. compiler recognizes plain old abstractmap declarations, has no clue abstractmap.simpleentry or abstractmap.simpleimmutableentry : however, via command line ( javac 1.6.0_51 ) following build , run: import java.util.abstractmap; public class test { public static void main (string args[]) { abstractmap.simpleimmutableentry<string, string> entry = new abstractmap.simpleimmutableentry("key", "value"); system.out.println(entry.getkey()); system.out.println(entry.getvalue()); } } also, android studio (i/o preview) recognizes abstractmap.simpleimmutableentry . i have build -> clean'd, restarted eclipse, rebooted mac. wrong in eclipse setup. help! are sure building level 17 of sdk? abstractmap.simpleimmutableentry added in api level 9. exact class caught me out build api level 8.

php - Why this is variable does not work? Jquery -

this question has answer here: how return response asynchronous call? 21 answers i writing following code below, takes data current date php file handle in jquery. until here well. i'm not understand why can not have new value of total variable after picks value coming php file. day.each(function () { var $this = $(this); var the_index = $this.index(); var the_date = $this.find('h3.date').html().substr(0,2); var the_day = $this.find('h3.day'); /*this variable*/ var total = 0; $.get('trd/datetime.php', function (date) { if(that.hasclass('list-'+date.day)) { weeklist.find('.item.list-'+date.day).addclass('active'); } total = date.firstdate; }, 'json'); console.log(total);

c - Lesser of two evils when using globals via extern -

i'm working old code uses many global variables. i'm aware of many of disadvantages of using global variables, question not whether should using global variables or not. after reviewing of code i've noticed 2 patterns , i'm trying decide 1 worse , why. a similarity between 2 patterns global variables exposed using "extern". the main difference between 2 patterns is: some globals extern'ed/exposed in header files, in turn included in many source files #include other globals extern'ed/exposed directly in source file itself which of these 2 believe worse other? , why? would consider them equally bad? , why? 1) hide can. if not need visible, don't allow people use them (by providing declarations). 2) use static if extern not necessary and… hide can. which of these 2 believe worse other? , why? the first; because unnecessarily visible other translations. second can cause linker errors, take insider knowledge use cor

actionscript 3 - Unique SharedObjects for Unique Accounts - AS3 -

so, i'm writing web application in actionscript 3.0 uses local shared objects sort of registration system.i'm having problem, know what's causing don't know how fix if makes sense.. or don't know start fix it, like said, use shared objects manage registration/login system (so.data.username, so.data.password) sort of thing.once login create more data, etc. unique profiles sort of thing so, problem want fix: when create new account , login, same data previous account there, can't login old account because so.data.username has been replaced.you might think i'm idiot, know.i know changes username on , over.. want know route should take can create multiple accounts under shared object , each account have own unique data (profiles, etc) thanks! if want create multiple accounts, store json against 1 of data fields. might end looking like: so.data.users = '[ { "username": "marty", "password"

SQL Server Copying tables from one database to another -

i have 2 databases, 1 called natalie_playground , 1 called livedb . since want practice insert, update things, want copy of tables livedb natalie_playground . the tables want copy called: customers, computers, cellphones, prices what tried (using ssms) right click on table there no copy in there! assuming have 2 databases, example , b: if target table not exists, following script create (i not recommend way): select table_a.field_1, table_a.field_2,......, table_a.field_n copy_table_here a.dbo.table_from_a table_a if target table exists, then: insert table_target select table_a.field_1, table_a.field_2,......, table_a.field_n a.dbo.table_from_a table_a note: if want learn , practice this, can use previous scripts, if want copy complete structure , data database another, should use, "backup , restore database" or, "generate script database data" , run database.

Memory management for a programming puzzle in java -

i trying solve interesting programming puzzle there several visitors movie rental store , want rent movies. each person can rent upto 2 movies. rental agency can rent 1 copy of each movie.to solve this, rental agency asks each person give wish list of movies want rent. each person can provide upto 10 wishes. depending on wish list provided people, rental agency wants come solution each person can give unique movie rental. input: text file containingg of 2 columns column1 has perosn id , column2 has movie id wish rent. there can upto 10 entries each person , file may not sorted. solution read entire file line line , create map of person vs list of movies requested. sort entries in map based on no of movies requested. traverse sorted list , assign upto 2 movies person list if particular movie not assigned else (using hashset purpose). this algorithm works reasonable size of file. if input file large out of memory error. specific, whil

jquery - Changing css via JavaScript conditional not working -

i trying modify css of class depending on url. here non-working code: js: <script> //<![cdata[ if (location.pathname == "/searchresults.asp" || location.pathname.indexof("-s/") != -1 || location.pathname.indexof("_s/") != -1) $('.colors_productname span').css("background-color", "#f7f7f7"); //]]> </script> html: <div> <a href="#" class= "productnamecolor colors_productname" title="cracked pepper"><span itemprop= 'name'>cracked pepper</span></a><br /> <div> <div> <b><font class="pricecolor colors_productprice"><span class= "pagetext_l483n">$11.00</span></font></b> </div> <img src="#" /></div> </div> notes: i can't change html, automatically generated the url of html includ

activerecord - CodeIgniter Update Batch with Multiple Index -

i'm having problem active record update batch on codeigniter. on documentation, $this->db->update_batch('mytable', $data, 'title'); where 'title' index update process. possible have 2 or more index active record? tried $this->db->update_batch('mytable', $data, 'title, title_2'); $this->db->update_batch('mytable', $data, array('title', 'title_2'); and it's not working.

How to do inter-process locking with forked Ruby processes? -

objective increment counter using ruby's fork method , several workers disclaimers i not want use external dependencies this usage of ruby's thread class not allowed i want see if possible using fork here's little shared memory mock class memory def self.address= value @value = value end def self.address @value end end here's worker class worker def initialize mutex @mutex = mutex end def work @mutex.synchronize print "begin: %d " % (tmp=memory.address) sleep 0.05 print "end: %d \n" % (memory.address = tmp + 1) end end end let's run it # init memory.address = 0 mutex = mutex.new # create workers workers = [] 10.times workers << fork worker.new(mutex).work end end # wait workers finish process.waitall output begin: 0 begin: 0 begin: 0 begin: 0 begin: 0 begin: 0 begin: 0 begin: 0 begin: 0 begin: 0 end: 1 end: 1 end: 1 end: 1 end: 1 end: 1 end

functional programming - Trying to get higher order functions to work in powershell -

i can't example work { $_ + $_ }, { $_ + 1}, {$_ - 1} | % { $_ 1 } i want construct list/array/collection/whatever of functions (this part fine), , pipe list code block on right, applies each of functions argument 1 , returns array results (namely; 2,2,0). i've tried using getnewclosure() method, & operator, nothing's worked far. the dollar underbar variable automatic variable populated in scenarios; in case, when there incoming object pipeline. in order give $_ value of 1, appears intent, you'll have pipe number each , execute scriptblock. easiest way pass directly argument % ( foreach-object ) accepts scriptblock: ps> { $_ + $_ }, { $_ + 1}, {$_ - 1} | % { 1 | % $_ } 2 2 0 look @ until makes sense :) if doesn't click, comment here , i'll explain in more detail. if you're interested in functional tinkering in powershell, might enjoy function wrote partial application: http://www.nivot.org/blog/post/2010/03/11/powershell20p

asp.net mvc - Jquery ajax url in controller action -

Image
can body explain how jquery ajax method url points controller action?i mean machinery behind technology.for example $("#location").autocomplete({ source: function (request, response) { $.ajax({ url: '/vacancy/autocompletelocations', data: request, datatype: "json", type: "get", minlength: 2, success: function (data) { response($.map(data, function (item) { return { label: item.ref_desc, value: item.ref_desc, id: item.ref_id } })); } }); }, select: function (event, ui) { $("#hdlocationid").val(ui.item.id); } }); i want know how url: '/vacancy/autocompletelocations' points particular action means machinery. an asp.net-mvc application has called route table . route tabl

android - Change the actionbar homeAsUpIndicator Programamtically -

i used following hack change homeasupindicator programmatically. int upid = resources.getsystem().getidentifier("up", "id", "android"); if (upid > 0) { imageview = (imageview) findviewbyid(upid); up.setimageresource(r.drawable.ic_action_bar_menu); up.setpadding(0, 0, 20, 0); } but not working on new phones (htc one, galaxy s3, etc). there way can changed uniformly across devices. need changed on home screen. other screens have default one. cannot use styles.xml this did acheive behavior. inherited base theme , created new theme use theme specific activity. <style name="customactivitytheme" parent="apptheme"> <item name="android:homeasupindicator">@drawable/custom_home_as_up_icon</item> </style> and in android manifest made activity theme above. <activity android:name="com.example.customactivity" android:theme="@style/customactivitytheme

iphone - How Can i Get the List of all Video files from Library in ios sdk -

hi i'm working on videos , list of video files library display , playing videos in app. can 1 me. allvideos = [[nsmutablearray alloc] init]; alassetslibrary *assetlibrary = [[alassetslibrary alloc] init]; [assetlibrary enumerategroupswithtypes:alassetsgroupall usingblock:^(alassetsgroup *group, bool *stop) { if (group) { [group setassetsfilter:[alassetsfilter allvideos]]; [group enumerateassetsusingblock:^(alasset *asset, nsuinteger index, bool *stop) { if (asset) { dic = [[nsmutabledictionary alloc] init]; alassetrepresentation *defaultrepresentation = [asset defaultrepresentation]; nsstring *uti = [defaultrepresentation uti]; nsurl *videourl = [[asset valueforproperty:alassetpropertyurls] valueforkey:uti]; nsstring *title = [nsstring stringwithformat:@"video %d", arc4random()%100]; u

jquery - JSON response error in codeignitor -

i new in codeignitor framework , json. want fetch data database when user clicks on url, i'm getting error. my script: function abc(i) { if(i == 1) { $.ajax({ type: "post", url: "<?php echo base_url('welcome/liststd');?>", data: 'postdata='+ , success: function(json) { var abc = json; document.getelementbyid("fname").innerhtml=abc[0].fname; } }); } } firebug response: [ { "id":"31", "fname":"darshan", "mname":"d", "lname":"dave", "std":"1", "marks":"12000", "image":"image31.jpg", "id1":"1", "in_date":"0000-00-00", "upd_date":"2013-07-10" }, { "id":"34",

nodejs connect session middleware don't set cookie? -

i use connect's session middleware in express app,in session's document can find req.session.cookie.maxage req.session.cookie.expries i set value them, in browser, still can't see cookie's expries changed. i try set req.session.cookie.maxage false ,then res.cookie() set maxage value time,ok time,it worked. req.session.cookie.maxage seemd rewrite cookie's maxage,so written in res.cookie() lost, in browser see "session" cookie. what want implement "remember me" functionality.so wrong? thanks. my app.js config: app.use(express.cookieparser('your secret here')); app.use(express.session({ secret: 'secret', store: new mongostore({ db: settings.mongosessiondb }), key: "sid" })); in login.js: if(req.body.remember){ req.session.cookie.maxage = 1000 * 60 * 60 * 24 * 30;//this not work, didn't reflesh brower }else{

c++ - Ambiguous template parameter -

i've created template function defined as template < typename _iter8, typename _iter32 > int utf8toutf32 ( const _iter8 & _from, const _iter8 & _from_end, _iter32 & _dest, const _iter32 & _dest_end ); edited: first parameter const type. the first , third parameters change reflect new position. second , fourth parameters mark upper boundary of iteration. i'm hoping implement 'one functions fits all' logic. stipulation both _iter types of same type , dereferenceable. want template parameters deducable. the first problem encountered was char utf8string [] "...some utf8 string ..."; wchar_t widestring [ 100 ]; char * piter = utfstring; utf8toutf16( piter, piter + n, widestring, widestring + 100 ); the _iter16 ambiguous. i'm guessing because compiler sees third parameter wchar_t[ 100 ] type , fourth wchar_t* type . correct me if i'm wrong. changing code to: utf8toutf16( piter, piter + n, (wchar_t*)widestring, wid

Postgresql Update with subquery -

this question has answer here: how update + join in postgresql? 6 answers update customer c set name = b.name, age = b.age (select a.*, b.* customer_temp a.id = b.id) b i got sql above, after run query, update rows same result. i wonder need after update customer c set name = b.name, age = b.age (select a.*, b.* customer_temp a.id = b.id) d c.id = d.id but got id ambiguous last query. try this update customer set name = b.name, age = b.age customer c inner join customer_temp b on b.id = c.id sql fiddle example

php - symfony db and doctrine user structure -

i have site 2 types of users: searchers , workers. my firewall on site , both of types the same provider (same table in db). the problem there 1 entity them -> site_users, , diff column on db decides role. but searcher has 1 many variable, , worker has other 1 many variable. i cant define them in main class because infect other user well i found solution , it's not problem. i add parent entity -> user 2 varibales: searcher & employer each of them 1 one relationship user if want fetch them call 1 needed, dont interrupt each other.

javascript - How can I call another QtScript .js file from one QtScript .js file -

now can use qscriptengine load , execute test.js file. in 1 of function of test.js i'd call function located in .js file. how do this? to load qtscript code multiple files need load file using qscriptengine.evaluate(). methods available js environment according rules of js. ie: able access global methods directly. but if working on big project, suggest use common js implementation in qt. have worked on large project on qtscript , used work great us. here link goes little detail of how can implement in qt.

matlab - How to apply transformation on rectangle coordinates -

i detecting object in code , drawing rectangle around it. have 4 variables draw rectangle: x, y, width, , height. have found transformation matrix needs applied on rectangle. transformation matrix returned 3*3 matrix this: tinv = 1.0022 0.0018 0 -0.0018 1.0022 0 -0.4353 -0.9079 1.0000 how apply transformation on rectangle using matrix? what should calculate 4 vertices of rectangle , apply transformation on each individual vertex. should easy enough; if you're trying do, use following say: x = 1; y = 2.34; w = 3.21; h = 2; the vertices (assuming (x,y) denotes top left vertex of rectangle base @ 0 radian: (x1,y1) = (1,2.34) (x2,y2) = (4.21,2.34) (x3,y3) = (4.21,0.34) (x4,y4) = (1,0.34) this represented as: [ 1.00 2.34 0.00 4.21 2.34 0.00 4.21 0.34 0.00 1.00 0.34 1.00 ] this transformed required simple matrix multiplication.

java - Save Uri as a file android -

so in app receiving image application intent intent = getintent(); string action = intent.getaction(); string type = intent.gettype(); if (intent.action_send.equals(action) && type != null) { handlesendimage(intent); // handle single image being sent public void handlesendimage(intent a) { uri pic = (uri) a.getparcelableextra(intent.extra_stream); } from here want save uri image in image gallery. know how save file in gallery not sure how uri in correct format save it. know contains image because picview.setimageuri(pic); causes picture appear in activity. want able save image gallery. ideas on how that? thought convert imageview bitmap , go there seems inefficient me , there has better way it. since know can create uris files can create file uri?

unable delete temporany file with Upload Ajax and http task goes to 99% -

hi have used custom control xpages async multi file uploader custom control works well, after tests noticed temporary files (named __xspxxx) saved in temporary folder \notes68787\xspupload not deleted after successfull upload. real problem after uploads nhttp task used cpu goes 50% , after 1 more upload goes on 100%. we in 8.5.3fp4 windows 2003 x64 environment. have suggestion? i'm unable reproduce problem. can try on domino 9.0 environment? or if remove fp4 (fp0), still have problems?

ios - transitionFromView:toView:duration:options:completion: confusion -

i trying utilize transitionfromview:toview:duration:options:completion: in uiview class reference point confusing me. means? this method modifies views in view hierarchy only. not modify application’s view controllers in way. example, if use method change root view displayed view controller, responsibility update view controller appropriately handle change. please view sample project https://anonfiles.com/file/521cbb41b086eae987fe27eb98278aba in project called transitionfromview:toview:duration:options:completion: , working fine , did nothing mentioned in above point. you more asking explanation of apple's documentation specific question, if understand posting correctly. nevertheless i'll give explanation , hope, you: you write: everything working fine.. and is, because doing here! according mvc design pattern (model-view-controller), using classes uiviewcontroller (the "c") , uiview (the "v") in code. a view

javascript - model.save - saves to the server only once -

i running code in backbone saves data server, groupmodalheaderview.prototype.save = function(e) { var $collection, $this; if (e) { e.preventdefault(); } $this = this; if (this.$("#group-name").val() !== "") { $collection = this.collection; if (this.model.isnew()) { console.log("model new"); this.collection.add(this.model); } return this.model.save({ name: this.$("#group-name").val()}, { async: false, wait: true, success: function() { //console.log($this, "this"); console.log('successfully saved!'); this.contentview = new app.groupmodalcontentview({ model: $this.model, collection: $this.collection, parent: }); this.contentview.render(); return $this.cancel(); }, }); } }; this works fine first time run it, if run again straight after saving first piece of data not save new

Algorithm for certain permutaion of array elements (parallel sorting by regular sampling) [C++] -

Image
i implementing parallel sorting regular sampling algorithm described here . stuck in point @ need migrate sorted sublists proper places of sorted array. problem can stated in way: there 1 global array. array has been divided p subarrays.each of subarrays sorted. p-1 global pivot elements determined , each sub-array divided p sub-sub arrays (yellow, red, green). need move sub-sub-arrays sub-sub-arrays local index in thread (so ordered in such manner @ colors neighbouring , order left right remains). actually serial algorithm do, have no clever idea how obtain proper permutation. following figure shows case p=3 threads. yellow color denotes sub-sub-array 0, red - 1, green - 2. the sub-sub arrays may have different sizes. ok seems don't have enough reputation comment on question, shall take route of posting answer. so let me straigh. stuck on phase 3 of algo. right? how this: let's have p linkedlists of indexes. let each process communicate index ranges

XSLT Select with 2 contains -

we using following select nodes 'experienceinfo' contains '582': <xsl:apply-templates disable-output-escaping="yes" select="td:benutzer_zu_gastro[contains(td:experienceinfo, '582')]"> and select nodes 'kategorien' contains 'restaurant': <xsl:apply-templates disable-output-escaping="yes" select="td:benutzer_zu_gastro[contains(td:kategorien, 'restaurant')]"> how combine 2 1 statement nodes selected experienceinfo contains 582 , kategorien contains restaurant? many help! it's simple must have thought "no, can't it": <xsl:apply-templates select=" td:benutzer_zu_gastro[ contains(td:experienceinfo, '582') , contains(td:kategorien, 'restaurant') ] "> if xml looks <td:experienceinfo>582</td:experienceinfo> (etc.) can made simpler. <xsl:apply-templates select=" td:benutzer_zu_gastro[

Symfony + ckeditor + kcfinder : no route found to browse server -

i have added ckeditor offer nice wysiwyg editor user. allow them upload pictures directly editor, i've installed kcfinder. i've put following lines in ckeditor's config : config.filebrowserbrowseurl = 'ckeditor/plugins/kcfinder/browse.php?type=files'; config.filebrowserimagebrowseurl = 'ckeditor/plugins/kcfinder/browse.php?type=images'; config.filebrowserflashbrowseurl = 'ckeditor/plugins/kcfinder/browse.php?type=flash'; config.filebrowseruploadurl = 'ckeditor/plugins/kcfinder/upload.php?type=files'; config.filebrowserimageuploadurl = 'ckeditor/plugins/kcfinder/upload.php?type=images'; config.filebrowserflashuploadurl = 'ckeditor/plugins/kcfinder/upload.php?type=flash'; my problem : when try browse files on server kcfinder, symfony tells me there no routes "get /admin/news_post_admin/ckeditor/plugins/kcfinder/browse.php". looks tries reach browse.php controller, not correct. any ideas how make symfony find

javascript - Moving SignalR object between HTML pages -

Image
i use signalr on javascript . i have 2 objects: connection object , hub proxy object: var connection = $.hubconnection(); connection.url = 'http://localhost:xxx/signalr'; var contosochathubproxy = connection.createhubproxy('chathub'); i want these 2 objects recognized in html pages, tried put them in sessionstorage had convert them json: sessionstorage["connection"]= json.stringify(connection); sessionstorage["proxyhub"]= json.stringify(contosochathubproxy); i got following error: "converting circular structure json" i found information in several places, , everywhere written should determine real object . the question real object? below there picture of connection object console: or there way pass object between pages without converting it? (without cookies) a new page requires new connection. love proven wrong.

google apps script - DriveEye only sends errors even after disabling it -

i have added driveeye app chrome, , enabled see account. used sending automated e-mail alerts on google drive shared folder activity. not working. receive error messages ( can not include here in hungarian). server error. removed driveeye chrome (drag , drop in chrome start screen). nothing changed. still receive errors. how can ged rid of it? how can remove or take authorization back? thanks helping it seems had same symptoms. there doesn't seem way remove driveeye, found way delete triggers, stops error emails. overview: web-based authoring environment google apps script contains menu item "resources --> triggers". can manage triggers here. (it appears place can this.) trick #1: due apparent masking bug, can't access menu item unless have @ least 1 active script, , open. empty dummy script suffice. trick #2: deleting trigger(s) won't occur right away. must preserve script used delete triggers unknown amount of time. might keep in

android - How can you imitate a (specific) browser when using a webview? -

in app use webview open website. on website there javascript causes error. now, know website uses browser detection , believe might problem why page appears blank page in webview. is there way somehow imitate browser if js tries detect browser not fail? here webviewclient: settings.setjavascriptenabled(true); settings.setdomstorageenabled(true); webview.setscrollbarstyle(webview.scrollbars_outside_overlay); webview.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { log.i(tag, "processing webview url click..."); view.loadurl(url); return true; } @override public void onpagefinished(webview view, string url) { log.i(tag, "finished loading url: " + url); } @override public void onreceivederror(webview view, int errorcode, string description, string f

android animation stops after each revolution -

i want make loading image keep circule. i tried this: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="false"> <rotate android:fromdegrees="0" android:todegrees="360" android:duration="1000" android:pivotx="50%" android:repeatcount="infinite" android:pivoty="50%"> </rotate> </set> it works problem whenever image goes 0 360, stops 0.001 seconds rotate again. please? this because 0 , 360 @ same location try this: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <rotate android:fromdegrees="0" android:todegrees="359" andro

How to backup and restore python current working environment? -

i want write function 'backup(filename)' store working data (objects?) under current environment of python, , 'restore(filename)' restore data/object again. r's save.image(file="workspace21.rdata") , load(file="workspace21.rdata") , can snapshot system. how write "backup" & "restore" ? or there package existed can ? a bit out of box, if important , need full solution, can run python inside virtual machine , use snapshots save session state. whether practical or not depends on use case.

php - Hashing password before saving to databse in yii -

i using yii framework building small application of job site.and have encounterd errors mentioned below my controller class follow: public function actionregister() { $model = new registerform(); if (isset($_post['registerform'])) { // print_r($_post); exit(); $model->attributes = $_post['registerform']; if ($model->validate()) { $model->password = sha1($model['password']); $model->role ='user'; $model->status='1'; $model->created =date("y-m-d h:i:s"); $model->modified =date("y-m-d h:i:s"); if ($model->save()) { yii::app()->user->setflash('success', "data saved!"); } else { yii::app()->user->setflash('error', "error,cannot save data!"); } } else { yii::app()-&

html - iFrame removes a div -

i have slight problem when use iframe, removes div. think error located somewhere here: <br> <h1>about</h1> <iframe src="http://www.wikipedia.com" scrolling="no" width="960" height="500" frameborder="0" style="margin-left: 0px";> <div class="center"> <p style="text-align: justify; ">&nbsp;</p> <p style="line-height: normal; font-family: verdana; "><span style="letter-spacing: 0.0px">people extremely visual creatures. why few things can beat power of moving imagery , why got involved in creating them.&nbsp;</span></p> <p style="line-height: normal; font-family: verdana; "><span style="letter-spacing: 0.0px">redrum started creative film , animation studio in 2009. enthusiastic filmmakers are, try tell memorable visual stories our clients message across. believe having each

php - Filter data from mysql by countries -

i want filter data countries dropdown menu: <form name="filter_form" method="post" action="display_data.php"> select country: <select name="value"> <option name="country" value="au">austria</option> <option name="country" value="be">belgium</option> <option name="country" value="bu">bulgaria</option> </select> <input type="submit" name="btn_submit" value="submit filter" /> <?php if($_post['country'] == 'be') { $query = mysql_query("select * think country='belgium'"); } elseif($_post['country'] == 'au') { $query = mysql_query("select * think country='austria'"); } else { $query = mysql_query("select * think"); } ?> the code not filter data. if can help, thanks! avo

css - REG : Custom Dropdown box identification [CAPYBARA] -

looking @ selecting value dropdown ( custom ) not regular dropdown , has lot of dropdown values i able select first value code find('.selected', :text=>arg1,exact: false).click but unable select remaining values text has lot of padding spaces! how tackle situation i'm not sure drop-down looks like, 1 thing might collect options: dropdown = session.find(:css, '#elementid') #customize needed options = dropdown.all(:css, "option").collect {|o| o.text} then use index select drop-down: session.select options[3], from: 'elementid'

AngularJS Multi-Page App Site Boilerplate Site Structure Advice -

i looking guidance creating angularjs multi-page app served laravel backend. web app tutorials on net point creating spas , getting started angular - please go easy on me. productpage example - http://example.com/products/widget <html data-ng-app='exampleapp'> <head> </head> <body data-ng-controller='productcontroller'> // productpage content served laravel angular tags <script type="text/javascript" src="/js/lib/angular.min.js"></script> <script type="text/javascript" src="/js/app.js"></script> <script type="text/javascript" src="/js/controllers/productcontroller.js"></script> </body> </html> cartpage example - http://example.com/cart <html> <head> </head> <body data-ng-controller='cartcontroller'> // cartpage content served web

windows runtime - Drawing over terrain with depth test? -

i'm trying render geometrical shapes on uneven terrain (loaded heightmap / shapes geometry generated based on averaged heights across heightmap not fit exactly). have following problem - somethimes terrain shows through shape showed on picture. open image i need draw both terrain , shapes depth testing enabled not obstruct other objects in scene.. suggest solution make sure shapes rendered on top ? lifting them not feasible... need replace colors of actual pixel on terrain , doing in pixel shader seems expensive.. thanks in advance i had similar problem , how solved it: you first render terrain , keep depth buffer. not render objects render solid bounding box of shape want put on terrain. you need make sure bounding box covers height range shape covers an over-conservative estimation use global minimum , maximum elevation of entire terrain in pixel shader, read depth buffer , reconstructs world space position you check if position inside shape in case c

html - Block UI, until jquery dialog dismissed -

i block ui background (not scrollable ...), until jquery dialog dimissed (which in dialog) any ideas how can that? this should you $('div#selector').bind('open', function(event) { // block }); $('div#selector').bind('dialogclose', function(event) { // unblock });

c - Are integer literals considered unsigned? -

if there positive integer literal in code, 50, compiler consider type unsigned int or int? a decimal integer literal of first type can represented in int , long or long long . 50 of type int . unsigned literals can specified using u or u suffix. decimal integer literal suffixed u or u of first type can represented in unsigned int , unsigned long or unsigned long long . 50u of type unsigned int .

Spring MVC Failed to convert property value of type 'java.lang.Integer' -

i have 2 entities, 1 of have composit primary key(id, version), version manytoone link entity(uchastokversion) field id. @entity @table(name = "uchastok_versions",schema="tb") public class uchastokversion { @id @generatedvalue(strategy = generationtype.identity) @column(name = "id") private integer id; @column(name = "date_activate", columndefinition="date unique") @datetimeformat(pattern="dd.mm.yyyy") @temporal(temporaltype.date) private date dateactivate; @transient private list<uchastok> uchastki; @entity @idclass(uchastokid.class) @table(name = "uchastki", schema = "tb") public class uchastok implements serializable{ /** * */ private static final long serialversionuid = 1l; @id @column(name = "id", unique = false, nullable = false) private integer id; @column(name = "name") privat