Posts

Showing posts from January, 2011

java - Can CVS still be installed on NetBeans 8.0 -

i have (thursday 28th may 2015) installed netbeans 8.0 on machine find cvs not come included on standard. have hunted around have found , no way install cvs on package. confess know nothing netbeans have have with cvs installation versioning. there anywhere or anyway please? and, before tells me, not sure used more - mercurial may have replaced it...

javascript - Wait for confirmation in .each statement -

i'm looping through elements , want toggle bootstrap modal if condition met, , when condition met want user choose appropriate action clicking button in modal. i'm having issue modal called , loop continues - result being modal shows , hides. how stop loop until user confirmation obtained thru bootstrap modal? you use confirm() synchronous (blocks code until user selects option) won't styled , bit nasty. otherwise you'll have rethink code/approach 'modal' dialogs in jquery not same modal windows in winforms. some possible options might nicer multiple dialog popups: loop through elements first , present single dialog options on use checkboxes/option boxes against each row needs action alternatively, change loop exit after first dialog shown, when dialog closed, restart event/action/loop first 1 have been handled , pick next one.

c# - ASMX Web service call its own instance located at different location -

i have 1 service located @ servers http://myservice/profilemanagerws/profilemgrws.asmx when client make call, need check request header property. if property call canadian instance, redirect call http://ca-myservice/profilemanagerws/profilemgrws.asmx previously service located @ servers , have hosted service canadian servers now. we not want make code changes @ consumers of http://myservice/profilemanagerws/profilemgrws.asmx should write httpmodule or soap extension instance? also, should add proxy instance call canadian instance? first of all, unless client application has functionality accept redirect response won't able alter web service functionality. what want implement geographical load balancing @ dns server. if canadian requests ip address myservice , give them ip address goes candian server configured accept requests myservice domain.

excel - Save generated Word file with unique name (mailmerge) -

i need macro. need save generated word file via mail merge. sub runmerge() dim wd object dim wdocsource object dim strworkbookname string on error resume next set wd = getobject(, "word.application") if wd nothing set wd = createobject("word.application") end if on error goto 0 set wdocsource = wd.documents.open("c:\users\admin\desktop\new folder (2)\g706014 ver.7.0.docx") strworkbookname = thisworkbook.path & "\" & thisworkbook.name wdocsource.mailmerge.maindocumenttype = wdformletters wdocsource.mailmerge.opendatasource _ name:=strworkbookname, _ addtorecentfiles:=false, _ revert:=false, _ format:=wdopenformatauto, _ connection:="data source=" & strworkbookname & ";mode=read", _ sqlstatement:="select * `mailing$`" wdocsource.mailmerge .destination = wdsendtonewdocument .suppressblanklines = true .datasource .firstr

sql - Creating an index on a table variable -

can create index on table variable in sql server 2000? i.e. declare @temptable table ( [id] [int] not null primary key ,[name] [nvarchar] (255) collate database_default null ) can create index on name? the question tagged sql server 2000 benefit of people developing on latest version i'll address first. sql server 2014 in addition methods of adding constraint based indexes discussed below sql server 2014 allows non unique indexes specified directly inline syntax on table variable declarations. example syntax below. /*sql server 2014+ compatible inline index syntax*/ declare @t table ( c1 int index ix1 clustered, /*single column indexes can declared next column*/ c2 int index ix2 nonclustered, index ix3 nonclustered(c1,c2) /*example composite index*/ ); filtered indexes , indexes included columns can not declared syntax sql server 2016 relaxes bit further. ctp 3.1 possible declare filtered indexes table variables. rtm may case i

osx - Can't switch branch: untracked working tree file because of case-insensitivity? -

i want merge develop branch master branch , thougt this: git checkout master git merge --no-ff develop git tag -a 1.0.0 but on checkout get git checkout master error: following untracked working tree files overwritten checkout: project/resources/someimage.png please move or remove them before can switch branches. aborting but have file someimage.png in develop branch , seems git has somehow old file. git case-sensitive? on local folder there no such file. shoud use git rm -f filename ? edit: now tried delete file, get fatal: pathspec './project/resources/someimage.png' did not match files now i'll try checkout master branch -f. i forced checkout this git checkout master -f and local differences should ignored. think through deleting , re-inserting image there problem in index or so.

Meteor Custom Accounts createUser with multiple parameters for user -

i trying user registration process in meteor . looked @ meteor accounts-password package , handle pretty required logic. app ,i struggling on following 2 points ---- 1 . accounts-password api named accounts.createuser takes limited parameters -- username , email , password registering user . requiring other fields mobile_number , first_name, last_name, address completing user registration creatuser . mobile number used send otp verify user's mobile . email verification , meteor . how can multiple parameters based create user executed using accounts-password api's. 2 . accounts-password api named accounts.loginwithpassword takes email , username , password login . in app , user enter either email or mobile_number 1 input , password second input , , based on , need verify user , log him in app . how can mobile number based loggingin included ? i've had similar use case had build system users mobile numbers , no email ids. use profile field store addition

javascript - jquery - how can I select element after '.first()' using? -

how can select html tag after using jquery function called .first() ? html <html> <head> </head> <body> <div> <a> <img id="#hello"> </a> </div> <div></div> </body> </html> js (jquery) var elemfirst = $(div).first(); var selectimg = elemfirst.$('img#hello'); // var selectimg = elemfirst.find('img'); <- working want select manual selectimg.addclass('some-css'); with respect you can use $('child','parent') selector, var elemfirst = $('div').first(); var selectimg = $('#hello',elemfirst); //or $('img',elemfirst); also, id has # , should id="hello" . if need keep value in id, use var selectimg = $('img[id="#hello"]',elemfirst);

Logging deletion of rows in table sql server -

Image
i have been searching way log deletion of rows table. tried log record changes in sql server in audit table didn't me. i have song list database, log table has columns: title / artist / year / position / sentindate . there list songs years 1999 2014, , every year has 2000 songs (top2000 called in netherlands). basically log table should once year has been deleted: i need basic way trigger-log when deletes year list of 1999-2014. i hope have informed enough understand, if not try explain in more detail. a trigger rejects or accepts each data modification transaction whole. using correlated subquery in trigger can force trigger examine modified rows 1 one. examples a. use after insert trigger the following example assumes existence of table called newsale in pubs database. create statement newsale: create table newsale (stor_id char(4), ord_num varchar(20), date datetime, qty smallint, payterms varchar(12), title_id tid) if

python - API for context managers -

i have object (say fileproxy ) looks file work. initialised foo = fileproxy("/some/file.txt") , can use so foo.open() foo.write("something") foo.close() i want make work context manager. question whether should make work context manager more creating object calls .open method , .close upon exit. with fileproxy("/some/file.txt") f: f.write("something") or should like with fileproxy("/some/file.txt").open() f: f.write("something") which more symmetrical non context manager api. i prefer former myself looks different way regular files in python work , i'm wondering if there's anti pattern i'm implementing here.

The import android.support.v7.app.ActionBarDrawerToggle cannot be resolved -

i trying use actionbardrawertoggle , getting error: the import android.support.v7.app.actionbardrawertoggle cannot resolved it got no problem importing v4 type understand, deprecated , doesn't function want to. further more, got no issue importing other v7 classes actionbar or actionbaractivity , happens actionbardrawertoggle only. how can issue (and type) resolved? some simple steps need follow: go project in navigator, right click on properties. go java build path tab on left. go libraries tab on top. click add external jars. go adt bundle folder, go sdk/extras/android/support/v7/appcompat/libs. select file android-support-v7-appcompat.jar go order , export , check box next new jar. click ok.

android - how to reduce spacing in the bitmap (render the text) -

i code print text in form of image. problem is,when print.the spacing far each line. dont know how. in code not have "\n" . dont why become that. whether drawtext or drawbackground public void drawtext(string text, int textsize) { textpaint textpaint = new textpaint(paint.anti_alias_flag | paint.linear_text_flag); //(paint.anti_alias_flag | paint.linear_text_flag) textpaint.setstyle(paint.style.fill); textpaint.setcolor(color.black); textpaint.settextsize(textsize); try { typeface tf =typeface.createfromasset(getassets(),"fonts/andalemono.ttf"); textpaint.settypeface(tf); } catch(exception e) { log.d("your tag", "typeface error: ", e); } staticlayout mtextlayout = new staticlayout(text, textpaint, 370, layout.alignment.align_normal, 1.0f, 0.0f, false); //draw background paint paint = new paint(paint.anti_alias_flag | paint.linear_text_flag); paint.setstyle(

javascript - how to create circles with text over svg file using d3 js? -

i beginner d3 js. have div contains object tag having svg file. i need create circle texts on svg file , bind click functions on them using d3 js. thanx in advance. below html code: <div class="span8 canvasdiv"> <object data="img/floor.svg" type="image/svg+xml" id="floorcanvas"></object> </div> js code: var svgcontainer = d3.select("#floorcanvas"); var circle = svgcontainer.append("circle") .attr("cx", 30) .attr("cy", 30) .attr("r", 20); youll need create 'g' tag append both circle , text 'g' cant append text directly svg shape (not tested) : html : <div class="span8 canvasdiv"> <object data="img/floor.svg" type="image/svg+xml" id="floorcanvas"></object> </div> js code:- va

excel - Change font color for a part of text in cell -

i have cells contain below value "image not allowed|png" i want change color of |png alone or whatever comes after "|" now trying change font color using below code cells(4,2).font.color = rgb(255, 50, 25) it change entire cells font color, possible change selected text color( |png ) using vba? this should start : sub vignesh() dim startchar integer, _ lencolor integer = 1 5 sheets("sheet1").cells(i, 1) startchar = instr(1, .value, "|") if startchar <> 0 lencolor = len(.value) - startchar + 1 .characters(start:=startchar, length:=lencolor).font.color = rgb(255, 0, 0) end if end next end sub

How do I build up a Neo4j graph from hundreds of thousands of events? -

we have event sourced application , thinking adding neo4j question view relations. think use case good, problem if replay every event 1 one take time build graph. what's best rebuild graph ~1.000.000 events? resulting graph approx. 100.000 nodes , lot of relations. first naive attempt 1 one takes way time since might want more 1 time. is best approach build inmemory list of nodes , build large cypher query nodes , 1 relationships? or best way use batch api? in ideal situation logic rebuilding should same when handle event 1 one live handling "commit" should done after each event. if requirement keep same logic in application lifecycle events, , use cypher in application, you'll have no choice handle transactional cypher endpoint. it barely doable, while load csv , batch api give more performance. i have application write ~1250 cypher statements per cypher transaction, each transaction takes approximately between 0.2 , 0.3 seconds. some little ti

sftp - Apache Commons VFS get or put files over a port-mapping -

i have question using commons-vfs2 picture, there server between client , file server used map file server port 22 10022, how can use commons-vfs2 upload or download file file server via sftp , ftp protocol? i tried use proxy following code: sftpfilesystemconfigbuilder.getinstance().setproxyhost(opts, "xxx.6.2.xx"); sftpfilesystemconfigbuilder.getinstance().setproxyport(opts, 10022); sftpfilesystemconfigbuilder.getinstance().setproxytype(opts, sftpfilesystemconfigbuilder.proxy_http); but it's not work, picture url http://ccwuj.img44.wal8.com/img44/507529_20150115150159/143279929037.jpg

javascript - How to call a PHP from a mobile app? -

i have html page takes login user , authenticates , redirects different page. converted web-page app using phonegap app build function. trying call php thats on server. proper way so? below code. html <script> function postdata() { // 1. create xhr instance - start var xhr; if (window.xmlhttprequest) { xhr = new xmlhttprequest(); } else if (window.activexobject) { xhr = new activexobject("msxml2.xmlhttp"); } else { throw new error("ajax not supported browser"); } // 1. create xhr instance - end // 2. define when xhr feed response server - start xhr.onreadystatechange = function () { if (xhr.readystate === 4) { if (xhr.status == 200 && xhr.status < 300) { document.getelementbyid('div1').innerhtml = xhr.responsetext; } } } // 2. define when xhr feed response server - start var userid = document.get

google chrome - How to move the mouse pointer to the center of the screen and apply left click? -

i have kiosk google chrome browser running on boot. when boots not work unless left click generated on center (because of google chrome bug). tried following not working. how tell go center of screen , click left (not right click). set wshshell = wscript.createobject("wscript.shell") wshshell.sendkeys("+{f10}") edit: runme.bat timeout 10 > nul "c:\program files (x86)\google\chrome\application\chrome.exe" --kiosk edit: centerme.vbs (failed) set = createobject("wscript.shell") private declare function setcursorpos lib "user32" (byval x long, byval y long) long private sub somesub() dim somex long, somey long somex = 400 somey = 400 setcursorpos somex, somey end sub wscript.quit vbscript doesn't allow moving mouse cursor or applying mouse clicks. "vbscript" code posted vb/vba code , not work in vbscript. need autoit you're trying do.

html5 - Phaser-Projectiles being affected by gravity -

i set gravity 1000 in create function : game.physics.arcade.gravity.y = 1000; but when intergraded projectiles in own function: function shootr(){ if (canshoot) { if (attacktimer< game.time.now) { attacktimer = game.time.now + 500; var projectile; projectile = projectiles.create( player.body.x + player.body.width / 2, player.body.y + player.body.height / 2, 'powerball'); game.physics.enable(projectile, phaser.physics.arcade); projectile.outofboundskill = true; projectile.anchor.setto(0.5, 0.5); projectile.body.velocity.x = 400; } } } the projectile being affected gravity, being dragged ground when projectile being launched. how make shoots in straight line, while other objects shot being affected gravity.

strftime is always showing am for times (even for "pm" time also) for every datetime entry in rails -

iam saving current date , time in database checkin time in db. using time.now. , when query database iam getting time in "am" time in "pm" also. @curr_emp_attendace = current_employee.punch_in_outs.where("year(check_in) = ? , month(check_in) = ?",time.now.strftime("%y") ,time.now.strftime("%m") ) and in view iam displaying <%= attendace.check_in.strftime("%a %d, %h:%m %p") when display iam getting "am" time (for times in "pm") also. might reason iam not understanding. try this: @curr_emp_attendace = current_employee.punch_in_outs.where(:check_in => time.now)

php - Redirect to a subfolder using htaccess -

i have searched similar topics in forum , nothing helped me. here looking for: have site having login url as site.com/folder1/php/login.php now want hide "php" folder name url, remove .php extension like site.com/folder1/login also folder name "folder1" may vary, folder name "php" remains same in urls. try in root/.htaccess rewriteengine on rewritecond %{the_request} ^[a-z]{3,}\s/?([^/]+)/([^/]+)/([^.]+)\.php [nc] rewriterule ^ /%1/%3 [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/]+)/([^/]+)/?$ /folder1/php/$2.php [nc,l]

c# - Check whether a string contain '&' character only -

how check whether string contains "&" only. mean if user enter & or &&& or string of '&'. please note http://myurl.com/&var=79 or should ignored. should check string contains & character. please me!!! i'm sure there better way regex here possible solution: class program { static void main(string[] args) { char testchar = '&'; string test1 = "&"; string test2 = "&&&&&&&&&&"; string test3 = "&&&&&&&u&&&&&&&"; console.writeline(checkifonly(testchar, test1)); // true console.writeline(checkifonly(testchar, test2)); // true console.writeline(checkifonly(testchar, test3)); // false console.writeline(checkifonly('u', test3)); // false console.wr

drop down menu - How to set pre-selected value in Yii2 Dropdownlist -

here set preselected value in yii2 dropdownlist, this dropdownlist, how can set preselect value in <?= $form->field($model, 'tpa_email')->dropdownlist( arrayhelper::map(approvaldetails::find()->all(),'id','tpa_email'), ['prompt' => 'select tpa email..']) ?> becoz everytime while updating form , value getting reset. the value of $model->tpa_email used select value list items. make sure $model->tpa_email contains key of value want have selected.

Using php variables in sql from different php blocks (Undefined variable: xxxx) -

i following this tutorial on how modify sql database. seems fine in when run code below error saying undefined index in line 11 , 12 not defined. can point mistake? can use variable 1 block in another?(the guy in tutorial does) <?php include '/connection.php'; if(!isset($_post['submit'])){ $query="select * shop id=$_get[id]"; $result=mysqli_query($conn,$query)or die(mysqli_error($conn)); $shop=mysqli_fetch_array($result); } ?> <form action="modify.php" method="post"> <input name="name" value="<?php echo $shop['name']; ?>"> //error here <input name="city" value="<?php echo $shop['city']; ?>"> //and here <input type="hidden" name="id" value="<?php echo $_get['id']; ?>"> <input type="submit" name=submit value="modify"> </form> <?php if(isset(

android - broadcast receiver works but after 1 or 2 hours it does not work -

here manifest <receiver android:name=".mycallreceiver" > <intent-filter> <action android:name="android.intent.action.phone_state" /> </intent-filter> </receiver> and public class mycallreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { if (intent.getstringextra(telephonymanager.extra_state).equals(telephonymanager.extra_state_ringing)) { code } if (intent.getstringextra(telephonymanager.extra_state).equals(telephonymanager.extra_state_idle) || intent.getstringextra(telephonymanager.extra_state).equals(telephonymanager.extra_state_offhook)){ code } } } it works after sometime press button , phone idle doesn't work more (i added "android.os.process.killprocess(android.os.process.mypid());" @ end of code , better , work maybe 2 3 hour afte

javascript - JSON.parse() on a large array of objects is using way more memory than it should -

i generate ~200'000-element array of objects (using object literal notation inside map rather new constructor() ), , i'm saving json.stringify 'd version of disk, takes 31 mb, including newlines , one-space-per-indentation level ( json.stringify(arr, null, 1) ). then, in new node process, read entire file utf-8 string , pass json.parse : var fs = require('fs'); var arr1 = json.parse(fs.readfilesync('jmdict-all.json', {encoding : 'utf8'})); node memory usage 1.05 gb according mavericks' activity monitor! typing terminal feels laggier on ancient 4 gb ram machine. but if, in new node process, load file's contents string, chop @ element boundaries, , json.parse each element individually, ostensibly getting same object array: var fs = require('fs'); var arr2 = fs.readfilesync('jmdict-all.json', {encoding : 'utf8'}).trim().slice(1,-3).split('\n },').map(function(s) {return json.parse(s+'}');})

objective c - Get current NSDate with a format of: dd/MM/yyyy -

i'm trying current date following format: dd/mm/yyyy . the way format it, this: nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"dd/mm/yyyy"]; and current date this: [nsdate date] . how can mix 2 together, , current date format? if want current day format this: dd/mm/yyyy. you can use code: nsdate *datecenter = [nsdate date]; nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"d, mmmm, yyyy"]; nsstring *datestring = [dateformat stringfromdate:datecenter]; lbldaymonthyear.text = datestring;

Is it possible to add optimized assembly file into *.c file as a inline assembly? -

i generate test.s file using gcc -s -o3 test.c . there quick sort code in test.c. possible add assembly code of quick sort of test.s test.c file again instead of original quick sort c code? almost certainly. if have compiler capable of using inline assembly (it's not mandated standard, rather it's extension), can inject whatever code wish. my question "why?". if compiler generates optimised code in first place, let job. in other words, compile code high optimisation. that way, if things change (better compiler, new architecture, etc), code auto-magically improve next time compile, that's not going happen if tell use specific assembly instructions. if, reason, don't want all code @ high optimisation, can split sort code in own file , use different flags one. there's still no reason why have assembly. if want it, should (relatively) simple matter of mapping .s file correct inline assembly format.

java - Error while running a basic wordcount program on Eclipse -

let me inform beginner in hadoop domain. so, referring https://developer.yahoo.com/hadoop/tutorial/module3.html tutorial. completed set , copied codes eclipse map-reduce project. no error showing far wordcountmapper,wordcountreducer , wordcount.java files concerned. now, when click on run on hadoop , select set server on vm player , click next, nothing happens afterwards. same "run on hadoop selected server page" stays stucked. progress information panel comes shorter span, can't check says actually. however, @ log files every time after completing these steps. please me out. struggling since last 2 days. far required libraries go, have added required .jar files hadoop installation path. .log file contents --- !entry org.eclipse.ui 4 0 2015-05-31 16:56:39.849 !message unhandled event loop exception !stack 0 java.lang.classcastexception: org.eclipse.swt.widgets.table cannot cast org.eclipse.swt.widgets.tablecolumn @ org.eclipse.swt.widgets.table.getcolumn(

javascript - how to get character's length which encoding with utf8mb4 in php and js -

i use mysql support utf8mb4 store emoji, in php or js side, can not correct length of them function of textarea input maxlength. as far know, utf8mb4 not support php or web side. know how make it? i js solve in js side ,which supported twitter! see twitter-text-js but how make in php side, don't find new twitter-text-php? find answer , how use it? js twitter-text-js var tweet = "👌h饿1"; var remainingcharacters = twttr.txt.gettweetlength(tweet); php mb_strlen

css - How to make a 100% height container in Bootstrap 3 -

Image
here's trying achieve. my html looks like: <body> <header> ... // bs sticky navbar - visible no matter </header> <main> <div class="container"> <div class="row"> </div> </div> </main> <footer> .. // footer @ bottom content can push down </footer> either .container or .row can white div. needs touch footer when there not enough content. the main div must stay 100% width. the solution must css , work in ie10+/modern browsers. ie9 great not necessary long alternative doesn't crap (i.e. footer in middle of text). i have tried many solutions such as: - http://thatemil.com/blog/2013/11/03/sticky-footers-flexbox-and-ie10/ - http://www.fredonism.com/archive/min-height-100-percent-and-sticky-footer.aspx unfortunately nothing found works. of solutions see not involve inner white div , use main one. 2nd solution linked above, example, shrinks main di

Non standard evaluation from another function in R -

here example hadley's advanced r book: sample_df <- data.frame(a = 1:5, b = 5:1, c = c(5, 3, 1, 4, 1)) subset2 <- function(x, condition) { condition_call <- substitute(condition) r <- eval(condition_call, x, parent.frame()) x[r, ] } scramble <- function(x) x[sample(nrow(x)), ] subscramble <- function(x, condition) { scramble(subset2(x, condition)) } subscramble(sample_df, >= 4) # error in eval(expr, envir, enclos) : object 'a' not found hadley explains: can see problem is? condition_call contains expression condition. when evaluate condition_call evaluates condition, has value >= 4. however, can’t computed because there’s no object called in parent environment. i understand there no a in parent env, but, eval(condition_call, x, parent.frame()) evals conditional_call in x (a data.frame used environment), enclosed parent.frame() . long there column named a in x, why should there problem? tl;dr when subset2() c

javascript - Function assignment doesn't work -

i'm new node.js. have searched forum couldn't find similar question. here problem encountered. following code runs fine. process.stdout.write("hello world!\n"); but following code: var myprint = process.stdout.write; myprint("hello world"); will generate following error: typeerror: cannot read property 'defaultencoding' of undefined any suggestions? thank much. probably, write() method needs called correct object reference write() method knows stream writing to. there multiple ways work around this. here's 1 way: var myprint = process.stdout.write.bind(process.stdout); myprint("hello world"); see .bind() on mdn more info. for future reference, when do: var myprint = process.stdout.write; myprint contains reference write method , method called no object reference. means this pointer inside write() method not point @ stdout stream when call process.stdout.write() . if method needs it's in

javascript - How to download a file using Express and Node.js in Response to a Form -

so have a bunch of files i'd users able download submitting form (sending request suppose). can tell me how change views, routes , app.js files able this? should routing handled in index.js file (where users can download files)? or should make brand new route using app.js file? edit: i'm using multer upload files. my scattered code @ point: in app.js have this: app.get('/download', function(req, res, next){ var file = req.params.file , path = __dirname + '/uploads/' + file; res.download("upload/a.tiff"); }); in index.jade have this: h2 download form(action="/download", method="get") input(type="submit", name="download") there nothing relevant in index.js file @ 1 point had function in app.js i've listed in index.js file. did not seem work. right have trying able download 1 a.tiff file. this error: 404 error: not found @ app.use.res.render.message (/users/brennan/persona

python 2.7 - Unusual behavior of jinja2 template_filter decorator in flask application -

i have filters.py file in flask application , content is: # -*- coding: utf-8 -*- __future__ import absolute_import, unicode_literals, print_function import arrow fresque import app @app.template_filter('short') def shorted_commit(cid): """gets short version of commit id""" return cid[:6] @app.template_filter('humanize') def humanize_date(date): """ template filter returning last commit date of provided repo. """ return arrow.get(date).humanize() now trying use template filter in html file content follows: {% extends 'layout.html' %} {% import 'macros.html' macros %} {% block content %} {% if tree %} {% entry in tree %} <span> {{ entry.name }} </span> <span> {{ entry.hex|short}} </span> {% endfor %} {% endif %} {% endblock %} also controller function renders pages written , saved in file

Solr multiple facet with ex and tag functions -

i using solr 4.10 , our requirement have multiple facets. each of facet should filter should impact selected facet, not other facets. for example, lets there 2 facets brand , type. when user select brand nikon, should impact type facet, not brand facet. similar behavior type. i tried implementing tag , ex function , query comes below, /select?q=query&wt=json&start=0&rows=10&facet=true&fq={!tag=brand}brand:(canon,nikon)&fq={!tag=type}type:(tv)&facet.mincount=1&facet.field={!ex=brand}brand&facet.field={!ex=type}type&fl=id,brand,type this works fine of cases, when there 0 results, somehow solr returns facets 1 of facet. above query, value in type, though there no documents in response. below response get, { "response": { "numfound": 0, "start": 0, "docs": [] }, "facet_counts": { "facet_queries": {}, "facet_fields": { "type": [

r - Access data.table columns with strings -

apologies question makes obvious work in python/pandas, i'm stuck this. how select data.table column using string? dt$"string" dt$as.name("string") dt$get("string") i'm sure super simple, i'm not getting it. appreciated! -------------- edited add ---------------------- after of helpful comments , tips below, think i've narrowed down problem bit , have reproducible example. consider: dt = data.table(id = c("a","a","a","b","b","b"), col1=rnorm(6), col2=rnorm(6)*100) and assume want assign values in col2 col1 . i've learned below, data.table syntax dt[,col1:=col2] , clean , simple. problems start when 1 (or both) of variables in j argument strings. found following: dt[, "col1":=col2] works expected dt[, "col1":="col2"] fails expected (tries assign character col2 double vector col1 dt[, "col1":=get("col2&qu

rust - How do I use static lifetimes with threads? -

i'm struggling lifetimes in rust (1.0), when comes passing struct s via channel s. how simple example compile: use std::sync::mpsc::{sender, receiver}; use std::sync::mpsc; use std::thread::spawn; use std::io; use std::io::prelude::*; struct message<'a> { text: &'a str } fn main() { let (tx, rx): (sender<message>, receiver<message>) = mpsc::channel(); let handle_receive = spawn(move || { message in rx.iter() { println!("{}", message.text); } }); let stdin = io::stdin(); line in stdin.lock().lines() { let message = message {text: &line.unwrap()[..]}; tx.send(message).unwrap(); } } i get: main.rs:62:39: 62:52 error: borrowed value not live long enough main.rs:62 let message = message {text: &line.unwrap()[..]}; ^~~~~~~~~~~~~ note: reference must valid static lifetime... main.rs:62:58: 64:6 not

minecraft - I need to know how to test if a value is not equal to multiple strings java -

how do this? want test if sign line 2 (1) equal "closed" or "open" , if not want please specify if open or closed says if type open or closed || not work... package me.mcmatt.shops; import org.bukkit.chatcolor; import org.bukkit.material; import org.bukkit.sound; import org.bukkit.block.block; import org.bukkit.block.sign; import org.bukkit.entity.player; import org.bukkit.event.eventhandler; import org.bukkit.event.listener; import org.bukkit.event.block.action; import org.bukkit.event.block.signchangeevent; import org.bukkit.event.player.playerinteractevent; public class signs implements listener { @eventhandler public void onsignchange(signchangeevent e) { if (e.getline(0).equalsignorecase("[shop]")) { block attached = e.getblock().getrelative(0, -1, 0); string name = e.getplayer().getdisplayname(); if (!(attached.gettype() == material.chest)) e.getplayer().sendmessage(chatcol

ruby on rails - ActiveAdmin: routes for overridden controllers -

i want override login activeadmin. created sessionscontroller , override create action like class admin::sessionscontroller < activeadmin::devise::sessionscontroller def create session[:zzz] = 1 logger.debug("@@@ #{session[:zzz]}") super end end how should apply changes activeadmin devise controller? for devise make like devise_for :users, controllers: {sessions: 'users/sessions'} in routes.rb my routes.rb activeadmin devise_for :admin_users, activeadmin::devise.config activeadmin.routes(self) i needed add overrided controller's code bottom of config/active_admin.rb class admin::sessionscontroller < activeadmin::devise::sessionscontroller def create session[:zzz] = 1 logger.debug("@@@ #{session[:zzz]}") super end end

ios - SWRevealController Hanging -

when segue rear menu cell via swrevealviewcontrollerseguepushcontroller uitableviewcontroller , animation starts hangs without app crashing, ui unaccessible via touches , doesn't react anymore. when instead use uiviewcontroller works perfectly. add again uitableview in uiviewcontroller , hangs again. basically, when using uiviewcontroller works. when using either uitableviewcontroller or nested uitableview in uiviewcontroller hangs. any help? vince

c - Socket programming - why do we not convert sin_family to network order? -

below example of valid socket creation (in c): // construct local address structure struct sockaddr_in servaddr; // local address memset(&servaddr, 0, sizeof(servaddr)); // 0 out structure servaddr.sin_family = af_inet; // ipv4 address family servaddr.sin_addr.s_addr = htonl(inaddr_any); // incoming interface servaddr.sin_port = htons(servport); // local port we need convert address , port network order not address family. why that? sin_family isn't sent on network, there's no need use network byte order. it's local flag operating system only. indicates polymorphic type of struct sockaddr * pointer, because ipv4 isn't format. af_unix address doesn't ip address , port fields, instance.

java - How to set rectangle bounds to the frame? -

looks i'm doing in instructions frame doesn't work. if put usual bounds stays same. doing wrong? import java.awt.rectangle; import javax.swing.jframe; import javax.swing.joptionpane; public class translatedemo { public static void main(string[] args) { // construct frame , show jframe frame = new jframe(); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true); rectangle r1 = new rectangle(0,0,60,30); frame.setbounds(r1); } } some notes made: that small rectangle (this important, because os's won't allow set bounds of jframe small, or else minimize, exit, etc. buttons collide. i understand using tutorial or demo of sorts; but, in reality, setting bounds of jframe isn't effective method accomplishing anything. using layout better in situation (but, wrong :) ). please more specific in error experiencing, if wish receive better answer. hope helps you, , bes

c++ - How to read value from `Link` between two nodes using omnet++ -

Image
i'm trying implement ford fulkerson algorithm in omnet++ using c++. took c++ class article couldn't read values network should come link s my class algorithm : // c++ program implementation of ford fulkerson algorithm #include <iostream> #include <limits.h> #include <string.h> #include <queue> using namespace std; // number of vertices in given graph #define v 6 class node : public csimplemodule { protected: // following redefined virtual function holds algorithm. virtual void initialize(); virtual void handlemessage(cmessage *msg); }; define_module(node); void node::initialize() { // these values should come links int graph[v][v] = { {0, 16, 13, 0, 0, 0}, {0, 0, 10, 12, 0, 0}, {0, 4, 0, 0, 14, 0}, {0, 0, 9, 0, 0, 20}, {0, 0, 0, 7, 0, 4}, {0, 0, 0, 0, 0, 0}

sql server - How do I add MSSQL php module in Jelastic -

Image
i developing application in php & mysql needs integrate microsoft database sql server client. we've done integration our development environment, discover jelastic not have mssql module. in jelastic documentation says possible upload additional modules php ( http://docs.jelastic.com/php-extensions ). know how compile mssql use in jelastic? is there way connect sql server database in jelastic, via php, without adding new module? if experience difficulties or have questions, using jelastic, can contact support team of chosen hosting provider. this, click on top right button "help" , choose "contact support" on dashboard:

r - Visualizing graph/network with 3 layeres (tripartite) igraph -

Image
there topic tripartite graphs in igraph, way use layout.sugiyama not me. impose order nodes. actually, visualize edge crossing tripartite graph. suppose have tripartite graph 3 nodes in each column. have 1 edge coming out each node. 6 edges be, example, (a->e, b->f, c->d, d-> h, e->g, f-> i). that: d g b e h c f how can using igraph? said, want see crossing edges. thank you. for example, do: library(igraph) coords <- matrix(c(rep(1:3, each = 3), rep(3:1, 3)), ncol = 2, dimnames = list(letters[1:9], c("x", "y"))) g <- graph.formula(a--e, b--f, c--d, d-- h, e--g, f--i) plot(g, layout = coords[v(g)$name, ])

c++ - passing vector from one class to other as object -

i have 2 classes net , ga , want pass vector ga net through main . consider following code. class ga { inline vector <double> get_chromosome(int i) { return population[i]; } } class net { int counter; net::setweights(vector <double> &wts){ inphidd = wts[counter]; } } main(){ net.setweights( g.get_chromosome(chromo) ); } error is: network.h:43:8: note: void network::setweights(std::vector<double>&) void setweights ( vector <double> &wts ); ^ network.h:43:8: note: no known conversion argument 1 ‘std::vector<double>’ ‘std::vector<double>&’ any idea? this simple: according standard, const references can bind temporaries. g.get_chromosome(chromo) returns temporary, , net::setweights(vector <double> &wts) tries bind regular reference. the line network::setweights(std::vector<double>& wts) should network::setweights(const std::vecto

Java:User Enter Antilog Base issue? -

i'm finding anti-logarithm of enter values.answer right natural log base.but when try find anti-log enter base.then doesn't give correct answer such as anti-log value 10 base 10 = 10000000000 code: public class { public static void main(string[] args) { scanner s = new scanner(system. in ); double value, res, value2, res2; system.out.print("enter anti log value:"); value = s.nextdouble(); res = math.exp(value); system.out.println("answer of antilog natural base is: + res); system.out.println("-----------------------------------"); system.out.print("enter base:"); value2 = s.nextdouble(); res2 = math.exp(value) / math.exp(value2); system.out.println("answer of antilog enter base : " + res2); } } it give answer enter base 10 = 1.0 how fix this. assuming understand question correct should replace res2 = math.exp(value) / math.exp(value2); with res2 = math.pow(val