Posts

Showing posts from January, 2012

ios - Setting the rootViewController after a modal view has been presented -

i have app re-init app if it's been in background long. when user opens app after allotted time, re-init happens, , display splash screen while data need. when data server set window.rootviewcontroller property new value. if old root view controller has had view controller presented modally, , view controller being displayed when re-init happens, dealloc doesn't called on view controller (i've tested putting nslog's in dealloc method). in case modal view controller not presented, dealloc gets called expected. does know of solution this? i'm not sure if it's apple bug, or if it's need handle on own. the solution came before set rootviewcontroller, call - (void)_dismissrootviewcontrollersmodalviewsifany { uiviewcontroller *rootviewcontroller = self.window.rootviewcontroller; if (rootviewcontroller.presentedviewcontroller || rootviewcontroller.presentingviewcontroller) { [rootviewcontroller dismissviewcontrolleranimated:no...

javascript - Java Applet is undefined -

i have jzebra applet need client side ticket printing. this applets html definition: <applet id="jzebra" name="jzebra" code="jzebra.printapplet.class" archive="../../../../../../web/org.openbravo.howtos/lib/jzebra.jar" width="10px" height="10px"> the function call in form button this: function printdocument() { var applet = document.jzebra; var frm = document.frmmain; var url = frm.elements["inpftpobdir"].value; var file ="0.txt"; var archivo = url + "/" + file; if (applet != null) { var printname = frm.elements["inpprintername"].value; var indice = frm.inpprinterselected.selectedindex; var printselected = frm.inpprinterselected.options[indice].text; alert(printname); alert(printselected); if(printselected == ""){ // printname = "zebra" //alert('default : ' + printname); ...

gis - API - List all addresses in given zip code -

does know of api out there return addresses given zip code? i'm aware of zipinfo's product, that's physical list exist on server , hoping api. have @ http://w10.melissadata.com/lookups/index.htm or google mailing lists.

qt - Make a cross-platform standalone Python desktop app when the GUI uses PyQt4, not installed on computer -

i made gui python program using pyqt4 framework on linux computer, , on macbook pro , able package program. program imports pyqt4 (obviously), along other libraries pandas. tried downloading pyqt4 on os not know going on. want able include necessary pyqt4 files in package user can run program without having download pyqt4. possible? also, i'm using py2app try package desktop app. others have suggested using macports along py2app, , tried downloading macports unable figure out. any appreciated!

java - Unique classes in generic list -

i have generic class generic list in it. want ensure generic list contains unique classes. have done far compare class names reflection (getclass()). think that's not clean solution. there better practices check? public class mygenericclass<t extends mygenericclass.myinterface> { private list<t> members = new arraylist<>(0); public void add(t t) { final boolean[] classinmembers = {false}; members.foreach(member -> { if (member.getclass().getname().equals(t.getclass().getname())) { classinmembers[0] = true; } }); if (!classinmembers[0]) { members.add(t); } } public interface myinterface { void dosomething(string text); } } public class main { public static void main(string[] args) { mygenericclass<mygenericclass.myinterface> mygenericclass = new mygenericclass<>(); mygenericclass.add(new performer1()); mygenericclass.add(new performer2()); mygenericclass.add(n...

com - How would one instantiate a class given a ProgID alone in C++? -

say have progid prog.class. in powershell, enough things $obj = new-object -com "prog.class" $obj.method(); in c++ though, need know supported interfaces cocreateinstance(clsidfromprogid(...),...,iid_someinterface,...) how away in c++ knowing progid , not interface ids? there way possible interface ids? can cocallmethodonclass(...)? powershell uses iid_idispatch obtain idispatch* . interface supports late binding, many com servers implement it. c++ not support late binding in language syntax, make more painful affair. you'll have call idispatch::getidsofnames() translate member name "method" dispid, idispatch::invoke() call it.

php - Yii2 Gridview Filter not working? -

i have tried many ways doesn't find solution. gridview: [ 'attribute' => 'lbt_book_master_id', 'value' => function($model){ return libraryborrowtransaction::getbookname($model->lbt_book_master_id); }, 'filter' => libraryborrowtransaction::getbn(), ], method: public function getbn() { $books_data = (new \yii\db\query()) ->select(["lbd_title value","lbd_id id"]) ->from('lib_book_master lbm') ->join('join','lib_book_details lbs','lbm.lbm_book_details_id = lbd_id') ->join('join', 'lib_borrow_transaction lbt', 'lbm.lbm_book_no = lbt_book_master_id') ->where('lbm.lbm_book_no = lbt.lbt_book_master_id') ->groupby('lbd_id') ->all(); $data = arrayhelper::map($books_data, 'id', 'value'); retu...

plsql - How to change the cursors dynamically in oracle? -

i want change cursor in runtime dynamically. procedure test_cur(a in varchar2, b in varchar2) cursor cur_a select x.col_a,x.col_b tab_a x, tab_b y x.col_a = y.col_a begin if (condition) rec in cur_a loop --do work end loop; else rec in cur_a loop in else section want add other code in clause of cursor. wanted know there other way this? why not create 1 cursor , put part of clause condition: cursor cur_a select x.col_a,x.col_b tab_a x, tab_b y x.col_a = y.col_a , (condition , (rest of clause)); so 1 cursor , many 'conditions' need. know oracle optimize clause ignore parts condition if false (so no costs other compilation). i used technique in complex search screens oracle. works well. i hope helps. christian

Extract URL Parameter using Excel Formula -

Image
how can extract url parameter "kw" url using excel formula? http://www.googleadservices.com/pagead/aclk?sa=l&amp;ai=cjuq7zvabvdk_crhssqf6iihyd7zv59khvjfs5labpuwu_amiababkangofihggygabz01eadyaebqqk8tgddlm9-pqoeke_qrrjdxkczneohuov47wctkvwtfgdo-tbcfznv3yz1yghvxwub_wuibggab6ylqh-qbwoob6a-g9ghaq&amp;ohost=www.google.com.ar&amp;cid=5ghbrxlb07mo7bzolkedrycn1cvrdfvvgl6nrn6sdtphjlq&amp;sig=aod64_1liexrqqfwlyhyfcfmweyn0n0n6q&amp;rct=j&amp;q=&amp;ved=0cbkq0qw&amp;adurl=http://segurosendirecto.com.ar/cotizador-de-seguros-auto?kw=san%2520cristobal%2520seguros with url in cell a1 , use: =mid(a1,find("kw=",a1)+3,9999) and if want include wk= , drop +3 formula.

javascript - triangle animation issue canvas flip rotation -

hello wanted know if can provide tips or direction on issue i'm having triangle animation. have partial animation not continuous, jitters @ end of animation. i'm looking advise how make full rotation. if can assist in how add multiple rotations amazing. thank .. <!doctype html> <html> <head> <title>triangle animation team b</title> </head> <body> <canvas id="canvas" width="900" height="600"></canvas> <script> function maketriangle(x1,y1,x2,y2,x3,y3) { var canvas = document.getelementbyid('canvas'); if (canvas.getcontext){ var ctx = canvas.getcontext('2d'); var array = ['red','green', 'black']; var color = array[math.floor(math.random() * 3)]; ctx.beginpath(); ctx.moveto(x1,y1); ctx.lineto(x2,y2); ctx.lineto(x3,y3); ctx.lineto(x1,y1); ctx.fillstyle = color; ctx.fill(); } } maketriangle(...

angularjs - How to use $location.search('term', null) in angular to hide parameters -

hi there kind of new angular. need way hide url parameters use. after of searching on internet , reading $location documentation have come across using " $location.search('term', null) " way this. there no practical example of placed in code. have place tried placing in $routeprovider block of code in controllers, neither seem work. can please me out on this. thank you

swift - iOS 8: How can I make a dial pad interface? -

i want make interface phone calls , can't find library or sample project implements dial interface, guys know useful materials creating dial interface? thanks in advance. i have created sample code without auto layout custom dial pad see if can you. https://github.com/kadasiddha/dailpad

java - My android app is doing too much work on the main thread but I can't help it -

i'm writing android whack-a-mole game. know, moles pop on ui , timer text view changed every second. used handlers of these works. told use handlers instead of java.util.timer in question . however, didn't work way wanted to. mean kind of worked timer text view's text changed irrationally. when checked logcat said i'm doing work on main thread. back then, when developing winforms programs, problem never occurs. thinking putting handlers on thread know ui thread can access ui stuff, right? here countdown class: package com.whackanandroid; import android.os.handler; import android.widget.textview; public class countdown { private handler handler; private int timeleft; private textview textview; private boolean paused; private countdownlistener listener; private runnable countdowntask = new runnable () { @override public void run() { if (!paused) { timeleft--; displaytime (...

java - Updating each second in Android -

i making app counts every second based on rate of pay, , written now, crashes on startup. am doing thread section wrong? i kind of new android, bit unclear on oncreate method in general. clarification , how relates code helpful well. the button supposed start count. think it's crashing due t.start() line, don't know how trigger event. package com.example.terik.myapplication; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem; import android.widget.textview; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview text2; text2 = (textview) findviewbyid(r.id.textview2); thread t = new thread() { @override public void run() { try { while...

python - IMDb HTML Extraction - With Beautiful Soup -

with beautiful soup4 , i'm trying text doesn't seem tagged. (i may wrong, i'm not capable html) i need extract several values imdb code of page; budget value , latest worldwide gross value particular film. length of code varies between films if there method using beautiful soup4 extract these values regardless of line number, hugely helpful. code: <div id="tn15content"> <h5>budget</h5> $165,000,000 (estimated)<br/> <br/> from source code of page: imdb box office page interstellar i need '$165,000,000' extracted can store etc. the gross code more confusing: <h5>gross</h5> $188,020,017 (usa) (<a href="/date/03-19/">19 march</a> <a href="/year/2015/">2015</a>)<br/>$187,991,439 (usa) (<a href="/date/03-15/">15 march</a> <a href="/year/2015/">2015</a>)<br/>$187,930,551 (usa) (<a href="/date/03-14/...

Google-Apps-Script Empty Pictures Copy -

i using following script, emedded in google-sheets file, copy charts images google-spreadsheet google-document. when open document there emty pictures inside (means can see margin if click on it). know there similar questions here on stackoverflow there no real solutions problem. in addition, if copy pictures google-drive empty too. note don't want create new chart per script , copying data. in opinion bad solution. function graphsreport(){ var doc = documentapp.create('auswertung ' + new date()); var charts = spreadsheetapp.getactivespreadsheet().getsheetbyname('auswertung').getcharts(); for(var = 0;i<charts.length;i++){ var chart = charts[i]; var picture = chart.getas('image/png'); picture.setname('chart' + i); //driveapp.createfile(picture); doc.getbody().appendimage(picture); } doc.saveandclose(); }

c# - StoryBoard object becomes read-only when set by a Style -

i have attached behavior has single attached property of type storyboard . want set property on every item in listview. xaml looks this: <grid> <grid.resources> <storyboard x:key="theanimation" x:shared="false"> <doubleanimation from="0.0" to="1.0" duration="0:0:0.20" storyboard.targetproperty="opacity" /> </storyboard> </grid.resources> <listview> <listview.resources> <style targettype="{x:type listviewitem}"> <setter property="local:mybehavior.animation" value="{staticresource theanimation}" /> </style> </listview.resources> </listview> </grid> so far good. code in 'mybehavior' tries this: private static void animationchanged(dependencyobject d, dependencypropertychangedeventargs e) { va...

android - onBackPressed not being called when softKeyboard is visible -

Image
i know answer has been asked multiple times there has not been legit answer solves issue. day, cannot believe google has not added listener softkeyboard. curious know if has solution listening backpress while keyboard visible? asking because within google play store when search visible , press back, hides search , keyboard @ same time. have recreated search cannot find legit answer closing custom searchview , keyboard @ same time. have tried lot of answers none of them working. i calling "adjustpan" within manifest mainactivity prevent custom views being shifted. "adjustpan" prevents root layout making room softkeyboard, rather softkeyboard above root layout. eliminates measure solutions, have been main solution of answers. android:windowsoftinputmode="adjustpan" here custom searchview it google not listening onbackpressed event - rather configuration changes involve keyboard. if want hide when keyboard changes "hidden" moni...

swing - Renderer cell in JXTreeTable in base of content of a rows in java -

i'm using jxtreetable org.jdesktop.swingx display hierarchical structure data, i've parent nodes , child nodes attached them. want have different renderer parent , child nodes. example: if jxtreetable shows parent node, first column should rendered string , others jcheckbox else if jxtreetable displays child node, every cell should rendered string. first, write in mytreetablemodel extends abstracttreetablemodel piece of code: @override public class<?> getcolumnclass(int column) { if (column == 0) return string.class; return boolean.class; } everything ok in parent node, shows empty jcheckbox in child nodes have blank cell. returning null in method getvalueat(....) doesn't fix problem. so, thought use renderer class don't know start. write pseudo-renderer this: private class customcellrender implements tablecellrenderer { @override public component gettablecellrenderercomponent(jtable table, object value, boolean is...

Hibernate Get and load method -

i have basic understanding of both methods have few concerns load() method: 1. if class final or default constructor not provided ,in case load hit database or throw error it’s not able create proxy class? 2. if object found in first or second level cache , return full object or proxy object? for method 1. if finds object in cache not hit database? as per understanding, load hits cache , get tries hit cache. if load gets object in cache returns, if not, returns proxy object given identifier set . if get , gets object cache returns, if not, goes db , returns found object, if not present returns null . incase of load , if returns proxy object, throws org.hibernate.objectnotfoundexception while saving/updating object, when identifier of object queried not present in database. so use load when sure have object against queried identifier in database, it's use should need update few attributes.

reactjs - React + Reflux - Issue with queue and timeout for components sharing the same store -

i have component so, i've refactored example not use valuelink illustrate problem. in example, have field component, rendered multiple times (3) bound same property in store. concept pretty simple, when input changes in one, reflected in others. the problem comes if type fast (bash few keys in) , events queued ends in loops each component updating based on earlier state update component. if type slowly, guess more tick timeout on queue, works fine. a similar symptom can observed using value link. it's doing same thing pretty i'd expect that. var app = react.createclass({ render: function() { return <field dataitemname="propertya" /> <field dataitemname="propertya" /> <field dataitemname="propertya" />; } }); var recordstore = reflux.createstore({ mixins: [statemixin], listenables: [formactions, recordactions], init: function () { }, getinitialstate: functi...

Android - Add click inside text that looks all the same -

i have text multilingual , so, different sizes. text occupies 3 lines , defined in 3 separate parts, now, separated. have text in same flow. problem here that, part in middle of text clickable , don't know how without separating text , 3 blocks , text looks this: lorem ipsum dummy text of printing , typesetting industry lorem ipsum dummy text (<--link) of printing , typesetting industry as text single flow make together. could me? thanks! use android:autolink="web" put string in resources this: <string name="yourstring">lorem ipsum , <a href="http://example.com">link</a></string> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:autolink="web" android:linksclickable="true" android:text="@string/yourstring" />

c# - How to preview image before upload on ASP.NET master page content placeholder -

how preview image before upload on asp.net masterpage content placeholder using asp.net controls? prefer automatically displayed after choosing image file upload control. here's code: uploadpicture.aspx <asp:content id="content1" contentplaceholderid="content" runat="server"> <div class="container"> <div class="row"> <div class="col-sm-3"> <asp:fileupload id="fileupload1" runat="server"/> <asp:image id="image" runat="server"/> <asp:textbox id="textbox1" runat="server"></asp:textbox> <asp:button id="upload" runat="server" onclick="upload_click" text="upload" /> <asp:label id="lb_msg" runat="server"></asp:label> </div> </div> </...

simple way to drop milliseconds from python datetime.datetime object -

this question has answer here: truncate python datetime 10 answers my colleague needs me drop milliseconds python timestamp objects in order comply old posix (ieee std 1003.1-1988) standard. tortured route accomplishes task me follows: datetime.datetime.strptime(datetime.datetime.today().strftime("%y-%m-%d %h:%m:%s"),"%y-%m-%d %h:%m:%s") is there simpler way end datetime.datetime object mongodb this? you can use datetime.replace() method - >>> d = datetime.datetime.today().replace(microsecond=0) >>> d datetime.datetime(2015, 7, 18, 9, 50, 20)

java - Convert String of type "2015-23-07T00:00:00Z" to XMLGregorianCalender of format "07/23/2015T00:00:00Z" -

i calling web service accepts date xmlgregoriancalendar of format "07/23/2015t00:00:00z" have database "2015-23-07t00:00:00z" . how convert string type of xmlgregoriancalender of type "mm/dd/yyyy't'hh:mm:ss.sss'z'" since service hosted third party can't change schema , need implement conversion. i tried this date d = new date(); simpledateformat sdf1 = new simpledateformat("yyyy/mm/dd't'hh:mm:ss.sss'z'"); string formatteddate1 = sdf1.format(d); date date = sdf1.parse(formatteddate1); gregoriancalendar gregoriancalendar; xmlgregoriancalendar result = null; gregoriancalendar = (gregoriancalendar)gregoriancalendar.getinstance(); gregoriancalendar.settime(date); result = datatypefactory.newinstance().newxmlgregoriancalendar(gregoriancalendar); ...

java - netbeans warning: "Utility class without constructor" -

i have convenience, utility class displaying error messages in swing app: public class errormessage { public static void error(component parent, string message){ joptionpane.showmessagedialog(parent, message, "error", joptionpane.error_message); } } however, netbeans (not compiler) gives warning: utility class without constructor i know can turn off warning, i'm wondering: point of warning? alt+enter shows me netbeans wants me create private constructor: private errormessage() { } why? as asking question, answer became obvious: so no 1 accidentally creates instance of errormessage class. because constructor private, cannot instantiated. great hint, realize it's for.

spring - "Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /myService -

i'm trying hit service. able see response in http log. see success message in soapui log. in soap response see http 404 error. in http log.. @ end.. showing thu jul 30 15:00:01 ist 2015:debug:<< "connection: close[\r][\n]" thu jul 30 15:00:01 ist 2015:debug:<< "date: thu, 30 jul 2015 09:30:00 gmt[\r][\n]" thu jul 30 15:00:01 ist 2015:debug:<< "server: websphere application server/8.0[\r][\n]" thu jul 30 15:00:01 ist 2015:debug:<< "[\r][\n]" thu jul 30 15:00:01 ist 2015:debug:<< "error 404: com.ibm.ws.webcontainer.servlet.exception.notargetforuriexception: no target servlet configured uri: /myservice i'm trying use service response. need response, run code. please in showing response on soap response column instead of http log. it seems application myservice not deployed on application server. name of application? myservice or myservice?

python - DRF serializer skips nested serializer validation when many=True -

i have serializer refers serializer many=true. simplified version: class serializera(serializers.serializer): id = serializers.charfield() quantity = serializers.integerfield() class serializerb(serializers.serializer): name = serializers.charfield() items = serializera(many=true, required=true) when i'm getting data without items field specified, serializer.is_valid() reason returns true. if 'many' argument set false, validation works expected. why happening? i assume you're trying perform put or post. in case, drf not support nested relations out of box , if don't have in field items - validator returns true. should return error if have in items . to make post/put work need override .create() , .update() method of serializerb.

PHP Mysql select is only showing one row -

i trying make page of tv series. somehow page shows 1 row seasons , 5 in database. $sql = "select * `shows` url='".dburl($_get["url"])."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { // general info tv show here $sql = "select * seasons `show`='".$row["id"]."' order number asc"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($seasons = $result->fetch_assoc()) { // seasons $sql= "select * episodes `show`='".$row["id"]."' , `season`='".$seasons["number"]."' order number desc"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($episodes = $result->fetch_assoc()) { // e...

jsf 2 - Modify the value of p:menuitem - primefaces -

i think it's small problem. modify attibute value of p:menubutton want take value user bean (after inscription in application), such take name of user (getname). i did : <p:menubutton value="#{user.getname}"> <p:menuitem value="my profile" action="#{toolbarview.edit}" update="" icon="ui-icon-disk" /> <p:menuitem value="log out" actionlistener="#{toolbarview.close}" update="" icon="ui-icon-arrowrefresh-1-w" /> </p:menubutton> but had issue in interface graphic (when enter localhost): type exception report message description server encountered internal error () prevented fulfilling request. exception javax.servlet.servletexception: /profile.xhtml @55,53 value="#{user.getname}": property 'getname' not found on type com.live.beans.user javax.faces.webapp.facesservlet.service(facesservlet.java:606) root cause ja...

How do i draw a Cube in OpenGL/C++? -

i see lot of people using glbegin(gl_polygon) draw cubes whats about, learnt in class whats diffrence way teacher thought me worse. glfloat verts[] = { -1.0f, +1.0f, +1.0f, // 0 +1.0f, +0.0f, +0.0f, // color +1.0f, +1.0f, +1.0f, // 1 +0.0f, +1.0f, +0.0f, // color +1.0f, +1.0f, -1.0f, // 2 +0.0f, +0.0f, +1.0f, // color -1.0f, +1.0f, -1.0f, // 3 +1.0f, +1.0f, +1.0f, // color -1.0f, +1.0f, -1.0f, // 4 +1.0f, +0.0f, +1.0f, // color +1.0f, +1.0f, -1.0f, // 5 +0.0f, +0.5f, +0.2f, // color +1.0f, -1.0f, -1.0f, // 6 +0.8f, +0.6f, +0.4f, // color -1.0f, -1.0f, -1.0f, // 7 +0.3f, +1.0f, +0.5f, // color +1.0f, +1.0f, -1.0f, // 8 +0.2f, +0.5f, +0.2f, // color +1.0f, +1.0f, +1.0f, // 9 +0.9f, +0.3f, +0.7f, // color +1.0f, -1.0f, +1.0f, // 10 +0.3f, +0.7f, +0.5f, // color +1.0f, -1.0f, -1.0f, // 11 +0.5f, +0.7f, +0.5f, // color -1.0f, +1.0f, +1.0f, // 12 +0.7f, +0.8f, +0.2f, // color ...

python - Modifying a list with existing references to elements? -

(if want skip 2 a.m. python science , cut chase, question summed @ end) consider following: 1: animals = ['cat', 'cow', 'donkey', 'horse'] # start list 2: animals_reference = animals # make reference , assign animals 3: cat = animals[0] # refer cat first element of animals 4: assert cat animals[0] # no copy occurred, still same object 5: animals[0] = animals[0].capitalize() # change first element of list 6: assert cat not animals[0] # animals[0] refers object 7: assert animals_reference animals # animals still points same object before my understanding underlying structure of python list c array (with lots of dynamic stuff going on, still, @ end of day, c array.) what's confusing me this: set cat refer first element of list (3). in c, that'd referring address of first element of array. we modify first element of list (5). but after doing that, cat no longer refers object (6). however, list reference hasn't changed ...

Lua execution in Redis - Atomicity & Scale? -

i have keys in redis <k,v> v comma separated string of sub strings v: <v1,v2,v3,...,vn> . until setting keys using transaction in jedis (redis api in java). new requirement needs me perform operations on existing keys. have 2 options: retrieve keys, perform operations, set keys code operations in lua , pass file along keys arguments. option 2 seems faster save round trip have following considerations: what if lua execution fails in between @ redis, after n keys. (may issue script or redis). redis ensure consistency? in option 1, abort writing , prevent inconsistent state. lua script understand takes keys arguments. need operate on 10 million keys. lua fine such huge argument list? my solution since said answer below none of them feasible choice. wrote own redis command in c , compiled source. call redis-cli> mycommand k v for each <k,v> in pipeline. followed tutorial here - hacking redis . might not adequate , require 1 browse , understa...

PHP changing form button to link with the method of the form being post -

print('<form method="post"><button title="logout" name="logout">logout</button></form>'); is there way can replace button text , still post me , log me out update: ok guys want link instead of being button hyper link exact same action here more code see im working (there's more code im showing stuff) if(isset($_get['login'])) { $user->signin(); } if (array_key_exists( 'logout', $_post )) { setcookie('steamid', '', -1, '/'); header('location: /'); } if(!$_cookie['steamid']) { print ('<form action="?login" method="post"> <a href="?login"> sign in through steam</a> </form>'); } else { print('<form method="post"><button title="logout" name="logout">logout</button></form>'); echo $user->getpl...

java - Creating 1x1 transparent gif in a Servlet -

following issue gets me lack of understanding. want create 1x1 transparent gif provided servlet: public void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("image/gif"); byte[] trackinggif = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x1, 0x0, 0x1, 0x0, (byte) 0x80, 0x0, 0x0, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x0, 0x0, 0x0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x2, 0x2, 0x44, 0x1, 0x0, 0x3b }; bufferedimage singlepixelimage = new bufferedimage(1, 1, bufferedimage.type_4byte_abgr); color transparent = new color(0, 0, 0, 0); singlepixelimage.setrgb(0, 0, transparent.getrgb()); response.setcontenttype("image/gif"); response.getoutputstream().write(trackinggif); } if call servlet firefox, servlet called twice , firebug tells me "the url not loaded" , shows broken image. chrome example not call twice....

How to start IIS application pools which are stopped only for websites which has "Started" status using Powershell? -

does can point me direction how can start iis (7/8) application pools stopped websites has "started" status using powershell (so no starting app pool connected application/websites has stopped state)? scenario1: stopped app pool started website start app pool scenario2: stopped app pool stopped website do nothing thanks i don't understand downvotes too. however, can try this: import-module webadministration gci iis:\sites | state -eq 'started' | select -expandproperty applicationpool | % { start-webapppool $_ } it seems don't have check whether applicationpool started, can adopt script , check status using get-webapppoolstate cmdlet if think necessary.

vbscript - Search for newer/higher version of Folder through VBS -

i want write script search newer version of folder. however, have no idea how start it. have 3 folders in directory. 15.0.4727.1002, 15.0.4701.1002, 15.0.4675 i search folder has newer or higher version. in case it's 15.0.4727.1002 as need 1 element (folder) collection (subfolders), sorting overkill. need convert folder name (correctly) sortable. subtask addressed in answers linked to. the conversion can done formatting (padding) parts of folder names: option explicit dim ofs : set ofs = createobject("scripting.filesystemobject") dim osb : set osb = createobject("system.text.stringbuilder") dim slst : slst = "" ' smallest possible value dim olst : set olst = nothing dim odir each odir in ofs.getfolder("..\f").subfolders dim aparts : aparts = split(odir.name, ".") redim preserve aparts(3) osb.appendformat_4 "{0,6}{1,6}{2,6}{3,6}", (aparts) dim skey : skey = os...

unlimited zero as output while running c++ in cpp driod -

for (short = 1; < 5; i++) (j = 0; j > 0; j--) cout << << "\t"; anybody please answer above code.. getting continuous 0 why please explain first off, need declare variable j somewhere. assuming have declared j somewhere else in program, program have written here print nothing out. since j set start @ 0, , 0 not greater 0, cout<<i<<"\t"; line never run. if provide more of code may able answer question better. try setting j start @ 1 if want print out i.

c# - Reading assembly version information and custom attributes in CoreCLR -

i wonder how read assembly version information in new coreclr either name of assembly code executing or explicitly giviging name of assembly or preferably type in assembly (can statically referenced)? i have code following (currently care assembly version) using system; using system.diagnostics; using system.io; using system.reflection; using system.runtime.interopservices; public class assemblyinfo { private readonly assembly assembly; public assemblyinfo(type type) { assembly = assembly.getassembly(type); } public string title { { return customattributes<assemblytitleattribute>().title; } } public version assemblyversion { { return assembly.getname().version; } } public string fileversion { { return fileversioninfo.getversioninfo(assembly.location).fileversion; } } private t customattributes<t>() t: attribute { var customattributes = assembly.getcustomattribu...

Https page doing Http request using CORS -

reading cors spec states [abridged] : ... user agents allowed terminate algorithm , not make request. done because e.g.: ... https http not allowed. ... this appears behavior in chrome, have not found reference behavior on various browser vendors documentation. for performance reasons wish make http request https page content. request different domain entirely correct cors headers http requests (which work ok http->http). are there headers can set allow https -> http? seems sensible disallow mixed-mode on single domain / sub-domains, cross-domain seems on protective, if other domain allows http normally. i'm imagining ' preflight check' or 'simple request' allowed if didn't have hsts headers or alike.

algorithm - Cormen quick sort modify partition function -

i learning quick sort introduction algorithms.i got stuck on question 7.1-2. of chapter 7 quicksort- "what value of q partition return when elements in array a[p…r] have same value? modify partition q=⌊(p+r)/2⌋ when > elements in array a[p…r] have same value." the first part easy , answer r.but can't figure out second part asking.i mean reason setting pivot (p+r)/2.further can't understand solutions found on searching on google. please me in understanding advantage of modification in case elements equal , if possible please provide algorithm so. by setting pivot middle of p , r, divide array of size n 2 sub-problems of equal size n/2. if draw recursion tree following recurrence, see height o(lgn) t(n) = 2t(n/2)+o(n) imagine if position of pivot returned partition last element in array. recurrence run time t(n) = t(n-1)+o(n) do see why inefficient if recursion tree linked list? try drawing tree , adding costs @ each node in both cases. ...

Rake tasks for scaling ruby apps in Heroku (non-rails)? -

i'm running ruby app with: heroku scale web=0 heroku scale worker=1 i'd write rake task run: heroku scale worker=0 i'm thinking of akin to: task :scale_down => :environment heroku = heroku::api.new heroku.post_ps_scale('worker', 0) end but 1 problem app doesn't have environment since it's not rails app. there simple rake task can use scale worker 0? thanks! task :scale_down heroku = heroku::api.new(api_key: env['heroku_api_key']) heroku.post_ps_scale(env['app_name'], 'worker', 0) end this scales app down 0. may want assign number config var..

How to get total count in couchbase Views -

when query view in couchbase using user_id(key), limit(10) , skip(0) parameter, response has following structure: { "total_rows":1896, "rows":[...] } here view return list of reports based on user_id:- function map(doc, meta) { if (doc.type == 'report' && doc.subscribed) { (var subscriber in doc.subscribed) { emit(subscriber, doc); } } } here sample report doc:- { "agree_allowed":true, "assigned_by":"", "assigned_to":"", "closed":[ ], "comments_allowed":true, "details":"test", "email":"", "status":"in progress", "subscribed":{ "user_cfd29b81f0263a380507":true, "user_cfd29b81f0263a380508":true, "user_cfd29b81f0263a380509":true, "user_cfd29b81f0263a3805010":true }, ...

selenium - IgnoreExceptionTypes does not work (C# Webdriver) -

i have found in c# whether using webdriverwait class or defaultwait class , in either case ignoreexceptiontypes method appears not work. i.e. in either case when running against page staleelementreferenceexception thrown despite fact instructing code ignore these exceptions. webdriverwait example : public void waitelementtobeclickable(iwebelement element) { var wait = new webdriverwait(driver, timespan.fromseconds(60)); wait.ignoreexceptiontypes(typeof(nosuchelementexception), typeof(staleelementreferenceexception)); wait.until(expectedconditions.elementtobeclickable(element)); } defaultwait example : public iwebelement safewaitfordisplayed(iwebelement webelement) { var w = new defaultwait<iwebelement>(webelement); w.timeout = timespan.fromseconds(30); w.ignoreexceptiontypes(typeof(nosuchelementexception), typeof(staleelementreferenceexception)); return w.until(ctx => { ...

make a API in PHP which accept Request / response Zipped, gziped, deflate -

i working on api development using php, need function request encoding , set reponse based on encoding "zipped", "gziped", "deflate" etc, , output should in json. i trying use below code, when run causing error "this webpage not available\n err_content_decoding_failed" so, please suggest 1 how can implement such thing. function converttoheaderencoding($input, $encoding, $debug = 0) { $compressed_out = ""; if($encoding == "gzip") { $compressed_out = gzencode($input); if($debug == 1) echo 'gzipd output'."\n".'before compression size '.strlen($output).' bytes'."\n".' after compression size '.strlen($compressed_out).' bytes'; header("content-encoding: gzip"); return $compressed_out; } else return $input; } $arr = array("key1"=>"...

ios - Swift: play the audio recorded -

i tried record , find answer here: recording audio in swift i make work. know how play recorded audio. recording have general var audiorecorder, , defined url path. tried audiorecorder.play() not work. i suppose problem comes form fact global var audiorecorder instance of avaudiorecorder , play should instance of avaudioplayer?, how 2 things related? i not want copy paste peace of code understand. why simplify code here. please explain why not work in specific code , how solve it. (i have done lot of tutorials related. problem there code lost. question here understand how specific part works) import avfoundation var audiorecorder:avaudiorecorder! @ibaction func record(sender: anyobject) { var audiosession:avaudiosession = avaudiosession.sharedinstance() audiosession.setcategory(avaudiosessioncategoryplayandrecord, error: nil) audiosession.setactive(true, error: nil) var documents: anyobject = nssearchpathfordirectoriesindomains( nssearchpathdirect...

nexus - Creating a Maven Project Programmatically Runtime -

i have created number of java classes using sun code model library. now, create maven project add classes , upload nexus sonatype internal maven repository. know how create maven project programmatically. appreciated. it not programmatically, maven archetype can generate project squeleton you: mvn archetype:generate -dgroupid={project-packaging} -dartifactid={project-name} -darchetypeartifactid=maven-archetype-quickstart you can run : mvn archetype:generate and choose archetype list displayed. once done, can put java file in src/main/java. https://maven.apache.org/guides/introduction/introduction-to-archetypes.html

How to compare 2 txt files in Python -

i have written program compare file new1.txt new2.txt , lines there in new1.txt , not in new2.txt has written difference.txt file . can please have , let me know changes required in below given code. code prints same value multiple times. file1 = open("new1.txt",'r') file2 = open("new2.txt",'r') newfile = open("difference.txt",'w') line1 in file1: line2 in file2: if line2 != line1: newfile.write(line1) file1.close() file2.close() newfile.close() here's example using with statement, supposing files not big fit in memory # open 'new1.txt' f1, 'new2.txt' f2 , 'diff.txt' outf open('new1.txt') f1, open('new2.txt') f2, open('diff.txt', 'w') outf: # read lines 'new2.txt' , store them python set lines = set(f2.readlines()) # loop through each line in 'new1.txt' line ...

javascript - How to set transform-origin using VelocityJS -

how can set transform-origin of tranform animation using velocityjs? you can animate transformoriginx / transformoriginy / transformoriginz in .velocity() calls. if it's reset initial value can use same start , end values.

ios - Getting Black Bars in iphone 6 Flash Movie? -

i'm working on flash cs6, adobe air18 , having resolution problem displaying flash video. code: stage.scalemode = stagescalemode.exact_fit; stage.align = stagealign.top_left; on ipads videos display full screen, on iphone 6 , 6+ i'm getting black bars left , right. i imagine might because not including necessary iphone 6 , 6+ default images. if these not included in package app revert displaying 4:3 ratio stage. ios thing. take here correct naming formats , sizes default images. http://blog.tomasmahrik.com/list-of-properties-sizes-for-application-icons-launch-images-screenshots-video-previews-for-ios-air-apps/

polymer - Polymer1.0: Single/multiple IronAjax? -

i wondering if wise use single ironajax whole app? otherwise run situation every view require ironajax. mean not hurting me creating multiple ironajax, naming them, , naming success , error messages need unique. otherwise can conflict on other ironajax method defined within tree. ran situation before. so not looking "what possible", looking best practices. a single iron ajax indeed more efficient, long code in error , response handlers not need different based on url retrieved. question philosophical argument , not have definitive answer since both ways possible , direction depends on comfort level of supporting application.

c# - async within a LINQ code - Clarification? -

almost every so's answer regarding topic , states : linq doesn't work async also : i recommend not think of "using async within linq" but in stephen's book there sample : problem: have collection of tasks await, , want processing on each task after completes. however, want processing each 1 as as completes, not waiting of other tasks. one of recommended solutions : static async task<int> delayandreturnasync(int val) { await task.delay(timespan.fromseconds(val)); return val; } // method prints "1", "2", , "3". static async task processtasksasync() { // create sequence of tasks. task<int> taska = delayandreturnasync(2); task<int> taskb = delayandreturnasync(3); task<int> taskc = delayandreturnasync(1); var tasks = new[] { taska, taskb, taskc }; var processingtasks = tasks.select(async t => { var result = await t; trace.writeline(result); }).toar...