Posts

Showing posts from January, 2014

How to use the varchar data type in c#? -

i have piece of code , want make varchar not string. appropriate syntax in c# string emri = row["nome"].tostring(); i have query have run , use emri in , compare column in table have created in mysql. column in mysql of type varchar(20). when execute code gives error in query , guessing maybe reason i have query string query = "if not exists(select * clienti codcliente= " + id + " , nome = '" + emri + "' , ragionesociale=' " + ragsoc + " ' , partitaiva=' " + piva + " ') insert clienti values(" + id + " ,' " + emri + " ',' " + ragsoc + " ',' " + piva + " ') else update clienti set( " + id + " ,' " + emri + " ',' " + ragsoc + " ',' " + piva + " ')"; and gives me problem you have error in sql syntax; check manual corresponds mysql server version right syntax use

list - Transform from [[Char]] to own data type in Haskell -

this question exact duplicate of: scanl in haskell 1 answer scanl (\exp y -> scanl (\x -> if (isletter x) update exp (literal x) "" else if x=='+' update exp epsilon "+" else if x=='*' update exp epsilon "*" else update exp epsilon "|") y) epsilon q my data type is: data reg = epsilon | literal char | or reg reg | reg reg | star reg deriving eq and update:: reg -> reg -> [char] -> reg update b "" = (a `then` b) update b "|"= (a `or` b) update b "*" = (star a) update b "+" = (plus a) update b "?" = (opt a) and trying transform ["a|","bc"] (then (or b c)) using functions above , can't use parsec . please don't "manually", end

iphone - Facebook SDK FBLoginView getting EXC_BAD_ACCESS -

i'm following hellofacebooksample project bundled facebook sdk 3.5. i've virtually copied , pasted own app, stuff appdelegate, yet reason clicking login button freezes app. record, authenticates correctly when connecting integrated framework in ios 6, done through fb sdk anyway. it's when try log in using web, i.e. hit fbloginview website opens, authenticated, return app. here code in samepl project, , i'll compare mine: fbloginview *loginview = [[fbloginview alloc] init]; loginview.frame = cgrectoffset(loginview.frame, 5, 5); loginview.delegate = self; [self.view addsubview:loginview]; [loginview sizetofit]; mine little different: loginview = [[fbloginview alloc] init]; loginview.delegate = self; [self.facebookcell addsubview:loginview]; [loginview sizetofit]; as delegate methods, i've implemented them verbatim. why app crash? there no valid reason crash when code pretty identical between app , sample app. debugger doesn't zombie objects on. ac

python - Random Phrase Creator -

i want create program generate random phrase creating 10 random integers 1 20, , depending on each variables integer, word or phrase produced. there easier way following: #this random phrase generator import random rand1 = random.randint (1, 20) rand2 = random.randint (1, 20) rand3 = random.randint (1, 20) rand4 = random.randint (1, 20) rand5 = random.randint (1, 20) rand6 = random.randint (1, 20) rand7 = random.randint (1, 20) rand8 = random.randint (1, 20) rand9 = random.randint (1, 20) rand10 = random.randint (1, 20) if rand1 ==1: print ('squirrel') and on... p.s. using python 3 thank helpful advice. new python, , helpful have people can me create better code. if cares, used program talks you, , offers chance hear jokes , play several games. have nice day. pps ended going with: import random words = 'squirrel orca ceiling crayon boot grocery jump' .split() def getrandomword(wordlist): # function returns random string passed list of strin

java - Changed & Improved passing data from WebServlet to a WebService -

i'm pretty new writing servlet , rest services, i'm @ problem i'm not sure if i'm doing correctly. service this: @post @produces ("application/json") @path ("/register") public string register( @formparam("name") string name, @formparam("username") string username, @formparam("password") string password, @context httpservletresponse servletresponse) throws ioexception { if( this.user_taken(username) ) return "username_taken"; user user = new user(name,username,password); ..... return mapper.writevalueasstring(user); } so can see service takes care of doing end (database , creating user) servlet on other hand in charge of taking request form, validating , passing service . servlet code: ... validate user input form ... clientconfig config = new defaultclientconfig(); client client = client.create(config); webresource service = client.resource("http://localhos

Import hashed user passwords into Meteor app -

i have existing site has user passwords hashed using sha1 hashing algorithm. need port users (and passwords) new meteor site. is possible? i encountered similiar problem , migrated accounts , had users reset passwords. can use built standard accounts methods handle login+reset functions. login method call: meteor.loginwithpassword(email, password, function(err){ if (err){ if(err.reason === "user has no password set"){ session.set('loginerrormessage', 'you have been migrated... reset password...'); //your template push user reset password } }else{ //normal login } }); can if have custom login form, possibly lightly customize accounts-ui package if desired this approach has worked pretty app far, users have follow password reset procedure , go

r - change distance of x-axis labels from axis in sciplot bargraph -

Image
i'm constructing plot using bargraph.ci sciplot. x-axis represents categorical variable, values of variable names different positions on x-axis. unfortunately these names long, @ default settings, of them disappear. solved problem splitting them multiple lines injecting "\n" needed. worked, because names multi-line, close x-axis. need move them farther away. how? i know can mgp, affects y-axis too. i know can set axisnames=false in call barplot.ci, use axis create separate x-axis. (in fact, i'm doing that, make x-axis extend farther default- see code below.) give x-axis own mgp parameter not affect y-axis. far can tell, axis() set ordinal or continuous variables , doesn't seem work great categorical variables. after fiddling, couldn't put names in right locations (i.e. right under correspondence bars) finally, tried using mgp.axis.labels hmisc set x-axis mgp, precisely want, far tell had no effect on anything. ideas? here's code. ylim = c(

java - String[] strings = TextUtils.split(line, "-"); -

i experimenting dictionary sample app comes android eclipse plugin. i'm trying create directory of local business'. issue section of code. try { string line; while((line = reader.readline()) != null) { string[] strings = textutils.split(line, "-"); if (strings.length < 2) continue; addword(strings[0].trim(), strings[1].trim()); } } { reader.close(); } mloaded = true; } this code allows me split line 2 strings first being before the hyphen , second string after hyphen. trying use similar code want break down 3 strings apposed 2 thanks help split() method split string depending upon expression want split with for example: in case want split using "-" string "abcd-xyz" split "abcd" , "xyz" string "abcd-xyz-1234" split "abcd" , "xyz" , "1234" it depends upon string passing in.

JSTL accessing properties from java bean -

i'm pretty new jstl bear me. have class created i'm try access properties in jstl. can't figure out i'm doing wrong here. i'm not getting error i"m getting nothing when try call "getchildpath" in java class i'm doing i'm not able access in jstl? appreciated. java class: public class childpath{ private string childpath = ""; public childpath(resource resource) throws repositoryexception{ valuemap properties = resource.adaptto(valuemap.class); childpath = properties.get("childpath", ""); } public string getchildpath() { return childpath; } my jstl reference: ${getchildpath} first should fix naming follow java naming convention. say, have passed javabean (type childpath ) instance (named bean ) jsp, in jsp can reference attribute private string childpath by: ${bean.childpath} use attribute/property name instead of method (getter) name.

sql - Mysql Case - Count Fields thats fall in curtain hours -

Image
i trying set report has following fields : pretty need report show date, total records fall in date (so group date) , on per hour basis 12 hour work day (from 8am - 8pm) need count when records present within times. after brain storming , brain farts thought why not use case. have tried : select date_format(signintime, '%b %d, %y') date, count(session_id) total, sum(case when hour(signintime) > 08 , hour(signintime) < 09 1 else 0 end) '8am-9pm', sum(case when hour(signintime) > 09 , hour(signintime) < 10 1 else 0 end) '9am-10am', sum(case when hour(signintime) > 10 , hour(signintime) < 11 1 else 0 end) '10am-11am', sum(case when hour(signintime) > 11 , hour(signintime) < 12 1 else 0 end) '11am-12pm', sum(case when hour(signintime) > 12 , hour(signintime) < 13 1 else 0 end) '12pm-1pm', sum(case when hour(signintime) > 13 , hour(sig

Java Calculator History Feature -

i hoping me feature store calculator's history string , have show history when user hits h key. i'm looking record each button pressed, including operators. appreciated. thanks. public class gui extends jpanel implements keylistener { private jbutton b1; private jbutton b2; private jbutton b3; private jbutton b4; private jbutton b5; private jbutton b6; private jbutton b7; private jbutton b8; private jbutton b9; private jbutton b0; private jbutton add; private jbutton subtract; private jbutton multiply; private jbutton divide; private jbutton solve; private jbutton clear; private jbutton decimal; private jbutton sqrt; private jbutton recip; private jbutton backspace; private jbutton ms; private jbutton mr; private jbutton mc; private jbutton percent; private jbutton love; private jtextfield jtf; string display = ""; string mstore; string history; boolean multiplybool = false; boolean dividebool = false; boolean addbool = false; boolean subtractbool = false;

html - cut off corners jquery mobile collapsible sets -

Image
i cut off top-left corner of jquery mobile header in collapsible set. here html: <div data-role="content" id="one" class="ui-content" role="main"> <div data-role="collapsible-set" data-corners="false"> <div data-role="collapsible" data-collapsed="false" data-theme="f" data-content-theme="f" class="cornered ui-collapsible-heading"> <h3>witness</h3> <p>content witness tab. content witness tab. content witness tab. content witness tab. content witness tab. content witness tab. </p> </div> <div data-role="collapsible" data-theme="e" data-content-theme="e"> <h3>victim</h3> <p>content victim tab. content victim tab. content victim tab. content victim tab. content victim tab. content victim tab. </p

objective c - Monomorphic arrays with static type checking -

id<uiview> views = @[one, two, three]; nsinteger object = [views lastobject]; // compiler warn me `views` stores uiviews how far have go implement this? have experience extending clang support similar features? similar: nsmutablearray-force-the-array-to-hold-specific-object-type-only i have thought also, though in end ask make me more productive. objective-c seems me pragmatic language, features has real world useful, things block super useful, features namespaces , typed arrays in experience not much. add lot of nsassert code check stuff that. mutable collections contained within other classes , have lot of control on can added them, maybe thats pattern adopt because don't have typed collections?

Can I use nested type in Scala generic function? -

how can use nested type in scala generic function ? i'd implement this implicit def basicdblist2list[list[a]](value : basicdblist) = value.tolist.asinstanceof[list[a]] compiler gives following error: scala: not found: type implicit def basicdblist2list[list[a]](value : basicdblist) = value.tolist.asinstanceof[list[a]] ^ when write: implicit def basicdblist2list[list[a]](value: basicdblist) = ... ... doesn't mean think means. you're declaring new type parameter called list , not referring existing list trait in library! you're declaring newly-defined list type requires type parameter, you've called a , can't reference it. what meant was: implicit def basicdblist2list[a](value: basicdblist): list[a] = ... ... says that, type a , can convert basicdblist list[a] . this sketchy code, though, 2 reasons: what type basicdblist class cont

ios - Performing valueForKeyPaths against multiple keyPaths -

let's have object number of properties , load 1000s of these objects array. next, perform series of valueforkeypaths against these properties: result.property1 = [array valueforkeypath:@"@sum.property1"]; result.property2 = [array valueforkeypath:@"@sum.property2"]; result.property3 = [array valueforkeypath:@"@sum.property3"]; etc... summing these properties individually seems pretty inefficient. there better way besides fast enumerating on properties , summing them manually? i.e. for(foo* foo in array) { result.property1 += foo.property1; result.property2 += foo.property2; result.property3 += foo.property3; } kvc requires keys strings: a key string identifies specific property of object. typically, key corresponds name of accessor method or instance variable in receiving object. keys must use ascii encoding, begin lowercase letter, , may not contain whitespace. so answer far know unfortunately can't valu

Keeping a website session alive in C# using WebRequest or WebBrowser control? -

i trying keep session alive using either webrequest or webbrowser control. works on websites without problem particular website logging me off after 30 mins. what ask 1 of website page @ random interval (1-10 mins) using navigateto function in webbrowser control. websites captcha login, first ask user login, cookies , use them webrequest requests , reuse webbrowser control keep alive website (so webbrowser , webrequest clients share same cookies). i looking ideas, maybe can me out. in advance! usually, there's nothing can session timeouts, they're both client-side , server-side, or server-side. if you're lucky, though, site in question relies on cookie timeouts, client-side. should case, can play around httpcookie.expires . this prevent expiring: httpcookie cookie = ...; cookie.expires = default(datetime);

html - Is an image that is display: none loaded by the browser? -

this question has answer here: does display:none keep elements loading? 2 answers are these images loaded browser: <div style="display: none"> <img src="/path/to/image.jpg" alt=""> </div> or <img src="/path/to/image.jpg" alt="" style="display: none;"> by "loaded browser" mean, these images loaded browser available right away when image no longer displayed none using css. taken cache or loaded anew moment no longer displayed none? to answer question, loaded page (or event) loaded. , typically used when going display element using javasript.

timeout - VBScript onTimeout then function -

i have vbscript working on uses object. sometimes object stuck. vbscript code hang on line until it's "done". when times out, want send .close command object before vbscript closes. how can tell when vbscript times out? i know can put wscript.timeout = 60 maybe like.. wscript.timeout = 5 while true loop sub wscript_timeout() msgbox("ok") end sub by seting timeout property instruct interpreter automatically terminate script when timer expires. same running interpreter option //t:xx , can't caught/handled within script. want requires ability run code asynchronously, , vbscript doesn't support that.

jquery - Ajax and pagination -

trying implement ajax pagination dialecting grails controller: 1) ajax function refresh grid: function refreshgridajax() { $("#filescontainer").find("#paginate a").live('click', function(event) { event.preventdefault(); var r = $(".curfolderid").text(); var url = $("#filescontainer").load("${request.contextpath}/files/listobjects?folderid="+r); //url = $(this).attr('href'); showspinner(); $.ajax({ type: 'get', url: url, success: function(data) { $('.curfolder').text($('.curfolder').text()); $("#filescontainer").fadeout('fast', function() {$(this).html(data).fadein('slow');}); }, complete: function(data) { hidespinner(); } }) }); } 2) controller method

ios - OpenGL ES 2.0 Pinch and Zoom -

in opengl es 1.1 on ios used implement pinch , zoom setting field of view using following: // handles touches events - (ibaction)handlepinchgesture:(uigesturerecognizer *)sender { static float startfov=0.0; cgfloat factor = [(uipinchgesturerecognizer *)sender scale]; uigesturerecognizerstate state; state=sender.state; if(state==uigesturerecognizerstatebegan) { startfov=[self getfieldofview]; } else if(state==uigesturerecognizerstatechanged) { float minfov=5.0; float maxfov=12.0; float currentfov; currentfov=startfov*factor; if((currentfov>=minfov) && (currentfov<=maxfov)) [self setfieldofview:currentfov]; } } using pinch gesture this: // set fulstrum , our field of view window -(void)setclipping { // near , far front , walls // fov in degrees float aspectratio; const float znear = .1; const float zfar = 2000;

html5 - And captions/subtitles to video-js youtube playlist player -

i edited code , made changes video-js youtubeplaylist player working i wondering how might add captions or subtitles playlist example here: http://bestimage.x10.mx/playlist_yt/youtube_playlist.html <!doctype html> <html> <head> <title>youtube playlist video player</title> <link href="./css/video-js.css" rel="stylesheet"> <link href="./css/video-js_playlist.css" rel="stylesheet" type="text/css"> <script src="./js/video-js_youtube.js"></script> <script src="./js/video-js_playlist.js"></script> <script>_v_.options.flash.swf = "video-js.swf";</script> </head> <body> <div text-align:center> <video id="vid1" class="video-js vjs-default-skin" controls preload="auto" width="854" height="480" data-setup='

actionscript 3 - 2D Running Game (in first person view) in as3/flash -

i want learn make infinite running games temple run.... @ basic level. @ as3 , flash... , have created graphics.... whole scenario of game in first person view. , graphics created in flash. can please suggest tutorials or techniques should use make objects coming far point , how can write logic of hitting them or escaping them. thanks ur help... :)

matlab - Create single .mat file by using multiple wave signal -

i want prepare training , testing set automatic speech recognition using matlab toolbox. have sample set containing several recorded audio (.wav). new matlab. in order use toolbox need create training ad testing set save in .mat file. question how create single .mat file containing audio? million. to create disjoint training , testing set, best method use crossvalind command. performs cross-validation of k-fold k parameter given input. if k=5 1/5th data used testing , 4/5th data used training. code follows: data=randi(20,[500 20]); %creating random data 500 rows , 20 columns. indices=crossvalid('kfold',size(data,1),5); test = (indices == 2); %you can put number between 1 5 train = ~test; traindata=data(train,:); testdata=data(test,:); savefile='datafile.mat' save(savefile,'traindata','testdata'); if change number 2 other number, train-test data same distribution , random each time. can put in loop saving, need use tricks

css - Div picture cut out of div box -

i adapting webdesign, when found problem , couldn't slove on own. i coded heading , article picture, both in same div, border @ bottom of div. problem: border comes right after title , doesn't integrate picture. check out fiddle see mean: click me! here code: <div class="latestarticle"> <a class="articletitle" href="#" >guitar hero experts melt face off</a> <div class="articlepicture"> </div> and css: .latestarticle { border-bottom: solid 1px #ccc; padding: 0px; margin-top: 12px; font-size: 12px; } .articletitle { color: #cd5700; text-decoration: none; font-weight: bold; font-size: 14px; margin-bottom: 5px; } .articlepicture { height: 76px; width: 136px; float: left; margin-top: 12px; margin-right: 9px; border: solid #a3a3a3 2px; } i'm wondering why not working. should work, anyway, add display: table; or display: table-cell; .latestarticle . works fine. s

java - Returning zero when it shouldn't -

the method below keeps returning 0, , cannot figure out why! please help! currentlocation.setlatitude(38.03211); currentlocation.setlongitude(-78.51002); and longitude/latitude of if loc 38.03161, -78.51075, public double getdistance(historicallocation loc) { return (double) math.abs(math.sqrt((currentlocation.getlatitude() - loc .getlatitude()) * (currentlocation.getlatitude() - loc.getlatitude()) + (currentlocation.getlongitude() - loc.getlongitude()) * (currentlocation.getlongitude() - loc.getlongitude()))); } take squareroot of absolute value, not other way around. coming nan setting 0 or that. (this fixed it)

hadoop - Duplicate value in part-r-00000 -

while processing xml file( https://github.com/studhadoop/xml/blob/master/rpt ) getting duplicate values output. bin/hadoop fs -text /user/root/t-output1/part-r-00000 st17925 1.02 st17925 1.02 st17926 3.00 st17926 3.00 st17927 3.00 st17927 3.00 my mapred https://github.com/studhadoop/xml/blob/master/xmlparser11.java why so? whether depends on size of xml file? whwn having large xml file, iget duplicated values. if small xml file ,the output ok. updated 1 one more doubt. instead of listing this studentid grade st17925 1.02 st17926 3.00 st17927 3.00 what change should make in program? update 2 how make output in csv format? because in reducer implementation, write key every value output collector: (text value : values) { context.write(key, value); } what wanted this: stringbuilder sb = new stringbuilder(); (text value : values) { sb.append(value.tostring()); sb.append(" "); } context.write(key, new text(sb.tostring());

android - How much time invalidate() takes for calling onDraw method of a view -

maybe applications doesn't stands issue, but, if want redraw view , particular app requires high resolution?.what i'm trying here can have situation slightest change of any input (for example touch event) want redraw view, probable lose of these changes on input because of time invalidate() takes calling ondraw method of view. i'm pretty sure always present trouble due more hardware capabilities software, so, questions are: am right? if case, can possibly know how error introduce on these particular high resolution apps i'm not sure if it's looking for, i've found this question while looking my answer invalidate() not working , @rachiet said delay between invalidate() , ondraw() 100 ms.

java - Why is my release() method not waking my instance? -

i've written example program demonstrate problem. there's bartender thread , 3 customer threads. run @ same time once created. bartender suppose serve each customer drink. my problem wait() method within bartender classes run() method never awakens. had intended release() method within run() method of each customer class awaken doesn't seem working. never awakens. how can go fixing this? can offer advice or code snippets. import java.util.concurrent.semaphore; import java.util.logging.level; import java.util.logging.logger; public class bar { semaphore serving; boolean isserving = false; public static void main(string[] args) { bar bar = new bar(); bar.run(); } public void run() { serving = new semaphore(1); thread bartender = new thread(new bartender()); bartender.start(); threadsleep(1000); thread customer1 = new thread(new customer()); customer1.start(); threadsleep

aggregate - Unable to make native javascript reduce() function work -

i'm trying aggregate data using reduce() function in javascript (similar this question ): html product 1: <button id="product1">add one</button> product 2: <button id="product2">add one</button> js $('button').on('click', function() { var pid = $(this).attr('id'); cart[cart.length] = {id:pid, qty:1} var result = cart.reduce(function(res, obj) { if (!(obj.id in res)) res.__array.push(res[obj.id] = obj); else { res[obj.id].qty += obj.qty; } return res; }, {__array:[]}) console.log(result) }); }); i'm unable make work array being return doesn't contain qty data. e.g.: object {__array: array[1], product1: object} object {__array: array[1], product1: object} object {__array: array[2], product1: obje

html - What javaScript code can I use so that the tab key skips one tabindex and the carrage return key skips X tabindexes? -

Image
i amateur coder , javascript novice (or less), , trying build online form multiple (many) <textarea> inputs. for arguments sake , let's presume 3 x 3 type orientation: for reasons of other functionality & performance, must use <textarea> , not <inputs> . if person presses [tab], expected tab-index adhered no worries ( a1 --> b1 ). if person pressed [return], because <textarea> , adds \n delimiter, breaks line , remains within still focused <textarea> . what happen when person presses [return], 3 tab-indexes 'skipped' (if right word), , focus goes <textarea> directly below previous focused <textarea> . example: in a1; write/input something; press [return]; taken directly a2. [[update]] example of html text area code: <textarea data-id="0" class="inputarea colorinput" id="datainput_0" name="colorinput_row_1" onfocus="classfocused();" onblur="cl

x86 - Emulate clock with second channel of system timer? -

is possible emulate clocks (with seconds, minutes, hours) using second channel of system timer? on x86 architecture. if you're asking 8253/8254 timer, try, first timer (out of 3 of 8253/8254 chip) generates interrupts. , then, shouldn't touch 1 may involved in memory regeneration , last 1 need used purpose not speaker.

html - Thumbnail rollover with text -

i'm using following css code rollover effect text: .thumb { position:relative; } .thumb img:hover { filter:alpha(opacity=0); -moz-opacity:0; -khtml-opacity:0; opacity:0; } .thumb:hover { background:#f00; } .thumb span { z-index:-10; position:absolute; top:10px; left:10px; } .thumb:hover span { z-index:10; color:#fff; } html code: <div class="thumb"> <a href="http://domain.com/"><img src="thumbnail.jpg" /></a> <span>text</span> </div> everything working except when hover on text: rollover effect disappears , can see image again. any ideas? thanks in advance i guess of styles simple overlay effect, if interested see demo i've made scratch here go demo html <div class="wrap"> <img src="http://images.google.com/intl/en_all/images/logos/images_logo_lg.gif" /> <div class="over

extjs - Changing the properties of a field dynamically -

in application's viewport i'm showing form panel list of fields in center region , property-grid in east region. i need show list of properties of field in property-grid on selection of field. user able change properties. requirement apply properties dynamically field. is there generic way achieve this? can me? some properties have getter , setter functions, not of them , doubt consistent enough trying do. my suggestion store config object each field, config object have each property want able change using property grid. when property changes, remove field form. re-create using ext.create , passing config object second parameter. insert object form. edit: can skip using ext.create using insert function on form panel, seems able accept config object directly.

android - Use AlarmManager without a service -

is possible use alarmmanager run alarm without app using service. alarmmanager have bring device out of sleep mode , execute code in onreceive. virtually every code sample have seen posted here shows service being used. yet android docs not mention need of having service. here working example, activity_alarm_manager.xml file's code <linearlayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <button android:id="@+id/btstart" android:layout_height="wrap_content" android:layout_width="match_parent" android:onclick="startrepeatingtimer" android:padding="@dimen/padding_medium" android:text="@string/btstart" tools:context=".widgetalarmmanageractivity"/&

ios - CALayer mask slows down view transitions iPhone 4 -

im using cashapelayer mask animate drawing of circular progress bar: cgmutablepathref path = cgpathcreatemutable(); cgpathaddarc(path, nil, 99.65, 99.25, 84, radians(startangle), radians(endangle), 0); cashapelayer *layer = [cashapelayer layer]; layer.path = path; layer.strokecolor = [uicolor redcolor].cgcolor; layer.linewidth = 21; layer.linecap = kcalinecapround; layer.linejoin = kcalinejoinround; layer.fillcolor = [uicolor clearcolor].cgcolor; _progressbar.layer.mask = layer; // configure animation cabasicanimation *drawanimation = [cabasicanimation animationwithkeypath:@"strokeend"]; drawanimation.duration = animation_duration; drawanimation.repeatcount = 1.0; drawanimation.removedoncompletion = yes; drawanimation.fromvalue = [nsnumber numberwithfloat:0.0f]; drawanimation.tovalue = [nsnumber numberwithfloat:1]; [layer addanimation:drawanimation forkey:@"drawcircleanimation"]; the animation works great, circular progress bar goes e

How to remove polylines in Google Maps Android API v2? -

Image
so have 2 markers: 1 destination (which static meaning not move) , other marker dynamic , updates position based on current location. i able draw polyline on route between 2 markers. problem when updating current location, previous polyline drawn previous position of dynamic marker still there. here image: ) as can see in image, marker dynamic 1 points current location , polyline marker's previous position located @ university of san carlos @ upper-right position of marker in image. destination marker not shown in image. how remove previous polyline? tried using method remove() polyline class didn't work. i based code link: answer : draw path between 2 points using google maps android api v2 create array markers/points , polylines. later, on remove, make this: polyline ptemp = mpolylines.remove(mpolylines.size() - 1); ptemp.remove()

c# - SMTP mail errors -

i developing c# application send mail using smtp server of our company mail. following code. mailmessage mail = new mailmessage(); smtpclient smtpserver = new smtpclient("10.203.195.48"); mail.from = new mailaddress(""); mail.to.add(""); mail.subject = "filename"; mail.body = "report"; smtpserver.host = "ip address fo smtp mail server."; smtpserver.port = 25; smtpserver.credentials = new system.net.networkcredential("", ""); smtpserver.send(mail); but error: mailbox unavailable.unable relay.the system doesn't have internet connection. the following code gmail smtp using port 587. change port , smtp. add namespace using system.net mailmessage mymailmessage = new mailmessage(); mymailmessage.from = new mailaddress("emailid"); mymailmessage.to.add("to"); mymailmessage.subject = "feedback form"; mymailmessage.body = "this test message";

perl - Term::ReadKey, non-blocking read in raw mode: Detect EOF? -

when pipe stuff program, not seem character 0x4 indicate eof. $ echo "abc" | map 'cat' saw a: \x61 saw b: \x62 saw c: \x63 saw : \x0a zzzbc ^c i have press ctrl+c quit, i'm not sure ctrl+c acting on. it's having shell send sigint pipeline? don't know how pipelines work on level. here program map : #!/usr/bin/env perl use strict; use warnings; use io::pty::easy; use term::readkey; use encode; $#argv % 2 , die "odd number of args required.\n"; if ($#argv == -1) { warn ("no args provided. command must specified.\n"); exit 1; } # sure enter command string %mapping = @argv[-@argv..-2]; $interactive = -t stdin; # %mapping = @argv; # @mapkeys = keys %mapping; # warn @mapkeys; if ($interactive) { print "spawning command in pty: @argv\n" # print "\ncontinue? (y/n)"; # $y_n; # while (($y_n = <stdin>) !~ /^(y|n)$/) { # print '(y/n)'; # } # exit if $y_n eq

drupal multi site setup for a migrationed copy -

drupal multisite setup dump folder configuration: actually, migrated drupal folder server new server. , dump put in fresh drupal 6 folder old db structure , folder structure : drupal/sites/www.site1.com drupal/sites/www.site2.com drupal/sites/www.site3.com , drupal folder in data directory. actually, working on www.site1.com , has run domain name called dev.example.com. configured in etc/apache2/sites-available document root data/drupal. when opened dev.example.com showing install.php page. how can directly access settings.php/modules/themes www.site1.php? it's urgent. can help? rename "www.site1.com" folder "dev.example.com". after go to: /sites/dev.example.com/settings.php & make sure database details mentioned there correct. after can run dev.example.com/update.php & clear drupal cache. hope solve problem.

mysql - Integrating Paypal payment APIs on server side -

i have java server providing web services frone end web application. 1 of functionality of our web application accept recurring payments our customer , pay sales agents using"pay me" option. i want backend java server talk paypal apis directly , deal payments. ex: when sales agent says "pay me", capture his/her paypal account id , store in database. backend process kick in , payment agent using paypal apis. is possible paypal apis? i have seen every paypal integration can onyl happen via web as long system can carry out api operation backend, there isn't reason shouldn't work. have cron job set runs every morning , performs api call.

Google maps v3 geocode multiple custom markers by address or latlng -

i need plot multiple custom map markers using mapsv3 api either address or lat/lon. put following code works ok lon/lat, if data contains address geocoder returns nothing. ideas on how fix this. $(document).ready(function () { initialize(); }); function initialize() { var centermap = new google.maps.latlng(-27.0,133.0); var options = { pancontrol: false, zoomcontrol: true, scalecontrol: false, maptypecontrol: false, streetviewcontrol: false, zoom: 3, center: centermap, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(document.getelementbyid("map"), options); var data = [ { 'title':'f c building construction ...', 'address':'', 'zindex':20, 'l

java - How to access as JsonNode from session | ${user.get()} -

i'm creating simple session object (jsonnode) jsonnode me = mapper.readvalue(result, jsonnode.class); httpsession session = request.getsession(true); session.setattribute("user", me); the trying access this. ${user} // works print {"id":8,"name":"jones"..} ${user.id} // trows error "property 'id' not found on type org.codehaus.jackson.node.objectnode" ${user.get(0)} // nothing printed out. ${user.size()} // return 4, id,name,username,token how re factor code fix problem, or selector? the version @mindas suggested should work, unless using tomcat 7. seems tomcat 7 has bug when calling overloaded methods jsp el ( see issue here ). using tomcat 7? the ${user.get(0)} isn't printing because method accessing value of specified element of array node. yours not array node , if use ${user.get("id")} should value id field, unless on tomcat 7 error cannot convert id of type class java.lang.strin