Posts

Showing posts from March, 2010

Get clicked cell on kendo ui grid change event -

i handling change event of kendo ui grid. in event handler, cell clicked invoked change event. need cell in order scan contents. any thoughts? it's documented in documentation: http://docs.telerik.com/kendo-ui/api/web/grid#events-change here's example code if have grid configured multiple cell selection ( selectable: "multiple, cell" ): change: function(e) { var item; var selected = this.select(); //get selected cell(s) (var = 0; < selected.length; i++) { item = this.dataitem(selected[i].parentnode); //get selected cell's dataitem } }

PHP redirect not working - php headers -

when load index.php file, header.php,sidebar.php, or nav.php don't show up. used "include" correctly, , in validators there no error. of files work themselves. here code. index.php <!doctype html> <html> <head> <title>homepage</title> <style> @import url(stylesheet.css) </style> <meta charset="utf-8"> </head> <body> <div id ="header"> <?php include('header.php');?> </div> <div id="navigation"> <?php include('nav.php'); ?> </div> <div class = "homepagemain" id="homepagemain"> <h2><strong><em>what zapdebate?</em></strong></h2> <p>zap debate website can debate on hot topic. find topic want , fight! debates out 14 days @ time, , whoever gets likes wins debate!zapdebate place practice debating, or share opinion. go on! fight!</p> </div...

hive - Hadoop Hangs on Job Kill Command -

i running hive 0.12 on hadoop 1.0.3 cluster , job got stuck @ 2.5% in mapping phase many of tasks showing 'lost task tracker' error. when attempt run hadoop job -kill job_id command, command hangs , job not killed. in addition, running of other hadoop job commands hang (such hadoop job -list). hadoop fs commands seem work fine. i checked log files, , not find out of ordinary other notifications of lost tasks. currently cluster stuck on job , need run other mapreduce jobs. best way kill job if hadoop job -kill command not working? you have no error messages when executing command ? to stop job, can try restart hive or restart mapreduce service on hadoop.

javascript - preventDefault( ) on appended html does not work. why? -

the title self explanatory. i'm appending html document in ajax call , prevent default event when click in <a> tag generated function. here's code: $.ajax({ type: 'get', url: "/api/search/info/" +id, accepts: 'application/json' }).then(function(data, status, xhr) { $(".book-results #results").append("<a class='bookitem' href='b"+data.value+"'>add book</a>"); }, showerr); inside same javascript file (but not within ajax function ), have listener: $(".bookitem").click(function(event) { event.preventdefault(); console.log("hello"); }); when trigger ajax event, .book-results #results gets populated, when click <a> tag default event gets triggered. there way make listener work? if so, how? you can't apply event listener before element trying attach listener exists. $(".bookitem").click(function(event) {...}); bind elements c...

css - how to fit image without stretching and maintain aspect ratio in div tag in html -

my image size 640*820.and want fit image screen of size 310*520. while doing maintain aspect ratio(without stretch). <div class="abc" style=" background: url("images/phone.png"); position: absolute; max-width: 100%; width: auto; margin-left:10px; background-size: contain; top: 50px;"> you state width of image , have height auto .div img { width: 310px; height: auto; } <div class="div"> <img src="#" title="#"> </div>

ios - How to deleteAllObjects from NSSet -

i have method here counts number of annotations on map view. however, every time method called, anncount keeps on incrementing. example, there 5 annotations on map - first time method called returns 5 expected. second time it's called returns 11, 16, 21, 26 , on.. mkmaprect visiblemaprect = mymapview.visiblemaprect; nsset *visibleannotations = [mymapview annotationsinmaprect:visiblemaprect]; anncount = [visibleannotations count]; nslog(@"%u", anncount); return anncount; i thinking if clear objects nsset work properly. however, nsset won't recognise deleteallobjects. have tried nsmutableset doesn't work "annotationsinmaprect:visiblemaprect". cheers. your problem not nsset returned. problem annotationsinmaprect: returning more objects expected. leads me believe add more , more annotations map (perhaps mistake). nsset immutable collection, cannot add or remove objects instance. more, when visibleannotations released, releases object...

c# - If network connection is lost while inserting large amount of data, what will happen? -

i using asp.net c# , sql server. inserting 10000 records sequentially. assume after inserting 6000 records, network connection lost. @ time happen? the 6000 records inserted or not? if 6000 records inserted - remaining 4000 records, , how identify how many records inserted , how reverse 6000 records? is there other option rectify problem? if problem occurred need to solve it? there should no duplicate data in end. it depends consider inserting. 10.000 insert statements, no transaction: nothing rolled back. 10k insert statements in transaction - rollback of operations. best way plan that: use sqlbulkcopy temporary table, isnert there final table (sqlbulkcopy has serious issues concurrent table access bypass this). use merge move final table. plan rerunning insert - mergfe makes sure of (no cleanup needed).

mapping - scala slick 2.0.2 cannot automatic map to custom class -

i'm starting play slick , can't figure out how results of query mapped on custom case class. here's code: package main.scala.model.tree import scala.slick.driver.h2driver.simple._ case class slicknode(id : long, parentid : long, statestring : string) extends abstractnode{} object slicknode { val nodes = tablequery[slicknodes] def findbyid(x : long) : slicknode = nodes.filter(_.id == x).first def findbyparentid(x : long) : iterable[slicknode] = nodes.filter(_.parentid == x).list } class slicknodes(tag: tag) extends table[(long, long, string)](tag, "nodes") { def id = column[long]("node_id", o.primarykey, o.autoinc) def parentid = column[long]("parent") def statestring = column[string]("state") def * = (id, parentid, statestring) <> ((slicknode.apply _).tupled , slicknode.unapply) } what expected automatic conversion (long, long, string) slicknode stated in * definition. missing someth...

javascript - Created jQuery button not listening to click -

this question has answer here: event binding on dynamically created elements? 19 answers i've got little loop in new buy button created every product in array. in loop buy button created , should clicked. however, click isn't being registered. button appear in page though. var list = jquery('<ul/>'); (var in persecondproducts) { var product = persecondproducts[i]; var listitem = jquery('<li/>'); listitem.html(i + '(' + product['price'] + ')'); var buybutton = jquery('<button />'); buybutton.html('buy'); buybutton.data('price', product['price']); buybutton.data('scorepersecondupgrade', product['scorepersecondupgrade']); listitem.append(buybutton); buybutton.click(function () { console.log('123123...

javascript - NVD3 Line Plus Bar With Focus Chart only displaying half width of first and last bar -

Image
this looks like: this want like: (created adding dummy data in beginning , end, , manually deleting svg paths...) .forcex() works small focus chart (the bottom one), not main chart. i've been trying fix in source code no avail. add elements before , after each series. x, use number before , after first , last number. y, use nan. create space before , after bars.

mysql - SELECT DISTINCT with INNER JOIN -

hello all, this sound simple i'm having problem here. there tables: table_a ta_id | ta_user | ta_hour | ta_date and table_b tb_id | tb_name | tb_adress here query: $sql = mysql_query("select distinct ta_user table_a inner join table_b on table_b.id = table_a.ta_user ta_date '%$vardate%' order ta_user asc "); when run while loop in array tb_name shuld print cause inter join dosen't work. any ideas ? it appears me have multiple table records given table b entity, right? by way, column names horrible...table_b.id = table_a.ta_user???? how examining database supposed know relationship exists? that's beside point. anyway, guess you're trying return table b entities have records in table_a given date? if so, distinct should work you. i'd use group instead because it's faster. should want, if understand correctly....

ios - I cannot intercept the back button of Numpad -

Image
i want firstresponder go previous textfield when or return key pressed. textfieldshouldreturn not launched. many guys! tried this doesn't seem work. myviewcontroller.h @interface myviewcontroller : uiviewcontroller <uitextfielddelegate> @property (strong, nonatomic) iboutlet uitextfield *firstcodefield; myviewcontroller.m @synthesize firstcodefield; - (void)viewdidload { [super viewdidload]; firstcodefield.delegate = self; secondcodefield.delegate = self; thirdcodefield.delegate = self; fourthcodefield.delegate = self; fifthcodefield.delegate = self; } - (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string { nsuinteger newlength = [textfield.text length] + [string length] - range.length; if (string.length == 0 && textfield.text.length) { if(textfield==fifthcodefield) { nslog(@"it goes fourth textfield doesn't clear number in cell."); ...

android - LocationManager throws NullPointerExpection -

please have code has been working me while, of sudden not working more, returns null pointer exception at double lat = (double) (lastknownlocation.getlatitude());. i have set required permission @ manifest file , seems not work again. think there must problem using gps provider now. latitutefield = (textview) findviewbyid(r.id.textviewlatitudevalue); longitudefield = (textview) findviewbyid(r.id.textviewlongitudevalue); speedfield = (textview) findviewbyid(r.id.textviewspeedvalue); altitudefield = (textview) findviewbyid(r.id.textviewaltitudevalue); addresslabel=(textview)findviewbyid(r.id.textviewaddress); lbllatitude=(textview)findviewbyid(r.id.lbllatdms); lbllongitude=(textview)findviewbyid(r.id.lbllongdms); // location manager locationmanager = (locationmanager) getsystemservice(context.location_service); // gps_provider string locationprovider = locationmanager.gps_provider; location lastknownlocation = locati...

php - Issue with cache? -

i'm trying install webviewer teamspeak 3 (a voip program) have issues. first of all, official website has discontinued support of 1 month ago, cannot ask them unfortunately. when go webviewer page first time seems work fine. if refresh page goes white , loads until get: php fatal error: maximum execution time of 30 seconds exceeded in c:\users\[...]\tsquery.class.php on line 414 here line 414 file: $ret .= fgets($this->connection, 8096); and whole function: private function send_raw($text) { $i = -1; $ret = ''; if ($this->connection === null) { $this->open_new_connection(); } stream_set_timeout($this->connection, 0, 300000); fputs($this->connection, $text); { $ret .= fgets($this->connection, 8096); } while (strstr($ret, "error id=") === false); return $ret; } i have tried both on webhost , moving script on same server voip installed on (thinking host might ca...

java - Maven project integration with Jenkins #selenium scripts -

Image
i trying run selenium scripts on jenkins locally on computer. using eclipse project , converted maven configure>convert maven project. jenkins configuration look @ configuration in images. have done far. beginner don't know missing. console output on jenkins try this: /user/gauravgandhi/documents/workspace/applico/website for file system path , pass pom.xml under root pom text box , define goals same. hoping configure jdk , maven @ jenkins level under configure jenkins link. please let me know if works or not.

c++ - What's the best way to trim std::string? -

i'm using following code right-trim std::strings in programs: std::string s; s.erase(s.find_last_not_of(" \n\r\t")+1); it works fine, wonder if there end-cases might fail? of course, answers elegant alternatives , left-trim solution welcome. edit since c++17, parts of standard library removed. fortunately, starting c++11, have lambdas superior solution. #include <algorithm> #include <cctype> #include <locale> // trim start (in place) static inline void ltrim(std::string &s) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) { return !std::isspace(ch); })); } // trim end (in place) static inline void rtrim(std::string &s) { s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) { return !std::isspace(ch); }).base(), s.end()); } // trim both ends (in place) static inline void trim(std::string &s) { ltrim(s); rtrim(s); } // trim start (copying) static inline std::st...

PHP: session controll the pages from unauthorized access, with level -

aim a simple login page check user credentials if correct in database lets user login , check on other pages if sessoin provide let user operation in pages else redirect them out login page authentication. the connection set , working fine: the session has started: for checking input , echo variables simple checking function: function check_param($val){ $value1=addslashes($val); $string1=htmlspecialchars($value1); $string2=strip_tags($string1); return $string2; } now user authenticate trough form , runs function check if can login pages , pass $_session['username'] , $_session['password'] , $_session['level'] next page , store browser tell getting destroy command. public function auth($name = '', $password = '', $level=''){ $sql = "select count(*) dab_users `name`=:name , `password`=:password , `level`=:level "; $result = $this->conn->prepare($sql); $passme = hash_v...

System Verilog Clocking block -

i trying perform simple test demo code of clocking block, encountered error. the code find @ "eda playground" http://www.edaplayground.com/x/3ga and error says: ** error: testbench.sv(38): default clocking block must specified use ##n timing statement. ** error: testbench.sv(40): default clocking block must specified use ##n timing statement. i think clocking block has been specified in code. any help? as error message says, have define clocking block default: default clocking cb_counter @(posedge clock); full code here: http://www.edaplayground.com/x/37_ the sv 2012 standard specifies ##n operator can used if there default clocking block defined module/program/interface, otherwise wouldn't able know clock event use delay.

java - Spring 4 / Groovy DSL - autowiring -

how enable autowiring when using groovy dsl in spring 4? if config.groovy file looks this: beans { mongoclient(com.mongodb.mongoclient) hello(org.abiri.helloimpl) { mongoclient = mongoclient } } previously in xml configuration, have done this: <bean id="hello" class="org.abiri.helloimpl" autowire="bytype" /> and enable whole file: <beans default-autowire="bytype" /> what equivalent of xml snippets in new groovy dsl, i.e need in order mongoclient autowired hello ? you need use hello(org.abiri.helloimpl) { bean -> bean.autowire = "bytype" } the configuration closure passed parameter can use configure things attributes on bean element in xml configuration. in addition autowire includes scope , initmethod , destroymethod .

javascript - Nake number of synchronous ajax calls in the same time -

is there way make number of synchronous ajax call in same time? lets have number of ajax calls have no dependency of each other. want them run in same time can't use asynchronous calls because of reason. what think want - make ajax calls in parallel , make action. so need use async operations in parallel option - sync.js async operations in parallel - http://alexeypetrushin.github.io/synchronize/docs/index.html var sync = require('synchronize') function read(a, cb) { settimeout(function(){ cb(null, a) }, 1000) } // runs in parallel sync.fiber(function() { sync.parallel(function() { // must call defer() manually within // parallel operation. read(1, sync.defer()) read(2, sync.defer()) }); var results = sync.await() // results contains [1,2] });

apache - index.php with a trailing slash is redirected to an absolute path -

i type in browser address bar www.mysite.com/index.php/ and redirected to www.mysite.com/home/user/domains/mysite.com/public_html/index.php mean? should use .htaccess solve issue? edit i noticed if load mysite.com/index.php/ without www. prefix, url not found message expected , no redirection made.

extjs - Can i make a to json from datasource? -

i have json file: [{ "text": "company", "id": "100", "leaf": false, "cls": "folder", "expanded": true, "children": [{ "text": "children level 1 1", "id": "02", "leaf": false, "cls": "folder", "expanded": false, "children": [{ "text": "children level 2 1", "id": "02.02", "leaf": false, "cls": "folder", "children": [{ "text": "children level 3 1", "id": "02.02.01", "leaf": true, "cls": "file" }, { "text": "children level 3 2", "id": "02.02.02", "leaf": tru...

web services - Convert NetSuite TransactionSearch into Advanced Search with only internalId column to return -

i've got ordinary transaction search, soap looks this: <?xml version="1.0" encoding="utf-8"?> <search xsi:type="sales:transactionsearch" xmlns="urn:messages_2013_1.platform.webservices.netsuite.com" xmlns:sales="urn:sales_2013_1.transactions.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:common="urn:common_2013_1.platform.webservices.netsuite.com" xmlns:core="urn:core_2013_1.platform.webservices.netsuite.com"> <sales:basic xsi:type="common:transactionsearchbasic" xmlns:common="urn:common_2013_1.platform.webservices.netsuite.com"> <common:type operator="anyof" xsi:type="core:searchenummultiselectfield"> <core:searchvalue xsi:type="xsd:string">_invoice</core:searchvalue> </common:type> ...

python - Not checking previous parameter -

i'm trying starting out python , i'm trying write basic program checks if word palindrome. there while loop within while loop program isn't backing out check if first loop still applicable. while n <= half_word_length: while word[n] == word[word_length - 1 - n]: n += 1 if word[n] != word[word_length - n]: print('this word not palindrome.') break else: print('this word palindrome.') regardless of if input word palindrome or not error message "list index out of range" . thought because wasn't checking outside of loop non-palindrome shouldn't cause program crash. apologies if hard understand, tell me , i'll try fix bit :) there absolutely no need inner while loop, break incorrectly indented , compare letters first letter ( word[0] ) not n th letter: while n <= half_word_length: if word[n] != word[word_length - n - 1]: print('this word not palindrome.') ...

java - saving a button for later use -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i want save button , change it's icon next time clicks on button, gives me nullpointer exception on line button2.seticon(icon); . how can save button , change it's icon next time? or how can access button array in constructor? possible? package tictactoe; // import necessary classes , interfaces import java.awt.borderlayout; import java.awt.dimension; import java.awt.font; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.util.linkedhashset; import java.util.random; import java.util.set; import javax.swing.icon; import javax.swing.imageicon; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.joptionpane; import javax.swing.jpanel; public class tictactoegame extends jframe { /** ...

c - Why doesn't following code work for a linked list with just 2 nodes having same value? -

the following function deletes duplicates in unsorted linked list. works cases except when linked list has 2 nodes have duplicate values such 10->10>null can point me going wrong ? void deldup(struct node* head) { struct node* outer = head; struct node* inner, *temp; while (outer->next != null && outer != null) { inner = outer; while (inner != null && inner->next != null) { if (inner->next->data == outer->data) { temp = inner->next; inner->next = inner->next->next; free(temp); } else { inner = inner->next; } } outer = outer->next; } } after deletion of second 10, outer->next null gets assigned outer. next outer while loop condition tries access outer->next first crashes. solution: reverse outer->next != null ...

java - Sends files from client to server -

in below codes,i trying let server-side select file client , sends it, work done on server side. program works running server first wait client run, make connection, server sends place of file client-side outreader.write("b://ghassar/ghassar.txt"); client reads location , sends file. have run debug , once server reads code string filename = inreader.readline(); stops , gets in loop, can me solve problem / server.java /* * server waits connection established client * */ import java.io.*; import java.net.*; class server { public static void main(string args[])throws exception { system.out.println("server running..."); /* listen on port 5555 */ serversocket server = new serversocket(222); /* accept sk */ socket sk = server.accept(); system.out.println("server accepted client"); // recive client inputstream input = sk.getinputstream(); //read coming ...

javascript - Using $sce in Angular -

i'm having trouble getting head around showing iframes in angular app. users allowed enter youtube url , app convert straight video. of course, angular won't allow directly have explicitly "trust" contents use show iframe: $sce.trustasresourceurl(url_of_video) however, how back? want able send url back-end in sanitized form it's no longer original url string. update: experimenting , came code: angular.foreach($scope.task.items, function(item) { item.data = $sce.gettrustedresourceurl(item.data); //this gets rejected $sce item.data2 = $sce.gettrustedresourceurl(item.data); //this accepted , i'm free post url }); i've noticed can create new name/value pair in array , assign original url if try assign item.data trusted form of sanitized data rejects it! hmmmmm! why this? any ideas? update 2 decided create 2 versions of data, 1 front end (which "trusted" $sce) , 1 back. appears have solved issue moment. take @ this ...

r - Finding index of a first NON-NA for a specific column in data frame -

i have data frame multiple columns. of data missing (na). sorted data frame 1 column, , data sorted na's sorted last values. want index of last non-na value. column1 column2 1 2 2 na 3 data 4 data na data na data na data so want index of 4. tried which(is.na(df)) but doesn't seem return na values. it appears want expression: max(which(complete.cases(df$column1)))

arrays - How can I accurately push individual users and accounts to a hash and then make sure separate account balances are not added together as one? -

working on bank program. need make sure users (person objects) have own bank accounts can create different balances in each account can interact with. should able deposit, withdraw, transfer money, etc. i'm having trouble outputting correctly. as see, when says how money each person has in account being called, it's displaying total accounts created user. ideas on how can fix this? also, need little guidance on if statement in transfer method. can't display correctly each scenario. class bank attr_accessor :balance, :withdrawal, :deposit, :transfer, :users @@accounts = {} #@@balance = {} def initialize(bname) @bname = bname @users = {} @@accounts[users] = bname #@@balance[users] = bname puts "#{@bname} bank created." end def open_account(name, bname, balance = 0) if @users.include?(name) bname.each |users| @@accounts.push('users') end end @balance = balance puts "#{nam...

actionscript 3 - What is the best way to use SWF library runtime (AIR) -

i building project in air going run third party swf. best way instruct people creating swf files? i don't understand how signing going work here. avoid been trying create library project in flash builder 4.7, how ever not see option export sfw file, nor know way share swc in run time. so how do this?

python - How to get APIViews and ViewSets to show on API Root when using Router with Django REST Framework? -

i started using drf , wondering how automatically generated api root provided router display endpoint routes don't come viewset-based views. in case, have non-viewset (generic) class-based views (listapiview , retrieveapiview) in views.py appear in api root. i open alternative solutions this, e.g. should abandon viewsets , implement endpoints differently, etc. i think best way here to: keep using preferred viewsets / generic* / mixins / bare views. real work happens. rewrite apiroot -view (it not complex, see the source ). either use urlconfig or extend defaultrouter make drf use apiroot-view.

jquery - How access data in JavaScript arrays using $.ajax -

this script when script executed want load data div of id #trial . script external array 3 names second trying call 'sarah'. whats wrong? <script> $(document).ready(function(){ $("#trial").click(function(){ var attempt=$.ajax({ url: "names.js", datatype: "script" }); var msg=names[1]; attempt.done(function( msg ) { $( "#trial" ).html( msg ); }); }); }); </script> change code this: <script> $(document).ready(function(){ $("#trial").click(function(){ $.ajax({ url: "names.js", datatype: "script", success: function(res){ //todo res } }); }); }); </script>

c# - Is there a faster way to count an XmlNodeList -

i read couple of regex definitions xml count function requires 47.3% of time. there better / faster way job done? private string[] xmlnodestostring(xmlnodelist tagname) { int = tagname.count; //47,3% int = 0; stringbuilder sbtemp = new stringbuilder(); while (a > 0) { if (tagname[i].innertext != "null")//11,8% { sbtemp.appendline(tagname[i].innertext); } i++; a--; } char[] csplitdef = { '\n' }; return (sbtemp.tostring().split(csplitdef, stringsplitoptions.removeemptyentries)); } i'm glad :) just iterate on nodes: private string[] xmlnodestostring(xmlnodelist tagname) { return xmlnodelist.cast<xmlnode>() .select(n => n.innertext) .where(t => !string.isnullorempty(t)) .toarray(); } you don't need nodes count, access nodes index , build string, later should splitted. if linq...

apache - Getting the request object outside a mod_perl handler -

i want log apache log file subroutine called mod_perl handler doesn't have request object ($r) . sub handler { ($r) = shift; ... common::subroutine_that_also_logs(); ... } package common; sub subroutine_that_also_logs { ... # $r->log->info('cannot this') ... } while using print stderr or warn works want use apache2::log additional request information in log :- [fri may 30 16:12:37 2014] [info] [client 123.123.123.123] cannot instead of cannot i want avoid global init in handler mean updating few hundred handlers :- my $globalr; sub handler { $globalr = shift; ... common::subroutine_that_also_logs(); } package common; sub subroutine_that_also_logs { ... $globalr->log->info('can try this') ... } i have set single perlfixuphandler initializing $globalr wonder if there better way or if $r available directly other means. you can use apache2::requestutil . package common;...

c++ - Error messages and having better organized code in Qt -

when starts loads data file , verify if correct before saving in memory. repositoryinfile::repositoryinfile(validator *validator){ this->validator = validator; this->read(); } read() private method tries open , read data file. throws exceptions. when catch error in program this: try { //do } catch (customexception custome) { qstring message = qstring::fromstdstring(custome.reason()); // i'm not extending std::exception beacause... don't know why qmessagebox::critical(this, "error!", message); } now, if goes wrong in repositoryinfile's constructor can throw exception , can catch in main function, can't show nice message box on screen informing user went wrong (or don't know how). right show message in console qdebug(), has purpose me. should redesign way repositoryinfile works , have other method load data file after gui initialized? not needed. show message box in exception handler. change nee...

Regex group in JavaScript -

Image
i find words in string. example: {add_first} and/or {ban_1} regular expression first: var arr = str.match(/{add_([a-z]+)}/gi); regular expression second: var arr = str.match(/{ban_([0-9]+)}/gi); but how combime both regular expressions? /{(add_([a-z]+)|ban_([0-9]+))}/gi here regexper visualisation :

dependency injection - Why does ComposeExportedValue not insert my object into the container? -

i have following line of code seems nothing @ all, no errors, nothing. object not in container's catalog: public void initialize() { if (authenticationmodel.current.protocol.tostring() != gettype().name.replace(unittypesuffix, "")) { return; } _container.composeexportedvalue<iloginview>(new loginview()); } the if check because potentially have more 1 login module, , 1 specified protocol must make it's view available in container. other dynamically loaded modules can ask login view registered. check passes , composeexportedvalue executes, object not visible in container. if this, see use login view, when composes test object: public class test { [import] public iloginview loginview { get; set; } } var test = new test(); container.composeexportedvalue<iloginview>(new loginview()); container.satisfyimportsonce(test); the documentation not detailed, think not added container because created object, , keep ownership ...

ezpublish - Error on login for backend users with custom roles -

i created custom role users, , assigned role particular user content tree limitation. on image problem when user log in, error on image . roles working, user can see assigned content tree , work it. how can solved first screen? redirection on content tree job. thank :) make sure user assigned role to, has basic role access basic contribution functions. have "backoffice user" role assigned every contributor (or group), includes (without limitation) : user/login on admin siteaccess content/read on @ least root node : need able "through" node (and others if needed) see ones under it ezoe, ezjscore, ezmultiupload, ezfind, ezie etc content/(edit|remove|...) on contents owned user himself or group hope helps

markdown - How to auto-preview a readme.md in a browser? -

i writing file called readme.md python project, , preview while write it. used it, cannot remember command line, , cannot find anywhere. it bash command-line linking .md file browser, refreshing page each time saved changes in .md file (written text editor). hence, need able write file in own text editor, , not online, , see result each time save changes (without having copy , paste have written online converter). worked text editor (i saw sublime-text plugins, not looking for), linked .md file itself. i don't know script talking made php parser markdown syntax embeds an example script ask apache parse .md file in html output (see docs/ directory of package simple documentation). if have localhost php running (php 5.3+), can use after short vhost config. original file parsed @ each request, page updated last modifications (but need view in browser).

How to add filters to a Grails app -

i'm trying add these single signout filters grails 2.3.6 app. according grails docs on filters seems can add new (custom) filters grails apps, whereas these existing filters imported project/jar. i scanned project existence of web.xml , didn't find anything. how can add specific filters in above link grails app? the easiest way run " grails install-templates " , edit resulting src/templates/war/web.xml file.

for loop - complexity - bigtheta 3 for cycle -

Image
i resolve problem don't have solution of kindly ask if can confirm if solution correct or not int h=1; int cont = 0; (j = 2^n; j>1; j = j/2) { h = h * 2; (i =1; < j; = i*2) (k=2; k<h; k++) cont ++; } i must find complexity of portion of code in bigtheta. so, analyze third cycle grow in way k -> linear until = h (h grow 2^w) - complexity log n. about second, first cycles' limit 0 think complexity log n. about first 2^n = 2^n-1 complexity n the total complexity n * log n you can proceed formally, step step, using sigma notation (i skipped steps, feel free ask more details if necessary):

php - HABTM SaveAssociated is performing a SELECT instead UPDATE in CakePHP -

when performin following saveall: $this->loadmodel('foo'); $my_data = array( 'foo'=> array('id' => 1), 'bar' => array() ); $my_values = array(1, 2, 3); foreach ($my_values $key => $value) { array_push($my_data['bar'], array( 'id' => $value, ) ); } $this->foo->saveall($data, array('deep' => true)); the [foo_has_bar] table wasn't updated. when checking queries i've found select: begin; update my_db.foo set id = 1 my_db.foo.id = 1; select foo_has_bar.bar_id my_db.foo_has_bar foo_has_bar foo_has_bar.foo_id = 1; commit; my model following: foo model: var $hasandbelongstomany = array( 'bar' => array( 'classname' => 'bar', 'jointable' => 'foo_has_bar', 'foreignke...

css3 - Different CSS position of a single letter in IE 9/10 vs. Chrome 35 -

Image
the x inside red box has in ie 9/10 offset left side of ~5px not there in crome/ff. can explain me why? , if there way fix css? example here: http://codepen.io/anon/pen/ptars result: crome (latest): ie 10: css/html code: <!doctype html> <html> <head><meta charset="utf-8"></head> <body> <style> div.pseudo{ position: relative; margin: 10px; background-color: orange; width: 20px; height: 20px; border: 1px solid red; padding: 5px; } div.pseudo:after{ content : "✘"; position: absolute; left:0; top:0; font-size: 20px; color: black; } </style> <div class="pseudo"></div> </body> </html>

C# convert to date - No implicit conversion between 'System.DateTime' and '<null>' -

this question has answer here: nullable types , ternary operator: why `? 10 : null` forbidden? [duplicate] 9 answers i have following code: var tz = timezoneinfo.findsystemtimezonebyid("central standard time"); dateanalyzed_copper = records.dateanalyzed_copper.hasvalue ? timezoneinfo.converttimetoutc(records.dateanalyzed_copper.value, tz) : null, ...... note dateanalyzed_copper nullable datetime. i following message type of conditional expression cannot determined because there no implicit conversion between 'system.datetime' , '<null>' you should cast either null nullable datetime: dateanalyzed_copper = records.dateanalyzed_copper.hasvalue ? timezoneinfo.converttimetoutc(records.dateanalyzed_copper.value, tz) : (datetime?)null or datetime value returned converttimetoutc : dateanalyzed...

What is the canonical way to isolate unit tests in Python with assertion-style tests? -

i asked question , realized i'd know if there's way achieve 'expectation' isolation assertion-style tests. i've copy , pasted simple example of mean 'expectation' isolation. i'm relatively new python, coming ruby/javascript , having testing libraries rspec , jasmine has provided me ability isolate 'expectations' when testing single function. since there doesnt seem 'expectation'-style library python actively maintained, wondering if there's way achieve equivalent testing style either unittest or pytest (the 2 popular python testing libraries understand). foo.py class foo(): def bar(self, x): return x + 1 expectation-style/describe-it test_foo.py describe foo: describe self.bar: before_each: f = foo() 'returns 1 more arguments value': expect f.bar(3) == 4 'raises error if no argument passed in': expect f.bar() raiseerror uni...

javascript - Kinetic.js get shape hit region with color change -

first of all, have images different shapes , have recolour them, , set hit region (for onclick event) when mouse on shape. after investigate problem separately, have found both solutions, dont know how use both together. -to use shape hit region, use .cache(), store image on cache , redraw without transparent pixels. -to change color, iterate on imagedata pixels, change them 1 one inside loop. for testing, i'm using original blue image (.png format) , want red image hit regions set properly, i'm using kinetic-v5.0.2. this code. function makekineticimage(imageobj){ var dimage = new kinetic.shape({ scenefunc: function (context) { context.beginpath(); console.log("scenefunc"); var x = 100; var y = 100; context.drawimage(imageobj, x, y, imageobj.width, imageobj.height); var imagedata = context.getimagedata(x, y, imageobj.width, imageobj.height); var data = i...