Posts

Showing posts from March, 2015

populating associations in mongodb -

i'm new mean , mongodb , trying figure out how populate answers questions. changed words in platform i'm learning (examples posts , comments). here's error message i'm getting. /users/joerigby/documents/codingdojo/full mean/blacktest3/node_modules/express/lib/view.js:62 throw new error('no default engine specified , no extension prov ^ error: no default engine specified , no extension provided. @ new view (/users/joerigby/documents/codingdojo/full mean/blacktest3/node_modules/express/lib/view.js:62:11) @ eventemitter.render (/users/joerigby/documents/codingdojo/full mean/blacktest3/node_modules/express/lib/application.js:569:12) @ serverresponse.render (/users/joerigby/documents/codingdojo/full mean/blacktest3/node_modules/express/lib/response.js:961:7) @ /users/joerigby/documents/codingdojo/full mean/blacktest3/server/controllers/answers_c.js:53:12 @ query.<anonymous> (/users/joerigby/documents/codingdojo/full mean/blacktest3/node_modules/mongoo...

New Java Array of Strings in Nashorn -

i'm writing high-performance nashorn application, , i'd find equivalent new string[]{"foo", "bar", "noise"} within javascript. cost of converting javascript array java array prohibitively expensive, shows on every flame graph. the best i've found point is: {var stringarray = java.type('java.lang.string[]');"); var arr = new stringarray(3)); var arr[0] = 'foo'; var arr[1] = 'bar'; var arr[2] = 'noise'; arr; } but that's super ugly. best syntax available me? thanks! you can using java.to() : java.to(["foo", "bar", "noise"],"java.lang.string[]"); if code works (it me, tested jjs 1.8.0_51), can create function ease code readability. this: function tojavastringarray(a) { return java.to(a,"java.lang.string[]"); }

javascript - jQuery, submit is not cancelling on form -

i have form trying use js cancel, can submit using ajax. however started , made form , tested see if submission cancelled/return's false discovered did not. checked other threads/posts made none helped me. form bellow, followed .js file. console in chrome has not given me errors either. edit: forgot mention alert in .js file not coming either. <form method="post" class="form-horizontal form-bordered" id="user-data-form"> <div class="form-group"> <label class="col-md-3 control-label" for="oldpassword">old password</label> <div class="col-md-6"> <input type="password" id="oldpassword" name="oldpassword" class="form-control" placeholder="old password"> </div> </div> <div class="form-group form-actions"> <div class="col-md-9 col-md-...

python - How to output progress of parallel process on regular basis? -

i'm learning python multiprocessing module , i've found this example (this bit modified version): #!/bin/env python import multiprocessing mp import random import string import time # define output queue output = mp.queue() # define example function def rand_string(length, output): time.sleep(1) """ generates random string of numbers, lower- , uppercase chars. """ rand_str = ''.join(random.choice( string.ascii_lowercase + string.ascii_uppercase + string.digits) in range(length)) result = (len(rand_str), rand_str) # print result time.sleep(1) output.put(result) def queue_size(queue): size = int(queue.qsize()) print size # setup list of processes want run processes = [mp.process(target=rand_string, args=(3, output)) x in range(1,1000)] # run processes p in processes: p.start() # exit completed processes p in proce...

c++ - Count space required for RLE-compressed string -

i'm working on interview workbook , doing problem: implement function compress string using counts of repeated characters (aabcccccaaa become a2blc5a3). return original string if "compressed" not smaller original. a solution found counts size of compressed string before else. i've tried tracing through helper function don't understand logic of line. any deciphering great! : size = size + 1 + std::to_string(count).length(); count int number of repeated characters in c++11, to_string lets append append ints strings. so, a+1 a1. better solution: int countcompression(const string& str) { if (str.length() == 0) return 0; char prev = str[0]; int size = 0; int count = 1; (int = 1; < str.size(); i++) { // repeated char if (str[i] == prev) count++; // unique char else { prev = str[i]; size = size + 1 + std::to_string(count).length(); ...

svn - Create a Subversion branch from an already modified trunk working copy -

there's situation create working copy subversion's trunk. i go changing things. onoly ffter changes have been made, decide wanna stage work , multiple commits on it. but don't want work inside trunk yet. wanna create branch it, commits, merge branch. but working copy created on trunk, , changes have happened , urging commited. how can create new branch , turn working copy's changes it? i use collabnet , visualsvn , tortoise. go working copy folder, right click.. there see: tortoisesvn > branch/tag after click branch/tag , there option there named " working copy " under " create copy in repository from: " with can create new branch of working copy including changes made. regards.

c# - How to commuicate with a Memory Mapped File from a Web API? -

i have web api controller needs communicate local tool via memory mapped file. when try open such file openexisting "file not found" error. string mmf_in_name = "memorymappedfilename"; memorymappedfile mmf_in = memorymappedfile.openexisting(mmf_in_name); i tried add prefix "global/" name without success. next tried start command line tool controller. tool starts gets same "file not found error". when run tool myself works fine. means file name correct. how can convince iis worker let me open , use memory mapped file? i'm using windows server 2012 , iss 8.5. this works on windows server 2012 , iis 8.5. it's important understand iis worker runs in different terminal server session normal applications. windows service. so when application exposing memory mapped file needs create via "global\" prefix added name. needs add security descriptor or identity. in c# this: string mmf_name = @"global\mymemo...

language agnostic - Eager load from disk into memory instead of page faulting multiple times -

lets have big file (or raw storage if possible in popular operating systems) on disk going need operate on. there way let operating system know entire chunk of data eagerly loaded memory rather having tiny chunk of loaded memory , page faulting every time try access segment hasn't been loaded memory yet? i'm thinking more memory mapped files, since operating system job of having things preloaded if doing sequential reads. i'm sure it's technically possible write operating system provides functionality looking for, exist in popular operating systems? also, operating systems preload entire block memory default if there ram available? if operating systems provide functionality, programming language support exists accessing functionality? as commentators have pointed out, case of sequential reading, modern operating systems perform read-ahead optimisation you. for other kinds of input, make use of asynchronous i/o . if program knows need read data in fut...

delphi - Insert Checkbox values into mysql database -

i have query use show data 3 tables in dbgrideh. dbgrideh has field checkbox. when check checkbox program gets error message cannot insert data triple table. how solve problem? i have 3 tables. (table name) first table have fields 'ids, 'name', 'address' value 1, 'indah', 'jakarta' (table age) second table have fields 'ida', 'name', 'age' value 1, 'indah', 10 (table class) third table have fields 'idc', 'name', 'class' value 1, 'indah', 2 i use 1 query select data 3 tables this: select name.name, age.age, class.class name, age, class i have error cannot update complex query more 1 table try this: select name.name, age.age, class.class name join age on name.ids=age.ida join class on name.ids=age.idc more mysql join update : you can't insert multiple tables in 1 mysql command. can use transactions. begin; insert use...

jquery - Django - Add field to form dynamically -

Image
objective: add field form dynamically pressing button. once submitted, store values fields in list. (i have looked @ other questions on stack overflow , tried find basic tutorial/explanation how this: dynamically add field form ) i not sure need looking up/researching. understand involve javascript django side unsure how work. i have created basic form starters: models.py from django.db import models class simpleform(models.model): basic_field = models.charfield(max_length=200) forms.py from django import forms models import simpleform class simpleform(forms.modelform): class meta: model = simpleform fields = ['basic_field'] views.py from django.shortcuts import render forms import simpleform def index(request): if request.method == "post": # loop iterate on dynamically created fields # store values in list else: form = simpleform() return render(request, "index.html", {'form...

How can I add an extra text line in a legend of matlab graph? -

i need help!!!!! i have following legend in line graph in matlab: --- esme --- manta --- senchu with respectives lines --- , want have text in top of legend like: sources --- esme --- manta --- senchu how can add such text? thank much!!! if using matlab version prior 2014b, can use method detailed here : hleg = legend('esme','manta','senchu'); %// create legend , handle it. htitle = get(hleg,'title'); %// handle legend's title. set(htitle,'string','sources'); %// set desired title. for newer versions of matlab (or handle graphics, precise) above no longer option (as mentioned here ), in case can use this file exchange submission desired result. method works obtaining position of legend, creating axes @ same coordinates , set its title something. please refer this undocumentedmatlab post discusses exact question.

java - Spring MVC pagination and sorting -

i trying implement pagination , sorting in spring mvc. per understanding, can use pagingandsortingrepository or jparepository same( http://springinpractice.com/2012/05/11/pagination-and-sorting-with-spring-data-jpa ). but both these use default findall method so. i wish create own method , execute custom query , perform pagination sorting on that(lets search category name , sort creation date). not sure how using pagingandsortingrepository or jparepository. it great if can have sort of guidance achieve this. thanks in advance. with jpa can many combination of queries specifying method signatures. please consult http://docs.spring.io/spring-data/jpa/docs/1.4.3.release/reference/html/jpa.repositories.html in repository interface can list<person> findall(); // standard list<person> findbyid(string id); // looking person have specific id list<person> findbynamelike(string name); // can put name "foo%" if want pagination , sorting... ...

javascript - Styling Polymer Element Dynamically -

i trying make paper-card element change colors based on status of customers data on fire base, reason color updates on second click of customer. right have paper cards id set firebase data in order make change colors. here's elements style code: <style is="custom-style"> :host { display: block; } #cards { @apply(--layout-vertical); @apply(--center-justified); } .row { padding: 20px; margin-left: 10px; } paper-card { padding: 20px; } #check { float: right; bottom: 15px; --paper-card } #done { --paper-card-header: { background: var(--paper-green-500); }; --paper-card-content: { background: var(--paper-green-300); }; } #default { /*apply default style*/ /*--paper-card-content: {*/ /* background: var(--paper-red-500);*/ /*};*/ } paper-icon-button.check{ color: var(--paper-green-500); } paper-icon-button.check:hover{ background: var(--paper-green-50); border-radius: 50%; } #check::shadow #ripple { color: green; ...

java - Connection Refused Error Hadoop Mac -

i trying install hadoop. installed everything, xml document editing , stuff. i've installed java , i'm pretty sure i've done correctly. when give $hstart command (i've configured alias starting hadoop) following error: /usr/local/hadoop/bin/hdfs: line 309: /usr/lib/jvm/java-7-openjdk-amd64/bin/java: no such file or directory /usr/local/hadoop/bin/hdfs: line 309: exec: /usr/lib/jvm/java-7-openjdk-amd64/bin/java: cannot execute: no such file or directory starting namenodes on [] localhost: starting namenode, logging /usr/local/hadoop/logs/hadoop-tejasbelvalkar-namenode-tejass-imac.local.out localhost: /usr/local/hadoop/bin/hdfs: line 309: /usr/lib/jvm/java-7-openjdk-amd64/bin/java: no such file or directory localhost: /usr/local/hadoop/bin/hdfs: line 309: exec: /usr/lib/jvm/java-7-openjdk-amd64/bin/java: cannot execute: no such file or directory localhost: starting datanode, logging /usr/local/hadoop/logs/hadoop-tejasbelvalkar-datanode-tejass-imac.local.out localho...

powershell - unary increment operator within a string doesn't work -

suppose set variable, $i = 0, then "-$i-" => "-0-" "-$($i)-" => "-0-" the above expect, fails: "-$(++$i)-" => "--" # expected "-1-" however, expressions work. example: "-$(pwd)-" => "-c:\temp-" so what's going on here? according documentation , expected behavior the increment operator (++) increases value of variable 1. when use increment operator in simple statement, no value returned. view result, display value of variable, follows: c:\ps> $a = 7 c:\ps> ++$a c:\ps> $a 8 to force value returned, enclose variable , operator in parentheses, follows: c:\ps> $a = 7 c:\ps> (++$a) 8 the shortest way around following statement: "-$((++$i))-" #=> -4- since set of parentheses tell return value, opposed execute statement.

rvm deafult ruby version working other version not working -

when installed rvm default install ruby 2.2.1 , working fine. i have installed version rvm install 2.1.0 , installed. when use 2.1.0 , run bundle install get: /home/awlad/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (loaderror) /home/awlad/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require' /usr/bin/bundle:7:in `<main>' i tried gem install bundler give me: error: while executing gem ... (nomethoderror) undefined method ord' nil:nilclass` if use ruby 2.2.1 bundle install working. when using rvm use 2.1.0 which bundle give me: /usr/bin/bundle when using rvm use 2.2.1 which bundle give me: /home/awlad/.rvm/gems/ruby-2.2.1/bin/bundle here output of gem env : rubygems environment: - rubygems version: 2.4.8 - ruby version: 2.2.1 (2015-02-26 patchlevel 85) [x86_64-linux] - installation directo...

java - Getting return value in JSP -

below code auto generate purchase order number mysql database in jsp. want return "pono" string shows error because outside if condition. how can string return? <%! public string autopono()throws sqlexception{ rs=pst.executequery(); if(rs.next()){ string po= rs.getstring("max(pono)"); int intno = integer.parseint(po); intno+=1; string pono = integer.tostring(intno); } return pono; } %> declare variable otsido of loop: <%! public string autopono()throws sqlexception{ string pono = null; rs=pst.executequery(); if(rs.next()){ string po= rs.getstring("max(pono)"); int intno = integer.parseint(po); intno+=1; pono = integer.tostring(intno); } return pono; } } %> ...

invoke manually button click event in c++ builder -

using c++ builder borland (bcb6). i wish invoke manually button click event. did: fmap->bbdoneinclick(null); while done button located on fmap form, went wrong that. do need call bbdoneinclick different parameters , not null ? instead of null use form1 or bbdone ... it depends on event code how uses sender parameter also can call event handler safely if form created if not access canvas can use in tform1::tform1 constructor if need take care of not using prior onshow or onactivate to avoid vcl problems or app crashes for common handlers sufficient use main window ... (i use this instead of null ) if have single handler multiple components deciding operation or target sender parameter in case need pass pointer component itself

hadoop - Job fails to read from one ORC file and write a subset to another -

working in apache pig interactive shell in hdp 2.3 windows, i've got existing orc file in /path/to/file . if load , save using: a = load '/path/to/file' using orcstorage(''); store '/path/to/second_file' using orcstorage(''); then works. however, if try: a = load '/path/to/file' using orcstorage(''); b = limit 10; store b '/path/to/third_file' using orcstorage(''); then following error traceback in logs second job (out of 2 schedules): 2015-08-25 16:03:42,161 fatal [main] org.apache.hadoop.mapreduce.v2.app.mrappmaster: error starting mrappmaster java.lang.noclassdeffounderror: org/apache/hadoop/hive/ql/io/orc/orcnewoutputformat @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:348) @ org.apache.pig.impl.pigcontext.resolveclassname(pigcontext.java:657) @ org.apache.pig.impl.pigcontext.instantiatefuncfromspec(pigcontext.java:726) @ org.apache.pig.backend.hado...

php - I want to remove spaces between tags in HTML -

$html contains html code. in case has spaces between > < divisions , between > or < , inner text, need remove them. this code: $html = '<div> </div> <div> here</div>'; $html = preg_replace('/>\s+</', "><", $html); but it’s not removing spaces between > < or > here . <div></div><div>here</div> any suggestion? for spaces, use str_replace : $html = '<div> </div> <div> here</div>'; $string = str_replace(' ', '', $html); for whitespace, use preg_replace : $string = preg_replace('/\s+/', '', $html); for after div space remove only, user $html = '<div calss="something"> </div> <div> here</div>'; $string = str_replace('> ', '>', $html);

wpf - c# printing how to handle cancel button? -

Image
basically application can handle printing using printpageeventargs , printed successfully. problem i'm not sure how handle if user decided cancel printing. kindly refer below image: now instead of user clicking on "save" button, user click on "cancel". may know method can override? p/s: please note popup appear if printer microsoft xps document writer . not ordinary printdialog.showdialog();

mysql - PHP add multiple JOIN method in function -

i have function fetch catid , typeid mysql database. function _is_type_($id,$type){ $db = mysqli_access::f("select catid,typeid " . catsgroup . " postid = ? , typeid = ?", $id, $type); foreach($db $row){ $catsdata[] = $row; } return $catsdata; } catsgroup table:(insert each post catid , typeid) |id| catsid | typeid | postid | i have another 2 table cats name , type name : cats name table: |id|cat_name| type table: |id|type_name| now in action need show/print name of catid , typeid table. know, can add php join method in function don't know how can i?! how generate result (show name o cats , type) using join method function? now i don't think require join in case need fetch data 2 different tables 2 different keys. also, assuming id column in name , type table has no relation. here, writing separate query can give quicker result going join. select cat_name name id=$id; select type_name...

Spring + CAS Redirect to login page after logout -

i'm using spring(3.2.8) + cas (4.0.0) , i'd redirect login page after logout (instead of displaying logout confirm page). i tried add cas.logout.followserviceredirects=true in cas.properties nothing happens. on client-side when user wants logout, accesses: app_url/j_spring_cas_security_logout my logout-webflow.xml looks like: <flow xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://www.springframework.org/schema/webflow" xsi:schemalocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"> <action-state id="terminatesession"> <on-entry> <evaluate expression="cryptoserverlogoutinterceptor.terminatecryptosession(flowrequestcontext)"/> </on-entry> <evaluate expression="terminatesessionaction.terminate(flowrequestcontext)"/> <transition to="dologout...

swift - Get Image Size Without Loading The Image -

i using below size of image. without creating sprite node, if make sense. let nodeimage = skspritenode(imagenamed: "nodeimage") let nodewidth = nodeimage.size.width let nodeheight = nodeimage.size.height what access images file , find out size of specific image. below (clearly doesn't work, example) let nodeheight = (imagenamed: "nodeimage").size.height any great. you use uiimage class. has e init method similar of skspritenode : uiimage(named name: string) and can use size property of uiimage obtain height in points of image.

c# - Wants next Stack<T> from the list of Actions -

i making undoredo functionlity application. on function doaction have list of action taken in stack<undoredoaction> want last action taken automatically first in list take out first in list have used actionlist.peek(); situation arise next time wanted take second 1 list. not sure how private void doaction(stack<undoredoaction> actionlist, stack<undoredoaction> storelist, action<undoredoaction> action) { if (actionlist.count > 0) { undoredoaction uraction = actionlist.peek(); action(uraction); storelist.push(uraction); } } you need use stack<t>.pop instead of peek . pop removes last added item in stack , returns while peek returns last added item without removing stack.

ios - AVAudioEngine stops device's background audio -

i using avaudioengine object, has many avaudioplayernodes attached it. audio works fine, except stops audio iphone playing in background (i. e. itunes or music app). when app opened, stops other background audio. there way allow background audio continue play? when app using avaudioplayernodes play audio itself? music app has it's own audiosession, makes audio engine stops, had problem too, please restart after music app. func stepb_startengine(){ if engine.running == false { { try engine.start() } catch let error { print(error) } } } setup audiosettion also: func setupaudiosession(){ do{ try avaudiosession.sharedinstance().setcategory(avaudiosessioncategoryambient, withoptions: avaudiosessioncategoryoptions.mixwithothers) try avaudiosession.sharedinstance().setactive(true, withoptions: avaudiosessionsetactiveoptions.notifyothersondeactivation) } catch let error { print(error) } ...

How to get json object of google maps places api in android? -

is there way json data google maps places api in android. using following link retrieve data. https://maps.googleapis.com/maps/api/place/textsearch/json?query=store+in+lahore&type=clothing_store&key=---- it returns data in json format. please me how can data form above in android. i know it's old question. hope useful others in future. first, have add module level build.gradle , android { uselibrary 'org.apache.http.legacy' } next step create asynctask, public class myasynctask extends asynctask<string, void, boolean> { private jsonobject jsonobject; @override protected void onpostexecute(boolean aboolean) { super.onpostexecute(aboolean); system.out.println(jsonobject); //use jsonobject here } protected boolean doinbackground(final string... args) { try { looper.prepare(); string latitude = args[0]; string longitude = args[1]; string radiu...

java - Way to prioritize specific API calls with multithreads or priority queue? -

in application, servlet(running on tomcat) takes in dopost request, , returns initial value of api call user presentation , ton of data analysis in lot more other api calls. data analysis goes mongodb. problem arises when want start process before bulk api calls finished. there many calls need @ least 20 seconds. don't want user wait 20 seconds initial data display, want data analysis pause let new request call initial api display. here's general structure of function after dopost(async'd in runnable). it's bit long abbreviated easier read: private void postmatches(servletrequest req, servletresponse res) { ... getting necessary fields req ... /* read in values arrays */ string rankqueue = generatequerystringarray("rankedqueues=", "rankedqueues", info); string season = generatequerystringarray("seasons=", "seasons", info); string champion = generatequerystringarray("championids=...

javascript - jQuery display none a option in a form -

i want display none option of form. html: <option class="level-0" value="top-10-villen-de">top-10-villen</option> jquery: if(jquery('option').attr('value') == 'top-10-villen-de'){ jquery(this).css('display', 'none'); } i've issue in if statement can't figure out issue. can helps me? thank you. hiding dropdown option isn't compatible browser. i've got better option. wrap option span , when need unwrap it fiddle link : http://jsfiddle.net/xms2uydx/

scala - Iterable with two elements? -

we have option iterable on 0 or 1 elements. i have such thing 2 elements. best have array(foo, bar).map{...} , while is: (foo, bar).map{...} (such scala recognized there 2 elements in iterable ). does such construction exist in standard library? edit: solution create map method: def map(a:foo) = {...} val (mappedfoo, mappedbar) = (map(foo), map(bar)) if want map on tuples of same type, simple version is: implicit class dupleops[t](t: (t,t)) { def map[b](f : t => b) = (f(t._1), f(t._2)) } then can following: val t = (0,1) val (x,y) = t.map( _ +1) // x = 1, y = 2 there's no specific type in scala standard library mapping on 2 elements.

Php array posts make max value output -

i want shopping cart number of item count. post different value different. please make code shorten , unlimited post can manage max value of number of items. if($_post['item_number_9']==9){$y=9;} elseif($_post['item_number_8']==8){$y=8;} elseif($_post['item_number_7']==7){$y=7;} elseif($_post['item_number_6']==6){$y=6;} elseif($_post['item_number_5']==5){$y=5;} elseif($_post['item_number_4']==4){$y=4;} elseif($_post['item_number_3']==3){$y=3;} elseif($_post['item_number_2']==2){$y=2;} elseif($_post['item_number_1']==1){$y=1;} echo $y; //9 max value of array // want code array , $y maximum post foreach($_post $key =>$entrie){ if(strpos($key, "item_number_") === 0){ $y = $entrie; } } this goes through $_post elements. if item_number_ value set $y . asumes there 1 entrie in $_post item_number_ in it, there should 1 entrie holds number of items in cart. but offerall ba...

java - GCD / LCM of two numbers to be evaluated from the input numbers itself -

considering input given a=21, b=36 , gcd (a,b) d=3 . if supposed achieve gcd solving equation a * x + b * y = d . how can evaluate numerous combinations of positive , negative integers x & y in equation fetch result satisfies equation. eg: a=21, b=36, (gcd) d=3 21 * x + 36 * y = 3 x = ? , y = ? sample answer: x=-5,y=3 how can in java ? you can extended euclidean algorithm . implementation here public class extendedeuclid { // return array [d, a, b] such d = gcd(p, q), ap + bq = d static int[] gcd(int p, int q) { if (q == 0) return new int[] { p, 1, 0 }; int[] vals = gcd(q, p % q); int d = vals[0]; int = vals[2]; int b = vals[1] - (p / q) * vals[2]; return new int[] { d, a, b }; } public static void main(string[] args) { int p = integer.parseint(args[0]); int q = integer.parseint(args[1]); int vals[] = gcd(p, q); system.out.println("gcd(" + p + ", " + q + ...

java - Create temporary file on specific partition -

i want write contents file atomically. have deal variety of filesystems, don't support atomic writes or locks. so want write changes temporary file first , move file target location, overwriting existing (old) file. for move operation fast possible, want temporary file on same partition target file. don't want in target directory, might interfere 3rd party applications. is there (cross-platform) way create temporary file (using nio) on specific partition? or way ensure move operation being fast make temporary file sibling of target file? // creates temporary file f = file.createtempfile("tmp", ".txt", new file("c:/")); // deletes file when virtual machine terminate f.deleteonexit(); (1) can specify folder (partition) parameter 3 in createtempfile (2) should put temp files in temp folder, need determine. (3) can gain drive (partition) original file.

java - XML parsing exception org.xml.sax.SAXParseException cvc-elt.1 -

my xml contains <?xml version="1.0" encoding="utf-8"?> <organization:organization xmlns:organization="http://www.bonitasoft.org/ns/organization/6.0.0-beta-016"> ...... </organization:organization> for complete xml file, please have @ : https://github.com/bonitasoft/bonita-examples/blob/master/rest-api-example/src/main/resources/acme.xml i error on server side (java & tomcat) : org.xml.sax.saxparseexception; linenumber: 2; columnnumber: 106; cvc-elt.1: cannot find declaration of element 'organization:organization'. (full stack trace below) i changed 'organization' tag <organization> ... </organization> still same error: cvc-elt.1: cannot find declaration of element 'organization' edit it works when change xmlns uri as <organization:organization xmlns:organization="http://documentation.bonitasoft.com/organization-xml-schema/1.1"> can please explain. i tr...

performance - AS3 | FPS issue while running on browser -

i've built small game running while on local (from flash). it's small 60-fps game. using same computer, i'm playing swf using browser (chrome, firefox, explorer) it's running extremely slow. i'm using swf monitor (and browser monitor) there can see swf running 61/60 fps not true. seem browser forcing swf fps down around 20 fps or so. i've tried wmode (direct / gpu) nothing. going on? after updating graphic card drivers, works on browser. flash can handle without updated drivers, on browser it's must have, else damage application performance , fps.

asp.net - How to get the country code from a specific country in c#? -

i've country dropdownlist want selected countries country code. user select "the netherlands" want country code "nl" don't know how this. using c# server coding. can me please. thanks in advance. actually question how convert english name iso 3166-2 code. "united state" "us" using regioninfo. you can write linq dictionary of <name,code> var countries = cultureinfo.getcultures(culturetypes.specificcultures) .select(x => new regioninfo(x.lcid)) .select(x => new[] { new { name = x.displayname, code = x.name }, new { name = x.nativename, code = x.name } }) .selectmany(x => x) .distinct() .todictionary(x => x.name, x => x.code, stringcomparer.invariantcultureignorecase); now can use as console.writeline(countries["united states"]); ...

python - Why can't uniqueness be enforced on Django ManyToMany field? -

i'm creating simple binary rating system website, study materials website summaries can rated +1 or -1. i've defined manytomany fields between summary model , user model so: users_rated_positive = models.manytomanyfield( user, blank=true, related_name='summaries_rated_positive') users_rated_negative = models.manytomanyfield( user, blank=true, related_name='summaries_rated_negative') however obvious given user can not rate given summary more once. i tried setting unique=true django doesn't seem let me that. is there more optimal way store ratings aligns better intentions? consider using manytomany through table . class summary(models.model): user_ratings = models.manytomanyfield( 'user', blank=true, through='userrating', ) class userrating(models.model): user = models.foreignkey('user') summary = models.foreignkey('summary') is_positive = models.booleanfield() ...

Credentials in Google developer console not loading -

https://console.developers.google.com/project/ */apiui/credential the credentials panel on repeatedly clicking not load ( keeps loading ) i need access oauth 2.0 , unable because nothing being displayed. i have done following activated - google analytics api ( enabled it) now need access oauth 2.0 , internet connection fast yet credential section not laod , other section in google developers age loading . what should resolved ? sounds me resolved filling oauth consent screen https://console.developers.google.com/project/<yourprojectid>/apiui/consent you'll need @ least product name , email address filled. google made change cannot create credentials long consent screen not filled. before change 1 got cryptic errors during oauth, change makes sense. if doesn't recommend setting project , quick test project. project not setup @ google in case you'd need contact google's customer support.

web services - CXFRS webservice don't work -

fuse esb. component: cxfrs webservice i have problem webservice. this pom.xml: <dependencies> <dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-core</artifactid> <version>2.15.1.redhat-620133</version> </dependency> <dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-blueprint</artifactid> <version>2.15.1.redhat-620133</version> </dependency> <!-- logging --> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.10</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid...

javascript - 'this.response' is not printing in the console -

function callotherdomain() { var invocation = new xmlhttprequest(); var username = "usr"; var password = "pass"; var url = 'https://someurl'; invocation.open('get', url, true, username,password); console.log(this.responsetext); invocation.send(); } i not able response working code above well first of all, responsetext response xmlhttprequest , should naturally member of invocation , not this . secondly, since it's response of request, there won't before there have been actual response received. if request synchronous after send call. unfortunately asynchronous request, means have create response handler (using onreadystatechange property) , print response when response have been received. i suggest follow link on onreadystatechange property, contains simple example on how handle async requests, doing want.

pug - How to use Meteor with Jade, Flow Router and Blaze? -

i'm trying make jade work meteor's flow router , blaze. somehow doesn't work me. i'm pretty sure it's small don't notice. html versions of home.jade , layout.jade files give proper, working result. according this , there used problem, solved in 0.2.9 release of mquandalle:jade. $ meteor list blaze 2.1.2 meteor reactive templating library kadira:blaze-layout 2.0.0 layout manager blaze (works flowrou... kadira:flow-router 2.3.0 designed client side router meteor meteor-platform 1.2.2 include standard set of meteor packages in your... mquandalle:jade 0.4.3 jade template language layout.jade template(name="layout") +template.dynamic(template="main") home.jade template(name="home") p looks working! routes.js flowrouter.route('/', { name: 'home', action: function() { blazelayout.render('layout', {main: 'home'}); } }); the result: ...