Posts

Showing posts from February, 2013

reduction - Prove NP-completeness of CLIQUE-OR-INDEPENDENT-SET -

first of all, want mention homework . however, solve problem can use literature want. even though think problem clear name, give description: "for given undirected graph g , given integer k, g contain totally connected (clique) subgraph of size k or totally disconnected subgraph (independent set) of size k." i know polynomial reductions 3-sat clique , 3-sat independent-set . ( http://mlnotes.com/2013/04/29/npc.html ) however, have problem 1 because cannot combine 2 reductions. tried reduction clique clique-or-independent-set without success. so appreciate hints! thanks in advance. i found out reduction problem independent-set clique-or-independent-set . need add n isolated vertices graph g (which instance of independent-set , has n vertices). let call newly created graph g' (instance of clique-or-independent-set ). not hard prove g has k independent-set iff g' has n+k independent-set of clique (since, construction, cannot have n+k c

actionscript 3 - is there a way to loop something in infinite speed and not every frame? -

so, if i'm checking in enterframe event listener, , want check (if happens) this. somehow checking every frame slow. there way check in infinite speed , not every frame, when checks something, instantly changes position? technically, there no way check faster once per frame, if have frame rate @ 60fps. timer limited trigger @ 60 times per second, , same speed can setting stage.framerate too. but, if checking, example, collision of flies fast , obstacle, before obstacle in current frame, , past next frame, can use derivative of axis-aligned bounding box collision detection, , transition collision detection (a probable example here) , checking if path intersects bounding box in time between 2 frames. if checking process depends on factors , time, , can check condition in frame , previous frame, can interpolate process between frames in conventional enterframe listener , check if condition seeking might happen in between, , if might, might check whether did happen

android - transferring audio files via WebSocket -

i have send , receive audio file via websocket using mobile devices. clients android, ios , wp. guys have idea how accomplish this? thought encode file base64 , send string, maybe there better way this? websocket should use? thanks send audio file sequence of binary frames. websocket libraries provide means send , receive binary data. see 5. data framing in rfc 6455 details binary frames.

Single Sign-On on Bluemix: how to retrive user profile after binding SSO service to Liberty -

i create app, , bind liberty. works fine. how user profile after user login? saw there "return-to url" in integration tab: https://ssoconfigboard.mybluemix.net:443/oidcclient/redirect/rwuyaliy78 but after visit url, got 500 server error: error 500: srve0295e: error reported: 500 anybody can help? i ran same issue using liberty bluemix sso service , found link extremely helpful: https://www-304.ibm.com/connections/blogs/sweeden/entry/getting_started_with_ibm_single_sign_on_for_bluemix?lang=en_us the key point here user info embedded in hashtable of private credentials. not obvious @ all. if download source code included blog you'll find java class called: userhelper.java. class extract things user name , e-mail address wssubject. i ended providing rest interface in web app allow users authenticated using oauth access own user information. i think 1 of reasons cryptic there hole in java oauth api standards in area wssubject class workaround provide wa

How to query for two fields in one and the same tuple in an array in ElasticSearch? -

let's there documents in index this: { "category":"2020", "properties":[ { "name":"foo", "value":"2" }, { "name":"boo", "value":"2" } ] }, { "category":"2020", "properties":[ { "name":"foo", "value":"8" }, { "name":"boo", "value":"2" } ] } i'd query index in way return documents match "foo":"2" but not "boo":"2" . i tried write query matches both properties.name and properties.value , i'm getting false positives. need way tell elasticsearch name , value have part of same properties tuple. how can that? you need map properties nested type . mapping similar this: { "your_type": { "prope

php - 500 (Internal Server Error) ajax get datatable laravel -

i'm using datatable showing record , using laravel backend in localhost show data in datatable. when run in homestead, have error: "500 (internal server error)" in ajax here json data: [{"id":11,"uid":null,"email":"muhghazaliakbar@live.com","username":"muhghazaliakbar","oauth_provider_id":null,"activated":1,"activation_code":null,"activated_at":"2015-05-31 03:54:29","last_login":null,"persist_code":null,"reset_password_code":null,"created_at":"2015-05-31 03:54:29","updated_at":"2015-05-31 03:54:29","deleted_at":null},{"id":12,"uid":null,"email":"nurindahsari@live.com","username":"nurindahsari","oauth_provider_id":null,"activated":1,"activation_code":null,"activated_at":&q

angularjs - Permission denied while installing Yo -

i'm trying set yo use angular generator project. following steps detailled here: http://yeoman.io/learning/index.html i have node.js , npm installed. but when use command: sudo npm install -g yo bower grunt-cli it fails , error: > spawn-sync@1.0.11 postinstall /usr/lib/node_modules/yo/node_modules/cross-spawn/node_modules/spawn-sync > node postinstall fs.js:439 return binding.open(pathmodule._makelong(path), stringtoflags(flags), mode); ^ error: eacces, permission denied '/usr/lib/node_modules/yo/node_modules/cross-spawn/node_modules/spawn-sync/package.json' @ object.fs.opensync (fs.js:439:18) @ object.fs.writefilesync (fs.js:978:15) @ object.<anonymous> (/usr/lib/node_modules/yo/node_modules/cross-spawn/node_modules/spawn-sync/postinstall.js:20:6) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.j

angularjs - Implement ngClick in angular-deckgrid? -

i trying implement ngclick event in angular-deckgrid. per documentation , have implemented same, in vain. click not being fired. using angular ui router states provide data view. below code snippet <button name="left" data-ng-click="mother.left()">left</button> <button name="right" data-ng-click="mother.right()">right</button> in state of ui router, sample.left=function(){ alert('left'); } but alert never fired. doing wrong? a small mistake has caused error. specify "mother.sample.left()" on data-ng-click. worked fine.

c++ - What is the difference between (void*) and (void(*)(argument type)) cast? -

this question has answer here: why function pointers , data pointers incompatible in c/c++? 14 answers void funcptr(int a); int main(){ int k=1; void (*funcptr2)(int); funcptr2 = (void*)(funcptr); // funcptr2 = (void(*)(int))(funcptr); (*funcptr2)(k); return 0; } void funcptr(int a){ printf("%d", a); } what difference between (void*) , (void(*)(argument type) in function pointer type casting? as result, not occur warning. is wrong? (void*) type casting is wrong? (void*) type casting yes, is. c standard doesn't allow conversion of function pointer object pointer or assignment between them. if compiler warning level, may warnings/errors such compiling with: gcc -wall -wextra -pedantic-errors -std=c11 file.c i not sure why thought casting function pointer. provided function pointer type matches functi

asp.net web api odata - Is there a way to prevent addition of default ODataMediaTypeFormatters to configuration? -

i trying customise behaviour of standard odatamediatypeformatters , have done wrapping them in type extends mediatypeformatter. e.g. var formatters = odatamediatypeformatters .create(serialiserprovider, deserialiserprovider) .select(formatter => new wrapper(formatter)); config.formatters.insertrange(0, formatters); after webapi configuration method has executed config.formatters contains 12 items (7 of wrapped formatters). however, when response being serialised config.formatters contains 17 items standard odata formatters have been re-added @ point. relevant standard formatter used in preference wrapped version. does know when re-addition happens , if/how can prevented? i figured out when realised formatters not re-added globalconfiguration.configuration.formatters, controllercontext.configuration.formatters. the odatacontroller annotated odataformattingattribute. checks see if controller's configuration contains oda

javascript - Bootstrap multiselect dropdown is not visible -

Image
despite fact can make bootstrap-multiselect work in independent file, i'm not able see dropdown list once click on caret, if included in portal files. i have used bootstrap-datepicker, datetimepicker, chosen, , backbone.js this line supposed trick $('.insightlist').multiselect({ selectalltext: true }); does have idea of can cause not adding class 'open' 'btn-group'? ![on click there btn-group class div whether should add open class][1] in advance i've created jsbin solve problem working demo . <!doctype html> <html> <head> <script src="http://code.jquery.com/jquery.min.js"></script> <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" /> <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> &l

Importing CSS into LESS -

is there option in less import contents of css file rather adding @import directive? example //example.less @import url("../css/site.css"); @import url("components.less"); //example.css @import url("site.css"); // don't want this! .component1 { ... } .component2 { ... } can done less? in less have different options importing. syntax: @import (keyword) "filename"; the following import directives have been implemented: reference: use less file not output it inline: include source file in output not process it less: treat file less file, no matter file extension css: treat file css file, no matter file extension once: include file once (this default behavior) multiple: include file multiple times optional: continue compiling when file not found more 1 keyword per @import allowed, have use commas seperate keywords: example: @import (optional, reference) "foo.less";

python - Unable to run the Theano CNN.py file for a different dataset -

i have converted dataset in form of mnist.pkl.gz file , runs logistic_sgd.py , mlp.py programs given in theano deeplearning tutorial pdf (university of montreal). on running cnn.py file gives huge error difficult understand. can has succesfully run cnn.py program different dataset me out here totally clueless error is. training set has 1176 entries , validation , test set has 168 entries each. maybe problem batch size. if can please suggest me appropriate batch size? i using spyder gui python 2.7 comes anaconda bundle. error occurs after printing '... building model' code snippet: print '... building model' # reshape matrix of rasterized images of shape (batch_size, 28 * 28) # 4d tensor, compatible our lenetconvpoollayer # (28, 28) size of mnist images. layer0_input = x.reshape((batch_size, 1, 28, 28)) # construct first convolutional pooling layer: # filtering reduces image size (28-5+1 , 28-5+1) = (24, 24) # maxpooling reduces further (24/2, 24/2) = (12,

Windows azure web role -

we have planned migrate our application web role web role splits server traffics other instances. have queries regarding . let me post 1 one. 1) since web role involves multiple instances (redirecting different servers @ run time based on number of instances created), happens session related details maintained in 1 server (with inproc mode resides in iis ) when next requests gets redirected other server session related details wont available know? windows azure takes copy of or need manully handle? 2)our application works presentation layer makes call web service in turn queries database , results displayed accordingly (presentation -> webservice -> database). when making presenataion layer cloud service web role obvioulsy need make service web role . right? 2.1) if so, happens when making request presentation how requests carried ? 2.2) having database in separated vm (not azure db) hosted in sql express when service dynamically creates multiple instances happens d

osx - XCode will build 'debug' but not 'release' because "<Module>-Swift.h" header is not found -

g'day, this killing me framework project builds without error or warning in debug configuration, when try build archive fails because <module>-swift.h not found. apparently it's not being generated in configuration. sometimes when happens (in debug) can delete references swift header, build put rebuild fix it. not when building release. all swift related build settings same debug release. here example of error build log, note file lbimageview.swift not import except foundation. make no reference drhexperimentdata class: compileswift normal x86_64 /users/l.walsh/documents/developer/labbot/lbimageview.swift cd /users/l.walsh/documents/developer/labbot /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /users/l.walsh/documents/developer/labbot/lbimageview.swift /users/l.walsh/documents/developer/labbot/lbsize.swift /users/l.walsh/documents/developer/labbot/lbdatamatrix.swift /users/l.walsh

linear programming - How to formulate x != y in lpsolve? -

i'm trying formulate variables x,y,z must different , accept values 1, 2 or 3 (this is, of course, toy example): min: x+y+z; 1 <= x <= 3; 1 <= y <= 3; 1 <= z <= 3; but make work still need either access boolean operators or != operator, don't seem exist in lpsolve! how can go this? wanted this: x != y; x != z; y != z; thanks edit: here's current code: /* objective function */ min: 1; /* variable bounds */ 1 <= x1 <= 4; 1 <= x2 <= 4; 1 <= x3 <= 4; 1 <= x4 <= 4; x1 + x2 + x3 + x4 = 10; x1 < x2; x2 < x3; x3 < x4; int x1; int x2; int x3; int x4; lpsolve giving me result: x1 = 1 x2 = 3 x3 = 3 x4 = 3 which wrong. why?

scala - How to compose functions that return Validation? -

this follow-up previous question suppose have 2 validating functions return either input if valid or error messages if not. type status[a] = validationnel[string, a] val ispositive: int => status[int] = x => if (x > 0) x.success else s"$x not positive".failurenel val iseven: int => status[int] = x => if (x % 2 == 0) x.success else s"$x not even".failurenel suppose need validate instance of case class x : case class x(x1: int, // should positive x2: int) // should more need function checkx: x => status[x] . moreover, i'd write checkx composition of ispositive , iseven . val checkx: x => status[x] = ({x => ispositive(x.x1)} |@| {x => iseven(x.x2)}) ((x.apply _).lift[status]) does make sense ? how write checkx composition of ispositive , iseven ? there lots of ways write this, following: val checkx: x => status[x] = x => ispositive(x.x1).tuple(iseven(x.x2)).as(x) or: va

c# - Intresting behaviour of IPAddress.TryParse -

i'm using ipaddress.tryparse validate ip address, if use if (ipaddress.tryparse("192.168.1.009", out ip) it fails, but if (ipaddress.tryparse("192.168.1.007", out ip) passes. if last digit 8 or 9 fails on valid ip address. i'm not sure work? quick guess: 009 , 007 interpreted octal numbers, whereas 007 valid number in base-8 , 009 not. try if (ipaddress.tryparse("192.168.1.9", out ip)) instead.

iphone - How can i implement localization functionality in ios? -

i'm developing ios application default language english. want localize hungarian language. how can translate complete app hungarian? how can implement localization functionality in ios? try tutorial taken ray wenderlich site: http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014

windows - Nodemon isn't recognized -

when run nodemon on windows 8 isn't recognized command. when steps in accepted answer of post work s - have repeat same thing every time open terminal. how fix this? i want run nodemon if global without hassle. thank you edit: i found answer , here you should set environment variables point npm installed packages.

c# - Unity vs iOS and for loops not executing the same way? -

i trying produce scrolling list based on how many games user has active. works fine in unity editor reason not working same way when build ios unit? here doing: int = 0; debug.log ("1. myturn count: "+myturn.count); list<parseobject> myturnlist = new list<parseobject>(myturn.values); myturnlist.sort((e1,e2) => e1.get<string>("lastmovetime").compareto(e2.get<string>("lastmovetime"))); debug.log ("2. myturnlist count: "+myturnlist.count); for(int x = 0;x <= myturnlist.count;x++){ if(x == myturnlist.count){ activegames[i].setactive(true); moregamesspacer(i); i++; } else { activegames[i].setactive(true); gamelogic(myturnlist[i],i); i++; } } in unity editor 2 debug.logs comes out number 4, in ios unit comes out zero? in both cases produces list, can see script should produce 4 games before "moregames" in list. in unity correct, on ios &quo

android - Optimize way to use ViewPager? -

i'm writing application need show 100 page in viewpager. there facility jump 1 index direct random index page. here every page self contain list of item. now if user viewpager.current(index) jump 1 random index page..then ui stuck moment , display. so avoid thought implement 7 adapter page view..where these 100(getcount()) page reuses these 7 page. but im'm getting e/androidruntime(25961): java.lang.illegalstateexception: fragment added: arraylistfragment{24dad9b6 #0 id=0x7f060009} e/androidruntime(25961): @ android.support.v4.app.fragmentmanagerimpl.addfragment(fragmentmanager.java:1192) e/androidruntime(25961): @ android.support.v4.app.backstackrecord.run(backstackrecord.java:616) e/androidruntime(25961): @ android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1484) e/androidruntime(25961): @ android.support.v4.app.fragmentmanagerimpl.executependingtransactions(fragmentmanager.java. i'm using fragmentstatepageradapte

active directory - Change default GPO namespace? -

we have set test domain controller examine settings before pushing them production @ work. upon setting domain simple error made in dns settings. forgot subdomain. testdomain.com rather site1.testdomain.com . we found way change majority of references, group policy objects not being applied correctly. when running rsop.msc . error: rsop data invalid invalid namespace did bit of digging , seems when create group policy, , click edit, name not reflect servers fqdn. dc01.testdomain.com rather dc01.site1.testdomain.com . how can change name space? or forced reset , re-run dcpromo.exe , ensure correct settings time? i have found problem. we renamed our domain using rendom.exe , changed settings in forest. , removed testdomain.com zone in dns settings. however! failed change domain on domain controllers dns suffix through system properties (system properties > advanced system settings > computer name > "to rename computer..." > "

java - Is there any way to create an array with two different values? -

i want create associative array (key, value) without using collections. i saw many hashtable functions on internet found random index assignment single value @ time modular operations. what want bidimensional array integer keys , string values allocating random index % operations each key. i know can collections , hashtable objects, want own. you can use 2 arrays. 1 array store keys while other array store values. , can make sure in myhashmap class implement methods in way both arrays updated when 1 updated.

interval by 4 using sql - Mysql -

i've table , want data interval 4 or, when i'm using modulo record not expected, pfb ` select (date_format(subscribed_from, '%y-%m')) date_ subscription operator = 'tim' , date_format(subscribed_from, '%y-%m-%d') between '2013-01-01' , '2014-12-31' group (date_format(subscribed_from, '%y-%m')); it show record this 2013-01 2013-02 2013-03 2013-04 2013-05 2013-06 2013-07 2013-08 2013-09 i want take data interval 4, below record expected. 2013-01 2013-05 2013-09 2014-02 and interval 2, below record expected 2013-01 2013-03 2013-05 2013-07 2013-09 if using modulo % 2 start 2013-01 , jump 2, problem if range want start 2013-02, 02 self not showing on result. if clause month start 2 given interval such 2,4,6,8,10,12 select date_, sum(the_metric_you_want_to_aggregate) ( select 4*floor( (date_format(subscribed_from, '%y%m') - 201301) /4) date_, the_metric_you_want_to_aggregat

eclipse - R cannot be resolved to a variable : Android -

Image
i'm new android , stuck error. imported existing project eclipse. plz me solve this. googled lot. can't solve this. thanks in advance possible problems: 1- possible have 2 resources have same name! 2- in 1 of files must have imported wrong r package... 3- or have resource (like image) has same name of resource in android sdk files 4- try rebuild , cleaning project i think problem no.2.. try delete every import statement has imported r package, import suggested r package yourself

java - finding the index of the largest element in an array -

i want write code returns index of largest element in given array. however, when try compiling, message can't seem understand. although have done things error message tells, keeps telling me fix them. please novice programmer! public class largest { int[] array = new int[10]; array[0] = 100; array[1] = 200; array[2] = 300; array[3] = 400; array[4] = 500; array[5] = 600; array[6] = 700; array[7] = 800; array[8] = 900; array[9] = 1000; int index; public static void main(string args) { (int i=0; i<10; i++) { if (array[i] < array[i+1]) { index = + 1; } else { index = i; } i++; } system.out.println(index); } } and below compilation message. largest.java:3: error: ']' expected array[0] = 100; ^ largest.java:3: error: ';' expected array[0] = 100; ^ largest.java:3: error:

javascript - * sign in regexp forces to match a letter -

i want match word , 0 or more letters after it. have constructed following regexp : /test\w*/ \w letter, * 0 or more match. works incorrectly. matches testing tests , not test itself. here code using testing: console.log(new regexp("test" + "[\\w*]").test("tests")); // true console.log(new regexp("test" + "[\\w*]").test("test")); // false - should true console.log(new regexp("test" + "[\\w*]").test("test-")); // false console.log(new regexp("test" + "[\\w*]").test("testing")); // true console.log(new regexp("test" + "[\\w*]").test("test@")); // false update expression works wanted in regexr.com the * inside brackets doesn't means 0 or more, literally char * matched. edited: if not want match words "test-" , use end of string anchor $ this: console.log(new regexp("test" + "\\w*$&quo

How to read and write Map<String, Object> from/to parquet file in Java or Scala? -

looking concise example on how read , write map<string, object> from/to parquet file in java or scala? here expected structure, using com.fasterxml.jackson.databind.objectmapper serializer in java (i.e. looking equivalent using parquet): public static map<string, object> read(inputstream inputstream) throws ioexception { objectmapper objectmapper = new objectmapper(); return objectmapper.readvalue(inputstream, new typereference<map<string, object>>() { }); } public static void write(outputstream outputstream, map<string, object> map) throws ioexception { objectmapper objectmapper = new objectmapper(); objectmapper.writevalue(outputstream, map); } i'm not quite parquet but, here : schema schema = new schema.parser().parse(resources.getresource("map.avsc").openstream()); file tmp = file.createtempfile(getclass().getsimplename(), ".tmp"); tmp.deleteonexit(); tmp.delete(

postgresql - python - how to properly quote sql string -

how quote string postgres sql syntax within python script uses psycopg2's cur.execute ("select .. ") postgres sql: select 'alter table rename ' || tablename || ' ' || regexp_replace ( tablename, '_foo$', '_bar' ) || ';' pg_tables tablename '%_foo'; within python script: cur.execute("select 'alter table rename ' || tablename || ' ' || regexp_replace ( tablename, '_foo$', '_bar' ) || ';' pg_tables tablename '%_foo'") simply, add line breaks: cur.execute("select 'alter table rename ' || tablename || ' ' || \ regexp_replace ( tablename, '_foo$', '_bar' ) || ';' \ pg_tables \ tablename '%_foo'")

Polymer 1.0 Iron-Ajax -

i trying data via php script works in polymer 0.5. null response , no errors in polymer 1.0, below code. have tried modifying php echo no response. hresponse fire @ point request information in ajax response information null. cannot find example see have gone wrong. thanks <iron-ajax id="ajax" url="" params="" handle-as="json" on-response="hresponse" debounce-duration="300"> </iron-ajax> , script setajax: function(){ this.$.ajax.url = "scripts/getnotes.php"; this.$.ajax.params='{"sn":"vba056"}'; this.$.ajax.generaterequest(); } hresponse: function(e) { console.log(e.detail.response); console.log(this.$.ajax.lastresponse); } when add this.$.ajax.params= inside script, should object. when place inside iron-ajax.html request generated, see why case. adding string. try set line this.$.ajax.p

java - Spring security check the user is logged or not when click a button -

i'm creating simple web application online flight reservation system using spring mvc spring security. i've created following table show flight details. <table class="table table-bordered table-hover table-striped "> <thead> <tr> <th>flight no</th> <th>flight destination</th> <th>flight origin</th> <th>flight date</th> <th>flight time</th> <th>book now</th> </tr> </thead> <tbody> <form:form commandname="reserv" cssclass="form-horizontal"> <c:foreach items="${flightinfos}" var="flightinfo"> <tr> <td>${flightinfo.flightno}</td> <td>${flightinfo.destination}</td> <td>${flightinfo

Sending an email in Iron Python taking forever -

so i'm trying send email in iron python 2.7, , nothing has worked me. combined bunch of different bits of code got try , workaround issue. basically, need send zip file without using localhost because i'm assuming client computer won't have localhost. here code: # send email def sendemail(): # set standard variables send_to = ["*******@live.com"] send_from = "********@outlook.com" subject = "new game info" text = "some new info you. automated message." assert isinstance(send_to, list) msg = mimemultipart( from=send_from, to=commaspace.join(send_to), date=formatdate(localtime=true), subject=subject ) print "created mime..." msg.attach(mimetext(text)) print "attached message..." open("templog.zip", "rb") fil: msg.attach(mimeapplication( fil.read(), content_disposit

ios - Autolayout Constraints Breaking on Widths Equally -

Image
i applying constraints using ib on few views learning purposes. constraint "width equally" applied on red , blue view. apply shows yellow line autolayout constraint. both views have width 258. here image: this expected behavior. fix it, must add additional constraints until red , blue views constrained. when view has no constraints on whatsoever, interface builder assumes want literally positioned on canvas currently. however, view has @ least 1 constraint, auto layout takes over. in screenshot, auto layout complaining because have specified width of red , blue views – , each other, in must equal. you'll need make sure both red , blue views have both x , y location , width , height defined.

c++ - Invoke the copy construction of a derived class from a pointer to the base class? -

i have 1- class {int m;}; 2- class b: public {float n;}; 3- class c: public {string n;}; i store instances of class in vector <class a*> myinstansesofa; it stored pointer because dynamically create them according if statement if (some condition) { a* newa = new b(); myinstancesofa.push_back(newa ); } else { a* newa = new c(); myinstancesofa.push_back(newa ); } now need create exact copy of vector. new set of pointers, exact copy of data. problem in copying data each instance of (which b , c) new vector. i tried following doesn't work. for (vector<a*>::const_iterator = myinstancesofa.begin(); != myinstancesofa.end(); ++it) { a* newa = new a(*(*it)); myinstancesofa.push_back(newa ); } i suspect error occurs because of "new a" invokes copy constructor type , not invoke of b or c (i dubugged , found happening). how can solve ? i believe cannot invoke constructor that, , there no str

Magento Upgrade 1.3 1.4 Pear Error Invalid Argument foreach -

hello trying upgrade magento 1.3 1.4. using guide http://astrio.net/blog/magento-upgrade-guide/ i tried command ./pear upgrade -f magento-core/mage_all_latest-stable i got error notice: array string conversion in pear/rest/10.php on line 85 php notice: array string conversion in /home/www/sss/staging.mysite.net/public/downloader/pearlib/php/pear/rest/10.php on line 85 so tried magento upgrade pear error ( command ./pear channel-update connect.magentocommerce.com/core ) .. gives me error: updating channel "connect.magentocommerce.com/core" channel "connect.magentocommerce.com/core" not responding on http://, failed message: file http://connect.magentocommerce.com:80/core/channel.xml not valid (received: http/1.1 404 not found ) trying channel "connect.magentocommerce.com/core" on https:// instead cannot retrieve channel.xml channel "connect.magentocommerce.com/core" (file https://connect.magentocommerce.com:443/core/channel.xml n

github - How to import googlesamples/android-UniversalMusicPlayer to my android studio -

Image
i'm newer in android , wish import this project android studio. how it? read this full document. explain in details step step whats need done. step 1: install git windows it can downloaded free git-scm.com. most settings available during installation process should compatible android studio. choose settings deem appropriate. step 2: link git executable android studio open android studio , got settings. in setting dialog open page version control / git. here define path git executable have installed. step 3: path repository github go github page , https path repository. instance: https://github.com/mxro/wallofthewiseandroid.git step 4: import git project android studio go android studio , go menu / vcs / checkout version control / git fill in required information: username, password, url etc now project should imported android studio , should able commit , push future changes github.

How to pass a variable between functions in Python -

sorry long code, felt important include trying accomplish. beginner python , programming in general , trying make simple text-based adventure game. game working @ first until added encounter bees. ran program , chose run bear, hp should @ 40, displayed. however, when chose swat bees, hp should @ 0 because 40(my current hp)-40=0. hp displayed @ 60, if bear encounter never happened. there way can fix or limitation in python? from sys import exit time import sleep import time #hp @ start of game: hp = 100 #the prompt inputs prompt = "> " #bear encounter def bear(hp): choice = raw_input("> ") if "stand" in choice: print "the bear walks off, , continue on way" elif "run" in choice: print "..." time.sleep(2) print "the bear chases , face gets mauled." print "you barely make out alive, have sustained serious damage" hp = hp-60 curre

CORS error for rails API -

i building rails api , when send request app (on different subdomain api) following response: xmlhttprequest cannot load http://api.myapp.dev/v1/posts/create. request header field content-type not allowed access-control-allow-headers. i don't understand why happening, since in rails controller have set headers['access-control-allow-headers'] = '*' . my app/routes.rb file : rails.application.routes.draw namespace :v1, defaults: {format: 'json'} # take care of cors match "*all", to: "api#cors_preflight_check", via: [:options] # routes posts 'posts(/index)', :to => 'posts#index' post 'posts/create' delete 'posts/:id', :to => 'posts#destroy' 'posts/show' put 'posts/:id', :to => 'posts#update' # routes post comments 'posts/:post_id/comments(/index)', :to => 'comments#index' post 'posts/:pos

debugging - Transferring large application to Android Wear through Android Studio -

i developing large application android wear through android studio (~200 mb). trying test application on lg g watch r through "debugging on bluetooth" taking lot of time send large app watch. are there alternatives / faster methods send application watch testing? thank you. edit: i have fixed issue ianhanniballake's advice. turns out usb driver not correctly installed on pc. similar issue should reinstall google usb driver following tutorial . thank again. the dock comes lg g watch r can plugged computer, allowing use faster usb connection install wear app.

java - persisting relationships in datastore - app engine and objectify -

my app using objectify. i'm new nosql . i have data model this. pay no attention lack of getters , setters, lack of builder pattern, etc. example. as can see, reallyweirdcar root of quite deep object graph. now, suppose build reallyweirdcar object in memory using given method. also, assume datastore empty. how save object using objectify ? is ofy().save().entity(rwc1) enough save entire object graph in 1 shot ? how persist relationships ? also, consider "good"(performant) model if of time i'm executing queries "find cars solicited customer john" thx in advance @entity class reallyweirdcar { @id public string id; public string name; @load public ref<engine> e1; @load public ref<engine> e2; // reference customer solicited construction of car @index @load public ref<customer> customer; } @entity class customer { @id public string id;

meteor - cfs:s3 how to get url after upload? -

i cannot understand how cfs:s3 work. on client have images = new fs.store.s3('images') @images = new fs.collection "allimages", stores: [images] filter: allow: contenttypes: ['image/*'] on server same keys. , change event "change .file-image": (e) -> console.log("changed!") fs.utility.eachfile e, (file) -> images.insert file, (err,fileobj) -> console.log 'fileobj',fileobj and after cannot understand do, how upload , url? when create cfs object you'll typically want retain _id , example: let imageid = images.insert file or images.insert file, (err,fileobj) -> let imageid = fileobj._id cfs might take awhile finish loading file , url isn't available until upload finished. let url = fileobj.isuploaded() ? fileobj.url() : null in blaze might like: {{#if this.isuploaded}} <a href="{{this.url}}">download file</a> {{else}}

android - ClassCastException / ArrayIndexOutOfBoundsException by trying to make a RecyclerView to handle multiple types of viewholder -

i've problem recyclerview. let me explain problem in detail. try implement recylerview 4 different kinds of child views. followed how-to " double wong ". have 4 viewholders extended 1 main viewholder, @ oncreateviewholder() choose 1 of them should initialized. override getitemviewtype() method. works fine, long childs of type 0. (type 0 means item not in database, type 1 - 3 means different flags in database). sometimes arrayindexoutofboundsexception , classcastexception , i cant figure out pattern . here comes code, made cuts make shorter. the fragment public class sucheserienfragment extends fragment { ... public list<pair<serieinfo, integer>> listtvshows; private seriecardviewsucheadapter seriecardviewsucheadapter; ... private class loadserie extends asynctask<string, void, string> { @override protected string doinbackground(string... search) { ... int type;