Posts

Showing posts from February, 2011

.htaccess - CakePHP 2.6.0 is not loading CSS and JS files -

i uploaded website server not loading css , js files, can see site text , after put .htaccess files in places got message in site: internal server error the server encountered internal error or misconfiguration , unable complete request. please contact server administrator, , inform them of time error occurred, , might have done may have caused error. more information error may available in server error log. additionally, 500 internal server error error encountered while trying use errordocument handle request. these .htaccess files /www/ <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule> /www/app/ <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] /www/app/webroot/ <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !...

azure - How to publish a WCF against a publish settings file? -

Image
i have created site in azure , downloaded publish settings file. when click publish in vs option select file publish settings but asp.net project. more or less like so . the problem i'm trying publish wcf library , publish option allows iis, ftp or system. can't find option publishing via settings file i've downloaded. how can point wcf project pubxml file? edit based on comments , replies, installed asdk. projects can choose now. this looking for. screenshot visual studio community 2013. and then... .. app.config additions addresses, bindings, , contracts .. azure endpoint configuration

How to remove duplicates in SQL Server -

i have data looks this: order no. name date unit price freight 001 abc 1-16 232 25 001 abc 1-16 55 25 001 abc 1-16 156 25 002 def 2-5 478 16 002 def 2-5 356 16 i trying let freight cost show once in table, result like: order no. name date unit price freight 001 abc 1-16 232 25 001 abc 1-16 55 0 001 abc 1-16 156 0 002 def 2-5 478 16 002 def 2-5 356 0 please me this here query want: select order_no, name, thedate, unit_price, case when row_number() on (partition order_no order order_no) = 1 freight else 0 end freight yourtable this looks @ rows each order number , provides row number. if it's row 1 of order uses values of freight column, otherwise uses 0. note i'm assuming freight valu...

javascript - Drawing soft brush -

Image
i'm trying create smooth brush in html5, example below. this tried, it's something. it's not smooth image above. editor.drawing.context.globalalpha = 0.3; var amount = 3; for(var t = -amount; t <= amount; t += 3) { for(var n = -amount; n <= amount; n += 3) { editor.drawing.context.drawimage(editor.drawing.clipcanvas, -(n-1), -(t-1)); } } and looks this. using brushes choose brush, can image predefined brushes or can make 1 using off-screen canvas , draw radial gradient it. simplicity made simple image brush such these: then each new point drawn canvas: calculate diff between previous , current point calculate length of line can use absolute step value independent of length iterate on length using normalized value , calculated step value the step value can looks result - largely depends on smoothness of brush general size (smoother brushes require smaller steps blend each other). for demo used brush-width, small...

javascript - Why do I get only 000000 as the add on number in a PHP Ajax file transfer with add on number? -

i got stackoverflow 000000 add on numbers: 1) want format id2 "000000" 6 digits, example if id2 302 should "000302" 2) want combine formatted data (000302) in .$_files['file']['name'] in upload.php file , save file new file name. the $new_id have "000000", whatever do. i still lost how it, first good! the file transfer code not me. code internet. i happy help! this in head section: <script type="text/javascript" src="js/multiupload.js"></script> <script type="text/javascript"> var config = { support : "image/jpg,image/png,image/bmp,image/jpeg,image/gif", // valid file formats form: "demofiler", // form id dragarea: "draganddropfiles", // upload area id uploadurl: "upload.php" // server side upload url } $(document).ready(function(){ ...

Python function returning correct result but interpreter returning strange error -

python newbie here, bear me... i'm attempting utilize poorly written codeacademy python tutorial, wherein exercise challenge to: write function called digit_sum takes positive integer n input , returns sum of number's digits. for example: digit_sum(1234) should return 10 1 + 2 + 3 + 4. (assume number given positive.) so, attempt solve challenge writing following code: userinput = raw_input("please enter number string here: ") n = userinput lst = list(n) usernumbers = [] def digit_sum(n): in lst: b = int(i) usernumbers.append(b) numsum = sum(usernumbers) return numsum print "this total: %s" % digit_sum(n) in console exercise, seems work expected: please enter number string here: 123 total: 6 none however, interpreter returns error (despite console seeming work properly): oops, try again. function fails on digit_sum(434). returns 18 when should return 11. why in heck error being retur...

What's the logic behind Python's hash function order? -

as know, of python's data structures use hash tables storing items set or dictionary . there no order in these objects. seems that, sequences of numbers that's not true. for example consider following examples : >>> set([7,2,5,3,6]) set([2, 3, 5, 6, 7]) >>> set([4,5,3,0,1,2]) set([0, 1, 2, 3, 4, 5]) but isn't sorted if make small change : >>> set([8,2,5,3,6]) set([8, 2, 3, 5, 6]) so question is: how python's hash function work on integer sequences? although there lot of questions in hash , order,but no 1 of them explains algorithm of hash function. so need here know how python calculate indices in hash table. if go through hashtable.c file in cpython source code you'll see following lines in _py_hashtable_set function shows way python calculate index of hash table keys : key_hash = ht->hash_func(key); index = key_hash & (ht->num_buckets - 1); so hash value of integers integer * (except -1) ind...

How to implement Spring Security 4 with both XML and Java config -

i trying implement spring-security 4 spring mvc web , rest app. added 2 classes enable spring security java config way. still want hold onto web.xml , not change entire project use java config. that, following error: 29-may-2015 08:47:12.826 severe [localhost-startstop-1] org.apache.catalina.core.standardcontext.filterstart exception starting filter springsecurityfilterchain org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'springsecurityfilterchain' defined @ org.springframework.beans.factory.support.defaultlistablebeanfactory. getbeandefinition(defaultlistablebeanfactory.java:687) as can see, says springsecurityfilterchain cannot recognized. of course supposed enabled @enablewebsecurity see below: classes used spring security: @configuration @enablewebsecurity public class securityconfig extends websecurityconfigureradapter { @autowired public void configureglobal(authenticationmanagerbuilder auth) throws exception { au...

ios - Adjusting UILabel width in XIB -

Image
i trying add 2 uilabels in container view , adjusting size of labels according content inside. working fine except 1 thing. want width of labels adjusted according first label having text a , number of lines of second label should change if content in second label more first label. here constraints labels. make sure label b has width constraint (it not width expand indefinitely fit content) ensure label b has numberoflines set zero. setting available in interface builder. i'm assuming constraints container has fixed width , height free expand fit labels.

xcode - IOS - Translucent Navigation Bar over content -

i have tableview uiimage in header. what accomplish same twitters profile page. translucent navigation bar on cover image. have done far navigationbar.translucent = true , set coverimage.frame.origin.x = -50 navigationbar still not go on image , image gets cut off. thanks uitableviewcontroller adjusts content inset start of content begins @ bottom edge of navigation bar. you can uncheck view controller's adjust scroll view insets property, stop tableview content being inset. (this affect both top , bottom bars.)

javascript - BookshelfJS belongsToMany doesn't return duplicates -

i have 2 tables have relationship belongstomany . pivot table contains column called state have 3 different values. tables table1 , table2 . there can multiple entries same table1-table2 relation different states . i want pivot entries table1 including multiple entries same table2 . unfortunately, code return this.belongstomany(table2, 'pivot_table1_table2').withpivot(['state']) only returns first entry each table2 . help appreciated. that's how bookshelf works! it's part of feature: remove dupes. found workaround; explicitly select attribute junction table that's unique. if don't have one, create model junction table. that's sadly solution then. update: perhaps that. routes.code unique in case , part of junction table. if won't trick, create model junction table , you're set (this more preferred). new station().where({ id: req.params.id }).fetch({ withrelated: [{ 'routes': function(q...

stage3d - Pass position to fragment shader in AGAL -

i trying shading agal. have set full screen quad drawn shader programs, ran unexplainable. i have these vertices var vertices:vector.<number> = vector.<number>([ - 1, - 1, 0, - 1, - 1, 0, + 1, - 1, 0, + 1, - 1, 0, - 1, + 1, 0, - 1, + 1, 0, + 1, + 1, 0, + 1, + 1, 0 ]); this pair of program works vertexshaderassembler.assemble(context3dprogramtype.vertex, "mov op, va0\n" + "mov v0, va1" ); ... fragmentshaderassembler.assemble(context3dprogramtype.fragment, "mov oc, v0" ); however not vertexshaderassembler.assemble(context3dprogramtype.vertex, "mov op, va0\n" + "mov v0, va0" ); ... fragmentshaderassembler.assemble(context3dprogramtype.fragment, "mov oc, v0" ); any clue on why have pass same values through va1 , why not work when vertices have 3 coordiante? there validation error or wrong indices order, if don't see result on screen. detec...

oop - Python Passing a Function to an Object -

i trying create class allows users create custom button object, holds button's appearance attributes, function, want able run when call button's executefunction() command. def foo(): print "bar" class button(object): def __init__(self, name, color, function): self.name = name self.color = color self.function = function # want able run function calling method def executefunction(self): self.function() newbutton = button("example", red, foo()) newbutton.executefunction() is correct way, or there specific way perform kind of action? in python, functions objects , can passed around. there small error in code , easy way simplify this. the first problem calling function foo while passing in button class. pass result of foo() class, , not function itself. want pass foo . the second nice thing can assign function instance variable called function (or executefunction if want), , can called vi...

r - Error when trying to read .csv files from Github -

i trying read few csv files github r using import function package rio getting error displayed below. error in fread(input = file, sep = sep, sep2 = "auto", header = header, : supplied 'sep' not found on line 1. read file single character column set sep='\n'. the code have used import("https://raw.github.com/smbilal/scc413/blob/master/hp.csv") the file can seen using above url , comma separated file cannot seem figure out problem. have tried other methods "geturl" ends throwing ssl error , description below. error in function (type, msg, aserror = true) : ssl certificate problem: unable local issuer certificate could still problem ssl cant seem read files using "import" or making other mistake?

php - Get function in Google Analytics API -

i'm trying fetch data using analytics api, example have this: function getresults(&$analytics, $profileid) { // calls core reporting api , queries number of sessions // last 7 days. return $analytics->data_ga->get( 'ga:' . $profileid, '7daysago', 'today', 'ga:sessions'); } and function in analytics.php file is: public function get($ids, $metrics, $optparams = array()) { $params = array('ids' => $ids, 'metrics' => $metrics); $params = array_merge($params, $optparams); return $this->call('get', array($params), "google_service_analytics_realtimedata"); } } how adapt example return dimensions along sessions, example, pagepath? thanks so question little unclear, first part of question correct, example works , way data google analytics api. not need touch or modify analytics.php however. here code should like: $ga_profile_id = xxxxxxx; // insert yours $from = da...

ios - Best way to animate scaling and sizing of buttons in Swift? -

i'm using code below animate intro-animation buttons in ios swift game. code inside of update function , same lot of buttons. if self.creditsbutton.size.width < 40 { self.creditsbutton.size.width += 1 self.creditsbutton.size.height += 1 } my question is; there better (more clean) way animate scaling/sizes of buttons/menu's? if button subclass of skspritenode skaction enables schedule animation without needing regularly update, e.g. (apologies objective-c): skaction *scale = [skaction resizetowidth:40.0 duration:0.4]; [spritenode runaction:scale];

sql server - Pass array on to sql and insert it in link table with one value -

i've found ways pass array stored procedure , ways insert table table. want insert array in table column2 1 other value have value column1: insert table1 (column1, column2) values (select @value, column2 @othertable) i tried inserting array column2 first , updating column1 1 value. didn't work , insanely expensive anyway. is there reasonable way this? if i'm understanding correctly, need rid of values , so: insert table1 (column1, column2) select @value, column2 @othertable;

intellij idea - Android Studio Rendering Library -

Image
this question has answer here: android studio rendering problems 12 answers i created test project inside of android studio , i'm getting following message: summary: rendering problems: version of rendering library more recent version of android studio. please update android studio. details: org.jetbrains.android.uipreview.renderingexception: version of rendering library more recent version of android studio. please update android studio @ org.jetbrains.android.uipreview.layoutlibraryloader.load(layoutlibraryloader.java:90) @ org.jetbrains.android.sdk.androidtargetdata.getlayoutlibrary(androidtargetdata.java:159) @ com.android.tools.idea.rendering.renderservice.createtask(renderservice.java:164) @ com.intellij.android.designer.designsurface.androiddesignereditorpanel$6.run(androiddesignereditorpanel.java:475) @ com.intellij.u...

hierarchical clustering - A UPGMA cluster in R with NoData values -

i have matrix of sites. want develop upgma aglomerative cluster. want use r , vegan library that. matrix has sites in not variables measured. following similar matrix of data: variable 1;variable 2;variable 3;variable 4;variable 5 0.5849774671338231;0.7962161133598957;0.3478909861199184;0.8027122599553912;0.5596553797833573 0.5904142034898171;0.18185393432022612;0.5503250366728479;na;0.05657408486342197 0.2265148074206368;0.6345513807275411;0.8048128547418062;0.3303602674038131;0.8924461773052935 0.020429460126217602;0.18850489885886157;0.26412619465769416;0.8020472793070729;na 0.006945970735023677;0.8404983401121199;0.058385134042814646;0.5750066564897788;0.737599672122899 0.9909722313946067;0.22356808747617019;0.7290078902086897;0.5621006367587756;0.3387823531518016 0.5932907022602052;0.899773235815933;0.5441346748937264;0.8045695319247985;0.6183003409599681 0.6520679140573288;0.5419713133237936;na;0.7890033752744002;0.8561828607592286 0.31285906479192593;0.3396351688936058;0...

java - init method is calling again and again in servlet -

the init method gets called again , again on every request in servlet. here code: public class personinfocontroller extends httpservlet { private static final long serialversionuid = 1l; public personinfocontroller() { super(); } public void init() throws servletexception { connection connection = database.getconnection(); system.out.println("init method"); } protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { list<personinfoservicei> mylist = new arraylist(); personinfoservicei instance = new personinfoserviceimpl(); mylist = instance.getdata(); string jsonstring = new gson().tojson(mylist); request.setattribute("list", jsonstring); requestdispatcher rd = request.getrequestdispatcher("showdata.jsp"); rd.forward(request, response); } public void destroy() { ...

oracle - Does anyone know what is the type of this hash? -

my friend give me oracle server 10g, , he's changeling me if password database or change using sh, server mine i've try hard because first time using oracle when looked @ server , explore file found hash password , lead me password, file located in path apache/modplsql/conf/dads.conf and hash found start symbol @ plsqldatabasepassword @xxxxxxxxxxxxxxxx the xxxxxxxxxxxxxxxx= random letters , numbers and end == at beginning thought it's sort of base64 encode, , turned out me not so question how can decode hash? can password clearly? how can modify password of database (: else, google , of them wrote oracle web server 9g using encode64 . best regard probably it's one-way hash, means can't decrypt it. if you're fortunate pal won't have deleted backup version of dads.conf file (it'll in same directory, date in name). otherwise, you're stuck in position of else trying hack database. guessing or brute force.

c# - Evaluate/Find column delimiter of a text file -

does have method of evaluating/finding column delimiter of given text file? i'm willing suggestions, whether involves c# script, powerscript, etc. i have client likes keep on our feet changing column delimiters every other data feed. obviously, breaks our sql agent import jobs. while go failure route -- if connection manager (with comma delimiter instance) fails, use connection manager (tab delimited connection) -- rather evaluate delimiter before failure , decide route take. have experience doing this? assuming each row has same number of columns, pick set of common delimiters (comma, tab, pipe, whatever) , count how many of each within first many rows. if comma counts first 5 rows 34,34,35,34,36 while tab count rows 0,0,1,0,0 have 34 comma-delimited columns, few commas embedded in text. it'll easier if know in advance how many columns expect. bottom line may not deterministic, black-and-white algorithm, matter of choosing rules , thresholds based on data lo...

Adding elements to the beginning of a multidimensional array and pushing the other elements to the next row PHP -

i'm trying add elements multidimensional array, want push other elements next row when that, right i'm able have them on same row. please take look: $array[0][0] = "one"; $array[0][1] = "two"; $array[1][0] = "three"; $array[1][1] = "four"; et($array); <--- function echo array in table format output: |one |two | |three |four| adding element beginning of array, , echoing out: array_unshift($array[0] , 'zero'); et($array); output: |zero |one |two| |three |four| | the output i'm trying get: |zero | | |one |two | |three|four| is there way element added first row, , push other elements second row in multidimensional array? if there is, please let me know. thank you. you need prepend new array onto existing array: array_unshift($array, array('zero')); or depending on et() function expects: array_unshift($array, array('zero', '')); or maybe need ...

html - Angular fire ng-click on row but not on href -

i've made page bootstrap, , have action when user clicks on row. easy, put ng-click on div row. however, inside row elements i've link, , avoid firing of ng-click when user clicks on link (in case should open url of link) this picture of row. bascially if use clicks anywhere except link simbol should filre ng-click, if clicks on link simbol should open url. is possible? ps: tried put ng-click on each item except href element, href element inside column within other things, , if don't put ng-click on column not fire if use clicks on empty space of column. <div class="col-sm-8" > <a href="{{club.url}}" ><i class="fa fa-link"></i></a> | <span class="h5 small">{{club.description}}</span> </div> $event.stoppropagation() on ng-click of anchor tag bubble event. markup <div class="col-sm-8" ng-click="mymethod()"> <a href=...

python - Django how are filter parameter names named? -

i'm following django tutorial here https://docs.djangoproject.com/en/1.8/intro/tutorial01/ . i've come across filter , get functions. i'm confused why valid: question.objects.get(pub_date__year=current_year) i understand defined pub_date in question model, how did pub_date__year created? basically, filter (and other django , python functions) can take number of arbitrarily named keyword arguments, or kwargs, , django parses these kwargs pass. django defines functionality in models.queryset object . might interested in queryset source code . see django documentation here , , referenced python documentation on functionality here .

html - Generating arcs with SVG paths -

using following, perfect semi circle specified start , end points; <path d="m100,100 l100,200 a50,50 0 1, 1 100,100 " stroke="black" stroke-width="2" fill="none" /> if circle complete, have x , y radius 50 (as specified first argument of part of path) centred on arc start point 100,200 , end point 100,100. if update path following; <path d="m100,100 l100,150 a50,50 0 1, 1 100,100 " stroke="black" stroke-width="2" fill="none" /> i see circle 'spill' out left of line. assumption: because distance between start , end point of arc less required 100px (diameter), centre point of circle calculated away line drawn between start , end of arc, , further equidistant these 2 points. therefore specified 50 radius acting minimum radius , not 'scaled down' if distance between start , end point less 2 * radius. if upd...

xamarin.android - Xamarin Tesseract OCR binding for Android -

i use tesseract ocr xamarin.android , xamarin.ios applications. found binding ios ( https://github.com/jherby2k/xamarin-tesseract-ocr-ios-unified ). is there equivalent android ? yes, there tesseract android implementation. can find here . you'll have build , create android bindings yourself. edit i created xamarin android binding based on project. can find here . there test project, don't forget need tesseract testdata copied on device.

php - mysql query inside foreach loop fails, why? -

can tell me why doesn't work? if try loop end '0'. $lines=file('test.txt'); foreach ($lines $value) { $query="select sum(dailyunitssold) dus, sum(dailygrosssales) dgs, count(*) cnt mydatatable category '%$value%'"; $joejoe=@mysql_query($query) or die (mysql_error()); $row = mysql_fetch_assoc($joejoe); echo $row['dus'].'<br />'.$row['dgs'].'<br />'.$row['cnt'].'<br />'; } i'm trying pull sold totals single table based on each product's category. example, total sales blue widget category, total sales green widget category, purple widget category, etc. problem category field has multiple entries in each field, 1 product row might have 3 or 4 categories, hence bit. thanks thoughts here. what if run this: $lines=file('test.txt'); foreach ($lines $value){ $query="select sum(dailyunitssold) dus, sum(dailygrosssales) dgs, count(*) cnt myda...

robotframework - Python module does not work as expected, if used as custom keyword in Robot Framework -

if call pathon function console, dates calculated expected: def get_nearest_date(day, month): """gets nearest date in future provided day , month.""" today = date.today() res = "" if (today.month < month): res = str(day) + "." + str(month) + "." + str(today.year) elif ((today.month == month) & (today.day < day)): res = str(day) + "." + str(month) + "." + str(today.year) else: res = str(day) + "." + str(month) + "." + str((today.year + 1)) return res for example: print get_nearest_date(1, 1) print get_nearest_date(1, 12) returns 1.1.2016 1.12.2015 but if use function custom keyword in robot framework testcase this bla ${d} = nearest date 1 1 log console ${d} ${d} = nearest date 1 12 log console ${d} it prints bla ...

mvvm - Using Blend InvokeCommandAction on button in WPF -

i learning wpf using mvvm pattern. trying use invokecommandaction behavior on button. in blend, placed button on view. dragged invokecommandaction onto button. blend displays properties tab. trigger set "click". set command closecommand : (icomamnd) in view using "create data binding" dialog. this generates following xaml <button x:name="closeapp" content="close" > <i:interaction.triggers> <i:eventtrigger eventname="click"> <i:invokecommandaction command="{binding closecommand}"/> </i:eventtrigger> </i:interaction.triggers> </button> closecommand relaycommand : icommand msdn. project compiles, when click on button, command not execute. ideas, or sample code point me to.

javascript - How to securely pass data from php forms to html -

i have login system html form , need send username , password php backend can there securely encrypt , store in database. wondering date , secure method of doing is. bearing in mind barebones string form of password important vigilant of secure way of passing back. know $_get , $_post extremely unsecure. encrypt data in javascript before sent server hence javascript hashing algorithm being laid bare end user or https encryption sufficient? if have https encryption pass using $_get , $_post? thanks google , read relevant information such this . do not hash on client. pass clear-text password server. use post keep password out of url (urls have nasty way of getting logged , otherwise exposed people). i recommend use https everywhere minimum use https login form , pages follow login. store password in database using php's password_hash function , verify using password_verify .

apache - Unable to locate WAMP servrer via localhost -

i have problem wamp server vith apache v.2.4.9. after complete reinstall of win7 wamp server unable reach via localhost or 127.0.0.1, shows error not found - requested url / not found on server. (and interesting) possible phpmyadmin via http://localhost/phpmyadmin normally. i tried stuff found - juggling httpd.conf rights, virtuals, on c:\windows\system32\drivers\etc checked line 127.0.0.1 localhost , have no such program skype or other server witch potencional blocker of port 80. only thing helps set in httpd.conf listening on port 8080, can root page (not sub directories) , it's unable reach database. i'm stuck developig home, if have suggestion, please write me. thanks! this because browser using ipv6 , ipv4 @ other times. not sure controls why browser uses ipv4 or ipv6 if have ipv6 activated ( , w7 ) seems make arbitrary decisions , can use either or both. so need add ipv6 loopback address hosts file. change hosts file c:\windows\system32\drivers\etc...

mpi - Resolve this function without recursion in order to use parallelism -

i'm trying optimize process calculate possible combinations of players form partitions. understand problem, use following example. for exampe have set of players n = {1,2,3,4,5} , players regrouped {1,2},{3,4},{5} . means player 1 play player 2 single player, , one. each group of players has set of strategies or choices. each player chooses group wants belong, example: group {1,2} has these possibilities {{1,2};{1,2,3,4}} ; i.e players {1,2} either choose stay or join group {3,4} . same explanation rest of players: {3,4}=>{{3,4};{3,4,5};{1,2,3,4}} {5}=>{{5};{3,4,5}} now, group of players choosing same strategy form new group (coalition). example, group {1,2} chose strategy {1,2,3,4} i.e. players {1,2} want form new group players {3,4} . players {3,4} choose strategy {3,4,5} , player {5} choose strategy {3,4,5} . players choose same strategy grouped form final partition of players this: {1,2},{3,4,5} ; players {3,4,5} have chosen same strategy, grouped toget...

asp.net web api - What's the equivalent of CastleWindsor's container.Release in LightInject? -

i saw asp.net web api dependency injection in seemann's site. uses castlewindsor though. request.registerfordispose( new release( () => this.container.release(controller))); what's equivalent of castlewindsor's container.release in lightinject? http://blog.ploeh.dk/2012/10/03/dependencyinjectioninasp.netwebapiwithcastlewindsor/ there not release method in lightinject. disposable services registered either perscopelifetime og perrequestlifetime. these services disposed when surrounding scope disposed. container.register<ifoo, disposablefoo>(new perscopelifetime()) using(container.beginscope()) { var foo = container.getinstance<ifoo>() } -- foo disposed here lightinject.webapi provides integration web api takes care of disposing controllers when web request ends.

javascript - How can I handle overflow on nav items? -

let's i'm making web page, , have bunch of nav items, this: home contact something-else and based on browser width, i'd have items can't fit put in dropdown, this: closed: home contact ... open: home contact ... --------^------------- | | | something-else | | | ---------------------- is there easy way of doing that? you js: window.onresize = function(event) { //get window width var winwidth = window.width; var navitemswidth = 0; //you'll use in minute... var extranavitems = []; //you'll use in minute... //then iterate through each nav var navitems = document.getelementsbyclassname('navitem'); (var = 0; < navitems.length; i++) { //check width of each item , compare win width navitemswidth += navitems[i].innerwidth; //if width greater screen width... if(navitemswidth > winwidth) { ...

c# - Add Items metroTabControl -

can tell me how add items/controls metrotabcontrol (windows forms)? whenever try visual studio 2013 designer, throws error: cannot add 'metrolabel' tabcontrol. tabpages can directly added tabcontrols the .net tabcontrol has pretty fancy designer, did not provide substitute it. understandably, creating designers lot of work , designer code quite obscure. select metrotabcontrol added, note little black triangle that's displayed on upper-right. click , select add tab . can drop label on added tab page.

What is this objective-c syntax -

this question has answer here: what ^ mean in objective c ios? [duplicate] 3 answers what caret (^) here , doing ? - (nsuinteger)hash { return [self.name hash] ^ [self.birthday hash]; } it's bitwise exclusive or. it's not objective-c, it's plain old c. compares bits of both items give , returns value 1s bits 1 in 1 of items not other. if have 2 numbers: 5 (00000101) 11 (00001011) the bitwise exclusive or yield result: 14 (00001110)

exception - What is the best way to check that passed parameters are valid in Python? -

this question has answer here: is pythonic check function argument types? 5 answers i've spent past year working in java, used assert ensure parameters passed method fulfilled preconditions. i'd same in python, read here exceptions better use assert. this have currently: if type(x) == list: x = np.array(x) else: err = ("object passed x not numpy.ndarray or list") assert type(x) np.ndarray, err err = ("object passed n not integer") assert type(n) inttype, err err = ("the size of object passed x not equal " "n squared") assert x.size n**2, err is there more elegant and/or pythonic way approach this? should writing own exception class raise when invalid parameters passed? don't limit yourself you astounded many functions, classes etc. produce useful output input more diverse in typ...

python - Inserting multiple QCheckBox into QTableWidget odd rows -

i'm trying create table 160 rows, , inserting qcheckbox every odd number of rows, on column 10. problem is, have create 80 qcheckbox (one each row, can separately assigned user)... creating 1 one 80 qcheckbox objects 9 projects have nonsense! is there way of doing loop? can't think of anything, searched answer , found nothing. [...] # importing pyside pyside import qtgui, qtcore [...] # creating table class table(qtgui.qdialog): def __init__(self, parent=none): super(table, self).__init__(parent) self.table = qtgui.qtablewidget() self.table.setrowcount(160) self.table.setcolumncount(10) # tricky part: chkboxitem = qtgui.qtablewidgetitem() chkboxitem.setflags(qtcore.qt.itemisusercheckable|qtcore.qt.itemisenabled) chkboxitem.setcheckstate(qtcore.qt.unchecked) chkboxitem2 = qtgui.qtablewidgetitem() chkboxitem2.setflags(qtcore.qt.itemisusercheckable|qtcore.qt.itemisenabled) chkboxitem2.se...

node.js - How to register a Handlebars partial outside partials folder on Sails.js? -

i have following folder structure on sails.js application: assets/ mymodule/ views/ partials/ mymodule backbone component (although client not full backbone application) there's given handlebar partial x.handlebars need rendered both via server , client sides. my struggle starts when views/ not accessible on client side there's no way load on backbone module. then have tried move assets/mymodule/templates/ accessible main template views/layout.handlebars can't load partial if try like: {{> ../assets/mymodule/templates/x}} which doesn't work (i assume handlebars use views/ root level layouts). there's 2 possible solutions i'm seeing in situation: duplicate these layouts , use 1 on each location (not ideal, works) place on assets/mymodules/templates/x , register handlebars partial on sails let available server-side rendering. how second solution? possible register global partial same way can helpers function under config...

excel - Move sequentially through a date range -

so i'm in bit of jam. want grab bunch of data using sql , list on excel chart. however, need list date, so: date | data 2015-05-19 | 62 2015-05-20 | 30 2015-05-21 | 78 getting data easy enough, need move through date range (2015-05-19 2015-05-21, example), listing every date have , sorting data based on dates. if have date range above, need sequentially move through each date in range, , list current value on excel sheet. anyone know how this? sorry if it's not explained, i'm not having easy time wrapping head around it. this using adodb , access database may have alter things fit needs. it's in sheet1 module. sub test() dim cnn adodb.connection dim rs adodb.recordset set cnn = getconnection() 'however create connection set rs = cnn.execute("select yourdate, yourdata yourtable yourdate > #5/19/2015# , yourdate < #5/21/2015# order yourdate") me.range("a2").copyfromrecordset rs...

sql server - SQL Filter Out Specific Month, Day, and Time for Any Year -

microsoft dynamics nav uses datetime of yyyy-12-31 23:59:59.000 identify yearly closing entries. trying write report bring of entries, except these. query works fine 2014 if explicitly use where clause of where [posting date] <> '2014-12-31 23:59:59.000') but need query work year. tried: where (datepart(mm, [posting date]) <> 12) , (datepart(dd, [posting date]) <> 31) , (datepart(hh, [posting date]) <> 23) , (datepart(mi, [posting date]) <> 59) , (datepart(ss, [posting date]) <> 59) but filtered out in december or had day of 31 or hour of 23 , etc... is there simple way filter given datetime, year? may this: where month([posting date]) <> 12 or day([posting date]) <> 31 or cast([posting date] time) <> cast('23:59:59.000' time) even more short answer: where year([posting date]) <> year(dateadd(ss, 1, [posting date]))

php - Laravel 5 Entrust one route - load different controller based on Role -

so i'm starting learn laravel , i've implemented entrust role permission package, works well. question is, i'd have 'dashboard' page so: example.com/dashboard. the thing is, i'm not sure how set up. since in app\http\controllers folder made subfolders admin , user, both have dashboardcontroller since want show different data either type of user. how can declare route point dashboard , check role authenticated user has, loads correct controller? have namespaces? haven't found answer yet trying more clear, don't want have this: example.com/dashboard/admin , example.com/dashboard/user, rather 1 url example.com/dashboard , check role user has. i'm sorry if answer obvious, stuff new me , haven't found answer yet. something should work you. routes.php route::get('/dashboard', ['as'=>'dashboard', 'uses'=> 'dashboardcontroller@dashboard']); dashboardcontroller.php use app\http\req...

javascript - Passing props from grandchildren to parent -

i have following react.js application structure: <app /> <breadcrumblist> <breadcrumbitem /> <breadcrumblist/> <app /> the problem is, when click on <breadcrumbitem /> , want change state in <app /> i used callback pass props <breadcrumblist/> that`s how far got. there pattaren how pass props compenent tree ? how can pass prop <app /> , without doing callback chaining ? if doing simple better pass change in state through component hierarchy rather create store purpose (whatever may be). following: breadcrumbitem var react = require('react/addons'); var breadcrumbitem = react.createclass({ embiggenmenu: function() { this.props.embiggentoggle(); }, render: function() { return ( <div id="embiggen-sidemenu" onclick={this.embiggenmenu} /> ); } }); module.exports = breadcrumbitem ; then pass parent through breadcrumblist component..... <breadcru...

javascript - Ajax function not receiving response from server -

essentially working uploader ( dropzone.js ) , incorporating website. adding files server works fine, having trouble deleting them. javascript: $(document).ready(function () { dropzone.autodiscover = true; $("#dzupload").dropzone({ url: "uploadhandler.ashx", addremovelinks: true, success: function (file, response) { file.previewelement.classlist.add("dz-success"); console.log("successfully uploaded: " + file.name); }, error: function (file, response) { file.previewelement.classlist.add("dz-error"); }, init: function () { var dzupload = this; this.on("removedfile", function (file) { $.ajax({ type: "post", url: "uploadhandler.ashx/deletefile", data: { filename: file.name }, datatype: ...

c# - PrincipalContext and error Value was invalid -

i have wcf service code: var ctx = new principalcontext(islocalmachine(strdomain) ? contexttype.machine : contexttype.domain); principal principal = principal.findbyidentity(ctx, name) i have 3 different test environments: 1: iis 8.5 .net v4.5 application pool, win 8.1, strdomain = "testdomen1" name = "testdomen1\testuser" - environment not have errors. 2: iis 7.5 .net v4.5 application pool, win server 2008 r2, strdomain = "testdomen1", name = "testdomen1\testuser" - - environment not have errors. 3: iis 8.5 .net v4.5 application pool, win 8, strdomain = "testdomen2" name = "testdomen2\testuser2" - environment has errors. on line principal principal = principal.findbyidentity(ctx, name) argument exception value invalid. parameter name: sddlform stacktrace @ system.security.principal.securityidentifier..ctor(string sddlform) if use debug>breakpoint line , "add watch" or "quick wa...

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo...

html - php - imap_fetchstructure - get exact object position in array -

i printing out structure $structure = imap_fetchstructure($imap, $email_number); print_r($structure); i need inside array , [disposition] tag of inline attachment. i trying out using: $inline_attachment = $structure[1]->disposition; if($inline_attachment == inline){ echo "inline attachment found!!"; } stdclass object ( [type] => 1 [encoding] => 0 [ifsubtype] => 1 [subtype] => related [ifdescription] => 0 [ifid] => 0 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => array ( [0] => stdclass object ( [attribute] => boundary [value] => 047d7b624dd8b40cbc05172d65ae ) ) [parts] => array ( [0] => stdclass object ( [type] => 1 ...