Posts

Showing posts from June, 2014

php - Calling a Codeigniter controller from cronjob -

i have created cron job cpanel. command is php /home/userdir/www/index.php messages test the controller messages , method test inserts record in temporary table. when run following command prompt on laptop running windows, runs fine. php c:/wamp/www/project/index.php messages test this works perfectly. however, on hosted server running linux, mail server has html home page. not go messages->test method. please help. use: php index.php welcome show as command in crontab. e.g.: 0 * * * * php /home/userdir/www/index.php messages test or 0 * * * * /usr/local/bin/php /home/userdir/www/index.php messages test or 0 * * * * wget http://domain.com/messages/test http://www.codeigniter.com/user_guide/general/cli.html

c# - Xamarin Forms - Plugins.BLE - MvvmCross.Plugins.BLE -

i want develop app xamarin forms detects devices , interacts them bluetooth connection. the plugin "plugins.ble" seems me request. found plugin here : https://github.com/xabre/xamarin-bluetooth-le i did not find plugin "plugins.ble" when wanted install in xamarin studio, tried use mvvmcross.plugins.ble plugin. downloaded , installed in project. reference mvvmcross.platform has been installed in same time. set permissions bluetooth in androidmanifest.xml. i have many problems plugin. in first place, initialized adapter : var adapter = mvx.resolve<iadapter>(); i put code in app.xaml.cs got nullreferenceexception when build. otherwise, when put var ble = mvx.resolve<ibluetoothle>(); xamarin studio not recognize ibluetoothle interface. maybe errors come mvvmcross using. don't want use mvvmcross if plugin "plugin.ble" available use did not find it. you have search pre release. haven't released "stable"

c# - Should i use property or Dictionary object for cashing config data -

i caching applications web.config key-value data singleton object can store config data in class properties or dictionary object. considering performance , flexibility not able decide between using dictionary or class properties. dictionary offers less changes whenever new key added/removed don't have make modifications singleton model logic whereas if use properties need manage additions/removal of respective key. while using dictionary need specify key name in string error prone , difficult manage. based on above 2 reasons using dictionary storing cached data. please suggest if better solution exists here sample code. public class configdata { /// <summary> /// configuration data /// </summary> public static readonly idictionary<string, string> configurationdata = new dictionary<string, string>(); /// <summary> /// initializes <see cref="configdata" /> class. /// </summary> static co

oop - Implementing data hiding access specifiers in C language -

is there way implement access specifiers "private", "protected" in c language. came across solutions in internet using "static" , "ifdefs" making function available inside other functions. apart these, there c implementation equivalent of using private , protected access specifiers in c++ classes? c not have user definable name spaces or access specifiers. since exclude (ab)use of preprocessor, way compiler error trying access private parts of "classes" not have .h file exposes "private" stuff. can still put "private" separate .h files (included module's or library's own .c files, not meant included application code), or hidden behind #ifdef s (requiring special define activate "private" parts). one common way hide things use opaque structs aka opaque pointers. approach, code outside module or library has pointer struct, no struct definition. , uses functions offered module instance

javascript - how to get data from div tags with same id -

html <!doctype html> <html> <body> <div id="one"> welcome <div class="two"> hello world </div> <div class="two"> bye world </div> </div> <button onclick="myfunction()"> click</button> <p id="demo"></p> <script> function myfunction() { var x = document.getelementsbyclassname('two')[0].innerhtml; document.getelementbyid('demo').innerhtml = x; } </script> </body> </html> i have 2 divs in div 1 class name ,through function able tha data of class="two" i. hello world.here want data 1 one tha same class name.i want print data class="two" i.e hello world,bye world.plz me use jquery's each function we can using jquery's each function. first pu

Resharper command line tools not working -

i trying use re-sharper command line tools. error highlighted . using 1 solution. issue? here command , responses ps d:\jerpos\tools\resharpercommandline> .\inspectcode.exe -o="d:\temp \results.xml" -d --swea -x=etherealcode.respeller "d:\jerpos\code\pos client\jer.pos.clientstartup.sln" jetbrains inspect code 2016.1.2 running in 64-bit mode, .net runtime 4.0.30319.34209 under microsoft windows nt 6.2.9200.0 **specify 1 solution file** usage: inspectcode.exe [options] [project file] show help: inspectcode.exe --help enabled solution-wide analysis according inspect code command line setting. you worked out i'm pretty sure it's due space in path (even though it's quoted). had similar problem , fixed creating symlink directory without space in name.

wpf - How change the background color of the dropdown panel of Combobox -

Image
i want change background color of drowpdown panel of combobox. i'm using wpf. i've read post backgroundcolor items combobox wpf and i've written code: <combobox width="{staticresource unityx3}" styles:typhography.typesize="body1" margin="12 0 0 0" foreground="{staticresource viola1brush}" displaymemberpath="authorname" selecteditem="{binding path=consoleviewmodel.answersviewmodel.selectedauthor}" itemssource="{binding consoleviewmodel.answersviewmodel.authors}" grid.column="1"> <combobox.itemcontainerstyle> <style targettype="{x:type comboboxitem}"> <setter property="background" value="blue" /> </style> </combobox.itemcontainerstyle> </combobox> i have obtained result in picture. i wan

php - pass a dynamically created table on submit -

i building simple application allow users add rows table , generate table user can type in data rows , columns. so far have managed create rows dynamically jsfiddle now need when user hits generate (i using php this), table must shown in html text area. i did try below code didn't work <form action="1.php" method="post"> <?php echo $table = '<table id="maintable" width="50%" cellpadding="0" cellspacing="0" class="pdzn_tbl1" border="#729111 1px solid" > <tr><td colspan=3>sdsdsdsds</td></tr> <tr><td colspan=1>fsdfsf</td><td colspan=2>sdffsdfsf</td></tr> </table>';?> <textarea name="thetable" style="display:none"><?php echo $table ?></textarea> <input type="button" name="add" value="add 1 column" id="addrows1" style=&quo

angularjs - How to run ionic app in live mode so that I can get the console logs? -

i'm trying run ionic app runs on device in live mode. in this guided run $ ionic run ios [options] so, tried $ ionic run android -c -s but once app installed successfully, terminal got closed. you want use ionic run android -c -l , activates console output , live update. works on wifi, don't need phone connected usb after uploaded apk. live update causes app automatically refresh when make changes code, don't have rebuild apk every time. i'm not sure, think read somewhere must have live update enabled have console output.

html - How Can split String to multiple lines with php -

how can split string multiple lines php i trying print string come phpmyadmin , echo multiple lines use bootstrap frame work . i use code . <p><?php echo $course_description; ?> </p> enter image description here

php - Twig parses space before variable -

twig seems parse space before variable part of variable's name. example, following piece of template: <td>{{ item.status }}</td> <td>{{ item.animatorid }}</td> sometimes gives me following exception variable " item" not exist in mytemplate.html.twig @ line 36 note space in name. line 36 second line. removing space between brackets , variable fixes it, makes code less readable. any idea how prevent behaviour?

rdbms - How to DROP Sub Partition in specific Partition in Mysql? -

i have created partitions , sub-partitions in table. partitions below : partition range ( month(record_date)) subpartition hash (day(record_date)) ( partition p2012 values less (5) ( subpartition 01_04 engine = innodb, subpartition 02_04 engine = innodb, subpartition 03_04 engine = innodb, subpartition 04_04 engine = innodb, subpartition 05_04 engine = innodb, subpartition 06_04 engine = innodb, subpartition 07_04 engine = innodb, subpartition 08_04 engine = innodb, subpartition 09_04 engine = innodb, subpartition 10_04 engine = innodb, subpartition 11_04 engine = innodb, subpartition 12_04 engine = innodb, subpartition 13_04 engine = innodb, subpartition 14_04 engine = innodb, subpartition 15_04 engine = innodb, subpartition 16_04 engine = innodb, subpartition 17_04 engine = innodb, subpartition 18_04 engine = innodb, subpartition 19_04 engine = innodb, subpartition 20_04 engine = innodb, subpart

how to set value in javascript in html input field using MaskedPassword.js -

we using maskedpassword.js in 1 of our input field displayed below- <input type="password" id="txttopin" name="txttopin" autocomplete="off" > <script type="text/javascript"> new maskedpassword(document.getelementbyid("txttopin"), '\u25cf'); </script> but when reloads page setting default value field using javascript followed- document.getelementbyid("txttopin").value = "abcd"; now "abcd" getting displayed in plain format instead of masked format. can me out resolved issue. note: please refer https://www.sitepoint.com/better-passwords-1-the-masked-password-field/ more details on maskedpassword.js. you need several things pull off, based on source code provided need to: wait dom loaded. save reference of txttopin field , maskedpassword instance. get new pin original txttopin _contextwrapper . set value ne

optimization - Minimize memory allocations for go map -

i digging optimising highly used code in go. question boils down following code snippet (copied memory allocations pprof list command). can see allocations done in line map being filled (line 959). routine ======================== cart.benchmarkmapwithoutcapacityfixval in /.../cart_test.go 3328966 3328966 (flat, cum) 15.50% of total . . 954: . . 955:func benchmarkmapwithoutcapacityfixval(b *testing.b) { . . 956: := 0; < b.n; i++ { . . 957: m := make(map[int]float32) . . 958: k := 0; k < 10; k++ { 3328966 3328966 959: m[k] = 0.434295723423 . . 960: } . . 961: } . . 962:} here trying do: trying allocate memory before (inner) loop there no unnecessary allocations happening: routine ======================== cart.benchmarkmapwithcapacityfixval in /.../cart_test.go

python - Using variables as index on list -

i have 2 lists: list1 = [1, 3, 6, 8, 1, 61, 89, ...] # how list1 declared list2[1][3][6][8][1][61][89][...] # how want access data list2 list1 1 one-dimensional list undefined size (can have 1, 2 or infinite items) list2 multi-dimensional (nested) list (can 2d or 3d or infinite) i wanted use lists list2[list1[0]][list1[1]][list1[...]] ; want access data in list2 using data list1 . i tried following got error len(list2[list1]) how can access list2 's data using indexes in list1 ? len(list2[list1]) : trying index list2 using list1 while indexing in lists done using integers. try: len(list2[list1[0]])

python - How to predict float vector labels with caffe? -

i wondering if it's possible predict 1-by-n feature associated input image using caffe. in this post there solution make caffe predict binary vector such [1 0 1 0]. is solution suitable if have 1-by-n float vector label (such [0.2, 0.1, 0.3, 0.4] ? want predict such vector, not binary vector label. you can think multitaskdata layer . can parse float typed label vector mentioned in question.

python - Changing default runtime serverless v1.0 -

trying use serverless v1.0 alpha, cannot set runtime variable. tried setting in serverless.yaml as: service: want_python provider: aws functions: hello: runtime: python handler: handler.hello but shows runtime of nodejs. tried python2.7 , did not work well. can work no problem in v0.5 changing runtime in s-function.json, figured same...folder files such: $ ls -lha handler.py serverless.env.yaml serverless.yaml handler.py , serverless.env.yaml boilerplate. thanks! starting serverless v1.0-beta.1 you're able use python. you can create python service way: sls create -t aws-python then you'll serverless.yml have provider , runtime configured this: provider: name: aws runtime: python2.7

sonarqube - Sonar - Ignore Lombok code via custom annotation -

i'm trying ignore lombok code (generated code) sonar analysis based on files have custom annotation, @excludelombok . i've tried this guide did not work. in fact, i've tried excluding entire directory analysis , still wouldn't work. i've tirelessly searched through stackoverflow looking solution, , i've seen has been discussed bit on here, i've seen people have been suggesting write single test coverage up, pointless since should not test auto generated code. the solution i'm looking exclude files based on custom annotation. far, attempt exclude not excluded. any appreciated. there no easy way exclude issues raised sonarqube rules sonarqube java analyzer, except using approaches described in " narrowing focus " documentation quote. now, introduced concept of issue filters in sonarqube java analyzer. mechanism @ moment used internally exclude issues raised rules @ analysis time, based on specific criteria. we plan exte

android - Use a common database for Sqlite -

i using apache cordova visual studio 2015 mobile app development. using genymotion emulator , sqlite database. i noticed, if use 2 different devices(merchant pov & consumer pov) demonstrate app, database using not synced database due being 2 different devices. is there way can make sure both devices using synced database? you need custom sync api synchronize data that. if in stage of testing local database, can make script loads sample data wich executed on opening of app. way device run same script , have same sample data. but if want insert data on device , have same data on another, have sync api. hope helps

jquery - Count many text inputs and do something when each is set -

i have many many textbox inputs on page, i'm attempting check each set in loop, when each set i'm attempting run function. i have following code: $( document ).ready(function() { var count_input = 0; var count_valid_input = 0; $("#weekly-suppliers").change(function(){ call_calculation(); // }); function call_calculation(){ $('input[class=enquiry]').each(function(){ count_input ++; var text_value = $(this).val(); if(text_value != '') //remember, data has been sanitized! { count_valid_input ++; console.log('input: ' + count_input); console.log('valid: ' + count_valid_input); } }) if(count_input == count_valid_input){ console.log('do calc'); do_calculation(); } else {

Parsing xml in java -

this part of xml file <iostatussummary> <iostatus_interval_value> <count>0</count> <iostatusvalue datainterval="2016-01-16 15:45:30">1.0</iostatusvalue> <iostatusvalue datainterval="2016-01-16 19:47:29">0.0</iostatusvalue> <iostatusvalue datainterval="2016-05-16 13:01:07">1.0</iostatusvalue> <iostatusvalue datainterval="2016-05-16 18:51:33">0.0</iostatusvalue> <iostatusvalue datainterval="2016-05-27 16:45:50">1.0</iostatusvalue> <iostatusvalue datainterval="2016-05-27 20:56:00">0.0</iostatusvalue> <iostatusvalue datainterval="2016-06-10 10:21:28">1.0</iostatusvalue> <iostatusvalue datainterval="2016-06-10 20:01:17">0.0</iostatusvalue

android - Push notification works incorrectly when app is on background or not running -

i using firebase cloud messaging send push notifications. here firebasemessageservice : public class firebasemessageservice extends firebasemessagingservice { @override public void onmessagereceived(remotemessage remotemessage) { log.e("tag", "from: " + remotemessage.getfrom()); log.e("tag", "notification message body: " + remotemessage.getdata().get("cardname")+" : "+remotemessage.getdata().get("cardcode")); sendnotification(remotemessage.getnotification().getbody()); } private void sendnotification(string messagebody) { intent intent = new intent(this, startactivity.class); intent.addflags(intent.flag_activity_clear_top); pendingintent pendingintent = pendingintent.getactivity(this, 0 /* request code */, intent, pendingintent.flag_one_shot); uri defaultsounduri= ringtonemanager.getdefaulturi(ringtonemanager.type_notification); notificationcompat.builder not

java - What is args ? and When would you use args? -

this question has answer here: what “string args[]”? parameter in main method java 13 answers public static void main(string[] args) what string[] args? when use args? args name of string array. compulsory in main method in java in order receive parameters input. if application receives inputs, loaded in args, each of them string inside array in given order. otherwise, args empty array. more information here

How to stop Log4Net from creating an empty log file -

i have stopped appenders writing logs file adding <log4net threshold="off" /> . want stop log4net creating empty log file. idea how? in advance! rootappender: <appender name="rootrollingfileappender" type="log4net.appender.rollingfileappender"> <file value="d:\documents\debug.log" /> <appendtofile value="true" /> <rollingstyle value="size" /> <maxsizerollbackups value="2" /> <maximumfilesize value="10000kb" /> ... </appender> i managed stop log4net creating empty log file removing <file > child element of appender, along related properties, , setting <appendtofile value="false" /> . modified configuration follows: <log4net threshold="off"> ... <appendtofile value="false" /> <rollingstyle value="size" /> <rollingstyle value="composite" /&

python - Python2.7: ssh.exec_command works on Ubuntu not on FreeBSD -

i'm creating ssh channel remote host using paramiko . however, when try execute command using ssh_object.exec_command , command doesn't seem executed on freebsd boxes, works on ubuntu boxes . there permission issue or prerequisite need check in remote machines? this function creates ssh handler: def ssh_connect(ip,user,pwd): ''' function make ssh connection ip using credentials passed , return handler args: ip: ip address of box ssh has done user: user name of box ssh has done pass: password of box ssh has done returns: ssh handler ''' ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh.connect(ip, username=user, password=pwd) return ssh and i'm using handler: ssh_obj = ssh_connect(ip, username, password) folder = "/var/xyz/images/" + build_number command = "mkdir " + folder ssh_stdin, ssh_stdout, ssh_stderr =

linux - grep for only uppercase words -

i find words all uppercase, when do grep -op '\w*[a-z]+\w*' * i get words.py:stringvalue words.py:words words.py:words_answered words.py:answered words.py:true where hoping for words.py:words words.py:words_answered question how can make sure uppercase words outputted? you can use regex word boundary on either side , using [a-z0-9_] instead of \w : grep -h -op '\b[a-z0-9_]*[a-z]+[a-z0-9_]*\b' * words.py:words words.py:words_answered

matlab - Recognizing a cell input in one line -

consider following function inputs >> b.a = 1 b = a: 1 >> c = {'this' 'cell'} c = 'this' 'cell' >> d = [1 2 3] d = 1 2 3 the input can called in many ways example testfunction(b,d,c) testfunction(d,c,b) etc want cell input , retrieve data it function testfunction(varargin) =1:numel(varargin) if(iscell(varargin{i})) fprintf('the input number %d cell!\n',i) end end which recognizes if variable input cell there elegant way ? because iscell doesnt return index , used class() returns class of varargin instead of input the main issue here not performance, rather readability , having pretty code. i suggest create separate function checks cell is, , call function in main function. way can check cell is, in single line. simple, fast, , easy read. since can save function , close script in editor, calling builtin one-liner. function can other

c++ - [Prob]Why copy constructor is not getting called -

i have created class , initialized array of objects through constructor, why or why not copy constructor getting called here? copy elision? #include<iostream> #include<stdio.h> class abc { int x, y; public: abc() { x = 0; y = 0; } abc(int a,int b) { x = a; y = b; } abc(const abc &obj) { std::cout<<"copy called"; } }; int main() { abc obj[2] = {abc(), abc(5,6)}; //copy elision or copy constructor? } you're right, it's copy elision, compiler optimisations , creates objects right in place of memory allocated within array, hence copy constructor doesn't called.

How to access WCF service from asp.net? -

we host wcf services , asp.net site on same machine, both in iis under network service account. both sites have anonymous , windows authentication enabled. service uses wshttpbinding when call service wcf test client works fine sends regular domain user credentials, when asp.net calls service exception: type : system.servicemodel.security.securitynegotiationexception, system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089 message : caller not authenticated service. it seems nt authority\network service not authenticated, not know why. here config parts: <service name="wumte.server.host.edocumentscreationnondual"> <endpoint address="" binding="wshttpbinding" contract="wumte.server.host.iedocumentscreationnondual" bindingconfiguration="largemessagewshttpbinding"> <identity> <dns value="localhost"/> </identity>

sql - Mysql - Joining one to many to many -

i wrote following code in order join 1 many many in sql server 2008 r2. code partitions select statement id , orders can grab top 3 diagnosis: left join (select zzabstractlink, diagnosiscihivalue, diagnosistype, rownumber = row_number() over(partition zzabstractlink order diagnosisoccurrence) i10_diagnosis_vr diagnosistype <> 'm') dx1 on ab.abstractid = dx1.zzabstractlink , dx1.rownumber = 1 left join (select zzabstractlink, diagnosiscihivalue, diagnosistype, rownumber = row_number() over(partition zzabstractlink order diagnosisoccurrence) i10_diagnosis_vr diagnosistype <> 'm') dx2 on ab.abstractid = dx2.zzabstractlink , dx2.rownumber = 2 left join (select zzabstractlink, diagnosiscihivalue, diagnosistype, rownumber = row_number()

Cakephp 3 : Without use joining is it possible load another model in a model? -

in controller can use loadmodel method table data in cakephp.but possible in model? example have used orm/table class. defined table name used table method.like below code $this->table('blogs'); is possible declare table in same way without association ? note : able in controller. if want load model in table can use tableregistry reference use cake\orm\tableregistry $othertable = tableregistry::get('other'); //do other table //example $somerecord = $othertable->find()->first(); if model associated other model want load via association (belongsto, hasone etc.) can directly use example: $this->othermodel->find()->contain()->where(['somecondition' => 'value'])->first() having said that, cannot define 2 tables 1 if trying do. can load , use different table inside table, can't define 2 tables under 1 table class. i don't understand why don't want define association here sounds should do, h

matlab - Correctly change the labels of my colorbar? -

i have data logarithmic. how plot it: contourf(x, y, log10(my_data));colorbar; now, image looks - colors scaled accordingly value of each point, image colorful. however, values displayed next colorbar wrong- miss base (i.e. have 3 instead of 10^3 ). tried using caxis suggested here : cmin = min(my_data(:)); cmax = max(my_data(:)); c = contourf(x, y, log10(my_data));colorbar;caxis([cmin cmax]); it helped little bit: values displayed colorbar correct. however: my image of 1 color if plotted my_data instead of log10(my_data). according documentation , intended effect. how rid of it ? the values on colorbar displayed 100, 200, 400, itd. h ow can change scientific notation? edit : souver's idea works. however, original ticks aren't nice powers of 10 . new ticks following: 10^-1 , 10^-0.5 , 10^0 , 10^0.5 , 10^1 , etc. don't want ticks such 10^-0.5 , 10^0.5 , etc. have new (shorter) list of ticks , labels want: set(cbar, 'ticklabels', new_labels)

android - How does facebook or instagram app retain images or data after entering the app with no internet connection? -

in facebook app, example, login internet connection. close app, turn off internet , close system tabs. though internet connection off, see images , data had been loaded still retained. how facebook app that? should if wanted implement such feature in android app? i use 'picasso' library caching, loading... images internet : http://square.github.io/picasso/ automatic memory , disk caching picasso.with(context) .load(url) .resize(50, 50) .centercrop() .into(imageview) for data, can store data using shared preferences small stuff or local database sqlite

ruby on rails - formstatic belongs to and active admin -

Image
i have problem active admin when try add new user i have in roles table admin , instructor how make display them user.rb file in admin directory activeadmin.register user form |f| f.inputs "new user" f.inputs :f_name f.inputs :l_name f.inputs :age f.inputs :job_title f.inputs :slug f.inputs :birthdate f.inputs :country f.inputs :role f.semantic_fields_for :images |fi| fi.input :photo, :as => :file end end f.button :submit end end can me ? you can following: f.inputs :role, :as => :select, :collection => # write here code produce `id`s saved in database, , string shown on web page.

error handling - PHP's white screen of death -

now i'm starting php, i'm starting remember why gave in first place. annoying thing on plate @ moment i've come term "php's white screen of death". when php gets fatal error due syntax or whatever, seems die without sending browser. i've added following .htaccess , , seems work of time, doesn't work in these cases. php_value display_errors 1 php_value display_startup_errors 1 php_value error_reporting 2147483647 # e_all am missing something? @ moment feel need hit refresh every few lines of code write, lest make mistake , have search through many pages trying track down 1 little mistake made... edit: example, given 2 lines of code below: $foo = array(':language' => $languageid; $foo = array(':language' => $languageid); the first exhibit white screen of death (ie, nothing @ printed browser), while second execute happily. errors , warnings appear in ....\logs\php_error.log or ....\logs\apache_error.log depe

javascript - How to add delay on Bootstrap dropdown menu -

<div class="collapse navbar-collapse navbar-responsive-collapse"> <div class="menu-container"> <ul class="nav navbar-nav"> <!-- shortcodes --> <li class="dropdown mega-menu-fullwidth"> <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown"> vad gör vi? </a> <ul class="dropdown-menu"> <li> <div class="mega-menu-content disable-icons"> <div class="container"> <div class="row equal-height"> <div class="col-md-3 equal-height-in&

php - Can not load model in controller in CakePHP -

i working in cakephp version 1.3.6. have created controller api in project. here, have load created 1 model dealpurchase.php , in model have write code like, <?php class dealpurchase extends appmodel { public $actsas = array('containable'); public $belongsto = array('user'); } ?> now, in controller(android_controller.php) have write function : function get_all_deal() { $this->layout = ""; $this->loadmodel('dealpurchase'); $condition2 = "dealpurchase.deal_status= '0' , dealpurchase.user_id = '45'"; $all_merchant = $this->dealpurchase->find('all',array('conditions'=>$condition2)); } when call function page display blank because of error.so problem in code? you should try debugging here. please sure debugging enabled in config. $this->loadmodel('dealpurchase'); $condition2 = array( "dealpurchase.deal_statue=

javascript - Sinon stub error with local storage in karma tests (es6 + jspm) -

Image
i trying stub setitem , getitem methods of window.localstorage , experimenting issues can seen in screenshot: the point don't know happens window.localstorage object seems different depending on property. when time comes stub setitem method, get testing storage services localstorage "before each" hook "should return current name": typeerror: attempted wrap string property setitem function @ checkwrappedmethod (base/node_modules/sinon/pkg/sinon.js:1355:29) @ object.wrapmethod (base/node_modules/sinon/pkg/sinon.js:1398:21) @ object.stub (base/node_modules/sinon/pkg/sinon.js:3465:26) @ context.eval (client/js/common/services/storage/localstorage.spec.js!transpiled:30:14) @ object.invoke (base/client/jspm_packages/github/angular/bower-angular@1.5.1/angular.js:4628:19) @ context.workfn (base/client/jspm_packages/npm/angular-mocks@1.4.8/angular-mocks.js:2441:20) @ window.inject.angular.mock.inject (base/cli

Defining weekday and weekend in WEKA dataset? -

this small part of dataset: @relation @attribute id {'1','2','3','4','5'} @attribute is_weekend {saturday, sunday} @attribute weekday {monday, tuesday, wednesday, thursday, friday} @attribute leaving_time {'07:00<=x<09:00','09:00<=x<12:30'} @data '1',??,,'09:00<=x<12:30' '2',??,'09:00<=x<12:30' '3',??,'07:00<=x<09:00' '4',??,'09:00<=x<12:30' '5',??,'09:00<=x<12:30' how can define weekday , weekend in data part!? i'm not quite sure you're trying do, because attribute definitions bit confusing. shouldn't is_weekend have values yes , no ? because now, each data point needs weekend day , weekday. assuming how want them, set attribute not fit missing: @data '1',?,'monday','09:00<=x<12:30' '2',?,'thursday','09:00<=x<12:30'

cuda - What dimension should the cuRAND initialization kernel have -

i working on program in there 2 main kernels. due impact on performances, each kernel has own dimensions. have 2 different block , grid sizes (whose values cannot known @ compile time). both kernels need use curand library, before third kernel launched initialize curand state on device. my question comes when need choose dimensions of kernel. let's have kernel 1 , 2: block_size_1 = 256 grid_size_1 = 10 block_size_2 = 512 grid_size_2 = 2 for curand initialization kernel, should use largest sizes ( 10*512 ), or highest number of threads ( 10*256 )? pick biggest kernel size, because maximum number of curand generators you'll use. can easyly evaluate size need using like __host__ void fun(){ curandstate * randstate; int mycurandsize = ((block_size1 * grid_size1) > (block_size2 * grid_size2))? block_size1 * grid_size1 : block_size2 * grid_size2); error = cudamalloc((void **)&randstate, mycurandsize * sizeof(curandstate)); if (error =

selenium - Yii2, Codeception: How to configurate acceptance tests to use the URL of my test server -

i want run functional tests on localhost, acceptance test on test server. changed configuration of acceptancetester (yii\tests\codeception\frontend\acceptance.suite.yml) from: webdriver: url: 'http://localhost' to: webdriver: url: 'https://test.mydomain.com' when run tests, need have following url in browser: https://test.mydomain.com/test-page have: https://test.mydomain.com/yii/frontpage/web/index-test.php/test-page how can remove root yii/frontpage/web/index-test.php/ url? in end have solved problem configuring test server able run acceptance tests: i have installed x window system , firefox, configured localhost in apache, works url: https://test.mydomain.com/yii/frontpage/web/index-test.php/test-page , and adjusted acceptance tests, work on test server (added more time in wait commands) this solution has advantage, colleagues can run tests independent me.

Chrome Safari ignores no-store cache-control directive -

i have page checkbox , link page a. i click on checkbox, click on link, go page a, click browser button, come back i still see checkbox checked, it's not clearing up. i have used proper cache-control headers below. cache-control: no-store, no-cache, must-revalidate pragma: no-store, no-cache expires: 0 also, tried this: document.body.onunload = function(){}; document.body.onpageshow = function(evt) { if (evt.persisted) { document.body.style.display = "none"; location.reload(); } }; nothing works in chrome , safari (desktop) works on ie, firefox, mobile chrome , safari. please help. this seems same problem why checkbox stay checked when reloading page? what worked me add autocomplete="off" form element on page.

php - How to get values from Prestashop module database -

i have quite simple prestashop module want rework use own database table separate language etc. previously module writen without multilingual function simple ps_configuration table use. public function hookdisplayfooter($params) { $value = configuration::get('mymodule_settings'); and have public function hookdisplayfooter($params) { $value = tools::getvalue('mymodule_settings'); everything works can't mymodle_settings values in function anymore. input array. array( 'type' => 'text', 'label' => $this->l('settings'), 'desc' => $this->l('my module settings.'), 'name' => 'mymodule_settings', 'lang' => true, 'size' => 64, ), this database table `mymodule_settings` varchar(255) not null, the mymodule_settings values correctly placed in database , see them in module bo, , question how them funct

java - Fail to read from bigtable in dataflow -

i using dataflow work write data bigtable. currently, got task read rows bigtable. however, whenever try read rows bigtable using bigtable-hbase-dataflow, fails , complains follow. error: (3218070e4dd208d3): java.lang.illegalargumentexception: b <= @ org.apache.hadoop.hbase.util.bytes.iterateonsplits(bytes.java:1720) @ org.apache.hadoop.hbase.util.bytes.split(bytes.java:1683) @ org.apache.hadoop.hbase.util.bytes.split(bytes.java:1664) @ com.google.cloud.bigtable.dataflow.cloudbigtableio$abstractsource.split(cloudbigtableio.java:512) @ com.google.cloud.bigtable.dataflow.cloudbigtableio$abstractsource.getsplits(cloudbigtableio.java:358) @ com.google.cloud.bigtable.dataflow.cloudbigtableio$source.splitintobundles(cloudbigtableio.java:593) @ com.google.cloud.dataflow.sdk.runners.worker.workercustomsources.performsplit(workercustomsources.java:413) @ com.google.cloud.dataflow.sdk.runners.worker.workercustomsources.performsplitwithapilimit(workercustomsources.java:171) @ com.go

jquery - select2 with ajax MVC does not hit results option -

i using select2 autocomplete , select multiple options. below how initialize select2 $(".selectpickerphone").select2({ allowclear: true, minimuminputlength: 2, ajax: { cache: false, datatype: "json", type: "get", url: "@url.action("getcontactnumbers ", "hmcontroller")", data: function(searchterm) { return searchterm; }, results: function(data) { debugger; if (data.isuser) { return; } return { results: $.map([data], function(item) { return { text: item.name, id: item.phonenum, data: item } }) }; } }, formatresult: function(response) { data = response.data; console.log(data); this.description = '<div id="fmu_select2_ajax_result">' + "<div>nom du produit : " + data.name + "</div>" +

mongodb - Mongoose - always return null instead of an error when no result found? -

why mongoose return null instead of error when no result found? person.findone({ 'name': 'ghost' }, function (err, person) { console.log(err); // null if (err) return handleerror(err); }); the person 'ghost' not exist in db expecting error null instead. why? how can get error instead? because mongoose return error when there error, not finding result not error. can handle response if got null, : person.findone({ 'name': 'ghost' }, function (err, person) { if(person === null) { console.log('no results found'); } if (err) return handleerror(err); }); or person.findone({ 'name': 'ghost' }, function (err, person) { if (err) { return handleerror(err); } else if (person) { return person; } else { return 'no results found';  } });

jquery - How to use Chaining with Nested, Revealing Module Patterns in JavaScript? -

i'm struggling head around couple of js patterns joined together: revealing module pattern , , chaining pattern . what ideally able invoke multiple methods single initialising function this: components .loader() .menu() .toolbar(); and works long methods define publicly return this; . things start go wrong when need nest revealing module patterns in order expose deeper methods invoked outside of initialisation this: components .menu .close(); the problem doing menu no longer returns components , instead returns it's child methods means breaks chain @ point. here "complete" example illustrate try achieve: var components = function () { var loader = function () { console.log("components.loader initialisation"); return this; } var menu = function () { console.log("components.menu initialisation"); var open = function () { console.log

join - Matching two dataframes in scala -

i have 2 rdds in scala , converted dataframes. have 2 dataframes.one produniquedf have 2 columns named prodid , uid , having master data of product scala> produniquedf.printschema root |-- prodid: string (nullable = true) |-- uid: long (nullable = false) second, ratingsdf have columns named prodid , custid , ratings scala> ratingsdf.printschema root |-- prodid: string (nullable = true) |-- custid: string (nullable = true) |-- ratings: integer (nullable = false) i want join above 2 , replace ratingsdf.prodid produniquedf.uid in ratingsdf to this, first registered them 'temptables' produniquedf.registertemptable("produniquedf") ratingsdf.registertemptable("ratingsdf") and run code val testsql = sql("select produniquedf.uid, ratingsdf.custid, ratingsdf.ratings produniquedf, ratingsdf produniquedf.prodid = ratingsdf.prodid") but error comes : org.apache.spark.sql.analysisexception: table not found: produniquedf; li

c# - Unity5 Plane pivot point creating -

i created 50x50 planes c# script. used vertices, uv , triangles. , planes making area. no problem there. plane_0_0 first 1 positioning @ center. need each plane pivoting bottom-left. how can pivoting bottom-left script? okay, think i've got it. want bottom-left corner "tile" center of whole "tileset" / "map", if , when rotate "everything", should center. okay, it's easy. need is, make plane_0_0 tile parent of rest of tiles (set .parent property of tiles want part of pivoting "pivot tile" go). later on, can change this. if e.g. other tile should pivot center, can "reset parenting". reparenting expensive routine. edit as (like wrote above) reparenting expensive operation, thinking alternatives , found use: create gameobject (let's plane) without mesh renderer, collider, etc , pull out size of field (in editor). make parent of tiles in scene. then, whenever need 'pivot' everything, can go paren

Convert Integer value into Hour value (AM / PM) in SQL Server -

i have table hour values . need convert hour value am/pm format, shown here: val hour --------------- 9 9:00 19 7:00 pm 10 10:00 19 7:00 pm 14 2:00 pm i have tried logic: declare @timing varchar(5)='15:02' declare @time time=cast(@timing time) select convert(varchar(50),@time, 100) but requires val converted varchar . there other way or inbuilt function available in sql server this? select format(dateadd(hh,val,'00:00:00'),'hh:mm tt') yourtable

.net - How to draw color spectrum / space using CIE L*A*B values in c# or java? -

any pointers or code samples or third party libraries on how draw color spectrum using cie l a b values using .net or java ? we tried using webgl draw using rgb values not display whole color space lab values. thanks bhanu

javascript - mongodb -- count() much slower than find()? -

i'm using mongoose count number of documents match query. index query is: {createdat: -1, status: -1, oid: -1} mongo version 3.2, amount of docs in collection 1.75 million. if do: model.find({ createdat: {'$gte': threemonths, '$lt': today}, status: {'$in': model.status_set} }).select({_id: 0, status: 1}).count().then((c) => result[alias] = c) it takes more 2 minutes. if do: model.find({ createdat: {'$gte': threemonths, '$lt': today}, status: {'$in': model.status_set} }).select({_id: 0, status: 1}).lean().then((c) => result[alias] = c.length) then takes 2.5 seconds. something i'm doing wrong? can speed things up? edit: explain logs. for count: "executionstats" : { "executionsuccess" : true, "nreturned" : 0, "executionti

Searching Menu template suggestion by regions in Drupal 8 -

i want write theme suggestion, add template suggestions contains region name. example in 'header region' want template this: menu--header.html.twig, or in 'custom region' - menu--custom_region.html.twig. i want if have 2 menus in same region, want templating 1 template. i tried function themename_theme_suggestions_menu_alter(array &$suggestions, array $variables){} in themename.theme file, dont know how query region, is. in block alter, know region, think if call block, contains menu, know region too. i in .theme file. is there solution? i've tried achieve same thing doesn't need region name in suggestion. block id , when place block in header region can change block id. check answer: https://drupal.stackexchange.com/a/219770/32059