Posts

Showing posts from June, 2012

javascript - Event Listener Best Practices for web app -

i'm making web app, , javascript collecting quite few $(document).on event listeners. working enough me, feels there must better way organize it. here's sample: // send quiz info via ajax, load form first question. $(document).on('click', '#create-new-quiz', function(){ createnewquiz(); $('#forms').load("dash/workspace.php", { action : 'get-new-question' }); }); // load form create first question $(document).on('click', '#finish-quiz', function(){ addquestion(); $('#forms').load("dash/workspace.php",{ action : 'finish-quiz' }); }); //call function add new question via ajax when button clicked. $(document).on('click', '#add-question', function(){ nextaction = "add-question"; addquestion(); }); that shows have variety of buttons dynamica...

javascript - Open datepicker on condition -

i want datepicker open under condition, in case presence of class, here's not working code: $('.ui-datepicker-trigger').click(function(e){ if ($(this).hasclass('disabledatepicker')) { e.preventdefault(); } }); thanks! this should work $("input").datepicker({ beforeshow: function(a,b){ if ($(this).hasclass('disabledatepicker')) return false; } }); http://jsfiddle.net/sctwm/2/

jquery - ASP.Net MVC Client Side and Server Side Calculations -

i new asp.net mvc , trying maintain correct use of mvc development pattern. getting bit lost in mix different technologies @ play. basically have form typed against model. simplicity sake lets model has 3 ints in it. int1, int2 , total. want create form allows user enter values in int1 , int2 , update total field displayed user whenever either 1 of them changes. want allow user hit save if happy total , http post controller 3 fields saved database. now went down path of using jquery onchange() calculations , set value of total works. however, feel though getting away true mvc here doing calculations within view. how things knockout , json play in here? want stay best practices of mvc as possible. mvc deals sending requested webpage user's web browser. once browser has received it, mvc not enter picture again, unless send new web request (whether page redirect, ajax call, or other means launch web request). anything happens in browser, not part of mvc. doesn...

javascript - RequireJS: Paths not working from require.config() -

this question has answer here: requirejs configuration ignored inline require calls follow script tag loads app 1 answer even though include require-min.js included, it's not picking paths require.config . i've used data-main method load config file. <!--when require.js loads inject script tag (with async attribute) scripts/main.js--> <script data-main="scripts/main" src="scripts/require.js"></script> you typically use data-main script set configuration options , load first application module. [...] however, aliases using jquery don't work. in config.js file... ... paths: { jquery: 'thirdparty/jquery-1.8.3.min' ... my index.html follows... ... <script type='text/javascript' src='js/require.js' data-main='js/config.js'></script> ... require...

c# - php code as converted in asp.net not working as expected? -

doing example of ajax , user type in textbox , text continuously posted using javascript , simultanously showing result whether item available or not. main html as <body> <h3>the chuff bucket </h3> enter food order: <input type="text" id="userinput" onfocus="process()"/> <div id="underinput"/> </body> here code javascript var xmlhttp = createxmlhttprequestobject(); function createxmlhttprequestobject() { var xmlhttp; if (window.activexobject) { try { xmlhttp = new activexobject("microsoft.xmlhttp"); } catch (e) { xmlhttp = false; } } else { try { xmlhttp = new xmlhttprequest(); } catch (e) { xmlhttp = false; } } if (!xmlhttp) { alert("cant create object boss!"); } else retu...

javascript - Openlayers - ModifyFeature - How to label vertices with a progressive number -

apologize in advance quite new in openlayer , javascript. i have control modifyfeature on path vector layer. i vertices rendered stylemap label showing progressive number (1,2,3,4,etc..), same sequence stored within linestring. any suggestion appreciated.

windows 7 - Moving SQL Server from XP to Win7 64bit -

i planning move sql server 2008 r2 express xp 32bit windows 7 64bit, , have following questions: which version of sql server (2008 or 2012 , 32bit or 64bit) should use on windows 7 pc? how move database? copy .mdf files directly or backup , restore databases on windows 7, or generate database scripts xp , execute script on windows 7? i used extremely openrowset microsoft.jet.oledb.4.0 statements in script. on windows 7 pc, simple change driver name microsoft.ace.oledb.12.0 in script, ok? thanks lot which version of sql server (2008 or 2012, 32bit or 64bit) since you're using 2008 r2 now, can use 2008 r2 , 2012 or 2014 versions on new machine. cannot "go back" older version (like 2008 ) without lot of trouble. since express version has limitations, 1 gb can used, don't see point in using 64-bit version. use 32-bit express versions - on windows 7 x64. how move databases? the simplest use backup & restore. back...

cordova - best map system for phonegap web app -

i have phonegap application uses google maps api display map markers, displays small resume of each attraction of city. i use cache application , localstorage, 1st preload images, 2nd display preview when user click on marker, , in case network slow or shut down. but if want app used offline. read google maps tiles can't used offline. if fact, offline app appears empty canvas instead of google map and js loading of google maps cache on manifest, app down, beacause of missing variable 'google' asked js scripts present in manifest: [error] referenceerror: can't find variable: google load (map.js, line 472) geolocation (geolocation.js, line 38) so scripts containing variable, stop. what solution ? ok me if google map not appear services not required. in fact, in android offline, have no problem, google map tiles not displaying, application still work offline. i saw multiples soluton 1 acceptable ? openstreemap + leafleft ? seems good, isn...

uitableview - ios - naming and make action from each cell -

so i'm using code... "mfsidemenudemostoryboard" https://github.com/mikefrederick/mfsidemenu/tree/master/demos/mfsidemenudemostoryboard/mfsidemenudemostoryboard and want give name each cell in "sidemenuviewcontroller.m" , make each 1 of these cells show specific uiview in "demoviewcontroller.m". ? any appreciated, thank you!! in sidemenucontroller - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { demoviewcontroller *democontroller = [[demoviewcontroller alloc] initwithnibname:@"demoviewcontroller" bundle:nil]; democontroller.title = [nsstring stringwithformat:@"demo #%d-%d", indexpath.section, indexpath.row]; uinavigationcontroller *navigationcontroller = self.menucontainerviewcontroller.centerviewcontroller; nsarray *controllers = [nsarray arraywithobject:democontroller]; navigationcontroller.viewcontrollers = controllers; [self.menucontainerview...

validation - Change Struts Validator default messages -

i new in struts2 . have created xml file validations, when test form don't error messages configured in xml file. instead struts 2 defaults messages such 1 : invalid field value field "capteur.energie_capteur". is there anyway make struts2 prints messages configured in xml file instead of default ones ? that not validation error message, conversion error message. you can override default conversion error message each single object, creating entry in global .properties file, described in struts 2 documentation, type conversion errors handling : by default, conversion errors reported using generic i18n key xwork.default.invalid.fieldvalue , can override (the default text invalid field value field "xxx" , xxx field name) in global i18n resource bundle. however, may wish override message on per-field basis. can adding i18n key associated action (action.properties) using pattern invalid.fieldvalue.xxx , xxx field name. i...

Any API or Web UI project to manage a Docker private registry? -

i can't find how manage images in private registry. can push or pull image because know id how list of pushed images ? take example person wants see available images under private registry of organization. how can ? unless i'm mistaken, can't find api or web ui discover registry content index.docker.io public registry. are there open source projects manage ? thanks. are there open source projects manage ? there containerized web application provides administration of one-to-many private registries. name docker registry ui , foss. the source on github , can run in container so: docker run -p 8080:8080 -v my_data_dir:/var/lib/h2/ atcol/docker-registry-ui disclaimer: wrote web-app not find 1 myself. believe answers question (as quoted).

ColdFusion and Oracle SQL Injection Example -

assuming coldfusion 10,0,13,287689 , oracle database 11g enterprise edition release 11.2.0.2.0 - 64bit production. with example... <cfquery name="q" datasource="ds"> update sometable set #form.col#label = <cfqueryparam cfsqltype="cf_sql_varchar" value="#x#"> id = <cfqueryparam cfsqltype="cf_sql_decimal" value="#id#"> </cfquery> also assuming there no data validation checking on #form.col# , how exploited? cause query fail invalid column, don't see way more malicious done since multiple statements cannot ran in single <cfquery> . not work... #form.col#: id = 1; delete users; --comment else out... i'm aware selects it's easier exploit using unions data you're not authorized see, i'm curious specific update statement. whilst traditional example sql injection involves sequential sql statements, simple example used highlight issue - if unprotect...

html - How to control the positions, layouts and fonts when there is an error and Response.Write(ex.Message) triggers? -

code below: .body { -webkit-font-smoothing: antialiased; font-size: 12px; line-height: 1.5; font-style: normal; font-variant: normal; font-weight: normal; font-family: "lucida grnde", "lucida sans unicode", helvetica, arial, verdana, sans-serif; margin-top: 0px; } .jumbotron { position:absolute; top: 10%; left: 50%; width:70em; height:auto; margin-top:auto; /*set negative number 1/2 of height*/ margin-left:-35em; /*set negative number 1/2 of width*/ border: 1px solid #ccc; background-color: #f3f3f3; display:block; } .detailview { top:0%; left:0%; width: 70em; height: auto; margin-top: auto; margin-left: auto; display:block; ...

ibm mobilefirst - Worklight JSONStore rejecting some user passwords and not others -

got weird 1 here. jsonstore in worklight 6.1.0.01 on ios 7.1 seems arbitrarily rejecting passwords. here's code using initialize jsonstore: var bitarray = sjcl.hash.sha256.hash(username + ':'+ password); var digest_sha256 = (sjcl.codec.hex.frombits(bitarray)); options.username = username options.password = digest_sha256; options.localkeygen = true; options.clear = false; collections[this.collection1] = collection1; collections[this.collection2] = collection2; collections[this.collection3] = collection3; wl.jsonstore.init(collections, options).then(function() { onsuccess(); }).fail(function(errorobject) { onfailure(); }); i've got user: ad1tst password: output of sha256 hash user b5de1dfbbd09c5f8cf78d858eb4ed09e3b9826f9c35c950d164e8accf7775082 using hash password, user can initialize database. i've got user ad2tst password: output of sha256 has user 607c04ef944b36ec939d39f7c6b24757776918b8425e5a3b912738d6dea0ebea using hash password us...

javascript - Hiding a <div> and showing a new one in the same spot? -

lets have 2 divs, 1 hidden, other showing. when button clicked, want use jquery fade effect fade out 1 div , fade in hidden div. so - <div id="part1">hello</div> <div id="part2" style="display: none">hello2!</div> <button id="btn1">click here!</button> and js - $("#btn1").on("click", function(){ $("#part1").fadetoggle(); $("#part2").fadetoggle(); }); now, works, can imagine happens first hides 1st div, shows second div, , takes second div place previous div located. what can this? want them stay in same position (something have here http://kenwheeler.github.io/slick/ in fade demo.) thanks! one solution using absolute positioning on both divs relative container. #parts-container { position: relative; } #part1, #part2 { position: absolute; left: 0; top: 0; }

c++ - Does std::unordered_multimap's bucket only contain elements with equivalent keys -

on www.cplusplus.com, states following unordered_multimap, elements equivalent keys grouped in same bucket , in such way iterator (see equal_range) can iterate through of them. i know cannot infer statement, i'd know if given bucket only contains elements equivalent keys? here pertinent requirements: [c++11: 23.2.5/5]: 2 values k1 , k2 of type key considered equivalent if container’s key_equal function object returns true when passed values. if k1 , k2 equivalent, hash function shall return same value both. [..] [c++11: 23.2.5/8]: elements of unordered associative container organized buckets. keys same hash code appear in same bucket. [..] there nothing prohibiting all elements key hash a , all elements key hash b being stored in same bucket. standard library implementation use whether or not fact used. no standard wording exists make explicit; it's defined omission.

asp.net - Fields erased in post -

i developing application in asp.net fields. have "name" field empty, request filled. when user clicks "record" button asp button, field cleared every time after validation. not want validate javascript. how cancel procedure , leave populated after validation without having repopulate field validated? i'm not using asp textbox. i'm using inputs type text. make input box serverside <asp:textbox id="tbxname" runat="server" /> instead of regular html <input> box. boxes cleared after postback because not server side , viewstate wont save properties when postback occurs.

javascript - Track last ajax call of website -

i know bit stupid question bit meaningless still wanted know there way track last ajax call on page. actually issue developed application works ajax , many ajax calls happening different different actions if no ajax request call 10 mins. expire session don't want on ajax call. what want if no activity happens in 10 mins. don't wanna if click or keyboard activity happens make 1 more ajax in after 10 mins. of click session not expire. but that's not issue write script issue i've lots of page , lots of different ajax call's want track last ajax call time on page. i don't know if there's possible way or not didn't write code yet if possible i'll start writing script otherwise i'll find way appreciate if suggest me way it. thanks you can use ajaxsetup , increment variable in ajaxsetup . because ajaxsetup call in every ajax call see documentation of ajaxsetup http://api.jquery.com/jquery.ajaxsetup/

angularjs - why checkbox is showing always false value -

i have html structure this <div ng-controller="parentctrl"> <div ng-controller="childctrl"> <input ng-model="selectall" id="selectall" type="checkbox" ng-click="selectallchange()"></div> </div> </div> here js code function parentctrl($scope) { $scope.selectall = false; $scope.selectallchange = function() { if($scope.selectall){ console.log('ttt'); } else console.log('fff'); } } on click of checkbox whether checked or not, in console getting fff how know checkbox checked or not in situation? in code, ng-model binds childctrl 's scope, code inside parentctrl accessing scope created parentctrl . you try this instead of $scope scope triggering function: if(this.selectall){ and use ng-change instead. ng-change="selectallchange()" click ...

android - Add space to top and bottom of GridView -

Image
i add space top , bottom of gridview, similar header/footer wanted support spaces , nothing else. currently using top/bottom padding, when scrolled content cropped in padding part. what's simplest solution this? thanks! instead of using paddings (which add space inside view), use margins (which add space ouside view): add android:layout_margintop="40dp" android:layout_marginbottom="40dp" to gridview (or different value) [edit] as per op's clarification: "spaces" must fixed , gridview scrollable. therefore i'm designing (by setting pair of anchored textviews act fixed header , footer): <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" android:padding="8dp" > <!-- header --> <text...

php - Is there any way to rebuild automatically the zend manifest (.zfproject.xml) before deploy? -

in zend framework project, creating , deleting actions, controllers , other components using zf command line tools produce manifest file (.zfproject.xml), doesn't map real set of action, controller, etc... , final application has. is there way reproduce .zfproject.xml before application's deploy? i'm asking it, in order have application state correctly mapped in manifest, permits me use (when need it) zend tool script.

html - Creating a server / service client -

i have been developing app has access db , return data has charts in web page. since added software had create local server / servce, using self host web api, returning data json can read in html file , create charts. the server / service works, problem remains on client. don't know if have create project html or if add folder html , css , javascript. basically when run have display html file. i have been looking web examples / solutions can't seem find 1 me, i've checked: creating pages t4, includes css , js files in html , when want change have remove include, debug , include again; create web app when run it creates me 2 servers, 1 i've created , web page server, although web page access using angularjs, can't have second server; i'm little lost on how it. can give me help? i'm using vs2010, self-host webapi, console app, entity framework, angularjs, nvd3 , d3. thk if have developed project using mvc4 can create view/contro...

c# - Constructing a linq query to get associations -

i have 2 tables, category , productcategory. a product can have multiple categories: category categoryid categoryname 1               electronics      2               e-reader      3               tablet      productcategory categoryid productid 1               100      2               100      3               100      3             ...

javascript - "Save link as" Event -

suppose on web page, there's link lets user download current state of application in file format so: <a href="example.com/download/url" id="download-link">download</a> i can listen click event , make sure recent state pushed server before download request made, so: $('#download-link').on('click', function(event) { event.preventdefault(); pushstatetoserver().done(function(){ window.location.href = event.target.href; }); }); this, however, not work if user right clicks link , selects "save link as". is there way me catch event? no, i'm pretty sure there no way can achieve this. the thing can catch contextmenu when right-click on link, there isn't way find out link in context menu clicked. this close you're gonna get. $('#download-link').on('contextmenu', function(event) { ... });

linux - libusb1 fails do_configure task with "udev support requested but libudev not installed" -

i'm trying build yocto image. i'm running ubuntu 12.04. i've installed packages link above recommends (and more) i cloned poky git repository, , checked out daisy-11.0.0 tag. conf/local.conf has machine=qemux86 , other settings default. i tweaked # of threads bitbake , make. bitbake -k core-image-minimal i following error during do_configure task of libusb1_1.0.18.bb: configure: error: "udev support requested libudev not installed" libudev-dev installed. this seems strange me because i'm using plain vanilla no frills setup. does know how resolve configure error? i'm not 100% sure on-topic so. please direct me proper place if before closing. you should repo sync , has been solved , pushed today (20 may 2014)

ios - Download the Media (mp3) presented by the UIWebView in fullscreen -

Image
so working on piece of code helps user in downloading mp3 files uiwebview. far has been working detecting last path component of view's url. (www.exampledownload.com/file.mp3). in cases absolute url doesn't finish in .mp3. uiwebview knows mp3 , opens on mediaplayer (as shown in attached screenshots). i've tested mp3 download apps out there , able detect mp3 , download it. want know how detect file webview trying open. download protocol stablished. need actual download url of files. attach screenshots make myself more clear. i've seen other apps in modify default media player, , webview shows mediaplayer button besides de normal playback buttons. (the download button) know how can done. thanks! you can intercept url in webview:shouldstartloadwithrequest:navigationtype: , check if mp3 , return no , whatever want file.

javascript - Non-ajax post using Dropzone.js -

i'm wondering if there's way make dropzone.js ( http://dropzonejs.com ) work standard browser post instead of ajax. some way inject inputs type=file in dom right before submit maybe? no. cannot manually set value of <input type='file'> security reasons. when use javascript drag , drop features you're surpassing file input altogether. once file fetched user's computer way submit file server via ajax. workarounds: instead serialize file or otherwise stringify , append form string, , unserialize on server side. var base64image; var reader = new filereader(); reader.addeventlistener("load", function () { base64image = reader.result; // append base64 encoded image form , submit }, false); reader.readasdataurl(file); perhaps you're using dropzone.js because file inputs ugly , hard style? if case, dropzone.js alternative may work you. allows create custom styled inputs can submitted form. supports drag , drop too, dra...

How to use certain parts of a JSON and put it in an alert (Plain Javascript) -

i bookmarklet when click on it, goes json , grabs "temp" there, , puts alert tell me weather click of button. there way it? or have use different api? this i've far: function insertreply(content) { document.getelementbyid('output').innerhtml = content; } var script = document.createelement('script'); script.src = 'http://api.openweathermap.org/data/2.5/find?q=australia,wa&mode=json'; document.body.appendchild(script); sure. first, realize that api seems support jsonp. is, if provide callback parameter, wrap response <callback>(...) <callback> value of callback parameter. means use url: http://api.openweathermap.org/data/2.5/find?q=australia,wa&mode=json&callback=insertreply and insertreply function provided appropriate object. then, if want grab temp out of it, use content object: document.getelementbyid('output').innerhtml = content.list[0].main.temp;

dom - Target is null error in browser dev tools -

i trying insert newly created elements (rows , cells) table (via javascript) above row has id of "dynpop". when attempt this, following error typeerror: target null here html of table... <table> <tr id="dynpop"> <td style="color:white"> blah blah blah blah blah </td> </tr> </table> and here code insert new row , cell before it... $rownumber = 1; var target = document.getelementbyid('dynpop'); //populate member table chapter image row var $chap_image = $out[1]; var olr1 = document.createelement('tr'); var old1 = document.createelement('td'); var olt1 = document.createtextnode($chap_image); old1.appendchild(olt1); olr1.appendchild(old1); $rowname = 'row' + $rownumber; olr1.setattribute('name', $rowname); target.insertbefore(olr1, target); $rownumber++; any thoughts why javascript code not working ? thanks! i"m not sure without seei...

grails - How to make GORM create an index on Map? -

in grails 2.3.7 project, have product domain class, this: class product { string code string description map attributes static constraints = { code(unique: true) } static mapping = { code index: 'code_idx' attributes fetch: 'join' cache true id generator: 'hilo' } } it translates database: create table product (id bigint not null, version bigint not null, code varchar(255) not null unique, description varchar(255) not null, primary key (id)); create table product_attributes (attributes bigint, attributes_idx varchar(255), attributes_elt varchar(255) not null); create index code_idx on product (code); with 4000 products in database, scaffold listing shows them fine. except, when click "sort" on code - because there no index - server this: explain select this_.id id14_0_, this_.version version14_0_, this_.code code14_0_, this_.description descript4_14_0_, attributes2_...

javascript - How to store a flag in a cookie where the flag is true only if a form has been completed? -

how store flag in cookie flag true if form has been completed? i have sidebar contains form, when submitted fades form , display message using 1 of user inputs. this sidebar form present on number of pages on website. in order identify if form has been completed on page believe can use flag variable define whether true or false , display form or message depending on stored value. i have never used cookies medium store value , not know correct syntax them. can make cookie when formsubmit successful. , on every page have script in header read either display form or not. is best way go this? , format , correct syntax identify this? html <div id="sidebarf"> <form id="sidebarform" onsubmit="return false" method="post" name="myform" autocomplete="off" > <input type="text" name="name" id="username" placeholder="name (eg. rob james)" value="" required...

html - css position fixed to a location within an area -

Image
i making list of products in shop website using asp.net , html. items showing alright, don't of button being misaligned depending on prodcut name length. i trying keep details button fixed @ bottom regardless, box on product 1,3 , , 5. other products' names push text down. these css in question. #gamecatalogue { list-style-type:none; } #gamecatalogue li { /* http://blog.mozilla.org/webdev/2009/02/20/cross-browser-inline-block/ */ width: 200px; min-height: 320px; border: 1px solid #000; display: -moz-inline-stack; display: inline-block; vertical-align: top; margin: 5px; zoom: 1; *display: inline; _height: 250px; border-radius: 7px; } .detailsbuttom{ position: relative; top: 25px; /* tried, vertical-height, alignment, position fixed, absolute, messed around z-index, moving items in different locations through li containter. } and output html (for 1 item) ...

javascript - Real Time Progress Bars -

hey want have real time progress bar while loading webpage on website. progress bar should show how actually page has been loaded . searched lot this. found various links show how same asp.net website. won't use it. there ways use images or javascript files approximate web page loaded this but there way can tell how of webpage loaded , update progress bar? (the webpage contain external files,stylesheets, javascript files , images) thanx in advance! take @ pace.js include pace.js , theme css of choice on page (as possible), , you're done! pace automatically monitor ajax requests, event loop lag, document ready state, , elements on page decide progress. on ajax navigation begin again! http://github.hubspot.com/pace/

ruby on rails - Openshift 500 internal server error -

after deployment rails application (the app works fine on local machine), getting 500 internal server error, not know wrong. ran rhc tail -a appname generate following logs: [ pid=422497 thr=12099720 file=utils.rb:176 time=2014-05-18 08:19:34.762 ]: *** exception runtimeerror in rack application object (missing `secret_key _base` 'production' environment, set value in `config/secrets.yml`) (process 422497, thread #<thread:0x00000001714110>): /var/lib/openshift/537858e95004463ce80005be/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application.rb:4 40:in `validate_secret_key_config!' /var/lib/openshift/537858e95004463ce80005be/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application.rb:1 95:in `env_config' /var/lib/openshift/537858e95004463ce80005be/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:510:in `call' /var/lib/ope...

javascript - Why can't I set "style" directly -

Image
let's suppose have <div> . set style color:red . <div style="color:red">text</div> why can't set style through javascript so: document.getelementsbytagname("div")[0].style="color:blue"; but can set property of style: document.getelementsbytagname("div")[0].style.color="blue"; this dom model. js debug tool use? run in browser console: document.getelementsbytagname("div")[0].style this result: so, command returned object. this: document.getelementsbytagname("div")[0].style="color:blue"; you redefining object. not correct @ all. that's , can't it. if want have tool manage css properties better can use jquery : prop() function

category theory - In what way is Scala's Option fold a catamorphism? -

the answer this question suggests fold method on option in scala catamoprhism. wikipedia catamophism "the unique homomorphism initial algebra other algebra. concept has been applied functional programming folds". seems fair, leads me initial algebra initial object in category of f-algebras . so if fold on option catamophism there needs functor f, create category of f-algebras option initial object. can't figure out functor be. for lists of type a functor f f[x] = 1 + * x . makes sense because list recursive data type, if x list[a] above reads list of type a either empty list ( 1 ), or ( + ) pair ( * ) of a , list[a] . option isn't recursive. option[a] 1 + a (nothing or a ). don't see functor is. just clear realize option functor, in takes a option[a] , done lists different, a fixed , functor used describe how recursively construct data type. on related note, if not catamorphism shouldn't called fold, leads confusion . well, co...

php - Retrieve all data from database via ajax with no get or post request -

i don't know how fetch data no request, i've been googling seems request mandatory. in example want load data asynchronously. if database updated admin there's no need client refresh page. thanks in advance. results.php <?php $con=mysqli_connect("host","xxx","xxx","xxx"); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $result = mysqli_query($con,"select * pages"); while($row = mysqli_fetch_array($result)) { echo "<a href=" . $row['url'] . ">" . $row['url'] . "</a>"; echo "<br>"; } mysqli_close($con); ?> index.html <html> <script> function showlinks() { if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); ...

python - Receiving "role" and/or "affiliation" with message in SleekXMPP -

apologies amateur question. i'm learning python , i'm fumbling around xmpp bot script using xmpp. i have bot built using muc bot example sleekxmpp: http://sleekxmpp.com/getting_started/muc.html where bot differs example script creates sqlite database , on each group_message event, parses xml retrieve nick , message body text , write database timestamp. here part of bot that's recording msg output xmpp channel: def groupchat_message(self, msg): if msg['type'] in ('groupchat'): raw = str(msg) # save raw xml string in database debugging purposes timestamp = datetime.utcnow().strftime('%y-%m-%d %h:%m:%s') fromuser = str(msg['from']) # convert "from" attribute string can split author = fromuser.split('/')[1] # split "from" attribute remove channel address leaving nick behind body = msg['body'] msginsert = [timestamp, author, body, raw] # database i...

javascript - dc.js Tutorial Line Chart Render -

i'm following this tutorial on javascript library dc.js , having issue rendering line chart in tutorial. display , doesn't @ way should in tutorial. d3 , crossfilter parts of code seem talking each other since brushing functionality works, i'm wondering if don't have css referenced correctly. can view code viewing page source. i'm assuming simple i'm overlooking due being new css , javascript. in advance reading. your problem fill attribute on path svg element not set, it's defaulting black, giving black fill in middle. when open developer console in browser (using ie), error messages "css ignored due mime type mismatch." both dc.css , colorbrewer.css. github pain mime types, may want move these files elsewhere. the work-around fill go away (but not addressing css loading problem) adding line of code: d3.select(".line").attr("fill-opacity", 0); i hope helps!

java - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException : getting a SEVERE: null -

i'm new in programming , want filter data grouped rent date . error revenuebylocs bt_filteractionperformed severe: null com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'rent_date between '2013-01-01' , '2014-02-02' group rent_date, a.branch_id' @ line 1 @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:39) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:27) @ java.lang.reflect.constructor.newinstance(constructor.java:513) @ com.mysql.jdbc.util.handlenewinstance(util.java:411) @ com.mysql.jdbc.util.getinstance(util.java:386) @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:1052) @ com.mysql.jdbc.mysqlio.checkerrorpac...

matrix - Eigenvalues of huge matrices -

i have 2 50,000 x 50,000 symmetric real matrices , b (double precision) non-sparse (55% non-zero). b positive-definite. i have generalized eigenproblem: v = µ b v i need find 3 - 4 of smallest algebraic eigenvalues (and if possible associated eigenvectors). do have still options left compute them on average computer 12 gb of ram? any suggestions can either try without effort or work. thanks! your options use out-of-core solvers. here scalapack reference: http://www.netlib.org/scalapack/prototype/readme.outofcore but have time this, isn't it? getting few eignenvalues can render problem feasible in reasonable amount of time, recommend estimate needed time before starting code.

Retrieve data from multiple excel file by using file path in the cell value -

i have excel file , wish auto retrieve data clicking button. i have stored file path in b11 b13. my code below: sub fetchdata() dim wbsource workbook dim shsource worksheet dim shdestin worksheet application.screenupdating = false workbooks.open filename:="c:\users\corporate quality\desktop\test\new microsoft excel worksheet" & sheets("sheet1").range("b3") set wbsource = activeworkbook set shsource = wbsource.sheets("sheet1") set shdestin = thisworkbook.sheets("sheet1") shdestin.range("e11") = shsource.range("a2") wbsource.close false end sub is there possible change workbooks.open filename:= "c:\users\corporate quality\desktop\test\new microsoft excel worksheet" b11:b13 ? i don't know what's in b11:b13 can concatenate values in same way doing b3. example, filename := range("b11").value & range("b12").value & range("b13").value ...

java - Regex positive look behind for regex reverse matching? -

how can match string literal reverse direction match string literal above it? basically match "match" behind , match "here:" match "here:" end of string (to delete) -- input -- keep here: match test test should deleted -- expected output (after match , delete) -- keep demo you don't need make movement, need find "here:" , ensure string contains "match" after (if not case, pattern fail): (?s)here:.*?match.* (?s) dot can match newlines however, if possible, obtain better performances using indexof method "match" , "here:", comparing result , cuting string @ index of "here:"

artificial intelligence - Exact Hidden Markov Model training algorithm -

in cases, baum-welch algorithm used train hidden markov model. in many papers however, argued bw algorithm optimize until got stuck in local optimum. does there exist exact algorithm succeeds in finding global optimum (except enumerating possible models , evaluating them)? of course applications, bw work fine. interested in finding lower bounds of amount of information loss when reducing number of states. therefore need generate best model possible. we looking efficient np-hard algorithm (that enumerates on (potentially) exponential number of extreme points) , not on discretized number of floating points each probability in model. a quick search finds in http://www.cs.tau.ac.il/~rshamir/algmb/98/scribe/html/lec06/node6.html "in case, problem of finding optimal set of parameters $\theta^{\ast}$ known np-complete. baum-welch algorithm [2], special case of em technique (expectation , maximization), can used heuristically finding solution problem. " therefor...

sql - foreign key database help needed -

i'm not sure how title question, here situation. i have 3 sql tables follows: one lookup table lists names of adjectives along number (primary key value) associated each adjective. one object table connects other tables outside situation need with. and 1 table connects object table adjectives lookup table. connecting table has 3 foreign keys. 1 connects primary key of lookup table, , 1 connects reference key in object table. if wanted waste disk space redundant database entries, wouldn't here asking help, because example: in lookup table, have following rows of values: 1,"sweet" 2,"bitter" 3,"sour" in object table, have primary key representing object, field object name, , reference key represent adjectives object. now, assume has 2 row these values: row 1: (primary key 1,"raspberry",reference key value 1), row 2: (primary key 2,"strawberry",reference key value 4). let's first step make raspberry ...

How to find JavaScript functions in a JavaScript (.js) file command line? -

i'm looking way top level functions, properties , methods defined in .js file without browser, preferably in command line. have looked esprima parser , escope seems overkill really. i've seen other questions here asking similar questions, i'm looking solution not using browser(without window object), using rhino javascript engine. is there simple way achieve without using javascript parser?

How to search images from private 1.0 registry in docker? -

i made private registry,curl xx.xx.xx.xx:5000 ok. push image docker private registry doing: docker push xx.xx.xx.xx:5000/centos return: http://xx.xx.xx.xx:5000/v1/repositories/centos/tags/latest the question how images registry web or command whatever. cant find information docker registry api. 1 helps ? :) as of v 0.7.0 of private registry can do: $ curl -x http://localhost:5000/v1/search?q=postgresql and json payload: {"num_results": 1, "query": "postgresql", "results": [{"description": "", "name": "library/postgresql"}]} to give more background here how started registry: docker run \ -e settings_flavor=local \ -e storage_path=/registry \ -e search_backend=sqlalchemy \ -e loglevel=debug \ -p 5000:5000 \ registry