Posts

Showing posts from May, 2015

java - How to broadcast a database present on a mobile through LAN? -

i have database single table named sensors on android mobile, being continuously updated real time sensor readings. i want make web server on mobile can read these readings (database) computer on lan entering mobile's ip. is approach correct? if so, please guide me how acheive this. you should other way around. let other computer server static local ip , make mobile app send data periodically via post request server.

c++ - Is it not possible to construct instances in a loop without a pointer? -

this code explode, right? loop exits, original instances die inner members if weren't pods, method do_stuff requires access members of b throw segmentation fault, correct? void foo() { std::vector<b> bar; (int = 0; < 7; i++) bar.push_back(b(i, i, i)); bar[3].do_stuff(); } so, there way without using pointer? or have this: void foo() { std::vector<b*> bar; (int = 0; < 7; i++) bar.push_back(new b(i, i, i)); bar[3]->do_stuff(); (int = 0; < 7; i++) delete bar[i]; } the first code better second one. the b instances moved since c++11 / copied pre-c++11 vector, not fall out of scope after loop — after vector falls out of scope. if want absolutely optimal performance, this: void foo() { std::vector<b> bar; bar.reserve(7); (int = 0; < 7; i++) bar.emplace_back(i, i, i); bar[3].do_stuff(); } this guarantee 1 reallocation, , elements constructed directly inside vector (instead of moving or

python - difficulty with search url in django -

i relatively new django , while trying implement search feature in site, having difficulty setting url in urls.py. search url dispatcher looks following: url(r'search/$','welcome.views.search',name='search'), also search form has action set 'search'. there seems no problem search functionality every time repeat search, url looks pretty bad. example: http://localhost:8000/search/search/search/search/?csrfmiddlewaretoken=1ziskyyhdogluhwokshkxo2ddhd8wotp&q=a the above url obtained after trying 4 successive searches.please me out friends. it seems giving relative path instead of absolute - so use, href="/search/* instead of href="search/* .(replace star paramaters) also use caret in regex(that stricter regex) url(r'^search/$','welcome.views.search',name='search'), instead of url(r'search/$','welcome.views.search',name='search'),

asp.net mvc 5 - How do I return a ViewModel from a Web API controller method AS JSON? -

Image
my controller method called , view model loads data, throws error upon returning. public accountmanagerviewmodel get(string id) { accountmanagerviewmodel account = new accountmanagerviewmodel(guid.parse(id)); return account; } i tried adding [serializable] attribute class no luck. does i'm doing make sense? we're hoping reuse code our mvc app in new web api app don't want have create new classes have manually populate our viewmodels , return web api controller methods. you need see error is. maybe guid incorrect? incorrect format or not exit? that should work fine. 1 thing keep in mind not serialise complex models, recursion,etc. may error may getting. (but can disable recursion serialisation too) the best way check error is, open developer console in chrome/ firefox , enable xmlhttprequest logging. in console can click on red response , view error asp.net. another way check code getting hit, put breakpoint on first line of code expecting

api - Controlling Sony CamCorder -

is possible control functionality of eg. pj620 on wifi using remote api similar other sony cameras? playmemories mobile able control zoom etc. technically know possible, if want own app, best option? developing application use cam corder due superior image stabilizing functionality , control on wifi instead of resorting lanc. since wifi allow me transfer recorded material in real time. unfortunately pj620 not supported. can see list of cameras support api here: https://developer.sony.com/develop/cameras/

posting code in mysql using php -

i saving code in mysql using php pdo, code not working. code is... <?php session_start(); include 'connection.php'; $question=$_post['question']; $answer=$_post['desc']; $query = $conn->prepare("insert qa(issue,desc)values(':issue','desc')"); $query->bindparam(':issue',$question, pdo::param_str); $query->bindparam(':desc', $answer, pdo::param_str); $query->execute(); if(!$query) { $_session['error']='error in posting issue'; header('location:index.php'); } but not insert code in mysql , it data in mysql like.. :issue! desc but whe use query... <?php session_start(); include 'connection.php'; $question=$_post['question']; $answer=$_post['desc']; $conn->exec("insert qa (issue,desc) values ('".$question."','".$answer."')"); if($conn) { $_session['sucess']='issue posted

javascript - Ajax mysql long polling -

i'm working on ajax long polling function mysql , doesn't seem work. computer overheating , website crashes after minutes. also, poll.php doesn't receive content data.php, instead, poll.php shows {"type":"connect_error). i have not done long polling before. i have 3 files: data.php <?php session_start(); define ('db_host', 'localhost'); define ('db_user', 'root'); define ('db_password', 'root'); define ('db_name', 'story_creator'); function sqlselect($query) { // create connection $conn = mysqli_connect(db_host, db_user, db_password, db_name); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $result = mysqli_query($conn, $query); // check connection if (mysqli_errno($conn)) { echo "failed: " . mysqli_error($conn); } $resultarray = array(); if ($result) { while ($row = mysqli_fetch_ar

osx - Enable DHE_RSA cipher suites on OS X/iOS -

i developing os x app communicates server on https using nsurlsession , datataskwithrequest . server supports following cipher-string: kedh+aesgcm:high:medium:tlsv1:!keecdh:!rc4:!3des:!seed:!idea:!rc2:!des:!md5:!dss:!anull:!enull:!psk:!srp:!aecdh:!ecdsa . on os x 10.11 error message: cfnetwork sslhandshake failed (-9824) . quote os x 10.11 release notes : dhe_rsa cipher suites disabled default in secure transport tls clients. may cause failure connect tls servers support dhe_rsa cipher suites. applications explicitly enable cipher suites using sslsetenabledciphers() not affected. so release notes talk using sslsetenabledciphers() can’t create sslcontext , find apples secure transport reference quite confusing (lots of deprecated stuff). how can re enable dhe_rsa cipher suites im app? swift or objective-c.

Why do we need stack cleanup code and how does it work?(In assembly language) -

stack data structure follows lifo rule. in assembly language, when calling function need push arguments onto stack using "push" instruction. why need stack cleanup code remove arguments? stack cleanup code looks add esp n how remove arguments stack? i'll first answer first part of op's question: why? because cpu's, stack carries both local storage current function (local variables , arguments) , control information (return address, pointer previous stack frame, etc) when call function not clean stack (for example, functions adhere cdecl calling convention), caller responsible leaving stack after callee returns, in same state before call. means if caller pushes n bytes stack, has remove n bytes stack, either popping , throwing them away, or faster, skipping bytes directly modifying value of stack pointer (that is, add sp,n instruction). otherwise, stack grow every called function not cleaned, , eventually, stack overflow happen.

Parallel downloads of Maven artifacts -

when building project dependencies not yet available in local repository, noticed maven 3.3.3 first downloads dependency poms sequentially , proceeds downloading dependency jars 5 threads in parallel. what's reason not using parallel downloads poms also? is there option configure number of parallel downloads of either poms or jars? op knows answer other people searching solution issue: it's not possible current version of maven, 3.5.0 . op has created issue this , code pr it has not yet been merged of writing these words (7th of may 2017).

windows - Python ctypes - Getting 0 with GetVersionEx function -

explanation : i'm trying results of function getversionex, '0' @ output time: class op_info(structure): _fields_ = [ ('dwosversioninfosize', dword), ('dwmajorversion', dword), ('dwminorversion', dword), ('dwbuildnumber', dword), ('dwplatformid', dword), ('szcsdversion', dword) ] def info(): op = op_info() ctypes.windll.kernel32.getversion(byref(op)) return op.dwmajorversion print info() question : how can make function works , real results? edit : @eryksun did before called getversionexw function: import sys op.dwosversioninfosize = sys.getsizeof(op_info) and output is: 452 but final result of info() still 0 here's example setup calling getversionexw fill in either osversioninfo or osversioninfoex record. import ctypes ctypes.wintypes import byte, word, dword, wchar kernel32 = ctypes.windll('kernel32', use_las

Import data from a textbox in excel in C# -

i have excel files contain textboxes , need import data boxes. ideas on how accomplish that? this has been addressed on site before, , rather well. check out here: how read data of excel file using c#?

python - Django Looking for URLS of a Different Project -

i have 2 projects in django i´m working on @ same time. today strange happened after switching projects. i have first project: urls.py , manage.py from django.conf.urls import patterns, include, url django.contrib import admin django.conf import settings django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: # url(r'^$', 'agenda.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^agenda/', include('modulo_agenda.urls')), url(r'^schedule/', include('schedule.urls')), ) """ django settings agenda project. more information on file, see https://docs.djangoproject.com/en/1.7/topics/settings/ full list of settings , values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # build paths inside project this: os.path.join(base_dir

java - Alternate displayed image -

i'm doing tictactoe, , idea in first time click 1 button shows image "x" , if click other button shows image "o" ... , continues, showing images alternately. trying 1 click @ button shows 1 image, if click again @ button image disappear. import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.imageicon; import javax.swing.jbutton; public class xobutton extends jbutton implements actionlistener{ imageicon x; imageicon o; byte value=0; byte k=0; public xobutton(){ try { x=new imageicon(this.getclass().getresource("x.png")); o=new imageicon(this.getclass().getresource("o.png")); addactionlistener(this); } catch (nullpointerexception e) { system.out.println("the image not available"); } } @override public void actionperformed(actionevent e) { value++; value %= 2; if( k%2 == 0) { switch(value){ case 0:

Error when compiling Vim with Python 3 Support -

compiling vim source using --enable-pythoninterp causes no issues when try use --enable-python3interp correctly finds anaconda python config directory after running ./configure --prefix=/usr --with-features=huge --enable-python3interp wild error below when try launch vim binary , no clue begin troubleshooting this: thank after seeing below after running ./configure under impression found correct python , config dir also: checking --enable-python3interp argument... yes checking python3... (cached) /ebs/anaconda3/bin/python3 checking python version... (cached) 3.4 checking python 3.0 or better... yep checking python's abiflags... (cached) m checking python's install prefix... (cached) /ebs/anaconda3 checking python's execution prefix... (cached) /ebs/anaconda3 checking python's configuration directory... (cached) /ebs/anaconda3/lib/python3.4/config-3.4m vim: caught deadly signal abrt *** glibc detected *** vim: malloc(): smallbin double linked list corrupte

opencv - template matching vs feature matching for document image calssification -

Image
to classify large collection of various documents images, 2 methods used. achieve better performance these methods used gpu programming. first method: based on template in method, fixed pattern extracted image , other images compared it. if similarity greater threshold value, image correctly classified. code: gpuinvoke.matchtemplate(source, template, imageresult, `emgu.cv.cvenum.tm_type.cv_tm_ccoeff_normed, intptr.zero, intptr.zero);` problems of first method: this method not invariant rotate more 10 degrees. selected pattern in image may destroyed. (for example, damage caused punching document.) if pattern many, performance reduced. the second method: based on image features in way points of image selected resistant changes. if exist similar points in other image, image classified. code: gpubruteforcematcher matcher = new gpubruteforcematcher(gpubruteforcematcher.distancetype.l2); matcher.knnmatch(gpuobserveddescriptors, gpumodeldescriptors, gpum

angularjs - Angular Pass Request Body to a Restful Interface -

my restful controller receiving null request body angular post , i'm not sure why. here's code controller: admincontroller.controller('modalctrl', ['$scope', '$modal', '$log', 'profile', 'availableprofiles', function ($scope, $modal, $log, profile, availableprofiles) { $scope.open = function (uuid, profile) { var modalinstance = $modal.open({ animation: true, templateurl: 'mymodalcontent.html', controller: 'modalinstancectrl', resolve: { profile: function () { return profile; }, availableprofiles: function () { return availableprofiles; } } }); modalinstance.result.then(function () { profile.save({uuid: uuid}, {profile: profile}); }, function () {}); }; }]); and here's code servic

math - Constructing Romberg integration table -

i trying write fortran program generate romberg integration table. there's algorithm in book numerical analysis r.l.burden , j.d.faires 9th ed. in chapter 4.5. far have written this implicit none integer,parameter::n=4 real::a,b,f,r(n,n),h,sum1 integer::i,k,j,m,l open(1,file='out.txt') a=0. b=1. h=b-a r(1,1)=.5*h*(f(a)+f(b)) write(1,*)r(1,1) i=2,n sum1=0. k=1,2**(i-2) sum1=sum1+f(a+(k-.5)*h) enddo r(2,1)=.5*(r(1,1)+h*sum1) j=2,i r(2,j)=r(2,j-1)+(r(2,j-1)-r(1,j-1))/(4**(j-1)-1) write(1,*)((r(m,l),m=2,2),l=1,i) enddo h=h/2. j=1,i r(1,j)=r(2,j) enddo enddo end real function f(x) implicit none real,intent(in)::x f=1/(1+x**2) end function this program gives following output: 0.750000000 0.774999976 0.783333302 0.782794118 0.785392165 3.56011134e-22 0.782794118 0.785392165 0.785529435 0.784747124 0.785398126 0.785529435 7.30006976e+28

Importing csv data into odoo/postgresql from command line -

i using odoo on cloud instance, trying import csv file command line, when tried import psql "crm.lead" table imported data show in odoo application. copy res_partner(name, website,email,phone) '/home/ubuntu/sample/data.csv' delimiter ',' csv header; templ=# select count(*) res_partner; count ------- 25647 (1 row) but in customers(odoo) can't find data. tried python script other sources ( http://www.firstclasscomputerconsulting.com/openerp/openerp70videos/tabid/145/articletype/articleview/articleid/3/import-data-into-openerp-7-using-direct-postgres-method.aspx ) but nothing works in case. need help. copy table_name '/path/to/csv/csv_file.csv' delimiter ',' csv; this query can directly execute on postgresql can execute python code.

mysql - PHP function (adding records) not working correct -

i working on website have user adding form. following function addrecord(). when admin user creating new user, function adds rows in sql table. but, every time add new users, stucked @ error message "user name/password not added contact", @ first else statement. when check table, access level , password fields having data, cannot log in hashed password. help, what's wrong code? thanks, sixxdog public function addrecord() { // verify fields if ($this->_verifyinput()) { // prepare encrypted password $password = trim($_post['password1']); // database connection $connection = database::getconnection(); // prepare data $query = "insert contacts(first_name, last_name, position, email, phone) values ('" . database::prep($this->first_name) . "', '" . database::prep($this->last_name) . "', '" . database::prep($this->po

python - LogRecord does not have expected fields -

in python using "logging" module, documentation promises logrecord instances have number of attributes, explicitly listed in documentation. however, appears not true. when not use logging module's 'basicconfig()' method, program below shows attributes 'asctime' , 'message' not present in logrecords passed loghandler's 'emit' method. import logging class logginghandler(logging.handler): def __init__(self): logging.handler.__init__(self) def emit(self, record): assert isinstance(record, logging.logrecord) print("logginghandler received logrecord: {}".format(record)) # list of logrecord attributes expected when reading # documentation of logging module: expected_attributes = \ "args,asctime,created,exc_info,filename,funcname,levelname," \ "levelno,lineno,module,msecs,message,msg,name,pathname," \ "proces

python - How to build a chi-square distribution table -

i generate chi-square distribution table in python function of probability level , degree of freedom. how calculate probability, given known chi-value , degree of freedom, this: in[44]: scipy.stats.chisqprob(5.991, 2) out[44]: 0.050011615026579088 however, know probability , degree of freedom. thus, compute corresponding chi-value given probability. the end result should similar something this . the value want can computed isf (inverse survival function) method of scipy.stats.chi2 distribution. this method uses broadcasting, can create table couple lines of code: in [61]: scipy.stats import chi2 in [62]: p = np.array([0.995, 0.99, 0.975, 0.95, 0.90, 0.10, 0.05, 0.025, 0.01, 0.005]) make df array shape (n, 1) , broadcasts p create 2-d array of pairings: in [63]: df = np.array(range(1, 30) + range(30, 101, 10)).reshape(-1, 1) now call isf : in [64]: table = chi2.isf(p, df) tweak default print options of numpy create nicely formatted table: in [65

javascript - Parse Promises Multiple httpRequest Cloud Code -

i'm writing ios app parse.com , cloud code. want retrieve objects contain 1 picture , other informations website , want add them class named news . when run code, every object saved (in class, 1 row = 1 retrieved object) unfortunately first 1 has picture saved.... idea ? i made lot of searches promises (series / parallels) , think problem comes here.. note : don't worry mylink, myimglink : put make code easy read ! parse.cloud.define("rajoutenews", function(request, response) { parse.cloud.httprequest({ url: 'myurl'}).then(function(httpresponse) { var news = []; var newsclass = parse.object.extend("news"); (var = 0; < 10 ; ++i) { var manews = new newsclass(); manews.set("link", mylink[i]); // "other informations" manews.set("imglink", myimglink[i]); manews.set("title", mytitle[i]);

c# - Entity Framework 6.1 to attach object based on unique constraint other than the primary key -

i'm working on developing model comunicate jet.com api, , got across hardship entity framework common while developing ef data model data api. so jet.com api returning unique keys in cases, don't want use keys primary keys in database few different reasons, have abillaty in entity framework implement unique constraints, question if there's way implement kind of override on attetch method attech entity based on unique key when primary key not set or not found? i'd assume can write extension method handle this, don't want re-invent wheel... i thinking possibility implement kind of exception handler unique key violation, far didn't figure out totally... i'm not sure if looking for, can map primary keys in ef6+ through code: modelbuilder.entity<officeassignment>().haskey(t => t.instructorid); https://msdn.microsoft.com/en-us/data/jj591617.aspx#1.1

javascript - express node.js making a get request to another server from node route -

so client makes request using button on index page. sends information route has been set follows: app.js var route = require('./routes/index'); var button = require('./routes/button'); app.use('/', index); app.use('/button', button); the request sent client-side directory node framework whenever presses button. if request sent 'localhost:port/button', button.js file mentioned above receive request. in button.js file have following: var express = require('express'); var router = express.router(); var somedata = ''; router.get('/', function (req, res, next) { //make request here such somedata //receives whatever request returns //set framework(i.e. spring...) somedata = getrequest('some other url'); res.send(somedata); }; module.exports = router; the problem here getrequest('some other url') within router request never receives information. also (as side-note), cannot seem

c++ - Does dlopen re-load already loaded dependencies? If so, what are the implications? -

i have program, code-named foo . foo depends on common.so , linked in normal way (sorry don't know technical way that). when foo running dynamically loads bar.so using dlopen() . far good. but, bar.so depends on common.so . dlopen() re-load common.so (from i've read loads required dependencies recursively), or detect loaded? if re-load it, cause problems in program? both foo , bar.so need see changes in common.so either of them make static variables there. maybe design needs changed or requires use of -rdynamic (which don't quite understand yet)? the posix spec dlopen() says: only single copy of executable object file shall brought address space, if dlopen() invoked multiple times in reference executable object file, , if different pathnames used reference executable object file. on linux, implemented using reference count; until dlclose called equal number of times, shared object remain resident. [update] i realize asking sha

sails.js - res.view() changes static asset path -

when using res.view('reset') of static assets (ie css , js files) prefixed reset. example: www.myapp.com/reset/angular.min.js <-- incorrect www.myapp.com/angular.min.js <-- correct i have following controller: reset: function (req, res) { user.findone({ resetpasswordtoken: req.params.token, resetpasswordexpires: { $gt: new date(date.now()) } }, function (err, user) { if (!user) { res.notfound(); return res.backtologinpage(); } return res.view('reset') }); } naturally, sails responding 404's because none of assets live @ path. how res.view('reset') serve files same directory when specifying view route 'get /reset': {view: 'reset'}?

c++ - Template function for collection based on member -

i have following structures struct obj { int a; int b; }; class objcollection { map<int,obj> collmap; public: string getcsva(); string getcsvb(); }; getcsva returns csv of a values in objects of collmap . getcsvb returns same b values. is there way can template function? reason becomes complicated me cannot pass address of member want generate csv for, outside class ie client code. there way this? note: can not use c++11. this looks need function parameter getcsv rather templates: declare function string getcsv(int (*selectmember)(obj)) . furthermore use selectmember([...]) wherever have used [...].a in getcsva . now can call getcsv providing method returning right field of obj , example: int selecta(obj o) { return o.a; }

PHP - Pull ids from a string and convert to array -

i'm working on linking system , ui post hidden string below "artwork:56,artwork:34,music:123" this represent linking following media: artwork id:56 artwork id: 34 music id:123 what i'm trying figure out how feed in string above , spit out id's need. function getartworkids($string){ //code needed } results [56,34] any awesome, thank you $string = "artwork:56,artwork:34,music:123"; $a = explode(',',$string); $ids = array(); foreach($a $i){ if(strpos($i,"art") !== false){ $ids[] = explode(':',$i)[1]; } } var_dump($ids); output: 56,34 the !== false important, strpos return 0 since string starts art . without !== false check you'd no results because if treat 0 boolean false

xcode - IOS Swift Parse Password Reset Page applying Rules -

i have application using parse store server side data. apply rules entry of password using regex successfully. when use parse's pfuser.requestpasswordresetforemailinbackground function user emailed password reset url allows password entered in reset. problem when user returns log application new password may not conform rules set in regex. how can enforce password rules in parse?

python - Filepath for Django Extending Template -

here template path webapp/ |__templates/ |__frontpage/ | |__home.html |__home_base.html in home.html, has: {% extends "home_base.html" %} this file structure work. however, want put home_base.html inside frontpage/, makes more sense. however, django report home_base.html template not exist, if home_base.html moved frontpage/. the error says cannot find home_base.html file under templates/ folder. since home_base.html moved frontpage/, why doesn't search home_base.html inside frontpage/ first? configurations missing? you need following template extended. {% extends "frontpage/home_base.html" %} django not have idea have have moved template. template according templates path have defined in settings. the template loader template in directories defined in dirs setting in templates settings. from dirs setting documentation: directories engine should template source files, in search order. al

java - Nested classes + extending Main Activity -

basically i'm trying create class processes users login app. following code have far: public class loginprocess extends mainactivity { public class getlogininformation extends asynctask<string, void, string> { context context = mainactivity.this; protected string doinbackground(string... params){ /** * passes information 3 parameters * @param 1: url * @param 2: username * @param 3: password */ try { url url = new url(params[0]); } catch(malformedurlexception e){ mint.logexception(e); e.printstacktrace(); log.e("loginprocess", "malformed url"); toast.maketext(context, "error sending login url", toast.length_long); } return "message received"; } protected void onpostexecute(string response){

javascript - blob shows up as bytestring ( angular + express ) -

i trying pull files back-end node.js / express server , display them in angular front-end. have tried different approaches keep on being stuck, data @ front-end displayed bytestring displaying base64 string didn't (it displayed base64 string). i think caused not setting properties of window use show file. my express code: router.get('/api/v1/getupload/:filename', function(req,res){ res.sendfile(__dirname + '/uploads/' + req.params.filename); }); my angular service code: (the managedatafactory returns result of call express) //get uploaded file $scope.getuploadfile = function(file) { // data link pdf managedatafactory.getuploadfile(file, {responsetype:'arraybuffer'}).success(function(f){ var blob = new blob([f]); var fileurl = $window.url.createobjecturl(blob); $scope.content = $sce.trustasresourceurl(fileurl); var w = $window; w.open($scope.content); }); } the html contains call ng-cl

c# - Insert [,] string array into a excel sheet -

i have [,] string array 40 rows 40 column items. trying write them excel sheet output keeps writing same word on first row of every column. doing wrong? public static void writetofile(this string [,] result) { try { //open instance of excel microsoft.office.interop.excel.application app = null; app = new excel.application(); app.workbooks.add(); excel._worksheet sheet = app.activesheet; sheet.name = "sheet 1"; int resultcount = result.length; (int = 0; < 40; i++) { (int j = 0; j < 40; j++ ) { sheet.cells[i].value = result[i,j]; j++; } i++; } if got array rows @ first dimension , columns @ second dimension, can write: sheet.range[sheet.cells[1,1], sheet.cells[40,40]].v

Search algorithm with avoiding repeated states -

with reference section 3.5 of russel , norvig : on grid, each state has 4 successors, search tree including repeated states has 4^d leaves; there 2d^2 distinct states within d steps of given state. what meaning of distinct states here. can explain me considering various values of d, 1,2,3,4. what meaning of distinct states here. the meaning of distinct state unique cell, count each cell in grid once. crude upper bound number of distinct states: first, @ subgrid of size 2d+1 x 2d+1 , , start node @ middle. easy see there no cells outside of subgrid reachable (from center) within d steps. in addition, number of cells in subgrid (2d+1)*(2d+1) ~= 4d^2 , found simple upper bound better naive 4^d . but there many cells still unreachable (for example, cannot within d steps (0,0) middle (which index (d,d) ), can tighter bound. approach 1: combinatorics: if can move "up , right", number of reachable cells can traverse through sum { cc(i,2) | i=0,1,...

algorithm - Compare growth rate: n·lg(n) and 0.02·n^(1.01). Which one grows faster? -

comparing n·lg(n) , 0.02·n^(1.01) , 1 grows faster? i write n^(1.01) n·n^(0.01) . doing that, question becomes then: how compare lg(n) , n^0.01 . but don't know 1 of lg(n) , n^0.01 grows faster. how solve problem? the logarithm grows slower positive power. assuming lg decimal logarithm, 0.02 n^(1.01) exceed n lg(n) @ n ~= 4.04192e+433 (see wolphram alpha query). if it's practical problem computational complexity though, it's reasonable n values, 0.02 n^(1.01) algorithm faster n lg(n) algorithm.

scala - What is a current status of spray-json version 2.0? -

i cloned spray json project, see spray 2.0 branch origin/feature/2.0.0 last commit on november 2012. mean spray-json 2.0.0 has been stopped? status/plans today? the spay project renamed or forming part in akka-http link info so spray-json deprecated, , maybe added project inside akka-http repo suggested http://mvnrepository.com/artifact/com.typesafe.akka/akka-http-spray-json-experimental_2.10

php - display two database table data in a single html table -

i have 3 tables viz customer, project , payment. logically customer should pay based on project in real scenario payment system different. pay in random amounts. project , payment child table of customer. both project , payment have customer id customer table custid custname custaddress 1 xyz abc 2 ijk abcd project table projid projname amount cus_id 1 project 1 10000 1 2 project 2 5000 1 3 project 3 11000 1 4 project 4 2000 2 5 project 5 3000 1 payment table payid paid cust_id 1 5000 1 2 7000 1 3 4000 2 4 1000 1 now want display project , payment details of each customer in same html table. want payment reflected based on project. if first project amount 5000 ,

Image Comparisson using CBIR and OCR -

working on project retrieving content given image , compare other images in repository , list out matching images. what should right approach search wont slowdown eventually. what planning first level of filtering use image querying (cbir technique) retrieve images matching pattern of given image. ocr image content , match check. please let me know if there better approach this. steps done softwares 1. tesseract ocr 2. image magick - image cleaning 3. textcleaner script found out image orientation using image magick software convert package has feature find image orientation using exif data not useful. for image rotated 90 degree thrice , ocr data each compared other find correct orientation. ( image maximum number of words wins) ocred image text , applied filtering bill no, date , amount. on success stores details on db future search on failure created 10 different images different filters (gray scale mode , sharpment applied) ocred images , found

enumeration - Swift issue with example -

i'm new swift , learning book called the swift programming language . in book there example: enum rank: int { case ace = 1 case two, three, four, five, six, seven, eight, nine, ten case jack, queen, king func simpledescription() -> string { switch self { case .ace: return "ace" case .jack: return "jack" case .queen: return "queen" case .king: return "king" default: return string(self.rawvalue) } } } and here part don't understand: if let convertrank = rank(rawvalue: 3){ let description = convertrank.simpledescription() } i tried change code above this: let convertrank = rank(rawvalue: 3) let description = convertrank.simpledescription() basically, have removed if statement, error occurs: value of optional 'rank?' not unwrapped; did mean use '!' or '?'? why have use if statement? , don't understand error message say.

unity3d - Declaring XML Namespace at Runtime -

i’m trying write script unity application (written in unityscript) able add nodes xml document @ runtime (using xmldocument class). encountering issues when trying declare 'name' attribute of new node. i know how can create node namespace outside of default xmlns attribution (in case replacing 'xmlns=' 'name=' ) match existing markup. after time on msdn docs assume xmlnamespacemanager or changing default namespace, struggling understand how implement (still pretty new xml in unity / ujs) advice welcome. many in advance, ryan current code: function start(){ //automatically loads xml doc save etc doc = new xmldocument(); doc.load(application.datapath + "/objmetatest01.xml"); root = doc.documentelement; debug.log("xml root: " + root.name); nodelist = root.selectnodes("metapipeobject"); debug.log("***xml log begin ***"); debug.log("number of objects: " + nodelist.count);