Posts

Showing posts from May, 2015

forms - Ajax call back: Return variable as input value -

after ajax call need echo out variable value of hidden field. html <form ajax1> <input name="place" value="milan"> <input name=submit onclick="return submitform1()"> </form> <form ajax2> <input type="hidden" value="$place"> <input name="filter"> <input name=submit onclick="return submitform2()"> </form> <div id="result"></div> ajax call function submitform1() { var form1 = document.myform1; var datastring1 = $(form2).serialize(); $.ajax({ type:'get', url:'query.php', cache: false, data: datastring1, success: function(data){ $('#results').html(data); } }); return false; } php <? $place= $_get['place'] //do stuffs ?> it works perfectly, need add function echo out $place in value=" " of form ajax2 any appreciated

html - How to keep a link tag a different color when on that page? -

i want tag of page on in different color rest of links. example: my links white, on hover change red underline. want page on red underline. how can this? create separate style active tabs. give tab active specific style (via class or id in css)

python - Counting unique values in a pandas grouped object -

i have table in pandas/python , doing following: grouped_data = df_comments_cols['article_id'].groupby(df_comments_cols['user_id']) now count number of articles per user following: ct_grouped_data = grouped_data.count() the above counts number of article ids per user. however, there multiple of same article ids per user (in sense user has interacted article more once) , wish count unique article ids per user - there quick way this? thanks in advance. i think might looking nunique , can call on groupby objects so: in [63]: df = dataframe({'a': randn(1000, 1)}) in [64]: df['user_id'] = randint(100, 1000, size=len(df)) in [65]: df['article_id'] = randint(100, size=len(df)) in [66]: gb = df.article_id.groupby(df.user_id) in [67]: gb.nunique() out[67]: user_id 100 2 101 1 102 1 104 2 105 1 106 2 107 1 110 1 111 4 112 2 113 1 114 2

c# - Initializing a List into a static method -

i have 6 operators trying push operator class. need initialise list of new operators can used effectively. i've got myself in quite mess , having fair few syntax problems, appreciated in creating list. public static list<comparisonoperator> createcomparisonoperators() { this.condition1select.items.clear(); this.condition2select.items.clear(); this.condition3select.items.clear(); this.condition4select.items.clear(); foreach (comparisonoperator op in ops) { this.condition1select.items.add(op); this.condition2select.items.add(op); this.condition3select.items.add(op); this.condition4select.items.add(op); } return new list<comparisonoperator>(); } the this statement means refer current instance. static methods don't have instance , can't use this statement. need make list static, too. comparisonoperator enumeration ops needs

c# - Error handling of user input in a List<int> -

i have following code: list<int> moneys = new list<int>(); console.writeline("please enter cost of choice"); int money = int.parse(console.readline()); moneys.add(money); from if enter text program stops working , unhandled exception message appears. wondering how handle exception, if possible program doesn't stop working? you should use tryparse method. not throw exception if input not valid. this int money; if(int.tryparse(console.readline(), out money)) moneys.add(money);

sql - Conditional querying to return timestamp if NOT todays date , else return time -

i have sql query want retrieve timestamp records table. the query must return time without time zone if todays date = timestamp in record. if record's timestamp::date not equals todays date return timestamp. examples: 2013-08-07 18:00:18.692+01 2013-08-09 20:13:09.927+01 expected result: 18:00:18.692 2013-08-09 20:13:09.927+01 from 2 timestamps able retrieve time 1st todays date retrieve both date , time second not todays date this formatting issue, might better handle in application code. can in sql. create table t ( ts timestamp not null ); insert t values ('2013-01-01 08:00'); insert t values (current_timestamp); the time , timestamp data types aren't compatible in way want return them, casting text makes sense. select case when ts::date = current_date ts::time::text else ts::text end t; ts -- 2013-01-01 08:00:00 16:34:52.339

java - Complex query in Morphia -

in method java, pass parameter collection mongodb complex query one: {"$or": [{"$and": [{"contextid": "akka"}, {"messageid": "pippo"}]}, {"$and": [{"domain": "niguarda"}, {"hostname": {"$ne": "hostserver"}}]} ] } the string contains query variable , passed parameter in query string. i tried pass query parameter method criteria (querydb.criteria(" {"$or": [ {"$and": [{"contextid": "akka"}, {"messageid": "pippo"}]}, {"$and": [{"domain": "niguarda"}, {"hostname": {"$ne": "hostserver"}}]}] }" ) but not work. any suggestions? what you're trying query q = dao.createquery(); q.or( q.and(new criteria[]{ dao.createquery().filter("contextid").equal("akka"),

javascript - HTML5 video source will not successfully change in IE -

i'm going nuts on problem. have script changes sources of <video> tag, reloads , plays it. problem can't work on version of internet explorer. i have array of video sources called sequence.sources , containing: sequence.sources = ['video.webm', 'video.mp4', 'video.ogv']; the sequences object loaded array, that's dynamic aspect of all. function use change video sources follows: var videoelem = document.getelementbyid('video'); // remove sources while (videoelem.firstchild) { videoelem.removechild(video.firstchild); } // add new sources (var = 0; < sequence.sources.length; i++) { var srcelem = document.createelement('source'); srcelem.setattribute('src', sequence.sources[i]); videoelem.appendchild(srcelem); } // initiate video videoelem.load(); videoelem.play(); this works on browsers ie. do? i've tried modifying src attribute of <video> tag directly, doesn't seem work. i&

java - SWTException in SWTBot-Test: Why is it thrown in Tycho+Surefire? -

i swtexception:invalid thread access of swtbot-test. turn green when started eclipse, problem must inside pom.xml guess. how solve this? i use following arguments , dependencies in pom.xml of test-fragment: <!-- language: lang-xml --> <build> <plugins> <plugin> <groupid>org.eclipse.tycho</groupid> <artifactid>tycho-surefire-plugin</artifactid> <version>${tycho.version}</version> <configuration> <testfailureignore>true</testfailureignore> <failifnotests>false</failifnotests> <forkedprocesstimeoutinseconds>300</forkedprocesstimeoutinseconds> <useuiharness>true</useuiharness> <useuithread>false</useuithread> <showeclipselog>true</showeclipselog> <dependencies> <dependency> <type>eclipse-plugin</type> <artifactid>my.host.ui.bundle</artifactid>

css - Vertical centring image with display table-cell not working -

im trying vertically centre image using css display table-cell. why code not working? looks should according css-tricks.css http://css-tricks.com/centering-in-the-unknown/ http://jsfiddle.net/sne4y/1/ .cont { background-color: grey; position: fixed; height: 100%; width: 100%; display: table; } img { display: table-cell; vertical-align: middle; } <div class="cont"> <img src="http://www.quarktet.com/icon-small.jpg" /> </div> the img tag doesn't need display: table-cell; , vertical-align: middle; parent does. so need: .cont { background-color: grey; position: fixed; height: 100%; width: 100%; display: table-cell; vertical-align: middle; } img { } <div class="cont"> <img src="http://www.quarktet.com/icon-small.jpg" /> </div> also, appears position: fixed giving problems, well, , had remove work here: http://jsfiddle.net

spam - How do we 'whitelist' our website for Facebook? -

how 'whitelist' our website - when people click on link our website (www.ineed.co.uk) comes 'facebook thinks site unsafe ...' if debug site can see : inferred property 'og:url' property should explicitly provided, if value can inferred other tags. inferred property 'og:title' property should explicitly provided, if value can inferred other tags. inferred property 'og:description' property should explicitly provided, if value can inferred other tags. inferred property 'og:image' property should explicitly provided, if value can inferred other tags. fix tags in head of website , d fine.

asp.net - Why does asp:Textbox sometimes add "text" to the CSS class in the rendered html? -

this markup: <asp:textbox id="txtaddress" cssclass="s175" runat="server" maxlength="30" placeholder="street"></asp:textbox> is rendered as: <input name="ctl00$leftcolumncontent$txtaddress" type="text" maxlength="30" id="leftcolumncontent_txtaddress" class="s175 text" placeholder="street"> but on project, markup: (exactly same) <asp:textbox id="txtaddress" cssclass="s175" runat="server" maxlength="30" placeholder="street"></asp:textbox> causes happen: <input name="ctl00$contentplaceholder1$txtaddress" type="text" maxlength="30" id="contentplaceholder1_txtaddress" class="s175" placeholder="street"> why "text" class not getting applied? it's class="s175" vs class="s175 text" .

c# - Call method every time a controller method is ending -

i have static class called notificationmanager , every time controller method called, want store modelerrors in notificationmanager. however, inside notificationmanager, can't access modelstate because not inside actual controller. is there way automatically call method once controller method finished, without having write in every single controller method? note: need use values in view. override onactionexecuted in controller. still have viewdata[] protected override void onactionexecuted(actionexecutedcontext filtercontext) { //do stuff base.onactionexecuted(filtercontext); }

performance - Is doing this: var[property] more resource intensive than var.property? -

i'm refactor long algorithm can adapted property instead of fixed one. so, instead of having var.x have var[property], property can x, y, alpha, etc. but, question appeared, performance wise, present impact?. thanks! in relative terms yes it's slower, whether matters depends on deep specifics of application , usage patterns.

php - Directory index forbidden by Options directive error in Cakephp -

getting directory index forbidden options directive error when trying upload images not getting every time, not know exact senario, have check error_logs of apache. .htaccess in webroot `<ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule>` i fixed using +indexes in < directory > don't know why i'm getting error images only, of ~700 kb , ~1500 x 1700 in size.

r - Behavior of do.call() in the presence of arguments without defaults -

this question follow-up previous answer raised puzzle. reproducible example previous answer: models <- list( lm(runif(10)~rnorm(10)),lm(runif(10)~rnorm(10)),lm(runif(10)~rnorm(10)) ) lm1 <- lm(runif(10)~rnorm(10)) library(functional) # works do.call( curry(anova, object=lm1), models ) # do.call( anova, models ) the question why do.call(anova, models) work fine, @roland points out? the signature anova anova(object, ...) anova calls usemethod , should* call anova.lm should call anova.lmlist , first line objects <- list(object, ...) , object doesn't exist in formulation. the thing can surmise do.call might not fill in ellipses fills in arguments without defaults , leaves ellipsis catch? if so, documented, it's new me! * clue--how usemethod know call anova.lm if first argument unspecified? there's no anova.list method or anova.default or similar... in regular function call ... captures arguments position, partial match , full mat

java - NullPointerException when using GMapsV2Direction class -

i've been trying fix run-time error last few days no avail, not sure why it's throwing nullpointerexception when creates nodelist when getdirection method called. i'm new android programming if can offer me little guidance appreciated, thank you! edit: judging debugger latlng co-ordinates , direction type being passed through getdocument() method, document isn't being returned getdocument() method. public document getdocument(latlng start, latlng end, string mode) { string url = "http://maps.googleapis.com/maps/api/directions/xml?" + "origin=" + start.latitude + "," + start.longitude + "&destination=" + end.latitude + "," + end.longitude + "&sensor=false&units=metric&mode=driving"; try { httpclient httpclient = new defaulthttpclient(); httpcontext localcontext = new basichttpcontext(); httppost httppost = new httppo

javascript - Covert JS object into flat array with parent names -

i have object this: data: { connection: { type: 0, connected: false }, acceleration: { x: 0, y: 0, z: 0, watchid: 0, haserror: false } }, converting flat array this: "connected": false "haserror": false "type": 0 "watchid": 0 "x": 0 "y": 0 "z": 0 is easy task (recurrence friend!). but there way in javascript called full parents , i.e. this: "connection.connected": false "acceleration.haserror": false "connection.type": 0 "acceleration.watchid": 0 "acceleration.x": 0 "acceleration.y": 0 "acceleration.z": 0 or expecting much? another variant: function flatten(o) { var prefix = arguments[1] || "", out = arguments[2] || {}, name; (name in o) { if (o.hasownproperty(name)) { typeof o[name] === "object" ?

c - recvfrom not receiving depending on ai_family used -

i'm trying head around socket programming , have encountered unexpected (for me) behaviour. when try send data "localhost" , set addrinfo.ai_family af_inet message send isn't coming through client process host process (recvfrom() doesn't return). if set af_inet6 fine. same af_unspec in case picks ipv6 addrinfo (first in list). both host , client use same ai_family of course. i've tried code copy pasted beej's guide network programming had same result. i'm using dgram sockets. i tried connecting different pc got opposite results, ipv4 worked fine, ipv6 did not. gather may due me using '6to4 gateway'. have no idea means. the problem related own machine code work on ipv4 on machine tested on. can't if it's sending or receiving problem. what prevent me sending or receiving data to/from localhost using af_inet sockets? i'm on windows7 64bit machine compiling mingw. if makes difference i'm running same program host ,

How to create a trigger in SQL Server that fires only right before the transaction will be committed -

so ran issue goes follows: - have table a. - have table b has foreign key table a. - have trigger on table ensures every item in table has @ least 1 row in table b pointing (through foreign key). - trigger runs "insert" commands. issue when insert table a, trigger raises error because table b doesn't have row foreign key new row in table yet. row on table b inserted end of transaction trigger not give me chance. solution problem? there way tell trigger run after last command in transaction executed? if need trigger fire on table a, not know if there corresponding rows in table b, should use "instead of" trigger. allow check table b before inserting rows table a. if there match in table b, proceed insert a, otherwise, add row b , a, or skip data doesnt match , return error application. http://msdn.microsoft.com/en-us/library/ms175521(v=sql.105).aspx

c++ - std::bad_alloc assigning a pointer from address of a reference -

for whatever reason, ended code looked this typedef std::vector<double> vector; void f(vector const& v) { vector const* p; p = &v; } this throws bad_alloc exception @ point of assignment. why? matter f called on non-cast vector? c++03 compiled on gcc 4.1. ** edit ** inside code running inside google mock see exception. tried tear code out , compile separately , worked fine. looking further ** further edit ** problem assignment happened in last line of constructor of object member of object. next object in initializer list of parent object exception coming from, gdb made happening on last line of previous object's constructor assignment taking place. downvotes remind me how misguided question was. there no possible way code can raise std::bad_alloc exception (or other exception, matter), since doing assigning pointer value pointer variable. std::bad_alloc raised new , new[] operators when memory allocation fails, , there no such memory al

mysql - How can I Update column value to Old value plus New value from other table using Trigger? -

how can update column value old value plus new value other table using trigger if value has have entry? wanted following. notice bold , italicized part. delimiter$$ create trigger trigger_name after insert on table_one each row begin insert table_two(clmn_id, clmn_one) values(new.clmn_id_fk,new.clmn_a) on duplicate key update clmn_one = values( clmn_one + new.clmn_a ); end$$ delimiter; try removing keyword values on duplicate key: delimiter$$ create trigger trigger_name after insert on table_one each row begin insert table_two(clmn_id, clmn_one) values(new.clmn_id_fk,new.clmn_a) on duplicate key update fine_amount = clmn_one + new.clmn_a; end$$ delimiter;

Binary search in an ordered list in java -

im looking way implement code in java works same way binary search in ordered arraylist ordered list thanks the algorithm should same both arraylist , list , given both ordered.

Tornado + SQLAlchemy non-blocking DB calls -

i'm relatively new application development here goes nothing. i've been working on project employs use of tornado server , sqlalchemy's orm database management/access (using postgres in end). at outset of project hadn't considered possibility using sqlalchemy prevent me taking advantage of tornado's async features (since sqlalchemy's database calls apparently 'block' thread). do have suggestions how implement async-compatible setup tornado+sqla+postgres? take @ aiopg - https://github.com/aio-libs/aiopg it python 3.4 asyncio adapter postgres includes sqlalchemy support. haven't tried myself yet, found while looking async libraries postgres , tornado. using momoko, supplies raw psycopg2 layer. remember latest version of tornado supports asyncio, asyncio libraries work tornado.

cocoa touch - How do you change button text dynamically when button is subview of a custom cell in iOS? -

i making ios app , has table view prototype cells. configure cells in cellforrowatindexpath method , works fine, come trouble when want change text in button after created. want changes button text when tap button. tried do: [button settitle:@"change" forstate:uicontrolstatenormal]; inside of clickmethod runs when click the button, changes text in last cell no matter button press. tried above doesn't work because have multiple instances of same button.(one in every row) know how can change text of button click on only. code creates button: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath: (nsindexpath *)indexpath { cell = [tableview dequeuereusablecellwithidentifier:@"cell" forindexpath:indexpath]; //configure cell button = [uibutton buttonwithtype:uibuttontyperoundedrect]; [button addtarget:self action:@selector(clickmethod:) forcontrolevents:uicontroleventtouchupinside]; [button settitle:@"button" forstate:u

BasicHttpBinding Error - Xamarin -

problem not calling wcf function using basichttpbinding , showing error. no host route error comes on visual studio. unhandled exception: system.net.webexception: error: connectfailure (no route host) using system; using system.collections.generic; using system.linq; using monotouch.foundation; using monotouch.uikit; using helloworld_app4.localhost; namespace helloworld_app4 { public class application { // main entry point of application. static void main(string[] args) { // if want use different application delegate class "appdelegate" // can specify here. localhost.service1 obj = new localhost.service1(); obj.getdata(32, true); uiapplication.main(args, null, "appdelegate"); } } } what license have got? if have indie license wont allowed access web/wcf services , have rely on rest services. i found out hard way switched ot using asp.net web

verilog - What division algorithm should be used for dividing small integers in hardware? -

i need multiply integer ranging 0-1023 1023 , divide result number ranging 1-1023 in hardware (verilog/fpga implementation). multiplication straight forward since can away shifting 10 bits (and if needed i'll subtract 1023). division little interesting though. area/power arent't critical me (i'm in fpga resources there). latency (within reason) isn't big deal long can pipeline deisgn. there several choices different trade offs, i'm wondering if there's "obvious" or "no brainer" algorithm situation this. given limited range of operands , abundance of resources have (bram etc) i'm wondering if there isn't obvious do. if can work fixed point precision rather integers may possible change : divide result number ranging 1-1023 to multiplication number ranging 1 - 1/1023, ie pre-compute divide , store coefficient multiply.

java - JAXB enoding issue when marshalling to System.out -

Image
i'm trying print console java bean, unmarshalled http response. have issues encoding. here's part of response: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <response> <errormsg>Ä°ÅŸleminizi ...</errormsg> </response> my method is: public void printtoconsole() { try { jaxbcontext context = jaxbcontext.newinstance(response.class); marshaller marshaller = context.createmarshaller(); marshaller.setproperty(marshaller.jaxb_formatted_output, boolean.true); marshaller.setproperty(marshaller.jaxb_encoding, "utf-8"); marshaller.marshal(this, system.out); } catch (jaxbexception e) { e.printstacktrace(); } } by viewing bean values debugger, they're shown correctly in debugger's pop-up(eclipse ide) thanks the problem using default console settings, not able print utf-8 characters properly. make sure co

uitableview - iOS neither init or initWithCoder are been called -

i add tableview viewcontroller , need initialize properties. neither -(id)init or - (id)initwithcoder:(nscoder*)adecoder been called. my header file: @interface myviewcontroller : uiviewcontroller <uitableviewdelegate,uitableviewdatasource> any of knows why or how can either init methods call? i appreciate help the uiviewcontroller reference states initwithnibname:bundle: designated initializer. that's 1 should override if you're doing stuff during initialization. update: right, pointed out simon, override initwithcoder: if you're using storyboard (though assume op not, said initwithcoder: not getting called).

ruby on rails - Heroku errors [was working yesterday] -

i keep getting these error's in heroku logs every time i've tried deploy today. app working fine last night, i'm not sure what's changed since since haven't done new. song_controller.rb class songscontroller < applicationcontroller before_filter :authenticate_user!, only: [:create ,:edit, :update, :destroy, :vote_for_song] before_action :set_song, only: [:show, :edit, :update, :destroy, :vote_for_song] def extract_video @song = song.find(params[:id]) @song.youtubeaddy.extract_video_id end def vote_for @song = song.find(params[:id]) current_user.vote_for(@song) @song.plusminus = @song.votes_for @song.save respond_to |format| format.js { render 'update_votes' } end end def vote_against @song = song.find(params[:id]) current_user.vote_against(@song) respond_to |format| format.js { render 'update_votes' } end end def new_songs @songs = song.order(

Memcached php add vs set performance -

new php memcahed library in php. wondering major difference between memcached::add , memcached::set are? both have same performance on head , advantage of using 1 on other? another thing these methods (::set , ::add) feature sort of safe addition? meaning, if key doesnt exist in memcache creates it, or if key exist replace it? want minimize duplicate keys. , way can create sort of safe adding replacing first checking if success, else create it. the difference documented on memcached::add : memcached::add() similar memcached::set() , operation fails if key exists on server. memcached::add() return false if key defined, meaning that's should use if want report error duplicate key. additionally, use memcached::getresultcode() check if add successful. for performance comparisons, may depend on number of memcached servers, library versions , number of factors specific application. premature optimisation, if still want compare, best bet benchmark own set-up.

javascript - Dynamicaly changing ng-pattern regex -

i want changing regex pattern same rules. example in plunker if selected type, have regular expression, model updated, if value valid. if selected type, doesn't have regular expression (e.g. 'string' in code), model never updated. doesn't matter, if function returned null or empty string . my question is, if exist way, how turn validation off? you can return .* when want allow input: $scope.getvalidatorregex = function () { switch ($scope.type) { case 'int': return /^\d+$/; default: return /.*/; } };

python - Displaying multiple instances in a ManyToManyField in Django -

Image
here's have in image: i display colored in green. display each product cost. bob cost $12010 , jill cost $12010 total price of $24020. here's code far: class purchaseorder(models.model): product = models.manytomanyfield('product', null =true) def get_products(self): return "<br> </br>".join([p.products p in self.product.all()]) get_products.allow_tags = true class product(models.model): products = models.charfield(max_length=256, null =true) price_for_each_item = models.floatfield() #here want displayed green how can this? notice each product gets new line. i'm trying each indivdual item on same line indivdual item's price. example here is, bob $12010.0 jill $12010.0 you can use string concatenation concatenate name price. if products should first part of string , price_for_each_item second part, use: def get_products(self): return "<br />".join("%s %

bash - PHP cli from different PHP.ini -

i've got php cli script need execute. however, cli version of php isn't need (the script requires php 5.3+ , cli version of php 5.2). from command line: # php /usr/bin/php # whereis php php: /bin/php.orig /bin/php /usr/bin/php.orig /usr/bin/php /sbin/php.orig /sbin/php /usr/sbin/php.orig /usr/sbin/php /etc/php.d /etc/php.ini /lib64/php /usr/lib64/php /usr/local/bin/php.orig /usr/local/bin/php /usr/include/php /usr/share/php /usr/share/man/man1/php.1.gz the host tells me can't change cli version of php can use php -c switch execute script php version. example gave was: php –c /root/php/53/etc/php.ini /example/target.php i wrote shell script wrapper command: #!/bin/bash php –c /root/php/53/etc/php.ini /example/target.php however, when execute script command line get: status: 404 not found content-type: text/html no input file specified. which makes me think gave me path apache version of php. can explain should doing here? thanks!

android - Set camera iso on Nexus 4 -

when use camparams.set("iso", (string)newvalue); in app , run on nexus 4, preview gets slow , after awhile crash because of high memory use. when use cameraparameters.set("iso", 100); preview slow when use cameraparameters.set("iso", 1600); works perfectly. it happens in other camera apps fv-5 when change iso setting. on samsung galaxy s 2 works perfectly. can do?

apache - Why does php script die at log_message? -

what cause script die on line: log_message('debug', "config class initialized"); details: this line in codeigniter system/core/config.php file , on site worked have installed new centos 6.4 virtual machine. i suspect it's apache configuration issue. you have different version of php

c# - When are the static constructors executed, before or after static fields? -

consider have public class classa { public string propertyb { get; set; } } and use this public class classd { static readonly classa propertye = new classa(); static classd() { propertye.propertyb = "valuef"; } } but rest of code didn't work expected. rewrote classd, , worked public class classd { static readonly classa propertye = new classa { propertyb = "valuef" }; } in way these 2 code samples different? expected had same behavior, don't. according msdn : if class contains static fields initializers, those initializers executed in textual order prior executing static constructor . the difference between 2 classes how propertye initialized. in first, sample, classd.propertye assigned first, classa.propertyb . in second sample, classa.propertyb assigned first, classd.propertye . could produce different results. you might have issues circular dependencies among fields. msdn art

wpf - A singleton is created when a collection-type dependency property is assigned a value -

i attempting create dependency object in wpf of type list(of) containing children of control. despite taking precautions outlined here seems singleton created when assign value property. when assign value value added multiplied number of instances of class. here code: public class period inherits listbox '-------- properties --------' private property subjects() list(of subject) return me.getvalue(subjectsproperty) end set(value list(of subject)) me.setvalue(subjectsproperty, value) end set end property private shared readonly subjectsproperty dependencyproperty = dependencyproperty.register("subjects", gettype(list(of subject)), gettype(period), new frameworkpropertymetadata(new list(of subject))) public sub new() mybase.new() me.subjects = new list(of subject) 'reason: stop adding values defult value collection. see:http://msdn.microsoft.com/en-us/library/aa970563.aspx end sub this subrouti

css3 - How do I create CSS only tabs/pages with #hash URLs? -

i'm trying create single page site uses css navigate between different content. i've read :target , understand site work in chrome, firefox, ie9+, safari, , opera 9.5+. how can implement css navigation 1 section visible @ 1 time? full demo uses this menu . layout to this, first layout document have multiple .page s, , each has unique id. <div class="page" id="home"> <h1>home</h1> <div class="body"> </div> </div> then create menu, or other structure contains links. these should have hashes match ids. example id="home" , href="#home" . <ul> <li><a href="#home">home</a></li> </ul> css you have decide how want pages transition. choose use combination of top , opacity . also note, it's highly recommended set elements initial position top of page. when click 1 of links, browser automatically make

jquery - How to stop scrollIntoView? -

i using jquery plugin jquery.scrollintoview . when click id( #back , #forward ), plug-in works properly. but, if click same id, want stop scroll event. what should use? .stop() ? .stoppropgation() ? i tried did not work... var _doc = document; var notify = function() { // ... }; $(function() { $(_doc.getelementbyid('back')).click(function(){ $(_doc.getelementbyid('top')).scrollintoview({ duration: 3000, easing: 'easeoutquint', complete: notify }); }); $(_doc.getelementbyid('forward')).click(function(){ $('p:last').scrollintoview({ duration: 3000, easing: 'easeoutquint', complete: notify }); }); }); what should do?

c# - Creating an Animation when DataGridCell's Bound Value is Updated -

all have following datagrid <datagrid x:name="resourcedatagrid" horizontalalignment="stretch" verticalalignment="stretch" autogeneratecolumns="false" gridlinesvisibility="none" rowheaderwidth="0" canuseraddrows="true" canuserdeleterows="true" itemssource="{binding path=resources, mode=twoway, updatesourcetrigger=propertychanged, isasync=true}"> <datagrid.columns> <datagridtextcolumn header="keyindex" binding="{binding keyindex}" isreadonly="true"/> <datagridtextcolumn header="filename" binding="{binding filename}" isreadonly="true"/> <datagridtextcolumn header="resourcename" binding="{

Is there a jquery event associated with the mouse leaving a subModal window? -

i'm using submodal window (basically floating frame) login prompt. there way trigger event when mouse leaves floating frame? yes, it's called mouseleave bind event handler fired when mouse leaves element , or trigger handler on element.

windows installer - Wix Cabinet Caching Not Working -

i can't seem wix cabinet caching work. i have <propertygroup> <cabinetcreationthreadcount>3</cabinetcreationthreadcount> <cabinetcachepath>cabs</cabinetcachepath> <reusecabinetcache>true</reusecabinetcache> </propertygroup> in wixproj. <media id="1" cabinet="contents.cab" embedcab="yes" compressionlevel="mszip"/> <media id="2" cabinet="static.cab" embedcab="yes" compressionlevel="mszip"/> in wxs and component know 100% never ever changes marked <component diskid="2" ... i see cab files generated in cabs directory, each time build, see modified time of cab file change, suggests it's regenerated cabinet instead of reusing 1 cache. using wix 3.6 how can working or debug problem further? are building or rebuilding (i.e. /t:build or /t:rebuild )? wix import remove generated fil

oracle - Is the use of SELECT COUNT(*) before SELECT INTO slower than using Exceptions? -

my last question got me thinking. 1) select count(*) count foo bar = 123; if count > 0 select var foo bar = 123; -- stuff else -- other stuff end if; 2) begin select var foo bar = 123; -- stuff exception when no_data_found --do other stuff end ; i assume number 2 faster because requires 1 less trip database. is there situation 1 superior, not considering? edit: i'm going let question hang few more days, gather more votes on answers, before answering it. if use exact queries question 1st variant of course slower because must count records in table satisfies criteria. it must writed select count(*) row_count foo bar = 123 , rownum = 1; or select 1 row_count dual exists (select 1 foo bar = 123); because checking record existence enough purpose. of course, both variants don't guarantee else don't change in foo between 2 statements, it's not issue if check part of more complex scenario. think situati

c++ - error: no match for ‘operator=’ -

i trying compile source in repository: https://github.com/maartenbaert/ssr and compilation errors on particular source file: https://github.com/maartenbaert/ssr/blob/master/src/gui/pageoutput.cpp with following error: ../../src/gui/pageoutput.cpp:66: error: no match ‘operator=’ in ‘((pageoutput*)this)->pageoutput::m_containers = {{"matroska (mkv)", "matroska", {"mkv"}, "matroska files (*.mkv)", {(pageoutput::enum_video_codec)0u, (pageoutput::enum_video_codec)1u, (pageoutput::enum_video_codec)2u}, {(pageoutput::enum_audio_codec)0u, (pageoutput::enum_audio_codec)1u, (pageoutput::enum_audio_codec)2u, (pageoutput::enum_audio_codec)3u}}, {"mp4", "mp4", {"mp4"}, "mp4 files (*.mp4)", {(pageoutput::enum_video_codec)0u}, {(pageoutput::enum_audio_codec)0u, (pageoutput::enum_audio_codec)1u, (pageoutput::enum_audio_codec)2u}}, {"webm", "webm", {"webm"}, "webm files (*

html - Using :before and :after attributes -

Image
i'm trying figure on how use :after , :before css , applying styles this: the objective here fit fixed width , height of box inside of parent box (not sure if said correctly). the box inside going past or overflowing. how set parent box adjust no matter how big child box is? child box i'm mentioning here dark grey box. <div class="connections-label"> <div class="connections-avatar"></div> <h3><a href="">christian blanquera</a></h3> <h4>invested on 5 million cookies in 20 startups</h4> </div> .connections-label { color:#1c89cc; text-decoration:none } .connections-label h4 { color:#686868; font-style:italic; } .connections-avatar { width:50px; height:50px; float:left; background-color:grey; margin-right:10px } .connections-label:after { content:""; } you're looking css clearfix solution. bas

python - Scipy minimize, fmin, leastsq type problems (setting array element with sequence), bad fit -

Image
i'm having trouble scipy.optimize.fmin , scipy.optimize.minimize functions. i've checked , confirmed arguments passed function of type numpy.array, return value of error function. also, carreau function returns scalar value. the reason of arguments, such size, this: need fit data given model (carreau). data taken @ different temperatures, corrected shift factor (which fitted model), end several sets of data should used calculate same 4 constants (parameters p). i read can't pass fmin function list of arrays, had concatenate data x_data_lin, keeping track of different sets size parameter. t holds different test temperatures, while t_0 one-element array holds reference temperature. i positive (triple checked) arguments passed function, result, one-dimensional arrays. here's code aside that: import numpy np import scipy.optimize scipy.optimize import fmin simplex def err_func2(p, x, y, t, t_0, size): result = array([]) temp = 0 in range(0, int(len