Posts

Showing posts from March, 2012

android - Changing List View Selected Row Color -

hey guys struggling past 4 days problem , no full solution given done issue , want share code you. are looking this? linearlayout newrow = new linearlayout(getbasecontext()); newrow.setorientation(linearlayout.horizontal); if(i % 2 != 0) { newrow.setbackgroundcolor(res.getcolor(/* color here: e.g., r.color.rowcols*/)); } using in loop i incrementer, can change every other row add different color. used linearlayouts , added things them (then added linearlayouts scrollable parent linearlayout), similar approach should accomplishable listviews.

How to rotate an image using Touch in HTML -

is know how rotate image using touch in html, css or javascript. have attached image easy understanding. please me.would appreciate suggestions. http://i.stack.imgur.com/ye7wp.png css3: -ms-transform:rotate(30deg); /* ie 9 */ -moz-transform:rotate(30deg); /* firefox */ -webkit-transform:rotate(30deg); /* safari , chrome */ -o-transform:rotate(30deg); /* opera */ you can take w3school, , care because rotation not supported browser. http://www.w3schools.com/css3/css3_2dtransforms.asp edit: that image linked not being rotated, change image position: take tutorial, http://kyleschaeffer.com/best-practices/pure-css-image-hover/

python - Select an array from a multidimensional array -

in following array, want select sub-array array a when id known a=[['id123','ddf',1],['id456','ddf',1],['id789','ddf',1]] i know id i.e, id456, based on how can select values ['id456','ddf',1] a without using loop. >>> = [['id123','ddf',1],['id456','ddf',1],['id789','ddf',1]] >>> next(x x in if x[0] == 'id456') ['id456', 'ddf', 1] i however, recommend use of dictionary instead.

javascript - convert string to Date object and compare in js -

how can compare 2 dates format var currdate = new date().format("mm/dd/yyyy"); if (date.parse("05-jun-2012")>date.parse(currdate)) { alert("please enter future date!"); return false; } please validate date. function customparse(str) { var months = ['jan','feb','mar','apr','may','jun', 'jul','aug','sep','oct','nov','dec'], n = months.length, re = /(\d{2})-([a-z]{3})-(\d{4})/i, matches; while(n--) { months[months[n]]=n; } // map month names index :) matches = str.match(re); // extract date parts string return new date(matches[3], months[matches[2]], matches[1]); } customparse("18-aug-2010"); // "wed aug 18 2010 00:00:00" customparse("19-aug-2010") > customparse("18-aug-2010");

android - Phonegap Video plugin? -

when creating video plugin following link phonegap video plugin working & executing fine. here particular video saving our internal storage & playing. want need play video directly without saving internal or external storage. tried, getting error in simulator sorry,this video cannot played . don't know doing mistake. can please me this. waiting reply & in advance.... code: //in button onclick="show()" method passing particular url.... function show() { window.plugins.videoplayer.play("file:///android_asset/www/bigbuckbunny.mp4"); } okay videoplayer can play videos 3 different types: 1) sd card file:///sdcard/bigbuckbunny.mp4 which play directly sd card. sd card on android open privileges application able access file. 2) assets file:///android_asset/www/bigbuckbunny.mp4 the app can access assets own. in order videoplayer app, start via intent, access video copy temporary location on sd card. 3) http ...

java - Play! framework 2.0: How to display multiple image? -

i need display gallery of photos. here template: @(photos: list[photo]) @title = { <bold>gallery</bold> } @main(title,"photo"){ <ul class="thumbnails"> @for(photo <- photos) { <li class="span3"> <a href="#" class="thumbnail"> <img src="@photo.path" alt=""> </a> </li> } </ul> } and here controller method: public static result getphotos() { return ok(views.html.photo.gallery.render(photo.get())); } and here photo bean : @entity public class photo extends model { @id public long id; @required public string label; public string path; public photo(string path, string label) { this.path = path; this.label = label; } private static finder<long, photo> find = new finder<long, photo>( long.class, photo.class); public static list<phot...

C# - saving user selected outlook folder -

i have basic c# form user select folder outlook (using microsoft.office.interop.outlook.application.session.pickfolder() ) i want folder saved every time user opens form, last select folder restored. how can achieved? thanks when user picks folder via pickfolder() , store folder.entryid , folder.storeid of selected folder. can use session.getfolderfromid() retrieve selected folder. see this msdn example reference . outlook.folder folder = application.session.pickfolder() outlook.folder; outlook.folder folderfromid = application.session.getfolderfromid(folder.entryid, folder.storeid) outlook.folder;

jquery and asp.net scriptlet usage issue -

function submitvalues(url, params) { var form = [ '<form method="post" action="', url, '">' ]; form.push('<input type="hidden" name="', key, '" value="', params[key], '"/>'); form.push('</form>'); jquery(form.join('')).appendto('body')[0].submit(); } if write line like form.push('<input type="hidden" name="mydata" value="', <% =system.web.configuration.webconfigurationmanager.appsettings["websiteurl"] %>, '"/>'); then getting error....not being able handle this. need suggestion rectify code. thanks

php - Sort Multidimensional Array Alphabetically not Working? -

so have array called $links array( [0] = array( 'type' => 'thread' 'url' => 'blah blah blah' ), [1] = array( 'type' => 'media' 'url' => 'blah blah blah' ), [2] = array( 'type' => 'website' 'url' => 'blah blah blah' ) ); what trying sort array alphabetically using "type". using usort() usort($links, create_function('$b, $a', 'return $a["type"] - $b["type"];')); the problem is, not sorting array... reverse array. after running through, website > media > thread. if process second time, reverses thread > media > website. the final result should media > thread > website. missing something? why not sorting correctly? try this, instead: usort($links, create_function('$a, $b', 'return strcmp($a["type"]...

neural network - What is the appropriate Machine Learning Algorithm for this scenario? -

i working on machine learning problem looks this: input variables categorical b c d continuous e output variables discrete(integers) v x y continuous z the major issue facing output variables not totally independent of each other , there no relation can established between them. is, there dependence not due causality (one value being high doesn't imply other high chances of other being higher improve) an example be: v - number of ad impressions x - number of ad clicks y - number of conversions z - revenue now, ad clicked, has first appear on search, click dependent on impression. again, ad converted, has first clicked, again conversion dependent on click. so running 4 instances of problem predicting each of output variables doesn't make sense me. infact there should way predict 4 taking care of implicit dependencies. but can see, there won't direct relation, infact there probability involved can't w...

Any difference between those two in Javascript? -

using this var class1 = function() { this.test1 = function() { }; }; and following function class1() { }; class1.prototype.test1 = function() { }; is there difference between two? the first 1 makes separate copy of function each class instance. allows function use closure'd variables constructor.

javascript - How do I stop a bouncy JQuery animation? -

in webapp i'm working on, want create slider div s move , down mouseover & mouseout (respectively.) have implemented jquery's hover() function, using animate() , reducing/increasing it's top css value needed. works well, actually. the problem tends stuck. if move mouse on (especially near bottom), , remove it, slide & down continuously , won't stop until it's completed 3-5 cycles. me, seems issue might have 1 animation starting before done (e.g. 2 trying run, slide , forth.) okay, code. here's basic jquery i'm using: $('.slider').hover( /* mouseover */ function(){ $(this).animate({ top : '-=120' }, 300); }, /* mouseout*/ function(){ $(this).animate({ top : '+=120' }, 300); } ); i've recreated behavior in jsfiddle . any ideas on what's going on? :) ==edit== updated jsfiddle it isn't perfect, adding .stop(true...

java - What is the elegant way to handle interruptions on IO? -

i looking @ implementation of ioutils.copy() apache commons @ http://www.docjar.com/html/api/org/apache/commons/io/ioutils.java.html , boils down to: public static long copylarge(inputstream input, outputstream output) throws ioexception { // default_buffer_size 4096 byte[] buffer = new byte[default_buffer_size]; long count = 0; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } return count; } i running in executor , task has timeout etc. if understand correctly if times out , future cancelled, thread keeps on running because there no check thread status anywhere in loop. leads dangerous leak , starvation. seems need rewrite loop, sane , correct way handle this? throw new ioexception(new interruptedexception()) ? declare method throwing interruptedexception , throw (hate io helper methods)? edit : checked bytestreams guava , seem doing same thing. i'm wondering why 2 maj...

jQuery animate border -

hi trying animate border of input no matter how put border doesn't seem animate. my current code: $(this).animate({border : '1px solid #f00'}, 'slow', 'linear'); you have set border color , style css properties in full jquery : $(this).css({bordercolor:"#f00",borderstyle:"solid"}).animate({borderwidth : '3px'}, 'slow', 'linear'); you need plug-in animate border color in jquery, check : http://www.bitstorm.org/jquery/color-animation/ then.. $(this).animate({bordercolor: '#f00'}); maybe that's someone...

sql - Access 2007 Left Join doesn't work -

i have 2 tables. table 1 tbl_daysweeksmonths has 1 row each date , it's corresponding week ending date , calendar month. table 2 tbl_callstats shows 1 record per agent per day corresponding call counts , stats etc. not consultants have records every day of week. to left table 1 (tbl_daysweeksmonths) columns date, week ending, month. right table 2 (tbl_callstats) columns row_date, agent, logid, total calls, talk time. i want link tbl_callstats tbl_daysweeksmonths date record displayed each agent (based on tbl_daysweeksmonths) if didn't take calls on particular day. i've tried left join still displays records days calls taken. feel i'm missing simple here. please help. select date,[week ending],tbl_callstats.agent tbl_daysweeksmonths left join tbl_callstats on tbl_daysweeksmonths.date = tbl_callstats.row_date group date, week, agent this query gets days , should show agent call in tbl_callstats. takes in consideration there row in tbl_callstats each d...

c# - How to split string preserving spaces and any number of \n characters -

Image
i want split string , create collection, following rules: string should splitted words. 1) if string contains '\n' should considered seperate '\n' word. 2) if string contains more 1 '\n' should considered more on '\n' words. 3) no space should removed string. exception is, if space comes between 2 \n can ignored. ps: tried lot string split, first split-ted \n characters , created collection, downside is, if have 2 \n consecutively, i'm unable create 2 dummy words collection. appreciated. is there anyway using regex? split regex this: (?<=[\s\n])(?=\s) something like: var substrings = regex.split(input, @"(?<=[\s\n])(?=\s)"); this not remove spaces @ all, not required should fine. if want spaces between \n s removed, split like: (?<=[\s\n])(?=\s)(?:[ \t]+(?=\n))?

c# - Copy File in local Network -

this web application have 2 pc's: a: 192.168.1.200 , b: 192.168.1.201, want copy b, code working single pc, it's not working in network. protected void button1_click(object sender, eventargs e) { string sourcepath = @"d:\source\"; string[] filepaths = directory.getfiles(sourcepath, "*.txt"); foreach (string in filepaths) { copyfiles(a, a.replace("d:\\source\\", "d:\\source1\\new\\")); //copyfiles(a, a.replace("d:\\source\\", "192.168.1.201\\source1\\new\\")); } } private bool copyfiles(string source, string destn) { try { if (file.exists(source) == true) { file.copy(source, destn); return true; } else { response.write("source path . not exist"); return false; } } catch (filenotfoundexception exfile) { response.write("file n...

python - uWSGI [+ nginx] file descriptor error (no such file or directory) -

i'm trying configure uwsgi django project. unfortunately when run uwsgi executable fails weird error: $ bin/uwsgi -s sock/uwsgi.sock --chdir testit --vacuum \ --env django_settings_module=testit.testit.settings --wsgi-file testit/wsgi.py --master *** starting uwsgi 1.2.3 (32bit) on [mon jun 4 17:14:52 2012] *** compiled version: 4.7.0 20120414 (prerelease) on 04 june 2012 16:20:49 detected number of cpu cores: 2 current working directory: /home/miki/sites/testit detected binary path: /home/miki/sites/testit/bin/uwsgi memory page size 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes bind(): no such file or directory [socket.c line 107] i haven't foggiest idea of do... tried ulimit , didn't work. it seems chdir command executed before else, can't find files if use relative paths. try using full path in arguments: bin/uwsgi -s $pwd/sock/uwsgi.sock --chdir testit --vacuum \ --env django_settings_module=testit.tes...

android add map with transparent buttons on top programmatically -

i want add @ run time map , transparent(as in map visible underneath) buttons controll type of map shows(normal/satellite/traffic). i can xml like <relativelayout ...> <map> <button .../> <button .../> </relativelayout> however since want select api key based on debug/release can't map go "under" buttons, here try this.mapview = new mymapview(this, map_key); this.mapview.setclickable(true); relativelayout.layoutparams p = new relativelayout.layoutparams(relativelayout.layoutparams.fill_parent, relativelayout.layoutparams.match_parent); //p.addrule(relativelayout.below, r.id.tipo_mappa); p.addrule(relativelayout.center_in_parent); this.mapview.setlayoutparams( p ); layout.addview(this.mapview, 0); the result see map in fullscreen, buttons hidden/underneath maybe. this layout.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:and...

versioning - versions-maven-plugin doesn't retrieve the latest version on nexus? -

i trying use (partly successfully) versions-maven-plugin retrieve latest release/snapshot versions local and nexus repositories update maven projects. when running plugin update versions, have noticed following behaviour: even though know there newer version in nexus, not in local repository, doesn't find latest version, latest local repo. if delete maven-metadata*.xml files local repo artifact want update, downloads latest maven-metadata*.xml files , correctly finds latest version. i see it's using 2.0.6 og maven apis, , method drives whole update mechanism retrieveavailableversions() interface artifactmetadatasource , implemented mavenmetadatasource . my question how can alter code of plugin download latest maven-metadata*.xml files such latest versions? or if there other reliable method can make happen.. thanks time. i have found solution myself , created goal run before running goals updates pom.xml files: method updates metadata repositories. if...

maven - Problems with release:perform. Checksum validation failed -

i´m trying run release plugin in application, release:prepare being done correctly when try run de release:perform. i´ll give sections of error: [info] uploaded: http://172.18.102.23:8080/artifactory/libs-release-local/br/fucapi/ads/ads/0.0.9/ads-0.0.9.pom (3 kb @ 5.5 kb/sec) [info] downloading: http://172.18.102.23:8080/artifactory/libs-release-local/br/fucapi/ads/ads/maven-metadata.xml [info] [warning] checksum validation failed, expected gif89a????!?,d; 2daeaa8b5f19f0bc209d976c02bd6acb51b00b0a http://172.18.102.23:8080/artifactory/libs-release-local/br/fucapi/ads/ads/maven-metadata.xml [info] [warning] checksum validation failed, expected gif89a????!?,d; 2daeaa8b5f19f0bc209d976c02bd6acb51b00b0a http://172.18.102.23:8080/artifactory/libs-release-local/br/fucapi/ads/ads/maven-metadata.xml [info] downloaded: http://172.18.102.23:8080/artifactory/libs-release-local/br/fucapi/ads/ads/maven-metadata.xml (43 b @ 1.3 kb/sec) [info] [info] build failure [info] [info] -----------------...

bash - Cant run shell script in PHP -

when trying run shell script exec , shell_exe nothing happens! when run command ls or whoami work's. what be? do echo output? echo exec('ls'); do have safe_mode enabled? phpinfo(); when yes: (from manual) note: when safe mode enabled, can execute files within safe_mode_exec_dir. practical reasons, not allowed have .. components in path executable. try call exec exec('...pathtoyourbashscript...', $out, $return); then echo $return; if shows 127 it´s path wrong. also check permissions. user 'nobody' apache user, needs rights access , execute script. you can change permissions running chmod 755 pathtouyourscript this means 'i don't mind if other people read or run file, should able modify it'.

What is the best way to handle time zones with Javascript -

i have authenticated user given time zone, e.g. "berlin, gmt+1". sake of question let's have in global scope: var timezone = "berlin"; var gmtdistance = 1; what best solution have date-related js behave accordingly, meaning if create new date object take timezone account. i thought it'd pretty straightforward, don't seem find perfect way on google/so. privilege answer doesn't need external library. my preference store dates on server side using utc time, , when handling data coming via ajax calls, create global handler parsing. the following example allows use: app.ajax({ url: '/my/post/url', data: { myproperty: 'myvalue' }, success: function (data, status, xhr) { // stuff here... }, error: function (xhr, settings, error) { // stuff here... } }); but, pre-parses returned values in "success" function's "data" element fixing dates utc ...

java - Eclipse: How to automatically generate getter when adding a field? -

i using tdd, , have typical coding pattern, using eclipse autocreate methods , fields code unit test. example: type name of method doesn't exist, e.g: myobj.setvalue(somevalue); click on little red error mark in ide create "setvalue" method. type inside of setvalue method: public void setvalue(string value) { this.value = value; } click red error mark auto-create private field (called "value in case"); so @ point, eclipse auto-create getter method, without having using source -> generate getters , setters menu. i saw question: how force eclipse prompt create getter , setter when doesn't automatically seems imply eclipse this, couldn't find configure that. is there way configure eclipse automatically add setter/getters when adding new private variable? update : clarify further, i'm looking saw in spring roo documentation. if take @ "how works" section, describes how framework automatically adds additional m...

asp.net - Free Embedded Only Document Database For Commercial Use -

i'm looking @ document databases asp.net mvc application, , need can embed application, free. have public web site i'm not making money off yet, may in future. said, noticed following these servers: ravendb not free commercial use in embedded form mongodb free, not natively embeddable. have gotten embed, may require agpl licensing, can't if true ( can mongodb used embedded database? ). db40 not free commercial use source isn't available. is there out there fast , free? again, cannot host server, need embeddable database application. thanks.

decode PHP JSON -

my php receives json string similar this: {"one-value":"google","sub-values":{"sub thing":"xpto"}} how value of "sub thing" ? if want "one-value": $json = json_decode($data); $service = $json->{'one-value'}; try this: $json = json_decode( '{"one-value":"google","sub-values":{"sub thing":"xpto"}}' ); echo $json->{'sub-values'}->{'sub thing'}; // or $json = json_decode( '{"one-value":"google","sub-values":{"sub thing":"xpto"}}', true ); echo $json['sub-values']['sub thing'];

actionscript 3 - ArgumentError: Error #2015: Invalid BitmapData. on iOS -

the simplest graffiti app. code works fine on desktop , on android. if try same on ios (tested on real device - ipad 2), error: argumenterror: error # 2015: invalid bitmapdata. in principle, clear why error - size of bitmapdata huge. why happens? , why on ios? private var maskline:sprite = new sprite(); stage.addeventlistener(mouseevent.mouse_move,onmove); stage.addeventlistener(mouseevent.mouse_down,ondown); stage.addeventlistener(mouseevent.mouse_up,onup); protected function ondown(ev:mouseevent):void { maskline.graphics.linestyle(20, 0x33cc00, 1); maskline.graphics.moveto(mousex, mousey); stage.addeventlistener(mouseevent.mouse_move, onmove); } protected function onup(ev:mouseevent):void { stage.removeeventlistener(mouseevent.mouse_move, onmove); } protected function onmove(ev:mouseevent):void { maskline.graphics.lineto(mousex, mousey); } save in bitmap code: maskline.filters = [new blurfilter(4, 4, 1)]; trace (capabilities.screenresolutionx +...

SQL update query for balances using Access raises 'Operation must use an updateable query' -

i have following query (ms access 2010) i'm trying use update table running balance: update accounts set a.currentbalance = (select sum(iif(c.categoryid = 2,t.amount * -1, t.amount)) + (select a1.openingbalance accounts a1 a1.accountid = a.accountid) totalamount transactions t inner join ( transactiontypes tt inner join categories c on c.categoryid = tt.categoryid) on t.transactiontypeid = tt.transactiontypeid); the tables used are: a work around "query must use updateable query" use temporary table , update final target data based on aggregated data in temporary table. in case, mwolfe suggests, have aggregate function in inner select query. workaround provide quick fix situation, has me. ref: http://support.microsoft.com/kb/328828 this article helped me understand specifics of situation , provided work around: http://www.fmsinc.com/microsoftaccess/query/non-updateable/index.html

c# - apply same storyboard in multiple control -

Image
<window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:class="storyboard.mainwindow" x:name="window" title="mainwindow" width="640" height="480"> <window.resources> <storyboard x:key="all_in_one"> <coloranimationusingkeyframes storyboard.targetproperty="(panel.background).(gradientbrush.gradientstops)[3].(gradientstop.color)" storyboard.targetname="btn_a"> <easingcolorkeyframe keytime="0" value="#ffcdcdcd"/> <easingcolorkeyframe keytime="0:0:0.6" value="#ffed0b00"/> <easingcolorkeyframe keytime="0:0:1" value="#ffcdcdcd"/> </coloranimationusingkeyframes> </storyboard> </window.resources> <grid x:name="layoutroot"> ...

objective c - Am I doing something wrong with Instruments in Xcode 4.3.2? -

Image
i followed this video tutorial detecting memory leaks using instruments xcode 4.3.2. as can see video, creator gets lot of useful feedback on type of object leaked etc. when run instruments, detect few memory leaks don't useful feedback on them: what mean "root leaks"? why there no more useful information in screen above? is can fix? i'm using arc within app - effect instruments finding memory leaks in way? a root leak can 1 of 2 things. can single memory leak, or can start of leak cycle. leak cycle occurs when lose reference group of objects. memory leak leaks 1 object while leak cycle leaks group of objects. your code may not have leak cycles, explain why cycles , roots section shows less information tutorial. choosing call tree instead of cycles , roots jump bar can find areas of code leaking memory.

Print.css to print tables from a webpage -

i having trouble trying print table webpage. when try print table shrinks content fourth of page , shows horizontal , vertical scroll bars. how can print table same way appears on webpage. there helpful sites or tutorials this? would if posted current print.css stylesheet, try adding table element /* remove unwanted elements */ #header, #nav, .noprint { display: none; } /* ensure content spans full width */ #container, #container2, #content { width: 100%; margin: 0; float: none; overflow: hidden; } as shown on http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml

parallel processing - Parallelly started Processes in Python executing serially? -

i have understanding problem/question concerning multiprocessing library of python: why different processes started (almost) simultaneously @ least seem execute serially instead of parallely? the task control universe of large number of particles (a particle being set of x/y/z coordinates , mass) , perform various analyses on them while taking advantage of multi-processor environment. example shown below want calculate center of mass of particles. because task says use multiple processors didn't use thread library there gil-thingy in place constrains execution 1 processor. here's code: from multiprocessing import process, lock, array, value random import random import math time import time def exercise2(noofparticles, noofprocs): startingtime = time() particles = [] processes = [] centercoords = array('d',[0,0,0]) totalmass = value('d',0) lock = lock() #create particles in range(noofparticles): p = particle() ...

java - I need to be able to find the line number and method name in eclipse -

i trying find line number , function name of current function cursor located in. need pass information function later processing. here few more details. editor ceditor. have plugin use data. need display current function , line number starts on. if function xyz starts on line number 5 , user typing in function on line 8. need xyz , line 5. i programing in java user writing in c/c++. sorry noticed missed lot of details. building , eclipse plugin needs method user's cursor in. when using ceditor cdt addon. the documentation cdt (c development tools) api here. cdt supports "dom" (document object model) can walk through learn document being edited. need ahold of itranslationunit object edited document, call getelementatline() icelement object describing code @ given line number. icelement root of big hierarchy of subclasses describe various c language elements. you can itranslationunit calling coremodelutil.findtranslationunit() , takes ifile p...

Using custom WCF username/password (UserNamePasswordValidator) authentication with Java -

i've found example authenticating wcf services custom username/password ( a simple wcf service username password authentication: things don’t tell you ). fits need... partially, guess. uses wshttpbinding , message security mode. the wcf service need build have java clients, , question if example link above works java ("interops" well). or should go basichttpbinding, securing connection @ transport level (https)? thanks wcf implements lots of web service protocols: http://msdn.microsoft.com/en-us/library/ms730294 although complicated solution not necessary best one. go ahead basichttpbinding , transport security if fits other requirements have. there all-in-one article describes configuration: http://www.remondo.net/using-ssl-transport-security-wcf-basichttpbinding/

android - System.Web.Services.Protocols.SoapException: Server was unable to process request.---> System.Data.SqlClient.SqlException: -

i have android application in want retrieve data sqlserver 2008. the android application connects web service accesses sqlserver database, tried calling method "getcommentstest" retrieves data database , got error: system.web.services.protocols.soapexception: server unable process request.---> system.data.sqlclient.sqlexception: cannot open database "my database" requested login. login failed. login failed user 'nt authority\network service.' knowing tried view web service on browser after publishing it, called function , worked. and here's android code call web service: public void calltestgetcomments() { try { soapobject request = new soapobject(namespace, method_name_get_comments); request.addproperty("eid", 140); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet=true; envelope.setoutputsoapobject(request...

java - calculate average with user input -

i'm writing program calculate average user input. import java.util.scanner; public class mean { static scanner input = new scanner (system.in); public static void main (string[] args) { double i; double sum = 0; int count = 0; { system.out.println("input"); = input.nextdouble(); sum = sum + i; count++; }while (i != 0); system.out.println("sum " + sum + " count " + (count - 1)); system.out.println("average " + sum / (count - 1)); } } here if input 0, calculate. if there 0s in list. can guide me great while condition? you ask scanner whether or not next token scanner reading double , break if isn't. example below: import java.util.scanner; public class mean { static scanner input = new scanner (system.in); public static void main (string[] args) { double i; double sum = 0; int count = 0; while(input.hasnextdouble(...

php - Building CSV with array -

i need run query return multiple rows , export csv. have put cells in order though. so lets table laid out id, name, address, wife. need build csv in order of id, address, wife, name. figured make array in correct order , make csv after hour of googling cant find out how make csv array. there fputcsv requires pre-made csv. also, hoping there codeigniter way of doing it. public function export() { $this->load->helper('download'); $data[1] = 'i pie'; $data[2] = 'i cake'; force_download('result.csv', $data); } i tried error said download helper file expecting string not array. here's code use... adjust columns need in export... note: csv directly sent php://output writes directly output buffer. means you're not saving .csv files on server , can handle much larger file size building giant array , trying loop through it. header("content-type: application/csv"); header("conte...

android - MyLocationOverlay - Custom image, but no shadow -

i have application, uses custom implementation of mylocationoverlay . in implementation set bitmap property used when has been specified, overload of draw. it works nicely, using custom image, but doesn't display shadow - done automatically in itemizedoverlay . can help? here (the relevant code from) class: public class locationoverlay: mylocationoverlay { /// <summary>bitmap use indicating current fixed location.</summary> public bitmap locationmarker { get; set; } /// <summary>uses custom marker bitmap if 1 has been specified. otherwise, default used.</summary> /// <param name="canvas"></param> /// <param name="mapview"></param> /// <param name="shadow"></param> /// <param name="when"></param> /// <returns></returns> public override bool draw(canvas canvas, mapview mapview, bool shadow, long when) { ...

gzip - Python Fileinput openhook=fileinput.hook_compressed syntax use -

i'm trying open number of files using glob , feed them through series of functions. of files gziped bz2 , plain text. used fileinput typically can't figure out syntax have take in compressed files. based on python fileinput doc should like: openhook=fileinput.hook_compressed my code looks like: import fileinput import glob filestobeanalyzed = glob.glob('./files/*') filename in filestobeanalyzed: inputfilename = filename line in fileinput.input([inputfilename, openhook=fileinput.hook_compressed]): #do stuff i invalid syntax on fileinput line @ = sign. any suggestions? you want for line in fileinput.input(inputfilename, openhook=fileinput.hook_compressed): #do stuff (i removed square brackets). trying assignment in list constructor. e.g. my_list=["foo",bar="baz"] #this doesn't work (syntaxerror) you got idea python documentation uses [ , ] indicate optional arguments functions. this aside...

flash - Horizontal dynamic text scrolling with external text -

i have script works nice if put text on dynamic text , if load external .txt file, text have loaded not inserted on dynamic text. here code: on external txt file use this: _txt=pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. i use load external text. loadtext = new loadvars(); loadtext.load("letreiro.txt"); loadtext.onload = function() { _root.textoletreiro = this._txt; trace(_root.textoletreiro); // output shows text! mctext._txt.text = _root.textoletreiro; // here i'm puting text on dynamic text, not working. }; and here horizontal scrolling code: var resetpos:number = (mctext._txt._x * -1) + 2; var endoftext= mctext._txt._x - (mctext._txt.textwidth + 5); function scroller() { mctext._txt._width = mctext._txt.textwidth; mctext._txt.multiline = false; mctext._txt.autosize = "right"; mctext.onenterframe = function() { mctext._txt._x -= 1; if (...

maven - GWT Module XXX not found in project sources or resources -

i have widgetset compiled maven goals: vaadin:update-widgetset gwt:compile. pom.xml , web.xml files configurations should fine. i'm maven newbie , first maven project. after compilation compiled code shows in src/main/webapp/vaadin/widgetsets folder. when try run install goal error shows: failed execute goal org.codehaus.mojo:gwt-maven-plugin:2.2.0:resources (default) on project validation-manager-web: gwt module com.pantar.widget.graph.graphwidget not found in project sources or resources. just in case here relevant files: pom: <plugins> <!-- compiles custom gwt components gwt compiler --> <!-- hosted mode browser client-side widget debugging can run goal gwt:run after uncommenting correct line below. remote debugger can connected port 8998. note e.g. jetty server should running server side parts - use goal jetty:run . --> <plugin> <groupid>org.codeha...

Pause Javascript Loop During Video -

given html5 video, possible create for- or while-loop not continue until video inside has ended? e.g., code below should play through 3 videos sequentially, not simultaneously. <video id="video0"> <source src="video0.mp4"> </video> <video id="video1"> <source src="video1.mp4"> </video> <video id="video2"> <source src="video2.mp4"> </video> . var i=0; while (i<3) { document.getelementbyid('video'+i).play(); i++; } a loop not satisfy needs here, it's better listen events. a list of events connected media-elements can found @ w3c page so, in specific case, should you: var playvideo = function(videoid){ var video = document.getelementbyid('video'+videoid); if(video){ video.play(); //binding eventhandler event firing @ end of video video.onended = function(e){ pl...

Django syncdb doesn't create db tables -

i've been troubleshooting error no luck. templatesyntaxerror @ /signup/ caught databaseerror while rendering: relation "signup_product" not exist line 1: ..."duration", "signup_product"."duration_type" "signup_pr... what i've discovered when run manage.py syncdb, not creating tables in database. empty database, explains above error. i ran manage.py sqlall myapp , displayed models in myapp.models i can start shell , import myapp fine. so why doesn't manage.py syncdb create tables? this before learned south. wasn't using migrate, syncdb wasn't adding new models.

C# WebRequest (Http POST over SSL) hangs at GetResponse() but different URL works. Also wrong POST parameters in a request -

i found code works expected: var url = "https://limal.info/efulfilment.php"; servicepointmanager.servercertificatevalidationcallback = delegate { return true; }; var alternativeanswer = encoding.utf8.getstring(new webclient().uploadvalues(url, new namevaluecollection() { { "xml", "test" } })); the following code gives me headache: var url = "https://limal.info/efulfilment.php"; servicepointmanager.servercertificatevalidationcallback = delegate { return true; }; var request = (httpwebrequest)webrequest.create(url); request.contenttype = "application/x-www-form-urlencoded"; request.method = "post"; request.timeout = 5000; // added you, need wait 5 sec... using (var requeststream = request.getrequeststream()) { var writer = new streamwriter(requeststream); writer.write("xml=test"); } using (var response = request.getresponse()) { using (var responsestream = response.getresponsestream()) { ...

Calling a module in python to process the same file. It works in one scenario, but not in the other, and I can't figure out what's different -

Image
as can see image above,i call txt_to_csv_space_split_version() module in script on top left , in script on bottom right. on top left, text file isn't read reason (output on top right), in bottom right, (output on bottom left). i hope makes sense-please feel free ask clarification! many thanks!! edit: green circles point module gets called in each of scripts. green rectangle highlights module definition. red circles show same text file being read (by same module) in both scripts. , yet, somehow, module doesn't seem working correctly script in top left. you're opening file in upper left script 'w' mode, wipe it's contents out. output_file=open("/users/markfisher/desktop/"+filenames[index]+'_output.txt','w') then call function opens file read it's contents: name_to_be_split="/users/markfisher/desktop/"+filenames[index]+'_output.txt' #print transpose.txt_to_csv_space_split_version(name_to_be_...

iphone - Process name for iOS simulator's apps -

Image
i see memory footprint of of standard iphone apps when run in ios simulator (for comparison purposes). does know these process show in activity monitor? i'm talking settings app, contacts app, photos app, etc. simulator apps won't show processes in activity monitor. process should see ios simulator .

css - DIV :after - add content after DIV -

Image
i'm designing simple website , have question. want after <div> tags class="a" have image separator on bottom, right after <div> (refer image, section in red). i'm using css operator :after create content: .a:after { content: ""; display: block; background: url(separador.png) center center no-repeat; height: 29px; } the problem image separator not displaying after <div> , right after content of <div> , in case have paragraph <p> . how code image separator appears after <div class="a"> , regardless of height , content of div a? position <div> absolutely @ bottom , don't forget give div.a position: relative - http://jsfiddle.net/ttamx/ .a { position: relative; margin: 40px 0; height: 40px; width: 200px; background: #eee; } .a:after { content: " "; display: block; background: #c...

python - Turning text in a text file to lists in a dictionary -

so example had text file peoples phone numbers,name,address. looked return @ end of each line 555-667282,bill higs,67 hilltop 555-328382,john paul,85 big road 555-457645,zac fry,45 tony's rd 555-457645,kim fry,45 tony's rd and wanted put in dictionary , in dictionary phone number key , there name , address list. if wanted print dictionary this. code this {555-667282: ['bill higs','67 hilltop'], 555-328382: ['john paul','85 big road'], 555-457645: ['zac fry','45 tony's rd'],['kim fry','45 tony's rd']} dicto = {} open('your_file.txt') f: line in f: s_line = line.rstrip().split(',') dicto[s_line[0]] = s_line[1:] edit: to handle cases there multiple entries associated 1 phone number: from collections import defaultdict dicto = defaultdict(list) open('your_file.txt') f: line in f: s_line = line.rstrip().split(',') ...

java - setText not displaying the value to a TextView -

let me preface i'm new programming android. i've been doing due diligence research no avail. have source code below , i'm having issues returning value returning. i have code laid out on eclipse , it's not triggering errors. when build code below, comes error. after inspecting values in debug view, can see proper values not binded textview. public class myfirstactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); calculateresult(2012, 9, 29); } private void calculateresult(int year, int month, int day) { long days = 0l; int returning = 0; java.util.calendar cal = new java.util.gregoriancalendar(year, month-1, day); long todaymi = new java.util.date().gettime(); long calmi = cal.gettimeinmillis(); long milldiff = calmi - todaymi; if (milldiff < 0) {...

javascript - Photoswipe gallery close event on iOS -

i've implemented fabulous photoswipe library in 1 of recent mobile applications using jquerymobile , i've run small problem using in tandem ios 5 (could others, i've got ios 5 device). below implemented javascript <script type="text/javascript"> (function (window, $, photoswipe) { $(document).ready(function () { $('div.gallery-page') .live('pageshow', function (e) { var currentpage = $(e.target), options = {}, photoswipeinstance = $("ul.gallery a", e.target).photoswipe(options, currentpage.attr('id')); photoswipeinstance.show(0); return true; }) .live('pagehide', function (e) { var currentpage = $(e.target), ...

database - Make Non-Windowed Component Data Aware -

i have non-windowed component date property. make component data aware read , write capabilities date field. (in other words, if change date @ runtime, write new date property value dataset.) have googled examples, haven't been able find any. found several read-only examples, e.g., tdblabel, none allow changes written dataset. if can point me example, grateful. here generic code approach question unit unit1; interface uses classes ,db ,dbctrls ; type tdataawarecomponent = class(tcomponent) private { private declarations } fdatalink : tfielddatalink; ffromdatechange : boolean; function getdatafield: string; function getdatasource: tdatasource; function getfield: tfield; function getreadonly: boolean; procedure setdatafield(const value: string); procedure setdatasource(const value: tdatasource); procedure setreadonly(const value: boolean); function getdateproperty: tdatetime; procedure setdateproperty(const...

cocoa touch - Putting text shadow on a UIButton text label -

i have uibutton on putting text label. want change color of text , put shadow 1 pixel away text, give nice 3d kind of view. how this? i want change color of text ... -[uilabel settextcolor:] ... , put shadow ... -[uilabel setshadowcolor:] ... 1 pix away text -[uilabel setshadowoffset:]