Posts

Showing posts from July, 2010

xml - Parse.com Cloud Code Evaluate xPath? -

i new using parse.com cloud code, , ios developer. in ios use hpple, xpath evaluator parse xml document. need in cloud code. wondering if there way in javascript sdk expressions like xpath expression: //day[@name='monday']/meal[@name='lunch']/counter[@name='deli']/dish/name to evaluate xml url: http://64.182.231.116/~spencerf/union_college/upperclass_sample_menu.xml this return strings "made order deli core", "caprese panini biggie sandwich". there way in javascript sdk or there modules can install parse's cloud code can evaluate xml this? the code have tried far this: parse.cloud.define("next", function(request, response) { var xmlreader = require('cloud/xmlreader.js'); parse.cloud.httprequest({ url: 'http://64.182.231.116/~spencerf/union_college/upperclass_sample_menu.xml', success: function(httpresponse) { //console.log(httpresponse.text); var somexml = httprespo

php - Add string / symbol to all keys in array -

what easiest way ( without looping manually ) to, in case, prepend dollar sign all keys of associative array? $input = array('fruit' => 'apple', 'car' => 'volvo'); expected output array('$fruit' => 'apple', '$car' => 'volvo'); try snippet below $input = array('fruit' => 'apple', 'car' => 'volvo'); $array = array_combine( array_map(function($k){ return '$' . $k; }, array_keys($input)), $input ); print_r($array); output: array ( [$fruit] => apple [$car] => volvo ) demo

jQuery on, add only one event listener -

i have event listener ul: $('body').on('click.submenu', '.top-level', submenu); is there way ensure gets added once? the reason being, need added when viewport @ "mobile" breakpoint, , when goes desktop mobile, there seems more 1 event listener. var body = $("body"); //store later use if(!(body.data("eventadded") === true)){ //test if event added body.data("eventadded", true) //if not, set eventadded true .on('click.submenu', '.top-level', submenu); //and add event }

iOS AFNetworking AFHTTPRequestOperationManager not setting json headers? -

im using afnetworking pod 'afnetworking', '~> 2.2' i need send post json headers, going out as "content-type" = "text/html"; why??, please see in code im setting this? - (void)postrequestwithparams:(nsdictionary*)paramasdicto andurl:(nsstring*)url success:(void (^)(id responseobject))success failure:(void (^)(nserror *error))failure { afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; manager.responseserializer = [afjsonresponseserializer serializer]; manager.responseserializer.acceptablecontenttypes = [nsset setwithobject:@"application/json"]; manager.requestserializer = [afjsonrequestserializer serializer]; [manager.requestserializer setvalue:@"application/json" forhttpheaderfield:@"content-type"]; [manager post:url parameters:paramasdicto constructingbodywithblock:^(id<afmultipartfo

ios - Passing data from one SKScene to the next -

so designing game. in menuscene class have following: -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { sktransition *transition = [sktransition fadewithcolor:[uicolor colorwithred:147.0/255.0 green:213.0/255.0 blue:216.0/255.0 alpha:1.0] duration:2.0f]; myscene *gamescene = [myscene scenewithsize:self.size]; [self.view presentscene:gamescene transition:transition]; } which transitions game scene. need pass data game scene. in game scene, instance of myscene , have @interface myscene() @property (nonatomic) skspritenode *heli; @property (nonatomic) int health; @property (nonatomic) float currentdy; @property (nonatomic) float gamespeed; @end and want able set these properties enter new scene, based on input user old scene. in research have come conclusion either want use initwithcoder or other sort of custom method transition scene. need add new method interface , implement in implementation? how need change game scene accept new data? need

c# - What does <P> mean? -

i can understand code does, point of <p> ? spweb web = context.web; output.appendformat("site url: {0}<p>", web.url); note <p> inside string literal. means part of string , has no special meaning in c#. appears intended html tag.

c++ - error: expected constructor, destructor, or type conversion before ‘main’ -

i trying figure out how jump 1 function come , preform another. when compile error error: expected constructor, destructor, or type conversion before ‘main’ here code: #include <iostream> #include "32pm.cpp" pm() int main() { std::cout << "hello world!"; } a function call followed semicolon, statement. statements can used in function body. e.g. in body of main . note declarations in c++ come in 2 flavors: block declarations, can used statements in blocks, , non-block declarations, can (directly) used outside functions. e.g. variable declaration block declaration, , namespace definition (or matter full function definition) non-block declaration. it's arbitary, essence there divide between constructs can used statements, , cannot, , part of c++ grammar.

angularjs - My directive stopped working when I started using ng-repeat with a different controller. What am I doing wrong? -

so followed guide have nav bar on every page: http://tomaszdziurko.pl/2013/02/twitter-bootstrap-navbar-angularjs-component/ and working, until created separate controller populate bootstrap carousel. thing is, ng-repeat works fine, when can't see navbar on page. can see fine on other pages. believe scoping issue, not sure where. this have in main body of page: <body> <reusable-navbar></reusable-navbar> <!-- carousel start --> <div id="main-carousel" class="carousel slide container" data-ride="carousel"> <!-- wrapper slides --> <div class="carousel-inner"> <!--must set hand--> <div class="item active"> <img alt="" src="../revamp/images/carousel/1.jpg"> </div> <!--repeat through rest--> <div ng-controller="carouselphotocontroller">

git - How to inspect openshift build log? -

i have application, deployed openshift via pushing source code git repo. i need troubleshoot problem, occurs during maven build, when executed on openshift (debugging locally not option). however, can't figure out way inspect maven build logs. you can either use 'rhc tail' command, or can ssh gear , in ~/app-root/logs directory, @ java server logs. if using jenkins build application, need log jenkins server , @ console build logs see happening.

what is the purpose of the @ symbol in front of a variable in octave? -

for example: model = svmtrain(x, y, c, @(x1, x2) gaussiankernel(x1, x2, sigma)); disclaimer: coursera ml class, it's impossible search @ symbol conventionally. @ prefixes definition of anonymous function .

java - Selenium element visible listener -

in testing application error , successful messages visible in element has 5-10 second timeout. element shown in event of error , successful messages. not pop-up message. wrote method take screenshot in event of failure. in screenshots error not visible because of it's timeout. appreciate if can give me idea how implement listener catch visibility of error element. can write findelement after every submit command. think it's not practical. you can use fluentwait - public boolean fluentwait(webdriver driver, final awaitedelement) { wait<webdriver> wait = new fluentwait<webdriver>(driver) .withtimeout(30, timeunit.seconds) .pollingevery(1, timeunit.seconds) .ignoring(nosuchelementexception.class); boolean flag = wait.until(new function<webdriver, boolean>() { public boolean apply(webdriver driver) { return driver.findelement(locator).isdisplayed(); } }); return f

node.js - hapi-auth-cookie not setting cookie -

for node app im using bell , hapi-auth-cookie plugins use yahoo api. current code, able authenticate yahoo , redirected homepage. however, request.auth seems empty once homepage. can tell, i'm doing example, yet have no authentication once homepage. appreciated! here's i've got: var path = require('path'); var hapi = require('hapi'); var cookiesession = require('cookie-session'); var serveroptions = { views: { engines: { html: require('handlebars') }, path: path.join(__dirname, './app/www/public/pages'), layoutpath: path.join(__dirname, './app/www/public/pages') } }; var server = new hapi.server(8003, serveroptions); server.pack.register([ require('bell'), require('hapi-auth-cookie') ], function(err) { if (err) { throw err; } server.auth.strategy('yahoo', 'bell', { provider: 'yahoo', password: 'cookie_encryption_password',

How to send to multiple email recipients using php -

i have problem receiving notification using bunch of email recipients, email received notification last email on line (email5@mysite.com) im been wondering why , what's problem? appreaciated. <?php class qif_email { function send_email(){ $to= "email1@mysite.com,email2@mysite.com,email3@mysite.com,email4@mysite.com,email5@mysite.com,"; $subject="inquiry"; $header="mysite.com - inquiry"; $message="date: ".$_post['date']." \r\n"; $message.="name: ".$_post['name']." \r\n"; $message.="company name: ".$_post['company_name']." \r\n"; $message.="contact: ".$_post['contact']." \r\n"; $message.="address: ".$_post['address']." \r\n"; $message.="city: ".$_post['city']." \r\n"; $message.="state: ".$_post['state']." \r\n&quo

ios - Transferring the same object between ViewControllers -

i have class, user, has nsmutablearray stores custom nsobjects. want 1 of these ever instantiated throughout entire app, , able call methods on in each viewcontroller getting , setting. problem don't know how call methods apply 1 instance, instead of creating new 1 each time. i'm new objective-c, learning curve makes me feel i'm missing bit obvious. i've been working on day , @ wit's end. there solution dilemma? should use singleton class? (if helps, class user class stores to-do list each user uses app. custom nsobjects to-do items. there's better storage method should used here, i'm not sure is.) randompleb sounds you're looking singleton. http://en.wikipedia.org/wiki/singleton_pattern . think question has been answered before search around on so. laymen's terms; create static reference class want 1 of inside class, make static method in following way: //call classes want modify public static getsharedinstance() { if(the sta

php - My button is not showing up the list after clicking? -

i've created webpage using php "everyone.php". now have twitter bootstrap drop down menu buttons, it's working fine check different page i've create page menu drop_down_menu.php . i'm calling page inside everyone.php using: <div class=ownmenu_container"> <?php include './drop_down_menu.php'; ?> </div> but unfortunately after running whole process, it's not showing list click buttons, did checked jquery , why i'm unable open list, can please ..? help appreciated! here everyone.php source code: <?php session_start(); require("conection/connect.php"); $tag=""; if (isset($_get['tag'])) $tag=$_get['tag']; ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3

java - Replacing System.err.println in quick debug of short code examples -

i have write short code samples using ide overkill; use gedit. debugging purposes, i've been using quick method dbgm . google search has thrown similar suggestions: import java.util.scanner; public class tyle { public tyle() { } /** * @param debugmessage * method takes debugmessage , prints string version * system.err.println */ private static void dbgm(object debugmessage) { system.err.println(debugmessage.tostring()); } /** * @param number */ public static int cube(int i) { int cube; cube=i*i*i; dbgm(cube); //debug message return cube; } public static void main(string [] args){ system.out.print("enter number: "); scanner s = new scanner(system.in); int inp = s.nextint(); tyle.cube(inp); s.close(); } } this has merits, can search dbgm , , leave bona fide system.out.println() calls alone. but not @ sure if using method practice, when in debug mode. have been thinking of using akin generics, provide type rather speci

javascript - Uncaught SyntaxError: Unexpected end of input on popup.html file in Chrome Extension -

i'm making chrome extension first time. when right click extension icon , inspect popup error i'm getting. uncaught syntaxerror: unexpected end of input myextension /popup.html and fact it's failing on html file making me confused. looked through 10 other similar questions , of time it's apparently syntax error in javascript file. i've linted mine couple different linters , still nothing showing up. me spot mistake here? it's 62 lines: function updatepopup(){ listofbad = json.parse(localstorage["badguys"]); $('#dumpster').empty(); var = 0; for(i = 0; < listofbad.length; = i+1){ $('#dumpster').append( listofbad[i] + "<br>"); } } $(document).ready(function(){ if(localstorage["badguys"] != undefined){ var namesthe = json.parse(localstorage["badguys"]); updatepopup(); chrome.tabs.query({ active: true, curren

mediacodec - Received wrong frame data with ExtractMpegFramesTest in Android? -

i'm trying frames using mediacodec , found extractmpegframestest.java example site http://bigflake.com/mediacodec/ . save frames looks little weird. don't know wrong it. maybe color space? here frame: https://drive.google.com/file/d/0bxhkrytbr4admgj1awhhnjdhudg/edit?usp=sharing many in advance. edit: things worked if video resolution 480x360 gadmei tablet. if it's bigger, similar results above (green screen part of frame). limitation of mediacodec or example working on? edit 2: it worked fine big resolution 1920x1080 on nexus 7. maybe problem of device. what resolution produces bad output on device? you can at: android: mediacodec: bad video generated on nexus 480x480 while 640x640 works well may have same issue

http - PHP Photo incorrect format -

i'm trying upload photo using php http post i'm getting following error: warning : imagecreatefromstring(): gd-jpeg: jpeg library reports unrecoverable error: in /home/randomma/public_html/randommash/web service/main.php on line 205 warning : imagecreatefromstring(): passed data not in 'jpeg' format in /home/randomma/public_html/randommash/web service/main.php on line 205 warning : imagecreatefromstring(): couldn't create gd image stream out of data in /home/randomma/public_html/randommash/web service/main.php on line 205 warning : imagejpeg() expects parameter 1 resource, boolean given in /home/randomma/public_html/randommash/web service/main.php on line 205 here code using try save file: imagejpeg(imagecreatefromstring(base64_decode($_post["img"], true)), "/users/images/20/".md5(uniqid()).".png");

reflecting random walk in matlab? -

Image
this question has answer here: matlab — random walk boundaries, vectorized 2 answers i have array of 10 vectors 'x' below (for simulating 1d random walk): r=rand(10,1000); r(r>.5)=1; r(r<=.5)=-1; x=cumsum(r); the image of 1 vector like: if consider 2 values in sequence , +10 , -10, reflect sequence 'x' when reaches values. how achieve this? before answering question, should point code broken. default cumsum accumulate data across first dimension, change behavior should specify dim parameter: x = cumsum(r,2); and, answering question, invert data above threshold : threshold = 10; nsteps = ceil( max(abs(x(:))) / (2*threshold) - 0.5 ); ii = 1:nsteps ind = abs(x) > 10; x(ind) = 20 * sign(x(ind)) - x(ind); end

C Multithreading - Sqlite3 database access by 2 threads crash -

here description of problem: i have 2 threads in program. 1 main thread , other 1 create using pthread_create the main thread performs various functions on sqlite3 database . each function opens perform required actions , closing when done. the other thread reads database after set interval of time , uploads onto server. thread opens , closes database perform operation. the problem occurs when both threads happen open database. if 1 finishes first, closes database causing other crash making application unusable. main requires database every operation. is there way can prevent happening? mutex 1 way if use mutex make main thread useless. main thread must remain functional @ times , other thread runs in background. any advice make work great. did not provide snippets problem bit vast if not understand problem please let me know. edit: static sqlite3 *db = null; code snippet opening database int open_database(char* db_dir) // argument db path rc = sqlite3_o

regex - Whole words in python regular expression -

how find whole words using regular expressions in python? use beautiful soup , re library parse document. in soup need find contents after word 'e-mail'. try for sublink in link.findall(text = re.compile("[e-mail:0-9a-za-z]")): print sublink.encode('utf-8') but not work. here working example word extraction via regular expressions: import re text = "first line\n" + \ "second line\n" + \ "important line! e-mail:mail@domain.de, phone:991\n" + \ "another important line! e-mail:tom@gmail.com, phone:001\n" + \ "another line" print text emails = re.findall("e-mail:([\w@.-]+)", text) print "found email(s): " + ', '.join(emails) output: found email(s): mail@domain.de, tom@gmail.com not sure if that's looking for. edit: characters 0-9a-za-z can written \w . , yes, added . , - . put them [\w@.-] if there more possible characters.

html5 - Mailto:subject age old query -

i have question , think know answer. have html code im using action="mailto: function. my question can assign subject generated email selection in code below? e.g. subject: urgent; when urgent selected. <head> <title></title> </head> <body> <form enctype="text/plain" method="post" id="orderform" action="mailto:randomeemail@gmail.com?subject" > <table border="1" align="left" style="width: 100%"> <tbody>`enter code here` <tr> <td style="text-align: justify;"><label for="element_10" class="deliverys">what type of delivery required?</label></td> <td style="text-align: justify;"> <select name="urgency required"> <option value="standard">standard delivery</option> <option value

How to escape ':', "," and '()' under javascript array which supports both window and linux? -

i have javascript array special characters getting populated back-end database. wanted escape characters on front-end form query string results properly. array shown below: var = new array(); a[0] = "abc,def"; a[1] = "abc:def"; a[2] = "abc(def)"; my query string formation shown below: http://localhost:8080/search/?ar=and(or(category1:abc,def),or(category2:abc:def),or(category3:abc(def))); my query string parameter getting separated ':" character, data having ':' characters failing query results. triend encodeuricomponent() in-built functions, fails in linux box.escape special characters should support both window , linux well. on this? i not sure if understood problem. if want escape characters array, can soemthing this. var = new array(); a[0] = "abc,def"; a[1] = "abc:def"; a[2] = "abc(def)"; var excplist = [',',':','(', ')']; var res = a.map(function(i

Making wget to bypass index.html file -

i trying download images this link . want download images hydraulics section, used --no-parent , when run command wget -r --no-parent -e robots=off --user-agent="mozilla/5.0 (windows nt 5.1; rv:31.0) gecko/20100101 firefox/31.0" -a png http://indiabix.com/civil-engineering/hydraulics/ it downloads index.html. i searched issue on web, , stack overflow has 2 questions: wget downloads 1 index.html file instead of other 500 html files why wget download index.html websites? but not help. started bounty on latter question, wonder if can suggest workaround in case? quite simple: there no images on link provided. the tiny icons ("view answer" etc.) part of css definition anchor (background-image). per now, wget not parse external css , pick images there. with -a png wget stop @ first file (.html) since doesn't match. i've succeded downloading with lwp-rget --hier --nospace http://indiabix.com/civil-engineering/hydraulics/

Fieldname#- defining struct in racket -

assuming have following code in racket: (struct st ( field1 field2# )) what # mean? nothing, it's part of name field2# . racket allows symbols used in names. that's why you've got things hash-ref! , number? ordinary functions, despite having unusual symbols. you can access , set other field: (struct st (field1 field2#)) (define (st 1 2)) (st-field1 a) (st-field2# a) this prints out 1 2 in drracket repl, expect of ordinary struct fields.

matrix - Addition of two matrices in SWI prolog -

i need addition of 2 matrices , swi prolog code of tried. answer wrong here. want corrected it. :- use_module(library(clpfd)). m_add(m1, m2, m3) :- maplist(mm_helper(m2), m1, m3). mm_helper(m2, i1, m3) :- maplist(dot(i1), m2, m3). dot(v1, v2, p) :- maplist(sum,v1,v2,p). sum(n1,n2,n3) :- n3 n1+n2. when give question follows, ?- m_add([[2,1,3],[4,2,5]],[[4,0,1],[1,7,1]],r). the answer appears this. r = [[[6, 1, 4], [3, 8, 4]], [[8, 2, 6], [5, 9, 6]]]. but answer should be, r = [[6, 1, 4],[5, 9, 6]]. actually, it's simpler think: m_add(m1, m2, m3) :- maplist(maplist(sum), m1, m2, m3). sum(x,y,z) :- z x+y. test: ?- m_add([[2,1,3],[4,2,5]],[[4,0,1],[1,7,1]],r). r = [[6, 1, 4], [5, 9, 6]]. if dealing integers, plus/3 can handy, can compute 'backward': m_plus(m1, m2, m3) :- maplist(maplist(plus), m1, m2, m3). ?- m_plus([[2,1,3],[4,2,5]],[[4,0,1],[1,7,1]],r). r = [[6, 1, 4], [5, 9, 6]]. ?- m_plus([[2,1,3],[4,2,5]],b,$r). b = [[4, 0, 1], [

SEND SMS from samsung galaxy win celphone using vb.net -

how send sms cellphone number using vb.net? have searched on internet including youtube seems not find or cant figure out start. cp cant event detected in "phone , modem" in windows... i have perfect way send sms in visual basic, using at-commands. at-commands:are instructed through can send , receive sms messages, make calls cell phone, , example send message: firstly: write code in top: imports system.io.ports imports system.io secondly: write code in public class of form: dim serialport new system.io.ports.serialport() dim cr string thirdly: create textbox(textmsgtextbox) write text message, , textbox2(mobilenumbertextbox) enter mobile number, , button(sendbut) send message. and write code in button click event. if serialport.isopen serialport.close() end if serialport.portname = com4 serialport.baudrate = 9600 serialport.parity = parity.none serialport.stopbits = stopbits.one serialport.databits = 8 serial

objective c - Xcode, Not able to detect SwipeGesture after i add Animation on my ScrollView -

before start, uiswipegesturerecognizer *seipeges=[[uiswipegesturerecognizer alloc]initwithtarget:self action:@selector(leftswipe:)]; seipeges.direction=uiswipegesturerecognizerdirectionleft; [self.view addgesturerecognizer:seipeges]; uiswipegesturerecognizer *rightgesture=[[uiswipegesturerecognizer alloc]initwithtarget:self action:@selector(rightswipe:)]; rightgesture.direction=uiswipegesturerecognizerdirectionright; [self.view addgesturerecognizer:rightgesture]; this swipe detect code run well. after add animation on uiscrollview. [uiview animatewithduration:3.0f delay:0.0f options:uiviewanimationoptionrepeat | uiviewanimationoptionautoreverse animations:^{ if(leftright==1) [imgcell.scrollview setcontentoffset:cgpointmake((-newoffsetx), 0)]; else [imgcell.scrollview setcontentoffset:cgpointmake(0, 0)];

regex - How to match exception with double character with Python regular expression? -

Image
got string , regex findall: txt = """ dx d_2,222.22 ,, dy h..{3,333.33} ,, dz b#(1,111.11) ,, dx-ay relative 4,444.44 ,, """ n in re.findall( r'([-\w]+){1}\w+([^,{2}]+)\s+,,\w+', txt ) : axis, value = n print "a:", axis print "v:", value in second (value) group trying match except double commas, seems catch 1 "," . can got in example simple (.*?) reasons got except ",," . thank you. edit: see want accomplish use r'([-\w]+){1}\w+(.*?)\s+,,\w+' instead. give such output: a: dx v: d_2,222.22 a: dy v: h..{3,333.33} a: dz v: b#(1,111.11) a: dx-ay v: relative 4,444.44 edit #2: please, answer did not include double comma exception not needed. there solution...should be. patern : any whitespace - word possibly "-" - " " - , ",," except itself. [^,{2}] character class matches character except: ',', '{', '

oauth - Google Cloud Storage - Python - Create bucket - 403 Error -

i trying use python example provide here ( https://developers.google.com/storage/docs/gspythonlibrary?hl=es-es ) while able listing of buckets work, unable create bucket working. when try create bucket using uri.create_bucket error 403 forbidden i sure have done setup , did extensive search verify things. full error message follows reply: 'http/1.1 403 forbidden\r\n' header: content-type: application/xml; charset=utf-8 header: content-length: 111 header: vary: origin header: date: mon, 18 aug 2014 07:37:00 gmt header: server: uploadserver ("built on aug 12 2014 13:30:28 (1407875428)") header: alternate-protocol: 443:quic traceback (most recent call last): file "gcsauthme.py", line 32, in <module> uri.create_bucket(headers=header_values) file "/usr/lib/python2.6/site-packages/boto/storage_uri.py", line 560, in create_bucket storage_class) file "/usr/lib/python2.6/site-packages/boto/gs/connection.py", line 1

java - Using Camel Bindy in Has-A relationship -

hi have problem exporting java object csv file in camel. suppose if have java object namely student, @csvrecord(separator=",") public class student { @datafield(pos=1) private string name; @datafield(pos=2) private string college; // getters , setters } i export object csv file using below code in camel route, .marshal(new bindycsvdataformat(camel.demo.book.class)) .to("file:data/destination?filename=book.csv") but if have 1 more entity object named address in student object. , want print particular values of address along remaing student details in csv. @csvrecord(separator=",") public class student { @datafield(pos=1) private string name; @datafield(pos=2) private string college; private address address; // getters , setters } public class address { private int houseno; private string street; private string city; //getters , setters } now want save student details (nam

c++ - linker ignores /openmp in qtcreator on windows -

when try compile openmp cpp file website , got link warning saying openmp flag ignored. lnk4044:unrecognized option '/openmp'; ignored i have added these code pro. file qmake_cxxflags+= -openmp qmake_lflags += -openmp or qmake_cxxflags += -fopenmp libs += -fopenmp as suggeted other stack overflow questions.but not solve problem. can 1 me solve problem? using qt creator 3.1.2 msvc2013 compiler on windows 7. msvc's linker not need or accept /openmp option. need option gcc (in case option -fopenmp ). although use cmake qtcreator instead of qmake here sample last qmake file use. msvc { qmake_cxxflags += -openmp -arch:avx -d "_crt_secure_no_warnings" qmake_cxxflags_release *= -o2 } gcc { qmake_cxxflags += -fopenmp -mavx -fabi-version=0 -ffast-math qmake_lflags += -fopenmp qmake_cxxflags_release *= -o3 }

XML with inline schema supported in Excel? -

i need generate simple xml file (a list of users) xsd xml can imported in excel (2010+). fields presented xml dynamic, it's user fields wants/needs. list can long , have 40 fields user can select from. excel builds table columns based upon xml schema. if first row has missing fields, these added table in wrong order. schema required! since xml based on request, xml schema must inline. based on every article find inline schema's i've created following.. crash'n burn every validator. excel won't accept either. <?xml version="1.0" encoding="utf-8"?> <users xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="#local"> <xs:schema id="local" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="users"> <xs:complextype> <xs:sequence> <xs:any processcontents="skip" namespace=

html - RGB/HEX/HSL Split 16777216 colors in basic 16 color ranges -

Image
hello need know 16 basic color ranges 1 of these rgb or hex or hsl. take example rgb. rgb split in 3 color mix r -red, g -green b -blue, each of color have 256 color shades 0 255 in total 256*256*256=16777216 colors. i need 16777216 color split in 16 ranges rgb(0,0,1) rgb(0,0,2) rgb(0,0..) rgb(0,0,255) rgb(0,1,0) rgb(0,1,1) rgb(0,1,..) rgb(0,1,255) , etc you can use website this: http://html-color-codes.info/ i use everytime colors :d

bash - How to begin at line n in a file with sed? -

when using sed sed -i 's/pattern/replacement/g' ./file.txt , how can tell sed skip first 10 lines of file, , begin replacements on 11th line? you can use address before s command in sed : sed -i.bak '11,$s/pattern/repalcement/g' file here 11,$ skip first 10 lines , start replacement 11th line onwards.

xslt - Wrapping my head around effecient solutions to copy-pasting chunks of code -

coming language php, naturally hate copy , pasting code on , on changing single variable or value. have series of code chunks in xslt copy , pasted on , on looking specific node value, , doing something. i start chunk, uses populate list of names each function: <xsl:variable name="<!-- variable of names -->"> <xsl:for-each select="//<!-- functions -->"> <xsl:for-each select="./<!-- user functions -->"> <xsl:if test="<!-- specific function -->"> <xsl:value-of select="title"/> <xsl:text> </xsl:text> <xsl:value-of select="firstname"/> <xsl:text> </xsl:text> <xsl:value-of select="lastname"/> </xsl:for-each> </xsl:for-each> </xsl:variable> here logic use grab: <xsl:if test="<!-- specific list of use

php - mysql find best matching word in one row -

i have following table: ------------------------ | uid | attrvalue | ------------------------ | 1 | spray | | 2 | strong | | 3 | strong | | 999 | creme | ------------------------ now have query in php , find rows queries found. select * attrtable match (attrvalue) against ('spray+very+strong' in boolean mode); i finds row 1 , 3. resultrows 1, 2 , 3. so important founds words or word combinations in table rows. query doesn't contain words or combined words aren't in table (i check first). just use like , other way around used to. select query table1 'attrvalue' concat(query,'%') order length(query) desc limit 1

How to download and automatic install apk from url in android -

i'm trying programmatically download .apk file given url , install it, getting filenotfoundexception . possible reason issue? try { url url = new url(fileurl); httpurlconnection c = (httpurlconnection) url.openconnection(); c.setrequestmethod("get"); c.setdooutput(true); c.connect(); string path = "/mnt/sdcard/download/"; file file = new file(path); file.mkdirs(); file outputfile = new file(file, "versionupdate.apk"); if(outputfile.exists()){ outputfile.delete(); } fileoutputstream fos = new fileoutputstream(outputfile); **//getting error in line** inputstream = c.getinputstream(); byte[] buffer = new byte[1024]; int len1 = 0; while ((len1 = is.read(buffer)) !

jquery - How to change css class attribute from ng directive? -

i have css class like .container{ width:55%; } now need write directive change width:82% according condition. directive this. controls.directive('nimaincontain', function () { return { require: '^nicontainer', restrict: 'e', transclude: true, replace: false, templateurl: 'views/templates/nimaincontain.html', compile: function (scope, ielement, iattrs, icontroller) { if (scope[0].parentelement.innerhtml.indexof("ni-right-aside") == -1) { $(".contaier").css({ 'width': '82%' }); } } }; }); views/templates/nimaincontain.html template contains ".contaier" class. when system link dire

How to install node.js in windows? -

i new node.js. can tell me steps install node.js in machine. i'm using windows 7 , visual studio 2012 development environment. thanks in advance.. download node.js installer (.msi) file follwoing link: http://nodejs.org/ and run installer double clicking , following instructions.

.net - Difference between @($null) and $null -

i have powershell code invoking .net method expects class passed parameter. the method accepts null value parameter, , in c# you'd call follows: var t = new foo(null) if translating powershell, 1 try: $t = new-object foo($null) but returns following error new-object : constructor not found. cannot find appropriate constructor type foo funilly enough, exact same error returned if call as: $t = new-object foo so first question why? .net see $null absence of something, oppose type null .net? why 2 instructions above return same error? now, found way around problem follows: $t = new-object foo(@($null)) this works fine, but... why? (@($null)).gettype() returns object[] (@()).gettype() return object[] , if run: $t = new-object foo(@()) i still get: new-object : constructor not found. cannot find appropriate constructor type foo so, second question: difference between @(), @($null) , $null? also, , last question, else don't understand.

c# - Program not being loaded -

i have vb.net windows form application(.net 4.5), have added c# based class library project in solution , 1 of vb.net projects referencing project. when build solution in debug cpu mode works fine when build in release cpu mode following exception could not load file or assembly 'tagwriter, version=1.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. attempt made load program incorrect format. any appreciated. thanks

c# - Action Filter Attribute does not work correctly with Hub class -

in asp.net web api using action filter attribute override onactionexecuting , onactionexecuted validate token send client in header when adding attribute on controller can intercept request before passing functions in controller till every thing working fine not true if add same attribute on hub class when debug can see methods on hub excuted first onactionexecuting , onactionexecuted . how solve problem. [ourauthorization] public class notificationhub : hub { private accplusentities1 db = new accplusentities1(); public void trnaddednotfication(string groupname) { clients.othersingroup(groupname).addednotfication(); } public void trndeletednotfication(string groupname) { clients.othersingroup(groupname).deletednotfication(); } public void joingroup(string accname) { var x = basecontroller.currentuser.accid; groups.add(context.connectionid, accnam

c++ - Using random number generator: multiple instances or singleton approach? -

i created class can use random number generator works better standard rand(). below i've included .cpp file class contains class variables std::mt19937 gen , std::uniform_real_distribution distr. my question whether it's necessary create multiple instances of number generator. instance if have classes , b , each class needs sample random numbers both within range [0,1] better if , b each had own instance of uniformnumbergenerator or should take singleton approach , use 1 instance both classes? uniformnumbergenerator::uniformnumbergenerator(double min, double max) { gen = creategenerator(); distr = std::uniform_real_distribution<double>(min, max); } std::mt19937 uniformnumbergenerator::creategenerator() { std::random_device rd; std::mt19937 result(rd()); return result; } //take sample double uniformnumbergenerator::operator()() { return distr(gen); } one legitimate reason have multiple instances of pseudo-random number generator (

node.js - Model.create retrive how many documents have been created -

i using model.create(array) in mongoose. want provide user feedback how many documents have been created , how many of them haven't (i.e. didn't validate). created callback user.create(userstoimport, function(err, docs) { console.log(err); console.log(docs); } the problem if document not validate, receive validation error on single non-valid document, while cannot retrieve information inserted documents. there way information? i think, need .settle() method when.js module . here example of doing using when.js mongoose 3.8.x : when = require('when'); promises = userstoimport.map(function(user) { return user.create(user); // returns promise }); when.settle(promises).then(function(results) { // results array, containing following elements: // { state: 'fulfilled', value: <document> } // { state: 'rejected', value: <error> } }); it's possible without promises (e.g. using async module ), c

sap - How to call generic object services in a report? -

Image
hi, i have repot attachment list object. want display these list. best way display it? report zay_gos_demo. data ls_appl_object type gos_s_obj. data lo_gos_api type ref cl_gos_api. data lt_attachment_list type gos_t_atta. data lt_role_filter type gos_t_rol. data ls_attachment type gos_s_atta. data ls_attachm_cont type gos_s_attcont. data ls_atta_key type gos_s_attkey. ls_appl_object-typeid = 'kna1'. ls_appl_object-instid = '0000000001'. ls_appl_object-catid = 'bo'. "bo - bor object "cl - persistent class start-of-selection. * create instance of gos api providing unique application object try. lo_gos_api = cl_gos_api=>create_instance( ls_appl_object ). * attachment list object (if needed restrict selection * adding roles filter table; initial table means: * attachments in roles) append cl_gos_api=>c_attachment lt_role_filter. append cl_gos_api=>c_annotation lt_role_filter. append cl_gos_api=

windows - Remove file ext from batch -

hay have search around here alot , try whole day remove file ext path name i try after b variable set, won´t work, when im asking somewhere can tell in foreach folders can loop in? now loop in in folder want loop in folder a-z , no files in working directory /mvh lukasz @echo off & setlocal enabledelayedexpansion :: foreach files in folder /r . %%f in (*) ( :: file extension set a=%%~xf echo !a! :: set path set b=%%f :: remove file ext set d=!b:!a=% echo !d! :: show result ::echo !d:%cd%\=! mkdir "%cd%\root\!b:%cd%\=!" ) pause @echo off setlocal enableextensions disabledelayedexpansion /r "%cd%" %%a in (*) %%b in ("%%~dpa.") ( if not exist "%cd%\root\%%~nb\%%~na\" echo mkdir "%cd%\root\%%~nb\%%~na" ) if output console correct, remove echo create folders

c# - Thread not ending possible that exceptions cause this? -

i'm starting multiple threads different things. threads have "endme" boolean variable. when try end threads setting variable , end debugger screams not end processes. after debugging bit found out processes go "ending" part of code when "end me" variable set accordingly. exception happens , thrown. now question is: can exception causes thread not able ended longer? promoting comment answer since correct , might relevant. in absence of code reproduce problem, note if communicating between threads setting boolean variable "endme", need use volatile reads , writes access variable, instance (in .net 4.5): public class threadedworker { bool endme = false; public bool endsignalled { { return volatile.read(ref endme); } } public void signalend() { volatile.write(ref isended, true); } } or in c# versions can use volatile keyword public class threadedworker { volatile bool endme = false;

json - How to show array element details which includes object details -

i have retrieve data .json file. while showing details unable show object details lies in array .json { "data":{ "questions":{ "level":[ { "question":[ { "title":"what grc stand for?", "answer":[ "global technical system", "global trade services", { "_correct":"1", "__text":"governance, risk, , compliance" }, "global testing site" ] }, { "title":"which not sap® version?", "answer":[ &q

mongodb - Is there a way to query Mongo based on the length in bytes of a particular field? -

since hard limit of 1024 bytes indexes in mongodb 2.6.x, i've had remove useful compound index included text field quite long , contained high unicode characters exceeding byte limit. i've had replace hashed index on single field forces mongodb open bson inspect other fields outside of hashed index. i'd try , remove these long results (so can restore original compound index), don't know how query field's data exceed number of bytes. know way? so far i've gone option... i've created new field in data (which unfortunate since requires significant io). script goes through , sets value each document. db.example.find({lb: {$exists: false}}).limit(200000).foreach(function (obj) { var lengthbytes = encodeuricomponent(obj.text).replace(/%[a-f\d]{2}/g, 'u').length; // print("id=" + obj._id + ";lenbytes=" + lengthbytes); db.example.update({ _id: obj._id }, {$set: { lb: numberint(lengthbytes)} }); })