Posts

Showing posts from May, 2012

java - collision detection not working? -

im quite new java. trying make can control ball arrow keys , if collide ball, print line in console saying "you lost" or somthing. i have done moving, struggling bit how can 2 balls collide. far have tried (i think put rectangle around ball, don't know really!): public void collision() { rectangle rectp = new rectangle(player.x, player.y, player.width, player.height); rectangle recte = new rectangle(enemy.ex, enemy.ey, enemy.width, enemy.height); if(rectp.intersects(recte)) { system.out.println("game over"); } } could me out , explain have done wrong. ps. please don't give me code, want try , learn!!!. thanks. public void actionperformed(actionevent e) { repaint(); x += velx; y += vely; } public void up() { vely = -1.5; velx = 0; } public void down() { vely = 1.5; velx = 0; } public void left() { vely = 0; velx = -1.5; } public void right() { vely = 0; velx = 1.5...

javascript - Nested views and events in backbone -

so have 2 views. 1 'parent' view bound collection , number of sub-views bound individual models in collection. class resulttable extends backbone.view el:"body" initialize:()-> @collection.bind "add", @add add:(model)-> new modelview({model:model}) class modelview extends backbone.view el: "#resultstablelist" initialize:()=> @model.on "selected",@select @render() render:()=> #append template select:(e)=> e.preventdefault() console.log(@model) events: 'click' : 'select' so when click on 1 of list elements, of modelviews' select functions triggered. thought way had built specific model had been clicked show up. what's going on? template html- <div id="resultstablecontainer" class="resultscontainer"> <ul id="resultstablelist"> </ul> this e...

javascript - How can I make my menu expand all the subitems? -

i have list menu javascript code makes collapse , expand .onclick . although make show 1 item because every time try new solution for loop or case can't work. this current code: <ul id="navigation"> <li class="main"><a>diagonóstico</a></li> <li class="sub"><a href="javascript:void(0);" class="sub_di1"> › grátis (na compra de qualquer serviço) </a></li> <li class="main"><a>hardware</a></li> <li class="sub"><a href="javascript:void(0);" class="sub_ha1"> › instalação/configuração de componentes</a></li> <li class="sub"><a href="javascript:void(0);" class="sub_ha2"> › instalação/configuração de periféricos </a></li> <li class="sub"><a href="javascript:void(0);" class="sub_h...

android - Proguard obfuscates Activity names in a merged library manifest -

i have several application projects use common library project. tried moving common activity declarations each application project's androidmanifest.xml library's manifest, , enabled manifest merging manifestmerger.enabled=true in project.properties . everything works fine in debug build, release builds (obfuscated proguard) fail activitynotfoundexception . because proguard obfuscating names of activities declared in library manifest, not in application manifest. i have examined merged bin/androidmanifest.xml file application project, , correctly has activity names listed. can please suggest workaround? the standard ant build process invokes aapt tool create proguard configuration (bin/proguard.txt) preserves necessary classes (e.g. activities deems used). if doesn't work project structure (maybe bug or unsupported case), can preserve classes in proguard-project.txt: -keep public class * extends android.app.activity -keep public class * extends androi...

Error associating Azure SQL database with Azure website: System.NullReferenceException: Object reference not set to an instance of an object -

i having strange error publishing website azure. published service using vs 2010 have run error in connecting database website. login page works, of pages on site, rely on same database. page issue comes following text: server error in '/' application. object reference not set instance of object. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.nullreferenceexception: object reference not set instance of object. source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [nullreferenceexception: object reference not set instance of object.] mao.controllers.reviewcontroller.index() +603 lambda_method(closure , controllerbase , object[] ) +62 system.web.mvc.actionmethoddispatcher.execute(con...

Python - summarize try-except statement -

i want summarize following code. should check if variable in calculation assigned. if not, result zero. because have hundreds of calculations these don't want repeat try-except every calculation. how that? a = 1 b = 2 d = 3 f = 2 try: ab = + b except: ab = 0 try: ac = - c except: ac = 0 try: bg = b / g except: ac = 0 write function it, using lambda (a one-line function) defer evaluation of variables in case 1 of them doesn't exist: def call_with_default(func, default): try: return func() except nameerror: # names don't exist return default ab = call_with_default(lambda: a+b, 0) # etc. you might benefit using sort of data structure (e.g. list or dictionary) contain values rather storing them in individual variables; it's possible use loops these calculations instead of writing them individually.

Can not figure out Javas strings? -

i student @ moment still learning. picked vb pretty quick , simple java on other hand pretty confused on. the assignment have been given time has me confused "write method determine number of positions 2 strings differ by. example,"peace" , "piece" differ in 2 positions. method declared int compare(string word1, string word2); if strings identical, method returns 0. returns -1 if 2 strings have different lengths." additional "write main method test method. main method should tell how many, positions strings differ, or identical, or if different lengths, state lengths. strings console. far @ , looking break down in dumdum terms if can don't need solution understanding it. package arraysandstrings; import java.util.scanner; public class differstrings { public static void main (string agrs[]){ scanner scanner = new scanner (system.in); system.out.print("enter word"); string word1; string word2;...

opengl - Unexpected projection -

it should rect, takes whole width of window. expecting this, because frustum width -5 5 , rect size 10x10 , rect on same z-axis position near plnane of frustum. result small , doesn't rect, don't know why? void glwidget::initializegl() { glclearcolor(1.0f, 1.0f, 1.0f, 0.0f); } void glwidget::resizegl(int w, int h) { glviewport(0,0, w, h); glmatrixmode(gl_projection); double ratio = (double)w/(double)h; double size = ((10.0/ratio)/2.0); glfrustum(-5.0, 5.0, -size, size, 10.0, 50.0); } void glwidget::paintgl() { glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glmatrixmode(gl_modelview); glloadidentity(); gltranslatef(0.0f, 0.0f, -10.0f); glcolor3f(0.0f, 0.0f, 0.0f); glbegin(gl_quads); glvertex3f(5.0f, -5.0f, 0.0f); glvertex3f(5.0f, 5.0f, 0.0f); glvertex3f(-5.0f, 5.0f, 0.0f); glvertex3f(-5.0f, -5.0f, 0.0f); glend(); glflush(); } it should rect, takes whole width of window. w...

How can I programatically truncate order "O" terms in Maple? -

in maple, taylor(exp(x),x,2); returns 1+ x +o( x 2 ). how can automatically convert result same expression o( x 2 ) terms removed? i.e. removebigo(taylor(exp(x),x,2)); return 1+x ?" p := taylor(exp(x),x,2); convert(p, polynom); that conversion has own help-page . note page taylor,details has such conversion last example. , page taylor mentions conversion of taylor series result polynomial described on details page.

java - String concatenation - Boolean hard-coded Vs Boolean Concatenation with String -

i need advice (both in java & .net) following piece of code. public void method(bool value) { string somestring; //some code if (value) { //some code ... somestring = "one" + value; } else { //some code ... somestring = "two" + value; } } which 1 advisable , why? either code above or code like somestring = "onetrue"; somestring = "twofalse"; after compilation , optimization jdk, method like: public static string method(boolean value) { string somestring; if (value) { stringbuilder sb = new stringbuilder(); sb.append("one"); sb.append(value); somestring = sb.tostring(); } else { stringbuilder sb = new stringbuilder(); sb.append("two"); sb.append(value); somestring = sb.tostring(); } return somestring; } ...

Image obstructing my navigation bar and the image above. Basic HTML/CSS issue -

i have image on site want set it's own entity can freeform , adjust without conflicting other elements, have it's css #backgroundimage{ position:absolute; float:right; top:0; left:50%; } using fixed , absolute positions cause image stack level nav bar, other position cause nav bar jump right under image i'm using (it's picture of moon) cutting off image, text, it's behind nav bar. things have tried: putting inside of have no idea how work out, , tried floating contained inside of div. i have read comments putting on z or y axis, have no idea means, i'm still reading or trying find me understand it. this school project, still basic in field. use z-index of -1 : #backgroundimage { z-index: -1; } also, it's not recommended name elements camel-case - use dashes instead.

Android Webview - Programmatically change orientation for specific webpage without reloading -

i'm trying see how go changing webview on page if page contains video can watch in landscape mode. not reload webview allow page rotate. how can done? not sure how go it. i haven't done this, think should work want. change orientation code when needed as dont want interrupt content disable activity retstarrt on orientation change to change orientation code use setrequestedorientation(activityinfo.screen_orientation_landscape) setrequestedorientation(activityinfo.screen_orientation_portrait); and prevent activity restarting when orientation change use following in manifest android:configchanges="keyboardhidden|orientation|screensize"

Rails DateTime field has current date/time if nil in the database -

i have form datetime field. since rails 3.2.13 doesn't support type="datetime-local" input fields yet (and i'm not ready move 4.0 beta), i'm doing manually: <input type="datetime-local" name="person[my_date_time]"<% if @person.my_date_time %> value="<%=@person.my_date_time.strftime('%ft%t')%>"<% end %>/> the problem @person.my_date_time current date/time if it's nil in database. , outputs seconds screws chrome's handling of datetimes. want field empty if it's nil in database. how can tell? rails' datetime_select method handles way want. if datetime field nil in database in application must changing or overwriting value. perhaps have default somewhere? it's not possible going on without seeing more code posted now. can post code person model , other relevant code (any gems might affect things, etc.)? strftime("%ft%r") # output without seconds, e.g...

java - JDBC ERROR: operator does not exist: date = integer -

string checkavailable_flight = string.format("select flightid, flightdate," + " origin, destination flight" + " flightdate::date = %s , origin = %s" + " , destination = %s;", date_, origin_, destination_); resultset rs = stmt.executequery(checkavailable_flight); if (!rs.next()) { system.out.println("no data inserted"); } else { { int flightid = rs.getint("flightid"); string date = rs.getstring("flightdate"); string origin = rs.getstring("origin"); string destination = rs.getstring("destination"); system.out.printf("%-10d %5s %5s %7s\n",flightid, date, origin, destination); } while (rs.next()); } error(s) occurred: sqlexception : error: operator not exist: date = integer hint: no operator matches given name , argument type(s). might ...

ruby on rails - Rspec: test for all controller actions -

i have rspec controller test: describe testcontroller "test actions" all_controller_actions.each |a| expect{get a}.to_not rais_error(someerror) end end end how implement all_controller_actions method? while prefer test 1 one, question doable. # must state variable excluded later because mycontroller has them. = applicationcontroller.action_methods m = mycontroller.action_methods # custom methods exclude e = %w{"create", "post} @test_methods = m - - e describe testcontroller "all actions got response" @test_methods.each |t| expect{get t}.to_not rais_error(someerror) end end end

iphone - Get current date string for special format -

i writing iphone app now. want current date , time following format. thu, 18 apr 2013 01:41:13 how can achieve this? the documentation setdateformat: in nsdateformatter class reference links data formatting guide . in data formatting guide , date formatters > use format strings specify custom formats > fixed formats section links appendix f of *unicode technical standard #35 . appendix f, while obtuse, tells everything: use e short week day name. use d day of month. use mmm short month name. use y year. use hh hour. use mm minute. use ss second. we can test without writing whole objective-c program using python's cocoa bindings: :; python python 2.7.2 (default, oct 11 2012, 20:14:37) [gcc 4.2.1 compatible apple clang 4.0 (tags/apple/clang-418.0.60)] on darwin type "help", "copyright", "credits" or "license" more information. >>> cocoa import * >>> f = nsdateformatter.new()...

c++ - Unlimited Unsigned Integer linked-list implementation. Subtraction not working -

so, have implemented entire unlimited unsigned integer class using linked-list project euler problem working on. have verified of logical bit operations correct (though can post if want see them). have implemented operators , operations. however, subtraction (and using it, i.e. division , modulus) doesn't work. when run following test, get: limitlessunsigned limitless = 0x88888888u; limitless = limitless << 4; limitlessunsigned tester = 0x88888884u; tester = tester << 4; //limitless = limitless >> 5; limitlessunsigned = limitless - tester; i following values debugger: limitlessunsigned integerlist std::__1::list<unsigned int, std::__1::allocator<unsigned int> > [0] unsigned int 0b11111111111111111111111111111111 [1] unsigned int 0b00000000000000000000000001000000 limitless limitlessunsigned integerlist std::__1::list<unsigned int, std::__1::allocator<unsigned int> > [0] unsigned int 0b000...

r - Formal argument "type" matched by multiple actual arguments -

i have translated program r c++. program in question runs multiple iterations of different values produces histogram , plot. c++ graphs finicky decided save values in csv format , graph them in r. files large, smaller size files, 10 iterations produces 23000 rows , 3 columns. of course increase drastically 100 or 1000 iterations. format of csv files 1,3,0.0107171 corresponds col num, row num , data. run r: >data<-read.csv(file.choose(),header=t) >plot(data,type="b", pch=19, xlab="x", ylab="y") error in plot.default(...) : formal argument "type" matched multiple actual arguments as side note: > hist(data[,3], xlab="step length (m)", main="") the histogram works without problems. please tell me if can provide more details, not when comes r might missing obvious. in advance. you passing data.frame plot , dispatches plot.data.frame , will, data.frame more 2 columns, call pairs(data.matrix(da...

How to use Google Calendar API with my Android App? -

i want use google calender android application. i read through documentation asks me use "signing certificate fingerprint sha1" application. how can generate sha1 application release , debug versions eclipse adt. does eclipse adt auto generate me? generate new 1 each time tried test application in emulator? note: found relative question @ answers not answering question. the process generating sha1 fingerprint same google services, can follow step step instructions for enabling api access in google api console , make sure enable google calendar api. you'll want register debug.keystore file debug builds , signing keystore file release. note, if targeting ice cream sandwich (v14)+ devices, can use built in calendar provider , provides access device's calendars including google calendars current user.

maven - Primefaces 3.3, POM, tomcat 7.0.39 and Jboss as EAP 5.1 -

i'm working primefaces 3.3 , jsf 2.0. , structure of pom below, when generate war, run (work) on tomcat 7.0.39. know need change pom war run in jboss eap 5.1. error:19:19:53,125 severe [config] critical error during deployment: com.sun.faces.config.configurationexception: factory 'javax.faces.context.externalcontextfactory' not configured properly. @ com.sun.faces.config.processor.factoryconfigprocessor.verifyfactoriesexist(factoryconfigprocessor.java:305) at o war generated below not work in jboss eap 5.1 <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.mkyong.core</groupid> <artifactid>otimizacaoprocessointerno</artifactid> <packaging>war</packaging> <version>1.0-snapshot...

linux - Shell script help on finding and replacing strings -

i have config file hive-site.xml one configuration element is; <property> <name>hadoop.embedded.local.mode</name> <value>true</value> </property> i want change "true" "false" shell script. in file there lots of configuration elements such as; <value>true</value> tags. so "sed" command used find , replace strings difficult used here knowledge. appreciate if can me this. this job xpath , reasonable xml library. doing shell script directly going create complicated , fragile solution. i'm going use python , popular lxml library example: from lxml import etree tree = etree.fromstring(''' <property> <name>hadoop.embedded.local.mode</name> <value>true</value> </property> ''') e = tree.xpath('//property[name="hadoop.embedded.local.mode"]/value')[0] e.text = 'false' print...

gtk3 - Does python gtk vte have a way to populate a dropdown menu? -

edit: looks im_append_menuitems not function popup menu. vte inherits gtk.widget way menu connect right mouse click , generate custom menu. , if works answer. i'm using gtk3 python . when opening vte window created in python gtk can normal things 1 expect terminal except right click dropdown menu. in c documentation there's vte_terminal_im_append_menuitems () . i haven't tried yet because requires gtkmenushell , i've used gtkmenu. might have trouble using it. the documentation isn't best edge cases, , i'm using python doesn't have bindings made right. of abstract gtk classes i've tried in python have given me trouble too. i'm wondering if there easier way gtkmenushell. if not example of gtkmenushell help. in meantime i'm going try on own. if come code i'll post answer.

Update attributes of embedded new record in Rails & Mongoid -

i'm trying write piece of functionality creates record template in rails app, customisations user. the difficulty comes when trying let user override field in embedded document: document duplicated rather updated. i start object of type, let's say, externallinkgrouptemplate , , contains number of externallink s. it's used create externallinkgroup contains externallink s. user should able edit link text when it's cloned not url, user presented form when it's copied user should able can create copy of (simplified because of code in different files, remove tests success etc): @link_group = externallinkgroup.new @template.links.each {|link| @new_link_group.links.push link.dup } @link_group.update_attributes(params[:link_group]) when link group created, contains twice many links template, , second set has changes. clearly, mongoid/activewhatever creating new items rather updating existing ones. i don't want pass through fields in parameters without dup...

c - when I compile with Scite, command prompt won't show up, why? -

when compile scite, command prompt won't show up, why? programming c program, , wouldn't pop once complied because not connected? or have connect it, if how? i'm using old version (10 year) description may not match yours: on 'parameter dialog' there setting called 'sub-system'. when sub-system set 'command-line-interface', child processes created pipe trap child output 'output pane'. no 'cmd window' in case. when sub-system set else : 'gui', 'shell' ... child process running free, not communicating scite: either normal window or cmd window show- in case. check 'parameter dialog' or 'cpp.config' file make sure 'go command' not called under 'command-line-interface' sub-system.

python - Use two databases in Django 1.5 -

i have django 1.5 application sqlite or mysql database. @ local server have oracle database typically connect connection string "tns=tns-name; uid=user; pwd=pwd;". how possible print data local oracle database in django application? actually, want transfer data oracle database main sqlite/mysql database. i've seen tutorials how use oracle database main database source in django application, want keep main database source , load specific data oracle database in specific django view. thank you. i'm not quite sure if you're looking for, django docs seem job explaining (if interpreted correctly). in short, need add list of databases in settings file , create router. lookup chain databases detailed here .

liferay 6 - Change default URL from /web/guest -

how change liferay url /web/guest another. in liferay control panel communities (in portal) option not there (it not visible) add/change below property in portal-ext.properties # # sets default home url of portal. # company.default.home.url=/web/guest

google glass - Is it possible to register a top-level intent in the Mirror API? -

example "top-level actions" "google," "take picture," etc. is possible using mirror api register custom top-level event? "ok glass, crunchify me." a secondary question have if it's possible take user speech. using "ok glass, google" example, user says query google takes , acts on. possible capture custom action using mirror api? this not yet possible glass client nor mirror api. however, there filed feature request can follow updates on progress.

Scala comparing generics? -

i writing generic binary search implementation , failing compile ( compare not member of type parameter b ) though b ordering , should converted implicitly ordered has compare method: /** * generic binary search in (min,max) f achieve target goal * o(log n) * * @param f function binary search on - monotonically increasing * @param min starting minimum guess (must exclusive) * @param max starting maximum guess (must exclusive) * @param avg mid function (min+max)/2 * @param goal target achieve * @tparam input type of f * @tparam b output type of f * @return some(x) such f(x) goal else none */ import scala.math.ordering.implicits._ def binarysearch[a: ordering, b: ordering](f: => b, min: a, max: a, avg: (a, a) => a, goal: b): option[a] = { if (min >= max) { none } else { val mid = avg(min, max) f(mid) compare goal match { case 1 => binarysearch(f, min, mid, avg, goal) case -1 => ...

elasticsearch - Exclude some characters from asciifolding conversion -

i have setup analyzer asciifolding filter. this filter replaces letter ç=>c , ñ=>n. need keep original ç , ñ in token. is there way setup exception in asciifolding filter? if not, can use char_filter asciifolding filter accents , not ç , ñ or there better approach? i didn't find configuration exceptions in asciifolding, have setup char_filter mappings need , apply in analyzer (without asciifolding): char_filter: { my_map: { type: "mapping", mappings: [ "á" => "a", "à" => "a" .... ] } }

c# - Import/Setting background image to windows form cause run slow -

i import background image every forms in project programs runs slow? how can fix this? the format image png. any things consider in doing this? solve issue? thanks! in form,set property doublebuffered true buffered graphics require updated graphics data first written buffer. data in graphics buffer written displayed surface memory. relatively quick switch of displayed graphics memory typically reduces flicker can otherwise occur. instead of using png format use jpeg format quality 12(final image quality png format),your image size decrease , form load faster.

php - errors: [1] 0: {message: "Undefined offset: 1} -

i receiving php error errors: [1] 0: { message: "undefined offset: 1 (error number: 8), (file: /users/akashpatel/documents/ios development/rideshare/rideshareapi/src/frapi/library/frapi/controller/api.php @ line 299)" name: "php notice error" at: "" } . below code. if (isset($_server['http_login'])) { list($userid, $apikey) = explode(':', base64_decode($_server['http_login'])); $this->setuserid($userid); $this->setapikey($apikey); //check against db $sql = "select * user id=:userid , apikey=:apikey"; $stmt = $db->prepare($sql); $stmt->bindparam(':userid', $this->getuserid()); $stmt->bindparam(':apikey', $this->getapikey()); try { $stmt->execute(); $user = $stmt->fetchobject(); } catch(pdoexception $err) { ...

java - Android: thread exiting with uncaught exception -

i have got problem , can't find solution it. when receive data on bluetooth connection, program crashes. receiving data in separate thread each received byte saved in queue. have 1 timertask, calls method read data queue every 1 ms, , refresh textbox in ui. program works while, crashes. please help. here main code snippets. public class mainactivity extends activity { textview mylabel1; volatile boolean stopworker = false; public queue<byte> receiverqueue = new linkedlist<byte>(); protected byte[] receiverarray; private boolean newdataread = false; //timer timertask mtimertask; timer timer = new timer(); final handler timerhandler = new handler(); } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mylabel1 = (textview)findviewbyid(r.id.textview1); //start timer ticking after 1 sec, , give timer tick every 1ms ontimertick(); ti...

java process hangs while launching an executible that is using the file system -

i'm trying execute 'edena' bioinformatic program within java code. process uses input files , write output files. when input files small (~1 mb) process finishes , exits perfectly. when input files larger (~ 80 mb) process hangs. invoking process cmd works fine, suspect got buffers etc.. i'm working on ubuntu 12.04.10 4gb ram (don't know if relevant). code hanging: string edena_exe1 = "edena -m 75 -p " + workshopdir + binassembly.cliquefilesdir + "clique_" + c.getid() + " -drpairs "+ workshopdir + binassembly.cliquefilesdir + "/clique" + c.getid() + "pair1.fna " + workshopdir + binassembly.cliquefilesdir + "/clique" + c.getid() + "pair2.fna "; process edena_proc1 = runtime.getruntime().exec(edena_exe1); edena_proc1.waitfor(); thanks! i suspect larger input file process generates more output. when process started jvm given limited buffered stream output. if not blee...

jsf - PrimeFaces tabmenu not changing index -

i using p:tabmenu component. have 4 menuitems, each 1 redirects different jsf page problem page returned without changing activeindex , activeindex remains same initial value 0. <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <p:tabmenu activeindex="0"> <p:menuitem value="home" url="menu.jsf" icon="ui-icon-star"/> <p:menuitem value="fabricants" url="/pagess/pagesfabricant/fabricant.jsf" icon="ui-icon-wrench" /> <p:menuitem value="composants" url="/pagess/pagescomposant/composant.jsf" icon="ui-icon-search"/> <p:menuitem value="dossier d'equivalence" url="deq.jsf" icon="ui-icon-document"/> </p:tabmenu> </...

java - Android - The method findViewById(int) is undefined for the type -

can keep getting error im getting @ line of code textview t1 = (textview)findviewbyid(r.id.textcocktailname); here's full code snippet: package com.drunktxtapp; import android.os.bundle; import android.widget.button; import android.widget.imageview; import android.view.view.onclicklistener; import android.content.intent; import android.widget.textview; import android.view.view; public class cocktaildetail { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.bloody_mary); imageview imageview1 = (imageview)findviewbyid(r.id.imagecocktail); imageview1.setimagedrawable(getresources().getdrawable(r.drawable.bloodymary)); button b1 = (button) findviewbyid(r.id.byoutube); textview t1 = (textview) findviewbyid(r.id.textcocktailname); string cocktailname = getintent().getstringextra("bloody mary"); t1.settext(cocktailname); ...

security - Paypal Express Checkout API vs PayPal button for Websites -

what difference between paypal button websites , express checkout api? why 1 use api rather button? additional functionality/ other advantages provide? website payments standard, uses html buttons create within account whereas express checkout use api calls complete payment. have more control on checkout flow express checkout, since buyer on site when complete payment. can calculate shipping , taxes, on site. can split payment between different accounts using express checkout parallel payments can not website payments standard. most merchants fact have more control on checkout flow website payments standard buttons. example, direct buyer credit card section on checkout page, or send them paypal login section. website payments standard, can not this. relies on cookies, , can not control standard.

ruby - When specing a namespaced class how do I stub the parent class? -

# models/event.rb class event < activerecord::base # ... end # models/event/timeline.rb class event::timeline # ... end # spec/event/timeline_spec.rb require 'spec_helper' require 'models/event/timeline' # <- fails since "event" not required describe event::timeline '' # ... end end i not want require 'event' since mean requiring of dependencies not nessesary spec. you use stub_const method rspec: https://www.relishapp.com/rspec/rspec-mocks/v/2-13/docs/mutating-constants but simpler use class event; end marian suggested. in response comment, need declared above describe block? if not perhaps try describe event::timeline let(:fake_class) { class.new } before stub_const("event", fake_class) end '' end end

javascript - Highcharts plotBands do not work with setExtremes function -

i using latest highcharts version (3.0) , have problem using plotbands , setextremes() function. chart: { renderto: "chart01", defaultseriestype: 'line', zoomtype: 'x', events: { load: function(event) { this.xaxis[0].setextremes(mystartdate, myenddate); this.yaxis[0].setextremes(0,largest); } } } when using this, highcharts not display defined plotbands. if comment out 2 setextremes functions plotbands displayed (red color spaces). see following (working) fiddle example: http://jsfiddle.net/j8jkq/ see following (not working) fiddle example: http://jsfiddle.net/j8jkq/1/ whats problem here? did setextremes functions remove plotband infos? to set extremes advice using min , max axis. that's why exists, see: http://jsfiddle.net/j8jkq/3/ second issue dates date objects, while should timestamps: mystartdate.gettime(); myenddate.gettime(); and example: ...

c++ - What does "void-value is not ignored" error mean and how to remove it? -

i try compile following code: #include <cppunit/extensions/helpermacros.h> #include "tested.h" class testtested : public cppunit::testfixture { cppunit_test_suite(testtested); cppunit_test(check_value); cppunit_test_suite_end(); public: void check_value(); }; cppunit_test_suite_registration(testtested); void testtested::check_value() { tested t(3); int expected_val = t.getvalue(); // <----- line 18. cppunit_assert_equal(7, expected_val); } as result get: testing.cpp:18:32: error: void-value not ignored should eddit to make example complete post code of tested.h , tested.cpp : tested.h #include <iostream> using namespace std; class tested { private: int x; public: tested(int int_x); void getvalue(); }; tested.cpp #include <iostream> using namespace std; tested::tested(int x_inp) { x = x_inp; } int tested::getvalue() { ...

android - Modifying Coverflow to use xml file -

Image
in application want modify coverflow can use xml file it. converflow follow. when changed coverflow below converflow cf = new coverflow(this); to coverflow cf = new coverflow(r.id.coverflowreflect); i error: the constructor coverflow(int) undefined i got 3 fixes issue. the first 1 change constructor public coverflow(context context) { super(context); this.setstatictransformationsenabled(true); } to public coverflow(int coverflowreflect) { super(coverflowreflect); this.setstatictransformationsenabled(true); } but got error in coverflow class saying the constructor gallery(int) undefined. here coverflow class: public class coverflow extends gallery { private camera mcamera = new camera(); private int mmaxrotationangle = 0; private int mmaxzoom = -380; private int mcoveflowcenter; private boolean malphamode = true; private boolean mcirclemode = false; public c...

weblogic - About Oracle Coherence (and WLS) -

the coherence functionality seems based on clustering concept. mean that, if want install wls on system development use, not need coherence component comes wls ? correct, not required use wls.

Creating a dynamic complex type in entity framework -

i have created stored procedure returns columns dynamically , i'm unable import entity framework does know how import stored procedure returns columns dynamically ef doesn't support stored procedure dynamic result set. result set must fixed ef map complex type / entity type.

c# - Published Web files, can they be converted back to solution? -

is possible take set of published web files , convert them solution? because solution has been lost our system, , files can found actual published files. have looked around , can't seem find on matter, great! thanks lot for web application source code compiled dll's. far know there no easy way reverse engineer web application source code. if wish further research, use search terms such 'reverse engineer web application dll', or 'retrieve source code dll' etc. luck!

mysql - Doctrine 2.3 - text field is not saved because of special characters -

i've spent hours debug algo , noticed coming doctrine (v2.3.3). i'm using libpuzzle calculate hash of image , store hash in database. hash returned has special character in , apparently doctrine doesn't it. this kind of string have (~550 char): ÿ�þÿÿþ�þþÿþÿþÿþþ�þÿþÿÿÿ�ÿþþÿþÿ�ÿÿþÿþÿþþÿþþÿÿÿþÿþþþþÿþ�þþþÿ�ÿÿ�ÿÿþ�þÿþÿþÿþÿþþÿþÿÿÿþþÿþþþþÿþþþþ���ÿÿ�ÿ�þþ�þÿÿþþþÿÿþÿþþÿþþþÿþ... i've investigated , found people saying add charset in config have it: # doctrine configuration doctrine: dbal: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: utf8 if change collation of column utf8_unicode_ci utf8_general_ci still not working. i've made sure default schema collation utf8_general_ci . i've tried string speci...

Jquery issue while retrieving textbox name from wordpress widget box -

when tried retrieve textbox name wordpress widget using jquery, shows incorrect name.this actual textbox in widget form < input type="text" value="" name="widget-nw_widget[3][heading][]" class="widefat" > whereas when alert name of field using jquery shows widget-nw_widget[__i__][heading][] . this jquery used getting name attribute alert( jqry( '.widget-content #ne_container .widefat' ).attr("name") );

azure - Set web address managed with Google apps to redirect to an external website -

i have domain (email, calendar etc.) managed google apps. i want when user accesses naked domain name (i.e. mydomain.com or www.mydomain.com), should redirect website stored in windows azure. now here see when trying via windows azure: you can point custom domain names windows azure web sites. windows azure must verify authorized configure custom domain name point windows azure web site. verify authorization, create cname resource record dns provider points either www.yourdomain.com mydomain.azurewebsites.net, or awverify.www.mydomain.com awverify.mydomain.azurewebsites.net. you use control panel dns settings domain. supplied registrar/web hotel used buy domain. far know, google still doesn't manage domains actual registrar have managed else. the control panel should have page dns management there 20 entries google apps. change www , naked domain entries point ip-address specified in azure , add additional cname entries awverify requested azure.

php - Matching regular and dash separated word with regex -

i want match words seperated dash - , regular word. i'm using regular expression \b(word|someother|xyz|....|word50)\b // upto 50 words trouble want match words w-ord w-o-r-d some-oth-e-r x-y-z so instead of putting (-)? after every character manually this \b(w(-)?o(-)?r(-)?d|w(-)?o(-)?r(-)?d|someother|....|word50)\b is there shorter way regex can match - also. list long want shorter way you can match this: $regex = '#\b(word|someother|xyz|....|word50)\b#'; $ret = preg_match($regex, preg_replace('#(?<=\w)-(?=\w)#', '', $str), $m); i.e. if dash comes between 2 word characters remove dash (hyphens) strings first , match.

.net - How to update gui in c# wpf from asynchronous method callback -

i've search on stackoverflow , in net , couldn't find solution problem. i read stream in async way. want callback update gui [stathread] private void clientloggedcallback(iasyncresult res) { try { mailclient.helpers.client.getinstance().client.getstream().endwrite(res); mailclient.helpers.client.getinstance().asyncrecieveencryptedprotocolmessage(new asynccallback(logininfo_recieved)); } catch { } } [stathread] private void logininfo_recieved(iasyncresult res) { try { mailclient.helpers.client.getinstance().client.getstream().endread(res); mailclient.asyncstate state = (mailclient.asyncstate)res.asyncstate; string answer = aes.decryptstringfrombytes_aes(state.buffer, state.aes_key, state.aes_iv); if (answer.contains("ok")) { string[] answer_params = answer.split(','); ...

ios - Matching 2 NSString values between class methods -

i understand can't pass instance variables within class methods, no longer confused difference between two. hence little stuck. i have 2 class methods , can both take nsstring argument. is there anyway can matched up? because 1 class method has string url needs opened in safari after button pressed , therefore @selector(openbrowser:) needs know url jwkobjectview01 please tell me there way this?? i have tried changing instance methods, app crashes when press button - trying working out:-) thanks in advance. ps know start saying understand can't mix 2 classes - far know, maybe missing something? //added code: uiview class .h file @interface jwkobjectview01 : uiview <uiwebviewdelegate> { nsstring *string; nsurl *url; nsuserdefaults *defaults; } + (jwkobjectview01 *)anyview:(uiview *)anyview title:(nsstring *)title weburl:(nsstring *)webstring; + (void)openbrowser:(nsstring *)urlstring; ...