Posts

Showing posts from August, 2012

Testing Android In App Billing real purchases -

what conditions test real purchases, when have tested app using test product android.test.purchased ? there few steps need pass, remembering, of them need time update on google play servers. for example, let's use com.example.product our real product id. time shows in example change own. upload apk file you can't test real purchases in debug mode. need download app beta, google know it's ok make purchases in app. check if have billing permission in androidmanifest.xml : <uses-permission android:name="com.android.vending.billing" /> change android.test.purchased com.example.product , export *.apk file. must signed ! publish apk in beta, you can go next steps, you'd need time beta ready download. add new product you can't add new product until have published beta. you can't test subscriptions, products. can test subscriptions (they renewed every 24h) go products section in google play develop

ruby on rails - Capistrano Many Private Repo Github -

very strange behavior , cant understand problems. have 2 private repositories on github , deploy capistrano. first app normal deployed deploy.rb : require "rvm/capistrano" require 'bundler/capistrano' set :rvm_ruby_string, "2.1.0" set :assets_role, :app set :normalize_asset_timestamps, false set :application, "awesome_app_one" set :scm, :git set :repository, "git@github.com:myaccount/repo_one.git" set :branch, :master set :deploy_via, :remote_cache set :ssh_options, { forward_agent: true } set :user, "rails" set :deploy_to, "/home/rails/#{application}" set :shared_children, %w(public/system public/files public/uploads log tmp/pids tmp/sockets) set :use_sudo, false task :production role :web, "123.456.789.0" role :app, "123.456.789.0" role :db, "123.456.789.0", primary: true set :branch, :master set :deploy_to, "/home/rails/#{application}" set :rails_env

html - Table using divs - no y overflow for row -

i trying create table using divs. (i can't use table, tr & td tags) the problem is: my cells must next each other (i use float:left ) my row should never expand vertically, can grow on x-axis. so here html : <div id="table"> <div class="rowheader"> </div> <div class="row"> <div class="cell">bla</div> <div class="cell">bla</div> <div class="cell">bla</div> </div> <div class="row"> <div class="cell">bla2</div> <div class="cell">bla2</div> <div class="cell">bla2</div> </div> </div> and css : #table { display: table; width: 100%; } .row { width: 100%; overflow: hidden; display: table-row; } .cell { float: left; display: table-cell; margin: 1px; padding: 2px; width: 35%; backg

gcc - Installing gfortran 4.6 in Fedora 19 -

i beginner fedora. use gamess software programme requires gfortran 4.6. when "yum install gcc-gfortran", fedora 19 ships gfortran 4.8.ix probl can tell me in detail fix problem. gfortran 4.6 has been replaced newer version since fedora 18. can download prebuilt release. there if have 64 bit machine, , there if have 32 bit. simply unpack , copy directory in path .

excel - How can I wrap an If statement around this code? -

i given project work on , i'm bit stumped. have routine being driven shortcut macro move data column column f , begin build itemized list 1 works through column. what need, however, wrap current operation in if statement operation not move data new cell if data in g5 (or, rc) equal cell value in a4 (or, rc-1). if can logic down, can operation work intended. the macro created macro recorder, here code: sub inserttagline() selection.insert shift:=xldown activecell.offset(1, 0).range("a1").select selection.copy activecell.offset(-1, 4).range("a1").select activesheet.paste activecell.offset(0, 1).range("a1").select application.cutcopymode = false activecell.formular1c1 = "=""tag: ""&rc[-1]" activecell.select selection.copy selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false activecell.offset(0, -1).rang

multithreading - Time based thread synchronization in java -

wondering if there time based synchronization in java. example below synchronization locks object , waits until //my application processor finishes task. synchronize (myobject) { //my application processor. } with same, there way synchronize 1 min or 2 min. synchronize (only 1 min && object) { //my application processor } or there other way in java synchronization method. p.s: don't want run threadmanager monitor above. , don't want run while loop. maybe looking java.util.concurrent.scheduledthreadpoolexecutor provides various ways of scheduling task performed/repeated in thread @ specified time/times in future. maybe have method holds lock extended period of time (almost bad idea), , asking how abort operation , release lock if time limit reached. there couple of ways depending on takes time. but guesses. haven't told problem trying solve. your example of using "synchronized" timeout not make sense. purpose of &q

c++ - casting array to variable -

i need efficient way cast part of array variable. let's suppose array defined this: unsigned char bytes[240]; now, need uint32_t value somewhere in array, this: uint32_t * word = reinterpret_cast<uint32_t *>(bytes[4]); which think me second word in array right? question is, safe , portable (windows, linux on x86 & x86_64, os x nice, don't care arm, ia-64 etc). you should use memcpy . portably ensures there no alignment or strict aliasing problems. if no copy needed, compilers smart enough figure out , directly reference data in array: uint32_t value; memcpy(&value, &bytes[4], sizeof value); //modify value: //... //copy array: memcpy(&bytes[4], &value, sizeof value);

How would I implement a forth-style reverse-polish notation parser in boost spirit? -

i'm trying implement parser old forth-based grammar of functions take form of: "num" "num" "command" command string of kind. for example: 0 1 hsff 41 sensor on 1 12.0 bh 4 lnon as can see, grammar [mostly] reverse polish notation, string of arguments preceding command. grammar pseudo white-space dependent, in that: 0 1 hsff 41 sensor on is valid as: 0 1 hsff 41 sensor on (in other words '\n' treated space) extra whitespace skipped, so: 0 1 hsff 41 sensor on is 2 valid commands lot of unnecessary whitespace. all of seemed simple enough, started chugging away @ implementing grammar. of course, things never simple seem, , found parser fails on first character (in case int). so, boiling things down, tried implementing single rule: namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; qi::rule<iterator> cmd_targetsenspaircmd =

ruby on rails - Rspec spec returns a LoadError -

returned app after years absence , not get: rspec spec to run. ran year ago , thought had left @ point pick again when had time, not ... decided update ruby , rails , went updates, bundle install etc, have ruby 2.1.1p76 , rails 4.1.0 running. i ran same command shown above , flag got: /users/me/.rvm/gems/ruby-2.1.1@rails410/gems/pg-0.17.1/lib/pg.rb:4:in `require': dlopen(/users/me/.rvm/gems/ruby-2.1.1@rails410/extensions /x86_64-darwin-13/2.1.0/pg-0.17.1/pg_ext.bundle, 9): library not loaded: @executable_path/../lib/libssl.1.0.0.dylib (loaderror) referenced from: /applications/postgres.app/contents/macos/lib/libpq.dylib reason: image not found - /users/me/.rvm/gems/ ruby- 2.1.1@rails410/extensions/x86_64-darwin-13/2.1.0/pg-0.17.1/pg_ext.bundle i noticed have loaderror not sure need correct that. 2 lines down see 'reason: image not found' , here further away solution. hopefully has expertise , generosity give me pointer in right direction? i instal

reflection - Scala Method Mirror return Type is always Any -

i new scala. how solve problem method mirror returns any? class abc{ def getstring(): string = { return "a,b,c"; } } //somewhere in project val ru = scala.reflect.runtime.universe val mirror = ru.runtimemirror(getclass.getclassloader); val c = class.forname("abc"); val classsymbol = mirror.classsymbol(c); val classtype = classsymbol.totype; val im = mirror.reflect(c.newinstance()) val _method_ = classtype.declaration(ru.newtermname("getstring")).asmethod; val method = im.reflectmethod(_method_); println(method()); //this prints "a,b,c" println(method().length()); // error, value length not member of can proper function returns proper object instead of any? thank you! if method mirror cannot return proper object(like string), point of method mirror? there no way runtime reflection return objects proper static types because static types applicable @ compilation time (hence static types); in order enforce dynamical

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7? -

this question has answer here: how avoid arrayindexoutofboundsexception or indexoutofboundsexception? [duplicate] 2 answers exception in thread "main" java.lang.arrayindexoutofboundsexception: 7? public static void main(string[] args) { piece[][] board; board = new piece[7][7]; // black pawns!create , set on board pawn bp1 = new pawn("black", true, 0, 6); board[0][6] = bp1; pawn bp2 = new pawn("black", true, 1, 6); board[1][6] = bp2; pawn bp3 = new pawn("black", true, 2, 6); board[2][6] = bp3; pawn bp4 = new pawn("black", true, 3, 6); board[3][6] = bp4; pawn bp5 = new pawn("black", true, 4, 6); board[4][6] = bp5; pawn bp6 = new pawn("black", true, 5, 6); board[5][6] = bp6; pawn bp7 = new pawn("black", true, 6, 6);

LogCat in Eclipse Android Debugging Exclusion Tag -

how create exclusion tag in eclipse. want tags beginning media omitted logcat in eclipse. because program has lot of different tags beginning media want go away. can tell want see there seems no way tell not want see. this related how filter out tagname in eclipse logcat viewer . in general, want use java regular expressions filter out/select particular log lines. example: ^(?!(media)).*$

jquery - Updating a table image using AJAX -

i have run funny situation using ajax update databases. on table editable, can upload images. once modify table (new or edit), fields sent , table reloaded ajax. images uploaded folder , filename/path captured show on table. ok small images (size) larger image, table reloads faster image uploaded. end broken image on table requires full page reload. i wondering if there ajax solution try load image on screen (based on class name) until loads or time out after amount. thanks.

Installing MySQL in Docker fails with error message "Can't connect to local MySQL server through socket" -

i'm trying install mysql inside docker container,tried various images github, seems manage install mysql when try run mysql gives error: error 2002 (hy000): can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' system specifications: ubuntu 12,04 on aws docker 0.10.0 packages tried far: https://github.com/eugeneware/docker-wordpress-nginx https://github.com/tutumcloud/tutum-docker-mysql remember need connect running docker container. want use tcp instead of unix socket. check output of docker ps command , running mysql containers. if find 1 use mysql command this: mysql -h 127.0.0.1 -p <mysql_port> (you find port in docker ps output). if can't find running mysql container in docker ps output try docker images find mysql image name , try run it: docker run -d -p 3306:3306 tutum/mysql "tutum/mysql" image name found in docker images .

performance - JavaScript Does memory leak happens every time function is called -

currently attending javascript training trainer told every function write constructor , every time call new object created. consider following code, function test(){ console.log("test"); } test(); test(); so every time call test function, create new object every time? update according him following code not result in memory leak function test(name){ this.name = name; } var 1 = new test("nicholas"); and following code allocate object , result in memory leak function createtest(name){ var t = new object(); t.name = name; return t; } var 2 = createtest("nicholas"); every function write constructor no not true. every time call new object created. if calling constructor using new yes new object craeted. otherwise not true. and yes there no memory leak happens when create object or when call function.

c++ - Counting number of even lines from file -

#include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream plik; plik.open("napisy.txt"); int nr_line=0; string line; int ile_parzystych=0; cout << "podpunkt a)=:"<< endl; if(plik.good()==false){ cout << "wrong read of file!"<<endl; } while(getline(plik,line)) { if( line.length() / 2 == 0) { ile_parzystych++; if(nr_line==1) {cout << "to jest pierrwsza linia - jest ona nieparzysta więc licznik = " << ile_parzystych << endl;} if(nr_line==2) {cout << "to jest druga linia - jest ona parzysta więc licznik = " << ile_parzystych << endl;} } } plik.close(); cout << endl << ile_parzystych << " <- tyle jest linii parzystych"; } problem

Apache downloading php files instead of executing them -

i trying install phpmyadmin in ubuntu server , when try access via browser it, php file downloads instead of displaying web page. placed phpinfo testfile in /var/www , working fine. i have commented lines in php5.conf file: <filesmatch ".+\.ph(p[345]?|t|tml)$"> sethandler application/x-httpd-php </filesmatch> <filesmatch ".+\.phps$"> sethandler application/x-httpd-php-source # deny access raw php sources default # re-enable it's recommended enable access files # in specific virtual host or directory order deny,allow deny </filesmatch> # deny access files without filename (e.g. '.php') <filesmatch "^\.ph(p[345]?|t|tml|ps)$"> order deny,allow deny </filesmatch> # running php scripts in user directories disabled default # # re-enable php in user directories comment following lines # (from <ifmodule ...> </ifmodule>.) not set on # prevents .htaccess files disabling

shell - VBA code to open two files using an application -

i'm relatively new @ vba, , developing excel based tool creates 2 .xls files, paths saved in 2 variables. next step user has select these 2 files, right click , select application called compare . i wondering if process automated using shell commands in vba. please advise. yes, possible. assuming compare takes 2 files arguments, this: public function opencompare(strfileone string, strfiletwo string) dim x variant x = shell("compare.exe " & strfileone & " " & strfiletwo, vbnormalfocus) end function

maven - How to create multiple WAR files from single pom.xml? -

i having single build.xml, creating multiple war files project. doing migration ant build maven build. how create multiple war files single pom.xml? i suggest build multi module maven project, each war output of single module. @ mini guide multiple modules , multimodule reference more details. i hope helps.

php - CakePHP : Updating all tables after user edit? -

i working on cakephp website, of of works trying update users page (which redirect now, once have working planing on making ajax update). code work, if ($this->request->is('post')) { $this->loadmodel('setting'); $this->loadmodel('address'); if ( $this->user->save($this->request->data, $validate = true, $fieldlist = array('firstname','surname','homephone','mobilephone','dob','gender')) ) { $newuserid = $this->auth->user('id'); $this->session->write('auth', $this->user->read(null,$newuserid)); $this->session->setflash('update done :)', 'goodflashmsg', array(), 'good'); $this->redirect('/user'); } else { $this->session->setflash('sorry :( there has been error, please try again', 'badflashmsg',

php - Best practice to separate Backend / Frontend with single Laravel4 installation? -

i hear tips got real experience folder structure worked with. coming codeigniter , i'm trying figure out best way create backend (cms) , frontend (frontpage) ? here couple app structures want critics on, considering actual version of laravel 4.1.28 . structure 1 webapp backend app/ bower_components/ local_components/ node_modules/ public/ vendor/ artisan.php composer.json composer.lock contributing.md gruntfile.js package.json phpunit.xml readme.md server.php frontend app/ bower_components/ local_components/ node_modules/ public/ vendor/ artisan.php composer.json composer.lock contributing.md gruntfile.js package.json phpunit.xml readme.md server.php structure 2 webapp app/ bootstrap/ commands/

javascript - Load more WordPress posts on (infinite) scroll with AJAX -

i'm loading more posts via ajax when user clicks on 'load more' button. code i'm using based on tutorial: http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax/ my aim modify code more posts loaded when user scrolls bottom of page. i've tried replacing $('#pbd-alp-load-posts a').click(function() { }); with this: $(window).scroll(function(){ if ($(window).scrolltop() == $(document).height() - $(window).height()){ } }); when doing that, new posts loaded when user scrolls bottom of browser window second time, next set of posts not loaded page. using button click approach, new 'load more' button added page next set of posts loaded if user clicks again. how can scroll approach load next set of posts when user scrolls bottom of page again? in test, instead of using exact equality : if ($(window).scrolltop() == $(document).height() - $(window).height()) { ... } try using threshold, e.g. :

Use StrongLoop to monitor NodeJS application in Linux via proxy -

i trying monitor strongloop test application , following error: [root sls-sample-app]# slc strongops generating strongops configuration requires registered email , password. visit http://strongloop.com/register if have not already. please enter your: email address: xxx please enter your: password: xxx error: { [error: connect etimedout] code: 'etimedout', errno: 'etimedout', syscall: 'connect' } i have registered on strongloop website , provided registration details in above run attempt. rhel 6.3 machine connected internet via proxy. how can proxy configured? thank you slc strongops doesn't have proxy support yet, it's being worked on. in meantime workaround find api key yoru account profile when logged dashboard , create strongloop.json manually info shown here. http://docs.strongloop.com/display/doc/setting+up+strongops+monitoring#settingupstrongopsmonitoring-configuringyourapikey

html5 - Defining how 2 separate, overlapping canvases blend -

Image
i want put canvas on top of , define way contents blended. i have 1 white canvas black characters on it, , want highlight part of transparent blue rectangle, without having black characters in background turning dark blue. in fact, i need aspect i'd if merged 2 canvases globalcompositeoperation set "multiply" instead of default, while keeping both canvases separated , overlapping. here's have : here's want : i aware globalcompositeoperation allow me if merged 2 canvases one. i'd rather keep both canvases : background canvas displayed lib. can still draw in it, complicate things lot: i'd dependent on logic , have tweak mine , theirs make work, performance critical , solution imply more drawing @ 24fps, i'd struggle every time lib updated... all in seems way better keep away interfering lib. there way choose how overlapping canvases behave? thanks in advance! edit: we've thought of transforming white parts of background can

CSS: Vertical align content of an element -

i need vertical align span, thing makes complicated span needs occupy whole parent. jsfiddle so, html is <div> <span>ok</span> </div> css: div { width: 200px; height: 200px; background-color: lightgrey; } span { display: block; width: 100%; height: 100%; vertical-align: middle; } is possible without changing html ? update: although below answers correct , interesting, chose 1 used correct one! tell behave table: div { width: 200px; height: 200px; background-color: lightgrey; display: table; } span { display: table-cell; text-align: center; vertical-align: middle; } http://jsfiddle.net/9uae6/2/

debugging - Why does Evan's Debugger say that I'm moving to eax instead of rax? -

i'm moving values rax debugger displaying it's moving eax. what's matter it? debugger, nasm or knowledge? anyway of course code working perfectly. debugger i'm using evan's debugger. in nutshell, both , debugger correct. when move rax , affects rax , eax , ax , al , ah refer various subsets of same 64 bits: al lower 8 bits of ax ( ah upper 8 bits). ax lower 16 bits of eax . eax lower 32 bits of rax .

c# - XamlParseException when using converter -

i getting xamlparseexception when try use converter. suspect made mistake in converter can't catch it. full error text: a first chance exception of type 'system.windows.markup.xamlparseexception' occurred in system.windows.ni.dll additional information: cannot create instance of type 'app.converters.dimensiontotext' [line: 21 position: 42] namespace app.converters { class dimensiontotext : ivalueconverter { public object convert(object value, type targettype, object parameter, cultureinfo culture) { dimensions dim = (dimensions) value; //bool param = (bool) parameter; return dim.width.tostring().trim() + "\"x " + dim.length.tostring().trim() + "\"x " + dim.height.tostring().trim() + "\""; } public object convertback(object value, type targettype, object parameter, cultureinfo culture)

The name of the driver class for the datasource is missing (Netbeans+ PostgreSql + Glassfish) -

i'm trying develop ejb application using netbeans 8 on postgres 9.2 db , glassfish 4 server. once created connection pool , jdbc resources in glassfish admin panel, i'm not able add entities using datasource. netbeans still giving me error: the name of driver class datasource missing i've tried adding libraries project. copied postgresql-9.2-1002.jdbc4.jar , postgresql-9.2-1002.jdbc3.jar files in c:\program files\glassfish-4.0\glassfish\domains\domain1\lib folder . screenshot: http://imageshack.com/a/img843/6884/w3ko.png if create entities using connection created before(in nb services/databases), works, result set after query empty. idea? here connection pool created: http://imageshack.com/a/img838/8286/bkw8.png this persistence.xml: <?xml version="1.0" encoding="utf-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instan

java - Using Web Service Client JAXB Generated Classes as JPA Entities -

i working on project retrieve data soap webservice , store in database later use using jpa. presently, using spring ws client, , generating web service classes using jaxb. the goal replicate of data contained in these classes (which rather large) faithfully in database, , end mildly tempting apply jpa annotations jaxb generated classes. in long run seems dangerous, because generated classes seem rather ephemeral, , lot of work re-applying jpa annotations while regenerating code if wsdl ever changed. the other option have webservice client copy data jpa entities created me, possibly using factory pattern. decouples jpa persistence possibly changing whims of wsdl designer, , somehow feels safer. feels safer because entity classes can never overwritten build task. what best practice situation? obviously, excessive decoupling not pay off when means lots of data transfer objects, case special? should jaxb created classes used in webservice client, , forgotten higher level

php - Mupdate sql query return an error: limit 1 -

<?php // find current order $current_order_id = find_order_by_id($_get['order']); if(!$current_order_id){ redirect_to("orders.php"); } ?> <?php $id = $current_order_id["id"]; $menu_name = $_post["menu_name"]; $address = $_post["address"]; $contact = $_post["contact"]; $transaction = $_post["transaction"]; $flemingia = $_post["flemingia"]; $goat_manual = $_post["goat_manual"]; $lbc_tracking_no = $_post["lbc_tracking_no"]; $visible = $_post["visible"]; $query = "update orders set "; $query .= "menu_name = '{$menu_name}', "; $query .= "address = '{$address}', "; $query .= "contact = {$contact}, "; $query .= "transaction = '{$transaction}', "; $query .= "flemingia = {$f

c# - Windows Phone 8.1 Page Navigation -

i'm still new windows phone development. i'm going develop windwos phone 8.1. no idea what's problem page navigation. wrote code this private void hbgo_click(object sender, routedeventargs e) { this.frame.navigate(typeof(secondpage)); } but shows me error ( this page not contain definition "frame" , no extension method "frame" accepting first arguments ) put code of bottom same... frame.navigate(typeof(secondpage)); the navigation depends on kind of project: if windows phone 8.1 silverlight should use navigationservice.navigate() method : applies to: windows phone 8 , windows phone silverlight 8.1 | windows phone os 7.1 if targeting windows phone runtime should use frame.navigate method() : minimum supported phone windows phone 8.1 [windows runtime apps only]

mysql - I'm getting a syntax error on a mysqli query -

$updatevehicle=mysqli_query($con, "insert `vehicles` (make,model,plate_no)". "values ('$make', '$model', '$plate') `customerid` = '$customerid'")or die(mysqli_error($con)); this error message: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'where customerid = 12369' @ line 1 i've verified table exists , rows specified type case sensitive match database. thank help please review query should update query not insert query.

Implementing istream in a C++ Fraction Calculator -

i trying learn object oriented programming , make simple fraction calculator can add or subtract number of functions , write answer reduced fraction. example: input= 3/2 + 4/ 8 , output = 2 i trying overload operators in order accomplish this. so in program, trying develop input consists of expression made of fractions separated operators '+'or '-'. the number of fractions in expression arbitrary. each of following 6 lines example of valid input expression: 1/2 + 3/4 1/2 -5/7+3/5 355/113 3 /9-21/ -7 4/7-5/-8 -2/-3+7/5 the numerator and/or denominator of fraction given input may negative. trying make input consist of single expression on single line , end of input should detected detecting end of file. my incomplete fraction class defined in source file below: #include <iostream> using namespace std; #include "fraction.h" #include <stdexcept> class fraction { public: fraction::fraction(int a, int b); int find_

c++ - Program crashes due to undefined behavior -

so i'm writing program creates library collection of cds , displays them. program compiles crashes whenever write array of pointers songs file structs contained within array shown here: //get song array (int = 0; < num_songs; a++) { getline (infile, line); sub = line.c_str(); word = createstring(sub); length = substr(word, -1, 5); title = substr(word, 5, strlen(sub)); cd->song_array[a] = createsong(title,length); destroystring(word); } i think it's due undefined behavior, here's .cpp file happening in. #include <iostream> #include "cds.h" #include "cd.h" #include <fstream> #include <string> #include <cstring> using namespace std; //creates collection of cds cds* createcds(const char* file_name) { //declare variables , allocate memory int max_cds = 50; cds* collection = new cds; collection->

python - Comparing values in range -

have 2 variables 'wins' , 'clicks' values ranging 1 100k each. need flag when 'wins' in multiples of 150, , when 'clicks' 0 or 1? requirement: iteratively want increment both values if 150<=int(wins)<=300 , 0<=int(clicks)<=1: need flag when "wins in multiples of 150" , when "clicks 0 or 1 " try flag = (clicks in (0, 1) , (wins % 150) == 0) clicks in (0, 1) : means clicks either 0 or 1 (wins % 150) == 0 : means wins % 150 remainder zero, win divisible 150. check following: >>> clicks, wins = 0, 150 * 7 >>> flag = (clicks in (0, 1) , (wins % 150) == 0) >>> flag true >>> clicks, wins = 2, 150 * 7 >>> flag = (clicks in (0, 1) , (wins % 150) == 0) >>> flag false >>> note: if 'clicks' , 'winds' strings , need use typecase int(clicks) , int(wins) . in answer both winds , clicks int. edit: tried make

c# - Serialize List of objects fails with NullReferenceException -

in order support copy/paste in application, have make objects serializable able put them clipboard , them again there. works expected long there no list<xy> objects have serialized. this first part on 1 object: [serializable] public class parameter : gobserversubject, iserializable, iobserver { #region attributes private static readonly ilog log = logmanager.getlogger(typeof(parameter)); private int priority; private string name; private int id; private string description; private string comments; private list<value> values; private container mycontainer; private bool changed; private int order; private bool noupdate; #endregion } i implemented 2 methods: public virtual void getobjectdata(serializationinfo info, streamingcontext context) { info.addvalue("priority", priority); info.addvalue("name", name); info.addvalue("id", id); info.addvalue("changed",

android - Quickblox: Fetching custom object based on field value with '+' character seems not to work? How to fix? -

i trying fetch custom objects based on field value including '+' character. more specifically, fetching contact custom object has email address field. it works fine normal email addresses. however, have email addresses include '+' character , fetch fails. how should use qbcustomobjects.getobjects api call request builder? hints & tips appreciated! in advance! code: qbcustomobjectrequestbuilder requestbuilder = new qbcustomobjectrequestbuilder(); requestbuilder.eq("emailaddress", “matti@iloapps.com"); // works // but: matti+test001@iloapps.com not work qbcustomobjects.getobjects("contact", requestbuilder, new qbcallbackimpl() { @override public void oncomplete(result result) { // stuff here.. } }); i solved issue doing url encoding in order meet http post requirements special characters. thought have been done automatically qb library wasn't.. improvement add in next versions (like in ios library)?

c# - Inject controls in derived windows breaks xaml markup in combination with binding -

i trying inject layoutgrid , canvas windows, causes little headache: here windowbase class: public class windowbase : window { protected override void oninitialized(eventargs e) { base.oninitialized(e); if (content frameworkelement) { var originalcontent = content frameworkelement; var grid = new grid(); grid.datacontext = originalcontent.datacontext; content = grid; grid.children.add(originalcontent); var canvas = new canvas() { horizontalalignment = horizontalalignment.stretch, verticalalignment = verticalalignment.stretch }; grid.children.add(canvas); } } } my mainwindow thats inheriting windowbase looks this: xaml: <local:windowbase x:class="insertcanvastest.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/wi

Is it possible to call a batch file from watir? -

i trying call batch file watir-webdriver. using ruby watir. tried use system(filename.bat) doesn't work. i have written step definition , when run got error stack level deep (systemstackerror). and(/^i execute batch file$/) system('filename.bat') end

c - Why is an int resetting to zero after each iteration of for loop? -

as title says, have simple loop cumulative variable += value of calculation. however, after each iteration, variable being reset zero. why? here's loop: int score_board(board* b) { int i; int total_score = 0; for(i = 0; < 4; i++) { printf("current total = %d\n",total_score); total_score += score_line(grab_line(b, i, 0)); total_score += score_line(grab_line(b, i, 1)); printf("scored row , columnn %d\tcum total=%d\n", i, total_score); } return total_score; } and here's output i'm getting, proving while total_score set value want during 1 iteration, loses value upon resetting loop: current total = 0 line score = 11000 line score = 40000 scored row , columnn 0 cum total=51000 current total = 0 line score = 60000 line score = 50000 scored row , columnn 1 cum total=110000 current total = 0 line score = 20000 line score = 40000 scored row , columnn 2 cum total=60000 cu

c# - Telerik Tab Control - Only the currently SelectedPage shows controls visbility correctly -

i'm using 2013 q3 telerik tab control in c# winforms project. if test .visible property of control placed on page in tab return false unless select page. there property besides .visible can used test visibility of control on page without having select it? here's dilatation: should not change native meaning of control's properties. period. asked in comment trying achieve, because suspected you're basing ui logic on control's visibility, in opinion isn't approach. visibility should bound background logic, not oposite. you're hiding controls reason, because @ point happened - keep track of "something" instead of inspecting results. imo visibility property should set, never checked. alternatively if it's not possible change concept reason, workaround i'd attach handler visiblechanged event , set enabled property if sender not tab control - checking against enabled property you'd know whether control in use or not. find

html5 - how to show html code as text in html webpage -

i'm asking on how show html code on tutorial html website, example show user how make link? <a href="#">text</a> thanks in advance with cdatasection. cdatasection object represents cdata section in document. a cdata section contains text not parsed parser. tags inside cdata section not treated markup , entities not expanded. you can use in xml sample : <![cdata[<tag>some text</tag>]]> it interpreted such : &lt;tag&gt;some text&lt;/tag&gt; or in program output. sample css : <style type="text/css"> /*<![cdata[*/ body { background:black; } /*]]>*/ </style> hope you.

soa suite - Invoke stored procedure through DBAdapter in a non blocking way -

i understand how can invoke through bpel stored procedure in non-blocking way. concern have stored procedure (in dbadpater) i'm invoking, takes time (around 30 minutes) , cannot wait until finishes. i'm trying setting in composite application invoke property "nonblockinginvoke" doesn't work, adapter blocking until respsonse. thanks. nonblockinginvoke use in flow when want separate thread of execution sync invoke branch, doesn't block other flows. flow cooperative parallel - not true parallel. sync invoke still blocks during call. read more here . anyway, 1 solution problem have new composite calls async composite uses db adapter execute stored proc. so, new service calls other service async, won't block - service calling db adapter blocks, @ point, invoker free. it's not bad idea wrap db adapter calls in own composite decouple/isolate true service implementation db service interface - can cahange.

c - Printing a number in Binary always prints in Normal form(BIG Endian) even when my computer is Little Endian? -

first of all, using user defined function called showbin() print binary of integer.as can see function checks each bit of given number right position left position(msb lsb). am using union 2 members, have stored 512 in first member (short unsigned int a) ,( we know normally(in big endian) binary of 512 0000 0010 0000 0000 ) , in next step tried print values of array c[0] , c[1] machine little endian it outputs : 0 2 ,now means under hood(in memory) binary stored as: 0000 0000 0000 0010 but when print value of a using showbin() shows 0000 0010 0000 0000 in normal(big endian) way, why not output in little endian way i,e 0000 0000 0000 0010 ???? .even if computer stores number in big endian should output 2 0 right?? ???? confused..????..can 1 please explain behavior in simple words. void showbin(unsigned short int a); int main() { union myun { short unsigned int a; //2 bytes char c[2]; //2 bytes }; union myun som; som.a=512; pr

Mean and SD in R -

maybe easy question. data.frame: > read.table("text.txt") v1 v2 1 26 22516 2 28 17129 3 30 38470 4 32 12920 5 34 30835 6 36 36244 7 38 24482 8 40 67482 9 42 23121 10 44 51643 11 46 61064 12 48 37678 13 50 98817 14 52 31741 15 54 74672 16 56 85648 17 58 53813 18 60 135534 19 62 46621 20 64 89266 21 66 99818 22 68 60071 23 70 168558 24 72 67059 25 74 194730 26 76 278473 27 78 217860 it means have 22516 sequences length 26, 17129 sequences length 28, etc. know sequence length mean , standard deviation. know how it, know creating list full of 26 repeated 22516 times , on... , compute mean , sd. however, thing there easier method. idea? thanks. for mean: (v1 %*% v2)/sum(v2) for sd: sqrt(((v1-(v1 %*% v2)/sum(v2))**2 %*% v2)/sum(v2))

javascript - How to get max zoom for maptype in location -

on google maps' js api reference page , says method getmaxzoomatlatlng : returns maximum zoom level available @ particular latlng satellite map type. for reason, terrain maptype bottoms out @ level 15 in calgary (for example) satellite maptype can go way zoom 19 . have 2 map services running simulataneously, , want maps in sync, can't sync if can't reach same zoom level. so, i want know when terrain map (or maptype) can't cope, , trigger special case functions. is there method, or alternative, getting maximum zoom location specific map type (since above mentioned method works satellite)? well, 1 solution i've decided go in meantime attach zoom-end handler arcgis map (could leaflet well) , maptypeid_changed handler google map. so, arcgis map ( emap ) did this: emap.on('zoom-end', function (e) { // map zooms synced gmap.setcenter(esri.geometry.webmercatortogeographic(e.extent.getcenter())); gmap.setzoom(e.level);

jquery - throw an alert if a key is pressed inside a textbox -

i trying this, not working. there way of doing differently? if($("#user_password").keypress()){ alert("hello"); } user_password id of textbox on login screen. i have canceled event textboxes when push enter, want allow them press enter in password field on login page. complete code is: $(document).keypress(function (e) { if($("#user_password").keypress()){ alert("hello"); } if(e.which == 13 && e.target.nodename != "textarea") return false; }); you need set event handler, if statements aren't relevant here: $("#user_password").keypress(function () { alert("hello"); }); if want find out element triggered event, @ event's target property: $(document).keypress(function (e) { if (e.target == $("#user_password")[0]) alert("hello"); if(e.which == 13 && e.target.nodename != "textarea") return false; });