Posts

Showing posts from July, 2013

css - Why string assignment in javaScript is case insensitive? -

i have create simple html page 1 button change color when clicked: <!doctype html> <html> <head> <title></title> </head> <body> <button onclick="if (this.style.backgroundcolor == 'red') { this.style.backgroundcolor = 'green' } else { this.style.backgroundcolor = 'red' } alert(this.style.backgroundcolor)"> ok </button> </body> </html> it surprising me alert(this.style.backgroundcolor) return red instead of red . why? there assignment this.style.backgroundcolor = 'red' , in red start capital letter. css styles aren't saved literal strings, they're converted internal, canonical representation of style. color styles case-insensitive, , canonical representation lowercase.

python - Django template with External CSS ; using {%static%} for images in a division -

i using django web app , encountered no image shown problem following code: <div class="hexagon-in2" style="background:url(static/images/gallery/2.jpg)"> please situation. if have defined media_url in settings.py <div class="hexagon-in2" style="background:url("{{ media_url }}/images/gallery/2.jpg)"> // or static_url if use static files storing images , media

javascript - Sencha app build native overwriting our custom code -

we have been working in application quite time developed using sencha touch 2. we test , debug code using chrome , ripple. the problem facing added custom search , grouping logic 1 of our lists views. when tested , debugged using chrome worked expected, used command package in order integrate cordova , generate android , ios applications. used following command: sencha app build native for reason, code generated command overwriting our custom search , grouping javascript code. why happening. thing not sencha tool not working correctly rather doing wrong causing happen. we clueless on reason be. can throw light this? why our custom grouper , filtering functions being overwritten when packaging application? bellow extract on how define grouping method in our store. again, when try in our debug environment works correctly. problem when package using above command, grouper function gets replaced default sencha touch 2 grouping function returns first character of string.

Codeigniter array issue -

i'm trying loop through array , insert values database. table looks this: hours_day hours_open hours_close my form enables user select day, opening time , closing time. there plus button adds day below it, user can choose whichever days wish. means select box names arrays, i.e. hours_day[] my model looks this: $hours = array( 'hours_day' => $this->input->post('venue_hours_day'), 'hours_opening' => $this->input->post('venue_hours_open'), 'hours_closing' => $this->input->post('venue_hours_close'), ); so have array ($hours) arrays inside of (hours_day, hours_opening, hours_closing). how loop through add database? you can use : $post_day = $this->input->post('venue_hours_day'); $post_opening = $this->input->post('venue_hours_open'); $post_closing = $this->input->post('venue_hours_closing'); $count = count($post_day); $results = a

heroku - ckeditor rails gem adds base url to assets -

i using ckeditor gem : rails 4 , assets_sync , heroku following url: http://www.baseurl.com//mybucket.s3.amazonaws.com/assets/ckeditor/config-77c214941cb7b15940a497f28f333f30.js while should be //mybucket.s3.amazonaws.com/assets/ckeditor/config-77c214941cb7b15940a497f28f333f30.js as defined in assets_host config.action_controller.asset_host = "//#{s3_bucket}.s3.amazonaws.com" i defined: var ckeditor_basepath = "http://mybucket.s3.amazonaws.com/assets/ckeditor/"; but doesn't either. why baseurl? thanks lot help. upgrading ckeditor gem version 4.0.11 fix issue.

javascript - addClass("test") give error: TypeError: undefined is not a function -

in console have: $(".mycssclass")[0].parentnode <li><span class="mycssclass">some text</span></li> i want add css class parent span , tag <li> i tried this: $(".mycssclass")[0].parentnode.addclass("test") typeerror: undefined not function i use jquery 1.5.2 addclass method of jquery objects. when use $(".mycssclass")[0] , have real element, not jquery wrapper. then, can: wrap jquery object again: $($(".mycssclass")[0].parentnode).addclass("test") only work jquery objects: $(".mycssclass").eq(0).parent().addclass("test") add class plain javascript (not supported on old browsers): $(".mycssclass")[0].parentnode.classlist.add("test")

ruby - What is the correct Rails association for this design? -

environment: ruby 2.0.0, rails 4.1, windows 8.1, devise i confused how handle issue. have items stored @ location until checked out user. want able query item , determine location or user holds it. so, item belong either location or user. each location , each user can have many items. this large library system book in 1 of several buildings , patron check out books each of buildings. @ point, i'd locate book either in building or patron. my confusion stems fact item associated either of 2 different models @ different points in time. @ location or held user, , should never both. what association or design work this? thanks.... i use polymorphic association this, try this: item.rb belongs_to :check_outer, :polymorphic => true user.rb has_many :items, :as => :check_outer location.rb has_many :items, :as => :check_outer you need proper database columns support this. on items table, add check_outer_type:string , check_outer_i

php - MySQL query to return counts of rows by month -

i'm trying counts of number of rows in table last 12 months , on month month basis give 12 counts . so far, have ugly way of doing it: select ( select count(i.id) intrusions i, devices d i.device_id = d.id , d.primary_owner_id = '1' , from_unixtime(start_time/1000) '2014-04%', select count(i.id) intrusions i, devices d i.device_id = d.id , d.primary_owner_id = '1' , from_unixtime(start_time/1000) '2014-03%', select count(i.id) intrusions i, devices d i.device_id = d.id , d.primary_owner_id = '1' , from_unixtime(start_time/1000) '2014-02%', etc ) the tables set 1 user can have many devices , 1 device can have many intrusions , hence conditions. the primary_owner_id , date added in dynamically in php using prepared statements . there better way write out wouldn't involve repitition , binding 24 parameters? appreciated you should use grouping this. this. select concat(year(from_un

c# - LINQ - Query syntax vs method chains & lambda -

does stick rules (or forced stick rules employer?) when choosing use either linq query syntax or lambda expression inside 1 of linq extension methods? applies entities, sql, objects, anything. at our workplace, boss doesn't lambda @ , he'd use query syntax anything, in cases, find less readable. var names = collection.select(item => item.name); var names = item in collection select item.name; maybe when adding condition, lambda find gets little messy, var names = collection.where(item => item.name == "fred") .select(item => item.name); var names = item in collection item.name == "fred" select item.name; just out of interest: how compiler treat one? know how above linq query compile lambda? name property called each element? instead , potentially improve performance? mean lambda more controllable in terms of performance? var names = collection.select(item => item.name)

Can anyone help me trace this LISP expression execution? -

l1 = ((a b) c d) l2 = ((e) f) the expression i'm supposed evaluate is: (cons (car l1) (list (cdr l2))) i've traced out follows: (cons (car l1) (list (cdr l2))) (cons ((a b)) (list ((f)))) (cons ((a b)) (((f)))) ((((a b)) (((f))))) or (i'm not sure if more readable or not, i've pressed space many times out now): ( ( ( (a b) ) ( ( (f) ) ) ) ) is correct? seems there's entirely many parentheses, maybe i'm being paranoid? none of examples can find have nested lists this, i'm not sure if i'm doing right. thanks cl-user 13 > (step (cons (car l1) (list (cdr l2)))) (cons (car l1) (list (cdr l2))) -> :s (car l1) -> :s l1 -> :s ((a b) c d) (a b) (list (cdr l2)) -> :s (cdr l2) -> :s l2 -> :s ((e) f) (f) ((f)) ((a b) (f))

Php str_replace and character ° -

im having issues character ° , 30°f. im doing string replace ignoring character: str_replace(array(',', '.', ' ', '´', '°', ':', ';', '!'), "", $name); any ideas? just records. degree symbol have variant in fonts think on windows word version use masculine ordinal indicator, thats little line under degree symbol sort of 1 used on spanish №, odd see around , in code world used without little line. in case replacing file name had , of course php didnt replace , didnt saw either doing copy paste, notice copying file name on link given can has cheezburger. if case, check file name , replace normal degree symbol or remove it.

c# 4.0 - No result with port forwading with mono.nat -

hi guys 1 can me mono.nat dll , url said nothing happens , upnp activated in router no result. url : http://www.fluxbytes.com/csharp/upnp-port-forwarding-the-easy-way/ probably nat adsl modem instead of ip router. try open.nat , please read documentacion . i hope can you. if doesn't work (doen't worry, will) enable tracing verbose level , open issue in github.

vb.net - How to use native Stopwatch with fewer decimal places? -

in visual basic 2010, how use built-in stopwatch function less accuracy/with fewer decimal places. building stopwatch. works well, has low framerate (about 5-10 fps) because stopwatch generates 10 decimal places! here's code lessen number of decimal places: private sub timer1_tick(sender system.object, e system.eventargs) handles timer1.tick rounded = convert.todecimal(stopwatch1.elapsed) rounded2 = decimal.round(rounded, 2) label1.text = convert.tostring(rounded2) end sub have @ this: any help? thanks! i think best options use custom format elapsed value (which timespan) this: private sub timer1_tick(sender system.object, e system.eventargs) handles timer1.tick label1.text = stopwatch1.elapsed.tostring("dd\.hh\:mm\:ss\.fff") end sub where fff optional number of milliseconds require - specify more or less f 's want. note won't round value in case of stopwatch wouldn't want round anyway.

c# - Is there a shortcut in Visual Studio 2013 that shows the definition pop up of the selected element? -

Image
the pop appears when hover on element: is there equivalent keyboard shortcut this? (in eclipse there is, it's f2). it called quick info shortcut control + k + i . from visual studio menu: edit->intellisense->quick info

http - Uncaught Security Error in Chrome -

uncaught security error: blocked frame origin " http://www.irishotel.in " accessing frame origin " https://maps.google.co.in ". frame requesting access has protocol of "http", frame being accessed has protocol of "https". protocols must match.

How to get datetime differance in laravel 4 -

i using laravel 4. facing problem finding difference between 2 date: 1 coming database table , 1 current datetime. date difference expecting 1 hour or 1 day. i've tried few solution can't fix yet. , don't know better way solve it. if guys have solution, please provide me example. please tell me if need library. here code: $lecture_id = input::get('lecture_id'); $delegate_id = input::get('delegate_id'); // $newdate = new datetime(); $lecture = lecture::find($lecture_id); // $lec_date = date::forge($lecture->start_time); // $lec_date = new datetime($lecture->start_time); $lec_date = $lecture->start_time->diffforhumans(carbon::now()); if ( $lec_date > 1) { lecturedelegate::create(array( 'lecture_id' => input::get('lecture_id'), 'delegate_id'=> input::get('delegate_id') )); re

google chrome - Would it be possible to store cookies on the cloud? -

would possible store cookies in google account when browsing using google chrome(just example)? wouldn't make aspects of searching web safer? why still storing cookies on device? the article on http cookies contains useful information on role/purpose in http. a cookie .. small piece of data sent website , stored in user's web browser while user browsing website. every time user loads website, browser sends cookie server notify website of user's previous activity. cookies designed reliable mechanism websites remember stateful information [between otherwise stateless http requests] .. in particular, cookies only/primarily useful because stored on device , because sent appropriate requests. entire concept of "storing cookies on cloud" unrelated primary benefit/use of cookies in first place! however, cookies considered insecure , should not used store sensitive information - why cookies coupled sessions , other server-side data access mech

Python callback in a class? -

i found code text summarization in github, , change program became tkinter program.i have problem when value in class using button widget , show result in text widget.how value of method summarize in code use tkinter button?i usualy use function or procedure nothing class , method.this code running in intrepreter. import nltk nltk.tokenize import sent_tokenize nltk.tokenize import word_tokenize nltk.probability import freqdist nltk.corpus import stopwords class naivesummarizer: def summarize(self, input, num_sentences ): punt_list=['.',',','!','?'] summ_sentences = [] sentences = sent_tokenize(input) lowercase_sentences =[sentence.lower() sentence in sentences] #print lowercase_sentences s=list(input) ts=''.join([ o o in s if not o in punt_list ]).split() lowercase_words=[word.lower() word in ts] words = [word word in lowercase_words if word no

extjs4 - compare date retrieved from datefield to current date in EXTJS -

i want compare date retrieve o datefield (xtype: 'datefield',) current date. i've done next : validatedatedebut : function(datedebutid) { var datedebutfield = ext.getcmp(datedebutid); var datedepuis = ext.date.format(datedebutfield.getvalue(),'d/m/y'); var datecourrante = ext.date.format(new date(),'d/m/y'); if (datecourrante < datedepuis) { alert("date value provided larger" ); } else { alert("date value provided less" ); } } where datedebutid id of datefield. problem "date value provided less". validatedatedebut : function(datedebutid) { var datedebutfield = ext.getcmp(datedebutid); var datedepuis_formated = ext.date.format(datedebutfield.getvalue(),'d/m/y'); var datecourrante_formated = ext.date.format(new date(),'d/m/y'); var datede

python - Get probability of classification from decision tree -

i'm implementing decision tree based on cart algorithm , have question. can classify data, task not classify data. want have probability of right classification in end nodes. example. have dataset contains data of classes , b. when put instance of class tree want see probability instance belongs class , class b. how can that? how can improve cart have probability distribution in end nodes? when train tree using training data set, every time split on data, left , right node end proportion of instances class , class b. percentage of instances of class (or class b) can interpreted probability. for example, assume training data set includes 50 items class , 50 items class b. build tree of 1 level, splitting data once. assume after split, left node ends having 40 instances of class , 10 instances of class b , right node has 10 instances of class , 40 instances of class b. probabilities in nodes 40/(10+40) = 80% class in left node, , 10/(10+40) = 20% class in left node (a

ios - Xcode inserting record in core data -

i have database in core data needs group items according type. because of cant add item @ end. need insert specific index. can please tell me how insert new record @ index x , moving old index x index x+1 , on. or there way sort record descending acording parameter y ? thank you any concept of order created using ordering attribute(s) on entity. it's entirely update / maintain ordering information (and use when fetching / processing fetched results).

Change name of Azure Resource Group -

Image
after new model implemented, of websites belong individual resource groups called "default-web-east" , of sql databases belong individual resource groups called "default-sql-east". this confusing least. i rename groups have semantic meaning. group associated sql database , web site in same resource group. however, not see anyway either. possible? 1) rename resource group? 2) combine existing sql db , website 1 resource group? edit: can't rename azure resource group. what can move resources new resource group instead. moving resources in resource group resource group b poor man's rename. unfortunately not resource providers let move resources between resource groups, , might have strings attached let move resources under conditions. for azure web apps (previously called azure websites) can move websites related resources in single invocation. "all websites related resources" means resource under provider "microsoft

phpExcel reader long numbers to text -

when reading excel file, have problems numbers greater length: i use: try { $inputfiletype = phpexcel_iofactory::identify($inputfilename); $objreader = phpexcel_iofactory::createreader($inputfiletype); $objphpexcel = $objreader->load($inputfilename); } catch(exception $e) { die('error loading file "'.pathinfo($inputfilename,pathinfo_basename).'": '.$e->getmessage()); } $sheet = $objphpexcel->getsheet(0); $highestrow = $sheet->gethighestrow(); $highestcolumn = $sheet->gethighestcolumn(); ($row = 1; $row <= $highestrow; $row++){ $obj = $sheet->rangetoarray('a' . $row . ':' . $highestcolumn . $row, null, true, false); list($code, $name) = $obj[0]; echo $code; } and returns 1.6364698338384e+18 is possible obtain 1636469833838380000 ? i try $code = (string) floatval($code); ... nothing... you can change cell format text in excel file , try reading values it. hope

web config - application configuration in biztalk -

i developed biztalk orchestration calling custom library method. since custom library consuming web service , writing data database therefore reads various info database connection string , wcf service endpoint address appconfig . put custom library gac , deployed biztalk application unable find place can put appconfig used custom library. i googled , found append config file in btsntsvc.exe placed under :\program files (x86)\microsoft biztalk server 2013, not recommended way. you can save configuration in btsntsvc.exe.config, file contains biztalk host configurations. take in mind, if you'll have syntax error in config file - you'll have troubles running biztalk engine. best solution use cache layer consume c# class library orchestration.

java - how to establish connections between a servlet and a socket -

supposing have servlet reads , writes file socket , want establish connection between servlet , socket, how done? well, socket, read somewhere 1 has this: url url = new url("http://example.com/getfile"); urlconnection con = url.openconnection(); con.setdooutput(true); how same servlet? i wanted since sending , receiving files between servlet , scoket. also, how both of them know when other has sent file , should read it? i have searched can't find site explains it. i unsure mean 'socket'. if socket standard protocol (http/https/ftp) can use above piece of code in servlet use in stand alone program. if socket not prescribe standard might want open direct connection using below piece of code: socket socket = new socket(server,port); //get input stream socket bufferedreader inputstream = new bufferedreader(new inputstreamreader( socket.getinputstream())); //get output stream socket. note // stream autoflush. p

function - Refactoring in Javascript -

here code: var randomcolor = ["red", "blue", "green", "#9cba7f", "yellow", "#bf5fff"]; function setrandomcolor() { return randomcolor[math.floor(math.random() * randomcolor.length)]; } $('.mastermind_master_cpu').each(function() { $(this).find('td').each(function() { $(this).css("background-color", setrandomcolor); }) }) as can see, mastermind_master_cpu table randomly fill different background color. problem have ten different tables , repeating every time. know how can go making 1 function / variable , calling when needed? thanks! create class, random_color , apply each table in addition current class, this: <table class="mastermind_master_cpu random_color">...</table> then can use once: $('.random_color').each(function() { $(this).find('td').each(function() { $(this).css("background-color", setrandomcolor); }) })

Finding the predecessor / successor of a list item in Prolog -

i having hard time translating idea lisp prolog. did find out how find predecessor , successor in lisp having hard time implementing same idea in prolog. poor syntax. please me out. sample queries: ?- predecessor(b,[a,b,c],p). p = a. % expected result ?- successor(b,[a,b,c],s). s = c. % expected result here's dcg approach: pred(x, p) --> stuff, [p,x], stuff. succ(x, s) --> stuff, [x,s], stuff. stuff --> [] | [_], stuff. predecessor(x, l, p) :- phrase(pred(x, p), l). successor(x, l, p) :- phrase(succ(x, s), l). sporadic trials: | ?- predecessor(a, [a,1,2,a,3], l). l = 2 ? ; no | ?- predecessor(x, [1,2,3,2,5], 2). x = 3 ? x = 5 no | ?- successor(a, [a,1,2,a,3], l). l = 1 ? l = 3 no | ?- successor(x, [1,2,3,2,5], 2). x = 1 ? x = 3 no | ?- per @false's comments, implementation can tidied bit: predecessor(x, l, p) :- phrase((..., [p,x], ...), l). successor(x, l, s) :- phrase((..., [x,s

Get variables from a href php -

i have: <a href="settings.php?yeah=<?php echo $yeah;?> & word=<? echo $word;?">settings</a> and in settings php: <? echo $_get['yeah']; echo $_get['word']; ?> the problem is working yeah. you need remove spaces between variables in href : <a href="settings.php?yeah=<?php echo $yeah;?>&amp;word=<?php echo $word;?"> settings </a>

ruby on rails - Jenkins docker cache not working -

i'm trying build docker file under jenkins docker build . here docker file: # docker-version 0.10.0 docker-index.my.com/ruby:1.9.3 maintainer my.com # never install ruby gem docs run echo "gem: --no-rdoc --no-ri" >> ~/.gemrc run mkdir /my_app workdir /my_app run gem install bundler run gem install bluepill add gemfile /my_app/gemfile add gemfile.lock /my_app/gemfile.lock run bundle install add . /my_app note i'm using common caching method bundle install, cache works locally not on jenkins build, problem of running under jenkins?

assembly - MIPS simple Sum -

i friends, i'm working on compiler program so, can't understand while i'm passin 3 code address mips assembly, gets error in simple sums those: addi $t0 , 1 ,1 it accepts : addi temp , temp , 1 how can sum 2 integers? have store first "1" in temporary? thanks lot yes. each instruction has 32-bits encode operation, registers , in case immediate value. immediate value alone consumes 16-bits, there aren't instructions 2 immediates. question why ever need 2 immediate values. if have 2 constants want put code, compute answer , put answer instruction code.

java - getWidth not working correctly as class variable -

i new java (and programming in general) , trying make program draws vertical line down centre of screen. this, made variable x gives me x coordinate of centre of screen. wanted able use variable within other private methods. when run code however, no line appears, if x set 0. import acm.graphics.*; import acm.program.*; import java.awt.*; public class target extends graphicsprogram { int x = getwidth()/2; public void run() { gline line = new gline (x,0,x,300); add (line); } } if put variable x inside run() method below, line drawn correctly, not able use later in other private methods understanding variable no longer class variable instance variable , therefor accessible run() , no other methods? public class target extends graphicsprogram { public void run() { int x = getwidth()/2; gline line = new gline (x,0,x,300); add (line); } } could enlighten me why first code not work whereas second 1

asp.net mvc - this call is ambiguous between the following methods or properties when using 2 models in a view c# razor -

i having trouble using 2 models in view in mvc. when try reference second model using razor giving me error: the call ambiguous between following methods or properties: 'system.web.mvc .html.displaynameextensions.displaynamefor<system.collections.generic.ienumerable <myapp.models.problems>, string>(system.web.mvc.htmlhelper<system.collections. `generic.ienumerable<myapp.models.problems>`(system.linq.expressions.expression <system.func<system.collections.generic.ienumerable<myapp.models.problems>, string>>)' , 'system.web.mvc.html.displaynameextensions.displaynamefor<myapp .models.problems>,string(system.web.mvc.htmlhelper<systems.collections.generic .ienumerable<myapp.models.problems>>(system.linq.expressions.expression<system.func <myapp.models.problems>,string>> this how call model in view: @model ienumerable<myapp.models.problems> this model being loaded in view: public class pro

How do I save ut8 encoding with excel vba macro -

i'm generating tsv file macro data contains special characters 'tm' symbol , in turn fed mysqlimport in server. because of special characters doesn't load rest of string after special character. i have following macro save preffered delimiter , enclosure want specify encoding want save file in well. how go this? sub tsv() dim srcrg range dim currrow range dim currcell range dim currtextstr string dim listsep string dim fname variant fname = application.getsaveasfilename("", "tsv file (*.tsv), *.tsv") 'fname = application.getsaveasfilename("", "csv file (*.csv), *.csv") 'assign character delimiter want listsep = chr(9) 'listsep = "|" 'assign enclosure character want listenc = "^" if selection.cells.count > 1 set srcrg = selection else set srcrg = activesheet.usedrange end if open fname output #1

performance - ifort -ipo flag strange behavior -

i have following code testing intel mkl daxpy routine. program test implicit none integer, parameter :: n = 50000000 integer, parameter :: nloop = 100 real(8), dimension(:), allocatable :: a, b integer start_t, end_t, rate, allocate(a(n)) allocate(b(n)) = 1.0d0 b = 2.0d0 call system_clock(start_t, rate) = 1, nloop call sumarray(a, b, a, 3.0d0, n) end call system_clock(end_t) print *, sum(a) print *, "sumarray time: ", real(end_t-start_t)/real(rate) = 1.0d0 b = 2.0d0 call system_clock(start_t, rate) = 1, nloop call daxpy(n, 3.0d0, b, 1, a, 1) end call system_clock(end_t) print *, sum(a) print *, "daxpy time: ", real(end_t-start_t)/real(rate) = 1.0d0 b = 2.0d0 call system_clock(start_t, rate) = 1, nloop = + 3.0d0*b end call system_clock(end_t) print *, sum(a) print *, "a + 3*b time: ", real(end_t-start_t

performance - Azure Queue delayed message -

i has strange behaviour on production deployment azure queue messages: of messages in queues appears big delay - minutes, , 10 minutes. befere ask setting delaytimeout when put message queue - not set delaytimeout message, message should appear immedeatly after placed in queue. @ moments not have big load. instances has no work load, , able process message fast, don't appear. our service process millions of messages per month, able identify 10-50 messages processed big delay, fail sla in front of our customers. does have idea can reason? how overcome? did faced similar issues? some general ideas troubleshooting: are message queued processing - ie queue.addmessage operation returned , waiting 10 minutes - meaning can rule out client side retry policies etc being cause of problem. is there chance time calculation subject kind of clock skew problems. eg - if 1 of worker roles pulling messages has close out of sync other worker roles see this. is possible in

MIPS data path for store word? -

based on figure, executing sw instruction cause these values assigned signals labeled in blue: regwrite = 0 alusrc = 1 alu operation = 0010 memread = 0 memwrite = 1 memtoreg = x pcsrc = however, little confused inputs used in registers block? can describe overall sw procedure in mips datapath? the execution of sw follow following steps in diagram: instruction read , decoded pc in instruction memory subcircuit. the register file read $rs , $rt (registers subcircuit) the value of $rs added sign extended immediate (selected alusrc ) (alu subcircuit). the added value , $rt passed data memory subcircuit value of $rt written memory.

Silencing broken pipe errors (`[Errno 32] Broken pipe`) in python with WSGI+Pyramid -

i have rather simple, naive python/wsgi/pyramid web-server. it's run using wsgiref.simple_server.make_server() , on server built using pyramid.config.configurator().make_wsgi_app() . server works fine. however, application it's serving has lot of javascript image mouseover popups. if run mouse across page, can generate 20+ image requests. fine (it's internal thing, not lot of users). however, doing causes server emit half dozen error tracebacks: 10.1.1.4 - - [25/apr/2014 01:56:42] "get /*snip* 500 59 ---------------------------------------- exception happened during processing of request ('10.1.1.4', 18338) traceback (most recent call last): file "/usr/lib/python3.4/wsgiref/handlers.py", line 138, in run self.finish_response() file "/usr/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response self.write(data) file "/usr/lib/python3.4/wsgiref/handlers.py", line 274, in write self.send_headers

wordpress - How to hide bootstrap drop down menu on second click in my nav bar? -

i using bootstrap in wordpress custom theme navigation menu not hide after click second time. how resolve problem using bootstrap 3. m using walker drop down menu here code <?php // loading wordpress custom menu wp_nav_menu( array( 'container_class' => 'nav nav-pills navbar-collapse', 'menu_class' => 'nav navbar-nav', 'menu_id' => 'main-menu', 'walker' => new cwd_wp_bootstrapwp_walker_nav_menu() ) ); ?> why dont use jquery hide , show drop down menu> drop down menu opens on class "open" might toggle class <script> $(".your_nav_bar_list_item_class").click(function(){ $(".your_nav_bar_list_item_class").toggleclass("open"); }): </script>

regex - Sed command on Linux only matches 1, where on Solaris multiple matches are found -

note i'm beginner sed. we make use of sed-command looks in output of clearcase command , obtains names of users view: <clearcase output> | sed -n "/development streams:/,// s/[^ ]* *views: *\([^_ ]*\)_.*/\1/p" (example clearcase output: project: project:xx0.0_xx0000@/xxxx/xxxxx_xxxxxxxx0 project's mastership: xxxxxxxxx@/xxxx/xxxxx_xxxxxxxx0 project folder: folder:xx0.0@/xxxx/xxxxx_xxxxxxxx0 (rootfolder/xxxxxxxx/xx0.0) modifiable components:component:00000000000@/xxxx/xxxxxx_xxxxxxxx0 component:xxxxxxx_xxxxxxx@/xxxx/xxxxxx_xxxxxxxx0 component:xxxxxxxxxxxxxx_x@/xxxx/xxxxxx_xxxxxxxx0 component:xxxxx@/xxxx/xxxxxx_xxxxxxxx0 component:xxxxxx_xxxxxxxxxxx@/xxxx/xxxxxx_xxxxxxxx0 integration stream: stream:xx0.0_xx0000_integration@/xxxx/xxxxx_xxxxxxxx0 (fi: nemelis) integration views: olduser_xx0.0_xx0000_int - properties: dynamic ucmview readwrite

What is negative property in the context of database design? -

i read in scientific literature lossy join negative property in relational database design. negative property in context of database design? there called positive property well? lossy join means lossy decomposition , join operation. example, given following relation, r: r +-----+-----+ | | b | |-----|-----| | foo | 100 | | foo | 200 | | bar | 100 | +-----+-----+ the following decomposition new relations r1 , r2 "lossy" because isn't possible reconstruct original tuples of r joining r1 , r2. r1 r2 +-----+ +-----+ | | | b | |-----| |-----| | foo | | 100 | | bar | | 200 | +-----+ +-----+ "lossy" means information lost after decomposition , join. in database design theory non-lossy decompositions of interest when considering whether possible alternative database designs can faithfully represent same information. out of context it's not meaningful lossiness either positive or negative thing - it's

SQL Server: group_by select active dates -

Image
in table have 2 columns: leasecontract.[contract activation date] leasecontract.[contract ending date] with 2 columns, i'd generate table example this: so query first row (new contracts): select count(leasecontract.id) total, year(leasecontract.[contract activation date]) jaar leasecontract group year(leasecontract.[contract activation date]) but there way same middle row? show active contracts grouped year in 1 query. thanks! sql version 2008 never did recursive cte before. place learn. so, 1 below should work. in case there's contract no end date, show "active" on listed years following start date. that's assuming sql server version 2008 or above, think. the recursion may not necessary, in theory getting distinct years start , end dates, possible there leap years no new contracts opened, or old ones closed, while still active. way, leap years included, plus min/max surpass distinct / group dates performance concer

php - laravel variable not defined -

this weird. sure missing simple. have following code: $producttoken = input::get('key'); $products = new product; $useremail = $products->activateproduct($producttoken); $productdetailsarray = $products->getproductdetailsforuseremail($producttoken); $emaildata = $productdetailsarray; mail::send('emails.productreleased', $emaildata, function($message){ $message->to($useremail)->subject('notification - product released public!'); }); it supposed activate product in database , send email user. email of user in $useremail , when did var_dump, shows. somehow line throws error $useremail undefined: $message->to($useremail)->subject('notification - product released public!'); this error get: undefined variable: useremail i used mail function before instead of passing variable passed input::get('email') because in registration form. right now, don't have

google app engine - unable to set cache expiration on in app.yaml for a python app -

in gae app serving static content follows (those entries in app.yaml file): handlers: - url: /css static_dir: static/css expiration: "10m" - url: /js static_dir: static/js expiration: "10m" despite information available here: https://developers.google.com/appengine/docs/python/config/appconfig#expiration content never cached in browser regardless whether use dev server or upload app. i using chrome , request header is: cache-control:max-age=0 and response headers are: cache-control:no-cache, must-revalidate pragma:no-cache server:google frontend status:304 not modified as per answers able find, tested both being logged in , out google admin account , nothing changes. any on appreciated. many thanks! response headers when logged out of admin account: date:fri, 25 apr 2014 09:54:44 gmt etag:"lhoiow" server:google frontend status:304 not modified version:http/1.1 gae should work fine 10m value. because signed in go

php - compare date with database (birthdate) -

so have row called birthday in database value of let's 2001-04-25 (date type). , want see if it's user birthday. current month , day: $monthday_today = date('m-d'); and query: $query = "select * users date_format(birthday, '%m-%d')=".$monthday_today; but doesn't works, thoughts? you need quote $monthday_today value. you query (if output it) this: select * users date_format(birthday, '%m-%d') != 04-2014 but not correct sql query, query should this: select * users date_format(birthday, '%m-%d') != '04-2014' the simple solution be: $query = "select * users date_format(birthday, '%m-%d')!="."'".$monthday_today."'"; the solution use parameterized prepared statements either positional or named parameters: $query = "select * users date_format(birthday, '%m-%d') != ?"; or $query = "select * users date_format(birthday, &#

How to concatenate a datetime into a textbox in c# asp.net to show just date -

how concatenate nullable datetime textbox in c# asp.net show date? when load date textbox below in textbox: 2014-04-26 00:00:00.000 but want date ideas? cant tostring display want. calling value below: txtdateexpected.text = loadvisitdetails.expecteddate.tostring(); you can date part using date property of datetime class: txtdateexpected.text = loadvisitdetails.expecteddate != null ? loadvisitdetails.expecteddate.date.tostring() : ""; or: if(loadvisitdetails.expecteddate != null) txtdateexpected.text = loadvisitdetails.expecteddate.date.tostring(); check here datetime.date msdn docs

MYSQL selecting from table 1 with conditions from 2nd table -

my first table, called emp employees table, information such names, phone numbers, town, etc. my second table, called loc table of cities , country’s in. - in list there less cities there in 1st table. (the purpose of cities list irrelevant atm) i want pull list (select from) of name , phone number used select name,number full_list , worked - want show employees live in cities in "cities" column in 'loc' tablet. want display country if possible. i tired stuff like select name,number full_list city cities but didnt work. edit: wanted add exact keys make simpler table 1: emplist name number table 2: cities city country this wanted "checked" against city column in tablet 1, if there match, want appear. column 2 country want appear if possible. ty try this: select f.name, f.number emplist e inner join cities c on (c.primary_key = e.foreign_key) c.cities '%your city%'; change keys table keys...

centos - what is php-common and what does it do? -

i on centos 6.5 , when install yum install php-common goes ahead , installs packages, php still not installed. and, when want install php directly says php-common causing conflict , install php module or php-cli independently. what php-common used for? to answer question, here's what's in php-common on redhat enterprise 6.4 version of package: [marc@foo ~]$ rpm -ql php-common /etc/php.d /etc/php.d/curl.ini /etc/php.d/fileinfo.ini /etc/php.d/json.ini /etc/php.d/phar.ini /etc/php.d/zip.ini /etc/php.ini /usr/lib64/php /usr/lib64/php/modules /usr/lib64/php/modules/curl.so /usr/lib64/php/modules/fileinfo.so /usr/lib64/php/modules/json.so /usr/lib64/php/modules/phar.so /usr/lib64/php/modules/zip.so /usr/lib64/php/pear /usr/share/doc/php-common-5.3.3 /usr/share/doc/php-common-5.3.3/coding_standards /usr/share/doc/php-common-5.3.3/credits /usr/share/doc/php-common-5.3.3/extensions /usr/share/doc/php-common-5.3.3/install /usr/share/doc/php-common-5.3.3/license /usr/sh

c# - Using a local variable in an expression tree -

i have linq expression finds historical changes given customer's creditbalance: var history = gethistory(id); var changes = history.where(x => history.where(y => y.auditid < x.auditid) .orderbydescending(y => y.auditid) .select(y => y.creditbalance) .firstordefault() != x.creditbalance); this function works expected. want change function allow user query changes any historical field. way chose tackle expression trees. so far have come solution: var history = gethistory(id); var c = expression.parameter(typeof(customer_history), "c"); var d = expression.parameter(typeof(customer_history), "d"); var caudit = expression.property(c, typeof(customer_history).getproperty("auditid")); var daudit = expression.property(d, typeof(customer_history).getproperty("auditid")); var wherebody = expression.lesstha

javascript - Safari and requestAnimationFrame gets DOMHighResTimestamp; window.performance not available -

i created animation using requestanimationframe . works fine in windows chrome , ie; safari (tested safari 6 , 7) breaks. turns out raf domhighrestimestamp rather date timestamp. that's fine , good, , expected, it's part of spec. however, far i've been able find, there's no way current domhighrestimestamp (i.e. window.performance not available, prefix). if create start time date timestamp, behaves radically wrong when try determine progress within raf callback (very small negative numbers). if @ this jsbin on safari, won't animate @ all. in this jbin, i've made change "skip" first frame (where time parameter undefined ), starttime gets set time parameter on next frame. seems work, skipping frame seems bit crappy. is there way current domhighrestimestamp in safari, given lack of window.performance ? or alternately, force raf sort of legacy mode forces date timestamp instead? does know why safari has inconsistency, provides paramet

jquery - Button not responding/not binding in javascript -

Image
this question has answer here: event binding on dynamically created elements? 19 answers i have 2 functions in javascript shown below: function add(){ $("#tbl tbody").append( "<tr>"+ "<td><input type='text'/></td>"+ "<td><input type='text'/></td>"+ "<td><input type='text'/></td>"+ "<td><button class=\"btn btnsave\"><i class=\"icon-ok\"></i></button><button class=\"btn btndelete\"><i class=\"icon-remove\"></i></button></td>"+ "</tr>" ); $(".btnsave").bind("click", save); $(".btndelete").bind("click",

jQuery event to catch loaded content -

i have aspx page form fire result div on same page. need process hrefs inside result output. action should used in case? $(document).ready , $(document).ajaxcomplete didn't work. concerning ajaxcomplete understand because not jquery routine used page controls. <script type="text/javascript" language="javascript"> $(document).ajaxcomplete(function() { $('a[href*="mouz"]').removeattr('href'); }); </script> here answer, adapted msdn - http://msdn.microsoft.com/en-us/library/bb397523(v=vs.100).aspx in client script add following sys.webforms.pagerequestmanager.getinstance().add_pageloaded(pageloaded); to handle event, function pageloaded(sender, args) { //get of panels have been updated var updatedpanels = args.get_panelsupdated(); //perform removal of href attr on dom element collection $(updatedpanels).find('a[href*="mouz"]').removeattr('href'); }

user interface - C - Change focus to new GtkWidget -

i'm working on gtk ui irc client. i'd add following interaction it: on user input: /join #channel create new tab < -- working set focus on < -- not working i can't seem set focus (not input focus, view focus sttign widget active view) on created gtkwidget* on notebook. tried using grab_focus() function focus still on created tab. what missing? the widget has focusable ( gtk_widget_can_focus ), otherwise gtk_widget_grab_focus not anything. also there no such thing "view-focus". have input focus , window focus. window focus - makes application receive mouse/keyboard events. widget input focus - makes widget receive keyboard events if window focussed note input here means input event (a gtkbutton handles enter whereas gtkscale handles 0 1 2 3 ... 9 . + - , may handle enter well).

How to set font type on android custombaseadapter -

i want change font type on list view, follow this answer, i declare this lv = (listview)findviewbyid(r.id.listview1); customadapter.custombaseadapter adapter = new customadapter.custombaseadapter(this, rowitems, "van helsing.ttf"); lv.setadapter(adapter); lv.setonitemclicklistener(this); but nothing happen listview font, won't change. this custom adapter: public custombaseadapter(context context, list<rowitem> items, string font) { this.context = context; this.rowitems = items; tf = typeface.createfromasset(context.getassets(), font); } what probelem codes guys ? edited: context context; list<rowitem> rowitems; typeface tf; public custombaseadapter(context context, list<rowitem> items, string font) { this.context = context; this.rowitems = items; tf = typeface.createfromasset(context.getassets(), font); } /*private view holder class*/ private class viewholder { textview txtmenu; } public view get

objective c - Xcode command line tool for calculator -

i want make command line calculator using xcode/osx application/command line tool/foundation type. in xcode, go products/scheme/edit scheme . in this, can add or delete command line arguments. these command line arguments stored in argument vector i.e. argv[] . i using nsarray store these arguments in objective-c array. now, want make calculator can evaluate expression. for example arguments argv[1]=5 , argv[2]=+ , argv[3]= 10 , argv[4]=- , argv[5]=2 . so, these arguments evaluate expression , give result. result=13 . #import <foundation/foundation.h> int main(int argc, const char* argv[]) { @autoreleasepool { nsarray *myarray =[[nsprocessinfo processinfo] arguments]; (int i=1; i<argc ; i++) { nslog (@"arguents %d=%@", i, myarray[i]); } return 0; } } here's simple calculator, knocked-up in few minutes: #import <foundation/foundation.h> typedef enum { op_none, op_add, o

nodes - How to reset / clear / delete neo4j database? -

we can delete nodes , relationships following query. match (n) optional match (n)-[r]-() delete n,r but newly created node internal id ({last node internal id} + 1) . doesn't reset zero. how can reset neo4j database such newly created node id 0? from 2.3, can delete nodes relationships, match (n) detach delete n shut down neo4j server, rm -rf data/graph.db , start server again. procedure wipes data, handle care.

uml - OO design: should collections always be stored? -

Image
i've wondered in many different situations, here come, looking experts knowledge. let's have model requires collection. simple example: application stores famous quotes along author , set of tags or keywords. user should able enter tag or keyword , matching quotes it. question is: need class contains collection of quotes? this: or correct? i'm asking in more abstract way possible (after all, uml should never depend on implementation). i've thought second example (just 1 class) incorrect, i'm thinking maybe user can press button on interface , button executes code gets quote stored somewhere, , second example correct? basically, should have collection stored somewhere, if storing class nothing else store collection (and provide methods access it)? i definitelly prefer 1 class, if there no strong reason have container class (especially on abstract conceptual level). add collection methods static functions . separate container class bring more comp