Posts

Showing posts from February, 2010

vbscript - Compressed (zip) Cannot create output file - error -

vbscript - Compressed (zip) Cannot create output file - error - i using vbscript scan folders, create zip files , add together files them (compress), run script on folders lot of files, next error: "compressed (zip) cannot create output file" my zip handling code follows: dim objfso set objfso= createobject("scripting.filesystemobject" function preformzip(objfile,target,zip_name, number_of_file) set shell = createobject("wscript.shell") zip_target = target + "\" + zip_name +".zip" if not objfso.fileexists(zip_target) makepathifnotexist(target) newzip(zip_target) else if number_of_file=0 objfso.deletefile(zip_target) newzip(zip_target) end if end if set zipapp = createobject("shell.application") asourcename = split(objfile, "\") ssourcename = (asourcename(ubound(asourcename))) zip_file_count = zipapp.namespace(zip_target).items.count zipapp.namespa...

laravel - Querying Relations -

laravel - Querying Relations - i got these tables: table: investigation id name start_city end_city table: city id name start_city , end_city in table investigation refers city.id . this investigation model: public function start_city(){ homecoming $this->hasone('city', 'id', 'start_city'); } public function end_city(){ homecoming $this->hasone('city', 'id', 'end_city'); } city model: public function start_city(){ homecoming $this->belongsto('investigation', 'id', 'start_city'); } public function end_city(){ homecoming $this->belongsto('investigation', 'id', 'end_city'); } investigation controller: public function show($id){ echo '<pre>'; var_dump(investigation::find($id)->start_city->name); } i trying property of non-object . suspect relationship somehow 'broken'. how prepare this? t...

c# - Get all inherited classes of a generic abstract class -

c# - Get all inherited classes of a generic abstract class - i'm looking way classes inherit generic abstract class, , perform method on each of classes. i've been next change parameter type when implementing abstract method have class implementations want, similar this: class="lang-cs prettyprint-override"> public abstract class abstractrequest<tresponsedata> tresponsedata : iresponsedata { public abstract void search(); public abstract gooddata binddata(tresponsedata data); } public interface iresponsedata { } public class aresponse : iresponsedata { } public class bresponse : iresponsedata { } public class : abstractrequest<aresponse> { public override void search() { // aresponse // phone call binddata() aresponse } public override gooddata binddata(aresponse data) { // bind info aresponse gooddata } } public class b : abstractrequest<bresponse> { p...

With django-rest-framework how do I assign a field to the request user when using a ModelViewSet? -

With django-rest-framework how do I assign a field to the request user when using a ModelViewSet? - the documentation recommends apiviews: def pre_save(self, obj): obj.owner = self.request.user this doesn't seem work back: class="lang-js prettyprint-override"> { "owner": [ "this field cannot null." ] } edit: pre_save method never gets called. checked inserting phone call pdb in pre_save method. my serializer plain hyperlinkedmodelserializer model , list of fields specified in meta. on model had overridden clean_fields . signature clean_fields : model.clean_fields(exclude=none) my custom clean_fields : def clean_fields(self, exclude=none): super(applicant, self).clean_fields() # bug here. # custom clean_fields code i didn't pass exclude parameter super class! oh god took me many hours debug. django django-rest-framework

Append byte array to pdf file c# asp.net using FileStream -

Append byte array to pdf file c# asp.net using FileStream - i working in asp.net web application. trying append byte array pdf file using filestream , want result pdf file containing byte arrays. getting lastly byte array saved in pdf. don't want utilize external library. here code appending bytes : public void appendbytetofile(byte[] renderedbytes) { string path = server.mappath("~/printimages/file1.pdf"); var stream = new filestream(path, filemode.append); stream.seek(0, seekorigin.end); if (stream.length==stream.position) { stream.write(renderedbytes, 0, renderedbytes.length); stream.close(); } } where renderebytes rdlc object of local study rendered pdf follows byte[] renderedbytes = report.render("pdf", deviceinfo); thank you c# asp.net pdf byte filestream

syntax error - mySQL corruption "Cannot add foreign key constraint" trying to CREATE table -

syntax error - mySQL corruption "Cannot add foreign key constraint" trying to CREATE table - edit corrupt mysql db problem. pls see "edit:" below trying add together table called client new mysql db: create table `client` ( `id` int not null auto_increment, `person_id` int not null default '0', primary key (`id`) ) collate='latin1_swedish_ci' engine=innodb; every time get: #1215 - cannot add together foreign key constraint . i have looked @ reserved word lists can find. none of them seem have "client". i can utilize "clients" (but not having table plurals -0 others singular), "clientxxx" etc. want utilize "client". there way round this? of import clients not patients. ps have deleted other tables db still not fly. pps although not listed client is ****** reserved word in sql in reality (or @ to the lowest degree heidisql lists it. there way around it? (i th...

javascript - Using function parameter value as dictionary key -

javascript - Using function parameter value as dictionary key - attempting build dictionary using key comes via function parameter. var progres_mark = function(progress_state) { var = date(); console.log({ progress_state : }) } progres_mark("encode") expected { 'encode': 'sun oct 19 2014 18:22:33 gmt+0300 (idt)' } actual { progress_state: 'sun oct 19 2014 18:22:33 gmt+0300 (idt)' } what’s going on? because compiler expects identifier or string , hence not evaluate variable's value. can utilize bracket notation accomplish want. var progres_mark = function(progress_state) { var = date(); var obj = {}; obj[progress_state] = now; console.log(obj) } javascript node.js dictionary

java - How to determine if a string is English sentence or code? -

java - How to determine if a string is English sentence or code? - consider next 2 strings, first 1 code, sec 1 english language sentence (phrase precise). how can observe first 1 code , sec not. 1. (int = 0; < b.size(); i++) { 2. in english language (not necessary sentence). i'm thinking counting special characters (such "=", ";", "++", etc ), , set if threshold. there improve ways this? java libraries? note code may not parsable, because not finish method/statement/expression. my assumption english language sentences pretty regular, contains ",", ".", "_", "(", ")", etc. not contains this: write("the whole lot of text"); the basic thought convert string set tokens. example, code line above may become "key,separator,id,assign,number,separator,...". , can utilize simple rules separate code english. check out code here java string nlp

python - Travis-ci build fails but tests pass locally -

python - Travis-ci build fails but tests pass locally - i've submitted (pretty little really) pull request sympy on github. tests pass locally, build has failed in module doesn't seem have have changed. my pull request: https://github.com/sympy/sympy/pull/8281 the failing travis-ci build: https://travis-ci.org/sympy/sympy/builds/38577918 this output: ________________________________________________________________________________ ________________________ sympy.stats.crv_types.uniform _________________________ file "/home/travis/virtualenv/python3.4.1/lib/python3.4/site-packages/sympy-0.7.5_git-py3.4.egg/sympy/stats/crv_types.py", line 2217, in sympy.stats.crv_types.uniform failed example: cdf(x)(z) expected: -a/(-a + b) + z/(-a + b) got: z/(-a + b) - min(a, z)/(-a + b) the code failing when tries run test in python 3.4 (but passes other versions of python). my alter unit test (sympy.physics.quantum.tests.test_qubit.py) , can't find...

mysqli/PHP - first two rows never show up(table with row data going across columns then moving down) -

mysqli/PHP - first two rows never show up(table with row data going across columns then moving down) - my website ignores first 2 images place database , proceeds add together images going across 5 columns , moving downwards next row. update: shows 3 of 4 images in database. skips 1 image. <?php $i = 1; echo "<table>"; while ($row = $recordset2->fetch_object()) { if ($i == 1) { echo "<tr>"; } echo '<td><img src="'.$row_recordset2['imgsource'].'" width="100" height="100"></td>'; if ($i == 5) { $i = 1; echo "</tr>"; } else { $i++; } } echo "</table>"; ?> this database looks http://i.stack.imgur.com/ifba8.jpg this website shows http://i.stack.imgur.com/wf7e1.jpg try this: <?php $i = 1; echo "<table>"; while ($row = $recordset2->fetch_object()) { ...

Notice: Array to string conversion (SQL Server and PHP) -

Notice: Array to string conversion (SQL Server and PHP) - i got error when seek fetch array of data. notice: array string conversion in line 7 however, happens tables. can fetch info other table not these 3 : user employeeid (nvarchar) pk uname (nvarchar) udept (nvarchar) transaction_po poid (int) pk stockid (int) fk employeeid (nvarchar) fk podate (date) povendorname (nvarchar) transaction_so soid (int) pk stockid (int) fk sodate (date) soquantity (int) socustomer (nvarchar) and code : require_once 'connection.php'; require_once 'session.php'; $tsql = "select * transaction_po"; $result = sqlsrv_query($conn, $tsql, array(), array( "scrollable" => sqlsrv_cursor_keyset )) or die(sqlsrv_errors()); // line 7 (error) echo '<table id="t01" width="95%" align="center" cellpadding="" cellspacing="0" border="1">'; if (!$result) { die(...

Jquery if else in how use? -

Jquery if else in how use? - why script not work? $(document).ready(function() { if ($('[style *= "block"]')) { $('#bss').addclass('click') } else { $('#bss').removeclass('click') }); like mentioned in comments have syntax errors , should utilize length cause else "if" query selector object of jquery never false. $(document).ready(function() { if ($('[style *= "block"]').length > 0) { $('#bss').addclass('click'); } else { $('#bss').removeclass('click'); } }); jquery

How to find all combinations (subset) of any size of an array in postgresql -

How to find all combinations (subset) of any size of an array in postgresql - this question has reply here: array combinations without repetition 1 reply given array, how find combinations (subsets) of elements of size in postgresql. example, given array [1, 2, 3, 4] combinations of size 3 be [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4] order not of import in combinations , hence [1, 2, 3] , [3, 2, 1] considered same combination. update: size of combinations required must specified @ run-time parameter, same function/query can used find combinations of size n <= size of array. the existing solution works combinations of size 3 , needs 1 additional cross bring together every increment in size, not practical. the next function produces combinations of requested size set of rows 1 combination per row: create or replace function get_combinations(sou...

How do I copy one vector to another vector in Java without updating the original vector? -

How do I copy one vector to another vector in Java without updating the original vector? - i copying vector vector of same type.and modifying re-create vector original vector getting update don't understand why? vector<allocated>finished_copy=new vector<allocated>(); finished_copy=finished; i printing value of original vector after , before modification for(int k=0;k<finished.size();k++) { system.out.print(finished.elementat(k).output); system.out.print(finished.elementat(k).step); system.out.println(); }//some modification on finished_copy and printing original both different please help me in this you're not doing copy. you're doing assigning same vector variable: before: finished ------> [a, b, c, d] after: finished ------> [a, b, c, d] ^ | finished_copy ---/ here's how re-create elements of vector one: vector<allocated> finishedcopy = new...

php - Wordpress admin links -

php - Wordpress admin links - i'm in situation in have wp installed , running on root. have custom created folder, lets phone call "my_folder". "my_folder" in root too, , there files included themes functions, , pages content displayed on admin dashboard. problem comes when visit page, admin menu still there, not linking like: mysite.com/wp-admin/etc.. it links like: mysite.com/my_folder/etc.. which incorrect.. i guess because admin menu takes relative url (from current directory in). how can prepare that? php wordpress

csv - Jaspersoft Studio : issues while drawing graph -

csv - Jaspersoft Studio : issues while drawing graph - i new jasperreports / jaspersoft studio , struggling bit charts. experts may find primitive , possible missing basic stuff here.. here brief of trying do 1) info source csv next fields sr_no, uri, total_time_taken, no_of_requests, avg_time_per_req, most_expensive_req, timestamp_of_exp_req 2) csv has around 40,000 lines in it 3) want create study has 40,000 lines in (a simple columnar study based on fields, sorted no_of_requests in descending order). piece of cake in jasperstudio ! 4) next, want summary page "top 10" uris in pie chart value of pie series no_of_requests , key uri (pretty straight forward) i have created study in jasperstudio info source csv. have selected fields , applied no filter query primary dataset (i.e. default dataset while creating report). helps me print 40,000 lines in "details" band of report...so first part taken care off. for summary page need pie chart chall...

javascript - Error: [$injector:unpr] Unknown provider: Learning AngularJS Could use a pointer or two -

javascript - Error: [$injector:unpr] Unknown provider: Learning AngularJS Could use a pointer or two - i leaning angular first application photo sharing tool. added code upload function , broke it. thought defining albumprovider in controller, apperently have failed so. error error: [$injector:unpr] unknown provider. stuck , hand on need fix. albumservice.js (function () { function albumprovider($http,$fileuploader) { this.getuploader = function (album_name, scope) { homecoming $fileuploader.create({ scope: scope, method: "put", url: "/v1/albums/" + album_name + "/photos.json" }); }; this.getalbums = function (callback) { $http.get("/v1/albums.json") .success(function (data, status, headers, conf) { callback(null, data); }) .error(function (data, status, headers, conf) { callback(data); }); }; this.getphotosforalbum...

algorithm - Variation of Bin packing- with bin and object classes and mutual constraints -

algorithm - Variation of Bin packing- with bin and object classes and mutual constraints - i'm working on problem variation of bin-packing, bit more general form constraints. problem definition follows- we have objects of varying sizes, can grouped object classes. have bins of differing capacities, grouped bin classes (all bins within same class have same capacity). object classes have constraints on bins may placed into- example, object of class 'a' can placed in either of bin classes 'x' or 'y'. objective find minimum number of bins in each class, can yield optimal packing of given set of objects. is there mathematical formulation of problem, , solution methods have come across? extension of bin-packing problem same methods can applied? understand np hard. unable find much how tackle problem, quite helpful if can point me in right direction. finding exact solution np-hard. finding optimal solution easy. since objective minimize number of...

php - About SimpleXML's foreach -

php - About SimpleXML's foreach - what's wrong here? want load list of 10 items, same. why? <?php $xml = simplexml_load_file('test.xml'); $name = $xml->item->title; foreach($xml -> item $item){ echo "$name<br>"; } ?> no, you're not accessing values within loop: $name = $xml->item->title; // not this! foreach($xml->item $item){ // access `$item` within loop echo $item->title . '<br/>'; // echo "$name<br/>"; // you're accessing item outside loop } additional question: just trim title numbering: $i = 1; $xml = simplexml_load_file('http://store.steampowered.com/feeds/weeklytopsellers.xml', null, libxml_nocdata); foreach($xml->item $item){ // $trimmed_title = ltrim($item->title, "#$i - "); $trimmed_title = str_replace("#$i - ", '', $item->title); echo $trimmed_title. '<br/>'; ...

path - Multi-Device Hybrid Apps for Visual Studio: ripple emulator doesn't start -

path - Multi-Device Hybrid Apps for Visual Studio: ripple emulator doesn't start - i have same problem fabio in this post. unfortunately can't add together answer. know problem can connected white space in user name. can alter path "c:\users\forename surname...", "c:\users\forenamesurname..." ? to alter username, suggest creating new user desired name. far dependencies concerned, in case used multi-device hybrid apps installer dependencies, here changes made: create new user , login go command panel -> programs , features uninstall android sdk download android sdk 1 time again here. install choosing "install users on machine" install next packages in android sdk manager: open scheme environment settings: change adt_home to: "c:\program files (x86)\android\android-sdk" (or if chose custom install directory) everything should run expected now. path ripple multi-device-hybrid-apps

c++ - Index of pointer to a char array -

c++ - Index of pointer to a char array - i trying find out, why output of next programme "wahnahnn". my question is: why index rising above p[4] (i.e. exceed length of array) , why produce "ahnn" after "wahn"? i still confused difference between p+i (which should location) , *(p+i) should value. why output value in both cases? #include <iostream> using namespace std; int main() { char a[] = "wahn"; char *p = a; (int i=0; p[i]; i=i+1) switch (i%2) { case 0: cout << p+i; break; case 1: cout << *(p+i); break; } homecoming 0; } the type of p + i char* . the operator << interprets nullterminated string. means programme output "whan" ( i == 0 p + == p , wich same a ) first iteration, "a" sec iteration, "hn" 3rd , "n" lastly one. c++ arrays pointers

javascript - Cordova - Capture video and retrieve base64 data -

javascript - Cordova - Capture video and retrieve base64 data - i using phonegap record video , wanting save base64 data-encoded string. far have tried this.. function capturesuccess(mediafiles) { var i, path, len; path = mediafiles[0]; win(path); } function win(file) { var reader = new filereader(); reader.onloadend = function (evt) { console.log("read success"); console.log(evt.target.result); }; reader.readasdataurl(file); }; function captureerror(error) { navigator.notification.alert('error code: ' + error.code, null, 'capture error'); } function capturevideo() { navigator.device.capture.capturevideo(capturesuccess, captureerror, {limit: 1}); } i have used readasdataurl specified in documentation. output of evt.target.result "data:video/mp4;base64," but there isn't encoded info after filetype. is there else need add together in order total base64 info of video? i s...

c# - Databinding to a ListView inside a HubSection -

c# - Databinding to a ListView inside a HubSection - i'm getting search results bing api , adding each article list , trying bind listview in xaml no results appear in hubsection. class="lang-c# prettyprint-override"> private list<newsarticle> bnews = new list<newsarticle>(); where newsarticle defined as: public class newsarticle : inotifypropertychanged { private string description; public event propertychangedeventhandler propertychanged; public string description1 { { homecoming description; } set { description = value; } } private string link; public string link1 { { homecoming link; } set { link = value; } } private string title; public string title1 { { homecoming title; } set { title = value; notifyproperychanged("title"); } } public void notifyproperychanged(string property...

git - How to push changes from one branch to another? -

git - How to push changes from one branch to another? - i working on local git repository. there 2 branches,master , development. want force development changes master branch, how do that? when do: git branch -a i see... * development master remotes/origin/head -> origin/master remotes/origin/development remotes/origin/master you want on master branch merge development branch it. if there conflicts fail , tell are. git checkout master git merge development i tend on cautious , in local, disposable, repository force upstream after sorted/merged. git github

javascript - Node JS Route Behavior makes no sense -

javascript - Node JS Route Behavior makes no sense - i'm trying create simple authentication page using node express framework. at moment, i'm not particularly worried weak protection. however, route file displaying weird behavior. here code: var express = require('express'); var router = express.router(); var admin = require("../controllers/admin"); router.get('/', function(req, res) { console.log('entered top route.'); if(req.body.isauthenticated) { res.redirect('admin/index'); } else { res.redirect('admin/login'); } }); router.post('/authenticate', function(req,res) { if(req.body.pword == "key") { console.log("resetting body.isauth'ed"); req.body.isauthenticated = true; console.log("new val: " + req.body.isauthenticated); res.redirect('admin/index'); } else { console.log("failed login attempt...

Why is the Google App Engine SDK for Windows flagged as a security risk by Google? -

Why is the Google App Engine SDK for Windows flagged as a security risk by Google? - i'm using app engine windows , when seek deploy app cloud, i'm asked username , password. when come in username , password, next error: password xxxxx@xxxxx.xxx: invalid username or password. 2014-11-06 18:48:41,628 error appcfg.py:2417 error occurred processing file '': http error 401: > > > unauthorized. aborting. error 401: --- begin server output --- must authenticate first. --- end server output --- 2014-11-06 18:48:41 (process exited code 1) then, got email google stating, effort made login business relationship , blocked. if wasn't me, take next steps. but, if me: if can switch app made google such gmail access business relationship (recommended) or > alter settings @ https://www.google.com/settings/security/lesssecureapps >account no longer protected modern security standards. any ideas? i'd hate lower secur...

R, in a table, how to move rows at the bottom? -

R, in a table, how to move rows at the bottom? - i have table this a: 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 40 41 42 43 44 50 51 52 53 54 and want table this: b 30 31 32 33 34 40 41 42 43 44 50 51 52 53 54 10 11 12 13 14 20 21 22 23 24 that means need take first k rows of initial matrix , set them @ bottom of matrix. how it? how b a? thanks untested reasonable chance of success: a[c( (k+1):nrow(a), 1:k) , ] if k represents both number of rows move , w+k want them moved and there sufficient rows allow happen, perhaps untested code succeed requested modification: a[ c( 1:(w-1) , (w+k+1):(w+2*k+1), w:(w+k), (w+2*k+2):nrow(a) ) , ] r table matrix

applescript - How CocoaPods' install command works behind the scene to add files to my Xcode project? -

applescript - How CocoaPods' install command works behind the scene to add files to my Xcode project? - i've started using cocoapods. way adds files xcode project i'm curious writing own applescript able add together files xcode project. how can that? reference appreciated? the xcode project file format tough. there 2 tools cocoapods can utilize edit them. xcodeproj ruby gem first. lot of other projects such slather depend on gem deal project files. if have installed cocoapods can utilize xcproj add together things project. can installed homebrew with brew install xcproj it has recompiled each time update xcode. if you'd create tool manipulates project i'd recommend these starting point. xcode applescript cocoapods

java - Apache Shiro - password format issue -

java - Apache Shiro - password format issue - i seek utilize passwordmatcher defaultpasswordservice defaulthashservice. defaulthashservice hashservice = new defaulthashservice(); hashservice.sethashiterations(10000); hashservice.sethashalgorithmname(sha512hash.algorithm_name); hashservice.setgeneratepublicsalt(true); defaultpasswordservice passwordservice = new defaultpasswordservice(); passwordservice.sethashservice(hashservice); string encryptedpassword = passwordservice.encryptpassword("password"); system.out.println("result:"+encryptedpassword); and here result must save database in column password. $shiro1$sha-512$10000$t5nkqea3qjmlpub/x+wn4q==$qwviyjbljsmwh7fsvhecklxqqxy11lv8es4guxd9t8d4htekcln/muytnhzyz+yvi1ykeg6l7t2km3qykug0xq== everything working. question why iterations number , algorithm name saved salt , password? case inform potential attacker, dumps our database such of import properties. nowadays, aim protect user passwo...

how to check a php file every 10 second using javascript -

how to check a php file every 10 second using javascript - i hava php file check items id for illustration check.php : <?php if(mysql_num_rows(mysql_query("select * items id = ".$_get['id']))) { echo "this id: $_get['id'] <b>true</b> \n\n"; } else { echo "this id: $_get['id'] <b>true</b> \n\n"; } ?> every 10 seconds, want check ids using javascript. <script> var id1 = 1; var id2 = 2; var id3 = 5; var id4 = 9; var id5 = 10; var id6 = 23; </script> i don't know how utilize javascript or ajax. i want output this: //after 10 seconds id: 1 true //after 20 seconds id: 2 true //after 30 seconds id: 5 trud , .... use setinterval interval , jquery $.load specifying variable arguments attached file load from... eg $('body').load('file.php?id=2&time=2'); javascript php load

Return rows from a multidimensional array with same value in php -

Return rows from a multidimensional array with same value in php - i have multidimensional array , need filter specific rows. here's contents of sample array. $arr = array( array("id"=>1, "msisdn"=>10, "sc"=>8155), array("id"=>2, "msisdn"=>20, "sc"=>22020), array("id"=>3, "msisdn"=>10, "sc"=>8155), array("id"=>4, "msisdn"=>10, "sc"=>8155), array("id"=>5, "msisdn"=>20, "sc"=>22020), array("id"=>6, "msisdn"=>30, "sc"=>22020) ); how can rows value of msisdn equal 10, example? something this? iterate through array , can search specific value , type. i don't want go much detail question isn't exclusively clear. func...

sdk - qbfc/qbxml ReceivePaymentAdd assign Payment to Invoice -

sdk - qbfc/qbxml ReceivePaymentAdd assign Payment to Invoice - when seek associate payment invoice, next error: receivepaymentadd orapplypayment: or object has multiple values end of orapplypayment end of receivepaymentadd what error mean? how work? note pushing invoice quickbooks in separate session, cannot utilize macros. if utilize isautoapply true without appliedtotxnadd block, payment pushes fine. here generated xml: <?xml version="1.0" encoding="utf-8"?> <?qbxml version="10.0"?> <qbxml> <qbxmlmsgsrq onerror = "continueonerror"> <receivepaymentaddrq requestid = "0"> <receivepaymentadd> <customerref> <listid>8000003f-1415364262</listid> </customerref> <araccountref> <fullname>accounts receivable</fullname> </araccountref> <txndate>2014-02-14</txndate> <refnumber>1003 - p1</refnumber> <totalamount>85...

javascript - How do I make an element appear based on a random number generator? -

javascript - How do I make an element appear based on a random number generator? - i'm making whack-a-mole type game school project. far i've created 2 random number generators run based on 2 setintervals stop after global timer, next steps are: making elements appear, based on id numbers i've given them, relating number generated. make appearing elements disappear, assuming using .onclick() , creating function add together number score variable in instance. not displaying item, or avoid closing it, if same number has been generated either generator , hasn't been clicked. (other solutions had stop generator producing same number twice or having either generator produce same number.) is there should consider besides these? maintain in mind i'm total newbie , explanations suggestions fantastic. here code have far: class="snippet-code-js lang-js prettyprint-override"> var score; var count; var fastcount; var counter; var randg...

c++ - Multiple inheritance -

c++ - Multiple inheritance - i have 2 base of operations classes (b1 , b2) derived mutual base of operations class(b), have mutual variable (let: int x; base of operations b), in 1st base of operations x=0 , in 2nd base of operations x=10 (default values given in b1,b2 constructors). visually: class b { int x; protected: b(int x) : x{x}{} }; class b1 : public b { protected: b1() : b(0){} }; class b2 : public b { protected: b2() : b(10){} }; now if derive 1 more class: class d : virtual public b1, virtual public b2 { public: d() : b1{}, b2{}{} }; here 1 re-create of x available per virtual concept, if seek access x value derived class object instance of x in o/p ( x=0 or x=10 ), , why? in order utilize virtual inheritance, base of operations b must declared virtual in both b1 , b2 . without that, have non-virtual inheritance of b. if have non-virtual inheritance, have 2 b bases in d , can't access x in d with...

ruby on rails - PORO presenter breaks url helpers -

ruby on rails - PORO presenter breaks url helpers - i have started creating rails presenters using poro approach. illustration presenter resides in app/presenters/band_presenter.rb , here it's code: class bandpresenter def method_missing(m, *args, &block) @band.send(m) end def initialize(band) @band = band end def thumb_url(size = :large_s) @band.images[size.to_s] if @band.images end end and works good. however, if i'll utilize instance of presenter in rails url helper methods, breaks them. example: @band = band.find(1) = link_to @band.name, band # => /bands/1 @band = @band.find(1) @band = bandpresenter.new(@band) = link_to @band.name, band # => /%23%3cbandpresenter:0x007f9139c50db0%3e/1 which seems legit. question - can somehow create presenter back upwards such way of using url helpers? try defining to_param method class bandpresenter def to_param @band.id end def model_name @band.model_name ...

debugging - How to dynamically create a breakpoint on an expression in chrome? -

debugging - How to dynamically create a breakpoint on an expression in chrome? - say have code in production. want test particular item in big list of items has behavior. 1 way accomplish in development debugger statement this: items.foreach(function(item){ // code... if (item.title.match(/foo/)) { debugger; } // more code... }); with code, set breakpoint in list, when list item matches expression. makes easy debug 1 item, may have obscure bug in it. if seek set breakpoint there clicking line, it's going pause @ every item in list, have step through 100 items before there super tedious. one problem above is, requires have ability edit client-side javascript, can't in production. so question is, can accomplish same sort of thing, purely using chrome web inspector? maybe "watch expressions" (haven't found much on google those). ideal be, within chrome web inspector, add together look like: breakpoint: line: 17 file: build.j...

ruby on rails - Trying to pass parameters -

ruby on rails - Trying to pass parameters - i'm trying pass url params rails app (ex: /entries/new?name=asdf controller: def new @entry = entry.new(params[:name]) end def create @entry = entry.new(params[:name]) if @entry.save redirect_to @entry, notice: 'entry created.' else render :new end end private # utilize callbacks share mutual setup or constraints between actions. def set_entry @entry = entry.find(params[:id]) end # never trust parameters scary internet, allow white list through. def entry_params params.require(:entry).permit(:name) end end form field : <%= hidden_field_tag :name, params[:name] %> i'm getting error "when assigning attributes, must pass hash argument." any ideas? params hash. params[:name] homecoming string ('asdf' in illustration above). when instantiating entry you're passing string when should passing hash. assuming name attribute...

WKWebView Cache manifest not working IOS8 -

WKWebView Cache manifest not working IOS8 - cache manifest works fine , events fired in safari in ios 8. not working @ in wkwebview else solve issue? import uikit import webkit class viewcontroller: uiviewcontroller { @iboutlet var containterview : uiview! = nil var webview : wkwebview? override func loadview(){ super.loadview() self.webview = wkwebview() self.view = self.webview! } override func viewdidload() { super.viewdidload() var url = nsurl(string:"http://html5demos.com/offlineapp") var req = nsurlrequest(url:url) self.webview!.loadrequest(req) } override func didreceivememorywarning() { super.didreceivememorywarning() } } the application cache comes supported if utilize html5test.com edit: window.applicationcache not homecoming undefined either when loaded wkwebview console.log("initializing page"); if (window.applicationcache == undefined){ console.log("application cache not suporte...

json - How to make a mobile app screen size aware -

json - How to make a mobile app screen size aware - i want create cordova (phonegap) app can used on devices. including pc screens. want layout adjust number , layout of panels (views) acording simple instructions. chose dojox.app because of way config.json file controls mvc construction of app. a dojox.app uses controllers handle size , orientation events. config.json file contains "controllers", "views" , other elements define mvc construction of app //mandatory,listen app.emit events,implement dojox/app/controller "controllers": [ //listens "app-init, app-load" "dojox/app/controllers/load", //listens "app-transition, app-domnode" "dojox/app/controllers/transition", //listens "app-initlayout,app-layoutview,app-resize" "dojox/app/controllers/layout" ], //mandatory, 1 or set of views view1+view2+view3 "defaultview": "home+rightpane", //manda...

crash - Android app crashing after push notification is received while running in background -

crash - Android app crashing after push notification is received while running in background - i'm developing app titanium when test on android crashes when receiving force notifications in background. on ios version not causing problem. i'm using android 4.4.2 version installed , titanium sdk 3.4.0 here's crash report: java.lang.runtimeexception: unable start activity componentinfo{de.hitabis.elsa.mobile/org.appcelerator.titanium.tiactivity}: android.support.v4.app.fragment$instantiationexception: unable instantiate fragment ti.modules.titanium.ui.widget.tabgroup.tiuiactionbartab$tabfragment: create sure class name exists, public, , has empty constructor public @ android.app.activitythread.performlaunchactivity(activitythread.java:2596) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2653) @ android.app.activitythread.access$800(activitythread.java:156) @ android.app.activitythread$h.handlemessage(activitythread.java:1355) @ android.os.han...

authentication - Symfony2 using both CAS and login/password authentification -

authentication - Symfony2 using both CAS and login/password authentification - i need create portal website using 2 authentication protocols. using standard approach login / password using cas service so, when user arrives on homepage can take 1 of these 2 authentication systems. i not skilled in security in symfony2, have follow symfony documentation write code: class="lang-html prettyprint-override"> #security.yml security: encoders: symfony\component\security\core\user\user: plaintext role_hierarchy: role_admin: role_user role_super_admin: [role_user, role_admin, role_allowed_to_switch] firewalls: secure_area: pattern: ^/ anonymous: ~ context: form_auth form_login: login_path: /form_login check_path: /form_login_check logout: path: /logout target: /riac access_control: ...

jcl - I keep getting IEFC452I errors, what's wrong? -

jcl - I keep getting IEFC452I errors, what's wrong? - //name job 1,notify=&sysuid //sort01 exec pgm=sort //sysout dd sysout=* //sysprint dd sysout=* //sysudump dd sysout=* //sortin dd disp=shr,dsn=public.data(ascii) //sortout dd sysout=* //sysin dd * sort fields=(1,1,ch,a) the message getting iefc452i text - job not run - jcl error the value of text userid plus character(s) entered when asked after submit. if @ file 2 of output, see shedload of other messages. your problem jcl can written in uppercase. is contest, or course? had same jcl (different problem) couple of days ago. if alter uppercase (in line-number area type uc99 on first line, , "uppercase" next 99 lines (saving having work out how many) , assuming dataset exists go. as other question, sort step, sysydu...

php - Doctrine 2. Cannot redeclare class Setup -

php - Doctrine 2. Cannot redeclare class Setup - sometimes see error occurs when page loads, points base of operations class initialize doctrine 2 setup. the problem error occurs through time , quite often, grab cause-effect relationship extremely difficult. however, sure problem has met someone. , may able prompt response. thanks in advance. error string: fatal error: cannot redeclare class doctrine\orm\tools\setup in /....hidden path..../lib/doctrineorm/doctrine/orm/tools/setup.php on line 34 class="lang-php prettyprint-override"> <?php namespace doctrine\orm\tools; utilize doctrine\common\classloader; utilize doctrine\common\cache\cache; utilize doctrine\common\cache\arraycache; utilize doctrine\orm\configuration; utilize doctrine\orm\mapping\driver\xmldriver; utilize doctrine\orm\mapping\driver\yamldriver; /** * convenience class setting doctrine different installations , configurations. * * @author benjamin eberlei <kontakt@beberlei.d...

java - How to inspect runtime annotations with javassist -

java - How to inspect runtime annotations with javassist - when attempting inspect code @ runtime using javassist need @ annotations. simple example: classpool pool = classpool.getdefault(); ctclass clazz = pool.getctclass("org.junit.test"); boolean found = false; (object annotation : clazz.getavailableannotations()) { if ("java.lang.annotation.target".equals(annotation.getclass().getname())) { found = true; } } the problem code never sets found = true . annotation classes returned are: com.sun.proxy.$proxy8 com.sun.proxy.$proxy9 any thought how actual annotations rather proxies? or how 1 actual annotation proxy? annotation objects not direct instances of annotation type, instances of (proxy in case) object implements annotation interface. try if (annotation instanceof java.lang.annotation.target) java javassist

javascript - How do you connect webkit devtools from IDE? -

javascript - How do you connect webkit devtools from IDE? - short explanation: i have webpage in chrome browser have no url , have sources are acessible chrome devtools. devtools started remote debugging flag, allows me type localhost:9222 in browser , see devtools there sources debug. details: i'm starting node-webkit app, is, in short words, node.js script along app scripts embedded webpage, displayed standalone webkit engine. so it's normal webpage in chrome without url. and want debug scripts remote debugger in thought (or eclipse). page have no url, have chrome developer tools can enabled remote debug. question: i want utilize standart ide eclipse/idea instead of devtools debug code. how connect devtools remote debug ide? javascript google-chrome debugging google-chrome-devtools node-webkit

r - Bootstrap and sample mean -

r - Bootstrap and sample mean - i have sample exponential distribution, let's x<-rexp(30,0.2) . i resample 5000 times replacement , compute sample mean: resample<-replicate(5000,mean(sample(x,30,replace=true))) i next histogram see distribution of t(x*)-t(x): hist(resample-mean(x),freq=false) i know since have sequence of iid exponentials, sum of sequence has gamma distribution (scaled number of exponential rv's i'm considering (i.e., 30)). how can overlay gamma distribution previous histogram? i'm trying utilize next res.range<-seq(min(resample),max(resample),.001) lines(res.range, dgamma(res.range,shape=1,rate=0.2/30)) seems doesn't work. r statistics statistics-bootstrap

ruby on rails - uninstalling ransack gem gives 'cannot load such file --ransack -

ruby on rails - uninstalling ransack gem gives 'cannot load such file --ransack - i want utilize elasticsearch gem , after installing , setting up, went on uninstalling ransack gem. i tried first removing gemfile (and gemfile.lock) , ran bundle install. after starting server webrick, got 'cannot load such file --ransack' i did gem uninstall ransack , bundle exec uninstall ransack same error. can help me out on this? make sure remove require 'ransack' from everywhere in project. ruby-on-rails ruby ruby-on-rails-4 gem ransack

c - The extern class specifier -

c - The extern class specifier - if have external variable this: int a; is right declaration equals to: extern int = 0; and not equals to: extern int; is same local variable write this: int local; is equals to: auto int local; in both cases compiler put, default, specifier extern or auto ? the rules linkage , external definitions little odd, partly historic reasons (cf. illustration this c89 rationale). rules objects (they different function declarations) are: at file scope: auto , register not allowed, diagnostic required1). static means internal linkage2) , declaration (tentative) definition3). extern means linkage declared, if none declared, external linkage4). no storage-class specifier means external linkage5) , declaration (tentative) definition6). if multiple declarations disagree on linkage, behaviour undefined7) (gcc aborts compilation, compilers, guess). a tentative definition means, object defined in same translation un...

java - Spring: calling method before injection -

java - Spring: calling method before injection - i explain problem simple example: class="lang-java prettyprint-override"> public class () { private b b; public () { /* ... */ } public b getb () { /* ... */ } @autowired public void setb (b b) { /* ... */ } public init (int x, int y, float rx, float ry) { /* ... */ } } and class="lang-java prettyprint-override"> public class b () { private a; public b () { /* ... */ } public geta () { /* ... */ } @autowired public void seta (a a) { /* ... */ } public init (int x, int y, float rx, float ry) { /* ... */ } } so need phone call init() method before injection, because after injection called method injected component in loop fps times per second, , of course of study not initialized nullpointerexception . i utilize setter injection , create object context.getbean("a") . is there way phone call method init() before injecti...

XML String convert into array in php -

XML String convert into array in php - i convert xml string array in php. generate bookstore array within 1 book array , nested array index 0,1,2. need same name (book) array bookstore. how generate type of array. xml string is.... $string = "<?xml version="1.0"?> <bookstore> <book> <name>php</name> <author>w3school</author> <price>200</price> </book> <book> <name>c#.net</name> <author>microsoft</author> <price>250</price> </book> <book> <name>asp.net</name> <author>microsoft</author> <price>350</price> </book> </bookstore>"; $value = simplexml_load_string($string); print_r($value); in above code, run , output display in book array in 0,1,2 index. simplexmlelement object ( [book] => arra...

Django 1.7 on Heroku: how do I get makemigrations to rescan the database? -

Django 1.7 on Heroku: how do I get makemigrations to rescan the database? - i have django 1.7 running on heroku. i've made alter models.py file (added column table) django doesn't seem able observe this. when run python manage.py makemigrations appname it responds no changes detected in app. i've tried deleting appname/migrations folder, doesn't help. is there way django rescan database , check differences? easy south. https://docs.djangoproject.com/en/1.7/topics/migrations/#the-commands have tried python manage.py migrate it seems migrate "responsible applying migrations, unapplying , listing status." django heroku django-migrations

python - 500 Error Django file upload -

python - 500 Error Django file upload - i have been using this code produce file uploader , can far getting template effort upload. wondering if need either configure apache, add together django settings or install more libraries maybe? i have followed steps mentioned on page, please inquire if suspect may have carried 1 or 2 of them out incorrectly. error jssor.slider.js error internal server error settings.py installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_file_form', 'django_file_form.ajaxuploader', 'jfu', ) template_context_processors = ( 'django.core.context_processors.request', 'django.core.context_processors.static', 'django.contrib.auth.context_processors.auth', ) middleware...