Posts

Showing posts from June, 2013

angular 2 reactive forms issue -

i have question regarding angular 2 reactive forms. created below country.ts export class country { countryname: string; countrycode: number } and database in-memory-data.service.ts import { inmemorydbservice } 'angular-in-memory-web-api'; import { injectable } '@angular/core';` @injectable() export class inmemorydataservice implements inmemorydbservice {` createdb() { let countries = [ { countryname: 'saudi arabia', countrycode: '+966' }, { countryname: 'bahrain', countrycode: '+973' }, { countryname: 'united kingdom', countrycode: '+44' },{ countryname: 'united arab emirates', countrycode: '+967' },{ countryname: 'brazil', countrycode: '+55' },{ countryname: 'czech republic', countrycode: '+420

javascript - Vue.js displays a few items only when using array push -

i using vue.js in codeigniter. trying push array, displays 10 items. in console looks okay, gives me error in view. here code //vuejs.js this.approval_enddate = []; (var = 20; >= 0; i--) { this.approval_enddate.push(i); } //view.php <ol> <li v-repeat="sem: approval_enddate">{{ sem }}</li> </ol> but here output 20 19 18 17 16 15 14 13 12 the value 11 1 not displayed. please help. thanks!

scala - scalding with Custom Tap could not build flow from assembly -

everyone have scalding project save data hbase using latest or stable engine in environtment, these engine , dependencies used project : engine : zookeeper 3.4.9 hbase 1.2.3 hadoop 2.7.2 dependencies : librarydependencies ++= seq( "org.apache.hbase" % "hbase" % "1.2.3", "org.apache.hbase" % "hbase-server" % "1.2.3", "org.apache.hbase" % "hbase-protocol" % "1.2.3", "org.apache.hbase" % "hbase-common" % "1.2.3", "org.apache.hbase" % "hbase-client" % "1.2.3", "org.apache.hadoop" % "hadoop-core" % "1.2.1", "org.apache.hadoop" % "hadoop-common" % "2.7.2", "cascading" % "cascading-core" % "2.6.1", "cascading" % "cascading-local" % "2.6.1",

excel - Vlookup for textbox in the whole workbook -

i'm trying solve problem: i'm having table in sheet1, in column there'll names of several text boxes in workbook, in column b there'll values corresponding text boxes. string in column b exceeded 256 characters (probably >1000 characters) can't link text boxes corresponding cells formula. in short, want vlookup text boxes in whole workbook (with multiple sheets). possible? appreciated :d in advanced. sampledownload

windows - c# run apk file on android emulator -

we want run our android application on windows tablet thinking write application check android emulator running or not .apk installed or not. there other approach build application? my approach: (call command c# process class) start or launch android emulator waiting android emulator ready install or launch .apk android emulator

Where to download previous version of .net core sdk? -

we have project uses .net core sdk 1.0.0-preview2-003121 . currently, i'm setting ci server automatic builds. in server, i'm getting error because .net core sdk installed not same 1 in project. error preview2-003121 not installed or cannot found under path c:\program files\dotnet. i did command line check dotnet --version , gave me 1.0.0-preview2-003131 where can download older versions of .net core sdk? have tried following links , give me latest version download https://github.com/dotnet/cli https://www.microsoft.com/net/core#windows this article explains how install correct .net core version. hth. http://blog.stephencleary.com/2016/06/dotnet-netcore-versions.html i able away following download https://dotnetcli.blob.core.windows.net/dotnet/preview/binaries/1.0.0-preview2-003121/dotnet-dev-win-x64.1.0.0-preview2-003121.zip copy 1.0.0-preview2-003121 directory inside dotnet-dev-win-x64.1.0.0-preview2-003121.zip\sdk paste in c:\program files

regex - replace as raw string in python -

this question has answer here: escaping regex string in python 3 answers just minor query. new python. replacing string content as: re.sub(all, val, parseddata['outdata']) where all contains round braces, , might contain other characters. >>> print picdspvers="dspfw:1.0008(1.0008),fpga1:2.0925(2.0925),fpga2:1.0404(1.0404),mcu:1.0000(1.0000)" because of matching fails. pattern coming interface, don't wanna put \ in data. i tried 'r' , re.u option also, still match fails. re.search('picdspvers="dspfw:1.0008(1.0008)',parseddata['outdata']) how can direct python treat matching pattern string. fyi, using python2.x if don't want matching pattern treated regular expression, don't use re.sub . plain strings, use str.replace() , so: new_outdata = parseddata['outdata'].repla

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

i have little problem on project. , turns out query result returns nothing when value of first name or last name has 'ñ' in it. here's code config.php: <?php ini_set('mssql.charset', 'utf-8'); header('content-type: text/html; charset=utf-8'); $servername = "192.168.1.21"; /* ip add of db server */ $connection = array("database" => "db", "uid" => "?", "pwd" => "***"); $conn = sqlsrv_connect($servername, $connection); if(!$conn){ echo "connection not established."; die(print_r(sqlsrv_errors(), true)); } ?> myquery: $idnumber = $_post["idnum"]; $response = array(); $query2 = "select clname, cfname, cmname, cqualifier student cidno = '$idnumber'"; try{ $stmt2 = sqlsrv_query($conn, $query2); } catch(pdoexeption $ex){ $response["success"] = 0; $response["message"] = "d

php - Error 4600 Zoho CRM Insert Record using cURL -

getting error - 4600 unable process request. please verify whether have entered proper method name, parameter , parameter values. $auth="authkey"; $email = $_post['lowner']; $firstname = $_post['fname']; $lastname = $_post['lname']; $email = $_post['email']; $phone = $_post['phone']; $url = 'https://crm.zoho.com/crm/private/xml/leads/insertrecords?'; $post = 'newformat=1&authtoken='.$auth.'&scope=crmapi&xmldata=<leads> <row no="1"> <fl val="lead owner">'.$email.'</fl> <fl val="first name">'.$firstname.'</fl> <fl val="last name">'.$lastname.'</fl> <fl val="email">'.$email.'</fl> <fl val="phone">'.$phone.'</fl> <fl val="description">insert zoho lead</fl> </row> </leads>'; //=================

jquery - PHP enable 2 links in same page after submit button is clicked -

i have php form name, email & submit button. below submit, there 2 disabled links in grey. 1. pdf download, 2. redirect other site. once submit button hit, form data sent mail , below 2 links activate. <form class="form-horizontal" name="contactform" role="form" action = "popupform.php" method="post"> <div class="form-group"> <div class="col-sm-10"> <input type="name" class="form-control" name="name" id="inputemail3" placeholder="namn:"> </div> </div> <div class="form-group"> <div class="col-sm-10"> <input type="name" class="form-control" name="email" id="inputpassword3" placeholder="e-post:"> </div> </div> <div class="form-group"> <div class="col-sm-10

c++ - How to specialize templated class methods based on type traits? Using std::enable_if works for non-class functions, but fails for class methods -

i've been trying create specializations of templated class methods such have different method definitions compiler selects based on whether argument integral type of enum class, clang gives me error: out-of-line definition of 'parsestring' not match declaration in 'mydata' while gcc gives following: error: prototype 'typename std::enable_if::value, void>::type mydata::parsestring(t&, std::string)' not match in class 'mydata' error: candidate is: template static void mydata::parsestring(t&, std::string) the following code used produce these errors. i've experimented other ways of using enable_if , such in template parameter rather return type, nothing far has worked. if make templated functions non-class functions instead of class methods, work fine. (removing static makes no difference.) is there way use enable_if templated class methods, or better way achieve same thing? #include <string> #include

java - Hibernate 2nd level cache. Store immutable objects (intact) and other in hydraded form -

is possible turn on hibernate option hibernate.cache.use_reference_entries selected classes (in case immutable dictionaries)? hibernate.cache.use_reference_entries optimizes second-level cache operation store immutable entities (aka "reference") not have associations cache directly, case, lots of disasseble , deep copy operations can avoid. default value of property false.

python - Jenkins doesn't include refrenced files when building conda package -

i building small conda package jenkins (linux) should just: download .zip external refrence holding font files extract .zip copy font files specific folder build package the build runs successful, package not include font files, empty. build.sh has: mkdir $prefix\root\share\fonts cp *.* $prefix\root\share\fonts my meta.yaml source has: source: url: <ftp server url>/next-fonts.zip fn: next-fonts.zip in jenkins do: mkdir build conda build fonts the console output strange though @ part: + mkdir /var/lib/jenkins/conda-bld/fonts_1478708638575/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_prootsharefonts + cp lato-black.ttf lato-blackitalic.ttf lato-bold.ttf lato-bolditalic.ttf lato-hairline.ttf lato-hairlineitalic.ttf lato-italic.ttf lato-light.ttf lato-lightitalic.ttf lato-regular.ttf myriadpro-blac

Issue with connectionDefaults.content.template Kendo UI Diagram -

i want content divide 2 lines. per this thread template function not allow line break. tried setting connectiondefaults.content.visual below function: var getconnection = function (data) { var g = new kendo.dataviz.diagram.group({ autosize: true }); var text1 = new kendo.dataviz.diagram.textblock({ text: data.label.name, fontsize: 16 }); g.append(text1); var text2 = new kendo.dataviz.diagram.textblock({ text: data.label.value, fontsize: 16 }); g.append(text2); return g; } but problem here data field not populate connection data due assigning values not possible. a solution appreciated.

Android Notification .addAction function -

mdatabase.child("reportlist").child(i).child("ambulance_coming").setvalue("rejected"); above code allows me make notification. problem is, i've added 2 .addaction notification. when press reject button, want line notificationcompat.builder builder = new notificationcompat.builder(homescreenambulance.this); builder.setsmallicon(r.drawable.ic_launcher); builder.setautocancel(true); string header = "report received:"; builder.setcontenttitle(header); string body = "location:"+location; builder.setcontenttext(body); intent intent = new intent("ph.edu.upm.agila.extendthelife.controller.rescuer.ambulance.mainscreenambulance"); intent.putextra("fa_id",fa_id);

node.js - How to get conversation details in microsoft bot framework for skype? -

i'm able conversation details webchat using https://webchat.botframework.com/api/conversations/[conversationid]/messages service url skype channel https://skype.botframework.com , dont find documentation getting conversation details you can use directline rest api (see docs ). the direct line api simple rest api connecting directly single bot. api intended developers writing own client applications, web chat controls, mobile apps, or service-to-service applications talk bot. within direct line api, find: authentication mechanism using standard secret/token patterns ability send messages client bot via http post message ability receive messages polling http stable schema, if bot changes protocol version you need enable directline channel bot on (see screenshot ) you don't have access each specific channel endpoint separately, can (with limitations) through directline api. start new conversation post /api/conversations get messages in

Calling methods in C++ dll from C# without any info, only header files -

i have third-party dll trying write wrapper in c# , have c++ sample code, works, when try calling methods in dll, error: unable find entry point named 'scan' in dll 'scard-com.dll'. please point out problem: here part of .h file used in sample c++ app interface iscard_cardreaderdevices : iunknown { virtual uint __stdcall scan(void) = 0; virtual uint __stdcall getdevicecount(void) = 0; virtual const char * __stdcall getdevicename(uint id) = 0; virtual const char * __stdcall getserialname(uint id) = 0; virtual iscard_cardreader * __stdcall connectbyid(uint id) = 0; virtual iscard_cardreader * __stdcall connectbyname(const char *name) = 0; virtual iscard_cardreader * __stdcall connectbyserial(const char *serial) = 0; virtual bool __stdcall disconnect(iscard_cardreader *reader) = 0; virtual iscard_secmsg * __stdcall attachsecmsg(iscard_cardreader *reader) = 0; virtual void __stdcall detachsecmsg(iscard_secmsg *secmsg) = 0; virtual iscard_script * __stdcall attac

angularjs - stripTrailingSlashes in angular-resource not working -

i'm having problem using $resource in application, need pass context retrieve json file parameter $resource , final url has '%2f' instead of '/' i read striptrailingslashes can used avoid this, can´t make work. tried using in module.config , in $resource. i have simple plunkr show this , although in plunkr seems work '%2f'. able see network petition in console slash instead. this code angular .module('appmodule', ['ngresource']) .controller('appcontroller', ['$resource', function($resource) { var vm = this; var reader = $resource(':context' + '/:file.json', {}, { query: {method: 'get', params: {context: '@context', file: '@file'}} }, { striptrailingslashes: false }); function load(context, file) { console.log('resource in ' + context + '/' + file); reader.query({context:context, file:file}, function(data) {

postgresql - How can you archive RDS postgres database by using recovery.conf? -

where can locate , edit file amazon rds instance?what path? i have connected database using command line. can access file via ec2 instance (since cannot connect rds directly)? can edit recovery.conf property values using database queries? what property should change in file? can somehow use amazon db parameter this? how can file trigger script? can script executed periodically archive database? how can use following pg_settings property add 1 more script while archiving database? "archive_command";"/etc/rds/dbbin/pgscripts/rds_wal_archive %p" too many questions, not idea how go , cannot find documentation on this. the answer these "you can't". rds sealed system. don't access wal archiving, except via features rds self exposes in form of read-replicas, backup management, etc. internally rds archives wal s3, don't have , cannot access s3 buckets uses. nor can change archive_command or script invokes. you can't

javascript - Is it possible to INSERT/UPDATE 8,000,00 records in MySQL within few minutes through Node JS -

i trying insert/update if exists in mysql 8,000,00 records through node js. i using node js "mysql" package. my queries are: insert .... on duplicate update type. for 5000 queries of type separated semicolon sending database using connection.query() method. values of query come text file contains 8,000,00 records. reading file using node js readline is possible insert things withing few minutes may 10 minutes? yes, depends on io, not language or platform

javascript - AngularJS Make a scope variable available before view is loaded -

i creating set of select boxes, bound list of values in view using directive select tag in it, on div. populated values, after rendered want set value depending on stored value in it. i trying setting model value in ng-init , using function call in controller initializes array stored values in it. however, array undefined when select boxes rendered , ng-init called. how ensure variable set when ng-init called on select boxes? angular.module('myapp') .controller('aclctrl', function() { $scope.retrievesetvalues(id) { //.then promise stored values, defined in factory, sets variable accessed in initializeselects() } $scope.retrievesetvalues($scope.myid); } view: selector directive: .directive("selector", [ function() { return { controller: function() { this.myvalues= ['a', 'b', 'c']; }, require: 'ngmodel',

javascript - How to update a table from Ajax post callback Symfony 3 -

Image
i have table needs updated ajax callback, i'm struggling find right way so. here picture how table should like: i cannot find right way so, here current html script: <table class="table table-striped"> <thead> <tr> <th>#</th> <th>12nc</th> <th>object description</th> </tr> </thead> <tbody> <tr> <th scope="row"><input id="id"></th> <td><input id="nc"></td> <td><input id="des"></td> </tr> </tbody> and here callbacks ajax: person_name:$('#input_text').val() } , function (data) { obj1 = data[0]; obj2 = data[1]; var obj = json.parse(obj2);

In ARM big.LITTLE architecture is there any ID register to find how many core/cpu present in a cluster dynamically? -

want detect how many cpu/core present in cluster dynamically. there id register support in arm big.little architecture? i think information available in cpu id register. if havent found already, available @ http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360e/cacedhjg.html

debugging - Deconstruct array of structs with natvis -

i'm looking way display entries of array of structs in separate arrays natvis in visual studio 2015. display this +-x[0] +-a +-b +-c +-x[1] +-a +-b +-c ... as a +-[0] (= x[0].a) +-[1] (= x[1].a) ... b +-[0] (= x[0].b) +-[1] (= x[1].b) ... c +-[0] (= x[0].c) +-[1] (= x[1].c) edit : following comment, working solution, requires alignment of proxy types, in case can done power-of-two values. #define a(t) __declspec(align(t)) struct c { int a; int b; int c; int junk; }; a(16) struct d { int z; }; a(16) struct db { int junk; int z; }; a(16) struct dc { int junk[2]; int z; }; typedef union { d da; db db; dc dc; } ui; typedef union { c c[50]; ui d[50]; } u; original (incomplete) answer: each type individually parsed , visualized. when parsing each x element there's no way on storing data later aggregate of a,b , c. you can change code such overlapping (union) type m

javascript - Scroll Down to content without changing page URL -

<a href="#scrolldown" id="up">scroll down</a> <p>long paragraph.</p> <a name="scrolldown" id="down">stop here</a> while click id 'up' should scroll down , stop in id 'down'. right when click id 'up' url getting changed. example(../loginaction#scrolldown). how scroll down id 'down' without changing page url. href 'scrolldown' won't apply page url. you can getting offset of element , scrolling it. var elementposition = document.getelementbyid('#myelement').offsettop; window.scrollto(0, elementposition);

css - Set input width to fit text size -

Image
i have , input icon, looking this: <div class="input-with-icon"> <input type="text" value="abcdefeghijklmnopqrtvuvwxyz" class="form-control"> <span class="icon icon-calendar"></span> </div> live demo is possible adjust css input fit text width? e.g. stretch type. currently, .input-with-icon has fixed width, if set auto, input won't stretch. you have many option that. first option change <input type="text"> <textarea class="form-control"></textarea> . <textarea> can handle better characters <input type="text"> . second option use this example . example @megakorre in this link . dont forget vote or put check if got answer. that's dude! happy coding! :)

ios - Crash on response of requestAccessForMediaType when asking permission for camera -

i have issue devices using ios 10, on first launch of app, when try use camera, appears pop-up describes reason app needs use camera, , either user accepts either declines it, app crash. after that, application crashes on splash screen. this issue happens if user tries use camera first time app launched. if user not use camera first time , terminates app, next time camera opens properly. i added nscamerausagedescription in info.plist think changing message in pop-up. the app's info.plist must contain nscamerausagedescription key string value explaining user how app uses data.

ios - Segment framework make UIAlertController to crash -

i follow " https://segment.com/ " implement analytics user usage on ios source. when use uialertcontroller show alert title @"", app crash! don't know why. solve it, must set title of alert nil. , logs: 2016-11-10 17:12:57.185 lightning rider partner[24434:236155] *** assertion failure in -[seganalytics screen:properties:options:](), /users/dungdo/desktop/tcourier-ios/v2_driver/pods/analytics/analytics/classes/seganalytics.m:323 2016-11-10 17:12:57.192 lightning rider partner[24434:236155] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'screen name () must not empty.' *** first throw call stack: ( 0 corefoundation 0x000000010c1f134b __exceptionpreprocess + 171 1 libobjc.a.dylib 0x00000001120f521e objc_exception_throw + 48 2 corefoundation 0x000000010c1f5442 +[nsexception raise:format:arguments:] + 98 3 foundation

regex - URL rewriting to a folder if url has one pattern and ignore the rule if url has another pattern -

i have following directory structure project example admin/ cdn/ client/ .htaccess when url http://192.168.1.121/example/ or http://192.168.1.121/example or http://192.168.1.121/example/category/productname or http://192.168.1.121/example/content/12 , on, it should rewrite client/ folder. but if url has http://192.168.1.121/example/cdn , should ignore rule. can me on this. how write rule in .htaccess thanks you can use /example/.htaccess : rewriteengine on rewritebase /example/ rewriterule ^(?!client/|cdn)(.*)$ client/$1 [l,nc] (?!client/|cdn) negative lookahead ignore rule when uri /example/cdn or /example/client

Python selenium download files -

i use selenium in python automate downloading process. current problem can right url (where pdf file located) using xpath, cannot download files because of os dial box. found solutions suggesting use of webdriver.firefoxprofile().set.preference . however, since need click on website several times using selenium right page, cannot set url directly set.preference @ beginning of program. me integrate set.preference existing program? thank much!! ps. can see website needs authentication. here current code: from selenium import webdriver selenium.webdriver.support.ui import webdriverwait import unittest import os class logintest(unittest.testcase): def setup(self): self.driver=webdriver.firefox() self.driver.get("myinitialurl") def test_login(self): driver=self.driver emailfieldid="usernameinput" passfieldid="passwordinput" loginbuttonid="submitbutton" bbbutton="(//a[contains(@href,'blackboard&#

Arranging array in php -

my problem can't arrange array in structure want. array1 , array2 generated dynamically. can see in array 2 has subjectid same in array1, means, element under subject cpe 305. elements in array 2 has id of 5 under the subject of cpe 305. same logic cpe 304. array1: array ( [0] => array ( [subjectid] => 5 [subjectcode] => cpe 305 ) [1] => array ( [subjectid] => 4 [subjectcode] => cpe 304 ) ) array2: array ( [0] => array ( [subjectid] => 5 [soid] => 1 [socode] => [sodesc] => ability apply knowledge of mathematics , science solve engineering problems ) [1] => array ( [subjectid] => 5 [soid] => 3 [socode] => c [sodesc] => ability design system, component, or process meet desired needs within realistic constraints such economic, environmental, social, political, ethical, health , safety, manufacturabil

asp.net mvc - Change DateTime culture info for specific datetime input -

i struggling hours, have model property public datetime validto { get; set; } i display property in view changed format @html.textboxfor(m => model.validto, "{0:dd.mm.yyyy}" }) and problem begin when submit form, because property model.validto has value dd/mm/yyyy . day , month switched position. should mm/dd/yyyy . how map custom date format in view date format in model ? can set custom date format in model ? cannot set culture whole page, need 1 model or better specific datetime property in model. any idea ? experiment 1 - custome model data binder - not work i tried solution answer displayformat applyformatineditmode [datetimeformat(format = "dd.mm.yyyy")] public datetime validto { get; set; } public class datetimeformatattribute : validationattribute { public string format { get; set; } public override bool isvalid(object value) { if (value == null) return true;

ios - How to enable interaction in imageview on animation completion -

i using cabasic animation move uiimageview . uiimageview not detecting touches how enable user interaction after completion of animation? [imageview setuserinteractionenabled:no]; cabasicanimation *theanimation; theanimation=[cabasicanimation animationwithkeypath:@"transform.translation.x"]; theanimation.duration=1; theanimation.repeatcount=1; theanimation.autoreverses=no; theanimation.fromvalue=[nsnumber numberwithfloat:0]; theanimation.tovalue=[nsnumber numberwithfloat:self.view.frame.size.width/2]; theanimation.removedoncompletion = no; theanimation.fillmode = kcafillmodeforwards; [catransaction setcompletionblock:^{ nslog(@"finished"); self.view.userinteractionenabled = true; }]; [imageview.layer addanimation:theanimation forkey:@"slide"]; [catransaction commit]; you can try this. bool animationpause; imageview = [[uiimageview alloc]initwithframe:cgrectmake(250, 300, 100, 100)]; uitapgesturerecognizer *singlet

javascript - Save canvas transformed with matrix3d -

i have canvas element loaded image. need change image perspective , have implemented css transform: matrix3d . have code builds transformation matrix based on coordinates , applies canvas. have this: // code builds matrix 4x4 // apply matrix canvas document.getelementbyid('test-canvas').style.transform = 'matrix3d(' + matrix.join(',') + ')'; it works fine, need save transformed image, when i'm trying via canvas.todataurl saves original image, not transformed one. how can save transformed image canvas? thanks

Difference between object and object.prototype in Javascript -

this question has answer here: how new operator work in javascript? 2 answers ok here's bit of code working atm. my problem don't difference between object , object prototype. until thought, if make new object, e.g. new memory, inherits properties declared in memory. in code, however, need add options memory.prototype. so core question is: difference between properties of object , properties of object.prototype? edit: specify: in memory function log this.options. doesn't work, unless include memory.prototype.options = {...}. if new memory inherits properties memory , defined e.g this.options.availablecards above, why need add options prototype? var creatememory = function (){ new memory( {wrapperid: 'memory-game'} ); }; var memory = function (options) { //check required options if ((options.wrapperid ==

aggregation framework - Recursive search on a collection in MongoDB -

i have list of documents in mongodb tree structure, model tree structures parent references pattern used. want single aggregation query returns ancestor list(till root), given 'name' property. structure: { '_id': '1', 'name': 'a', 'parent': '', }, { '_id': '2', 'name': 'b', 'parent': 'a', }, { '_id': '3', 'name': 'c', 'parent': 'b', }, { '_id': '4', 'name': 'd', 'parent': 'c', } aggregation result:(given, name = 'd') { '_id': '4', 'name': 'd', 'ancestors': [{name:'c'}, {name:'b'}, {name:'a'}] } note: can't change document structure now. cause many problems. saw many solutions suggest use model tree structures array of ancestors . cannot use now. there way achieve above

Get values of void pointer to an array -

// c lang #include <stdio.h> void func (void *ptr) { int *iptr = ptr; printf("{%d, %d, %d}\n", iptr[0], iptr[1], iptr[2]); } int main() { int ary[] = {111, 222, 333}; func(&ary); return 0; } => output: {111, 222, 333} // vala public void func (void *ptr) { int *iptr = ptr; print("{%d, %d, %d}\n", iptr[0], iptr[1], iptr[2]); } void main(string[] args) { int[] ary = {111, 222, 333}; func(&ary); } => output: {155115112, 155115112, 3} ??? how values of void pointer array, in vala? ※ using void[] better using void* ? in example c code void* equivalent array of bytes (some chunk of memory), this: public void func (uint8[] ptr) { int[] iptr = (int[]) ptr; print("{%d, %d, %d}\n", iptr[0], iptr[1], iptr[2]); } void main(string[] args) { int[] ary = {111, 222, 333}; func ((uint8[]) ary); } this type unsafe however. vala uses addional hidden parameter length is

javascript - How to use computed property with getters and setters to trigger commit in Vuex -

i using computed property: category in input field bound v-bind following: <select name="category" :value="category"> <option value="ac">ac</option> <option value="tv">tv</option> ... </select> and have getters , setter computed property follows: computed:{ category: { () { return this.$store.state.category }, set (value) { console.log("value of category changed") this.store.commit("set_cat", value) } } } but when change input, setter not called, how can achived this, or other way can change state variable directly html input field. here fiddle this. this worked change v-bind v-model in select . <select name="category" v-model="category"> <option value="" disabled hidden>select product</option> .... here working fiddle . please post answ

linux - Gradle keeps running and can not find symbol R in offline -

Image
i having issue in project gradle, keeps running, have tried work in offline mood facing cannot find symbol r issue. i turned on "offline work" file > other settings > default settings > build,execution,deployment > build tools > gradle > offline work gradle version using 2.14.1. in build.gradle file using compilesdkversion 24 buildtoolsversion "23.0.3" minsdkversion 15 targetsdkversion 24 output of ls -l total 40 drwxrwxr-x 5 adnan adnan 4096 nov 11 10:38 app -rw-rw-r-- 1 adnan adnan 625 nov 10 17:43 build.gradle -rw-rw-r-- 1 adnan adnan 861 nov 10 17:46 danielx.iml drwxrwxr-x 3 adnan adnan 4096 nov 10 17:43 gradle -rw-rw-r-- 1 adnan adnan 855 nov 10 17:43 gradle.properties -rwxrwxr-x 1 adnan adnan 4971 nov 10 17:43 gradlew -rw-rw-r-- 1 adnan adnan 2314 nov 10 17:43 gradlew.bat -rw-rw-r-- 1 adnan adnan 497 nov

android - Changing app theme without recreating activity -

i have custom theme theme.appcompat.daynight.noactionbar parent resources both day , night modes. in documentation, there method provided change theme , unless current activity recreated, theme change next time activity launched. twitter , pocket on other hand change themes without recreating activity user on. how can achieve this?

javascript - HTML, CSS, JS - Align textareas with labels in table display -

i using following css align labels , textareas div { display: table; } p { display: table-row; } label { display: table-cell; text-align: center;} textarea{ display: table-cell; margin-left: 10px} , adapted answer of clément question how align input forms in html . using first paragraph header contains labels. following paragraphs contain textareas . <div> <h4> h1 </h4> <p> <label>id</label> <label>name</label> <label>input1</label> <label>input2</label> <label>input3</label> <label>input4</label> </p> <p> <label>123213</label> <label>test1</label> <textarea title="1" style="border:1px solid black;"></textarea> <textarea title="2" style="border:1px solid black;"></textarea> <textarea title="3" style=

c - Can I change the Global Offset Table/GOT or Procedural Linkage Table/PLT programmatically? -

the availability of platform-specific features, such sse or avx, can determined during runtime, useful, if not want compile , ship different objects different features. the following code example allows me check avx , compiles gcc, provides cpuid.h header: #include "stdbool.h" #include "cpuid.h" bool has_avx(void) { uint32_t eax, ebx, ecx, edx; __get_cpuid(1, &eax, &ebx, &ecx, &edx); return ecx & bit_avx; } instead of littering code runtime checks, such above, repeatedly perform checks, slow , introduce branching (the checks cached reduce overhead, there branching nonetheless), figured use infrastructure provided dynamic linker/loader. calls functions external linkage on platforms elf indirect , go through procedural linkage table/plt , global offset table/got. suppose there 2 internal functions, basic _do_something_basic , somehow optimized version _do_something_avx , uses avx. export generic do_something sym

javascript - Focus() is not working in ionic using ios 10 safari browser -

focus() not working in ionic using ios 10 safari browser. it works when use chrome emulator not when use ios 10 safari browser. below code i'm using focus element. var rvmobileapp = angular.module('rvmobileapp.shared.directive'); rvmobileapp.directive('rvsetfocus', function ($timeout) { return { link: function (scope, element, attrs) { $timeout(function () { element[0].focus(); }, 100); } }; thanks in advance.. by default ios not allow keyboard interaction except when input field tapped. to override this, need put in config.xml: <preference name="keyboarddisplayrequiresuseraction" value="false" />

c++ - Crosscompile OpenCV with FFMPEG support -

Image
i trying cross compile opencv ffmpeg support arm board buildroot based custom linux. host ubuntu pc. i want static opencv libraries. i have downloaded ffmpeg source , crosscompiled following configuration ./configure \ --enable-cross-compile \ --cross-prefix=arm-linux-gnueabihf- \ --target-os=linux \ --arch=arm \ --disable-static \ --enable-shared \ --enable-nonfree \ --enable-ffmpeg \ --enable-gpl \ --enable-swscale \ --enable-pthreads \ --disable-yasm \ --disable-stripping \ --prefix=../build \ --extra-cflags=-i../build/include --extra-ldflags=-l../build/lib the paths correct , ffmpeg built successfully. when try configure opencv cmake-gui, have manually specify paths. despite this, opencv configuration unable resolve ffmpeg correctly i have attached screen shot below it cannot resolve ffmpeg versions. tried ignore , build fails linker error linking cxx static library ../../lib/libopencv_features2d.a [ 49%] built target opencv_features2d make: *** [all] error

python - Do not internationalize/translate URLs -

problem i'm trying upgrade django 1.10.3 django 1.9.8 . tests failing however, because reason django trying translate/internationalize urls when reverse() them. i've not changed when comes internationalization , turn "feature" off. not failing lot of tests, there projects have refer urls of website statically. means url on website not allowed change (or have edit them every translation django comes with, real pain). error the actual error i'm encountering in tests following: traceback (most recent call last): file "/tests/unit/views/test_index.py", line 14, in setup self.url = reverse('indexpage') file "/local/lib/python2.7/site-packages/django/urls/base.py", line 91, in reverse return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))) file "/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 346, in _reverse_with_prefix possibilities = self.

c# - Negamax for simple addition game -

i'm trying implement negamax simple game players alternate adding 1 or 2 running sum. player increases total 21 wins. i'm using pseudocode here: https://en.wikipedia.org/wiki/negamax#negamax_base_algorithm the human player moves first computer should win adding number makes total congruent 0 mod 3. i'm not doing dynamic move generation. comparing negamax score adding 1 running sum negamax score adding 2 running sum. int total = 0; console.writeline("the current total " + total); while (total < 21) { console.writeline("add 1 or 2?"); total += convert.toint32(console.readline()); console.writeline("you increased total " + total); if (total == 21) { console.writeline("you win"); break; } if (negamax(total + 1, 1) > negamax(total + 2, 1)) total++; else total += 2; console.writeline("computer increased total " + total); if (total == 21) { console.wr

filesystems - WebDAV FileSystemProvider - Java NIO -

i have java application lots of nio methods files.copy , files.move , files.delete , filechannel ... what trying achieve: want access remote webdav server , modify data on server basic functions upload, delete or update remote webdav data - without changing every method on application. here comes idea: i think webdav filesystem implementation trick. adding custom webdav filesystemprovider managing mentioned file operations on remote data. i've googled lot , apache vfs sardine implementation looks - seems apache vfs not compatible nio? here's example code, imagine it: public class webdavmanagertest { private static defaultfilesystemmanager fsmanager; private static webdavfileobject testfile1; private static webdavfileobject testfile2; private static filesystem webdavfilesystem1; private static filesystem webdavfilesystem2; @before public static void initwebdavfilesystem(string webdavserverurl) throws filesystemexception, org.apache.commons.vfs2.filesystemexcepti

linux - Rails request timeout on browser but backend still works -

i have zone , location , capacity models such that, zone has_many :locations , location has_many :capacities . on rails4 production server, when try create more 500 locations capacities, times out , shows 500 error. on backend, keeps creating locations capacities. how can stop server timing out , know when backend process complete. ps: using nginx on linux environment.

reactjs - Defining attributes in React.js -

i wondering there difference between these 2 ways of defining react component attributes: var = react.createclass({ ssestream: new eventsource("/stream/"), componentdidmount: function() { this.ssestream.addeventlistener("message", function(msg) { // }.bind(this)); }); var = react.createclass({ componentdidmount: function() { this.ssestream = new eventsource("/stream/"); this.ssestream.addeventlistener("message", function(msg) { // }.bind(this)); } }); note difference of how react component attribute ssestream defined. guess in second example attribute being recreated every time component re-rendered whereas in first created once , therefore first way should preferred. so question is, there slightest differenc