Posts

Showing posts from June, 2013

ember.js - "undefined is not a function" for CP and didInsertElement -

Image
i'm wrapping js component ember addon, i've done many times before, , yet i'm running problem right @ get-go makes me worry maybe "magic" of ember has shifted slightly? anyway hoping can explain why following: import ember 'ember'; import layout '../templates/components/nav-menu'; export default ember.component.extend({ layout: layout, tagname: 'nav', classnames: ['navmenu','navmenu-default','navmenu-fixed-left'], attributenames: ['role:navigation'], classnamebindings: ['offcanvas'], hideat: null, offcanvas: function() { let hideat = this.get('hideat'); if(!hideat) { return 'offcanvas'; } else { return 'offcanvas-%@'.fmt(hideat); } }.property('hideat'), _initialize: function() { this.$().offcanvas(); }.on('didinsertelement') }); this fails on 2 counts. as-is fails in offcanvas computed property say

swift - basic Authorization - SSL Handshake failed -

trying connect webservice on https basic authorization, cant work. error message get: cfnetwork sslhandshake failed (-9806). appreciate help. here relevant code: var post : nsstring = "username=\(username)&password=\(password)" let postdata = post.datausingencoding(nsutf8stringencoding) let base64encodedcredential = postdata!.base64encodedstringwithoptions(nil) nslog("postdata: %@",post); var url : nsurl = nsurl(string: "https://localhost:8080/webservice")! var postlength : nsstring = string( base64encodedcredential.lengthofbytesusingencoding(nsutf8stringencoding) ) var request:nsmutableurlrequest = nsmutableurlrequest(url: url) request.httpmethod = "post" request.httpbody = postdata request.setvalue("basic \(base64encodedcredential)", forhttpheaderfield: "authorization") request.setvalue(postlength, forhttpheaderfield:

bind - named Transfer failed -

dig @111.1111.111.111 domain.ru. axfr ; <<>> dig 9.8.2rc1-redhat-9.8.2-0.30.rc1.el6_6.2 <<>> @95.85.36.112 domain.ru. axfr ; (1 server found) ;; global options: +cmd ; transfer failed. google searched all. can not understand what's wrong? Му named.conf options options { listen-on port 53 { 0.0.0.0; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { any; }; recursion no; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; allow-transfer {111.1111.111.111;}; Не могу понять что произходит? Что я делаю не так ? i can not understand occured? doing wrong? allow-transfer directive

asp.net - Can't call a function or access a controller which is used in a repeater, in codebehinde -

i've searched internet , didn't find working answer question. the question when use text-box , button in asp:repeater c# aspx website update column of sql server table, can't access textbox , button in code-behind (aspx.cs) page. i've find way "show" controllers (the text-box , button) in asp:repeater in link below, can't use update database of website. can't find control within asp.net repeater? i'd glad if know how solve problem, reply this. here sample code of demonstrating problem: aspx page <asp:repeater runat="server" id="commentha" > <itemtemplate> <div id="comment list" style="direction: rtl; font-family: '2 nazanin','adobe arabic'; font-size: large;"> <div id="replys">

How do I ignore the initial load when watching model changes in AngularJS? -

i have web page serves editor single entity, sits deep graph in $scope.fieldcontainer property. after response rest api (via $resource), add watch 'fieldcontainer'. using watch detect if page/entity "dirty". right i'm making save button bounce want make save button invisible until user dirties model. what getting single trigger of watch, think happening because .fieldcontainer = ... assignment takes place after create watch. thinking of using "dirtycount" property absorb initial false alarm feels hacky ... , figured there has "angular idiomatic" way deal - i'm not 1 using watch detect dirty model. here's code set watch: $scope.fieldcontainer = message.get({id: $scope.entityid }, function(message,headers) { $scope.$watch('fieldcontainer', function() { console.log("model dirty."); if ($scope.visibility.savebutton) {

java - Appfuse spring security hasRole() not working -

i'm trying appfuse , have added custom menus in menu.jsp (no doing in menu-config.xml because add glyphicon, , struts menu can't it) so hide/show menus wanted use spring security authorized tag <security:authorize access="hasrole('role_admin')"> <li> <a href="test.jsp"><i class="fa fa-edit fa-fw"></i> forms</a> </li> </security:authorize> but tag causes yike! error(error 500), nothing showed in console. have <logger name="org.springframework.security" level="all"/> <logger name="org.springframework" level="all"/> in log4j2.xml. if switch <security:authorize ifanygranted="role_admin" > works expected. far know, ifanygranted deprecated. i'm curious why see no error in output console? i'm using appfuse 3.5 springmvc, run

css - How to style a QWizard's button area? -

Image
i have application styles set in qss file. widget backgrounds darker colour , buttons have own styles too. this working throughout software except on qwizard seems have own button area across bottom of wizard default qt widget colour still applied it. i have looked @ various components can apply styles on qwizard none of them seem button area across bottom of form, wondering if has encountered before , found out object need apply style change colour of area. if set wizard style classicstyle qwidgets available colorization qss . wizard->setwizardstyle(qwizard::classicstyle); for default vistastyle painting hardcoded in source of qwizard this: if (wizardprivate->isvistathemeenabled(qvistahelper::vistabasic)) { if (window()->isactivewindow()) painter.setpen(qpen(qbrush(qcolor(169, 191, 214)), 0)); // ### hardcoded else painter.setpen(qpen(qbrush(qcolor(182, 193, 204)), 0)); // ### hardcoded painter.drawline(0, 0, width(), 0

excel - VBA ComboBox not displaying values -

this question has answer here: my combobox doesn't display values i've added in vba 2 answers trying use comobobox vba , displays 1 empty row when click on down arrow. have never used combobox before , still beginner vba. private sub comboboxt_change() comboboxt.additem "apple" comboboxt.additem "orange" comboboxt.additem "banana" end sub like saagar said, way code written, add items combobox if there change in combobox. code use this: private sub userformname_activate() comboboxt.additem "apple" comboboxt.additem "orange" comboboxt.additem "banana" end sub the easiest way achieve in user form creator, double click on userform frame. should show code working with, top dropdown bars (the first 1 might either "userform" or "general") can select

c# - View Column Types Not Supported - Entity Framework -

update: ticket system.data.sqlite.org. link i have view similar in sqlite database select * ( select * ( select fc.filtercommandid, fc.procedureid, 1 isdynamic, substr(fc.datatype, 1, 20) || fc.sequence filter, fc.objectname ((filtercommands fc inner join dynamicfiltercommands dfc on fc.filtercommandid = dfc.filtercommandid) inner join dynamicfiltercommandfields dfcf on dfc.dynamicfiltercommandid = dfcf.dynamicfiltercommandid) inner join procedurefilterkeys pfk on fc.procedureid = pfk.procedureid group fc.filtercommandid, fc.procedureid, 1, substr(fc.datatype, 1, 20) || fc.sequence, fc.objectname order fc.sortorder ) sq union select fc.filtercommandid, fc.procedureid, 0, substr(fc.datatype, 1, 20) || fc.sequence, null filtercommands fc inner join staticfiltercommands sfc on fc.filtercommandid = sfc.filtercommandid ) the proble

java.lang.NoClassDefFoundError: com/google/gwt/core/shared/GWTBridge -

i'm not sure why java.lang.noclassdeffounderror: com/google/gwt/core/shared/gwtbridge on line 60 of home.java . steps reproduce: clone jenterprise , open jenterprise , helloworld projects build jenterprise helloworld run helloworld -> com.jenterprise.examples.helloworld.begin go to: http://localhost:8090/examples/helloworld/home what i'm trying use onmoduleload() update interface after executing other logic in method use forward(request, response) show interface, i.e. public void main(httpservletrequest request, httpservletresponse response) { system.out.println("running home: main(httpservletrequest request, httpservletresponse response)"); onmoduleload(); request.getrequestdispatcher("/index.jsp").forward(request, response); } onmoduleload() entrypoint method, part of client-side gwt code compiled gwt compiler. can't use server-side.

Create Dictionary in Javascript / PHP -

i'm trying create dictionary .txt file in shape of tree. on every line of text file there's word, extract words in array. now regarding tree, each node contains letter, if it's last letter of word, contains definition, , each node have array children contains letters others words starting same way. so have nodes defined way: function node(letter,definition,children) { this.letter = letter, this.definition = "", this.children = [] }; i have array dictionary contain nodes. every node organized (so know 'a' in dictionary[0] , 'b' in dictionary[1] , on). i defined functions build dictionary: check if dictionary contains first letter of word have (c character, dictio dictionary array , ascii ascii-97 value of character) function checkchar(c,dictio,ascii){ if(dictio[ascii].letter == c ){ return true; } return false; }; create node given character function createchar(c){ var noeud = { let

multithreading - how to make thread in c++ -

i need simple program using sleep() , ( _begin thread() ) make thread on program void tdrow(){ sleep(50); move_bare_without_ball(a,b,windowsize); _beginthread(tdrow(),0,0); } _beginthread visual c++ crt function. don't recommend using or process.h purpose. please use std::thread (or if compiler older, boost::thread ). if using _beginthread , you'd give tdrow, not tdrow().

tomcat6 - Update Tomcat to point at custom domain -

to navigate local tomcat installation use http://localhost:8080 can tomcat configured when run locally still navigates http://localhost:8080 can specify different host name ? e.g when navigate http://<machine_name>.com:8080 redirects http://localhost:8080 . this local development. think may need modify hosts file : http://en.wikipedia.org/wiki/hosts_%28file%29

java.util.prefs.Preferences Sharing between two JVMs -

i have 2 java programs ( a , b ) run in separate (local) jvms, access same java.util.prefs.preferences (java.util.prefs.windowspreferences) prefs = preferences.systemnodeforpackage(foo.class) both programs call once @ startup. a gui program allows configuration. changes written preferences node. @ end flush called. b background program doing actual work. a sends notification b configuration has changed. b reads changed configuration. there no concurrent access preferences, since cross-jvm locking (using java.nio.channels.filelock ) used. my question: safe solution? b read a has written?

.htaccess Regex Match File with Extensions or no Extension -

basically want match of patterns below file path after protocol through file name, file doesn't have extension. i got there, once try make match files without extension, matches until rest of line. my test strings http://regexr.com/foo.html?test (//regexr.com/foo.html) http://regexr.com/foo?test (//regexr.com/foo) http://regexr.com/foo.php?test (//regexr.com/foo.htm) http://regexr.com/foo.htm?test (//regexr.com/foo.htm) my current expression \/(.+)\.php doesn't match second file path without extension, , if make last collection optional, selects through parameters. appreciated. edit below .htaccess block i'm attempting modify rewritecond %{request_filename} !-d rewritecond %{the_request} \ /(.+)(\.php|\.html?) rewriterule ^ /%1.aspx [l,r=301] rewriterule ^(.*).aspx$ $1.php [qsa] further edit pointed out, may have been better asked redirect question. (another note, removed html redirect since causes performance hit, files extension *.php f

Perl script logic converted to C# -

i have perl script need convert c#. but have hit speedbump. the perl script: use math::basecnv; use math::basecnv dig; use xml::simple; use lwp::simple; dig('url'); # select right alphabet base64 $parser = new xml::simple; $url = 'http://10.0.2.128/api.xml'; $content = $url or die "unable $url\n"; $data = $parser->xmlin($content); $stringdata=$data->{datafield}; $decvalue = cnv('a'.substr($stringdata,3,54),64,10); dig('hex'); $hexvalue = cnv($decvalue,10,16); the value of $stringdata is ws=3lcobgcaxjqaadljiqeaaag2fdadiaab7qhka6eyapqga1cc8gaa4e length: 57 the value of $decvalue is 29461891743732702623135632717213292230507524331718660652410396996938709350973448271678550990392836 length: 98 and value of $hexvalue is dcb08e06009ac634000039632101000001b6143003880001ed01ca03a13200f420035702f20000e04 length: 81 my issue cant same $decvalue , $hexvalue when using c#. have searched google dry , not close getting th

c# - How to convert a view into a PNG? -

i want create png view. using code: //i instance user control ucformtoprintview miviewtoprint = new ucformtoprintview(); miviewtoprint.datacontext = ((ucformtoprintview)ccform).datacontext; //i use rendertargetbitmap render user control system.windows.media.imaging.rendertargetbitmap rtb = new system.windows.media.imaging.rendertargetbitmap(794, 1122, 72, 72, system.windows.media.pixelformats.pbgra32); rtb.render(miviewtoprint); //i use encoder create png system.windows.media.imaging.pngbitmapencoder encoder = new system.windows.media.imaging.pngbitmapencoder(); encoder.frames.add(system.windows.media.imaging.bitmapframe.create(rtb)); //i use dialog select path save png file microsoft.win32.savefiledialog savefiledialog = new microsoft.win32.savefiledialog(); savefiledialog.filterindex = 1; if (savefiledialog.showdialog() == true)

android - How to pass a string from a list in one activity to another -

what convert list of user string , on click pass selected string next activity. tried on messaging feature have used on app , has worked fine. attempting work gallery feature. section supposed find users in parse, convert them string , display them on list view. on click supposed collect string on list , use in gallery view activity display images username equal 1 selected list. listuseractivity list view of usernames saved in database. //display clickable list of users private void setconversationslist() { currentuserid = parseuser.getcurrentuser().getobjectid(); names = new arraylist<string>(); parsequery<parseuser> query = parseuser.getquery(); query.wherenotequalto("objectid", currentuserid); query.findinbackground(new findcallback<parseuser>() { public void done(list<parseuser> userlist, com.parse.parseexception e) { if (e == null) { (int i=0; i<userlist.size(); i++) {

javascript - How can I disable dynamically an Angular directive? -

i'm working on project using angularjs (html5/css3). in main html file of project, there table fill dinamically using array of controller: controller manages section of html page in table contained. the html code of table this: <table class="col-md-12 col-sm-12 col-lg-12 display" id="tableidprocedures"> <thead> <tr> <th><span>code</span></th> <th><span>description</span></th> <th><span>quantity</span></th> <th><span>note</span></th> </tr> </thead> <tbody> <tr ng-repeat="procedure in procedures"> <td>{{procedure.codexamination}}</td> <td>{{procedure.descrexamination}}</td> <td contenteditable="true">{{procedure.quantityexamination}}</td> <td>{{procedure.noteexamination}}&l

Copy array of strings into another array in C -

i'm making word search program in c takes user input , chooses 1 of global arrays of words , uses generate word search. works when use 1 of global arrays not choice, want copy contents of category arrays, depending on users choice newarray can used word search. program crashes after entering option @ moment, here's have. switch(choice) { case 1: chosearray(newarray, masseffect); break; case 2: chosearray(newarray, fallout3); break; case 3: chosearray(newarray, elderscrolls); break; case 4: chosearray(newarray, gameofthrones); break; case 5: chosearray(newarray, breakingbad); break; default: printf("enter valid option!"); } void chosearray(char** newarray, char** category) { int i; for(i=0;i<6;i++) { strcpy(newarray[i], category[i]); } } the arrays , declared globally now char gameofthrones[6][250] = {"kingslanding", "tyrian", "stark", "lanisters&qu

java - How to use file picker in android app -

i developing simple android app, want use file picker when press button, how can implement file picker in app. i spent time earlier figuring out wrap intents provide ability hook third-party app components content selection. works media files, if want users able select file, must have existing "file explorer" app installed. because many android devices don't have stock file explorers, developer must instruct user install one, or build one, themselves. afilechooser solves issue. you can clone ipaulpro/afilechooser .

sql - Specific data types -

i'm trying build database i'm struggling type of data. basicly have behave combobox : have several choices can choose one. unfortunatly can't define in sql database. came idea store different "choices" in table , each entries fill one, leaving 10+ empty field. isn't there method in cleaner way ? enumerated types behave describe.

Converting input String to int array with Variable length in java -

here snippet of code. want of user number variable length , convert int array. example: input: 352040 , output:{3,5,2,0,4,0} scanner in = new scanner(system.in); system.out.println(" enter size number: "); int length = in.nextint(); system.out.println(" enter number: "); int number = in.nextint(); int[] intarray = null; string str = integer.tostring(number); ( int =0; < length ;i++) intarray[i] = integer.parseint(string.valueof(str.charat(i))); system.out.println(arrays.tostring(intarray)); this comes error(exception in thread "main" java.lang.nullpointerexception) , cant understand why. thanks help. you need create array first. int[] intarray = new int[length]; // create array string str = integer.tostring(number); ( int =0; < length -1;i++) intarray[i] = integer.parseint(string.valueof(str.charat(i)));

java - iText RadioGroup/RadioButtons across multiple PdfPCells -

i'd make pdfptable multiple rows in it. in each row i'd have radio button in first cell , descriptive text in second cell. i'd radio buttons part of same radio group. i've used pdfpcell.setcellevent , own custom cellevents in past render textfields , checkboxes in pdfptables. however, can't seem figure out how radio buttons/radio groups. is possible itext? have example? please take @ createradiointable example. in example, create pdfformfield radio group , add after constructing and adding table: pdfformfield radiogroup = pdfformfield.createradiobutton(writer, true); radiogroup.setfieldname("language"); pdfptable table = new pdfptable(2); // add cells document.add(table); writer.addannotation(radiogroup); when create cells radio buttons, add event, instance: cell.setcellevent(new mycellfield(radiogroup, "english")); the event looks this: class mycellfield implements pdfpcellevent { protected pdfformfield ra

How to override default attributes in Chef using roles -

i can't work, been @ hours. there's duplicate of question here, never adequately answered. i've tried strip problem down minimum. here's trivial recipe: "my_recipe.rb" file "/tmp/my_target_file" content node.default['my_file_content'] action :create end ...and attributes file in attributes subdirectory: "my_attribute.rb" default['my_file_content'] = 'from my_attribute.rb' i create role in roles subdirectory: "my_role.rb" name 'my_role' description 'my role' run_list 'recipe[my_cookbook::my_recipe]' default_attributes['my_file_content'] = 'from my_role.rb' i upload both cookbook , role chef server , run knife command chef workstation: knife bootstrap xxx.xxx.xxx.xxx -x myusername -p mysudopassword --sudo -r role[my_role] -n my_node_name it runs fine , target file gets created, contents of /tmp/my_target_file not expected. i'm getting $ c

swift - Why core data doesn't delete related objects? -

entities driver , car in 1:many relationship. in driver entity in relationship table have relationshipname, car , no inverse when open table graph style in xcode between entities there 2 arrows on car entity , no arrows on driver entity. code deleting object: let somecar:nsmanagedobject = ... let ed = nsentitydescription.entityforname("driver", inmanagedobjectcontext: context!); managedobjectcontext?.deleteobject(somecar); context?.save(nil); but delete driver car intact. reason not deleting related objects?

c++ - Why is digits10 for reference to integer type 0? -

the following code: #include <iostream> #include <limits> #include <cstdint> int main() { std::cout << std::numeric_limits<std::uint64_t>::digits10 << "\n" << std::numeric_limits<std::uint64_t&>::digits10 << "\n"; } outputs 19 0 i expect std::uint64_t& have same value std::uint64_t : there reason discrepancy? 18.3.2.1/2: specializations shall provided each arithmetic type, both floating point , integer, including bool. member is_specialized shall true such specializations of numeric_limits. so know specializations exist for these non-reference types. 18.3.2.3/1: the default numeric_limits template shall have members, 0 or false values. i suspect done way because can static_assert on is_specialized force compile error, there possibly template application 0 ok default value 1 or more of limits. if want able test references run through

regex for date in javascript -

this question has answer here: regex validate date format dd/mm/yyyy [duplicate] 16 answers how come when searching dd/mm/yyyy in string works: /(\d\d?)\/(\d\d?)\/(\d{4})/ but doesnt: /\d{2}\/\d{2}\/d{4}/ you have typo may not know why . second expression looking d{4} rather \ d{4} . without backslash, you're looking letter d rather number. additionally, {2} means you're looking 2 of preceding character/group, 1/1/2014 won't test positive. {1,2} match 1 to 2 consecutive items. first expression achieves functionality \d\d? . ? matches whether or not preceding character/group exists. var tests = [ { rx: /\d{2}\/\d{2}\/d{4}/, text: "10/10/dddd" }, // true { rx: /\d{2}\/\d{2}\/\d{4}/, text: "10/10/2014" }, // true { rx: /\d{2}\/\d{2}\/d{4}/, text: "1/1/2014" }, // false

algorithm - Single pass EDI parsing without an XML schema - Possible? -

before sigh , hold head in hands, please understand i'm working pretty old system on rather tight timeline. we have single pass edi parser written in business language. currently, data definitions including loop level, area, , name of each segment stored in database table. table assigns each segment within area incremental sequence number. e.g., 004010 810 header area: segment sequence big 5 nte 10 cur 15 ref 20 ynq 25 per 30 n1 (start of loop) 35 n2 40 etc. etc. so, if read segments in order appear in standard, can each 1 can assigned sequential number, "depth" (how many loops "down" appears) , name (2-3 characters). the algorithm followed parser @ present follows: reset currentarea 1 each segment in document { search segment's name in table restricting area >= currentarea. if not found, have error. else { if area changed { empty temporary "search bounds" table. create single recor

c# - Setting nullable TimeSpan in XAML -

i creating style player mediaplayerframework , in xaml style want set 2 properties ( skipaheadinterval , skipbackinterval ) of type timespan? . i tried <setter property="skipaheadinterval" value="00:00:20.00" /> but getting cannot assign nullable type on property skipaheadinterval is there way in xaml? have considered using valueconverter , handling nullable within valueconverter scope?

ios - Swift: return to tableview after selecting a search result -

Image
i have implemented search function. want able search list, select item on list, return main tableview while item remains selected. how do this? this tableview without selections or character typed searchbar. items not have detail view. items have more information can retrieved, e.g. url. data must retrieved later when user presses "mail" button top left. this list search results. grey highlight of cell indicates cell selected. how return main tableview, whilst keeping selection? see cancel-button top right, cross-button in searchbar top middle, , "search" button on lower right part of keyboard. none bring main tableview whilst storing selection. based on suggested answers, able store row's index path, using function below: override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { let rowtoselect = indexpath println(rowtoselect) selectedcelltitle = selectedcell?.textlabel?.text ?? "&quo

c# - Programmatically Creating and Populating Multiple Listboxes in Grid -

goal: create listbox each parameter on ssrs report. currently, code works fine if report has 1 parameter. idea populate list of validvalue objects , add labels listbox. should happen each parameter. how programmatically create multiple list boxes, populate them using foreach statements, , add them grid? here's code: reportparameterinfocollection parameters; parameters = reportviewer.serverreport.getparameters(); list<string> labels = new list<string>(); list<validvalue> paramlist = new list<validvalue>(); listbox boxbox = new listbox(); foreach (reportparameterinfo param in parameters) { paramlist = param.validvalues.tolist(); labels.clear(); boxbox.items.clear(); foreach (validvalue val in paramlist) { labels.add(val.label + " - " + val.value); } foreach (string lab in labels)

facebook - How to handle Multiple Social Media Logins and sessions Flow on Android? -

i have created android app has navigation drawer fragments. i started social media integrations, facebook, twitter , google plus. using official respective sdk's. not social media sessions , calls acquire data made in following activities: mainactivity : if of sessions lost or revoked, needs redirect loginactivity . done during activity lifecycle methods. loginactivity : permission granted , redirects main after success navigationdrawerfragment : navigation drawer, use display user's profile image, name , email address. in these 3 classes making calls respective sdk methods , managing sessions there lot of code duplication. also 3 sdk's have different ways of providing authentication. facebook: uses uilifecyclehelper implemented on standard lifecycle functions of activity. google plus: have implement googleplay store callbacks in activity , create googleapiclient on activities. twitter: has less of "taking on app" attitude , uses retro

php - Force authentication external website with Google Apps Domain -

morning folks, i need implement way force authentication of people inside google apps domain access website. to clear, user try site.com . if doesn't have cookie, he's redirected , forced google oauth2 login form. if has one, can visit website. in addition, aim here restrict login users inside google apps domain (people other google email adresses gmail won't work here). i hope clear enough, lot in advance guys ;) if website running on apache webserver, or can front website apache web server operating reverse proxy, mod_auth_openidc ( https://github.com/pingidentity/mod_auth_openidc ) can enforce authentication google account , restrict particular google apps domain, see: https://github.com/pingidentity/mod_auth_openidc#openid-connect-sso-with-google-sign-in

smarty - Include path from root -

i have structure kinda this: src ---stuff1 ------stuff2 ---------stuff3 ------------tpl1.tpl ---dir1 ------dir2 ---------dir3 ------------tpl2.tpl i want include tpl2.tpl in tpl1.tpl , how can avoid monsters this: {include file="../../../../../dir1/dir2/dir3/tpl.tpl"} ? php file: <?php $root = "/path/to/the/root/of/my/site/or/templates" $smarty->assign('root',$root); template file: {include file="`$root`/dir1/dir2/myfile.tpl"} or {include file="$root/dir1/dir2/myfile.tpl"} or {include file="$root|cat:"/dir1/dir2/myfile.tpl"} http://www.smarty.net/docs/en/language.syntax.quotes.tpl

android - Get notified when a third party app is launched for the first time -

i want notified when 3rd party apps opened user first time. my app system app, can request system permissions. i know can polling data such app's cache , seeing larger 0, there other way without polling? (for example, via broadcastreceiver) as per knowledge, don't broadcast when launch application first time. however can check intent.flag_activity_launched_from_history set if application has been launched history. not solve problem case check if in future find way detect first application launch.

c# - Unity project character only moving one way no matter where you touch on an IOS device -

this code movement when touch on ios device in 2d game creating in unity. when run game loads when touch right moves left , when touch left moves left. i have used screentoworldpoint told use dont seem work move 1 direction void playerwalkmobile() { // force push player float force = 0.0f; // players velocity float velocity = mathf.abs(getcomponent<rigidbody2d>().velocity.x); if (input.touchcount > 0) { counttouches++; touch h = input.touches[0]; vector2 position = camera.main.screentoworldpoint(new vector2(h.position.x, h.position.y)); debug.log("the postion of touch " + h.position); if (position.x > 0) { // if velocity of player less maxvelocity if (velocity < maxvelocity) force = speed; // turn player face right vector3 scale = transform.localscale; scale.x = 1; transform.localscal

jquery - Why cant null be returned to a $.getJSON() function? -

given following controller method public actionresult testjsonresult() { return json(true, jsonrequestbehavior.allowget); // return json(null, jsonrequestbehavior.allowget); // return null; } and client side script var url = '@url.action("testjsonresult", "test")'; $.getjson(url, function (result) { if (result) { console.log('returned result'); } else { console.log('returned null'); // never hit } }).fail(function (result) { console.log('failed'); // hit return json(null); , return null; // result status 200 ok }); then outputs 3 return value options are return json(true, jsonrequestbehavior.allowget); // outputs "returned result" return json(null, jsonrequestbehavior.allowget); // outputs "failed" return null; // outputs "failed" acording specification values a json value must object, array, number, or string, or 1 of following

jquery - table row click event and checkboxes -

this question has answer here: how have click event fire on parent div, not children? 5 answers i have click event attached table row , within columns have checkboxes. <table> <tbody> <tr class='shop_order_single_table'> <td><input type='checkbox' /></td> <td><input type='checkbox' /></td> <td><input type='checkbox' /></td> </tr> </tbody> </table> when click checkbox click event row still executes. here code: $(".shop_order_single_table").on("click",function() { //click event executes }); how have click event table row not execute when clicking checkbox? $(".shop_order_single_table input").on("click", func

sql - In postgres how do i use the apostrophe character as a literal -

i trying convert instances of character ’ ', cant work how it. this checks syntax okay isn't changing character ubuntu@ip-172-31-39-147:~$ echo "update musicbrainz.release set name = translate(name,'’','’') name ~ '[’]+';"|psql jthinksearch update 7284 if dont escape ' fails: ubuntu@ip-172-31-39-147:~$ echo "update musicbrainz.release set name = translate(name,'’',''') name ~ '[’]+';"|psql jthinksearch error: syntax error @ or near "[" line 1: ...ease set name = translate(name,'’',''') name ~ '[’]+'; and if escape it still fails different error ^ ubuntu@ip-172-31-39-147:~$ echo "update musicbrainz.release set name = translate(name,'’','\'') name ~ '[’]+';"|psql jthinksearch error: syntax error @ or near "[" line 1: ...ase set name = translate(name,'’','\'

groovy - Remap keys for groovysh when opened in ConEmu -

previous title: groovy shell settings/config file location on windows , example where can find/create groovysh/groovy shell settings/config file in microsoft windows 7? groovysh has issue groovy-6453 keys don't work correctly on windows version of groovy. i'd used autohotkey remap keys i've started use conemu , haven't figured out how differentiate tabs far autohotkey. i'm hoping i'll able remap keys in config file works globally user , not need autohotkey script anymore. just clarify there nothing wrong conemu specific version of groovysh i'm using. if set title of cmd window start groovysh title stick , autohotkey can check window title. in conemu commands input box enter -new_console:t:groovy"cmd.exe /c title groovy&&groovysh" t:groovy sets title tab conemu's viewpoint , cmd.exe /c title groovy sets title cmd's viewpoint. additional &&groovysh starts groovy console. autohotkey sees title 

oracle - Why my LibraryCache gets locked with parallel queries? -

i using oracle 12c, needed understand, 1) facing issue of several sessions in locked state (librarycache). showing me parallel queries running, have not set parallel clause in ddl of table object. migration indexes created parallel clause create not understand why taking dml also. 2) if assume if case while running dml sqleditor executionplan shows me noting parallel. finally got answer through, http://blog.tanelpoder.com/2007/06/23/a-gotcha-with-parallel-index-builds-parallel-degree-and-query-plans/

android - Start Service from BroadcastReceiver never call service.onStartCommand() method -

i have music service playing audio files. start service activity. send notification play/pause button when click on play button notification send broadcast receiver , it's working. in on onreceive(context context, intent intent) method call context.startservice(intentservice) problem musicservice.onstartcommand() never called. my receiver public class playepisodereceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { toast.maketext(context, "service started", toast.length_short).show(); if(musicservice.isrunning()) { intent serviceintent = new intent(context, musicservice.class); serviceintent.putextra(appconstants.action_type, appconstants.action_play); context.startservice(intent); } } } my manifest: <service android:enabled="true" android:name=".backgroundtasks.musicservice">

logarithm - MATLAB semilog scaling -

i'm new matlab, , working on program deals frequency of human voice based on microphone input. biggest problem running musical notes (what dealing in project) increase in frequency exponentially, 1.059463^x each semitone in musical scale. in program dealing with, need both scale graph detected frequency close note number corresponds scale data can work note numbers in terms of notes , musical cents frequency graph can converted midi data. other option have found has been create library of frequencies recorded frequencies compared to, unnecessarily complicated , time consuming. so, in essence, trying scale data a2, frequency of 110hz, correspond note number 45. there way this? i think want: f = 110; %// frequency in hz n = log10(f/440)/log10(2)*12+69; %// 440 hz (note a4) note 69 note = round(n); cents = round((n-note)*100); examples: f = 110 gives note = 45 cents = 0 f = 345 gives note = 65 cents = -21 in accordance this reference , th

matlab - Singular Value Decomposition positive value -

i using singular value decomposition (svd) applied singular spectrum analysis (ssa) of timeseries. % original time series x1= rand(1,10000); n = length(x1); % windows trajectory matrix l = 600; k=n-l+1; % trajectory matrix/matrix of lagged vectors x = buffer(x1, l, l-1, 'nodelay'); % covariance matrix = x * x' / k; % svd [u, s_temp, ~] = svd(a); % eigenvalues of squared eigenvalues of x s = sqrt(s_temp); d = diag(s); % principal components v = x' * u; = 1 : l v(:, i) = v(:, i) / d(i); end i wanted know if there way have singular components (i.e. columns of v) positive. x > 0 in case (and covariance matrix a) you may looking algorithm such non-negative matrix factorization . this available in statistics toolbox in command nnmf , , there freely available third-party toolbox well.

javascript - Dual Axes with column drill down, Cannot column click -

i have dual axes highchart, wit column drill down , spline, there problem column area below level of spline, nt goes in drill down of column. $(function() { highcharts.setoptions({ lang: { drilluptext: '<< go {series.name}' } }); highcharts .data({ csv: document.getelementbyid('tsv').innerhtml, itemdelimiter: '\t', parsed: function(columns) { var brands = {}, cpc = {}, brandsdata = [], cpcdata = [], temp = {}, versions = {}, drilldownseries = [], $container = $('#container'), chart = $('container').highcharts(), origchartwidth = 1500, origchartheight = 600, chartwidth = origchartwidth, chartheight = origchartheight; // parse percentage strings columns[1] = $ .map( co