Posts

Showing posts from September, 2014

sharepoint - Convert InfoPath 2010 form InfoPath 2007 Form -

we've got infopath floating around created in infopath 2010. has been distributed handful of users through sharepoint document library - unfortunately users infopath 2007 aren't able submit form, or open it. receive error message: "the form template created newer version of infopath. form template created infopath version 14.0.0." has else encountered problem? there known procedure converting .xsn files version 14.0.0 version compatible infopath 2007? to open form in infopath 2007, need set form's compatibility infopath 2007. can in form options dialog. if have used newer features such people picker, may downgrade user experience , force recreate of these controls. if not need of more advanced features of infopath client, may consider having users access form using web browser interface. can set default open mode document library, or can put "?openin=browser" in url when open form. see details on microsoft's site using query st

android - Import Paypal Library -

Image
i have paypal library imported in integration seems it's not added still seeing errors. might importing improperly have paypal_mpl.jar in "libs" folder. i can see problem. in class path have added old paypal mpl library source using new sdk code.

c# - Scrolling through Visual Studio Intellisense list without mouse or keyboard arrows -

Image
i'm heavy user of intellisense in visual studio. i'm "keep hands on keyboard" , "keep them in home position" aficionado, i'm looking ways keep hands centered on a s d f     j k l ; keys as possible. whenever intellisense list pops in visual studio, if there many words in list start same letters word i'm trying select, typing first few letters hone in on selection doesn't help, since list won't jump down preferred selection until type enough characters reach first unique character in word. it's faster take right hand off j k l ; keys , reach up/down arrow keys manually scroll through list. i'd rather keep hands centered in home position, , ideally use j , k keys move , down in intellisense list (similar how j , k move , down in vim...and since use vsvim inside visual studio). the msdn intellisense documentation lists up/down arrow keys , scrolling (mouse wheel, pgup / pgdn keys, etc.) options doing this: so here q

java - Download dependencies to local repository but not to "target" one -

i have project, has pom.xml , depends on lots of dependencies outside (located far-far in internet..). so, want download dependencies depend on "local repository". this try (i not need compilation, use "validate" here. i'm not expect have "target" folder in end): mvn validate -dmaven.repo.local=c:\my\.m2\repository dependency:copy-dependencies in end - yes have many dependencies been downloaded "c:\my\.m2\repository" , of them went to: c:\projects\myproject\java\trunk\target\dependency , these ones: junit-4.8.1.jar log4j-1.2.8.jar mockito-all-1.8.2.jar question is: how make downloaded "c:\my\.m2\repository" not "target" of project? for now, because of that, projects depend on failing while building, because expecting find "junit-4.8.1.jar" in local repo. another try: mvn validate -dmaven.repo.local=c:\my\.m2\repository dependency:resolve then dependencies not resolvable @ all. c

javascript - How to abstract this single case (showing text field based on selection of a drop down list) into a general function in jQuery? -

this first detailed question on so. hi, have form , have many instances want show text field after drop down list when user selects "other" option in drop down list. i using standard naming convention , wondering, have have many functions ddl/text field pairs in document, or can have single function can call on class of ddls? here's html: <label for="spotter">spotter:</label> <select id="spotter" required> <option value="snoop dogg">snoop dogg</option> <option value="mc escher">mc escher</option> <option value="linus thorvalds">linus thorvalds</option> <option value="other">other</option> </select> <br/> <div id="spotter_other_div"><label for="spotter_other">other spotter:</label><br><input type="text" name="spotter_other" id="spotter_ot

Proper submenu using only HTML+CSS -

Image
i'm trying write simple html+css menu without absolute positioning or js. problem regarding submenus, either expand current selected item or displace it: the html straightforward: <ul id="menu"> <li>item 1</li> <li>folder 1 <ul> <li>item 2</li> </ul> </li> <li>item 3</li> </ul> and css: #menu, #menu ul { border-style: solid; border-width: 0px; border-top-width: 1px; float: left; list-style: none; margin: 0px; padding: 0px; width: 180px; } #menu li ul { background-color: cyan; display: none; position: relative; right: -168px; width: auto; } #menu li:hover ul { display: block; } #menu li { border-style: solid; border-width: 1px; border-top-width: 0px; padding: 10px; } #menu li:hover { background-color: lightgrey; font-weight: bold; } i thought submenu affect layout after be

jquery - refreshing php variable with JS -

i have problem refreshing php variable... php variable after refreshing still same - not refreshed my little js: var reload = function() { var pred = <?php echo json_encode(reload()); ?>; $(".reload").fadein("fast").text(pred); settimeout(reload, 3000); } settimeout(reload, 3000); my php function: function reload() { foreach ($servers $server) { $s = explode(":", $server); $data = $status->getstatus($s[0], $s[1]); if (!$data) {} else { $c1 = $c1 + $data['players']; } } return $c1; //players returned } if joined game after during script variable same on beggining... nothing changed. why variable isn't refreshing ? doing wrong? thanks , sorry bad eng reload() called once: when script executes first time. php processing completed on server side before output (including html , javascript) sent browser. when javascript function executes, r

Python Tornado Websocket Handler blocks while receiving data -

i have 2 pretty simple tornado-based websocket handlers running in same process, each of function on own. however, when 1 receiving large amount of data (>8mb) process blocks , other unable process messages until of data has been received. there way can around , prevent tornado blocking here? tornado works large amount of short concurrent requests. not split long request smaller ones. process blocks. why passing big amount of data using sockets? final solution depends on answer question. if don't have big requests - use haproxy in front of multiple tornado instances.

javascript - Overriding SELECT behavior of Enter key -

working on html control more/less operates spreadsheet - matrix of editable data cells. when comes cells derived select i'm having issue getting correct behavior when type of cell selected edit: if render select using default formatting (size = 0) user gets out-of-place behavior of select's enter-key processing: 1st enter => activates editing on cell (shows select control) 2nd enter => expands select show options user makes selection using up/dn keys 3rd enter => closes list. (problem: enter hidden "keydown" event handler) 4th enter => required trigger event listener deactivating cell edit. on other hand, if select rendered listbox (ie, size = 3, example) enter key behavior i'm looking (meaning, #2 , #3 on above list no longer required), because list displayed internally control (rather pop-up) blows cell/row sizing. so, there way "hook" 3rd enter-key event above, or other relatively straight-forward way alter select's

How to prevent WPF Checkbox inside a Button from being checked by double-click? -

i have wpf button content has bunch of controls including checkbox. currently single-click on checkbox fires "checked" event, that's fine. what don't double-click fires "checked" event. currently double-click triggers both checkbox' "checked" event , button's "doubleclicked" event. what want double-click on checkbox should trigger button's event, not checkbox's event. checkbox should checked upon single-click. is there way that? thanks. what trying might not make best user experience because you're going have implement delay prior processing user's attempt check box. why? well, if double click checkbox, want nothing happen checkbox, want pass control button. that's totally understandable. but happens if click checkbox? @ moment release mouse button, going expect check mark appear. system can't yet know don't plan click again. so, has wait through doubleclicktime determine

php - insert multiple fields using foreach loop -

i have problem when want insert multiple fields 1 table. here's form: <h1>add user</h1> <form method="post" action="index.php"> <table> <thead> <th>name</th> <th>age</th> </thead> <tr> <td><input name="name[]" type="text" /></td> <td><input name="age[]" type="text" /></td> </tr> <tr> <td><input name="name[]" type="text" /></td> <td><input name="age[]" type="text" /></td> </tr> <tr> <td><input name="name[]" type="text" /></td> <td><input name="age[]" type="text" /></td> </tr> </table> <input type="submit" name="

How do I force Metawidget to display a date selection widget instead of a number widget for timestamp properties? -

metawidget creates date selection widgets if property type java.util.date. in case, pojo contains timestamps of type long. public class node { private long created; private long lastmodified; /* ... */ } node node = new node(); vaadinmetawidget metawidget = new vaadinmetawidget(); metawidget.settoinspect(node); how configure metawidget particular long property rendered date selection widget? you need hook in custom widgetbuilder this. custom widgetbuilder need worry creating date widget 'long', , can return null else: your custom widgetbuilder needs like: public class mywidgetbuilder implements widgetbuilder<component, vaadinmetawidget> { public component buildwidget( string elementname, map<string, string> attributes, vaadinmetawidget metawidget ) { if ( "long".equals( attributes.get( type ))) { return new popupdatefield(); } return null; } } then wrap inside compositewidget

c++ - How to get position of CCSprite added to CCParallaxNode? -

i have ccparallaxnodeextras scrolls infinite (following space game tutorial). added child ccsprite made of other ccsprite, this: _backgroundnode = ccparallaxnodeextras::node(); this->addchild(_backgroundnode,-2); float acum = 0.0; back1 = ccsprite::create(); for(int = 0; < num_repeats; ++i) { ccsprite *back = ccsprite::createwithspriteframename("rock.png"); back->setposition(ccp(acum, 0)); back1->addchild(back); acum+= back->getcontentsize().width+150.0; } _backgroundnode->addchild(back1, 1 , ccp(0.1,0.1), ccp(0, winsize.height * 0.64)); now in update have this: ccpoint backgroundscrollvert = ccp(-1024, 0); _backgroundnode->setposition(ccpadd(_backgroundnode->getposition(), ccpmult(backgroundscrollvert, dt))); perfect, background moves , disappears (that want now) need collision between sprites on background , fixed sprite child of main node. the problem whenever try collision simple

What is ASN.1 and it's pros/cons? -

i looking generic, strict , platform independent serialization framework. , discovered called asn.1. it looks related serialization, couldn't understand is. read wikipedia article , itu article still, it's hard know. i have many questions. maybe need overall differential description of asn.1. what asn.1? does define strict datatypes? (such 32-bit integer, 1-bit boolean, etc.) is there reference implementation in c/c++? why doesn't popular apache thrift , protocol buffers or other serialization stuffs? what's pros/cons of asn.1 when compared other serialization frameworks? 1) it's serialization standard defined iso. 2) yes, although smallest space value occupy (afaik) 5 bits. 3) don't know of full one, although i'm not claiming knowing. 4) hard answer in neutral way, far i've experienced complexity, getting close full implementation hard . 5) see 4. asn.1 space efficient (protobuf may give run money) seem complex co

stuck with Javascript infinite while loop -

my apologies n00b question, i've tried looking through infinite loop related issues they're way more complex: var replay = 1; while (replay = 1) { replay = prompt("yes(1) or no(0) ?"); } how come infinite loop? i thought while loop continue iterating while replay variable has value of 1. however doesn't stop when user input 0, or else matter. thanks in advance of input! you assigning not checking in (replay = 1) you need double equal signs == , or better yet triple equal signs === check equality in types of operands. besides, code can changed (preview: http://jsfiddle.net/nabil_kadimi/rfda5/ ): var replay; while ((replay = window.prompt("yes(1) or no(0) ?")) === '1') { /* player wants replay */; } or better (preview: http://jsfiddle.net/nabil_kadimi/pdv4m/ ): var replay; while (replay = window.confirm("replay?")) { /* player wants replay */; }

express - Node.js: curl: (52) Empty reply from server with space in request not encoded -

var http = require('http'); var server = http.createserver(function (request, response) { response.writehead(200, {"content-type": "text/plain"}); response.end("hello world\n"); }); server.listen(8000); console.log("server running @ http://127.0.0.1:8000/"); i executed following curl commands: curl "http://127.0.0.1:8000/" hello world // space not encoded curl "http://127.0.0.1:8000/x y" curl: (52) empty reply server curl "http://127.0.0.1:8000/x" hello world // space encoded curl "http://127.0.0.1:8000/x%20y" hello world can please explain why curl 52??? in case, want send 500 back. can that? even missing res.send looks issue route. meant. app.get('/item/:id', function(...) { .. }) note : before id . creates variable can accessed on req.params.id.

ios - Access text from UITextField in modal View Controller from Home View Controller -

i have viewcontroller1 uilabel can present viewcontroller2 modal segue. have uitextfield in viewcontroller2 need access viewcontroller1 can set uilabel collected text. i've tried working prepareforsegue without success. should do? edit: i'm using delegate, i'm doing wrong. here's code i'm using in viewcontroller2.h : @class viewcontroller2; @protocol vcprotocol -(void)setname:(nsstring *)name; @end @interface viewcontroller2 : uiviewcontroller @property (nonatomic, weak) id<vcprotocol> delegate; @property (strong, nonatomic) iboutlet uitextfield *namefield; - (ibaction)setbutton:(id)sender @end viewcontroller2.m -(ibaction)setbutton:(id)sender { [self.delegate setname:namefield.text]; } i conform vcprotocol in viewcontroller1.h . then, in viewcontroller1.m , have code: - (void)setname:(nsstring *)name { self.firstsignaturenamelabel.text = name; } - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {

php - Stuck with SQL repeating first row only -

ok, here goes. i'm trying write blogging system (learning how anyway), , problem have sql returning first line in database. many times records have. can't work out going wrong. can point me in right direction please? <?php include "db_connect.php"; include "functions.php"; include "style/header.php"; ?> <link href="style/style.css" rel="stylesheet" type="text/css"> <div id="main"> <?php echo 'welcome forest, '.$_session['username']; $sql = mysql_query("select post_id, post_user, post_title, post_description, post_info, post_date posts"); $row = mysql_fetch_array($sql); $post_id = $row['post_id']; $post_user = $row['post_user']; $post_title = $row['post_title']; $post_description = $row['post_description']; $post_info = $row['post_info']; $post_date = $row['post_da

osx - Thrust Error: libc++abi.dylib: terminate called throwing an exception. Abort trap: 6 -

trying simple copy data host device using thrust. it's outputting: libc++abi.dylib: terminate called throwing exception abort trap: 6 code: #include <thrust/host_vector.h> #include <thrust/device_vector.h> void test() { thrust::host_vector<int> h(4); h[0] = 14; h[1] = 20; h[2] = 38; h[3] = 46; thrust::device_vector<int> d = h; // causing error } int main() { test(); return 0; } here's how compiled , ran in os x: $ nvcc test.cu -o test $ ./test i have cuda 5.5 installed believe installed thrust 1.6.0 automatically. turns out bug in 5.5 production release. uninstalled , reinstalled 5.0, works fine.

PHP combobox not showing in HTML table -

i've created in php html table combobox retrieves values of mysql database table. this code: <?php include_once 'indeling/header.php'; print '<a href="overzicht_notass.php" class="button">overzicht nota\'s</a> <br /><br />'; $sql = " select notas.id notaid , notas.klantid klantid , notas.bedrag bedrag , notas.datum datum , contacten.bedrijf bedrijf , contacten.adres adres , contacten.woonplaats woonplaats notas left join contacten on (notas.klantid = contacten.id); "; function bedrijven($mysqli) { $sqlbedrijven = " select id , bedrijf , adres , woonplaats contacten order bedrijf asc "; $resultbedrijven = $mysqli->query($sqlbedrijven); if (!$resultbedrijven) { echo "something went wrong: (" . $mysqli->error .")"; } echo "<select name = klantid>\n";

VB.net clicking a submit button using Web Browser -

i want click submit button of webpage displaying in web browser seems not work @ here code: webbrowser1.document.forms(0).invokemember("image") i basing on html code of button want click is: <div class="buttonrow forward"> <input type="image" src="includes/templates/template_default/buttons/english/button_send.gif" alt="send now" title=" send "> </div> did miss something? need help. try setting property webbrowser.allownavigation = true

Vim line completion with external file -

can line completion ctrl + x ctrl + l used show line completions specific external file instead of "only" current buffer? dictionaries, lines. update: to test did following: created file tt.txt test lines placed file in d:\t1\ (i'm on windows) included file :set path+=d:\\t1\\tt.txt :set complete ? returns complete =.,w,b,u,t,i :set path ? returns path=.,,,d:\t1\tt.txt checkpath returns: included files found typing line should completed matching content tt.txt ctrl + x ctrl + l returns pattern not found what missing? i think way achieve want custom complete-function. see help complete-functions (very useful!) documentation. here's attempt @ solution: first need separate function silently grep file string (if call naked vimgrep function ugly error if there no matches). function! silentfilegrep( leader, file ) try exe 'vimgrep /^\s*' . a:leader . '.*/j ' . a:file catch /.*/ echo "no

jquery - jQueryUI datepicker maxdate -

Image
i´m using jqueryui 1.10.3. version todays date choosable. version 1.9.1 choose dates placed infinitely in future. presume there bug somewhere in code. while in 1.10.3 console says nothing, 1.9.1 threw "t.originalevent undefined" (in firebug) , "cannot read property 'type' of undefined" (in chrome dev tools). how can find error specifically? my js-code: $(function() { $( ".datepicker" ).datepicker({ numberofmonths: 3, mindate: 0, maxdate: "+3m" }); $( ".datepicker" ).datepicker( "option", "dateformat", "dd.mm.yy" ); $.datepicker.regional['de'] = { cleartext: 'löschen', clearstatus: 'aktuelles datum löschen', closetext: 'ok', closestatus: 'schließen ohne Änderung', prevtext: '< früher', prevbigte

geolocation - Why is Google maps latitude vertical and not horizontal? -

i don't know why wiki show latitude horizontal , latitude vertical on earth. when using google map see latitude vertical (-90, 90) , longtitude horizontal (-180, 180) can show me why? i don't know wiki you're referring to, it's wrong. latitude vertical (from south north), longitude horizontal (from west east) so latitude, longitude y,x latitude ranges vertically -90 (south pole) +90 (north pole). 0 ( horizontal ) equator separates southern , northern hemisphere. longitude ranges horizontally -180 180, 0 vertical line goes through london. longitude -180 , 180 both represent same vertical line.

c# - Lock ASP.NET Control While Processing User Request -

let me dive problem directly: there asp.net submit form (in example mock one). going lock page web controls , display animated progress bar user hits "submit" button. have tried following code snippet but page controls not lock! , need t handle it. here markup: <form id="form1" runat="server"> <asp:scriptmanager runat="server" id="smgr" enablepartialrendering="true"></asp:scriptmanager> <div> <asp:updateprogress runat="server" id="progressdisplay" associatedupdatepanelid="updatepanelform"> <progresstemplate> <img src="images/25-1.gif" /> </progresstemplate> </asp:updateprogress> <asp:updatepanel runat="server" id="updatepanelform"> <contenttemplate> <asp:textbox runat="server" id=

Using php variable in javascript -

this question has answer here: what difference between client-side , server-side programming? 5 answers i know doing totally wrong , haven't got idea how this.. have javascript function , trying use php declare array teams if round equals 1. teams , round come parameters in function teamelement() function teamelement(round, team, isready) { <?php if(round == 1) $round2_array[] = team) ?> document.write('<p>round: ' + round + '<br>team ' + team.name + '<br> ready ' + isready); ... anyone can please? many thanks. taking @ code, part: function teamelement(round, team, isready) { <?php if(round == 1) $round2_array[] = team) ?> i see lack of basic knowledge: javascript client side scripting language, while php server side scripting language. php , javascript executed in 2 different

IllegalArgumentException when executing command with ProcessBuilder in Java -

i'm writing simple java application user can execute cmd commands. there textfield enter command , button execute it. code looks follows: sendbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { try { processbuilder pb = new processbuilder("cmd.exe", "/c", message.gettext()); process pr = pb.start(); } catch (ioexception e1) { e1.printstacktrace(); } } }); everything works fine if user executes notepad.exe but reason java.lang.illegalargumentexception if command example: "c:\users\username\appdata\local\google\chrome\application\chrome.exe" www.youtube.com it's because of quotes, know workaround this? processbuilder expects list of arguments passed list<string> or string... . problem passing 2 separate argu

html - div overflow scroll: when scrolled to bottom, content starts scrolling -

i have modal dialog scrollable div inside. div set to overflow: scroll; however, when user scrolls way down inside div, content behind popup starts scrolling down. question: when popup open, don't want user able scroll main page behind it. possible? i don't think there need me provide code, general question. using jquery set css as overflow: hidden when popup open and on popup close use overflow : auto or overflow : scroll wish. i think, don't need write code it.

python - How to implement smooth tile based movement -

the player in game centered in screen, , 'scroll' background move around. i list of keys pressed pygame.key.get_pressed() , if player's move cooldown over, call move function. function scrolls map in direction of movement 1 tile. however movement not smooth. 'jumps' next tile. how implement movement system player moves in small steps (speed * dt) still moves distance of 1 tile every time move function called? game needs rendered in between each small step think. full source here: https://github.com/hcollings/rpg-game/blob/alternate_movement/game.py animations , movement perceive rather what's happening. in grid system, can abstract visual movement of player away actual mechanics taking drawing part of code , updating draw position independently of gameplay position. the problem experiencing jumping commonly handled kind of interpolation technique. lerp() common function provides linear interpolation, in below example use different techniq

javascript - How do I pass e.target back to the server -

i have front-end track element has been click ed , send server work on backend depending on element is. code setup so... $('body').on('click', function(e) { $.post( '/edit', {el: $( e.target ).serialize()}, function(response) { console.log( response ); }); }); but el empty string on server. else can e.target info server? update: i think question benefit context. the basic function of app enable in-page editing. node server loads html page want edit. clicking on element on page lets me change text in element, post ed node server, use cheerio module change dom representation , overwrite original html file. reloading page gives me new version of page edits had made. but apply edits have made on front-end, cheerio needs e.target find right element in dom representation , change text , since many of elements on page don't have id s. this whole app... var express = require( 'express' ) , fs = require( &

c# - how to display address in google map -

i displaying google map on asp.net page using jquery.i have nation name,company name,address , longitude , latitude. right have add addresses in dropdown,on basis of dropdown selection have passed longitude , latitude in code.this part working display map on basis of latitude , longitude.but have no longitude , latitude comapnies.so want use directly address of comapnies display map. here code have used: <script src="js/jquery/jquery-1.9.0.min.js"></script> <!-- <msdropdown> --> <link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css" /> <script src="js/msdropdown/jquery.dd.js"></script> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?ke

html - What Gets Added to `document`? -

i working on page , noticed had element bound document (ex. document.formnameid ). thinking must javascript , not being able find place set, removed javascript on page. still found element name set on document. after playing it, seems form elements have name attribute set added document . there other elements default bound that? edit: upon further inspection, can find elements inside form element same api. so if input element: document.formname.inputname check example out. yes, these called (in html5) named properties the description in spec says: the document interface supports named properties. supported property names @ moment consist of values of name content attributes of applet , exposed embed , form , iframe , img , , exposed object elements in document have non-empty name content attributes, , values of id content attributes of applet , exposed object elements in document have non-empty id content attributes, , values of id con

java - Unable to locate element: {"method":"id","selector":"sysPublishDateDate"} -

i tried call textbox. getting following error: unable locate element: {"method":"id","selector":"syspublishdatedate"} . here come attaching code this: try{ webelement title = driver.findelement(by.xpath("//div[@id='widget_title']//input[@id='title']")); title.sendkeys("automation"); webelement browse = driver.findelement(by.xpath("//div[@id='listingthumbnail']//span[@id='dijit_form_button_14']")); browse.click(); driver.manage().timeouts().implicitlywait(150,timeunit.seconds); try{ list<webelement> sidemenu = driver.findelements(by.xpath("//*[@id='dijit_layout_contentpane_6']")); for(webelement drop:sidemenu){ system.out.println(drop.gettext()); } }catch(exception e){ } webelement file = driver.findelement(by.xpath(&q

css - Bootstrap 3 RC1 - Change navbar color -

i change bootstrap 3 navbar color default grey #5e00ff. customize section of bootstrap not available yet - how manually? in css, add this: .navbar { background-color: #5e00ff; } hope helps.

multithreading - Android - Using Indeterminate ProgressBar with another Thread -

Image
i trying use indeterminate progress bar when user clicks button when email sent. having problems thread open send email , progress bar think. right crashes when 2 close , wasn't sure if there smart way enable progress bar (basically want animation of swirling circle while emails sent user has feedback happening in background). oncreate public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); requestwindowfeature(window.feature_indeterminate_progress); setcontentview(r.layout.signin_page); verify_button = (button) findviewbyid(r.id.verify_button); signin_button = (button) findviewbyid(r.id.signin_button); staysignedin = (checkbox) findviewbyid(r.id.staysignedincheck); link4help = (textview) findviewbyid(r.id.link_to_register); gmail = (edittext) findviewbyid(r.id.signin_email); password = (edittext) findviewbyid(r.id.signin_password); email_success = (imageview) findviewbyid(r.id.email_authenticate_suc

bash - Git: Show content of file as it will look like after committing -

after reading git pre-commit hook : changed/added files , following question arose: given have file both staged , unstaged changes, how can display preview of file's contents after staging? example: echo "foo" >> file git add file echo "bar" >> file wanted output: [previous contents of file] foo use : prefix access objects in current index (staged not yet commited). git show :file see gitrevisions (emphasis mine): <rev>:<path>, e.g. head:readme, :readme, master:./readme a suffix : followed path names blob or tree @ given path in tree-ish object named part before colon. :path (with empty part before colon) special case of syntax described next: content recorded in index @ given path .

php - XML signature differences between HEREDOC and DOMDocument -

an api client have developed works xml messages , messages signed according xml signature syntax , processing specification. after long struggle, got signatures working. at moment building xml heredoc (simply php strings) , cleanup, i'd create xml domdocument directly. however, causes message invalidated server. this current setup (server accepts message when signed): $xml = <<<eot <?xml version="1.0" encoding="utf-8"?> <directoryreq xmlns="http://www.idealdesk.com/ideal/messages/mer-acq/3.3.1" version="3.3.1"> <createdatetimestamp>$timestamp</createdatetimestamp> <merchant> <merchantid>$merchantid</merchantid> <subid>$subid</subid> </merchant> </directoryreq> eot; $document = new domdocument(); $document->loadxml($xml); this oo approach (server rejects message when signed): $document = new domdocument('1.0', 'utf-8');

c++ - Vector gets iterated more times than size() -

i've got piece of code: for (std::vector<marker>::iterator = markers.begin(); != markers.end(); ++it) { if (it->getdots().size() < 3) { markers.erase(it); } } in 1 of test inputs (the app image analysis) segfault. tried debug code (to no avail) , noticed 1 thing. when asking gdb p markers.size() receive $9 = 3 . expect loop iterate 3 times, surprisingly (at least) 5 times. in fifth iteration there's segfault. noticed it's not dereference of *it (here it-> ) causes error. it's it->getdots() , simple getter. i write in c++ rarely, might simple mistake, neither debugging, nor googling brought solution. help? i'd emphasize, on various different inputs (slightly different images) function works properly, it's harder me trace bug down. vector::erase invalidates iterators pointing element being erased, , elements follow. it becomes invalid, , ++it expression on next loop iteration exhibits undefined behavior.

Get one most recent comment for each post in mongodb -

i have 2 collections in mongodb, 1 posts , 1 comments. best approach 1 recent comment each post? i'm looking similar solution mongodb: http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/ you should able aggregation framework combining $group $max . i give exact solution, can't unless give example of data. by way: proper way structure data in mongodb put comments sub-array of posts.

java ee - Where Eclipse deploys servlets on GlassFish? -

i'm using eclipse juno glassfish 4 on widows 7 box. glassfish installed local host. if keep defaults , deploy dynamic web project server via eclipse, web address servlets? should put html form action parameter? servlet's class annotated @webservlet . context root /webproject . i see servlet deployed on server, getting *404 *s on attempts. update: it's working now. haven't realized urlpatterns value case-sensitive .

entity_load or EntityFieldQuery to pull entity ids in Drupal -

should using entity_load or entityfieldquery entity ids custom entity? i going use entity_load pull of entities in question of particular type, , grab relevant information (but seems inefficient). entityfieldquery return array of entity ids. if need entityfieldquery faster. if need field values should entity_load. slow drupal way. if large number of nodes may have timeout issues. overcome use drupals batch api or can use database api write custom query pull in exact data need in 1 query. technically faster requires more code , can break compatibility.

Android - searching music using MediaStore using a string -

i can not accomplish on 2 weeks now. i have posted numerous amount of code on few questions yet of them got ignored won't flood question more code of own won't read. how search mediastore "like" attributes using string? e.g. type in shoot thrill, receive song id code: if(cursor.movetofirst()){ while(cursor.movetonext()){ string title = cursor.getstring(cursor.getcolumnindex(mediastore.audio.media.title)); string artist = cursor.getstring(cursor.getcolumnindex(mediastore.audio.media.artist)); string id = cursor.getstring(cursor.getcolumnindex(mediastore.audio.media._id)); test.settext(title +" " + artist + " " + id); } } here begin with: string[] projection = { basecolumns._id, mediastore.audio.artists.artist,

How to connect a COBOL program to an Oracle database? -

how can cobol program running, on mainframe platform, connect , access oracle database running on different unix platform? oracle have product embedding sql calls in cobol; it's pro*cobol pre-compiler. find out more. the snag is, pro*cobol program must reside on oracle server. so, given architecture, need make remote calls. it's been long time since used cobol (literally more 2 decades) thing remember functionality varied across different flavours. if using flavour based on cobol-85 compiler (or later) has external extension you're in luck, because can write own remote calls. here's cics example . otherwise might need buy something. ets sell product called cobol-rpc: find out more (no warranty implied or intended).

java - How to change the color of the background in libgdx labels? -

i can change color of font this labelstyle style1 = new labelstyle(..some font..., color.valueof("ff4500") ); label.setstyle(style1); but how change background? right background same background of whole screen set in render method lke gdx.gl.glclear(gl10.gl_color_buffer_bit); gdx.gl.glclearcolor( 1.000f, 0.980f, 0.941f ,1); actually not change background of lable that. did change clearcolour. guess know that. to change background need change background @ style of label. i'd recommend use simple ninepatch background, (can square! if white can change colour of ninepatch , background colour changes!) ninepatch temp = new ninepatch(new texture(....), 10, 10, 10, 10); //edges for more information ninepatch take here libgdx wiki ninepatch you need add ninepatch skin objekt. example this skin skin = new skin(); skin.add("background",temp) after can drawable skin can set ba

ios - Attach UISwipeGestureRecognizer to Multiple Views -

i have view controller normal view. in view, have 4 sub views. need each 1 react uiswipegesturerecognizer . hooked views uiswipegesturerecognizer in interface builder , hooked uiswipegesturerecognizer ibaction . works great; react uiswipegesturerecognizer . but, need action different, depending on view called ibaction . should do? here's ibaction code: - (ibaction)swipe:(uiswipegesturerecognizer *)sender { switch (view) { case view1: //do break; case view2: //do break; case view3: //do break; default: //do break; } } how should handle this? - (ibaction)swipe:(uiswipegesturerecognizer *)sender { if (sender.view == view1) { //do } if (sender.view == view2) { //do } if (sender.view == view3) { //do } } don't complicate simple. besides, using tags force define same tags in nib i

Python: How to make Next button read diffrent files. -

i'am going make window next button, text widget , label widget. want when klick on next button read adiffrent files on text widget, mean first click on nexst read file_1 in text widget, , secound click read file_2, , on. can me, thanks shelf might it. try opening file in shelf, reading it, printing it, closing it. when button hit variable incriminated. variable points index in array holds file names. pass file path function this: import shelve = 0 paths = array containing file paths function file (path): function opens reads prints , closes - file @ path while true: loop calls function args paths[i] i++ btw eas not meant python code representation p.s if have got wrong end of stick pls tell me , change awnser

How to create an options form in C# Windows Forms? -

Image
see picture above. screenshot visual studio's options form. the left side treeview. right side various controls change program options. when nodes in treeview selected, right side changes, showing different options. how program this? right side have 50 overlapping panels, , selecting of nodes changes panel visible? if case, how go managing such? mess in designer. no don't make 50 overlapping panels. create several usercontrols and, example, link types on tag of node. can use activator create controls. create 1 treeview , 1 panel: (pseudo code) // create nodes: treenode item = new treenode(); item.tag = typeof(usercontrol1); treeview.nodes.add( item ); // field currentcontrol usercontrol _currentcontrol; // on selection: treeviewitem item = (treeviewitem)sender; if(_currentcontrol != null) { _currentcontrol.controls.remove(_currentcontrol); _currentcontrol.dispose(); } // if no type bound node, leave panel empty if (item.tag == null) return;

WPF How to disable NavigationWindow commands -

i use pages , navigationwindow: navigationwindow = new navigationwindow(); navigationwindow.height = 200; navigationwindow.width = 100; navigationwindow.windowstate = windowstate.maximized; page = new intropage(); navigationwindow.navigate(page); navigationwindow.show(); i navigate using goback , goforward methods, don't want use them shortcuts (function buttons in mouse etc.) how can disable these shortcuts? in navigation window xaml can add this: <navigationwindow.inputbindings> <keybinding key="back" command="notacommand" /> <keybinding key="next" command="notacommand" /> <keybinding key="browserback" command="notacommand" /> <keybinding key="browserforward" command="notacommand" /> <keybinding key="left" modifiers="alt" command="nota