Posts

Showing posts from June, 2012

recursion - C# recalling method leads to program exit -

i've been coding text adventure game. when program run, boot() method called, reading %appdata%.ilan\texert setting files (meanwhile there username.txt). after boot() , goes mainmenu() , user can choose play, go options, or exit. when user goes options menu, , comes back, tries play game or return options menu, game quits, not supposed happen. source boot() = line 455 mainmenu() = line 579 main() = line 504 believe because int declared in method itself, , because method called multiple times int variable retains previous value. there way fix this? at line 610 retrieve results of mainmenu method, call optionmenu method @ line 617, once optionmenu() method fires don't else prevent application ending once control returns main() method. though call mainmenu() in optionmenu() method there nothing evaluating results of call write menu console , return main(). need put loop in main() method repeatedly call mainmenu() method, evaluating selected results, , other

c - What would be an equivalent of "MaxSteps" using the GSL's ODE solver? -

i want reproduce ode solver created using mathematica gsl . here mathematica code uses ndsolve : result[r_] := ndsolve[{ s'[t] == theta - (mu*s[t]) - ((betaa1*ia1[t] + betaa2*ia2[t] + betab1*ib1[t] + betab2*ib2[t]) + (betaa1t*ta1[t] + betaa2t*ta2[t] + betab1t*tb1[t] + betab2t*tb2[t])) * s[t] - ((gammaa1*ia1[t] + gammaa2*ia2[t] + gammab1*ib1[t] + gammab2*ib2[t]) + (gammaa1t*ta1[t] + gammaa2t*ta2[t] + gammab1t*tb1[t] + gammab2t*tb2[t])), //... other equations s[0] = sinit,ia1[0] = ia1init,ia2[0] = ia2init, ib1[0] = ib1init,ib2[0] = ib2init,ta1[0] = ta1init, ta2[0] = ta2init,tb1[0] = tb1init,tb2[0] = tb2init}, {s,ia1,ia2,ib1,ib2,ta1,ta2,tb1,tb2},{t,0,tmax}, maxsteps->100000, startingstepsize->0.1, method->{"explicitrungekutta"}]; trying exact equivalent using gsl: int run_simulation() { gsl_odeiv_evolve* e = gsl_odeiv_evolve_alloc(nbins);

android - Interstitial Ad Loading After every 1 Minte -

i want display interstitial ad after every 1 minute... can 1 please explain sample code ... thanks please interstitialads = new interstitialad(this, "your_pub_id"); final adrequest adrequest = new adrequest(); interstitialads.loadad(adrequest); interstitialads.setadlistener(this); firstly very bad experience users. recommend against it. but if want piss users off like: final runnable runanble = new runnable() { public void run() { while (true) { wait(60000); runonuithread(intersitial.showad()); interstitial.loadad(new request()); } } }; edit: do not this . have had word admob directly contravenes policies , account disabled.

preload image then change background javascript -

im changing background image following code inside script tag. causing whiteflash when background changes, pages ajax. cant pick background color background im using on profiles page , each profile has different background. is possible preload image change background stop whiteflash? thanks $('body').css('background-image', 'url(../images/waves.jpg)'); $('body').css('background-attachment', 'fixed'); $('body').css('background-size', 'cover'); you load hidden image , change when image finishes loading, this: function preloadimage(source, destelem) { var image = new image(); image.src = source; image.onload = function () { var cssbackground = 'url(' + image.src + ')'; $(destelem).css('background-image', cssbackground); }; } usage: preloadimage('images/waves.jpg', 'body'); edit: wrapped code inside function. edi

c++ - Range of HSV values to sample an Image as done by adobe -

Image
i have image shown in inset. sampled in adobe photoshop using blue color image shows. sampled image shown in gray-scale on left. i know opencv provides similar method sample images inrange() function. how can find out range of hsv values adobe checked sample image. since resultant image pretty want , not able determine range myself great if 1 guide me same. you can convert image in hsv cv::cvtcolor(...) here documentation then accordingly wikipedia blue near 240° of hue channel of image. can set maxhue = 270 , minhue = 180 or other values scan image. maybe should set minsaturation , minvalue avoid black , white. to find best ranges can link them sliders in qt gui , change them until same result photoshop...

iphone - Reducing iOS app size - Are <imagename>@2x.png images redundant? -

i trying reduce size (30+ mb) of binary submission, , sense images acquire sizable (>26 mb) part. i observed if remove retina images ( @2x.png ), ios gracefully replaces them 4-inch retina ( -568h@2x.png ) versions. are retina images redundant if supply -568h@2x.png versions? p.s. not 1 image makes of difference, if answer yes, apply default.png ? in general image@2x can used stand in image , not other way around (because wouldn't good). side effect of doing more memory used , on non-retina devices cause problem. if aren't supporting non-retina devices don't need image s. generally speaking shouldn't have many image-568h@2x images other default , other background images. of content images same size no matter screen size is. not need differently named images button of same size on multiple different screen sizes.

c# - Remove a checkbox that is being created dynamically in a loop -

i have bunch of code dynamicly creates controls. looks in folder , lists filenames in it. each file in folder creates checklistbox item, listbox item , 2 checkboxes. working great , intended: private void getallfiles(string type) { try { string listpath = "not_defined"; if (type == "internal_mod") { int first_line = 76; int next_line = 0; int = 0; checkbox[] chkmod = new checkbox[100]; checkbox[] chktool = new checkbox[100]; listpath = this.internalmodspath.text; string[] filestolist = system.io.directory.getfiles(listpath); foreach (string file in filestolist) { if (!internalmodschklist.items.contains(file)) { internalmodschklist.items.add(file, false); string filename

vb.net - Vertical & Horizontal scrollbars in a panel -

scenario: put panel on form. set panel's borderstyle fixedsingle. (just can see when run it.) set panel's autoscroll=true set panel's anchor top, left, bottom, right inside panel, place sizable control (button, picturebox or whatever). adjust control's bottom edge few pixels above bottom of panel. adjust control's right edge should few pixels more narrow panel minus width of vertical scrollbar. (that is, should narrow enough leave room vertical scrollbar may appear.) now run it, , vertically resize form little shorter you'd expect vertical scrollbar appear. problem: both scrollbars appear, because existence of vertical scrollbar reduces width of client area, forcing horizontal scrollbar appear. apparently .net evaluates whether vertical scrollbar necessary first, evaluates whether horizontal should appear, dependent upon whether client size reduced presence of vertical scxrollbar. (i.e. same experiment doesn't cause unnecessary vertical

mysql - Codeigniter: "Table not found" error when data inserted after database creation -

Image
i'm making installer module codeigniter application. i'm creating mysql database , it's tables through code , want insert user credentials db during installation process. this: the problem i'm having after creation of database , it's tables, when try insert user info database gives error saying "the table 'user' doesn't exist" while table exists. here code: $this->load->dbforge(); //create database $this->install_model->use_sql_string(); //add tables .sql file $this->load->database($database_name); //load created database $this->install_model->add_the_user($username, $password)); //insert user data the database , tables being created correctly. last line of code gives error. i have no idea i'm doing wrong here. please help! i think should load database first, u should import .sql file. table created in loaded db. $this->load->dbforge(); //create database $this->load->d

PHP arrays, trying to match three numbers -

im trying match 3 or more numbers 2 seperate arrays, have far code matching first 3 numbers, when need compare 6 numbers , see if there 3 in common ? have tried comparing 6 numbers not work. appreciated. jessica foreach($lottotickets $y => $yvalue) { if($i == 0) { echo " "; } else{ if((($winner[0] == $lottotickets[$y][0]) || ($winner[0] == $lottotickets[$y][1]) || ($winner[0] == $lottotickets[$y][2]) || ($winner[0] == $lottotickets[$y][3]) || ($winner[0] == $lottotickets[$y][4]) || ($winner[0] == $lottotickets[$y][5])) && (($winner[1] == $lottotickets[$y][0]) || ($winner[1] == $lottotickets[$y][1]) || ($winner[1] == $lottotickets[$y][2]) || ($winner[1] == $lottotickets[$y][3]) ||($winner[1] == $lottotickets[$y][4]) || ($winner[1] == $lottotickets[$y][5])) && (($winner[2] == $lottotickets[$y][0]) || ($winner[2] == $lottotickets[$y][1]) || ($winner[2] == $lottotickets[$y][2]) || ($winner[0] == $lottotickets[$y][3]) ||($winner[2] ==

Java programming main method in class -

sorry naive question. learn programming in java , have question on beginning. i follow lesson: closer @ "hello world!" application , can found following code. class helloworldapp { public static void main(string[] args) { system.out.println("hello world!"); // display string. } } having experience in programming in c++ code me looks rather bizarre. class helloworldapp contains starting point application, me looks strange, because of many points, example, in order work thought need somehow evoke method main because in class, works is. if have several classes (nor not sure if it's ok in java app? but, in general should ok), define several starting points in app? what reason define staring point class? java not c++. c++ had preserve backwards compatibility c, although object oriented language still has elements of procedural language including stand alone independent functions. example function main(int argv, char ** arc) e

The JavaScript charts are not showing up -

can me out code. <script type="text/javascript"> $(function () { $("#chartcontainer").dxchart({ datasource: [{ st_status: "placed students", oranges: 3 }, { st_status: "higher students", oranges: 2 }, { st_status: "overlap", oranges: 1 }], series: { argumentfield: "st_status", valuefield: "oranges", name: "series 1", type: "bar", color: "blue" } }); } </script> the charts not showing in webpage. idea what's going wrong? rookie , please forgive me if not asking under correct topic. thanks! edit: error in console says uncaught typeerror: object [object object] has no method 'dxchart' graph_test.php:46 failed load resource: server responded status of 404 (not found) i had same issue. jquery being included on page second t

python - can this work with other bit wise gates? -

i have been working on bit of bit wise gates. a=0b01100001 b=0b01100010 bin((a ^ 0b11111111) & (b ^ 0b11111111)) >>>0b10011100 so wondering how adjust work nand gate , other instance. >>> bin((a ~ 0b11111111)& (b ~ 0b11111111)) syntaxerror: invalid syntax >>> bin((a ^ 0b11111111) ~ (b ^ 0b11111111)) syntaxerror: invalid syntax does not work example. you should start here: https://wiki.python.org/moin/bitwiseoperators x << y returns x bits shifted left y places (and new bits on right-hand-side zeros). same multiplying x 2**y. x >> y returns x bits shifted right y places. same //'ing x 2**y. x & y "bitwise and". each bit of output 1 if corresponding bit of x , of y 1, otherwise it's 0. x | y "bitwise or". each bit of output 0 if corresponding bit of x , of y 0, otherwise it's 1. ~ x returns complement of x - number switching each 1 0 , each 0 1. same -x - 1. x ^ y &quo

java - Hibernate criteria with variable amount of OR LIKE clauses -

i new hibernate, , @ moment struggeling firing query use of criteria. what want achieve is, selecting records contain string in either first or lastname columns. here have. should give better idea. session session = hibernateutil.opensession(); criteria criteria = session.createcriteria(contact.class); if(keywords != null) { for(string keyword : keywords) { if(keyword != null && keyword.length() > 0) { criteria.add(restrictions.like("firstname", keyword, matchmode.anywhere)); criteria.add(restrictions.or(restrictions.like("lastname", keyword, matchmode.anywhere), null)); } } } searchmatches = criteria.list(); so in end query should along lines of: select * contacts (firstname '%oe% or lastname '%oe%'), , if multiple keywords given, like: select * contacts (firstname '%oe% or lastname '%oe%') or (firstname '%roo% or lastname

javascript - How to make a menu and submenu in AngularJS -

i trying display menu on page options file, edit, view, etc find in word document , when click on main menu item (file example), dropdown pops submenu options. thought basic behavior lot of uis have failing find examples of doing via angularjs. suggestions appreciated. in advance. angular doesn't have widgets built-in. can either pull in jquery plug-in or use bootstrap achieve this. this example assumes you're using bootstrap 2.3.2 , have created functions in controller: <ul class="nav nav-pills"> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">file <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#" ng-click="new()">new</a></li> <li><a href="#" ng-click="open()">open</a></li

insert - MySQL query runs without error but does not populate database -

evening folks, having of "looked @ long moments". this code when run return success message nothing gets entered database table, no errors being thrown up, know correct values being received _post can't see what's wrong, have identical query on page , works fine. can see issues code? if (isset($_post['username']) && $_post['username'] !== '') { $salted = md5($_post['pass1'] . 'salt'); try { $sql = 'insert users set username = :username, firstname = :firstname, lastname = :lastname, email = :email, password = $salted, joined = curdate()'; $s = $pdo->prepare($sql); $s -> bindvalue(':username', $_post['username']); $s -> bindvalue(':firstname', $_post['firstname']); $s -> bindvalue(':lastname', $_post['lastname']); $s -> bindvalue(':email', $_post['email'])

php - Search multiple tables and display as multiple tables -

i want users search database return data 2 different tables have done using union want not search 2 tables display 2 tables..how can go doing this? $result .= "<table border='1'>"; $result .="<tr><td>cater</td><td>part</td><td>gids</td></tr>"; while ($row = mysql_fetch_array($sql)){ $result .= '<tr>'; $result .= '<td>'.$row['name'].'</td>'; $result .= '<td>'.$row['part'].'</td>'; $result .= '<td>'.$row['gid'].'</td>'; $result .= '</tr>'; } $result .= "</table>"; $result .= "<table border='1'>"; $result .="<tr><td>cater</td><td>dish</td><td>gids</td></tr>"; while ($row = mysql_fetch_array($sql)){

c++ - Doxygen not outputting anything -

i'm trying document project doxygen , doxygen not create output anymore. first time ran doxygen via doxywizard, went fine, discovered graphviz not in path variable , none of dots worked. closed doxywizard, deleted output folder , contents, added grahviz path, , doxygen not output anything, using basic options (even without diagrams). might missing something? here doxyfile used: # doxyfile 1.8.5 #--------------------------------------------------------------------------- # project related configuration options #--------------------------------------------------------------------------- doxyfile_encoding = utf-8 project_name = "my project" project_number = project_brief = project_logo = output_directory = e:/doxygen create_subdirs = yes output_language = english brief_member_desc = yes repeat_brief = yes abbreviate_brief = "the $name class" \

c# - Grouping By subproperty -

orderitems can have or not have preferences. want group orderitems preference.but preference of 1 type(4) otherwise should belong @ "null" group. this code works other coders telling me sucks (but dont suggest solution) . ? public ienumerable<igrouping<preference,orderitem>> orderitemsgrouped { { var grouped = orderitems .groupby(item => { var = item.preferences.firstordefault(p => p.preference.preferencegroup.type == 4); if (i != null) return i.preference; else { return null; } }) .orderby(k => { return k.key == null ? -1 : k.key.order; }); return grouped; } } we don't know static type of orderitem.preferences.first() -- though should preference right, code looks it's not ( i pulled orderitem.preferences , has preference instead of being one). even though loo

.htaccess - apache htaccess in subdirectories with cpanel/whm -

i'm using cpanel/whm setup. htaccess files work fine base directory (public_html) below (public_html/stuff/) isn't processed. i'm aware need set allowoverride, enable this? the allowoverride directive set in apache global configuration file. file managed cpanel , it's important not edit sections labeled not edis edits lost. the configuration file located at: /usr/local/apache/conf/httpd.conf you're looking section looks following since allowoverride directive available inside <directory> section of configuration file. <directory "/"> options allowoverride </directory> after ensure allowoverride enabled in apache configuration need let cpanel know have updated file running following command: /usr/local/cpanel/bin/apache_conf_distiller --update more allowoverride directive: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride cpanel logs , configuration posters: http://go.cpanel.net/logposter

c# - Switch statement inside Razor CSHTML -

i'm developing project in asp.net mvc4, twitter.bootstap 3.0.0 , razor. in view, need display buttons depending of property value. using switch statement, example below doesn't work (nothing displayed): @switch (model.currentstage) { case enums.stage.readytostart: html.actionlink(language.start, "start", new { id=model.processid }, new { @class = "btn btn-success" }); break; case enums.stage.flour: html.actionlink(language.gotoflour, "details", "flours", new { id=model.flour.flourid }, new { @class = "btn btn-success" }); break; ... } changing bit, using <span> tag, code works: @switch (model.currentstage) { case enums.stage.readytostart: <span>@html.actionlink(language.start, "start", new { id=model.processid }, new { @class = "btn btn-success" })</span> break; case enums.stage.flour: <span>@html

android - expandable list view with xml entries -

i want display expandable list view in android contains constant strings defined in xml file in resources app should support multiple languages cleanest way keep strings i know possible in normal listview can use property android:entries="@array/stringarray" but when use expandable list gives me exception should use expandable list adapter instead of list adapter know not using adapters "i think implicit" so obliviously "entries" usable expandable lists cant find way make work any suggestions welcome well think easiest solution create expandable list adapter object , bind expandable list object. when add members of string array adapter elements, expandable list modified accordingly. @ simpleexpandablelistadapter constructors find out how implement idea mentioned above.

Python Distutils: How to overwrite an existing module in another installed package -

im struggling on figuring out how create setup.py module overwrite series of specific modules in location. for example, lets i've got new_file_1.py , new_file_2.py (in right directory structure above setpu.py) /setup.py /my_modules/__init__.py /my_modules/new_file_file_1.py /my_modules/new_file_file_2.py and need new_files overwrite old files live in path somewhere else, not 1 of generic python library paths. i realize brute force, there way hard-code, or take in via command line, absolute path isn't going to staple on sorts of generic path stuff? e.g. if tell setup.py --prefix=/some/path/ install /some/path/.../python2x/dist-packages/ or that. i recognize shell-script simpler, work doing @ moment necessitates stay within python scripts. tldr, can force distutils put files in particular specified location?

c# - MySql & Entity Framework causing "Object reference not set to an instance of an object." -

forgive me if vague...i using mysql connector entity framework based application. i have record in content table, trying fetch, whenever tries record, i'm getting exception: object reference not set instance of object. at line: data.entities.content content = this.sitedata.content.take(1).singleordefault(); i've checked sitedata instance (...it is), when inspected content , appeared not have records, i'm assuming take(1) fails...i wrong. here stack trace: [nullreferenceexception: object reference not set instance of object.] mysql.data.entity.selectstatement.getdefaultcolumnsfortable(tablefragment table) +64 mysql.data.entity.selectstatement.getdefaultcolumnsforfragment(inputfragment input) +90 mysql.data.entity.selectstatement.adddefaultcolumns(scope scope) +87 mysql.data.entity.selectstatement.wrap(scope scope) +37 mysql.data.entity.selectgenerator.wrapifnotcompatible(selectstatement select, dbexpressionkind expressionkind)

math - Why UDP checksum contains the UDP length twice? -

i trying understand udp checksum mechanism. using packet. saw example in summation of field, udp length included twice. why need include udp length twice in checksum ? this example saw ip header: source ip address c0a8 … 0291 ip header: destination ip address c0a8 … 0101 ip header: protocol number(zero padded on left) 0011 16 bit udp length 0032 udp header: source port 0618 udp header: destination port 0035 udp header: length 0032 udp data 0001 0100 0001 0000 0000 0000 0131 0131 0331 3638 0331 3932 0769 6e2d 6164 6472 0461 7270 6100 000c 0001 sum hex values 181e carry 4 add in carry 1822 1s complement = checksum! e7dd because that's says in rfc 768 . no other answer possible.

tomcat 7, grails app, finding the running webapp? -

i installed tomcat 7 on centos 6 , running good, running service, can start , stop it, log file looks fine. but, doesn't respond webapp address, i've got wrong ... i'm able access tomcat externally on: www.my-domain.us:8080 (standard welcome apache tomcat 7 page), when try access under application called cpn, cannot. trying: www.my-domain.us:8080/cpn www.my-domain.us/cpn www.my-domain.us:8080/cpn/cpn the cpn.war file exploded tomcat in webapps, i.e. have a .../webapps/cpn/* directory in application.properties app.name=cpn. also, in config.groovy have: grails.serverurl = "http://www.my-domain.us" what doing wrong? if it's not responding @ didn't start successfully, check log files "startup failed due previous errors". common problem can if grails trying create default stacktrace.log log file "current directory" whatever is not writable uid of tomcat process. can eliminate possibility adding 'n

angularjs - Can $scope.$watch determine equivalency of two objects? -

i've built directive gets data $parse 'ing angular expression in 1 of $attrs . expression typically simple filter applied list model, evaluation of change when parent $scope modified. to monitor when should update data it's using, directive using $scope.$watch call, custom function re-$ parse 's expression. problem i'm running $parse generate new object instance expression, $watch sees value changed when data in each object equivalent. results in code hitting $digest iteration cap due actions taken in $watch callback. to around doing following, currently: var getter = $parse($attrs.myexpression); $scope.$watch(function () { var newval = getter($scope); if (json.stringify($scope.currentdata) !== json.stringify(newval)) { return newval; } else { return $scope.currentdata; } }, function (newval) { $scope.currentdata = newval; // other stuff }); however, don't relying on json intermediary here, nor using $

debian - Django admin panel works but main page gives me a 404 -

i'm brand new django , python. i've done php. it took me 3 tries, i've django installed correctly. followed tutorial on installing it, , worked. enabled admin, panel, , set mysql. the admin panel works, , i've got static folder has of css well. when go main page 404. (my project called firstweb ) wheni go firstweb there 404, firstweb/admin works. using urlconf defined in firstweb.urls, django tried these url patterns, in order: 1. ^admin/ current url, firstweb/, didn't match of these. and i'm confused whole runserver thing. other little server other apache? why need start every time? from django.conf.urls import patterns, include, url # uncomment next 2 lines enable admin: django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: # url(r'^$', 'firstweb.views.home', name='home'), # url(r'^firstweb/', include('firstweb.foo.urls')), # uncomment admin/doc line below e

Cannot Update Git Submodule -

i trying clone of vim settings git repo, , repo contains submodules of other hosted projects. however, when try update of submodules, following error. cloning bundle/ack... remote: counting objects: 318, done. remote: compressing objects: 100% (189/189), done. remote: total 318 (delta 124), reused 256 (delta 70) receiving objects: 100% (318/318), 48.13 kib, done. resolving deltas: 100% (124/124), done. submodule path 'bundle/ack': checked out 'fd9632b40ac07b39adb270311cde2c460c9ba6da' cloning bundle/command-t... remote: counting objects: 2820, done. remote: compressing objects: 100% (1434/1434), done. remote: total 2820 (delta 1348), reused 2574 (delta 1122) receiving objects: 100% (2820/2820), 2.75 mib | 701 kib/s, done. resolving deltas: 100% (1348/1348), done. submodule path 'bundle/command-t': checked out '07087e16ba8fe0a87b1d1ccd03e158a0157dc1f8' cloning bundle/fugitive... error: rpc failed; result=22, http code = 400 fatal: remote end hung un

celery add to broker without publishing -

i add message broker without broker publishing subscribers. i want to, @ later date, tell broker publish message. i want can set one-off predefined task can executed calling it. an alternative have tried doesnt work do: task = tasks.send_message.apply_async(['hello'], countdown=60) revoke(task.task_id, terminate=true)` but doesn't revoke task - task executes. this can done rabbitmq dead-letter exchange extension. when publish task put on queue no consumers , declare consumer queue dead letter queue. when message ttl expires on original exchange dead letter consumer queue consumed. to accomplish celery declare queue from kombu import exchange, queue dead_letter_options = { 'x-message-ttl': 60 * 10 * 1000, # 10 mins 'x-dead-letter-exchange': 'default', 'x-expires': (60 * 10 + 1) * 1000, } celery_queues = ( queue('default', exchange('default'), routing_key='default'), que

c++ - Why pass a string by reference and make it a constant? -

just general question signature of function is: void f( const string & s )... why necessary pass reference if not changing string (since constant)? there 2 alternatives passing reference - passing pointer, , passing value. passing pointer similar passing reference: same argument of "why pass pointer if not want modify it" made it. passing value requires making copy. copying string more expensive, because dynamic memory needs allocated , de-allocated under cover. why better idea pass const reference / pointer passing copy not planning change.

c# - Overloading Linq Except to allow custom struct with byte array -

i having problem custom struct , overloading linq's except method remove duplicates. my struct follows: public struct hashedfile { string _filestring; byte[] _filehash; public hashedfile(string filestring, byte[] filehash) { this._filestring = filestring; this._filehash = filehash; } public string filestring { { return _filestring; } } public byte[] filehash { { return _filehash; } } } now, following code works fine: public static void test2() { list<hashedfile> list1 = new list<hashedfile>(); list<hashedfile> list2 = new list<hashedfile>(); hashedfile 1 = new hashedfile("test1", bitconverter.getbytes(1)); hashedfile 2 = new hashedfile("test2", bitconverter.getbytes(2)); hashedfile 3 = new hashedfile("test3", bitconverter.getbytes(3)); hashedfile threea = new hashedfile("test3", bitconverter.getbytes(4));

javascript - could not get the property value of my object in angularJs -

i undefined whenever value of property of object. function run(id){ var report = services.getreportinfo(id); var childreport = { id: newguid(), parentid: report.id, // undefined reportpath: report.path // undefined }; ... } services.js angular.module('project.services').factory('services', function(){ var reports = [ { .... }, { .... } ]; function getreportinfo(id){ var report = reports.filter(function(element){ return element.id === id; }); }; return{ getreportinfo: getreportinfo }; } whenever put breakpoint on var report = services.getreportinfo(id) contains correct values each property of report object. however, when report.id or report.path, undefined value. --edited-- oh, know got wrong. the getreportinfo function returns array , i'm accessing properties without telling index should values said properties. function

Using a function as the parameter for another function in PHP -

this may strange , doesn't work wanted check before gave on idea. essentially, i'm trying use results of function 1 of parameters function. example - function1($param1, function2($param1));. the code i've included outputs want to, issue i'm having outputs in wrong order - rather outputting: logos, h2, form, h2, form; outputs: form, h2, logos, form, h2. // display list function ul($c, $p){ echo '<ul class="'.$c.'">'.$p.'</ul>'; } // display list item function li($c, $p){ echo '<li class="'.$c.'">'.$p.'</li>'; } // display navigation function nav(){ require 'strings.php'; // if user not logged in, display login form if(!isset($_session[$uss])){ $nav = li('', require_once 'log_in.php'); // otherwise provide user information , navigation

Interpretation of memory layout -

Image
on page , there example image of part of memory layout program : what each line in such image represent? each line represent single line of physical memory ? physical memory has 32-bit or 64 bit each line, in case, each line in image cover several lines of physical memory ? thanks. each 2 digit group represents 1 octet (byte). laid out in groups of 16 octets because fits on printed page or terminal screen. address of leftmost octet in left column (e.g. 00430020 ). this representation used typographic convention , not have relation physical structure of memory.

animation - Syncing sounds with frames inside CCAnimation for cocos2d 2.x* -

how sync sound effects animation (ccanimation) nsmutablearray* animationframes = [nsmutablearray array]; [animationframes addobject:[[[ccanimationframe alloc] initwithspriteframe:[titlelayer spriteframeforfile:@"title_startanime01.png"] delayunits:1 userinfo:nil] autorelease]]; [animationframes addobject:[[[ccanimationframe alloc] initwithspriteframe:[titlelayer spriteframeforfile:@"title_startanime02.png"] delayunits:1 userinfo:nil] autorelease]]; [animationframes addobject:[[[ccanimationframe alloc] initwithspriteframe:[titlelayer spriteframeforfile:@"title_startanime03.png"] delayunits:1 userinfo:nil] autorelease]]; [animationframes addobject:[[[ccanimationframe alloc] initwithspriteframe:[titlelayer spriteframeforfile:@"title_startanime04.png"] delayunits:1 userinfo:nil] autorelease]]; [animationframes addobject:[[[ccanimationframe alloc] initwithspriteframe:[titlelayer spriteframeforfile:

Javascript window.onsave event -

is there way detect/intercept when user tries save page? allow me embed external files , provide user fully-functional offline app. the other solution embedding resources beginning, consumes many resources , and takes away of dynamic capability. any alternative not require any external libraries (including jquery, respect it, loads project) acceptable. there no window.onsave event find. however, listen ctrl+s keystroke intercepted. var isctrl = false; document.onkeyup=function(e){ if(e.keycode == 17) isctrl=false; } document.onkeydown=function(e){ if(e.keycode == 17) isctrl=true; if(e.keycode == 83 && isctrl == true) { //run code ctrl+s -- ie, save! return false; } } code courtesy of: how capture ctrl-s without jquery or other library?

salesforce - What is the end point URL to post the status in google plus? -

am trying post status salesforce app google plus, need endpoint url process. you cannot programmatically or automatically post user's google+ stream google+ v1 api . if google apps customer own apps domain, can use google+ domains api make automatic posts , these restricted users within domain , other users within domain can see posts.

android - issue using setContentView() after making WindowManager -

we start activity starts service becomes idle until service calls activity again. activity goes onpause(i believe) , isn't started until broadcastreceiver gets call start. service creates windowmanager system overlay , when user triggers it, supposed call activity , make activity make new view stuff in it. goes through without hitch, no errors popup , logs suggest code runs through smoothly, new view supposed made never comes view. interestingly enough though, if click app start again, pops view wanted earlier. i'm curious why doesn't happen when want to, instead remains invisible. i've tried setting view visible, tried bringtofront(), , tried flags on intent bring activity top of stack none of work. relevant code below. im not here hear why don't think app user or don't think follows androids base "design" want debugging interesting bug. mainactivity @override protected void oncreate(bundle savedinstancestate) { super.oncreate(s

MATLAB, I want to fill a 15 column matrix with a few fixed selected values such that all combinations are covered -

example, wish fill 15 column matrix values 0.25,0.25,0.25,0.25,0,0,0 .....( 11 columns zeros) possible column combinations filled. in example using 4 columns 0.25 , other 11 col's 0's. result should :- 0.25 0.25 0.25 0.25 0.00 0.00 0.00 0.00 ....... 0.25 0.25 0.25 0.00 0.25 0.00 0.00 0.00 ....... 0.25 0.25 0.25 0.00 0.00 0.25 0.00 0.00 ....... . . . . . . . . ....... . . . . . . . . ....... 0.25 0.25 0.00 0.25 0.25 0.00 0.00 0.00 ....... 0.25 0.25 0.00 0.25 0.00 0.25 0.00 0.00 ....... etc, etc. when using "perms" (limited 10 elements anyway ) treats each "0" if unique hence multiple rows same. "unique" function works fine if less 10 elements need use more that. appreciate assistance, thanks the function accumarray friend in case. i'll simpler example - creating 6 column matrix 2 columns filled , rest zero. first, list of h

html - how to use javascript function in a form button? -

i don't know html , javascript.. have activity on how you'll call javascript function located @ <head></head> of html tag? and if there several functions? can call @ same time in 1 button? or should create function , put functions in there? this our activity about... in javascript button, when clicked, must calculate transactions? have 5 functions, , 1 of them called button tag, while other 4 inside of function. don't know do... when clicked button, nothing happen. btw, it's reservation form, when button clicked, must calculate inputs , shows confirmation page/alert prices , such. guys! this code of form: <form name="reserve" action="" id="reserve" method="post"> <fieldset> <legend>contact information</legend> <label for="name">name: </label> <input type="text" name="firstname" value="firstname" onfocus="if (this.value=