Posts

Showing posts from September, 2013

ios - UICollectionView indexPathsForVisibleItems don't update new visible cells -

i have viewcontroller collectionview inside. when view loads, visible cells (9 cells) shown correctly. when scroll down, want load visible items in collectionview loadimagesforonscreenrows calling indexpathsforvisibleitems partnercollectionview. when loadimagesforonscreenrows indexpathsforvisibleitems has allways first 9 cells in it, when cells 10 18 should visible on screen. code use is: #import "partnerlistviewcontroller.h" #import "appdelegate.h" #import "partner.h" #import "imageloader.h" #import "partnerdetailviewcontroller.h" @interface partnerlistviewcontroller () @end @implementation partnerlistviewcontroller @synthesize lbltitle; @synthesize partnercollectionview; @synthesize imagedownloadsinprogress; @synthesize fetchedresultscontroller; @synthesize managedobjectcontext; - (void)viewdidload { [super viewdidload]; // additional setup after loading view. appdelegate * appdelegate = (appdelegate *) [[uiappl

python - How can I force ElementTree to write to disk every change? -

i have deal huge xml file create big database. from database structure generate xml tree, ends eating memory (over 10gb now), process never end since system can't process new query. i think solution avoid saving xml structure memory, , dump directly disk whenever add new. is can do? how? thanks! i'm not sure how code works, it's done. depending on how it's structured, create timestamp , compare incoming data old data, or scan file whether current xml has been added. after (assuming new code) following: path = "path/" name = "filename" xmlroot = element("root")#create root element xml structure xmlsub = subelement(xmlroot,"sub") subname = subelement(xmlcard,"name") subname.text = "element text" savename = path + name + ".xml" #constructs location of xml file (path/filename.xml) tree = elementtree(xmlroot) #compiles tree tree.append(savename) #appends specified file this outpu

c# - How can I get two controls on separate forms bound to the same datasource to update each other? -

i have form lot of fields on it, of optional; reasons beyond control, required fields scattered throughout form rather than, say, grouped @ top big "required" label. i've been asked make separate form can launched main form has required fields. idea user can bring "required fields" form, enter necessary data automatically shows in main form enter it, close "required fields" form , fill in optional fields want on main form, , save form. i've got fields on "required" form bound exact same data sources associated fields in main form, , know that's working because can enter information in "required" form , save, , entered data gets saved. problem while data source behind scenes gets updated, corresponding field on other form doesn't . i'd able have typed in required field on either form instantly show in corresponding field on other form, people understand it's storing input regardless of field use. i know

multithreading - java.concurrent.ReentrantLock - why we want to acquire the same lock multiple times -

this question has answer here: why use reentrantlock if 1 can use synchronized(this)? 5 answers i know if using reentrantlock, allows same thread acquire same lock more once. internally, has counter count number of lock acquisition. if acquired same lock twice, need release twice. question why want acquire lock multiple times, should 1 time acquisition enough? can give me common use case? consider following case in need set of operations isn't atomic, atomic. example may want set value of array return current value upon setting. (try-finally removed brevity). final reentrantlock lock = new reentrantlock(); final object[] objects = new object[10] public object setandreturnprevious(int index, object val){ lock.lock(); object prev = get(index); set(index,val); return prev; lock.unlock(); } public void set(int index, object val){

.htaccess - Rewrite rules for a branch of content formerly under a CNAME alias -

i'm migrating blog installation new server. original installation on amazon server. new server location true server amazon install made appear @ through dns changes , cname alias. the aliased urls looked this... blog.domain.tld/articles/{title of articles} at new , true domain location, false "blog" aliasing dropped, , new url structure be... domain.tld/articles/{title of articles} i need setup mod_rewrite rules calls old fake urls land people @ new , true ones. i've seen examples online of root-to-subdirectory or subdirectory-to-root redirects on same server, in case faux subdirectory involved on different server, i'm not sure do. i'm not sure makes sense (or possible) redirect aliased url. anyone have pointers, insights, or examples? in advance. this similar redirecting www. links non-www links, following should work: rewritecond %{http_host} ^blog\.domain\.tld$ rewriterule (.*) http://domain.tld/$1 [r=301,l]

Windows gadget - javascript changing CSS -

i'm working on schedule school on windows desktop. have issue changing, because value of "getday" still on 0 , display default.css. here check code: var currdate = new date(); var currday = currdate.getday(); var newcss = "default.css"; if (currday = 0) newcss = "default.css"; if (currday = 1) newcss = "pondeli.css"; if (currday = 2) newcss = "utery.css"; if (currday = 3) newcss = "streda.css"; if (currday = 4) newcss = "ctvrtek.css"; if (currday = 5) newcss = "patek.css"; if (currday = 6) newcss = "default.css"; document.getelementbyid('sitecss').href = newcss; whats wrong? :-) use "==" in ifs: if (currday == 0)...

arrays - using perl, how to select last 2 lines in the case of each row has same word? -

bini -- -21.89753 -20.47853 -20.27835 -18.34952 -16.23454 bini -- -16.89753 -14.47853 -13.27835 -12.34952 -11.23454 bini -- -10.09014 my file has array shown above. , array starting bini array having multilines showing 3 lines here. wanted try extract last 3 elements last 2 lines. so, -12.34952 -11.23454 -10.09014 these 3 elements wanted. sometimes, last line may have elments 2 5 depending on files. here, has 1 elements last line. what tried follows while(my $line = <file>) { if($line =~ /bini/) { #extract last 3, 2, 1 element @entries = split(/ws+/,$line); $element1 = (pop@entries); $element2 = (pop@entries); $element3 = (pop@entries); } as result, see element1 -10.09014, unfortunately, couldn't element 2 , element 3. me? .. i want keep original script. mean,, creaing process of result.txt , opening method of "log" output format. blockquote #!/usr/bin/perl use warnings; use strict; u

jsf 2 - FullAjaxExceptionHandler does not redirect to error page for Ajax request -

Image
i know there has been numerous questions here on question, of them suggest adding following code because there layer "above" fullajaxexceptionhandler sending plain redirect instead of doing ajax redirect (see this similar question ): if ("partial/ajax".equals(request.getheader("faces-request"))) { // jsf ajax request. return special xml response instructs javascript should in turn perform redirect. response.setcontenttype("text/xml"); response.getwriter() .append("<?xml version=\"1.0\" encoding=\"utf-8\"?>") .printf("<partial-response><redirect url=\"%s\"></redirect></partial-response>", loginurl); } else { // normal request. perform redirect usual. response.sendredirect(loginurl); } my question i'm configuring omnifaces's fullajaxexceptionhandler error handling, not have spring security or container managed security intercepting reques

segmentation fault - Program not crashing when run from Makefile -

i have particular executable (let's call bin ) crashes segfault when run ./bin , if create makefile: all: ./bin and make , executable runs without error , terminates correctly. how possible? you don't version of make you're using, older versions of gnu make had bug make set own stack size "unlimited" didn't set default value when running programs. newer versions of gnu make fix bug programs run default stack size. see https://savannah.gnu.org/bugs/?func=detailitem&item_id=22010

Matlab syms variable precision? -

just having issues variable precision in matlab.. i have code: x = 0.1; syms y; s = solve(x+1==(1+y)/(1-y),y); y = double(s); val = abs(((2^2)*(y^2))/(2*(y-1)^2)) but val rounded off. should getting val = 0.0049999 instead getting val = 0.0050 . anyone have idea why? thanks. edit: adding code x = 0.1; syms y; s = solve(x+1==(1+y)/(1-y),y); y = double(s); val = abs(((2^2)*(y^2))/(2*(y-1)^2)) sprintf('%22.20f',val) i=1:2 val= val+((2^i)*(y^i))/(i*(y-1)^i); sprintf('%22.20f',val) end the first sprintf works , shows correct rounding, second doesnt!! it has floating-point representation , how matlab displays such numbers readability. if add line end of code: sprintf('%22.20f',val) you'll get: ans = 0.00499999999999999924 edit though technically deals python, this website offers brief , concise overview on limitations of floating-point representations.

sql - Efficiency of quarterly calculation of workforce headcount -

i have 1 table, per_all_peopl_f, following columns: name person_id emp_flag effective_start_date effective_end_date doj -------------------------------------------------------------------------------- abc 123 y 30-mar-2011 30-mar-2013 10-feb-2011 abc 123 y 24-feb-2011 27-feb-2011 10-feb-2011 def 345 n 10-apr-2012 30-dec-4712 15-sep-2011 there many entries (1000+) repeated data , different effective start dates. i have calculate workforce headcount. is, number of employees exits company quarterly. the following columns have fetched: headcount in 2012 (1st quarter) headcount in 2013 (1st quarter) difference between 2 headcounts % difference the query used find headcount quarterly is: function1: create or replace function function_name (l_end_date ,l_start_date ) return number; l_emp begin select count(distinct papf.person_id)

javascript - custom click event trigger, widget jquery -

i creating jquery widget, concept similar menu bar, has 2 buttons, example, buttonone , buttontwo. i have style associated , html code. i worked in hello world widget // constructor _create: function() { var my=this.element; var supe=this; .............. //first event my.bind('mouseenter', function (event) { supe._trigger('activated', event, my); }); }, i use like $(function() { ........... var bar=$("#bar-event").mybar(); //first atempt bar.click(function() { alert( "handler .click() called." ); }); //second attempt bar.bind('mybaractivated', function(event, data) { // handle event alert('yes working!!!!!!'); }); }); my first attempt, noob attempt, click works, in area of top div in html. in second attem

ios - PhoneGap 1.0 app Submit to AppStore fails -

we have old app created phonegap version 1.0. there absolutely no chance migrate latest phonegap/cordova because of huge changes in both ios/js code required. an attempt upload app compiled ios sdk 6.1 failed message: "apps not permitted access udid , must not use uniqueidentifier method of uidevice. please update apps , servers associate users vendor or advertising identifiers introduced in ios 6.". phonegap 1.0 sources not available in public, it's distributed compiled framework. does have idea how workaround issue? crazy, working solution (hack) well, once phonegap 1.0 provided compiled lib, can try change compiled binary itself. the reason of apple reject calls [uidevice uniqueidentifier] method deprecated in ios 6. if app (js code) not use udid provided phonegap (actually, have no idea there way it), it's safe (!? see note bellow) change call of uniqueidentifier other method returning nsstring of uidevice class. i've used +(nsstri

hadoop - Flume NG not writing to HDFS -

i'm new @ using flume , hadoop i'm trying setup simplest (but helpful/realistic) example can. i'm using hortonworks sandbox in vm client. after following 1 tutorial 12 (which involves setting , using flume) seems working correctly. so setup own flume.conf should read apache access log use memory channel write hdfs simple enough right? here's conf file agent.sources=exec-source agent.sinks=hdfs-sink agent.channels=ch1 agent.sources.exec-source.type=exec agent.sources.exec-source.command=tail -f /var/log/httpd/access_log agent.sinks.hdfs-sink.type=hdfs agent.sinks.hdfs-sink.hdfs.path=/flume/events agent.sinks.hdfs-sink.hdfs.fileprefix=apacheaccess agent.sinks.hdfs-sink.hdfs.rollinterval=10 agent.sinks.hdfs-sink.hdfs.rollsize=0 agent.channels.ch1.type=memory agent.channels.ch1.capacity=1000 agent.sources.exec-source.channels=ch1 agent.sinks.hdfs-sink.channel=ch1 i've seen several people have problems writing hdfs, , in cases there weren't eno

javascript - How to correctly chain Angular HttpPomise -

i had angular service function: service.getitembyid = function(id) { var hp = $http({method: "get", url: "service/open/item/id", headers: {"token": $rootscope.user.token}, params: {"id": id}}); return hp; }; i need manipulate returned values before sending them on , want keep httppromise structure intact since controller code written expect success , failure functions of httppromise present. i have rewritten service this: service.getitembyid = function(id) { var hp = $http({method: "get", url: "service/open/item/id", headers: {"token": $rootscope.user.token}, params: {"id": id}}); var newhp = hp.success( function(data, status, headers, config) { data.x = "test"; //todo: add full manipulation alert("success");

ios - Use result of an if statement as a variable -

i'm wondering if there's way of using returned value of method , checked if statement , variable if not nil . i hope code example below helps explain i'm after. let's have method returns uiimageview , -(uiimageview *)imageviewexistsforid:(nsstring *)viewid . in method somewhere else, want check if imageview returns value, , conditional, use if-statement, such: if ([self imageviewexistsforid:<viewid>]) { // use returned imageview here } else { // 'nil' returned, no need use result } normally, declare placeholder variable before if-statement, such as: uiimageview *returnedimageview = [self imageviewexistsforid:<viewid>]; if (returnedimageview) { ...etc i'm curious know if there way of passing result method, when first checked if-statement, without having store result in variable first, more akin to: if ([self imageviewexistsforid:<viewid>]) { uiimageview *imageview = if-statement-result // ??? (i.e. don't

android - Contextual Action Bar and Checkbox problems -

so got far this, please keep in mind listview dynamic called api. an adapter listview. contextual actionbar implementation. what needed. for contextual actionbar , checkbox items sync (like if icons unchecked, action bar destroyed) what tried: @override public view getview(int position, view convertview, viewgroup parent) { // todo auto-generated method stub viewholder vh; if(convertview == null){ vh = new viewholder(); convertview = minflater.inflate(r.layout.projectlist_frame, null); vh.projecttitle = (textview)convertview.findviewbyid(r.id.projecttitle); vh.projectsector = (textview)convertview.findviewbyid(r.id.projectsector); vh.cb = (checkbox)convertview.findviewbyid(r.id.checkbox1); convertview.settag(vh); } else{ vh = (viewholder)convertview.gettag(); } vh.proj

Silverlight: Scroll issue with RichTextBox Selection property -

i have grid in silverlight having lot of different controls. in last row of grid, have richtextbox. to write in richtextbox, first have scroll down because controls much. each time open grid, controls initiated initial data. there problem line this.rtb.selection.text = "initial text"; what line is, set text richtextbox control , set focus on it, result scroll bar move bottom, annoying. i want text assigned scroller should stay @ top. try this: // create paragraph paragraph prgparagraph = new paragraph(); // create text, , add paragraph run rnmytext = new run(); rnmytext.text = "this example text "; prgparagraph.inlines.add(rnmytext); // add paragraph rtb rbtmyrichtextbox.blocks.add(prgparagraph);

Erasing old folders when moving folders/files with Robocopy -

i using robocopy archive files/folders on x days on our server , finding filters must not correctly set. move executes correctly, old folders left on source server once move complete, leaving me many empty folders , subfolders. here script: robocopy "source" "destination" /dcopy:t /tee /mt:16 /move /minage:120 /log+:log.txt what missing? you need /e copy (empty) subfolders http://ss64.com/nt/robocopy.html

node.js - Passing Variable from NodeJS to client-side JS file -

is possible pass server-side javascript variable <script> tag in html view? in routes file have: exports.index = function(req, res){ res.sendfile('views/index.html', { data: {foo: bar} }); }; if using jade template, do: script(type='text/javascript'). var local_data =!{json.stringify(data)} to access data object. however, doesn't work html file. there work-around this? have route send data using res.json() , use ajax in html fetch json data. http://www.w3schools.com/ajax/

Canvas fillStyle none in HTML5 -

i want fill no color canvas i.e. want background div color should keep on displaying in div. have googled didn't find solution keep fillstyle no color. also tried omitting fillstyle leave me black color. any options available? thanks you need use clear canvas: context.clearrect(0, 0, canvas.width, canvas.height); (or rectangle need). also make sure have no css rules set canvas element's background (which might case if canvas not transparent on init canvas transparent default). if need clear non-regular shape can use composite mode: context.globalcompositeoperation = 'destination-out'; ( xor , source-out can used degree remove existing pixels variations). this clear canvas in form of next shape (path) draw (or use image solid pixels clear canvas).

java - Maintain IMAP message state information (imap flags) when using Javamail -

we have java app built third party opens read/write imap connections, , retrieves messages. marks them "read". guessing due fact app opens read/write connection. there way can prevent app updating "read (seen)" imap flag? maybe parameter can set when opening connection imap? open folder read-only instead of read/write.

css - SVG Text responsive positioning -

Image
so have svg rectangle has svg text inside. svg text being placed in textbox includes things come user's profile. information sent server , want have specific positioning so: so far i've managed easily... thing people don't fill out profiles (i.e. leave our date of birth, or location) ends creating svg text blank. <g display="default"> <text x="10" y="30">alexander great</text> <text x="10" y="40"></text> <text x="10" y="50">greece </text> </g> i can assume have name if date of birth not provided, want textbox smart enough move location right under name. right enter in specific x , y attributes text node why proving little difficult. there way make positioning more responsive? through css or through svg attributes? generating svg elements through d3.js if need to, set if statements check kind of want avoid this. thanks. assumin

Why do I get an "Error running 'autoreconf'" error using RVM to install ruby-2.0.0-head? -

i tried install ruby 2.0 via rvm in mac osx lion system, keep bumping error: installing ruby source to: /usr/local/rvm/rubies/ruby-2.0.0-head, may take while depending on cpu(s)... head @ a653ba0 merge revision(s) 42720: [backport #8829] git://github.com/ruby/ruby * branch ruby_2_0_0 -> fetch_head up-to-date. copying repo src path... ruby-2.0.0-head - #autoreconf........ error running 'autoreconf', please read /usr/local/rvm/log/1378234760_ruby-2.0.0-head/autoreconf.log skipping configure step, 'configure' not exist, did autoreconf not run successfully? ruby-2.0.0-head - #post-configuration ruby-2.0.0-head - #compiling. error running 'make -j8', please read /usr/local/rvm/log/1378234760_ruby-2.0.0-head/make.log there has been error while running make. halting installation. my autoconf version 2.68 , rvm 1.22.3. has had same problem before? managed fix issue. perl version problem. autoconf log saying "this perl not built su

c# - Call server side function from javascript asp.net -

i need track when user clicks play on wistia embedded video. need write sql db name of video , logged in user. have built need call server side function javascript. here script code: <script> wistiaembed = wistia.embed("zt4tf4py2t"); wistiaembed.bind("play", function () { alert("play"); // call c# function here return this.unbind; }); </script> thanks, sam the simplest solution send post via ajax. if you're using jquery , this: $.ajax('/your/url/here.aspx?videoid=1'); then in asp.net code, add page checks request parameter , saves information database. if you're using mvc, controller action.

c# - DataView row Filtering -

i have 2 dataview trying sort, in dgtest1 trying exception of data contains typeid != 25 , in dgtest2 trying show data typeid == 25 . when step through code throwing error on saying "cannot interpret token '!' @ position 6". can show me how use string row filter? the parameters (data table table, string rowfilter, string sort, dataviewrowstate) dgtest1.itemssource = new dataview(dttest1, "typeid!= 25", "", dataviewrowstate.currentrows); dgtest2.itemssource = new dataview(dttest1, "typeid == 25", "", dataviewrowstate.currentrows); the correct syntax use rowfilter expression in first dataview constructor is dgtest1.itemssource = new dataview(dttest1, "typeid <> 25", "", dataviewrowstate.currentrows); ^^ in second 1 need use dgtest2.itemssource = new dataview(dttest1, "typeid = 25", "", dataviewrowst

html - Tricky javascript/jquery/YUI issue for controlling white space between <input> elements -

Image
this 1 bit complicated, , describe initial problem in detail , @ moment in solving it. the problem: my cms outputs of html inputs follows: <input type="text"><input type="submit"> now because these input elements not each on own lines, there lack of white space between button , textfield so: the preferred way, , majority of html generated in fact this, have html on seperate lines: <input type="text"/> <input type="submit"/> so render this: now, cannot alter html (generated cms), , cannot play around margins , negative margins affect inputs. i have found jquery solution seems work , fixes problem: $('input').after(" "); it gives consistent white space between input elements if written in correct way. but, cannot use jquery in solution. not work jquery library. can use pure javascript, or yui3. now, on stackoverflow has helped me convert above jquery following yui3 code: y.

Preferred Representation of a 3D-Plane in C/C++ -

what preferred way of representing fixed-dimensional plane (struct) in 3d-graphics when c/c++ preferred language. should we store normalized plane normal vector , origo-distance separate entities or should we express them in non-normalized vector? first alternative requires 1 float/double other hand more efficient in algorithms operate on normal because precalculated. first alternative more numerically stable if vary normal , offset separately. sadly, c++ not best language work planes. can @ first think using 4 floating point values choice fits in simd register in sse , vmx. may have class single 128bits member, first 3 values represent plane normal , last distance ( juste homogenous coordinate, plane not needs normalized normal if care sign of distance test ). but when works planes categorize points, sphere, , other volumes, implementing single plane point distance function result sub-optimal algorithm because of time, know test lot of points against small num

android - Emulate highlight on view click -

Image
i have imageview icon. icon, example, have size: 32 x 32 dip. imageview have background: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:drawable="@drawable/simple_button_focused_holo" /> <item android:state_pressed="true" android:drawable="@drawable/simple_button_pressed_holo" /> <item android:drawable="@android:color/transparent" /> </selector> then user click on icon, can see hightlight on click. ok: work on 4 , 2 android version. size 32 little clicking. therefore, add hidden view , add onclick hidden view. view have ~ 50dip , user can easy click on icon. in case, user don't see highlight on click. cann't increase size source icon, because parent view have fix size , near icon exists other views: textviews, progressbar (which not need response on click). can change ba

php - Style Certain Table Rows from Database Query Set Data with CSS -

Image
i have set of data in mysql database. have table created these data using php loops. want style rows in ways. example, data fetched database in groups of 2, 3, 4, 5 rows. there 25 rows of data , i'd style each group bit differently, eg, add color row sub heading... i built out , didn't quite take consideration styling necessary. client wants styling , i'm trying figure out how make it. here image excel kind of thing i'm trying accomplish: i hand write html , style code cleaner , tighter when using php loops. also, if can figure out, use model , template other scenarios need style parts of table more data. here php snippet: <table> <tr> <th>hd1</th> <th>hd2</th> <th>hd3</th> </tr> <?php $mysqli = <connect db fine>; $query = 'select a, b, c t1'; if($stmt = mysqli_prepare($mysqli, $query)) { mysqli_stmt_execute($stmt); m

python - Cx_freeze with lxml.html TypeError -

import lxml.html gives me error when want compile cx_freeze: traceback (most recent call last): file "c:\python27\scripts\cxfreeze", line 5, in <module> main() file "c:\python27\lib\site-packages\cx_freeze\main.py", line 188, in main freezer.freeze() file "c:\python27\lib\site-packages\cx_freeze\freezer.py", line 572, in freeze self._freezeexecutable(executable) file "c:\python27\lib\site-packages\cx_freeze\freezer.py", line 186, in _freezeexecutable exe.copydependentfiles, scriptmodule) file "c:\python27\lib\site-packages\cx_freeze\freezer.py", line 554, in _writemodules path = os.pathsep.join([origpath] + module.parent.path) typeerror: can concatenate list (not "nonetype") list when delete import ok, need use lxml.html not importing solves nothing :( the error getting indicates module.parent.path returning nonetype . need make sure lxml in pythonpath .

java - getResourceAsStream returns null randomly and infrequently -

i'm getting null pointer exception when using getresourceasstream once every 10000 runs. how class looks like public class configloader{ private properties propies; private static configloader cl = null; private configloader(){ propies = new properties; } public static configloader getinstance(){ if(cl == null){ cl = new configloader(); } } public boolean load(){ try{ propies.load(this.getclass().getresourceasstream("/config.properties")); } catch(nullpointerexception e){ system.out.println("file not exist"); return false; } return true; } } as can seen here, class implemented singleton. resource exists , detected of time i'm not sure why failing once in while seems strange me. it find out null (propies? value returned getresourceasstream?) my guess call getinstance several threads , 1 of them gets configloader has not been initialised because

html - handle jQuery hover behavior -

i've made simple example problem guess it's easier understand. have few div s have grey color, when hover on 1 of them, see true color. if click 1 of them (and alerts clicked) should change color , .hover() shouldn't work anymore on element, until 1 clicked. i'm sitting here 1 hour , don't work: .test { background-color: #ccc;} <div class="test" id="d1"></div> <div class="test" id="d2"></div> <div class="test" id="d3"></div> and script: $(function() { $('#d1').hover(function() { $(this).css('background-color', '#f00'); }, function() { $(this).css('background-color', '#ccc'); }); $('#d2').hover(function() { $(this).css('background-color', '#f0f'); }, function() { $(this).css('background-color', '#ccc'); }); $('#d3').hover(function() { $(this).css('background-color', &

Django, filter by multiple values -

so have these models: bands(models.model): mgmt = models.foreignkey(user) name = models.charfield(max_length=200) contracts(models.model): band = models.foreignkey(bands) start_date= models.datefield() bookedgig(models.model): = models.foreignkey(bands) under= models.foreignkey(contracts) date = models.datefield() how construct in views.py file capture bookedgigs user? goal display through template, various gigs under title of contacts/bands. in views.py have def home(request): user = request.user bands = bands.objects.filter(mgmt=user).order_by('name') #this give me bands belonging user contracts = contracts.filter(band=bands) #but here bands not 1 value queryset. #if try contracts = bands.booked_gig_set.all() 'queryset' object has no attribute 'booked_gig_set' templates: know wrong how i'd display lists. {% b in bands %} band:{{b.name}} {% c in contracts %}

windows - Shared memory between mingw and visual studio application -

is possible share memory region between application compiled mingw , 1 visual studio ? i relying on boost interprocess: shared_memory_object shm (create_only, "mysharedmemory", read_write); shm.truncate(1000); mapped_region region(shm, read_write); int *pi = (int *)region.get_address(); i realized not possible via cygwin, boost shared_memory_object created via cygwin posix layer. a simple test program confirms possible. 1 caveat use exact same boost versions. between boost 1.53 , 1.54 unique id creation underlying memory mapped file has apparently changed. did not check memory alignment issues.

sql - get all nested children for a parent id -

started fiddling work table productid, labelname, categoryid, childcategoryid ------------------------------------ 1, widget a, 1, null null, category a, 2, 1 2, widget b, 3, null categories table categoryid, categoryname --------------------------- 1, category 2, category b 3, category c given information above, how categories product id? for example, given product id of 1, following desired results. desired results productid, labelname, categoryid, childcategoryid ------------------------------------ 1, widget a, 1, null null, category a, 2, 1 null, category b, null, 2 it supposed hierarchical data , apologize not being able explain well. boggling mind. widget has product id of 1 , category id of 1. means records have childcategoryid of 1 included, gives category a. cata has category id of 2, before, records have childcategoryid of 2 included in result, why category b included. this mess produces sample result sample data. still isn't clear you think al

regex - Perl: Replacing links (html) that meet certain criteria -

on forum, want automatically add rel="nofollow" links point external sites. instance, creates post following text: link 1: <a href="http://www.external1.com" target="_blank">external link 1</a> link 2: <a href="http://www.myforum.com">local link 1</a> link 3: <a href="http://www.external2.com">external link 2</a> link 4: <a href="http://www.myforum.com/test" alt="local">local link 2</a> using perl, want changed to: link 1: <a href="http://www.external1.com" target="_blank" rel="nofollow">external link 1</a> link 2: <a href="http://www.myforum.com">local link 1</a> link 3: <a href="http://www.external2.com" rel="nofollow">external link 2</a> link 4: <a href="http://www.myforum.com/test" alt="local">local link 2</a> i can using quite

android - Quick Unresolved Class Issue -

i error on line 80 (userfunction.logoutuser(getapplicationcontext());) says userfunction cannot resolved. have defined userfunction , have tried use full package name , things, can rid of error quick? (asked question future reference since happens lot) thanks! package com.example.dashboardactivity; import libary.userfunctions; import org.json.jsonexception; import org.json.jsonobject; import android.app.activity; import android.content.intent; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class loginactivity extends activity { public final string tag = "loginactivity"; button btnlogin; button btnlinktoregister; edittext inputemail; edittext inputpassword; textview loginerrormsg; // json response node names private static string key_success = "success"; private static string key_error = "error