Posts

Showing posts from April, 2012

jQuery move all children to another div -

i have div many childen. how move of them div using jquery ? code looks like: jquery("body").append("<div id='popupwrapper'></div>"); var myid = $('.floatingframelightblue1').attr('id'); jquery(myid).children().append("popupwrapper"); but doesn't work. i'm doing wrong? here have simple example of it: http://jsfiddle.net/lhr79/ as have told you. need use appendto instead of append , specify selector type (class, id... ) using . or # preceding name. in case: #popupwrapper popupwrapper id , not class.

android - How to show the DrawerLayout when sliding from left to right, no matter where? -

background google has introduced drawerlayout, shows menu on left area of screen when click on "up" button of action bar. because library isn't supported yet on actionbarsherlock, there way overcome using this project . it has variants on many apps: currents, gmail, hangouts, youtube... the question on "currents" app (and in youtube) , when user slides (most-left) page left right , drawerlayout appears, no matter finger has started touch . how can achieve same effect? maybe should use onintercepttouchevent ? there isn't documentation , tutorials of cool things can done , other this link (ok , this one too) . (in part of "give user quick peek") 20dp on left used functionality, can see "currents" work larger area. it seems library still not quite finished, , layout xml file cannot shown in visual ui editor... edit: seems library open sourced. code available on : .../android-sdk\sources\android-18\android\sup...

winforms - paint rectangle on column header in c# -

Image
i have painted datagridview column header , called repaint event in scroll event ,but not seems repaint . text in painted rectangle gets scettered ( see second image) here code, void datagridview1_scroll(object sender, scrolleventargs e) { rectangle rtheader = this.datagridview1.displayrectangle; rtheader.y += 0; rtheader.height = this.datagridview1.columnheadersheight; } rectangle r1; void datagridview1_paint(object sender, painteventargs e) { string[] monthes = { "apple", "mango", "cherry", "grapes", "pineapple" }; (int j = 0; j < this.datagridview1.columncount; ) { r1 = this.datagridview1.getcelldisplayrectangle(j, -1, true); int w2 = this.datagridview1.getcelldisplayrectangle(j + 1, -1, true).width; r1.x += -2; r1.y += 30; r1.width = r1.width + w2 - 1; r1.height = r1.height / 3 - 2; e.graphics.fillrectangle(new solidbrush(t...

How to get javascript values on code behind in c# -

i need javascript values on code behind in c#.i know can use hidden field there no server control on page postback.please tell me how can vales in code behind. here code: <html> <head> <title>facebook logged in user details username,email,profile image</title> <script src="jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <script> // load sdk asynchronously (function (d) { var js, id = 'facebook-jssdk', ref = d.getelementsbytagname('script')[0]; if (d.getelementbyid(id)) { return; } js = d.createelement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_us/all.js"; ref.parentnode.insertbefore(js, ref); } (document)); // init sdk upon load window...

c# - Can Expression.PropertyOrField be used to access a static property or field? -

the documentation of expression parameter of expression.propertyorfield states can null static members: an expression type contains property or field named propertyorfieldname . this can null static members . (emphasis mine) however, whenever pass null argumentnullexception . the documentation of method contradictory: the documentation of expression parameter states can null static members the documentation of argumentnullexception states thrown if expression null fact is : method can't used access static members, documentation of expression parameter incorrect. when expression correct type supplied, method doesn't work expected, because ever looks instance members. to access static field or property, use expression.makememberaccess instead.

php - Delete MYSQL values past the most recent 80 -

i'm using: select * users order date_time desc limit 0, 80 to display 80 recent usernames, how can make query such deletes other entries past 80? i presume need cron job, kind of query need execute? here different ways: delete users users left join ( select id users order date_time desc limit 0, 80) t1 on users.id=t1.id t1.id null sql fiddle demo and without limit: delete users users left join ( select id ( select id, @currow := @currow + 1 row_number users,(select @currow := 0) r order date_time desc) t row_number<=80 ) t1 on users.id=t1.id t1.id null sqlfiddle demo

java - Can I access an outer class's field from a static inner class? -

i have class has static inner class: class { private list<string> list; public static class b { // want update list here without making list static // don't have object outer class } } as can see other answers need non-static inner class that. if cannot make inner class non-static can add required getter , setter method in outer class , access them creating instance of outer class inside inner static class: public class { private list<string> list = new arraylist<string>(); public list<string> getlist() { return list; } public void setlist(list<string> list) { this.list = list; } public static class b { // want update list here without making list static void updlist() { a = new a(); a.setlist(someotherlist); system.out.println(a.getlist()); } } }

MySQL / PHP Not inserting correct amount of entries -

hopefully quite simple someone. i have following code: <?php // connects database mysql_connect("localhost", "xxxxx", "xxxxx") or die(mysql_error()); mysql_select_db("xxxxx") or die(mysql_error()); require("../includes/common.php"); require("admin_header.php"); require("admin_menu.php"); $query = "truncate table pt_menutitles"; $result = mysql_query($query) or die(mysql_error()); // menu headers category $data = "select a.menuheader, a.total from(select distinct (menuheader),count(*) total `pt_products` `menuheader` <> '' group `menuheader` order total desc limit 4) order a.menuheader"; $result = mysql_query($data) or die(mysql_error()); while($info = mysql_fetch_array($result)) { $menudata = "select a.subcategory, a.menuheader,a.totcount from(select distinct (subcategory),menuheader,count(*) totcount `pt_products` `menuheader`=...

quickfix - Why is a FIX connection dropping heartbeats when both endpoins are on the same server? -

we have 2 applications using quickfix engine, both running in same machine. see session ends due lack of heartbeats. how can since both running on same machine? fix heartbeat mechanism has nothing fact applications communicating using fix protocol run. if see session being dropped due lack of heartbeat have determine session did not send heartbeat (it fail respond «test request» message, if any) , why did happen. possible reasons are: server , client have different heartbeat interval settings , server not honor client's heartbeat interval (field #108 in «logon» message) , test request/response logic broken (or turned off). underlying transport errors (i.e. tcp/ip errors or udp packet drops). other software/hardware bugs. something else. hope helps. luck!

xaml - c# DataBinding in User control Win8 -

i've observablecollection's list receives data database, , put data in grid, data binding. so, i've user control appears when click in item of grid. want text box of user control, show selected item of grid. i've tried using data binding, textbox not shows selected item.. possible ? grid code: <flexgrid:c1flexgrid x:name="grid" itemssource="{binding list3, mode=twoway}" autogeneratecolumns="false" horizontalalignment="left" height="431" margin="10,147,0,0" verticalalignment="top" width="1152" selectionmode="row" keepcurrentvisible="true" tapped="grid_tapped" > <flexgrid:c1flexgrid.datacontext> <local:controller/> </flexgrid:c1flexgrid.datacontext> <flexgrid:c1flexgrid.columns> <flexgrid:column binding="{binding describe}" header=...

Python NumPy log2 vs MATLAB -

i'm python newbie coming using matlab extensively. converting code uses log2 in matlab , used numpy log2 function , got different result expecting such small number. surprised since precision of numbers should same (i.e. matlab double vs numpy float64). matlab code a = log2(64); --> a=6 base python code import math = math.log2(64) --> = 6.0 numpy code import numpy np = np.log2(64) --> = 5.9999999999999991 modified numpy code import numpy np = np.log(64) / np.log(2) --> = 6.0 so native numpy log2 function gives result causes code fail test since checking number power of 2. expected result 6, both native python log2 function , modified numpy code give using properties of logarithm. doing wrong numpy log2 function? changed code use native python log2 now, wanted know answer. no. there nothing wrong code, because floating points cannot represented on our computers. use epsilon value allow range of error while checking float ...

javascript - How to make a jQuery Deferred object resolve/reject with the same 'resolved/rejected' state of another deferred? -

i'm writing several functions deferred objects depend on varying combinations of other deferred objects. function takesonesecond() { return $.deferred(function(deferred) { // something... }).promise(); } function takesoneminute() { return $.deferred(function(deferred) { // something... }).promise(); } function takesthreeminutes() { return $.deferred(function(deferred) { // something... }).promise(); } function myswitchingfunction() { return $.deferred(function(deferred) { // here.. // chooses 1 of several other functions call. if(/* choose 1 second */) { // tie ourselves '1 second' function. // call function. takesonesecond().done(function() { deferred.resolve(); // if that's done, i'm done too. }).fail(function() { deferred.reject(); // if failed, i've failed too. }); }...

.net - Azure Mobile Services vs web sockets for device as a server -

i have in mind scenario windows 8 app act server, receiving messages diverse clients (other windows 8 apps or excel web apps). messages need arrive @ low latency (<1s in cases). considering many different solutions. need kind of server backbone match making (route messages appropriate device). , try decide between azure mobile services. source send messages azure , azure send them push notification appropriate "server" device. problem latency here not good. azure mobile services (or simpler simple web api site) matchmaking: actual sending of messages established each client having web socket connection server app. here have low latency, fear connectivity problems. fact server won't store messages better data protection perspective, makes disaster-recovery , handling moments server app on background more difficult. azure service bus. it's supposed made (the server subscribes feed of client messages), think new queue need created each server (and clients ha...

Adding TFS Group, AD groups and setting permissions in powershell -

i trying automate process of creating tfs groups , adding ad groups , permissions. able create tfs group , add ad groups it. need same @ project level , @ different branch levels dev, main, hotfix, etc. (when go tfs right click on project->advanced->security). using commands iex "& $tfsecuritycmd /gcg `"group name`" `"group desc`" /collection:`"$adresstfs1`" | /server:`"?`"" #iex "& $tfsecuritycmd /gc `"vstfs:///classification/teamproject/00000000-0000-0000-0000-000000000000`" `"group name`" `"group desc`" /collection:?" neither works. cant figure out server url , in second case collection url, when right click , properties, not gives me url. ok got working now, needed add escape charaters here , there

full text search - FreeTextTable bad performance with SQL Server 2008 -

my index populated 12 millions of rows datassearch_fr table fields : [id] [int] identity(1,1) not null, [data] [nvarchar](max) not null, [dataid] [varchar](200) not null, [datatypeid] [int] not null by using freetexttable this: select * freetexttable(datassearch_fr, (data), 'din', language 1036) ft query returns 12 000 rows instantly but using freetexttable this: select dataid, datatypeid, max(rank) rank datassearch_fr inner join freetexttable(datassearch_fr, (data), 'din', language 1036) ft on ft.[key] = id group dataid, datatypeid query returns 4400 rows in 10 or 15 seconds... problem me not 4400 rows returned, point logically dûe max(rank) , group by ...but 10 or 15 seconds seem , slowest response time not case keywords searched. do know way improve response time ? thanks help, sébastien by using set statistics io on i have result: table 'datassearch_fr'. scan count 5, logical reads 37861, physical reads 0, rea...

c# - how to use sso just for some pages (continued) -

i have web application. use sso authentication. put code showed below in web.config page. <authorization> <deny users="?"> </authorization> <authentication mode="forms"> <forms loginurl="https://sso.***.***.***/login" timeout="30" defaulturl="~/index.aspx" cookieless="usecookies" slidingexpiration="true" path="/" /> </authentication> <location path="index.aspx"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location> if users click http://website.com/index.aspx , no login needed. other pages, need login first(go sso page). works well. problem if user click http://website.com/ ,they still need go login first. that's not want. need go index page directly. please help

applescript - Automating "Airport Utility" -

i trying automate process of opening "airport utility" , changing router given channel. wanted create either applescript or automator .app, actions not replaying correctly after have recorded them. goal possible, , if best route go down? many thanks, hcaw ps. apologies if question ambiguous... gui scripting if you're using automator action called "watch me do", don't think works well. consider using automator action of "run applescript" , using gui scripting. believe work better. gui scripting applescript. http://www.macosxautomation.com/applescript/uiscripting/ even better gui scripting use appleevents applescript, not mac software supports appleevent need do.

ios - Setting `title` changes UINavigationController stack -

i've had code working fine this: [self.navigationcontroller pushviewcontroller:subview animated:yes]; to push new view onto uinavigationcontroller stack, i've implemented functionality reloads content of view , updates title, have function this: - (void)loadentries:(nsstring *)entriestoload { //loading code self.title = [entriestoload lastpathcomponent]; } this code set title fine, causes uinavigationcontroller lose main root view was. if comment code out works absolutely fine, set title when i'm push new view onto view stack , has been working fine. add strangeness if view child view of child view ( root view -> child view -> child view ) seems treat first child view root. i'm unsure why changing title have such impact on navigation stack. there must confusion here. talking child view (which sub-view after being added) or child view controller? because: [self.navigationcontroller pushviewcontroller:subview animated:yes]; is expe...

c# - OrderBy on a Sub Collection using RavenDB -

i'm using ravendb within c# asp.net, , i'm having trouble applying orderby orders value within sub collection. basic example of model is: public class record { public string id { get; set; } public string name {get; set; } public field[] fields { get; set; } } public class field { public string name { get; set; } public string value { get; set; } } this saves down ravendb so { "name": "a name of somesort" "fields": [ { "name": "colour", "value": "red" }, { "name": "size", "value": "large" } ] } imagining large amount of these records saved db, can page of data so using (var session = documentstore.opensession("testdb")) { var result = session.query<record>().skip(0).take(10).tolist(); } what i'd able sort records based on field va...

javascript - How to display notification before form submit with jquery? -

is possible hold form submission display notification couple of seconds? before page reloads after callback form submitted display along lines: "thank callback request. in touch shortly." you can use preventdefault() stop form submitting, show information want , submit() form in settimout() after desired delay.

Bootstrap Dropdown Menu link issue -

i have created dropdown menu can seen in fiddle <div id="navbarcontainer" class="container-fluid"> <nav class="navbar"> <div class="navbar-inner"> <ul class="nav"> <li class="dropdown" data-toggle="tab"> <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">adult <i class="caret"></i> </a> <ul class="dropdown-menu" role="menu"> <li><a href="/">al4 participant record</a></li> </ul> </li> <li class="dropdown" data-to...

html - floating to right div not showing chosen width -

i have div floating right width of 740px set in css. displaying in browser don't see 740px width, going wrong? placing h1 text inside doesn't make div 740px wide; shows width of text. while making float left, has total width of 740px. missing here of concept of floating? <div id='banner'> <h1>website title</h1> </div> div#banner { padding: 0px; margin: 5px; border-style: solid; border-width: 1px; border-color: blue; width: 740 px; height: 310 px; display: inline-block; float: right; text-align:left; } i can fix use of min-width, feels more fix solving problem why div isn't @ 740px wide. thanks helping! your css problem use width: 740 px; height: 310 px; please remove space 740 , px and use width:740px; & height:310px; try this http://jsfiddle.net/7ccdk/2/ div#banner { padding: 0px; margin: 5px; border-style: solid; border-width: 1px; border-color: blue; width: 740px; height: 310px; disp...

javascript - Returning value from async function in NodeJS -

i'm trying query data in json serverside code running on node.js here clientside ajax request: $(function() { var values = $(this).serialize(); $.ajax({ url: '/querysearch', type: 'post', data: values, success: function(msg){ console.log(msg); }, error: function(){ alert('failure'); } }); }); my serserside code: app.post('/querysearch', function(req, res) { var querynumber = number(req.body.querynumber); if (querynumber == 1){ executequery1(res, sendqueryresults); } else if (querynumber == 4){ executequery4(res, sendqueryresults); } else if (querynumber == 6){ executequery6(res, sendqueryresults); } else if (querynumber == 7){ executequery7(res, sendqueryresults); } }); function executequery1(res, callback) { var query = "" + 'query string'; service.oneshotsearch(query, {}, function(err, results) { if (err) { consol...

java - ArrayIndexOutOfBoundsException while adding row to datamodel -

i apologize asking question that's been asked lot in various forms, have yet find complete answer works. i'm trying append row tablemodel. i've tried doing in lot of different ways run similar issues (or new , exciting ones). anyway, when try add row "arrayindexoutofboundsexception" error. i've marked line error occurs in code below. i've included errors i've seen , debugging output i've been using. i'm aware don't need extend defaulttablemodel see here, stripped down version i've been working chase bug. exception: exception in thread "awt-eventqueue-0" java.lang.arrayindexoutofboundsexception: 2 > 0 @ java.util.vector.insertelementat(vector.java:594) @ javax.swing.table.defaulttablemodel.insertrow(defaulttablemodel.java:374) @ javax.swing.table.defaulttablemodel.addrow(defaulttablemodel.java:350) @ javax.swing.table.defaulttablemodel.addrow(defaulttablemodel.java:361) @ smc.role...

TicTacToe in Java - why does it go on too long? -

i writing tictactoe game, , repeatedly prompts user move. asking selection more 9 times , not sure why. my design has 2-dimensional array store information current state of board, use joptionpane ask users selection of board (1 top left, 2 top middle, 3 top right, 4 middle left, etc). after every move, output console current board. if spot used, prompt user again. (there no need winner check, told time. here entire code: import javax.swing.joptionpane; // basic tictactoe game. public class tictactoe1 { public static void main(string[] args){ // hello there! object[] options = { "i'm ready play!",}; object[] options2 = { "select number.",}; joptionpane.showoptiondialog(null,"to play tictactoe, use numbers 1 9 choose place mark. ready?","tictactoe1", joptionpane.default_option, joptionpane.information_message, null, options, options[0]); // define board. char board[]...

navigation - Custom block limiters in vim -

how can add custom word pairs mark beginning , end of block in gvim, can jump across using % (just { , } ) i jump functionstart functionend , viceversa. functionstart <code here> functionend like described others should do: put matchit.vim in matchit.zip /plugin/matchit.vim in ~/.vim/plugin directory( mkdir ~/.vim/plugin if doesn't exist ) , add line ~/.vimrc . enable jumping across keyword pairs using % . let b:match_words = '\<functionstart\>:\<functionend\>' "keyword pairs put these 2 lines instead if want make same keywords work vim buffers let g:match_words = '\<functionstart\>:\<functionend\>' "keyword pairs autocmd bufreadpre * let b:match_words = g:match_words "buffer specific variable

r - Getting legends with dashed line in ggplot when errorbars are solid -

Image
this question has answer here: removing layer legend in ggplot 1 answer i'm having difficulty getting legend behave want when ggplot errorbars. errorbars ridiculous dashed line force solid one, unfortunately results in legend forgets dashed property. there several similar so-questions haven't found address particular problem ( this 1 closest , another similar can found here ). hadley did gave answer 2010 on similar question on r-help list i'm not sure how implement it, seems lot of work have 4 lines , 2 facets in actual plot. test code set.seed(1) test_df <- data.frame(models = rep(paste("model", letters[1:3]), 3), x = c(rep(1, 3), rep(2, 3), rep(3, 3)), y = c(1:3,1:3+1+rnorm(3,0,.2),1:3+2)+rnorm(3,0,.3)) test_df$ymax <- test_df$y + ....

Parse JSON Array in php and add values to php array -

i have json object of type: { "order": { "food": "[test 1, test 2, test 0, test 3, test 1, test 3, test 11, test 7, test 9, test 8, test 2]", "quantity": "[2, 3, 6, 2, 1, 7, 10, 2, 0, 0, 1]" }, "tag": "neworder" } i have used json_decode take values inside food , quantity , store them inside php array, ve tried many approaches no luck. point right way it, or wrong json message?? php json_decode 's 2nd argument set true return associative arrays instead of objects. additionaly, json valid food entry resolves string when using json_decode. in order have array want code snippet work: <?php $json = '{"order":{"food":"[test 1, test 2, test 0, test 3, test 1, test 3, test 11, test 7, test 9, test 8, test 2]","quantity":[2,3,6,2,1,7,10,2,0,0,1]},"tag":"neworder"}'; $array = json_decode($json, true); ...

java - Using JSoup to scrape Google Results -

i'm trying use jsoup scrape search results google. code. public class googleoptimization { public static void main (string args[]) { document doc; try{ doc = jsoup.connect("https://www.google.com/search?as_q=&as_epq=%22yorkshire+capital%22+&as_oq=fraud+or+allegations+or+scam&as_eq=&as_nlo=&as_nhi=&lr=lang_en&cr=countryca&as_qdr=all&as_sitesearch=&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=").useragent("mozilla").ignorehttperrors(true).timeout(0).get(); elements links = doc.select("what should put here?"); (element link : links) { system.out.println("\n"+link.text()); } } catch (ioexception e) { e.printstacktrace(); } } } i'm trying title of search results , snippets below title. yea, don't know element in order scrape these. if has better method scrape google using java love know. thanks. ...

css - Wrap markdown code blocks with prettyprint classes in Python -

in python there markdown extension highlights code codehilite. extension wraps snippets in codehilite classes. how can function put class='prettyprint' on every snippet without processing codehilite. basically convert every <pre></pre> tag markdown makes <pre class='prettyprint'></pre> why not using str.replace() or 're.subn()'? e.g.: replaced = markup.replace('<pre>', '<pre class="prettyprint">') or replaced = re.subn('(<pre[^>]*)', '\\1 class="prettyprint"', markup)

Spring Maven dependency issue during JUNIT -

i'm struggling junit code, i'm using spring 3.2.3, when use spring 3.0.2 working fine. question same spring junit test error in example had said use transitive dependency(which don't understand is). understood answer exclude older version of jars(resolved depenedency). when verified dependency hierarchy find dependency has resolved version 3.2.3 , there no older version of dependencies my pom.xml is <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.company</groupid> <artifactid>artifact</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>artifact</name> <url>http://maven.apache.org</url> <properti...

asp.net - How to determine which IdP to redirect from a SP? -

i'm building sp initiated single sign-on, , wondered best practice determining identity provider redirect user to. here options i've come with: /sso/logon/acme , acme name of known idp. we know endpoint url provider, , redirect user. downside, anonymous user can detect idps support guessing names , checking redirect. /sso/logon/1 , 1 id of identity provider. same problem. /sso/logon?endpointurl=http://idp.acme.com we blindly redirect authnrequest endpoint, , unauthorized endpoints rejected when respond /sso/logon/abcdefg abcdefg cryptographically secure random string we lookup endpoint url associated key, , know redirect. similar first 2 options, not guessable this must solved problem. what's best way handle this?

android - Implement NYTimes-like section "Up" navigation -

Image
the new york times android app offers section navigation using spinner in action bar. user starts out on "top news", , if navigate section, content area replaced , left-pointing arrow "up" navigation added action bar logo. no matter how many sections switch between, if hit arrow-ed logo, go "top news". , if go "top news" using action bar spinner instead of arrow-ed logo, logo loses arrow appropriately. (standard functionality.) my initial approach adapting put section content (a listview) in fragment, , replace fragment inside activity whenever user changes sections. content replacement works beautifully, haven't been able implement "up" navigation, , haven't found resources doing fragments. i'm wondering how should design this. see 3 major approaches: continue have sections part of 1 activity using fragments content replacement. implement "up" navigation using method (what?) haven't been able engi...

inheritance - In java, if I call, from a subclass, a superclass method that calls an overriden method, which class' method will be called? -

say have super class: public class mysuperclass { protected void myprmethod() { //do... } public void mypumethod() { myprmethod(); } } and sub class: public class mysubclass extends mesuperclass { public mysubclass() {} @override protected void myprmethod() { //do instead... } } then main: mysubclass mysubclass = new mysubclass (); mysubclass.mypumethod(); which myprmethod mysubclass.mypumethod() call? edit: got downvoted thrice already. cannot try since not @ home, though knowing answer right me designing part in program making. because method myprmethod() overridden in subclass, subclass implementation called. the actual method gets called depends on object on gets called.

iphone - How to lock a view as the user scrolls -

i new-ish iphone development , trying figure out how can fix view after has reached top of screen when user scrolls window. view unlock when window scrolled down again go original position. ive seen on on few apps instagram (with user name separators). does design pattern have specific name? an example (not iphone though) can seen on http://mashable.com/ -- @ "the new stuff", "the next big thing", , "what's hot" bar. see how locks scroll down my solution is create uitableview create uiview separately used fixed table header setup table's tableheaderview property conform uiview's frame as uitableview inherited uiscrollview can rely on scrollviewdidscroll method in adjust fixed header y coordinate changes when scrolling table. there can other similar solution strenght of particular solution can manipulate fixed header's gui element throughout scrolling easily. an example better writing down details creat...

bash - Awk: Drop last record separator in one-liner -

i have simple command (part of bash script) i'm piping through awk can't seem suppress final record separator without piping sed. (yes, have many choices , mine sed.) there simpler way without needing last pipe? dolls = $(egrep -o 'alpha|echo|november|sierra|victor|whiskey' /etc/passwd \ | uniq | awk '{irs="\n"; ors=","; print}'| sed s/,$//); without sed, produces output echo,sierra,victor, , i'm trying drop last comma. you don't need awk, try: egrep -o ....uniq|paste -d, -s here example: kent$ echo "a b c"|paste -d, -s a,b,c also think chained command simplified. awk things in one-liner.

scope - Ruby set local variable inside a block -

i have variable set default value on, , perform procedure on. thing is, don't have access variable inside block block has it's own variable scope , no access outside. here snippet: value = "" cmd_errors = array.new # call command line status = popen4.popen4(cmd) |stdout, stderr| output = stdout.read error = stderr.read if (!output.empty?) value = json.parse(output) #this creates block scoped variable called 'value' , local variable still empty else cmd_errors << error end end is possible allow block write local variable? perhaps using references? in program, external value variable is being modified block. usual assign nil such external variables, have work fine. try modifying value else inside block, this, , see variable being changed. guess output.empty? coming true. value = nil cmd_errors = array.new status = popen4.popen4(cmd) |stdout, stderr| output = stdout.read error = stderr.read value = ...

java - How to divide lines using html() method in Jsoup -

i'm experiencing 1 problem catching elements tag in jsoup. return of method links.html() writen in string crawlingnode = links.html(); writes in .txt file entire string without spaces or line divisions. but, in console shows links divide per line. so, need ask if there 1 way write in .txt file links divide per lines using html() method? cos me doesn't make sense returned method on console shows divided , on .txt file can same ps: i'm sorry not give 1 shorter version, code complete runnable. focus on the elements links = doc.getelementsbytag("cite"); string crawlingnode = links.html(); crawlingnode = crawlingnode.replaceall("(?=<).*?(>=?)", ""); //remove undesired html tags system.out.println(crawlingnode); httptest.writeonfile(writer, crawlingnode); part, contains problem want solve. in advance! public class httptest { static file file; ...

regex - Finding inner matches using Regular Expressions in Javascript -

if have string "#review?loanid=12-00034&docid=0" , need select loanid ( "12-00034" ) string, how use single regular expression this? so far can use /loanid=[\d-]*/ retrieve "loanid=12-00034" how id itself? can nesting regular expression, wondering if possible 1 regex. this should help var query = "#review?loanid=12-00034&docid=0" var matches = /\bloanid=([-\d]*)/.exec(query) console.log(matches[1]); // => 12-00034 this pretty similar other answers, here main difference i'm using \b word boundaries prevent regexp matching incorrect id in whateverloanid=123&loanid=123-456 the second difference capture group ([-d]*) . means if string has empty loanid ?loanid=&something=foo , won't typeerror matches[1]

osgi - Does Apache Felix FileInstall works for dynamic configuration of an application? -

i trying develop application can configured users. need configuration done installing/updating/stopping/uninstalling bundles. should of course done dynamically during run-time of application. i found nice framework apache felix fileinstall provides directory in seems add bundle when add bundle file in directory (update, , remove bundles similarly). but can see method not work in case. need have bundles in directory stop or uninstall them application. , want install them when appropriate. how expecting configuration of application done. is trying achieve supported apache fileinstall? making wrong assumptions framework? other possible ways me if apache fileinstall not enough? thanks. you don't need fileinstall this, use osgi apis. mentioned installing, updating, stopping , uninstalling; these supported following api calls respectively: bundlecontext.installbundle bundle.update bundle.stop bundle.uninstall incidentally these same methods called fileinstall...

java - When creating an RSS Feed using Rome, how can I add Comments? -

i want create rss feed using rome (it looks site abandoned). for each entry, add comments element. comments part of rss spec: comments : url of page comments relating item. how can add comments syndentry? you need define custom module. see rome tutorial here

ruby - Why is rindex vs. index changing the output of selection sort? -

i working through basic algorithm exercises, , confused implementation of selection sort: def selection_sort(xs) len = xs.length len.times |i| low = xs[i...len].min tmp = xs[i] xs[i] = low xs[xs.rindex(low)] = tmp end xs end the code works fine, however, if use xs[xs.index(low)] = tmp instead of xs[xs.rindex(low)] = tmp , function not work on following tests: selection_sort([3, 6, 2, 7, 4, 1, 4, 5, 6, 7, 8, 0]) selection_sort([0, 8, 7, 6, 5, 4, 1, 4, 7, 2, 6, 3]) in mind, should not matter since index index whether coming right or left. wouldn't using rindex vs index change flow (for duplicate entries), still output ordered list? what overlooking? what's happening you're testing index after you've reassigned low value, not before you've reassigned value in low value's new position. so, let's consider: xs = [4,3,2,1] = 2 low = [2, 1].min = 1 tmp = xs[i] = 2 now, assign xs[i] = low , means array looks ...