Search Results

Search found 2562 results on 103 pages for 'angularjs ng repeat'.

Page 12/103 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • How to use use external js in typescript

    - by Krishan
    I Generate the Angular JS code through the Typescript code. In one situation, I need to add external JS file to my typescript file and need to access the classes in the js file. I add that js file like this. /// <amd-dependency path="../../vendor/tweenMax.js" /> But still the typescript file can not identify the objects of that javascript file. If someone knows the suitable way, please add your answer. (I'm using min. js file)

    Read the article

  • Yeoman 'grunt test' fails on clean project with 'port already in use'

    - by XMLilley
    With: Mac OS 10.8.4 Node 0.10.12 npm 1.3.1 grunt-cli 0.1.9 yo 1.0.0-rc.1 bower 0.9.2 [email protected] I encounter the following error with a clean yo angular project, followed by grunt server then grunt test: Running "connect:test" (connect) task Fatal error: Port 9000 is already in use by another process. I'm new to Yeoman and am stumped. I've deleted my original project and created a new one in a fresh folder just to make sure I wasn't overlooking any invisible configs. I restarted the machine to make sure I wasn't running any temporary server processes I had forgotten about. After all attempts, the basic server starts fine, attaches to Chrome, and the watcher updates the browser on any changes. (Notably, the server is running on 9000, which seems odd for the test-runner to also be trying to use 9000.) But I get that same error on attempting to start the test runner. Is this something I can fix, or an issue I should report to the Yeoman team? Thanks.

    Read the article

  • making a password-only auth with bcrypt and mongoose

    - by user3081123
    I want to create service that let you login only with password. You type a password and if this password exists - you are logged in and if it's not - username is generated and password is encrypted. I'm having some misunderstandings and hope someone would help me to show where I'm mistaken. I guess, it would look somewhat like this in agularjs First we receive a password in login controller. $scope.signup = function() { var user = { password: $scope.password, }; $http.post('/auth/signup', user); }; Send it via http.post and get in in our node server file. We are provided with a compare password bcrypt function userSchema.methods.comparePassword = function(candidatePassword, cb) { bcrypt.compare(candidatePassword, this.password, function(err, isMatch) { if (err) return cb(err); cb(null, isMatch); }); }; So right now we are creating function to catch our http request app.post('/auth/signup', function(req, res, next) { Inside we use a compair password function to realize if such password exists or not yet. So we have to encrypt a password with bcrypt to make a comparison First we hash it same way as in .pre var encPass; bcrypt.genSalt(10, function(err, salt) { if (err) return next(err); bcrypt.hash(req.body.password, salt, function(err, hash) { if (err) return next(err); encPass=hash; )}; )}; We have encrypted password stored in encPass so now we follow to finding a user in database with this password User.findOne({ password: encPass }, function(err, user) { if (user) { //user exists, it means we should pass an ID of this user to a controller to display it in a view. I don't know how. res.send({user.name}) //like this? How should controller receive this? With $http.post? } else { and now if user doesn't exist - we should create it with user ID generated by my function var nUser = new User({ name: generId(), password: req.body.password }); nUser.save(function(err) { if (err) return next(err); )}; )}; )}; Am I doing anything right? I'm pretty new to js and angular. If so - how do I throw a username back at controller? If someone is interested - this service exists for 100+ symbol passphrases so possibility of entering same passphrase as someone else is miserable. And yeah, If someone logged in under 123 password - the other guy will log in as same user if he entered 123 password, but hey, you are warned to make a big passphrase. So I'm confident about the idea and I only need a help with understanding and realization.

    Read the article

  • Angular.js: value() not injected in config()

    - by Nik
    I am having trouble getting the value() injected into the app.config(). Here's the code (coffeescript) window.app = angular.module("app", []) app.value("template_path", "assets/angular/templates/users") app.config(["$routeProvider","template_path" ($routeProvider, template_path) -> console.log template_path it is throwing an "Unknown provider: template_path from app" error Could it be that the config() method cannot be injected with value() set values? I am using 1.0.2 Thank you!

    Read the article

  • How to hide an element after $compile?

    - by Miron
    How to hide directive generated html after inserting it to body? Directive has "replace" set to trueThere is a directive: .directive('location', function () { return { restrict : 'A', scope : {}, replace : true, templateUrl: 'common/components/location/location.html', link : function (scope, element, attr) {……} } }); So it is used in another directive: var scope = $rootScope.$new(true); var directive = $compile('<div location></div>')(scope); $document.find('body').append(directive); directive.hide(); - not working How to hide directive generated html after inserting it to body? Directive has "replace" set to true

    Read the article

  • Loading a view routed by a URL parameter (e.g., /users/:id) in MEAN stack

    - by Matt Rowles
    I am having difficulties with trying to load a user by their id, for some reason my http.get call isn't hitting my controller. I get the following error in the browser console: TypeError: undefined is not a function at new <anonymous> (http://localhost:9000/scripts/controllers/users.js:10:8) Update I've fixed my code up as per comments below, but now my code just enters an infinite loop in the angular users controllers (see code below). I am using the Angular Express Generator for reference Backend - nodejs, express, mongo routes.js: // not sure if this is required, but have used it before? app.param('username', users.show); app.route('/api/users/:username') .get(users.show); controller.js: // This never gets hit exports.show = function (req, res, next, username) { User.findOne({ username: username }) .exec(function (err, user) { req.user = user; res.json(req.user || null); }); }; Frontend - angular app.js: $routeProvider .when('/users/:username', { templateUrl: function( params ){ return 'users/view/' + params.username; }, controller: 'UsersCtrl' }) services/user.js: angular.module('app') .factory('User', function ($resource) { return $resource('/api/users/:username', { username: '@username' }, { update: { method: 'PUT', params: {} }, get: { method: 'GET', params: { username:'username' } } }); }); controllers/users.js: angular.module('app') .controller('UsersCtrl', ['$scope', '$http', '$routeParams', '$route', 'User', function ($scope, $http, $routeParams, $route, User) { // this returns the error above $http.get( '/api/users/' + $routeParams.username ) .success(function( user ) { $scope.user = user; }) .error(function( err) { console.log( err ); }); }]); If it helps, I'm using this setup

    Read the article

  • What happens with $q.all() when some calls work and others fail?

    - by Alan
    What happens with $q.all() when some calls work and others fail? I have the following code: var entityIdColumn = $scope.entityType.toLowerCase() + 'Id'; var requests = $scope.grid.data .filter(function (rowData, i) { return !angular.equals(rowData, $scope.grid.backup[i]); }) .map(function (rowData, i) { var entityId = rowData[entityIdColumn]; return $http.put('/api/' + $scope.entityType + '/' + entityId, rowData); }); $q.all(requests).then(function (allResponses) { //if all the requests succeeded, this will be called, and $q.all will get an //array of all their responses. console.log(allResponses[0].data); }, function (error) { //This will be called if $q.all finds any of the requests erroring. var abc = error; var def = 99; }); When all of the $http calls work then the allResponses array is filled with data. When one fails the it's my understanding that the second function will be called and the error variable given details. However can someone help explain to me what happens if some of the responses work and others fail?

    Read the article

  • ruby regex, parsing html

    - by danwoods
    Hello all, I'm trying to parse some returned html to look for currently playing movies. The pattern I'm trying to match looks like: <span dir=ltr>Clash of the Titans</span> Of which there are several in the returned html. (the html is huge, I've posted a sample at the bottom) I'm trying get an array of the movie titles with the following command: titles = listings_html.split(/(<span dir=ltr>).*(<\/span>)/) But I'm not getting the results I'm expecting. Can anyone see a problem with my approach or regex? Returned html (I believe the 'markdown'formating will render the some of the html, but this is just an example): <script>window.gbar={};(function(){function h(a,b,d){var c="on"+b;if(a.addEventListener)a.addEventListener(b,d,false);else if(a.attachEvent)a.attachEvent(c,d);else{var f=a[c];a[c]=function(){var e=f.apply(this,arguments),g=d.apply(this,arguments);return e==undefined?g:g==undefined?e:g&&e}}};var i=window.gbar,k,l,m;function n(a){var b=window.encodeURIComponent&&(document.forms[0].q||"").value;if(b)a.href=a.href.replace(/([?&])q=[^&]*|$/,function(d,c){return(c||"&")+"q="+encodeURIComponent(b)})}i.qs=n;function o(a,b,d,c,f,e){var g=document.getElementById(a);if(g){var j=g.style;j.left=c?"auto":b+"px";j.right=c?b+"px":"auto";j.top=d+"px";j.visibility=l?"hidden":"visible";if(f&&e){j.width=f+"px";j.height=e+"px"}else{o(k,b,d,c,g.offsetWidth,g.offsetHeight);l=l?"":a}}}i.tg=function(a){a=a||window.event;var b,d=a.target||a.srcElement;a.cancelBubble=true;if(k!=null)p(d);else{b=document.createElement(Array.every||window.createPopup?"iframe":"div");b.frameBorder="0";k=b.id="gbs";b.src="javascript:''";d.parentNode.appendChild(b);h(document,"click",i.close);p(d);i.alld&&i.alld(function(){var c=document.getElementById("gbli");if(c){var f=c.parentNode;q(f,c);var e=c.prevSibling;f.removeChild(c);i.removeExtraDelimiters(f,e);b.style.height=f.offsetHeight+"px"}})}};function r(a){var b,d=document.defaultView;if(d&&d.getComputedStyle){if(a=d.getComputedStyle(a,""))b=a.direction}else b=a.currentStyle?a.currentStyle.direction:a.style.direction;return b=="rtl"}function p(a){var b=0;if(a.className!="gb3")a=a.parentNode;var d=a.getAttribute("aria-owns")||"gbi",c=a.offsetWidth,f=a.offsetTop>20?46:24,e=false;do b+=a.offsetLeft||0;while(a=a.offsetParent);a=(document.documentElement.clientWidth||document.body.clientWidth)-b-c;c=r(document.body);if(d=="gbi"){var g=document.getElementById("gbi");q(g,document.getElementById("gbli")||g.firstChild);if(c){b=a;e=true}}else if(!c){b=a;e=true}l!=d&&i.close();o(d,b,f,e)}i.close=function(){l&&o(l,0,0)};function s(a,b,d){if(!m){m="gb2";if(i.alld){var c=i.findClassName(a);if(c)m=c}}a.insertBefore(b,d).className=m}function q(a,b){for(var d,c=window.navExtra;c&&(d=c.pop());)s(a,d,b)}i.addLink=function(a,b,d){if((b=document.getElementById(b))&&a){a.className="gb4";var c=document.createElement("span");c.appendChild(a);c.appendChild(document.createTextNode(" | "));c.id=d;b.appendChild(c)}}})();if(!window.google)window.google={};if(!window.google.movies)window.google.movies={};window.google.movies.registerFixdir=function(){var c="[\u0000- !-@[-{-\u00bf\u00d7\u00f7\u02b9-\u02ff\u2000-\u2bff]",g=new RegExp("^"+c+"([0-9]"+c+"$|[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u2c00-\ufb1c\ufdfe-\ufe6f\ufefd-\uffff])"),h=new RegExp("^"+c+"$");function e(d,a){if(!a)a=d&&d.target?d.target:window.event.srcElement;a.dir=g.test(a.value)?"ltr":(h.test(a.value)?"":"rtl")} var i=[document.getElementsByName("q")[0],document.getElementById("mtq")];for(var f=0,b;b=i[f];f++)if(b){b.onkeyup=e;e(null,b)}}; Movie Showtimes - Google Search.fl:link{}a:link,.w,a.w:link,.w a:link{color:#00c}a:visited{color:#551a8b}a:active{color:red}.t a:link,.t a:active,.t a:visited,.t{color:#000}.left{width:12em}.box{background:#fff}.nopadding{padding:0}.k{background:#36c}.z{display:none}.x{width:3em}.y{width:23em}.b{color:#00c;font-size:12pt;font-weight:bold}.i,.i:link{color:#a90a08}.n a{color:#000;font-size:10pt}.n .b a{color:#00c}.n .i{font-size:10pt;font-weight:bold}.h{cursor:pointer}body{background:#fff;font:82% Arial,Helvetica,sans-serif;margin:3px 0 0;padding:0}table{border-collapse:collapse;border-spacing:0}img{border:0}td,th{vertical-align:top}h1,h2{font-size:100%;margin:0}a{color:#00c}/ CSS for page */#title_bar{background:#f0f7f9;border-top:1px solid #6b90da;padding-bottom:4px;padding-left:8px;padding-top:4px}#google_bar{margin:3px 10px}#search_form{margin:3px 10px}#left_nav{border-right:1px solid #c9d7f1;margin-top:11px;position:absolute;left:9px;width:13.4em}#left_nav .section{margin-bottom:1.2em}.hidden{visibility:hidden}#results{height:auto !important;height:350px;margin-left:15em;min-height:350px;min-width:800px;width:expression(document.body.clientWidth<1000?"800px":"99.9%")}.name{font-size:124%;margin:0}.times{clear:both;margin:0}.address{margin:0}#movie_results{overflow:auto}.movie_results{margin-top:11px}.movie{clear:both;margin-bottom:40px}.movie .header{padding-left:8px}.movie .img{border:1px solid #ccc;float:left;margin-bottom:10px}.movie .desc{margin-bottom:15px;max-width:42em}.movie h2{font-size:124%;margin-bottom:2px}.movie .info{margin-bottom:10px}.movie .syn{margin-bottom:10px}.movie .section_title{background:#f0f7f9;clear:both;font-size:108%;margin-bottom:11px;margin-top:11px;padding-bottom:4px;padding-left:8px;padding-top:5px}.movie .showtimes{margin-bottom:8px;padding-left:8px}.movie .show_left{width:49%}.movie .show_right{width:49%}.movie .theater{padding-bottom:15px}.theater{clear:both;padding-bottom:1px}.theater_after_icon{padding-left:25px}.theater .show_left{width:49%}.theater .show_right{width:49%}.theater h2{font-size:124%;margin-bottom:2px}.theater .icon{float:left;height:3em;margin-right:5px}.theater .closure{font-size:100%}.theater .info{font-size:100%;padding-bottom:5px;padding-top:5px}.theater .movie{margin-bottom:8px;margin-right:8px;max-width:42em}.theater .movie .desc{margin-bottom:5px;margin-left:0}.theater .movie .info{margin-top:0}.theater .showtimes{margin-bottom:40px;margin-top:8px}#theater_map{right:0;left:0;position:relative;top:0}#theater_static_map{border:1px solid #c9d7f1;margin:10px}.map_marker .name{margin-top:10px}.photo{border:1px solid #ccc;margin-bottom:20px;margin-left:8px}.show_left{float:left;margin:0;width:49.999%}.show_right{float:right;margin:0;width:50%}.show_more{clear:both;font-size:124%;margin:0}.show_more a{color:#77c}.reviews{margin-bottom:8px;padding-left:8px}.review{margin-bottom:5px}.review .publisher{color:green}.review .date{color:#6f6f6f}.trailer{margin-bottom:8px;padding-left:8px}.clear{clear:both}.iconA{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 0}.iconB{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -38px}.iconC{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -76px}.iconD{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -114px}.iconE{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -152px}.iconF{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -190px}.iconG{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -228px}.iconH{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -266px}.iconI{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -304px}.iconJ{background:url(http://maps.gstatic.com/mapfiles/red_icons_A_J.png) repeat 0 -342px}.iconK{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 0}.iconL{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -38px}.iconM{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -76px}.iconN{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -114px}.iconO{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -152px}.iconP{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -190px}.iconQ{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -228px}.iconR{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -266px}.iconS{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -304px}.iconT{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -342px}.iconU{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -380px}.iconV{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -418px}.iconW{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -456px}.iconX{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -494px}.iconY{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -532px}.iconZ{background:url(http://maps.gstatic.com/mapfiles/red_icons_K_Z.png) repeat 0 -570px}#gbar,#guser{font-size:13px;padding-top:1px !important}#gbar{float:left;height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbs,.gbm{background:#fff;left:0;position:absolute;text-align:left;visibility:hidden;z-index:1000}.gbm{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}.gb1{margin-right:.5em}.gb1,.gb3{zoom:1}.gb2{display:block;padding:.2em .5em;}.gb2,.gb3{text-decoration:none;border-bottom:none}a.gb1,a.gb2,a.gb3,a.gb4{color:#00c !important}.gbi .gb3,.gbi .gb2,.gbi .gb4{color:#dd8e27 !important}.gbf .gb3,.gbf .gb2,.gbf .gb4{color:#900 !important}a.gb2:hover{background:#36c;color:#fff !important}Web Images Videos Maps News Shopping Gmail more ▼Books Finance Translate Scholar Blogs YouTube Calendar Photos Documents Reader Sites Groups even more » [email protected] | Google Account settings | Sign out     Advanced Search  PreferencesShowtimes for Murfreesboro, TN 37130Change Location› Today › Tomorrow › Monday › Tuesday› Theaters › Movies› Show list view › Show map viewPremiere 6 Theater810 Northwest Broad Street, Murfreesboro, TN - (615) 896-4100Clash of the Titans? - 1hr 50min?? - Rated PG-13?? - Action/Adventure? - Trailer - IMDb2:10  4:15  6:15  8:20  10:25pmDiary of a Wimpy Kid? - 1hr 33min?? - Rated PG?? - Comedy/Drama? - Trailer - IMDb2:00  3:50  6:00  7:50  9:40pmHow to Train Your Dragon?1hr 38min?? - Rated PG?? - Family/Animation? - IMDb2:00  3:55  6:00  7:55  9:50pmThe Bounty Hunter? - 1hr 46min?? - Rated PG-13?? - Action/Adventure/Comedy/Romance? - Trailer - IMDb2:15  4:15  6:25  8:25  10:30pmThe Last Song? - 1hr 47min?? - Rated PG?? - Drama? - Trailer - IMDb2:20  4:15  6:30  8:35  10:35pmTyler Perry's Why Did I Get Married Too?2hr 1min?? - Rated PG-13?? - Comedy?2:20  4:35  7:30  9:45pmContinental Cinema 5450 US Highway 231 N, Troy, AL - (334) 808-4225Clash of the Titans 3D? - 1hr 50min?? - Rated PG-13?? - Action/Adventure? - IMDb1:00  4:00  7:00  9:30pmHow to Train Your Dragon 3D? - 1hr 38min?? - Rated PG?? - Family/Animation? - IMDb1:05  4:05  7:05  9:25pmThe Bounty Hunter? - 1hr 46min?? - Rated PG-13?? - Action/Adventure/Comedy/Romance? - Trailer - IMDb1:00  4:00  7:00  9:30pmThe Last Song? - 1hr 47min?? - Rated PG?? - Drama? - Trailer - IMDb1:05  4:05  7:05  9:25pmTyler Perry's Why Did I Get Married Too?2hr 1min?? - Rated PG-13?? - Comedy?12:55  3:55  6:55  9:35pmMall Cinema - Hartford KYUS Hwy 231 South 62 East, Hartford, KY - (270) 298-3315Clash of the Titans? - 1hr 50min?? - Rated PG-13?? - Action/Adventure? - Trailer - IMDb5:00  7:00  9:00pmHow to Train Your Dragon?1hr 38min?? - Rated PG?? - Family/Animation? - IMDb5:00  7:00  9:00pmCarmike Wynnsong 16 - Murfreesboro2626 Cason Square Boulevard, Murfreesboro, TN - (615) 893-2253The Last Song? - 1hr 47min?? - Rated PG?? - Drama? - Trailer - IMDb12:15  1:00  2:45  4:00  5:15  7:00  7:45 

    Read the article

  • how to solve this problem

    - by Surbir
    root@me-desktop:~# sudo apt-get install aircrack-ng Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: aircrack-ng 0 upgraded, 1 newly installed, 0 to remove and 446 not upgraded. 1 not fully installed or removed. Need to get 1,579kB of archives. After this operation, 2,843kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu/ maverick/universe aircrack-ng i386 1:1.1-1 [1,579kB] Fetched 1,579kB in 1min 9s (22.7kB/s) Selecting previously deselected package aircrack-ng. (Reading database ... 520739 files and directories currently installed.) Unpacking aircrack-ng (from .../aircrack-ng_1%3a1.1-1_i386.deb) ... Processing triggers for man-db ... Setting up linux-image-3.0.1-030001-generic (3.0.1-030001.201108060905) ... Running depmod. update-initramfs: Generating /boot/initrd.img-3.0.1-030001-generic Warning: No support for locale: en_US.utf8 Examining /etc/kernel/postinst.d. run-parts: executing /etc/kernel/postinst.d/dkms 3.0.1-030001-generic /boot/vmlinuz-3.0.1-030001-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.0.1-030001-generic /boot/vmlinuz-3.0.1-030001-generic run-parts: executing /etc/kernel/postinst.d/nvidia-common 3.0.1-030001-generic /boot/vmlinuz-3.0.1-030001-generic run-parts: executing /etc/kernel/postinst.d/pm-utils 3.0.1-030001-generic /boot/vmlinuz-3.0.1-030001-generic run-parts: executing /etc/kernel/postinst.d/update-notifier 3.0.1-030001-generic /boot/vmlinuz-3.0.1-030001-generic run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.0.1-030001-generic /boot/vmlinuz-3.0.1-030001-generic exec: 15: update-grub: not found run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2 Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.0.1-030001-generic.postinst line 1010. dpkg: error processing linux-image-3.0.1-030001-generic (--configure): subprocess installed post-installation script returned error exit status 2 Setting up aircrack-ng (1:1.1-1) ... Errors were encountered while processing: linux-image-3.0.1-030001-generic E: Sub-process /usr/bin/dpkg returned an error code (1) root@me-desktop:~#

    Read the article

  • Is there an application that can help someone create an XML document based on the Relax NG schema?

    - by meowsqueak
    I've spent a bit of time creating a Relax NG schema for use within our team to validate XML documents we use for exchanging information. The schema is not complicated, but it is reasonably large. I am wondering if there exists a tool that can read in such a Relax NG schema and assist a user in creating a corresponding instance document, using the schema as a template. Perhaps an application with a GUI that creates fields and drop-down selections for each part of the document? For example, the tool might create an outline XML document and prompt the user to select multiples of certain elements, fill in each field, perhaps with permitted values read directly from the schema. It might also show the user via visual feedback when their document is 'complete', or highlight validation problems as they come up. I could anticipate writing a custom GUI tool to create such an XML document, but I'd really like changes to the schema to be automatically reflected by the GUI - and I really wonder if this hasn't already been done. I know some editors can automatically validate an XML document against a schema as it's being written, but I would really like to get my users one step away from the XML so they don't have to worry about the details of the XML syntax.

    Read the article

  • Zipping with padding in Haskell

    - by Travis Brown
    A couple of times I've found myself wanting a zip in Haskell that adds padding to the shorter list instead of truncating the longer one. This is easy enough to write. (Monoid works for me here, but you could also just pass in the elements that you want to use for padding.) zipPad :: (Monoid a, Monoid b) => [a] -> [b] -> [(a, b)] zipPad xs [] = zip xs (repeat mempty) zipPad [] ys = zip (repeat mempty) ys zipPad (x:xs) (y:ys) = (x, y) : zipPad xs ys This approach gets ugly when trying to define zipPad3. I typed up the following and then realized that of course it doesn't work: zipPad3 :: (Monoid a, Monoid b, Monoid c) => [a] -> [b] -> [c] -> [(a, b, c)] zipPad3 xs [] [] = zip3 xs (repeat mempty) (repeat mempty) zipPad3 [] ys [] = zip3 (repeat mempty) ys (repeat mempty) zipPad3 [] [] zs = zip3 (repeat mempty) (repeat mempty) zs zipPad3 xs ys [] = zip3 xs ys (repeat mempty) zipPad3 xs [] zs = zip3 xs (repeat mempty) zs zipPad3 [] ys zs = zip3 (repeat mempty) ys zs zipPad3 (x:xs) (y:ys) (z:zs) = (x, y, z) : zipPad3 xs ys zs At this point I cheated and just used length to pick the longest list and pad the others. Am I overlooking a more elegant way to do this, or is something like zipPad3 already defined somewhere?

    Read the article

  • Best practice: How to use (repeat) CSS style attributes correctly?

    - by ellie
    Hi guys! As a CSS newbie I'm wondering if it's recommended by professionals to repeat specific style attributes and their not inherited but default properties for every relevant selector? For example, should I rather use body {background:transparent none no-repeat; border:0 none transparent; margin:0; padding:0;} img {background:transparent none no-repeat; border:0 none transparent; margin:0; outline:transparent none 0; padding:0;} div#someID {background:transparent none no-repeat; border:0 none; margin:0 auto; padding:0; text-align:left; width:720px; ...} or body {background:transparent; border:0; margin:0; padding:0;} img {background:transparent; border:0; margin:0; outline:0; padding:0;} div#someID {background:transparent; border:0; margin:0 auto; padding:0; text-align:left; width:720px; ...} or just what (I think) I really need body {background:transparent; margin:0; padding:0;} img {border:0; outline:0;} div#someID {margin:0 auto; width:720px; ...} If it's best practice to go with the first or second one what do you think about defining a class like .foo {background:transparent; border:0; margin:0; padding:0;} and then applying it to every relevant selector: <div id="someID" class="foo">...</div> Yep, now I'm totally confused... so please advise! Thanks!

    Read the article

  • Pascal's repeat... until vs. C's do... while

    - by Bob
    In C there is a do while loop and pascal's (almost) equivalent is the repeat until loop, but there is a small difference between the two, while both structures will iterate at least once and check whether they need to do the loop again only in the end, in pascal you write the condition that need to met to terminate the loop (REPEAT UNTIL something) in C you write the condition that need to be met to continue the loop (DO WHILE something). Is there a reason why there is this difference or is it just an arbitrary decision?

    Read the article

  • How to override the new limited keyboard repeat rate limit?

    - by Olivier Pons
    I may be an alien around here, but here's my problem: the speed limit on old Ubuntu releases (= before 11) was very very fast. It was really great for me. Now, on Ubuntu 11, they may have thought: "who will ever want that speed? Nobody! So let's put the maximum speed to a lower limit". It's so stupid that they tried to narrow down the speed to some other famous OS. If Linux is more powerful, why remove some of its power? I don't get that. So is there any way to override that speed limit and get my keyboard as fast as it is on other previous versions?

    Read the article

  • Image SEO - always repeat main keyword in alt text?

    - by Marcus Edensky
    I'm working on an Easter Island website and I'm currently redesigning my image system. Virtually all my photos are of Easter Island. My question is, should I always include the keywords "Easter Island" for Google to easier understand that my photos are from Easter Island, or is it sufficient that the "Easter Island" keywords are in the domain, as well as in all other pages of the site? For example, Alt text 1: "Moai statues at volcano Rano Raraku at Easter Island (Rapa Nui)" or Alt text 2: "Moai statues at volcano Rano Raraku" Would example 1 be considered keyword stuffing by Google

    Read the article

  • Is it OK to repeat code for unit tests?

    - by Pete
    I wrote some sorting algorithms for a class assignment and I also wrote a few tests to make sure the algorithms were implemented correctly. My tests are only like 10 lines long and there are 3 of them but only 1 line changes between the 3 so there is a lot of repeated code. Is it better to refactor this code into another method that is then called from each test? Wouldn't I then need to write another test to test the refactoring? Some of the variables can even be moved up to the class level. Should testing classes and methods follow the same rules as regular classes/methods? Here's an example: [TestMethod] public void MergeSortAssertArrayIsSorted() { int[] a = new int[1000]; Random rand = new Random(DateTime.Now.Millisecond); for(int i = 0; i < a.Length; i++) { a[i] = rand.Next(Int16.MaxValue); } int[] b = new int[1000]; a.CopyTo(b, 0); List<int> temp = b.ToList(); temp.Sort(); b = temp.ToArray(); MergeSort merge = new MergeSort(); merge.mergeSort(a, 0, a.Length - 1); CollectionAssert.AreEqual(a, b); } [TestMethod] public void InsertionSortAssertArrayIsSorted() { int[] a = new int[1000]; Random rand = new Random(DateTime.Now.Millisecond); for (int i = 0; i < a.Length; i++) { a[i] = rand.Next(Int16.MaxValue); } int[] b = new int[1000]; a.CopyTo(b, 0); List<int> temp = b.ToList(); temp.Sort(); b = temp.ToArray(); InsertionSort merge = new InsertionSort(); merge.insertionSort(a); CollectionAssert.AreEqual(a, b); }

    Read the article

  • Tester/Doer pattern: Assume the caller conforms to the pattern or be defensive and repeat the check?

    - by Daniel Hilgarth
    Assume a simple class that implements the Tester/Doer pattern: public class FooCommandHandler : ICommandHandler { public bool CanHandle(object command) { return command is FooCommand; } public void Handle(object command) { var fooCommand = (FooCommand)command; // Do something with fooCommand } } Now, if someone doesn't conform to the pattern and calls Handle without verifying the command via CanHandle, the code in Handle throws an exception. However, depending on the actual implementation of Handle this can be a whole range of different exceptions. The following implementation would check CanHandle again in Handle and throw a descriptive exception: public void Handle(object command) { if(!CanHandle(command)) throw new TesterDoerPatternUsageViolationException("Please call CanHandle first"); // actual implementation of handling the command. } This has the advantage that the exception is very descriptive. It has the disadvantage that CanHandle is called twice for "good" clients. Is there a consensus on which variation should be used?

    Read the article

  • JSF ui:repeat and f:ajax giving wrong value for h:inputText after rerender.

    - by Andrew
    I have a list of questions and I can display them ok using a ui:repeat, but after clicking the Edit button the rerendered inputText is given the wrong question.id. For some reason, if you click Edit on the first item, the inputText value assigned is that of the second item in the list, even though other outputs (other than the h:inputText element) are correct. <h:form id="questionnaireForm"> <ui:repeat value="#{ProjectManager.currentProject.preQuestions}" var="question" varStatus="current" id="preQuestionsRepeat"> <div> <ui:fragment rendered="#{!question.editing}"> <f:ajax render="@form"> <p>#{question.id} #{question.questionText}</p> <h:inputText value="#{question.id}"/> <h:commandLink styleClass="link" action="#{question.setEditing}" value="Edit"> </h:commandLink> </f:ajax> </ui:fragment> </div> <div> <ui:fragment rendered="#{question.editing}"> <f:ajax render="@form"> <p>#{question.id} #{question.questionText}</p> <h:inputText value="#{question.id}"/> </f:ajax> </ui:fragment> </div> </ui:repeat> </h:form> Obviously I don't really want to edit the id. I just want the correct question.something to show up in my inputText :-) Perhaps I'm not using correctly? It seems fine according to my reading so far. Many thanks for your assistance.

    Read the article

  • Why does p:panelGrid not work with ui:repeat?

    - by CycDemo
    If I use as below, I get no error, no output. Why does p:panelGrid not work with ui:repeat? Note : I don't want to use c:forEach because of the I already face a lot of JSF issue. <p:panelGrid> <ui:repeat value="#{MyBean.dataList}" var="data"> <p:row> <p:column> <h:outputText value="#{data.name}"/> </p:column> <p:column> <h:outputText value="#{data.description}"/> </p:column> </p:row> </ui:repeat> </p:panelGrid> MyBean.java public List<Data> getDataList(){ List<Data> result = new ArrayList<Data>(); result.add(new Data("Name 1", "Description 1")); result.add(new Data("Name 2", "Description 2")); result.add(new Data("Name 3", "Description 3")); result.add(new Data("Name 4", "Description 4")); return result; } Expected output with primefaces

    Read the article

  • How to close all tabs in Safari using AppleScript?

    - by Form
    I have made a very simple AppleScript to close all tabs in Safari. The problem is, it works, but not completely. Here's the code: tell application "Safari" repeat with aWindow in windows repeat with aTab in tabs of aWindow aTab close end repeat end repeat end tell I've also tried this script: tell application "Safari" repeat with i from 0 to the number of items in windows set aWindow to item i of windows repeat with j from 0 to the number of tabs in aWindow set aTab to item j of tabs of aWindow aTab close end repeat end repeat end tell ... but it does not work either. I tried that on my system (MacBook Pro jan 2008), as well as on a Mac Pro G5 under Tiger and the script fails on both, albeit with a much less descriptive error on Tiger. The problem is that only a couple of tabs are closed. Running the script a few times closes a few tab each time until none is left, but always fails with the same error after closing a few tabs. Under Leopard I get an out of bounds error. Since I am using fast enumeration (not using "repeat from 0 to number of items in windows") I don't see how I can get an out of bounds error with this... My goal is to use the Cocoa Scripting Bridge to close tabs in Safari from my Objective-C Cocoa application but the Scripting Bridge fails in the same manner. The non-deletable tabs show as NULL in the Xcode debugger, while the other tabs are valid objects from which I can get values back (such as their title). In fact I tried with the Scripting Bridge first then told myself why not try this directly in AppleScript and I was surprised to see the same results. I must have a glaring omission or something in there... (seems like a bug in Safari AppleScript support to me... :S) I've used repeat loops and Obj-C 2.0 fast enumeration to iterate through collections before with zero problems, so I really don't see what's wrong here. Anyone can help? Thanks in advance!

    Read the article

  • how to set length and postion for repeat-x and scroll background-image?

    - by user550945
    Hi all, I have an to set background image. it is a red line under the input value. background-attachment:scroll; background-color:#FFFFFF; background-image:url("../images/errorLine.gif"); background-position:left bottom; background-repeat:repeat-x; the input value is like "123; 456; 789;". the red line cover all the string, its length is the same as the input width. Is there any way to make the red line only under the "456;"? Is there anyway to do it by CSS? Thanks a lot. Best regards, Ryanivanka

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >