Posts

Showing posts from March, 2012

Php sessions switch image -

this question exact duplicate of: php imageswap script stuck php sessions imageswap [duplicate] i have home button on website, home button image of house. want make website userfriendly website. if clicking on button home button changing color , opens homepage. person knows on page he/she is. code far. the problem of script it won't switch image i'm not expert in php sessions scripting, me out? searched google , couldn't find related question. <?php session_start(); $_session['1'] = $_get["active"]; if (!empty($_get["active"])){ ?> <a href="<?php echo $this->createurl("/admin/survey/sa/index")."home"; ?>"> <img src='<?php echo $simageurl;?>home1.png' alt='<?php $clang->et("default administration page");?>&

asp.net mvc - How to use Moq with Entity Framework IDbSet Count() etc. methods -

i'm trying use moq make tests entity framework code first classes. i'm new moq , mocking techniques , wonder if it's possible test describe below. searched through web solutions, based on repository pattern, want avoid. i have itestentities interface context public interface itestentities { idbset<order> orders { get; } idbset<product> products { get; } idbset<user> users { get; } } then context public class testentities : dbcontext, itestentities { public testentities() : base("name=testentities") { } public virtual idbset<order> orders { get; set; } public virtual idbset<product> products { get; set; } public virtual idbset<user> users { get; set; } } a controller , action test public class homecontroller : controller { private itestentities db; public homecontroller() { db = new testentities(); } public homecontroller(itestentities db) {

java - How to Prevent JSP Page Refresh -

please can 1 me idea on how prevent jsp page refresh when request parameter triggered. below line of code: string action = request.getparameter("cmd"); if (action == null) { system.out.println("you here2"); action = ""; } else if(action.equalsignorecase("examselected")){ system.out.println("the exam id of long value " + examid); arraylist<subject> subjectname = new arraylist<subject>(); i want when action on examselected, let jsp page not refresh. in response. if want update info o page without refreshing can use ajax updating info on page. here detailed tutorial describes how to ajax requests. https://netbeans.org/kb/docs/web/ajax-quickstart.html

css - jquery mobile: How to insert an image into button -

i have kind of problem. have button: <button type="button" data-theme="c">test</button> and here instead of text test insert picture: <img src="resources/images/test-icon.png" align="middle" /> i tried couple of options couldn't find solution. thank help! bacause selected tag assume using jquery mobile styled buttons , not classic native browser button version. if case example never work. while amits example 1 never work in jquery mobile. when jquery mobile styles button hiddes old 1 , creates new 1 out of a tag. takes button text , redirects click events real (now hidden) button. we can use information modify new button styles. unfortunately in case of inputt button , input submit can't done without javascript. so show solution. jquery moible button can constructed this: <a data-role="button" class="custom-button">button text goes here</a> we can modify

android - Gson fromJson() returns object with null attrubutes -

Image
i'm trying create java objects using line: quiz currentquiz = gson.fromjson(json, quiz.class); but this: here object classes: quiz: public class quiz { private string ref; private string broadcast_dt; private question[] questions; public quiz() { // todo auto-generated constructor stub } public string getref() { return ref; } public void setref(string ref) { this.ref = ref; } public string getbroadcast_dt() { return broadcast_dt; } public void setbroadcast_dt(string broadcast_dt) { this.broadcast_dt = broadcast_dt; } public quiz(string ref, string broadcast_dt, question[] questions) { super(); this.ref = ref; this.broadcast_dt = broadcast_dt; this.questions = questions; } public question[] getquestions() { return questions; } public void setquestions(question[] questions) { this.questions = questions; } } question: public class question { private int question_number; private string question_text; private ans

php - plupload should save large and small image -

i using plupload save multiple images, want store same image 2 sizes, small image thum , large image display in large. how plupload store 2 sizes of images? it easier implementing need in server side... for plupload; can make use of function: resize : {width : 500, height : 600, quality : 90}, you should able achieve need if made use of events such fileuploaded reupload same uploaded file different parameters. here take @ discussion; should guide right path http://www.plupload.com/punbb/viewtopic.php?id=555

qgis - Change offset of geotiff file -

i need change offset of tiff files exporting qgis. qgis gives them offset of 0xbd72, while program need load them in reades files offset of 0xbcde. does know how change offset of tiff file in qgis or python/gdal or other way? (i trying make dtm of same shape srtm ace2-data, north of 60deg, use in compass c-pilot, flight instrument paragliding. needs data in offset 0xbcde , 0x2ee2 bytes per row.) since gdal software configures , writes data, take @ technical manual . in particular, see creation options section, there many options affect resulting file. also, it's not clear mean "offset", need clarify it. also, ideal tiff file, run gdalinfo example.tif to idea of ideal structure.

Start the script on Hover jQuery Cycle -

i have done jquery cycle in practice web design. problem is, want script start on mouse hover happens when refresh page, starts already. on 1st mouse over, stops. 2nd mouse over, starts slideshow , stops when it's mouse out. here's code: jquery(function($){ // cycle plugin $('.slides').cycle(); // pause & play on hover $('.slideshow-block').hover(function(){ $(this).find('.slides').addclass('active').cycle('resume'); }, function(){ $(this).find('.slides').removeclass('active').cycle('pause'); }); }); i tried putting 'pause' or "pause" in $('.slides').cycle(); destroys plugin , there no more effect. help! :) you can use .mouseover , .mouseout , .mouseenter or .mouseleave have better control of mouse actions. example: $(".slideshow-block").mouseover(function() { $(this).find(".slides").addclass('

Display Graph in Titanium iOS -

in app, need display status of feedback graph (chart) view. is webview need? i tried rgraph framework, showing errors me, how use framework? are they're anyother ways achieve this? thanks in advance ! yes, library utilizes canvas, you'll need webview display on. possibly helpful reading material on displaying charts: display charts titanium

c++ - Accessing child function, while using parent class -

i doing assignment university course , me , partner have problem. program making game. we have several classes, inherit base class, called creature. these enemies player needs deal , run own ais. there 4 different types of child classes, within namespace creature(including parent, creature), 1 class having special functions needs. class called bunny. now, job call ai functions needed. problem is, not know what class calling out, such, when ask game board tell me creature get. all enemies saved pointers so, in game board squares: struct square { // pointers morso class, enemy saved creature::creature* creature; //undeeded stuff removed }; now, , fine until need access special functions. pupu multiply if conditions filled. such, in pupu there few functions need call make sure carries out it's act correctly. however, here comes problem. i call our board class give me creature in coordinates give it. void gameengine::gameengi

how to know that user accept oauth permission in youtube api v2 in android -

i want use youtube api v2 in android, following developers.google.com/youtube when open https://accounts.google.com/o/oauth2/auth?client_id=client_id&redirect_uri=redirect_uri&scope=https://gdata.youtube.com&response_type=code url in webview, ask access application. how know if user accept it, because after accepting webview redirect page can success code=4/fsgko348949 i think tutorial can useful: http://blog.blundell-apps.com/tut-oauth-youtube-api-access/ this tutorial shows how detect if user selects “allow access” using listener: package com.blundell.youtubesignin.oauth; /** * class checks paramater's our redirect url has informing our listener * passes auth code if access granted. * * google documentation: * if user granted access application, * google have appended code parameter redirect_uri. * value temporary authorization code can exchange access token. * example : http://localhost/oauth2callback?code=4/ux5gnj-_miu4dod_gnzdjx9etof

php - How can I use Session Variables to output login username -

i'm building application , have added login page works well, communicating "username" , "password" field in database. after logging in, takes page users authorized see. is there way can display "welcome, xxx" particular user logged in @ next page? , more importantly, output detailed information of logged in user on next page? thanks. you can use session temporarily store data can seen across page.... after checking successful login credential, can stores user data in session <?php session_start(); $_session['username'] = $user_name; ?> after storing user data in session,you can access data across different pages until unset session data <?php session_start(); if (!isset($_session['username'])) { echo 'welcome, '.$_session['username']; } else { echo 'sorry, not logged in.'; } ?> when user logged out,unregister session variable. unregistering of sessi

android - How to stop a GridView from cropping my images? -

Image
i have gridview have filled 64 60x60px png's. want gridview display them close perfect square can have set numcolumns in xml 8 have 8x8 gird. here looks like: my images have small border @ edge though being cropped off. here drew on top left image should when displayed: here xml: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/textfieldfu" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <gridview android:id="@+id/gridview" android:lay

php - Facebook server login doesn't retrieve info if user refreshes page -

the code according fb manual, , ve noticed if user refreshes page, can't retrieve id of user..the user need clear address bar entire string after url, in order able obtain user info.. <?php $app_id = "myid"; $app_secret = "mysecretkey"; $my_url = "http://myurl.php"; session_start(); $code = $_request["code"]; if(empty($code)) { $_session['state'] = md5(uniqid(rand(), true)); // csrf protection $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&state=" . $_session['state'] . "&scope=publish_actions"; header("location: " . $dialog_url); } if($_session['state'] && ($_session['state'] === $_request['state'])) { $token_url = "https://graph.facebook.com/oauth/access_token?" . "cl

postgresql 9.2 - Confused with sql query -

i have following tables: customer(login varchar, town varchar) orders (ordno int , login varchar) >>login fk customer combination (id int, ordno int ,product_id int) >>ordno fk orders i need show products have been sold in all cities. example: insert customer (log1 , ny) (log2, ny) (log3, london) insert orders (1,log1) (2,log1) (3,log3) insert combination (1,1,1) (2,2,2) (3,3,1) product 1 sold in ny product 2 sold in ny product 1 sold in london if available cities ny , london, product must result of query product 1 select a.productid combination inner join orders b on a.ordno = b.ordno inner join customer c on b.login = c.login group a.productid having count(distinct a.id) = (select count(distinct town) customer) sqlfiddle demo

html - Tab content background cutting off in Safari but fine in Chrome -

i'm having trouble css tab content of site. client has asked image added background, have done , working fine in chrome , ie. in safari image being cut off, please see http://jsfiddle.net/j9ftx/11/ referring to. there must in css tabs controlling width can't find what. thanks help .tabs { position: relative; margin: 40px auto; width: 810px; background-color:#ffffff; background-image:url(http://creationdev.co.uk/expressiveprint/images/parrot.png); background-repeat:no-repeat; } .tabs input { position: absolute; z-index: 1000; height: 40px; left: 0px; top: 40px; opacity: 0; cursor: pointer; } .tabs input#tab-2{ top: 80px; } .tabs input#tab-3{ top: 120px; } .tabs input#tab-4{ top: 160px; } .tabs input#tab-5{ top: 200px; } .tabs label { background: #1c1c1c; margin-top:8px; font-size:32px; font-weight:normal; line-height: 40px; height: 40px; position: relative; padding

java - Submitting form to Struts Action using AJAX -

function callprocessfastafiles(){ var form=document.forms[0]; document.forms[0].action="/bioinformaticsonlinetool/fromprocessfasta.do"; document.forms[0].submit(); } i calling function send form server. how can change using ajax after server done, response comes on same page?

How to close the session in asp.net if computer idle for 5 mins -

i m developing web application using asp.net , want close current user session if computer idle 5 minutes. idle not means web application only, full system means if no keystroke received keyboard 5 mins. i got info thru google idle tracker in vc++ dont know how use dll in web application. link here. please guide me how achieve this. want total computer active time , idle time thru asp.net employees productivity report. it depend on how controlling session, looking @ web.config section <authentication mode="forms"> <forms loginurl="~/account/login" timeout="2880" /> </authentication> this allows specify timeout , view return when timed out.

SNMP Agent in Python -

i required snmp agent in python, listen on particular port , and responds basic snmp command (like gte, set, getnext ...etc) if 1 have code please reply on post. there's collection of snmp command responder scripts @ pysnmp web-site . here's simple pysnmp-based command responder uses text files in /tmp mib data store. from pysnmp.entity import engine, config pysnmp.entity.rfc3413 import cmdrsp, context pysnmp.carrier.asynsock.dgram import udp pysnmp.smi import instrum, error pysnmp.proto.api import v2c snmpengine = engine.snmpengine() config.addsockettransport( snmpengine, udp.domainname, udp.udptransport().openservermode(('127.0.0.1', 1161)) ) config.addv1system(snmpengine, 'my-area', 'public', contextname='my-context') config.addvacmuser(snmpengine, 2, 'my-area', 'noauthnopriv', (1,3,6), (1,3,6)) snmpcontext = context.snmpcontext(snmpengine) class fileinstrumcontroller(instrum.abstractmibinst

How can we send a request to the sharepoint search service? -

can explain me how can send request sharepoint search service? going start developping on sharepoint 2013. thank help if want use rest api can download following search tool http://blogs.msdn.com/b/nadeemis/archive/2012/11/10/sharepoint-2013-search-query-tool-released-on-codeplex.aspx you put values , rest api query. use search client object model follow below link http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/09/10/how-to-query-search-with-the-sharepoint-2013-client-object-model.aspx hope helps

automation - How to get data out of citrix -

here's want able do: run program on local computer logs in citrix server (using citrix receiver or doing in similar way), on server in citrix session open web browser, load website, , bring html of site out of citrix session , onto local computer. bascially want data out of citrix remote session. how can programmatically? i'm fine whatever programming language/modality comfortable in answering question using. i've looked little citrix apis while find things logging in , sending keystrokes , mouse clicks found nothing obtaining data. log in , use program wireshark information, i'm guessing it's encrypted (plus wouldn't doing task programmatically). know of @ least 1 open source program seems able replace citrix reciever/client (openthinclient.org) before got digging through source code try answer question thought i'd ask here in case had easier answer. if want automate task, having program act citrix client necessary? i assume don't

jquery - fancybox loads ok... then when page finishes loading its thrown off and changes position -

i've tried @ site's code using chromes debug tool see why happening no avail. basically. im using fancybox wordpress when user clicks on image expands pretty lightbox. currently whilst page loading still if click image fancybox loads ok, page finishes loading fancybox positioned right , overlay shows on site content (not whole browser screen) im wondering if there way see causing or if knows fix :( appreciated. http://bit.ly/17k4ef1 generally speaking, not idea set size , position and/or margins body , html tags use wrapper containers instead. your issue caused because body has element.style { min-height: 100%; position: relative; top: 0; } ... css properties. remove them test , you'll see normal.

git - How to add a sequence of commits to another branch? -

in git, how apply sequence of commits "d-e" master a-b \ py3-version c-d-…-e back onto master, obtain master a-b - <d patch applied> - <…> - <e patch applied> \ py3-version c-d-…-e i want because master python 2 version, c being python 3 version generated automatically (through 2to3 ), needed improve ( d e ). now, put improvements d e onto master branch (and forget c , py3-version , regenerated new master branch). how can done? this called cherry-picking in git lingo, can import changes selectively 1 branch another: git checkout master git cherry-pick py3-version~10..py3-version this pick last 10 commits "py3-version" branch. in case of conflicts prompted manually resolve them. should continue cherry-picking git cherry-pick --continue (or git cherry-pick --abort , if went wrong).

excel - "Update Lookups" prompt Box -

i have simple snippet of code paste down vlookup reference array in workbook. keep getting annoying prompt asking me update lookups.. have made explicitly clear file want , location, why asking me , how may disable prompt , make automatic? many thanks, range("f2").select activecell.formular1c1 = _ "=vlookup(rc[-5],'\\linkstation\rrm\campaign creator\raw data generators\rdg\[power event lookups.xlsx]sheet1'!r1c1:r10000c2, 2, false)" range("f2").autofill destination:=range("f2:f" & cells(rows.count, 1).end(xlup).row) http://support.microsoft.com/kb/826921 i beleive looking for. to suppress message , automatically update links when open workbook in excel 2002 or in excel 2003, follow these steps: 1.on tools menu, click options, , click edit tab. 2.click clear ask update automatic links check box. to suppress message , automatically update links when open workbook in excel 2007, follow these steps: 1.clic

scrollbar - Force jQuery UI dialog to show scroll bars -

i'm using jquery ui dialog boxes on site show pop-up forms. forms tend longer modal box, there vertical scrolling involved. when scroll trackpad or mousewheel vertical scroll bar shows on right hand side , fades out again. need scroll bar visible @ times. i've googled no avail. idea how this? here's html: <p class="open-support-form">click request support</p> <div id="support-form" class="dialog" title="request support"> <p>support line: 0800 123 4567</p> <p>email: helpdeskuk@company.com</p> <p><a href="#">screensteps manual</a></p> <p>more content</p> </div> here's jquery: // support form jquery( "#support-form" ).dialog({ autoopen: false, height: 500, width: 500, modal: true, close: function() { allfields.val( "" ).removeclass( "ui-state-error" );

backbone.js - How to set up Firebase location as a Backbone Model ID? -

i use backfire - firebase integration backbone.js examining backfire demo application see firebase location set "root" key , value id key. json response firebase { "-it-myawefbi1qgd8pxb": { "title":dummy title", "id": "-it-myawefbi1qgd8pxb" } } in model see firebase location set model id. backbone model attributes attributes: { id: '-iswdv_2rwzu3who0giq' title: 'dummy title' }, id : '-iswdv_2rwzu3who0giq' i wonder how data structure in firebase forge (backend) creates response described above? by going todo page , typing in command: new firebase('https://backbone.firebaseio.com').once('value', function(ss) { console.log(json.stringify(ss.val(), null, 2))}); i able see data structure looks this: { "-it-myawefbi1qgd8pxb": { "id": "-it-myawefbi1qgd8pxb", "title": "prepare lunch"

php - How to change the site language in codeigniter -

i have developed website in codeigniter , want multi-language. i have followed tutorial working hooks. here hook.php $hook['post_controller_constructor']=array( 'class'=>'languageloader', 'function'=>'initialize', 'filename'=>'languageloader.php', 'filepath'=>'hooks' ); and have created class , placed inside hooks folder. class langswitch extends ci_controller { public function __construct() { parent::construct(); $this->load->helper('url'); } function switchlanguage($language="") { $language=($language!="") ? $language:"english"; $this->session->set_userdata('site_lang',$language); redirect(base_url());

java - JMXBean entries are not showing up -

implementation of jmxbean performancemetadata jmxbean = new performancemetadata(); responsedocument = (document) serviceoperation.invoke(servicecomponent,requestdocument); jmxbean.setnumofrequests(1); jmxbean class: public class performancemetadata implements performancemetadatambean{ private int numofrequests; public int getnumofrequests() { return numofrequests; } public void setnumofrequests(int numofrequests) { this.numofrequests = numofrequests; } class registering jmxbean : call class while booting server. public class jmxbeans { public void registerjmxbeans() { mbeanserver mbs = null; performancemetadata metadataobj = null; objectname name; try { metadataobj = new performancemetadata(); mbs = managementfactory.getplatformmbeanserver(); name = new objectname("test.performace:type=performancemetadatambean");

xaml - Converting KeyBinding to MouseBinding in WPF -

i'm working datagrid. i have following xaml: <dg:datagrid lc:datagridpackage.querygrid="{binding mygrid}"> ... <dg:datagrid.resources> <lc:commandreference x:key="mycommand" command="{binding mycommandactionitem}" /> </dg:datagrid.resources> <dg:datagrid.inputbindings> <keybinding modifiers="control" key="d" command="{staticresource mycommand}" /> it works fine. click on row in datagrid, press ctrl+d , command executes (in case, refreshing row). however, if change keybinding mousebinding: <mousebinding mouseaction="leftdoubleclick" command="{staticresource mycommand}"> i error "a 'binding' cannot set on the 'command' property of type 'mousebinding'. 'binding' can set on dependencyproperty of dependencyobject". what doing wrong? try this: <mousebinding mous

PHP MYSQL search for postcode using LIKE -

i have query searches postcode using like. postcode fine if puts full postcode e.g. sw14 4np. if put in sw1 return sw1+ results. how can make if put sw1, display sw1 postcode , not sw11, sw14 etc. my query is: select postcode data postcode '$search%' the database postcodes stored sw14 4np etc space. use regular expression based pattern matching: where postcode rlike '^$search( ?[0-9][a-z]{2})?'

Tabris 0.11 iOS EXC_BAD_ACCESS Geolocation -

first of all: got such , fast feedback guys few days ago. i'm still playing around in tabris 0.11 , tried implement geolocation guys did in demo project. everything working great on android, under ios (iphone 5) error exc_bad_access (code=1, address=0xbbadbeef) here how code looks like public void create( composite parent, uicontext context ) { // creation of layout types createlayouts(); parent.setlayout( gridlayoutfactory.filldefaults().margins( 0, 0 ).spacing( 0, 0 ).create() ); createcontainer( parent ); createbrowser(); } private void createlayouts() { layoutgrid = new gridlayout(); layoutgrid.numcolumns = 1; layoutgriddata = new griddata(); layoutgriddata.horizontalalignment = griddata.fill; } private void createcontainer( composite parent ) { [...] containerbrowser = new composite( parent, swt.none ); containerbrowser.setlayout( layoutgrid ); containerbrowser.setlayoutdata( new griddata( swt.fill, sw

geolocation - Can Twitter API search for all latest tweets from a country, rather than a geo co-ordinate? -

i want search latest tweets uk closest i've found being able search radius given co-ordinate e.g. https://api.twitter.com/1.1/search/tweets.json?geocode=51.503355%2c-0.127564%2c50mi returns tweets 50 mile radius of centre of london.

Magento not showing products while saving in backend -

i have small problem magento 1.5 the products showing ok in frontend, on open product in backend , press save or save , continue, frontend not showing nothing. i think here problem index management. what can no reindex hole category or hole database on save product ? any appreciated. you can change behavior of index not update on every product change, , manually (i.e. via cronjob) you can change in admin area @ system / index management. select product index , choose "change index mode" in dropdown.

war - Using the context-root from glassfish-web.xml in GlassFish 3 -

we switched glassfish 3.1.2.2 , have several web-applications packaged war files. @ times desired context-root these applications differs filename. back when used weblogic achieved declaring context-root in weblogic.xml this <context-root>path/to/our/app</context-root> we noticed same tag exists in glassfish-web.xml. no matter define there, server determines filename context-root. now find option --contextroot in asadmin utility allow overwrite filename @ deploy time, we'd prefer define directly in archive whoever deploy in end won't need know desired contex-root. is there way achieve this? normally should work glassfish-web.xml looking this: <!doctype glassfish-web-app public "-//glassfish.org//dtd glassfish application server 3.1 servlet 3.0//en" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> <glassfish-web-app> <context-root>/path/to/app</context-root> </glassfish-web-

c# - The name "XYZ" does not exist in the namespace "clr-namespace:ABC" -

Image
i working on creating markup extensions , started weird vs behaviours. have extracted , pinpointed issue in separate solution. problem vs can't create clr object in xaml. here is: view: <window x:class="wpfapplication4.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfapplication4="clr-namespace:wpfapplication4"> <window.resources> <wpfapplication4:dog x:key="doggy" /> </window.resources> <grid /> </window> code behind: using system.windows; namespace wpfapplication4 { public partial class mainwindow : window { public mainwindow() { initializecomponent(); } } } dog class: namespace wpfapplication4 { public class dog { } } app.xaml (no code in app.xaml.cs): <application x:class=&

c - What does sched_yield do in this case? -

if have process threads running on different cores, sched_yield in case? relinquished , issued again? because see sched_yield not cause thread calling it, wait cycles @ all, seems call not going kernel. the man page says: if calling thread thread in highest priority list @ time, continue run after call sched_yield(). so if there's nothing more important run, function nothing.

How to filter Record values of files in hadoop mapreduce? -

i working program in mapreduce. have 2 files , want delete information file1 exists in file2. every line has id key , numbers (separated comma) value. file1: 1 1,2,10 2 2,7,8,5 3 3,9,12 and file2: 1 1 2 2,5 3 3,9 i want output this: output: 1 2,10 2 7,8 3 12 i want delete values of file1 have same key in file2. 1 way have 2 files input files , in map step produce: (id, line) . in reduce step filter values. but, files very large , therefore can't way. or, efficient if file1 input file , in map open file2 , seek line , compare value? have million keys , every key must open file1, think have excessive i/o. what can do? you can make both file1 , file2 inputs of mapper. in mapper you'd add source (file1 or file2) records. use secondary sort make sure records file2 come first. so, combined input reducer that: 1 file2,1 1 file1,1,2,10 2 file2,2,5 2 file1,2,7,8,5 3 file2,3,9 3 file1,3,9,12 you can take

linux - How to redirect output of ssh.exec_command to a file in Python paramiko module? -

i want run python script test.py on linux target machine (which has python interpreter) , capture output of command in text file part of python script invoke.py using paramiko module. the statement in script stdin, stdout, sterr = ssh.exec_command("python invoke.py > log.txt") generates blank file log.txt. please suggest corrections / alternate way this. write output file correctly. test.py when run locally outputs sane text (which expected logged in log.txt). there relevant posts here , here , no 1 deals output of python script

c# - WebServiceHost returning 405 not allowed on GET in .NET4.0 -

this simple webservicehost works when compile .net3.5 not in 4.0 access browser url http:// mycomputer:8081/svc/helloworld the 3.5 version returns the"hello world! @ <time>" string, 4.0 version returns - 405 not allowed. does know why? i'm using .net4.0 on win7 sp1 64bit machine using system; using system.web.services; using system.servicemodel; using system.servicemodel.web; using system.collections.generic; using system.runtime.serialization; [servicecontract] public interface imyservice { [operationcontract] [webget(uritemplate = "helloworld")] string hellworld(); } public class myservice : imyservice { public string hellworld() { return "hello world! @ " + datetime.now.tostring("s"); } } public class myclass { public static void main() { string mycomputer = "mycomputer"; string mysvcuri = "http://" + mycomputer + ":8081/svc";

javascript - requestAnimationFrame polyfill: what's the element parameter for? -

i using requestanimationframe polyfill erik möller (fixes paul irish , tino zijdel) , wondering second parameter called "element" for. here code: (function() { var lasttime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestanimationframe; ++x) { window.requestanimationframe = window[vendors[x]+'requestanimationframe']; window.cancelanimationframe = window[vendors[x]+'cancelanimationframe'] || window[vendors[x]+'cancelrequestanimationframe']; } if (!window.requestanimationframe) window.requestanimationframe = function(callback, element) { var currtime = new date().gettime(); var timetocall = math.max(0, 16 - (currtime - lasttime)); var id = window.settimeout(function() { callback(currtime + timetocall); }, timetocall);

java - Increment an int using Jbuttons for use with an array -

http://pastebin.com/dh4jweck the program supposed to, every time number button pressed, save number array, counter use point next cell in array seems update when same button pressed twice. for example if input 121323311 keypad prints 1 1 2 1 2 2 3 3 4 arraycount. edit: origianal code in buildgui() method was: jpanel buttons = new jpanel(); buttons.setlayout(new gridlayout(0,3)); jbutton 1 = new jbutton("1"); buttoneventhandler bl1 = new buttoneventhandler(); one.addactionlistener(bl1); jbutton 2 = new jbutton("2"); buttoneventhandler bl2 = new buttoneventhandler(); two.addactionlistener(bl2); so on each button, i've changed to: jpanel buttons = new jpanel(); buttoneventhandler bl = new buttoneventhandler(); buttons.setlayout(new gridlayout(0,3)); jbutton 1 = new jbutton("1"); one.addactionlistener(bl); jbutton 2 = new jbutton("2"); two.addactionlistener(bl); and works. thank you. it seems have multiple instances

c - Is there a difference between initializing a variable and assigning it a value immediately after declaration? -

assuming purely non-optimizing compiler, there difference in machine code between initializing variable , assigning value after declaration? initialization method : int x = 2; assignment method : int x; x = 2; i used gcc output assembly generated these 2 different methods , both resulted in single machine instruction: movl $2, 12(%esp) this instruction sets memory held x variable value of 2 . gcc may optimizing because can recognize end result of operations; think way interpret 2 versions. reasoning both version same thing: set part of memory specific value. why distinction made between terms " initialization " , " assignment " if resulting machine code same? is term " initialization " used purely differentiate variables have specific value assigned on (non-initialized) variables have whatever garbage value left in memory? the behavior must identical, differences in generated code depend on compiler. for example, compil

Facebook api and send invite to more than one friend in android -

i have problem inviting firend facebook api app. method: private void invitefromfacebook(activity activity, list<graphuser> list) { for(int i=0; i<list.size(); i++) { //todo post invite friends wall // log.v("mainactivity", "user id: " + user.getid()); if(list == null || list.size() == 0) return; bundle parameters = new bundle(); string friendsidsinformat = ""; friendsidsinformat = friendsidsinformat + list.get(i).getid(); parameters.putstring("to", friendsidsinformat); parameters.putstring( "message", "use app!"); facebook mfacebook = new facebook( getresources().getstring(r.string.facebook_app_id)); // show dialog invitation mfacebook.dialog(activity, "apprequests", parameters, new facebook.dialoglistener() { @overri

ruby - Custom profile for Chrome -

environment: mac os x 10.8.3, ruby 2.0.0p0, selenium-webdriver 2.32.1, chromedriver 26.0.1383.0. i want change default browser language. testing if site detects browser language correctly , displays pages in language. i able set firefox language german: require "selenium-webdriver" profile = selenium::webdriver::firefox::profile.new profile["intl.accept_languages"] = "de" caps = selenium::webdriver::remote::capabilities.firefox(firefox_profile: profile) caps.platform = "linux" caps.version = 20 driver = selenium::webdriver.for( :remote, url: "http://username:access-key@ondemand.saucelabs.com:80/wd/hub", desired_capabilities: caps) driver.navigate.to "http://sandbox.translatewiki.net/" i want same using chrome (and other browsers, if possible). i have tried several things trying open page in german in chrome, every time page displayed in english, instead of in german. require "selenium-webdriver&q

Eclipse SVN commit an unupdated version? -

i'm trying commit out of date version of java project, won't let me without updating it. not want update because updated version messed up, checked out older version... there way of creating new project on svn it? can't show on our repository. option select when right click project , select team? branch working copy main repository, have 2 working copies refer. have access both versions can needful... link reference see branches, tags , trunk....

php - fpdf line break not working -

i have knockout observable contains text has line breaks in it. like this: var str += item.first_name + " " + item.last_name + "," + item.occupation + "\n\n"; str += "re :" + item.first_name + " " + item.last_name + ", dob: " + item.date_of_birth + "\n"; text = ko.observable(str); the method using display string is: $pdf->multicell(0,8,$text); the result in pdf : dr. bart grahamson,mbbsre :jack junior, dob: 1985-01-02 what way catch line breaks? use \n , \r. var str += item.first_name + " " + item.last_name + "," + item.occupation + "\n \r\r \n"; str += "re :" + item.first_name + " " + item.last_name + ", dob: " + item.date_of_birth + "\n \r"; text = ko.observable(str);

asp.net mvc - how to create a view with multiple models mvc 4? -

Image
so works in asp.net mvc 4 project , have problem in view, want create view 2 differnt type of model,first view (index) take ienumerable (models.mymodel) second (subscriber details) take models.mymodel, this model code : public class subscribersmodel { [required] [datatype(datatype.text)] public string name { get; set; } [required] [datatype(datatype.text)] [stringlength(maximumlength: 10, minimumlength = 7)] public string cin { get; set; } [required] [datatype(datatype.date)] public datetime birthday { get; set; } [datatype(datatype.text)] public string birthplace { get; set; } } my controller code : public class subscriberscontroller : controller { private agencydbentities dbcontext = new agencydbentities(); private subscribe sb = new subscribe(); public actionresult index() { var subscribers = sb in dbcontext.subscribes select new subscribersmodel { cin = sb.cin, name = sb.name, birth

pagination - Wordpress get range of posts -

using wp_query, how can range of posts? when select category, want first until 6th post, on same page want 7th until 13th post. it easy if using normal query. ok,i found answer. looking 'wp_query range' , didn't find anything, started looking @ 'offset' , found plenty information. didn't think of sooner. for else looking range : $termid = $wp_query->get_queried_object_id(); $args = array( 'cat' => $termid, 'order' => 'desc', 'posts_per_page' => 6, 'offset' => 6 ); $category_posts = new wp_query($args); if($category_posts->have_posts()) : while($category_posts->have_posts()) : $category_posts->the_post();

c++ - Fill_Rect in SDL -

i got question sdl_fillrect. normally function work that: sdl_fillrect(screen, &screen->clip_rect, color); my question is, instead of passing single color, can fill rect multiple color contain different red, blue, , green channel of pixel? how go determining color pattern? think closest gonna sdl_blitsurface . pattern surface , blit onto surface. http://www.libsdl.org/docs/html/sdlblitsurface.html

php - Factory Method - what exception to throw -

i have extremely simple factory method creates model instance based on values , conditions of config passed it. what unsure if factory unable create model instance based on config receieves. first question is, should return false or null? or should throw exception? if should throw exception exception should be. im working in php here (list of php exceptions http://php.net/manual/en/spl.exceptions.php ) you person can answer questions. should happen isn't defined anywhere. if ask me, prefer throw exception, call yourfactory_classnotfoundexception if want. make calling code more straightforward won't need test return value. afaik know there following common consensus in php core functions , classes: false should returned method encounters error , not throw exceptions. (and has no boolean return value is_file() ). methods expected set errno , errmsg give user chance grab error message. some of newer php classes throw exception in case. prefer ex