Posts

Showing posts from July, 2015

ssh - Can I connect to an EC2 instance with one key-pair while forwarding another? -

i need connect ec2 instance amazon-provided key-pair, forward public key associated github account can pull private repo (with fabric). possible? if so, need have public key on each remote machine pull from? yes. use -i option ssh. , agent , agent forwarding github account. ssh -i my_aws_key_pair.pem -a myawshost i assume question, know how whole agent thing. way, can add aws key pair agent ssh-add my_aws_key_pair.pem , need ssh -a. forward both keys though. not sure if wanted avoid or not.

perl - What is the reason for the error "Failed to decode JSON" in MediaWiki::API? -

we have private mediawiki installation inside our company. based on daily builds on our source code, update wiki perforce labels people can use build labeled streamlined process. tried automate using perl scripts on windows server using mediawiki::bot , mediawiki::api . use mediawiki::bot; use mediawiki::api; $mw = mediawiki::api->new(); $mw->{config}->{api_url} = 'http://somewiki/w/index.php/title#feature_list'; # log in wiki $mw->login({ lgname => 'username', lgpassword => 'password' || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; # list of articles in category $articles = $mw->list({ action => 'query', list => 'categorymembers', cmtitle => 'category:perl', cmlimit => 'max' }) || die $mw->{error}->{code} . ': ' ...

java ee - How can I display image in JSP? -

i trying display user avatar stored in db on user personal page (jsp) here do 1- have servlet processing login request , produce user bean object. (user avatar byte array ,it may appear multiple times on different pages , locations that's why prefer session attribute rather read them each time db) 2- user bean stored in session attribute. 3- want have jsp or servlet display byte array avatar image anytime. 4- whish servlet reusable other icon images, that's why think can not rely on session attributes pass byte array? (i not quite sure this) so there design achieve want ? or should use session attributes pass data around? thanks how can display image in jsp? using html <img> element. is there design achieve want? you create standalone servlet that. it's 2 or 3 lines of code in doget() method. true, servlet not reuseable streaming images straight db, create one. isn't major problem imho. or should use session at...

discovery - WCF: How to set AnnouncementService only receive localhost on/off line message -

i create wcf-lib, want interprocess communication. when open app, use lib, announce each other. use udpannouncementendpoint, work. receive announcement intranet. can ? and create endpoint code this: private void actioninitclientservice() { // create clientselt servicehost _clientservicehost = new servicehost(_clientinstance); _clientservicehost.addserviceendpoint((typeof (iclientservice)), new netnamedpipebinding(), info.address); // make client discoverable via udp // , broadcast online announcement _clientservicehost.addserviceendpoint(new udpdiscoveryendpoint()); var discoverybehavior = new servicediscoverybehavior(); discoverybehavior.announcementendpoints.add(new udpannouncementendpoint()); _clientservicehost.description.behaviors.add(discoverybehavior); _clientservicehost.opened += onopenedclientservicehost; _clientservicehost.closed += onclosedclientservicehost; } and ...

javascript - Bind click handler to all elements except those of a certain HTML tag -

so have page setup lets expend text boxes upon click: http://hashtag.ly/#nascar it adds 'active' class elements upon click , removes if click text box. i'd remove class if click on red background. i'll want add elements page shortly it's important removal comes clicking red portion <body> element. so here's have on page now: (note log replaced removal of class) $('*:not(li)').click(function(){ console.log('foo') }); the problem logs 'foo' everywhere click, directly on text boxes li elements. how can make work upon click of background? thanks! your problem you're bubbling down html stack. putting handler on everything , if click on li, event bubble ul. similarly, $('body') cause bubbling issues. you're best off creating div outside of main stack handle this. imagine absolutely positioned div behind of page. if want have everything fire except li, code need more this: $('*:n...

javascript - using .css('display')=="none" in Internet Explorer -

i'm trying test something's visibility with $(this).css('display')=="none"; the problem is, works in chrome, ff...but not in ie. i've tried ie 8 , 9 far. does know work around? frustrating bunch of people still use ie , don't want lose bunch of people. use $(this).is(":visible") cross-browser solution. from docs: elements considered visible if consume space in document. visible elements have width or height greater zero. elements visibility: hidden or opacity: 0 considered visible, since still consume space in layout. read more: http://api.jquery.com/visible-selector/ , how tell if element visible

Word 2003 vba cannot change bookmark font -

the following code not work objdoc.bookmarks("somebookmark").range.font.bold = true objdoc.bookmarks("somebookmark").range.text = getsometext() objdoc.bookmarks("somebookmark").range.font.bold = true when run code text retrieved getsometext() still has default font. why don't style bookmarks? searched in past , didn't find proper solution then. however, since bookmark represents fixed field in text template, format shouldn't change easily. i'm sorry put in reply field, can't find "comment" button :-s

c# - Autofac two properties with the same type -

if i've got 2 properties in class same interface type , want inject 2 different conrete types each how do autofac either property or constructor injection. eg. class : ia { public ib propertyb { get; set; } public ib propertyc { get; set; } public a(ib b, ib c) { propertyb = b; propertyc = c; } public void printb() { propertyb.print(); } public void printc() { propertyc.print(); } } i've tried of course c inject both properties var builder = new containerbuilder(); builder.registertype<b>().as<ib>(); builder.registertype<c>().as<ib>(); builder.registertype<a>().as<ia>(); var container = builder.build(); var = container.resolve<ia>(); or same result: builder.registertype<b>().as<ib>(); builder.registertype<c>().as<ib>(); builder.registertype<a>().as<ia>().propertiesautowi...

When we should we use stream wrapper and socket in PHP? -

i don't understand when should use stream wrapper , socket. can tell me when should use stream wrapper , socket in php? please give me example regarding same. streamwrappers quoting php manual @ streams: introduction : a wrapper additional code tells stream how handle specific protocols/encodings. example, http wrapper knows how translate url http/1.0 request file on remote server. there many wrappers built php default (see supported protocols , wrappers ) you use stream wrappers whenever opening urls, ftp connection, etc functions fopen or file_get_contents . stream wrappers have benefit not need know protocol (unless write own custom wrapper). since funnel access through regular file functions ­docs , not need learn api benefit. used stream wrappers without noticing it, instance, when did $pagecontent = file_get_contents('http://example.com'); somewhere in code. benefit of stream wrapper can put filters in front , modify stream minimal eff...

postgresql - function to_char(unknown, unknown) is not unique -

when running following query. select * surgicals to_char(dt_surgery ,'dd-mm-yyyy' ) = to_char('12-02-2012','dd-mm-yyyy'); the error coming 'sql state 42725: error: function to_char(unknown, unknown) not unique' how run above select query? you mean to_char('12-02-2012'::date, 'dd-mm-yyyy') . to_char cannot convert plain string string. still, not seem make sense, need 1 of these two, depending on format of date constant (which cannot determined actual example date provided): select * surgicals to_char(dt_surgery ,'dd-mm-yyyy' ) = '12-02-2012'; select * surgicals to_char(dt_surgery ,'mm-dd-yyyy' ) = '12-02-2012';

grand central dispatch - IOS dispatch_async view will disappear -

i using dispatch_async , block retrieve server data every 3 seconds or so. method of handling view either disappearing or user shutting program down? would boolean flag async block checks every , then? if so, if view exits while async block sleeping? you cannot cancel dispatch call, best bet move nsoperation instead. there highly relevent video wwdc 2012, session 211 - building concurrent user interfaces on ios covers precisely kind of problem describe. suggest watch it. the basic approach create nsblockoperation can check -iscancelled property on return if gets cancelled. can cancel operation in viewdiddisappear . an alternative approach use nstimer can invalidated/cancelled. might simplest solution given description of code doing.

ios - NSURLRequest HTTPBody vs. ASIHTTPRequest postBody -

i'm trying convert of project's nsurlrequests use nsurlconnection asihttprequest calls. came across issue setting httpbody in asihttprequest. here's had nsurlrequest call: nsmutableurlrequest *req = [nsmutableurlrequest requestwithurl:[nsurl urlwithstring:self.urlstring]]; [req sethttpmethod:@"post"]; [req sethttpbody:[self.paramstring datausingencoding:nsutf8stringencoding]]; [self _sendrequest:req]; and convert asi, have far: __block asihttprequest *request = [asihttprequest requestwithurl:[nsurl urlwithstring:self.urlstring]]; [request setrequestmethod:@"post"]; [request appendpostdata:[self.paramstring datausingencoding:nsutf8stringencoding]]; [request setcompletionblock:^{ nslog(@"asihttp request finished: %@", [request responsestring]); // stuff here }]; [request setfailedblock:^{ nserror *error = [request error]; nslog(@"asihttp error: %@", [error description]); }]; [request startasynchronous]; alt...

python 2.7 - Creating executable with Py2exe and matplotlib errors -

i have been searching forum , many others , cannot seem method of creating executable. have tried several different methods (py2exe, pyinstaller , cx_freeze) , seem give me kind of error. when tried pyinstaller, received error "no _imaging c module installed". search says has pil, code not using pil. when tried py2exe, keep receiving following error: file "scout_tool.py", line 18, in <module> file "matplotlib\pyplot.pyc", line 95, in <module> file "matplotlib\backends\__init__.pyc", line 25, in pylab_setup importerror: no module named backend_qt4agg i @ loss of do. code contains following imports: import os import csv import wx import time import math matplotlib.backends.backend_wx import figurecanvaswx figurecanvas matplotlib.backends.backend_wx import navigationtoolbar2wx matplotlib.pyplot import figure,show mpl_toolkits.basemap import basemap matplotlib.figure import figure import matplotlib.pyplot plt numpy.ran...

android - NoClassDefFoundError with PDFViewer -

i'm trying implement pdf viewer, application comes detect pdfs stored in sd card, can see in image. http://img225.imageshack.us/img225/3852/pdfs.png but when click on file view it... error. this logcat: 06-28 07:32:46.963: warn/dalvikvm(330): unable resolve superclass of lcom/example/trypdf/second; (496) 06-28 07:32:46.983: warn/dalvikvm(330): link of class 'lcom/example/trypdf/second;' failed 06-28 07:32:46.983: error/dalvikvm(330): not find class 'com.example.trypdf.second', referenced method com.example.trypdf.pdfvieweractivity.openpdfintent 06-28 07:32:47.013: warn/dalvikvm(330): vfy: unable resolve const-class 419 (lcom/example/trypdf/second;) in lcom/example/trypdf/pdfvieweractivity; 06-28 07:32:47.013: debug/dalvikvm(330): vfy: replacing opcode 0x1c @ 0x0002 06-28 07:32:47.013: debug/dalvikvm(330): vfy: dead code 0x0004-000e in lcom/example/trypdf/pdfvieweractivity;.openpdfintent (ljava/lang/string;)v 06-28 07:32:47.373: info/activitymanager(59): di...

android - make the picture next to each other gridView -

im using grid view , picture seems have spaces between each other. should make picture next each other? <gridview android:id="@+id/gridview" android:layout_width="30px" android:layout_height="fill_parent" android:columnwidth="0dp" android:numcolumns="3" android:verticalspacing="0dp" android:horizontalspacing="0dp" android:stretchmode="columnwidth" android:gravity="" />

Processing form's element(s) in JSP -

i have html form in jsp page, , in have javascript validation. user must enter 1 field: name or id or year, , java file search student in database name or id or year. javascript alerts when no field filled , performs action if 1 field filled. <html> <head> <title>student search database</title> <script language="javascript"> function validate2(objform){ int k = 0; if(objform.name.value.length==0){ objform.name.focus(); k++; } if(objform.year.value.length==0){ objform.year.focus(); k++; } if(objform.id.value.length==0){ objform.year.focus(); k++; } if(k == 0){ return false; } return true; } </script> </head> <body bgcolor=#add8e6><center> <form action="foundstudents.jsp" method="post" name="entry2" onsubmit="validate2(this)"> <input type="hidden" value="list" name="seek_stud"> ....................................................

XAML windows 8 metro app, binding issue -

i using grouped gridview in windows 8 metro application, have variablesizedwrapgrid in itemspaneltemplate , , want bind maximumrowsorcolumns property, not binding correctly. here xaml <gridview itemssource="{binding source={staticresource groupeddata}}" > <gridview.itemtemplate> <datatemplate> <grid width="120" height="150" > <!--some controls here binded correctly.--> </grid> </datatemplate> </gridview.itemtemplate> <gridview.groupstyle> <groupstyle> <groupstyle.headertemplate> <datatemplate> <grid margin="1,0,0,6"> <stackpanel orientation="horizontal"> <textblock text="{binding maxgridcoulmns}"></textblock> <!--wor...

sql server 2008 - SQL divide by zero with a sum function -

i having problems dividing zero. if denominator 0 value zero. when try using nullif , end 0 or 1 calculated value. here sql: select statecode, month1date,(sum(order)/sum(value)) myvalue tblorders inner join tblstates on orderstatecode = statecode group statecode, month1date select statecode, month1date, isnull(sum(order) / nullif(sum(value), 0), 0) myvalue tblorders inner join tblstates on orderstatecode = statecode group statecode, month1date a 0 denominator changed null , cause result null . whole result has isnull() turn nulls 0's. personally not include isnull() , leave result null . depends on use-case really. edit: deleted case when version answer had before mine.

javascript - Modifying a JSON object returned with PDO -

i'm trying return use json object handlebars. making small todo list learn how use it. my php api follows : $query = "select * table"; try { $db = getconnection(); $response = $db->query($query); $todo = $response->fetchall(pdo::fetch_obj); $bdd = null; echo json_encode($todo); } it returns : [{"id":"1","todo":"do something","who":"me","is_done":"0"},{"id":"2","todo":"learn json","who":"me","is_done":"0"}] but i'd need : {todos: [{"id":"1","todo":"do something","who":"me","is_done":"0"},{"id":"2","todo":"learn json","who":"me","is_done":"0"}]} i tried in php api add instead of echo json_encode($todo) ...

jquery mobile - changePage interfering with custom select -

i have select button on jquery mobile page data-native-menu="false". list of options long pop-up, why jqm uses page overlay show select-menu. i'd use select menu navigation, bind change event changepage function. here's happens: tap on list item, new page slides in , slides out again immediately. guess happens because page overlay of custom select menu wants go page invoked ?!? any ideas prevent this? thank in advance :-)) here's code html: <div id="one" data-role="page" data-theme="a"> <div > <div class="myheader"></div> </div> <div data-role="content"> <div id="startbuttons"> <a href="#two" data-role="button" data-theme="a" data-transition="slide">preis ermitteln</a> <select name="miet...

java - Au revoir, Python? -

i'm ex-c++ programmer who's discovered (and fallen head-over-heels with) python. i've taken time become reasonably fluent in python, i've encountered troubling realities may lead me drop language of choice, @ least time being. i'm writing in hopes out there can talk me out of convincing me concerns circumvented within bounds of python universe. i picked python while looking single flexible language allow me build end-to-end working systems on variety of platforms. these include: - web services - mobile apps - cross-platform client apps pc development speed more of priority @ time-being execution speed. however, in order improve performance on time without requiring major re-writes or architectural changes think it's imperative able interface java. way, can use java optimize specific components application scales, without throwing away code. as far can tell, requirement enterprise-capable, platform-independent, fast language large developer base...

Need some clarification regarding this Qt tutorial, can someone help me out? -

i'm guessing answers these questions simple familiar qt. i'm trying follow intro tutorial qt: http://doc.qt.nokia.com/4.7-snapshot/gettingstartedqt.html . until part i've taken screenshot for: http://i160.photobucket.com/albums/t182/thinkpad20/qtintro.jpg i understand these 2 code blocks enough, if implement widget class show here, should putting in main function of code? doesn't anywhere. also, when try compile code, "undefined reference 'vtable notepad'" error. can me out? undefined reference 'vtable notepad' means you're not linking in moc-generated files. qt docs mention common mistake . as include in main , involves creation of application , gui element, calling exec on application. @ basic, might this: #include <qapplication> #include "notepad.h" int main(int argc, char *argv[]) { qapplication app(argc, argv); notepad mainwindow; mainwindow.show(); return app.exec(); }

xslt - How to read a file in current directory through Java Class in another directory -

i working on linux os. i facing trouble parsing & transforming xml file though java. location of java xmltransform.class: /home/apps/source (this path present in classpath) location of xml file (working directory): /home/apps/nk/working/payload.xml when inside "working directory", invoking xmltransform.class passing xml filename payload.xml getting following error: xml-22004: (fatal error) error while parsing input xml document (invalid inputsource.). --------- oracle.xml.parser.v2.xmlparseexception: invalid inputsource. @ oracle.xml.parser.v2.xmlerror.flusherrors1(xmlerror.java:320) @ oracle.xml.parser.v2.xmlreader.pushxmlreader(xmlreader.java:248) @ oracle.xml.parser.v2.xmlparser.parse(xmlparser.java:202) @ oracle.xml.jaxp.jxtransformer.transform(jxtransformer.java:321) @ transformationengine.main(transformationengine.java:30) it clear class not able resolve file name. please give pointers how can resolve this? note: invoice_transfo...

javascript - FB Comments not working -

<div id="fb-root"></div> <script> window.fbasyncinit = function() { fb.init({ appid : '307264182690190', // app id channelurl : '//www.gig-links.com/channel.html', // channel file status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true // parse xfbml }); // additional initialization code here }; // 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...

jax rs - Why do we need JAXB bean when configuring JSON for RESTful web services? -

i'm reading tutorial configuring json restful web services: https://blogs.oracle.com/enterprisetechtips/entry/configuring_json_for_restful_web jaxb defines how java objects converted , xml. however don't understand why have jaxb bean model when creating restful web services return json response? after json not xml, right? however don't understand why have jaxb bean model when creating restful web services return json response? short answer you don't have use jaxb create restful service using jax-rs framework. jax-rs provides messagebodyreader / messagebodywriter mechanism plug-in whatever binding want. json binding providers include implementation of these classes can use directly. below example of how eclipselink moxy (i'm tech lead): http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html advantage of using jaxb applying jaxb mapping provides easy mechanism provide 1 set of mappings both xml , json representa...

python - Check if item is in an array -

if i've got array of strings, can check see if string in array without doing for loop? specifically, i'm looking way within if statement, this: if [check item in array]: assuming mean "list" "array", can do if item in my_list: # whatever

paint - How do I make a pattern fill of the path of a text in android? -

Image
i trying generate below effect programmatically altering between 2 states on time basically in first image (state #1), want path of text filled own custom bitmap (a red circle in case of example above) , should repeat after fixed distance (which happens same diameter of red circle in case). in second image (state #2), red circles take alternative pattern , locations blank spaces in state #1. from the answer question gather can use bitmapshaders on paint. following code have come 1 state. stuck , unable think how can achieve this. public void drawtext(string text, int x, int y) { paint defpaint = new paint(); defpaint.settextsize(100); defpaint.setstrokewidth(0); defpaint.setstyle(style.fill_and_stroke); defpaint.setshader(new bitmapshader( ((androidpixmap) assets.redcircle).bitmap, tilemode.repeat, tilemode.repeat)); path path = new path(); defpaint.gettextpath(text, 0, text.length(), x, y, path); canvas.drawpa...

WCF - library naming convention -

This summary is not available. Please click here to view the post.

javascript - How to float a modal window in jquery -

i using jquery ui create floating window. able create window. having trouble in making floating. want window should in top right corner of "body". (now can see on right @ bottom) , want make moving. when scroll page window should scroll along it. e.g. http://manos.malihu.gr/tuts/jquery-floating-menu.html here code have done far. please find code on http://jsfiddle.net/z8rw6/1/ javascript code: $(document).ready(function(){ $("#dialog").dialog(); var $parent = $('#body'); var windowheight = $(window).height(); var parentabsolutetop = $parent.offset().top; var parentabsolutebottom = parentabsolutetop + $parent.height(); var topstop = parentabsolutetop + $( ".selector" ).dialog( "option", "height" ); $('#dialog').dialog({ width: 300,height: 600 }).dialog('widget').position({ my: 'right top', at: 'right top', of: $('#body') }); $(window).scroll(functio...

asp.net - Object reference not set to an instance of an object. IE issue -

i developed website in asp.net , works fine in browsers except ie error "object reference not set instance of object". in local machine works fine, error after publish server. any ideas how solve issue? here stack trace get: server error in '/web' application. -------------------------------------------------------------------------------- object reference not set instance of object. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.nullreferenceexception: object reference not set instance of object. source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [nullreferenceexception: object reference not set instance of object.] a2apay.web.controllers.membercontroller...

c++ - How do I set timeout for TIdHTTPProxyServer (not connection timout) -

i using tidhttpproxyserver , want terminate connection when success connect target http server receive no response long time(i.g. 3 mins) find no related property or event it. , if client terminate connection before proxy server receive response http server. onexception event not fired until proxy server receive response. (that is, if proxy server still receive no response http server, not know client has terminate connection...) any appreciated. thanks! willy indy uses infinite timeouts default. asking for, need set readtimeout property of outbound connection target server. can access connection via tidhttpproxyservercontext.outboundclient property. use onhttpbeforecommand event, triggered before outboundclient connects target server, eg: #include "idtcpclient.hpp" void __fastcall tform1::idhttpproxyserver1httpbeforecommand(tidhttpproxyservercontext *acontext) { static_cast<tidtcpclient*>(acontext->outboundclient)->readtimeout = .....

javascript - Specifying routes by subdomain in Express using vhost middleware -

i'm using vhost express/connect middleware , i'm bit confused how should used. want have 1 set of routes apply hosts subdomains, , set apply hosts without subdomains. in app.js file, have var app = express.createserver(); app.use...(middlware)... app.use(express.vhost('*.host', require('./domain_routing')("yes"))); app.use(express.vhost('host', require('./domain_routing')("no"))); app.use...(middlware)... app.listen(8000); and in domain_routing.js : module.exports = function(subdomain){ var app = express.createserver(); require('./routes')(app, subdomain); return app; } and in routes.js plan run sets of routes, dependent on whether subdomain variable passed in "yes" or "no" . am on right track or not how use middleware? i'm bit confused on fact there 2 app server instances being created (as that's how examples on web seem things). should instead pass in origina...

html - Growing an element on the spot in CSS -

i have lot of spans boxes in center tag , want each box grow on spot when user hovers on it. doesn't work, because shifts other elements along , doesn't nice: .square:hover { background-color: yellow; width: 50px; // 25px height: 50px;// 25px } how can grow without shoving of neighbors aside? i wrap .square in relatively position container of same size, on hove make .square absolutely positioned .squarecontainer { position:relative; width: 25px; height: 25px; } .square:hover { position:absolute; width: 50px; height: 50px; } this way when .square removed flow doesn't affect other elements. edit setting .square absolute doesn't seem work setting both relative works fiddle http://jsfiddle.net/ur4at/10/

ios - How to determine which view controller is currently active/the one displaying a view? -

in app queueing local notifications, when fire must present modal view. trouble have numerous view controllers 1 of active , 1 needs present modal view controller. how can determine 1 in use? i setting navigation controller windows root view controller, , can push number of other view controllers, of them may presenting view controller modally. must work on ios 4 , 5. i have lot of view controllers avoid putting code in each of them each check if top one. you can @ navigation controller's topviewcontroller property find out controller @ top of stack. 1 view displayed. since may presenting modal view controller, you'll more interested in visibleviewcontroller property, give controller current view whether presented modally or pushed onto navigation stack.

javascript - Jquery Mobile. Markup and code structure of offline app -

i'm building offline application phonegap + jqm. app pages in separate files. sample of page file structure. <div data-role="page" id="page2"> <script type="text/javascript"> ... necessary javascript create page content ... </script> <div data-role="header"><h3>header</h3></div> <div data-role="content">content</div> <div data-role="footer"><h3>footer</h3></div> </div> is way write js code inline page markup? me, clear , convenient. see , can write necessary code current page. don't want write code responsible creating page content in 1 file include in header. so, ok? functionally end result same whether javascript inline on page or whether link it, can if want place javascript inline. that said it's idea separate code markup, doing helps keep things more structured , makes easier reuse cod...

shebang - What is the significance of -T or -w in #!/usr/bin/perl? -

i googled #!/usr/bin/perl , not find satisfactory answer. know it’s pretty basic thing, still, explain me significance of #!/usr/bin/perl in perl? moreover, -w or -t signify in #!/usr/bin/perl ? newbie perl, please patient. the #! commonly called " shebang " , tells computer how run script. you'll see lots of shell-scripts #!/bin/sh or #!/bin/bash . so, /usr/bin/perl perl interpreter , run , given file execute. the rest of line options perl. "-t" tainting (it means input marked "not trusted" until check it's format). "-w" turns warnings on. you can find out more running perldoc perlrun (perldoc perl's documentation reader, might installed, might in own package). for scripts write recommend starting them with: #!/usr/bin/perl use warnings; use strict; this turns on lots of warnings , checks - useful while learning (i'm still learning , i've been using perl more 10 years now).

jquery - Nivo slider enlarging images issue -

Image
while using nivo slider enlarges images 2x original size results in horrible looking pictures. wondering if way fix this. image sizes 367 x 246 px . here screen of happens: here html erb: <div class="slider-wrapper up-nivo"> <div id="slider" class="nivoslider"> <%= image_tag "logo.jpg", alt: "" %> <%= image_tag "line.jpg", alt: "" %> <%= image_tag "game.jpg", alt: "" %> <%= image_tag "leaders.jpg", alt: "" %> <%= image_tag "crowdfacingjim.jpg", alt: "" %> <%= image_tag "band.jpg", alt: "" %> </div> </div> then here css: .nivoslider { position:relative; width:100%; height:auto; overflow: hidden; } .nivoslider img { position:absolute; top:0px; left:0px; } .nivo-main-image { display: block !important; pos...

eclipse adt - Working android project stopped working after updating android tools from r19 to r20 -

i came new project have been developed quite long time. my co-workers have exact same codebase had install eclipse , adt plugin. co-workers have r19 of android tools , android platform-tools r11. i've android tools r20 , platform tools r12. now error message after running software. java.lang.runtimeexception: unable instantiate activity componentinfo{ com.project.package/com.project.package.myactivity}: java.lang.classnotfoundexception: com.project.package.myactivity in loader dalvik.system.pathclass loader so our manifest looks this: <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@style/theme.mystyle" > <activity android:name=".myactivity" android:label="@string/app_name" android:windowsoftinputmode="adjustresize" android:screenorientation="portrait" android:configchanges="locale...

visual studio 2010 - Disabling drag and drop or ask on any drag-drop operation of files/folders VS2010 -

Image
sometimes accidentally move files somewhere anywhere ? on solution explorer. is there way asking on drag & drop operations? or disabling drag&drop . if user tfs may cause other annoying problems. a scenario hard achieve succeed!) suppose don't know these moved files. on compile delete these files(mostly cause errors),if check-in after delete ,say goodbye files gone , on tfs can't add new file it's name used . you need previous version , on...

.net - Failed to add a service. Unable to connect to the remote server -

i know faq, , i've read similar q's , a's i'm still not coming right. i'm newbie @ web services , asp.net in general. have small wcf service application written colleague worked , demo'ed on pc. on pc, , no changes, can't accepted wcf test client program when adding service (error message below). colleague on leave! the project properties set start wcftestclient.exe using vs development server auto-assigned port number. project has webform.aspx , global.asax file added needed service. i have run netsh http add urlacl url=http://localhost:51568/service1.svc user=<loginname> my questions how service started wcftestclient, , webform on browser? i have looked @ various answers similar questions still stumped. failed add service. service metadata may not accessible. make sure service running , exposing metadata. error: cannot obtain metadata http://localhost:51568/service1.svc if windows (r) communication foundation service ha...

java - How can I execute a method of a class that has been uploaded? -

the goal implement web application can execute methods of .class files has been uploaded. uploaded class file available byte[] . public class in .class file implements specific interface. after upload, i'd call method (interface implementation). is there way in running java application? if yes, how? btw. i'm aware of security risks. shouldn't hard: create own classloader (not hard, see below). load class using classloader#defineclass(string, byte[], int, int) . check implements interface ( yourinterface.class.isassignablefrom(loadedclass); ). use java reflection/introspection on class<?> got on step 1. (e.g. yourinterface obj = (yourinterface)loadedclass.newinstance(); ). call method: obj.shinymethod(); re creating own classloader: here's simple 1 delegates system class loader: class myclassloader extends classloader { public myclassloader() { super(classloader.getsystemclassloader()); } // our custom public f...

C# Based Agent Development Framework -

a while ago followed course agent technology , had use jade learn concept. wondering if there , easy use framework based on c# language. if knows framework please share link. thanks in advance ^^ here paper on c# agent platform university of genova starting point finding framework. you'll need exercise google skills....

Closing inputstreams in Java -

i have following piece of code in try/catch block inputstream inputstream = conn.getinputstream(); inputstreamreader inputstreamreader = new inputstreamreader(inputstream); bufferedreader bufferedreader = new bufferedreader(inputstreamreader); my question when have close these streams in block, have close 3 streams or closing befferedreader close other streams ? by convention, wrapper streams (which wrap existing streams) close underlying stream when closed, have close bufferedreader in example. also, harmless close closed stream, closing 3 streams won't hurt.

c++ - Store numericals in TCHAR array into an INTEGER variable in VC++. (in UNICODE environment) -

i had asked question similar in thread: https://stackoverflow.com/questions/11259474/store-the-numericals-in-char-array-into-an-integer-variable-in-vc w.r.t. above thread, question follows:: working in unicode environment. tchar treated wchar. my scenario follows:(c++) in tchar a[10], array a[] has elements (numbers) '1','2','3' etc.... say a[0] = '1'; a 1 = '2'; a[2] = '3'; now a[] storing 3 characters '1', '2' , '3'. want store int 123 (an integer 123). how achieve in c++ ? thanks in advance. first, have null-terminate string. otherwise, how know stop? there's function _ttoi() that. a[3] = 0; int n = _ttoi[a]; you have understand null termination bit. depending on how fill a characters (digits), logic of determining end of string might vary.

osx - How to enable 'Use symbol and text substitution' inside Xcode -

Image
i have virtual mac running , want code bit in xcode. keyboard has characters { , [ available using alt-gr. in virtual mac, using same keyboard combinations gives me different output. alt-gr + 9 produces capital ç instead of { alt-gr + ^ produces ô instead of [ i managed solve programs using 'use symbol , text substitution' option under language & text - text in system settings. working fine in textedit, safari, ..., not in xcode. xcode seems ignore symbol , text substitution. any ideas how fix this? or maybe workaround? appreciated, because issue slowing down programming speed. xcode, text substitutions not enabled default. enable go xcode -> edit -> format -> substitutions -> text replacement (enable this) hope helps! edit: senseful mentioned better use code snippets. link explaining how use code snippets creating custom code snippets , this . hope helps!

php - Sort an array without rewriting a key -

i have array looks this: $arr = ( [0]=>int(2) [1]=>array( ....) [2]=>array( ....) [3]=>array( ....)) i have used usort sort it: usort($arr,function($a, $b) { if($a['prop'] == $b['prop']) return 0; return ($a['prop'] < $b['prop']) ? 1 : -1; }); my problem key [0] rewritten array element. don't me wrong...it's suppose to. how sort $arr array without rewrite key [0] ? just use uasort() http://php.net/manual/en/function.uasort.php

xcode4.2 - Clang 3.1 on xcode 4.2 (Snow Leopard) -

is possible install clang 3.1 on xcode 4.2 (snow leopard)? you can build , install yourself. instructions can found here . i'm not sure if (or macports solution... +1 @trojanfoe) callable xcode though. after moving " /developer " & within xcode package, i'm thinking apple trying keep xcode "walled garden" well.

Move checkboxlist from one groupbox to another groupbox for windows form using c# -

this form created using windows application under menu1 have submenus on click of submenu have display checkboxlist in groupbox on click of checkbox , click of move button list of command should displayed on other groupbox , have buttons "delete" , "clear" on click of delete button selected command should deleted list , click of clear button list command displayed should cleared groupbox , want display number selected checkboxlist in message box windows form using c# can any1 me on this.. please provide me code aslo.... regards, sweety let's have [chklist1 : first checklistbox] , [lstbox1 : destination] btnadd, btndel, btnclear private void btnadd_click(object sender, eventargs e) { foreach (var item in chklist1.selecteditems) { if (!lstbox1.items.contains(item)) lstbox1.items.add(item); } } private void btndel_click(object sender, eventargs e) { ...

How to avoid validator error for HTML script tag containing markup (in JavaScript template) -

i came across javasciprt templating system. here simple article : http://blog.reybango.com/2010/07/09/not-using-jquery-javascript-templates-youre-really-missing-out/ digging in topic, found several other javascript template engines. haven't found information how deal validation errors. the errors mean are: using markup in mentioned in article cited above, have html fragment this: <script id="clienttemplate" type="text/html"> <li><a href="clients/${id}">${name}</a></li> </script> when check validator, errors end tag element not open , etc. is there way suppress errors?

facebook - unable to get fan page to check if user has liked this page or not using fql -

i want know whether user has liked page or not , following code: function checkpagelike($fbuid,$token){ $fqlquery = "select uid page_fan page_id = ".$this->config->item('pageid')." , uid=".$fbuid; $res = "0"; try{ $ret_obj = $this->facebook->api(array('method' => 'fql.query', 'query' => $fqlquery, ),'get',array('access_token' => $token)); if(checkarray($ret_obj ) && $ret_obj [0]['uid']){ $res = "1"; } }catch(exception $e){ print_r($e); } return $res; } so using code able check if our page in liked user or not. , working. 1 of qa did thing different may didn't gave permissions first time, gave permissions, installed app. , our above code wasn't able if user has liked page or not. user removed app. again installed same problem. logged in different machi...

jquery background image fade -

i using jquery load ina background image fills page width / height. have following in head: $(document).ready(function() { $('body').css({ 'background-image' : 'url({html_base}images/backgrounds/randoms/{back_img})', 'background-repeat' : 'no-repeat', 'background-position' : 'center top', 'background-attachment': 'fixed', 'background-size': '100% 100%', }); $('#home-promo').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: 'auto' }); $('.model-search').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: '393' }); }); this works fine , can seen @ http://projects.snowshtechnologies.com/golden_dragon/home/ i want bg image fade in black backgroun...