Posts

javafx 2 - I need to select or read only .config files via file chooser in java fx can any one help me -

i need file path of .config folder can 1 me you can add extensionfilter filechooser select .config files (or type) via filechooser . e.g. filechooser flc = new filechooser(); flc.settitle("select file"); extensionfilter ext = new extensionfilter("config files", "*.config"); flc.getextensionfilters().add(ext); file tmpfile = flc.showopendialog(stage); you can set extention type filechooser. e.g. extensionfilter ext = new extensionfilter("image files", "*.png", "*.jpg", "*.jpeg"); hope helps.!

How to get the total count of records after union of CTE tables in SQL? -

i applying cte on 3 4 tables , combining results using union.i not storing combined result anywhere. facing challenge total number records resulted after union of these 4 tables. also have select limited number of rows based on flag set if export excel set select 25000 records else select 10000 records. please me on this. code sample looks below: with item_characteristics_cte ( select sequence, item_id item_characteristics_log ), item_required_quantity_log_cte ( select sequence, item_id item_required_quantity_log ) select c1.item_id item_characteristics_cte c1 inner join item_characteristics_cte c2 on c1.sequence = c2.sequence union select c1.item_id item_id item_required_quantity_log_cte c1 inner join item_required_quantity_log_cte c2 on c1.sequence = c2.sequence c2.rn = c1.rn i not sure flag mean in above question. count, use 1 additional cte this: ;with item_charac...

javascript - innerHTML in DOM -

i unable change text inside 'p' tag using script <script> var firstitem = document.getelementbytagname('p'); firstitem.innerhtml = 'adding javascript'; </script> you have several coding errors. here's corrected code: <script> var firstitem = document.getelementsbytagname('p')[0]; firstitem.innerhtml = 'adding javascript'; </script> the correct method document.getelementsbytagname('p') . note "s" @ end of "elements". then, because document.getelementsbytagname('p') returns html collection object, have either iterate on collection or reach collection grab specific dom object (which did in example [0] ). and here's working code snippet: // change first <p> tag document.getelementbyid("test1").addeventlistener("click", function(e) { var firstitem = document.getelementsbytagname('p')[0]; firstitem.in...

Map Function in Swift -

i working map function in swift. seeing use of "$0" , not know means. "$0" pointer current element of array? stringarray = newstringarray.map({"\($0)new"}) i wouldn't use word pointer, think have right idea. when use map here, you're taking array , applying function every element in array. here, function takes in 1 argument (a string) , outputs string. $0 refers first argument function you're calling which, in case, argument. the anonymous sort of functions pass map called closures. looking @ apple's official documentation on closures might helpful! here's link: https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_language/closures.html

Javascript - Homing bullet -

i've been working on little project, , while can bullet home in on mouse, has strange behavior. if bullet going left/right/up/down mouse, change direction , forth , continue fly away mouse instead of turning @ it. also, makes loops unnecessary, figure that's because i'm not keeping direction positive or negative (i wrong though). http://codepen.io/evanward/pen/voegdo?editors=001 this code have updating singular bullet. var target = app.mouse.subtract(app.bullet.pos), angle = target.angle(); if(angle < 0) { angle += math.pi * 2; } var delta = angle - app.bullet.dir; if(math.abs(delta) > 180) { if(delta < 0) { delta += 180; delta *= -1; } else { delta -= 180; delta *= -1; } } if(app.bullet.dir > math.pi * 2) { app.bullet.dir -= math.pi * 2; } app.bullet.dir += delta/10; app.bullet.pos.x += math.cos(app.bullet.dir) * app.bullet.vel; app.bullet.pos.y += math.sin(app.bullet.dir) *...

python - Django admin change list view disable sorting for some fields -

is there way(s) disable sorting function fields in django admin change list fields, users cannot click column header sort list. i tried on following method, doesn't work. https://djangosnippets.org/snippets/2580/ i tired override changelist_view in modeladmin nothing happen. def changelist_view(self, request, extra_context=none): self.ordering_fields = ['id'] return super(mymodeladmin, self).changelist_view(request, extra_context) in above case, allow user sort list id. anyone has suggestion? thanks. for django 1.7 (or version last use) not support such things. 1 possible dirty work-around defining model class method , using method instead of model field. class testclass(model): some_field = (.....) other_field = (........) def show_other_field(self): return self.other_field class testclassadmin(modeladmin): list_display = ("some_field", "show_other_field") since show_other_field model clas...

xslt 1.0 - Transform which produces default namespace convention xmlns="..." -

given following xml: <root xmlns="example.com"> <child /> </root> what xslt (version 1.0) can used produce: <newroot xmlns="stackoverflow.com"> <child /> </newroot> i've tried various combinations of exclude-result-prefixes , namespace-alias. e.g, <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:e="example.com" xmlns:s="stackoverflow.com" exclude-result-prefixes="e"> <xsl:namespace-alias stylesheet-prefix="s" result-prefix="#default" /> <xsl:template match="e:root"> <s:newroot> <xsl:apply-templates /> </s:newroot> </xsl:template> <xsl:template match="e:child"> <s:child /> </xsl:template> </xsl:stylesheet> the closest i've come following incorrect xml <new...