Posts

Showing posts from March, 2011

html - Dynamically assign values to select tag using Xquery -

i tried drop down using <select> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="opel">opel</option> <option value="audi">audi</option> </select> it working well. instead of hard-coded values , dynamically assign values xquery/xpath example /leader/country/text() so have list of countries above code should go select tag of html try xquery flwor expression like: <select>{ $country in /leader/country/string(.) return <option value="{$country}">{$country}</option> }</select> while xpaths on database useful getting started, it's learn search api or cts:search() query performance on large datasets. hoping helps,

javascript - Combines table filters in jquery -

i have table different places, , implemented simple buttons allow filter list. first filter location (north, east, central, south, west) based on postcode. filter on "impress". shows places have have 4 or higher value in column. filters work great separately, not together. result after when press "west" shows me places in "west, when click impress, expect see places in west 4 or 5 score impress. jsfiddle here $('.table td.postcode').each(function() { var celltext = $(this).html(); var locationstring = celltext.substring(0,2); if (locationstring.indexof('w') > -1){ $(this).parent().addclass('west'); } if (locationstring.indexof('c') > -1){ $(this).parent().addclass('central'); } if (locationstring.indexof('e') > -1){ $(this).parent().addclass('east'); } if (locationstring.indexof('s') > -1){ $(this).parent().addclass('so

javascript - How do I configure bower with Visual Studio? -

Image
as complexity of web project growing, realizing downloading external javascript libraries manually, error prone, time consuming , making project less maintainable on time. although visual studio has nuget package manager, not powerful bower. not external libraries being released on nuget. but there no clear on how configure bower visual studio. please ! as complexity of web project grew, realized downloading external javascript libraries manually, error prone, time consuming , made project less maintainable on time. although visual studio has nuget package manager, not powerful bower. not external libraries being released on nuget. so, decided take plunge , started bower. my project structure cleaner , easy maintain. here listing steps, need take configure bower visual studio. detailed steps use bower available on http://bower.io/#install-bower . here list steps, took to — install bower — configure visual studio — download sample package -- ( angular

ios - How to resize a fixed width and height UIImageView with auto layout -

i have view named myview half screen , sit @ top of screen. inside view added uiimageview 120x120 size sits in center of myview (horizontally , vertically). inside ib, satisfy constraints(x & y) need set fixed width , height image, after set center horizontally , center vertically. but fixed height , width, image doesn't resize when changing screen size. want image resize when running on iphone5 or iphone 4s, because myview resize. need image should depend on myview size. how achieve ? set imageview.cliptobounds = yes , , set imageview.contentmode = uiviewcontentmodescaleaspectfit; update talking imageview not image, in case not resize due constant width , height, 1 thing, create iboutlet of constraint , change there values when required, or can set aspect ratio superview

To shuffle an array a of n elements C++ -

i have problem shuffle array problem according seed random again same result , not 2-exchange , 2 array same! want 2 result array exchange random the code 2-exchange #include <stdio.h> #include <cstdlib> #include <ctime> void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } void printarray(int arr[], int n) { for(int = 0; < n; i++) printf("%d ", arr[i]); printf("\n"); } // function generate random exchange int* randomized(int arr[], int n) { // use different seed value don't same // result each time run program srand(time(null)); // start last element , swap 1 one. don't // need run first element that's why > 0 for(int = n - 1; > 0; i--) { // pick random index 1 i-1 int j = rand() % (i - 1 + 1) + 1; //int j = rand() % (i+1); // swap arr[i] element @ random index swap(&arr[i], &arr[j]); } retu

apache - php variable $page not passed correctly into the URL -

i'm trying install review&approval server kollaborate, it's zip package containing js/php files needs deployed in document root, , navigate http://server-ip/install/index.php but navigating next page result in literally passing $page variable url instead of 1.php -> 2.php , on.. this: http//server-ip/install/index.php?page=<?=($page+1) resulting in 'page not found!' pagecounter on webpage not displaying correctly looks variable $page index.php not passed browser correctly real value. suexec disabled fast-cgi wrapper, , there re-writing rules in .htaccess rewriteengine on # not directory rewritecond %{request_filename} !-d # existing php file rewritecond %{request_filename}\.php -f # rewrite index index.php rewriterule ^(.*)$ $1.php a short snippet navigation function done javascript: since piece of software can purchased , don't need editing customers show how construct it. kollaborate support not me further other saying wrong in installation.

javascript - Sort getJson using pure JS - no plugins -

so trying sort external json file. end goal output data table , allow user click on table header , sort data. first trying figure out how sort data. close function below works in 2 out of 3 cases. have use pure js , have following code: <!doctype html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=windows-1252"> </head> <body> <div id="cattable"></div> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script> function sortjsonarraybyproperty(objarray, prop, direction){ if (arguments.length<2) throw new error("sortjsonarraybyprop requires 2 arguments"); var direct = arguments.length>2 ? arguments[2] : 1; //default ascending if (objarray && objarray.constructor===array){ var proppath = (prop.construc

javascript - Replace any words in URL -

i need replace 2 words in window.location.href when user wants follow it. for example i'm user , want go url: stackoverflow.com/questions/7821801/javascript-indexof need replace '7821801' 'js' , '-indexof' 'ok' when page loads. or redirect user 'mysite.com/css' 'mysite.com' . i tried window.onload = function() { var urli = window.location.href; var arr = ['acasa', 'sktop']; (var = 0; <= arr.length; i++) { if (urli.search(arr[i]) > 0) { document.getelementbyid('parv').innerhtml = urli.replace(arr[i], 'tek'); }; }; } but did not work. if want redirect user, should write window.location.href=document.getelementbyid('parv').innerhtml; after manipulations by way, if want redirect, there no need in setting new url dom element, use variable

javascript - One-time resolving promise singleton (Angular service) -

the question applies promises in general , isn't specific angular, example makes use of angular $q , service singletons. here a plunker var app = angular.module('app', []); app.factory('onetimeresolvingservice', function ($q) { var promise = $q(function(resolve, reject) { settimeout(function () { resolve(); }, 500); }); return promise; }); app.controller('acontroller', function (onetimeresolvingservice, $q) { onetimeresolvingservice.then(function () { console.log('a resolved'); return $q.reject(); }).then(function () { console.log('a resolved'); }); }); app.controller('bcontroller', function (onetimeresolvingservice, $q) { onetimeresolvingservice.then(function () { console.log('b resolved'); return $q.reject(); }).then(function () { console.log('b resolved'); }); }); and document is <body ng-app="app"> <div ng-controller=&q

javascript - Variable Value Is Printing '[ object Object]' -

i using script below take value url , display value within input field. var querystring = function () { // function anonymous, executed , // return value assigned querystring! var query_string = {}; var query = window.location.search.substring(1); var vars = query.split("&"); (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); // if first entry name if (typeof query_string[pair[0]] === "undefined") { query_string[pair[0]] = decodeuricomponent(pair[1]); // if second entry name } else if (typeof query_string[pair[0]] === "string") { var arr = [ query_string[pair[0]],decodeuricomponent(pair[1]) ]; query_string[pair[0]] = arr; // if third or later entry name } else { query_string[pair[0]].push(decodeuricomponent(pair[1])); } } return query_string; }(); document.addeventlistener("domcontentloaded", function() { document.geteleme

javascript - D3 bar chart not reading JSON via PHP -

Image
i'm trying create d3 bar chart based on this example. data i'm feeding d3 script in json, resides in php file. json data being echoed out json_encode . here's snippet of what's being echoed out in php file: [ { "state": "alabama", "amount": "4" }, { "state": "arizona", "amount": "1" }, { "state": "arkansas", "amount": "3" }, { "state": "california", "amount": "19" }, for reason, x-axis appearing nan (instead of each state's name) , have 1 huge bar chart instead of 25 bars supposed have... this code: <script> var margin = {top: 0, right: 20, bottom: 30, left: 40}, width = 960 - margin.left - margin.right, height = 275 - margin.top - margin.bottom; //var formatpercent = d3.format(".0%"); var x = d3.scale.ordinal() .ranger

PHP&html: emailing form's checkboxes -

i'm trying make simple form sends user input email. don't know php i'm having trouble here. can't make form include checkboxes' results in mail. tried several times can't make work. it's in spanish, sorry that! here code: contactoformescritorio.php: <?php $where_form_is = "contacto.html".$_server['server_name'].strrev(strstr(strrev($_server['php_self']),"/")); mail("my@mail.com","formulario de pedido de copias","form data: nombre: " . $_post['cd-name'] . " email: " . $_post['cd-email'] . " tamanio: " . $_post['tamanio'] . " acabado: " . $_post['acabado'] . " incluir en la cotizacion: " .implode(',',$_post['agregados'])."\n" . " foto elegida e información adicional: " . $_post['cd-textarea'] . " . "); include("confirm.html"); /* * procesar

iphone - iOS background image sizes -

Image
i've been looking in google , in forum right sizes ios app , found 960x640, 1134x750 , 2208x1242 theses apparently iphones , i'm wondering if ipad uses @3 2208x1242 or should tell designer 4 more sizes ipad's or without retina display? here's date resolutions ipad, paint code's website doesn't have ipad info posted know:

java - "android.R.id.content" generates an error with no change to the source code -

this code exercise source code course took. worked fine until afternoon. no change made , re imported , similar project , experienced same new error. public class tourlistadapter extends arrayadapter<tour> { context context; list<tour> tours; public tourlistadapter(context context, list<tour> tours) { super(context, android.r.id.content, tours); this.context = context; this.tours = tours; } i'm using android studio 1.3 android.r.id.content used work , generates error: expected resource of type layout. i've searched stackoverflow , there appears new feature annotates possible mis-matches. somehow android id integer used ok , not longer. did not download new today android studio. i have re-built, cleaned , sycn'd. have exited , rebooted computer no resolution. it's not error, it's warning. as you've noted in question, resource method parameters can annotated indicate type of

javascript - Getting 'unexpected mongo exit code 100' while running a meteor application -

i new meteor .i started learning meteor language referring book 'my first meteor application'...while running application getting 'unexpected mongo exit code 100' error.it showing 'unexpected mongo exit code 100 restarting'.help me on error this error indicates either mongo process still running in background or killed improperly. may use try `ps -a | grep 'mongo' to see what's going on. either way, in .meteor/local/db directory, there non-empty mongo.lock file. if there's active mongo process, kill , file should become empty. otherwise remove file manually. when you're done error should disappear.

read eval print loop - Practical REPL use with Java 9 -

i'm learning repl java 9 , how utilize effectively. considering java heavy on configuration , external dependencies has made experiments outside trivial more work configure waiting build/run. instance, evaluate more trivial line of java, based on runtime, 1 has reference external library own dependencies. over-complicates things , perhaps make point of such feature moot real-world scenarios. until ide's integrate repl , automatically manage/inject dependent libraries, how 1 use feature without feature becoming more of burden hurdle meant overcome? please note i'm not looking conjecture, methods in 1 has worked accomplish this. i'm using kulla repo here experiment. as of october 2015 repl (project kulla) still not integrated, , modular jdk, runtime images goes second alternative download. once integrated in dec 2015, there should start work , testing of them together. as of october 2015 tutorials suggest starting building sources: jdk 9 repl: get

java- how to calculate sum of 2 numbers using two 2D arrays? -

i have write program allows input of 2 numbers in 2 2*3 arrays , displays sum of corresponding numbers. not able understand why , how program implemented using two 2*3 arrays @ lost of how should working. still here have come far: package lesson1; import java.util.*; class myclass{ public static void main(string[] args) { scanner input= new scanner(system.in); int sum; int array1[][]= new int[2][3]; int array2[][]= new int[2][3]; for(int i=0; i<array1.length; i++){ for(int j=0; j<array1[i].length; j++){ array1[i][j]= input.nextint(); for(int x=0; x<array2.length;x++){ for(int y=0; y<array2.length; y++){ array2[x][y]= input.nextint(); sum= array1[i][j]+ array2[x][y]; system.out.println("the sum "+sum); } } } } } } i believe code complicated

jquery - preventing form submision and submiting form on success function ajax -

i have problem submiting form in success .,.. function? in ajax doesn't work. code: $("#settings_submit_button").on('click',function(evt){ var settings_email = $("#settings_new_email").val(); var current_password = $("#current_password").val(); evt.preventdefault(); if($("#settings_current_email").val() != '') { if(validateemail($("#settings_new_email").val())) { $.ajax({ type: 'post', url: 'ajaxchecker.php', data: {settings_email :settings_email, current_password: current_password}, success: function(data) { var response = $.trim(data); if(response == 'notright') { $("#settings_loader2").text("zadali ste nesprávne heslo"); } else if(response == 'taken')

Make this jQuery code a little more dynamic -

jquery(document).ready(function ($) { if (window.location.href.indexof("seniors") > -1) { var $ul_senior = $('<ul class="sub-menu-jquery"></ul>'); $("#menu-item-630").append($ul_senior); $("#menu-carecenter-seniors-menu li").each(function () { var $li = $(this); $($li).clone().appendto(".sub-menu-jquery"); }); }; if (window.location.href.indexof("medical") > -1) { var $ul_medical = $('<ul class="sub-menu-jquery"></ul>'); $("#menu-item-636").append($ul_medical); $("#menu-carecenter-medical-menu li").each(function () { var $li = $(this); $($li).clone().appendto(".sub-menu-jquery"); }); }; if (window.location.href.indexof("foundation") > -1) { var $ul_foundation = $('<ul class="