Posts

Showing posts from February, 2010

sql server - Using SQLSRV extension in PHP CLI script -

folks! this first experience big scripts in php cli , i'm facing 'not found' error when using sqlsrv_connect function in script. running script in browser okay, connects fine, queries goes fine could; when in cli, friend, shows fatal error: call undefined function sqlsrv_connect() what be, dark magic or newbie developer? this how use function: $_dbip = '127.0.0.1'; $_dbnome = $nome_bd; $_dbuid = 'sa'; $_dbpwd = 'very_strong_secret_pwd'; $conn = sqlsrv_connect($_dbip, array('database' => $_dbnome, 'uid' => $_dbuid, 'pwd' => $_dbpwd)) or die( print_r( sqlsrv_errors(), true)); thanks in advance! there 2 php.ini files , 1 cli , 1 web browser. you need make sure extension enable on both. you should use pdo if possible, because better extension , supports sql server .

Ada - Any defined behavior for incrementing past end of range? -

if define range in ada being 1 .. 1000, there defined behavior ada spec if increment past 1000? for example: type index range 1..1000; idx : index := 1; procedure increment begin idx := idx + 1; end what should expect happen once call increment idx = 1000? wraps around (idx = 1) out of range exception undefined behavior something else? your program fail constraint_error . however, not because try set idx 1001. rather initial value of 0 not within predefined range either. thankfully, compiler warn @ compile time fact. if had set idx permitted value , incremented beyond upper limit in way compiler cannot statically detect, again constraint_error raised (but there won't hint @ compile time). error technically exception can handle other exception in language. note: intentionally linked ancient ada '83 specs above show behavior has been part of language since beginning of time.

vb.net - How to sort datagridview columns programatically -

i being asked sort columns on vb.net created datagridview. it's not code i'm trying help. here part of code: try dim sqlselect string = "select * manpower logouttime null , logindate = #" & datetoday & "# order customername" dim mydataadapter = new oledbdataadapter(sqlselect, myworkforceconnection) mycommandbuilder = new oledbcommandbuilder(mydataadapter) mydataadapter.fill(mydatatable) catch ex exception msgbox(ex.message) exit sub end try if mydatatable.rows.count = 0 messagebox.show("no records found.") exit sub end if dgvmanpower.datasource = mydatatabl dgvmanpower.columns("id").visible = false dgvmanpower.columns("employeename").width = 175 dgvmanpower.columns("employeename").sortmode = datagridviewcolumnsortmode.automatic dgvmanpower.columns("employeename").headertext = "emplo...

cakePHP - PHP EXCEL saves as .html -

i have implemented phpexcel within cakephp application, helper: <?php app::uses('apphelper', 'helper'); /** * helper working phpexcel class. * phpexcel has in vendors directory. */ class phpexcelhelper extends apphelper { /** * instance of phpexcel class * @var object */ public $xls; /** * pointer actual row * @var int */ protected $row = 1; /** * internal table params * @var array */ protected $tableparams; /** * constructor */ public function __construct(view $view, $settings = array()) { parent::__construct($view, $settings); } /** * create new worksheet */ public function createworksheet() { $this->loadessentials(); $this->xls = new phpexcel(); } /** * create new worksheet existing file */ public function loadworksheet($path) { $this->loadessentials(); $this->xls = phpexcel_iofactory::load($path); } /** * set row pointer */ pu...

excel vba - Code to remove 'NULL' values -

let me give quick layout our process is: i export report excel (let's call workbook "raw data"). run extract macro on imported file: sub extract_sort_1601_january() ' dim ans long ans = msgbox("is january 2016 swivel master file checked out of sharepoint , open on desktop?", vbyesno + vbquestion + vbdefaultbutton1, "master file open") if ans = vbno or iswbopen("swivel - master - january 2016") = false msgbox "the required workbook not open. please open correct file , restart extract process. procedure terminate.", vbokonly + vbexclamation, "terminate procedure" exit sub end if cells.entirerow.hidden = false application.screenupdating = false ' line autofits columns c, d, o, , p range("c:c,d:d,o:o,p:p").columns.autofit dim lr long lr = range("b" & rows.count).end(xlup).row 2 step -1 if range("b" & lr).value <> "1" ...

python - Undefer all tables in SQLAlchemy? -

is there direct syntax undefer columns in query object? i know there way of undefering groups, have query touching many tables many groups deferred i'd undefer. it's getting bit verbose. i know can undefer columns in single table, doing every table: # undefer columns specific single class using load + * session.query(myclass, myotherclass).options( load(myclass).undefer("*")) http://docs.sqlalchemy.org/en/latest/orm/loading_columns.html#sqlalchemy.orm.undefer

" ./bin/spark-shell " Not working with Pre-built version of Spark 1.6 with Hadoop 2.6+ on ubuntu 14.04 -

freshly downloaded pre-built version of spark 1.6 hadoop 2.6+ on ubuntu 14.04 onto desktop. i navigated spark shell , initiated spark per link given below quick start spark link using ./bin/spark-shell i receiving following errors . saw similar question asked mac osx here . ashwin@console:~/desktop/spark-1.6.0-bin-hadoop2.6$ ./bin/spark-shell log4j:warn no appenders found logger (org.apache.hadoop.metrics2.lib.mutablemetricsfactory). log4j:warn please initialize log4j system properly. log4j:warn see http://logging.apache.org/log4j/1.2/faq.html#noconfig more info. using spark's repl log4j profile: org/apache/spark/log4j-defaults-repl.properties adjust logging level use sc.setloglevel("info") welcome ____ __ / __/__ ___ _____/ /__ _\ \/ _ \/ _ `/ __/ '_/ /___/ .__/\_,_/_/ /_/\_\ version 1.6.0 /_/ using scala version 2.10.5 (openjdk 64-bit server vm, java 1.7.0_91) type in expressions have them evaluated. type :help...

c - How can a file contain null bytes? -

how possible files can contain null bytes in operating systems written in language null-terminating strings (namely, c)? for example, if run shell code: $ printf "hello\00, world!" > test.txt $ xxd test.txt 0000000: 4865 6c6c 6f00 2c20 576f 726c 6421 hello., world! i see null byte in test.txt (at least in os x). if c uses null-terminating strings, , os x written in c, how come file isn't terminated @ null byte, resulting in file containing hello instead of hello\00, world! ? there fundamental difference between files , strings? null-terminated strings c construct used determine end of sequence of characters intended used string. string manipulation functions such strcmp , strcpy , strchr , , others use construct perform duties. but can still read , write binary data contains null bytes within program , files. can't treat them strings. here's example of how works: #include <stdio.h> #include <stdlib.h> int main() {...

iterator - Operator != is ambiguous for std::reverse_iterator c++ -

i working on container implements own iterator, using std::reverse_iterator<> reverse iteration functionality. can assign reverse iterator rend or rbegin, when try access of functionality (such != or ==) this: 1 intellisense: more 1 operator "!=" matches these operands: function template "bool std::operator!=(const std::reverse_iterator<_ranit1> &_left, const std::reverse_iterator<_ranit2> &_right)" function template "bool avl::operator!=(const tree &left, const tree &right)" operand types are: std::reverse_iterator<avl::avl_iterator<avl::avltree<char, int, std::less<char>, std::allocator<std::pair<const char, int>>>>> != std::reverse_iterator<avl::avl_iterator<avl::avltree<char, int, std::less<char>, std::allocator<std::pair<const char, int>>>>> my iterator operator overloads: bool operator == ( const avl_iterator...

How to mach a string when not followed by another with sed -

does knows how match sed each 'foo' instance excepted when following 'bar' in following string? 'foo       boo      foo    foo       bar foo     foo         foo' desired result (matched instances in bold) ' matched       boo      matched    foo       bar matched     matched          matched ' after big amount of tests, found: sed -e "s/foo\( *\)bar/foo\1bar/g" -e "s/foo/matched/g" -e "s/foo\( *\)bar/foo\1bar/g" it consists in first matching 'foo bar' instances , replacing them temporary string (here 'foo bar'), in matching resting 'foo' instances before replacing "back" 'foo bar' ones original version... (i hope clear...) but anyway not clean @ all. surprised there not more straig...

python - Lektor installation fails on MacBookPro OS X 10.6.8 -

i trying install lektor on macbookpro os x 10.6.8 imagemagick , python2.7 installed. when run installation command: curl -sf https://www.getlektor.com/install.sh | sh the build process runs until gets error when building '_watchdog_fsevents' extension. error is: cc1: error: -werror=unused-command-line-argument-hard-error-in-future: no option -wunused-command-line-argument-hard-error-in-future i've cut , pasted output prior error following code section. how should overcome this? running build_ext building '_watchdog_fsevents' extension creating build/temp.macosx-10.6-x86_64-2.7 creating build/temp.macosx-10.6-x86_64-2.7/src gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -i/usr/local/include -i/usr/local/opt/sqlite/include -dndebug -g -o3 -wall -wstrict-prototypes -wno-error=unused-command-line-argument-hard-error-in-future -dwatchdog_version_string="0.8.3" -dwatchdog_version_major=0 -dwatchdog_version_minor=8 -dwatchdog_vers...

Android - can not get resources from XML -

android - resources xml hi, i developing android app quiz game, game has 24 questions, , each question has string (question) , 4 imagebutton (answer), when user select correct imagebutton`, go next question. but problem is, after selecting first correct answer, screen refreshes new question , new set of images, freezes there, , no matter click, not go next question. have attached code , appreciated!! public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_new_game); // set variables int fourimageid[] = { r.id.1_4a, r.id.1_4b,r.id.1_4c, r.id.1_4d }; questiontext = (textview) findviewbyid(r.id.question1); questionlist = getresources().getstringarray(r.array.question); correctansweridlist = listofimages.getlistofcorrectimages(); imageidlist = listofimages.getlistofimages(); //two dimension array // give values 4 image buttons (int = 0; < 4; i++) { fourimages[i] = (imagebutton) findviewbyid(fourimageid[i])...

python - Remove documents using datetime object? -

trying pass datetime object via pymongo, can't use hardcoded "datetime" shown in pymongo documentation (eg: "2015-12-24t11:59:00z"). simply want delete collections on 7 days old. why erroring on "an integer required" when i'm passing utc date via 'newdate'? from datetime import datetime, timedelta pymongo import mongoclient newdate = datetime.utcnow() - timedelta(days=7) result = db.collection.remove({"receiveddateutc" : { '$lte' : datetime(newdate) }} ) the reason newdate datetime object. result = db.collection.remove({'receiveddateutc' : { '$lte' : newdate }} ) demo: in [67]: newdate = datetime.utcnow() - timedelta(days=7) in [68]: newdate out[68]: datetime.datetime(2015, 12, 29, 22, 2, 41, 391369)

rust - How to convert a *const pointer into a Vec to correctly drop it? -

after asking how should go freeing memory across ffi boundary, on rust reddit suggested rather wrapping structs in box , use vec::from_raw_parts construct vector following struct, , safely dropped: #[repr(c)] pub struct array { data: *const c_void, len: libc::size_t, } however, from_raw_parts seems require *mut _ data, i'm not sure how proceed… the short answer self.data *mut u8 . but, let's talk more details... first, words of warning: do not use vec::from_raw_parts unless pointer came vec originally. there no guarantee arbitrary pointer compatible vec , create giant holes in program if proceed. do not free pointer don't own. doing leads double frees , blow other large holes in program. you need know capacity of vector before can reconstruct it. example struct contains len . acceptable if len , capacity equal. now, let's see if can follow own rules... extern crate libc; use std::mem; #[repr(c)] pub struct array { ...

javascript - Parse string into object -

i data database, when try parse json parse error accrue indicating not valid json format. (because values not in quotation). i can not make changes data valuable & prefer not use replace if possible! var data = "a,b,c"; data = json.parse('['+ data +']'); //error because there no quotation marks is there other javascript function can used parse value of data json or array. as said in comments, data has not json format, don't try parse json. instead, seems represents comma-separated list of values. obtain array these values can use string.prototype.split . and then, wrap each item in object, can use array.prototype.map : "a,b,c".split(',').map(function(item) { return {0: item}; }); simplifying es6 arrow functions , "a,b,c".split(',').map(i => ({0:i}));

java - Appium - Instruments crashed on startup Emulator -

i'm new appium, , i'm trying run example using following code java / intellij osx el capitan 10.11.2 appium version 1.4.16 desiredcapabilities desiredcapabilities = new desiredcapabilities(); desiredcapabilities.setcapability("devicename", "iphone 6"); desiredcapabilities.setcapability("platformname", "ios"); desiredcapabilities.setcapability("platformversion", "9.2"); desiredcapabilities.setcapability("app", "http://appium.s3.amazonaws.com/testapp6.0.app.zip"); driver = new iosdriver(new url("http://127.0.0.1:4723/wd/hub"), desiredcapabilities); driver.manage().timeouts().implicitlywait(30, timeunit.seconds); but i'm getting following error here log info info: [debug] [inst] instruments trace complete (duration : 20.832968s; output : /tmp/appium-instruments/instrumentscli0.trace) info: [debug] [instserver] instruments exited code 0 info: [debug] killall instru...

php - Laravel: a model that belongs to two other models -

in laravel, there way list of objects belong 2 models? for example, model transactions: belongs users belongs category model user: has many transactions model category: has many transactions assuming these relationships correctly defined, kind of query make in, controller, access set of transactions belongs user x , category y? assuming transaction table has foreign keys user_id , category_id , do: $transactions = transaction::where('user_id', '=', 'x') ->where('category_id ', '=', 'y') ->get();

python 3.x - Access denied while installing gurobipy / pysetup (windows) -

in google+ have found same question, unfortunately no answer yet. using gurobi , pycharm , wanted use gurobipy interface now. cannot install gurobipy on windows computer. have done? 1. checked again whether license valid. case. 2. followed instructions on gurobi webside how install gurobipy. each time enter pysetup receiving error message access denied. zugriff verweigert german access denied appreciate time! have 1 , cheers ralph if want setup gurobipy existing python installation have to: run pysetup.bat as administrator (right click -> "run administrator"). pysetup.bat can found in gurobi <installdir>/bin directory. in terminal opens, enter path existing python installation, want install gurobipy . hit enter. done.

c - Instruction executes twice -

this question has answer here: why non-equality check of 1 variable against many values returns true? 2 answers why message print twice? 4 answers i have following piece of code. want user enter a or r , continue executing program, or try user input if enters else. but problem is, when enter illegal value program shows message twice, , not once. how can make message ever show once? label: puts ("a/r?"); c = getchar (); if (c != 'a' || c != 'r') goto label; if user enters a , have press enter key on keyboard input register. key leaves newline character in standard input , therefore character read second time around , test fails again. the test fails input because trying have input 2 things @ same time. have use ...

node.js - How to Stop Yeoman AngularJS Giving Errors Even though Karma Installed Globally -

i'm trying start yeoman angularjs project , receive following errors @ end of project install. have installed of these modules via npm install -g karma , npm install -g phantomjs. why still seeing these errors though globally installed karma , phantomjs? ├── unmet peer dependency jasmine-core@* ├── unmet peer dependency karma@^0.13.0 || >= 0.14.0-rc.0 ├── karma-jasmine@0.3.6 ├─┬ karma-phantomjs-launcher@0.2.3 │ └── lodash@3.10.1 └── unmet peer dependency phantomjs@>=1.9 npm warn karma-phantomjs-launcher@0.2.3 requires peer of karma@>=0.9 none installed. npm warn karma-phantomjs-launcher@0.2.3 requires peer of phantomjs@>=1.9 none installed. npm warn karma-jasmine@0.3.6 requires peer of jasmine-core@* none installed. npm warn grunt-karma@0.12.1 requires peer of karma@^0.13.0 || >= 0.14.0-rc.0 none installed.

postgresql - Select values from a list that aren't in a table? -

i'd following; what's easiest way? select id (1,2,3) id not in (select id table) the idea not increase memory usage of python script loading table ids script first. way can think of build temporary table using query, little verbose. select id (values (1),(2),(3)) s(id) except select id table to psycopg: id_list = ['1','2','3'] q = """ select array_agg(id) ( select id (values {}) s(id) except select id table ) t; """.format(','.join(['%s'] * len(id_list))) print cur.mogrify(q, [(id,) id in id_list]) # cur.execute(q, [(id,) id in id_list]) output: select array_agg(id) ( select id (values ('1'),('2'),('3')) s(id) except select id table ) t;

.net - How to convert to a strong type that has a collection? -

i'm trying convert entity contains collections model can't figure out how include collections in model. for simple example of this, please see model below: namespace models public class productmodel public property id integer public property description string public property isinstock boolean public property orders list(of productordermodel) end class public class productordermodel public property id integer public property orderdate datetime public property delivereddate datetime? public property shippingaddress string end class end namespace now can cast product model shown below: dim simplifiedproductmodel productmodel = p in dc.products _ select new productmodel { _ .id = p.productid, _ .description = p.productdescription, _ .isinstock = p.productisinstock, _ .ordercount = p.orders.count() _ } what can't figure out how inclu...

asp.net - Excel VBA - Web Server Authentication popup -

Image
i trying query spreadsheet web relay device (controlbyweb x310) x310 iot device. has built-in web servver , when manually browse url first time pops web server login page (not browser html window): i've recorded macro of adding log data via excel insert "from web" data connection. uses recorded following vba: with activesheet.querytables.add(connection:= _ "url;http://111.111.111.111:8080/log.txt", destination:=range("$a$1")).... within last item end statement ".refresh backgroundquery:=false" takes while it's thing returns nothing. if i've manually logged web page via edge browser , authenticated access, command returns need. have thousands of these devices sitting on internet need collect data script loop through each practical. is there command or syntax querytables object can pass user id , password login pop-up? like: with activesheet.querytables.add(connection:= _ "url;http://111.111.111.111:80...

jquery - dynamically appending elements on dynamically created elements -

i have modal dynamic content. e.g. can create item typing someting in textbox , hit enter. after hit enter want notification below textbox, dynamically created. normally i'd put in .js.erb $("#idoftextbox").append("some waring") but mentioned textbox id: idoftextbox created dynamically , because of approach doesnt work. i read plenty , think understand problem, normaly you'd this $(document).on("click", "#idoftextbox", function(){ $(this).append("some warning"); }; but don't want bind specific event, want append message when controller renders .js.erb file i thought mb .on("load", might work, had no success far. i'd appreciate help. try : $('body').append("<div id='idoftextbox'></div>"); $(document).find('#idoftextbox').append("some value"); example : https://jsfiddle.net/dinomyte/2rhasve1/2/

mysql - unexpected ')' Parse error: syntax error, unexpected ')' in C:\xampp\htdocs\login6.php on line 17 -

i making php script gets table data database, , getting following error: unexpected ')' parse error: syntax error, unexpected ')' in c:\xampp\htdocs\login6.php on line 17 when delete it, more errors. <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'nemrac587'; $dbname='c'; $conn = mysqli_connect ($dbhost, $dbuser, $dbpass, $dbname); if(! $conn ) { die('could not connect: ' . mysqli_error()); } $sql = 'select id, name, password users'; mysqli_select_db('test_db'); $retval = mysqli_query( $sql, $conn ); if(! $retval ) { () die('could not data: ' . mysqli_error()); } while($row = mysqli_fetch_array($retval, mysql_assoc)) { echo "emp id :{$row['id']} <br> ". "emp name : {$row['name']} <br> ". "emp salary : {$row['password']} <br> ". "--------------------------------<br>"; ...

sql - Optimize WHERE clause in query -

i have following query: select table2.serialcode, p.name, date, power, behind, direction, length, centerlongitude, centerlatitude, currentlongitude, currentlatitude table1 table2 join pivots p on p.serialcode = table2.serial table2.serialcode = '49257' , date = (select max(a.date) table1 a.serialcode ='49257'); it seems retrieving select max subquery each join. takes lot of time. there way optimize it? appreciated. sub selects end being evaluated "per row of main query" can cause tremendous performance problems once try scale larger number of rows. sub selects can eliminated data model tweak. here's 1 approach: add new is_latest table track if it's max value (and ties, use other fields created time stamp or row id). set 1 if true, else 0. then can add where is_latest = 1 query , radically improve performance. you can schedule update happen or add trigger...

memory leaks - Why does an empty node.js script consume more and more RAM? -

running this: setinterval(function() { console.log(process.memoryusage()); }, 1000); shows memory usage growing: { rss: 9076736, heaptotal: 6131200, heapused: 2052352 } ... time later { rss: 10960896, heaptotal: 6131200, heapused: 2939096 } ... time later { rss: 11177984, heaptotal: 6131200, heapused: 3141576 } why happen? the program isn't empty , it's running timer, checking memory usage, , writing console once second. causes objects created in heap , until garbage collection runs heap usage keep increasing. if let go should see heapused go down each time garbage collection triggered.

mysql - how do i improve cross join with 20,000 records? -

i have 2 tables: users (userid,student_no,name) , regd (semester,student_no) . users contain 7,000 records , regd contains 20,000 records. there entries in regd not in users . how quickly select entries in users have entries in regd semester = '2012-2'? tried this: select * `regd` , users semester = '2012-2' , users.student_no = regd.student_no but taking forever load queries if have tiny database. every 6 months, 10,000 entries added regd , 2,500 entries added users each year. add indexes on join columns: create index idx_regd_student_no on regd(student_no); and create index idx_users_student_no on users(student_no); also, if tables don't have pk, add one. in case of regd, can use pk = (semester, student_no) . as other comments say, 22k records not big, can assume without decent index. hope helps.

istream - Handling exception std::out_of_range c++ -

i trying read flight schedules file flight class. i experienced problemn when using microsoft visual studio 2015. tried same code on tutorialspoint c++ online compiler , works fine. here example data of text file: las vegas; 21:15; aa223; a3; dallas; 21:00; ba036; a3; london; 20:30; aa220; b4; mexico; 19:00; vi303; b4; london; 17:45; ba087; b4; here error message receive: unhandled exception @ 0x75f25b68 in sf.exe: microsoft c++ exception: std::out_of_range @ memory location 0x00c5ee9c. and here stream extractor in problem apparently occurs istream &operator>>(istream &is, flight &f) { std::string singleline; >> singleline; std::string s0, s1, s2, s3; size_t loc = singleline.find(';'); s0 = singleline.substr(0, loc); singleline.erase(0, loc + 1); loc = singleline.find(';'); s1 = singleline.substr(1, loc - 1); singleline.erase(0, loc + 1); loc = singleline.find(';'); s2 =...

Azure - Finding resources I am an owner of in another azure account -

Image
i getting started azure, (working iot hubs) isn't dumb question - didn't find searching on here... anyway - have had play iot hub instance owned azure account (started on 1 month free trial, today added msdn member free benefit) now basic connectivity device i'm programming own iot-hub instance happening, want work iot-hub instance in account of employer, data goes system on. they've set me owner on side iothub want connect (i have screenshot shows i'm owner resource in question - attached) when go azure dashboard can't seem find way show me resource. so, how find this? you try looking in "subscriptions" see if employers listed. can click on profile name see if there other directories listed can browse within resources. option when set deployment, employers subscription option can select deploy into.

python - Django Bootstrap App differences with the normal Bootstrap -

i read in books , see in tutorials better use django bootstrap example: https://github.com/dyve/django-bootstrap-toolkit https://github.com/dyve/django-bootstrap3 over using base template original boostrap? but difference? 1 better? the django bootstrap toolkit automatically handles things paginations , forms , on , makes them loop bootstrap. if you're using templatetags reduces work (i.e. don't need add classes make bootstrap make forms or pagination buttons nicer). some examples toolkit provides are: render form bootstrap classes bootstrap stylizes it. {{ form|as_bootstrap }} it gives input fileds date input can used inside form class. date = forms.datefield( widget=bootstrapdateinput(), ) check out demos more info.

Join and filter condition between CRM entities using Odata query -

can please tell me odata equivalent query below fetchxml query? <fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0"> <entity name="customeraddress"> <attribute name="name"/> <link-entity name="contact" alias="ab" to="parentid" from="contactid"> <filter type="and"> <condition attribute="statecode" value="0" operator="eq"/> </filter> </link-entity> </entity> </fetch> i looked lot , tried mentioned here: filter on expanded entities in odata doesn't work. unfortunately not possible build odata query include expand on related entity , filter on if work dynamics crm 2016 new webapi can use clear fetchxml data querying. recheck following articles: http://debajmecrm.com/2016/01/04/leverage-web-api-to-execute-your-system-views-personal-views-an...

python - How to include another template with Chameleon? -

i'm using latest chameleon in latest pyramid. want let template include template. php, may use such '@include('_partials.assets')', how use chameleon? in question how use template inheritance chameleon? , know how inherit, can't include yet. thank you! if understand question correctly can put line of code in first template. <tal metal:use-macro='load:partial_assests.pt'></tal> "tal" replaced html tag.

javascript - Angular Material ng-click not working in custom directive -

i trying use directive create header page html page, since header appear on multiple pages. created directive called 'header' loads header.html this html uses directive this directive app.directive('header', function() { return { controller: headercontroller, templateurl: 'header.html' }; }); header.html <link rel="stylesheet" href="css/header.css"> <script src="scripts/signin/signin.js"></script> <script src="scripts/signin/signincontroller.js"></script> <md-button class="md-button" id="accountcreation" ng-click="showloginpage()">create account/login</md-button> my header.html file has button should open dialog isn't working. created header using javascript , worked fine. showloginpage defined in controller $scope.showloginpage() function isn't being called upon clicking button a snippet of control...

java - LibGDX - Centering Orthographic Camera -

so i'm working on game have camera in game centered on middle of screen device lengths. hope this picture can better explain i'm trying achieve. have tried setting position of camera hasn't worked me. scrnheight = gdx.graphics.getheight(); if (scrnheight <= height) { cam.settoortho(false, 480, 800); } else { cam.settoortho(false, 480, scrnheight); } //this part seems giving me issues cam.position.set(cam.viewportwidth/2,cam.viewportheight/2, 0); cam.update(); gdx.input.setinputprocessor(this); gdx.gl.glclear(gl20.gl_color_buffer_bit); gsm.update(gdx.graphics.getdeltatime()); gsm.render(batch); batch.begin(); batch.draw(border, -(border.getwidth() - width) / 2, -(border.getheight() / 4)); batch.end(); i don't know if i'm giving wrong coordinates when i'm setting position or happening causes lack of vertical centering. appreciated. the orthographic camera position in ...

drag and drop - Dragging and Dropping the bitmap in specific location in Android, otherwise restoring to initial position -

colorballs class has 2 bitmaps (not shown here), , struggling find if bitmap dragged , dropped within "square" (please see on draw method below) on screen. bitmap should never dragged again, if same bitmap moved anywhere-else not within square, should restore original position when stopped moving bitmap. please code. // method draws balls @override protected void ondraw(canvas canvas) { //canvas.drawcolor(0xffcccccc); //if want background color //draw balls on canvas (colorball ball : colorballs) { canvas.drawbitmap(ball.getbitmap(), ball.getx(), ball.gety(), null); } // draw square. paint rectpaint = new paint(); // color of border rectpaint.setcolor(color.blue); rectpaint.setstrokewidth(1); rectpaint.setstyle(paint.style.stroke); int w = this.getwidth(), h = this.getheight(); int offset = (h - w)/2; int step =w/3; rect= new rect (0, offset+0*step, step, offset+st...

objective c - How To Add Visual Effect Views Blur On All Views Storyboard iOS? -

Image
i need add visual effect view center activityindicator loading label device fullscreen using objective c . using storyboard below posted image cant add visual effect blur view on over top side. you can try below code add blur effects: // usage [loginview blurbackgroundwithscreenshotview:backgroundimageview withtype:blursubview withcolor:blurblackview withpoint:cgpointzero]; // // uiimage+blur.h // // created ankit thakur on 07/03/14. // #import <uikit/uikit.h> @interface uiimage (blur) - (uiimage*) blurredsnapshot; @end // // uiimage+blur.m // // created ankit thakur on 07/03/14. // #import "uiimage+blur.h" #import <accelerate/accelerate.h> @implementation uiimage (blur) - (uiimage *)applyblurwithradius:(cgfloat)blurradius tintcolor:(uicolor *)tintcolor saturationdeltafactor:(cgfloat)saturationdeltafactor maskimage:(uiimage *)maskim...