Posts

Time Complexity Dijkstra -

if complexity of algorithm o(evlogv) . given e=20000 , v=1000 . how many seconds take execute? 20000 * 10000 log 10000 = 800000000 what 800000000 means ? big-o notation way of describing how many times set of operations performed. doesn't relate directly time on machine or instructions required operate on machine. so, 800000000 number of times set of operations performed when have data set of size e=20000 , v=10000.

HTML select doesn't show scrollbar with size = 1 and multiple = true in Firefox 39 -

Image
when create <select> element multiple selection , size=1 , firefox doesn't draw scrollbar. firefox version 39 . example, in chrome ok. <select size="1" multiple> <option value="0" label="val1">val1</option> <option value="1" label="val2">val2</option> <option value="2" label="val3">val3</option> </select> can it? example here: http://jsfiddle.net/tzd6uazj/ when define size="1" creating 1-option-high multiple select box, of course incredibly unfriendly thing visitors. if want allow users select multiple list items, set size attribute reasonable number can see more 1 option @ time. even on chrome(in fiddle), couldn't see option 2 in select.... can't use checkbox button group?

perl - read xml file without any XML module -

i trying read xml form using perl can not use xml modules xml::simple, xml::parse. it simple xml form has basic information , ms doc attachment. want read xml , download attached doc file print xml information in screen. but don't know way how can without xml module , heard xml file can parse using data::dumper not familiar module, not getting how this. could please me on if there way without xml modules? sample xml: <?xml version="1.0"?> <catalog> <book id="bk101"> <author>gambardella, matthew</author> <title>xml developer's guide</title> <genre>computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>an in-depth @ creating applications xml.</description> </book> <book id="bk102"> <author>ralls, kim</author> <title>mi...

Logstash add date field to logs -

my application produces logs, without timestamp. there way in logstash append timestamp logs on processing something like, mutate { add_field => { "timestamp" => "%{date}" } } logstash adds @timestamp field default. don't need set additional. logstash take time event received , add field you. for example if try command: ls_home/bin/logstash -e 'input { stdin {} } output { stdout { codec => rubydebug } }' you see automatically created @timestamp field in result: "@timestamp": "2015-07-13t17:41:13.174z" you can change format , timezone using date filter or can match timestamp of event (e.g. syslog timestamp) using other filters grok or json.

Rails: rendering collection of different models -

i have defined @results variable in controller contains different models , want render them in view using <%= render @results %>. how can give render method address directory contains partials these models. solution <% @results.each |result| %> <%= render "home/partials/#{result.class.name.downcase}", result.class.name.downcase.to_sym => result%> <% end %> render in current object's view directory: render 'form' # renders _form.html.erb in same directory to in directory, add it's directory name: render 'shared/form' # renders _form.html.erb in views/shared/ since results variable apparently contains multiple models, assign directory value each entry in hash or array , call in view or controller. that's best can give based on very, little information in question.

.net - Executing Gulp task(s) only when publishing ASP.NET 5 web application -

what best way execute gulp tasks when publishing asp.net 5 web application? need add custom build event executes gulp command? cmd.exe /c gulp -b "c:\projects\projectname\source\projectname.web" --gulpfile "c:\projects\projectname\source\projectname.web\gulpfile.js" publish or, preferably, there way bind gulp task beforepublish target via task runner explorer? any suggestions appreciated. update 2 .net core cli doesn't support "prepack" more. "postcompile" script may work better. https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json#scripts original answer add "scripts" section of project.json project.json: scripts documentation { ... "scripts": { "prepack": "gulp publish", } ... }

asp.net mvc - 400 BadRequest Error And Custom Error Page -

i try have custom error page http error 404 page, add following in web.config. , can work. <system.webserver> <httperrors errormode="custom" existingresponse="replace"> <clear /> <error statuscode="401" path="~/error/unauthorized" responsemode="executeurl" /> <error statuscode="403" path="~/error/forbidden" responsemode="executeurl" /> <error statuscode="404" path="~/error/notfound" responsemode="executeurl" /> <error statuscode="500" path="~/error/servererror" responsemode="executeurl" /> </httperrors> </system.webserver> originally, request through web api , return error messages. after adding httperrors in web.config. returns "badrequest". any idea of solve that? thanks in advance try: <configuration> ...