Posts

Showing posts from May, 2015

xsd - Cannot resolve the name X to an element declaration component in a recursive xml schema -

i'm beginning working xml schemas. i'm creating simple schema , don't understand why error while trying implement simple recursive element. i'm sure it's totally trivial. here following error: e [xerces] src-resolve: cannot resolve name 'node' a(n) 'element declaration' component. <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified"> <xs:element name="root"> <xs:complextype> <xs:sequence> <xs:element name="node"> <xs:complextype> <xs:sequence> <xs:element ref="node" /> </xs:sequence> </xs:complextype> </xs:element> </xs:sequence> </xs:

javascript - REST api GET with jQuery, not working -

here code html: <form name="test" id="test" method="post"> <input type="submit" name="sub" value="hit me" class="page"/> </form> jquery: $.ajax ({ type: "get", url: "https:// url", datatype: 'json', async: false, headers: {"authorization": "bearer xxxx"}, success: function (){ alert('yay!'); } }); result: {"error": "shell form not validate{'html_initial_name': u'initial-js_lib', 'form': <mooshell.forms.shellform object @ 0x260c6d0>, 'html_name': 'js_lib', 'html_initial_id': u'initial-id_js_lib', 'label': u'js lib', 'field': <django.forms.models.modelchoicefield object @ 0x260c7d0>, 'help_text': '', 'name': 'js_lib'}{'html_initial_name': u'

jQuery(window).scrollTop() issue in Firefox? -

i have following code use display hidden footer when scroll down past point on page. jquery(document).scroll(function(){ if(jquery(window).scrolltop() >= jquery('.foot').offset().top + jquery('.foot').height() - window.innerheight) { // add class here } else { // remove class here }); this works fine in chrome , ie. doesn't work in firefox. i've narrowed problem down jquery(window).scrolltop(). i've created test http://jsfiddle.net/captainmorgan/cvsre/1/ open in chrome , scroll down mouse wheel. 100. when same thing in firefox 114, firefox continues display multiple messageboxes , number keeps decreasing. know why firefox this? try: jquery(window).scroll(function(event) { var nextscroll = jquery(this).scrolltop(); if(nextscroll > (jquery('.foot').offset().top + jquery('.foot').height() - window.innerheight)) { //action } });

windows - setup InstallShield Limited Edition 2013 in win8.1 -

i setup installshield limited edition 2013 visualstudio2013 in win8.1. setup packet download http://learn.flexerasoftware.com/content/is-eval-installshield-limited-edition-visual-studio . , progress of setup correctly.but when setup finished,i can't find installshield in vs's new project(just has add-in installshield limited edition). i've tried in win7/win8, it's works,but win8.1 it's may have wrong. can me? thx i've searched answers,but there unuseful: installshield le not working in vs2013 in windows 8.1 install shield limited edition in visual studio 2013 express i've solve question.my system win8.1 enterprise 64bit,i'm not sure problem caused system or vs or both of them. in end, changed system win8.1 pro 64bit , correct. , i've try setup win8.1 enterprise 64bit in visualmachine, problem persists. guess it's error in win8.1 enterprise. guess. have no time find solution in win8.1 enterprise , setup win8.1 pro instead.

java - Issue with addMouseMotionListener getting wrong coordinates -

Image
i borrowed class below make selection area tool project. has issue when try make selection when content not aligned @ top-left, mouse coordinates related scrollpane, draws on image - see ss better understanding: sscce : import java.awt.borderlayout; import java.awt.color; import java.awt.dimension; import java.awt.graphics2d; import java.awt.point; import java.awt.rectangle; import java.awt.robot; import java.awt.toolkit; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; /** getting rectangle of interest on screen. requires motivatedenduser api - sold separately. */ public class screencapturerectangle { rectangle capturerect; screencapturerectangle(final bufferedimage screen) { final bufferedimage screencopy = new bufferedimage(screen.getwidth(), screen.getheight(), screen.gettype()); final jlabel screenlabel = new jlabel(new imageicon(screencopy)); jscrollpane screenscroll = new jscrollpane(screenlabel); screen

java - W3C module does not exist -

i try y! weather xml parsing sake of learning using bluej. when compiled class, bluej giving me error: package org.w3c not exist here code: import java.net.url; import java.io.inputstream; import javax.xml.parsers.documentbuilderfactory; import javax.xml.parsers.documentbuilder; import org.w3c.*; public class weatherapp { public static void main(string[] args) { url xmlurl = new url("http://weather.yahooapis.com/forecastrss?w=22722924&u=c"); inputstream xml = xmlurl.openstream(); documentbuilderfactory dbf = documentbuilderfactory.newinstance(); documentbuilder db = dbf.newdocumentbuilder(); document doc = db.parse(xml); xml.close(); system.out.println(doc); } } what go possibly wrong here? , how fix it? thanks

ruby on rails - Refactor code to avoid circular logic in controller -

situation : one form allows users select multiple quantities of items they'd request this form posts 2 models, 1 parent: request, , child: items. upon submit, 1 request created, several items created, depending on quantity indicated to handle this, have 2 sets of params, 1 items, 1 requests desired end state : i not want item created without request nor request created without item all errors present in form (whether it's not selecting @ least 1 item, or errors in attributes of request object) shown user once page re-rendered; i.e., error checking together current hacky solution & complication : currently, i'm checking in stages, 1) there quantities in items? if not, regardless of user may have put request attributes, page re-rendered (i.e., attributes request lost, validation errors shown). 2) once first stage passed, model validations kicks in, , if fails, new page re-rendered again i've spent waaaaay long thinking this, , nothing elegant

javascript - Looping through an array and setting variables -

what have far: http://codepen.io/anon/pen/umhzl?editors=101 you notice can click box , unclick it. when button clicked other buttons unclicked(turn normal color). my attempt @ this: (var =0; < booths.length; i++){ var obj = booths[i] obj.e1['fill'] = obj['color']; obj.e1['checked'] = 'false'; $("#"+obj.name).remove(); } i know color in e1/rectangle object of box, not know how change/access variable. says obj.e1 undefined. if obj['fill'] still doesn't work. how change colors such loop (or similar). it's not e1 , it's el (lowercase 'l'). , you'll still want use attr() function, e.g.: for (var =0; < booths.length; i++){ var obj = booths[i] obj.el.attr('fill', obj['color']); obj.el.attr('checked', 'false'); $("#"+obj.name).remove(); } example: htt

How to write Java generic method with E... elements and return List<E> -

i want write method follow public static <e> arraylist<e> newlist(e... elements){ arraylist<e> list = new arraylist<e>(elements.length); addall(list,elements); return list; } it works when use this list<string> = listutils.newlist("a","b"); but can't compile in case list<class> c = listutils.newlist(string.class,long.class); how can fix problem ? thank ! if understand you, can wildcard ( jls-4.5.1 ) so, public static void main(string[] vargs) { list<class<?>> c = listutils.<class<?>>newlist(string.class,long.class); } also, newlist wouldn't compile posted it. assume should like, public static <e> list<e> newlist(e... elements) { list<e> list = new arraylist<e>((elements != null) ? elements.length : 0); (e elem : elements) { list.add(elem); } return list; }

javascript - How to get D3 Tree link text to transition smoothly? -

visualization goal: build d3 tree has text at, both, nodes , links, , transitions cleanly, when nodes selected/deselected. problem: while can link text, called "predicates," show along centroid of link paths, can't seem them transition in , out "smoothly." question: can please me please me clean code , better understand how tree "link" transitions behaving understand theory behind code? visualization , source location: http://bl.ocks.org/guerino1/raw/ed80661daf8e5fa89b85/ the existing code looks follows... var linktextitems = vis.selectall("g.linktext") .data(tree.links(nodes), function(d) { return d.target.id; }) var linktextenter = linktextitems.enter().append("svg:g") .attr("class", "linktext") .attr("transform", function(d) { return "translate(" + (d.target.y + 20) + "," + (getcenterx(d)) + ")"; }); // add predicate text each link path li

how to post JSON obj with attribute, to an API url using PHP? -

really stumped @ how approach - need to: take json data attribute, php post api/url. should have json file in folder, file call url , pass json? how can return calculation results via json? learn this, have array of numbers, perform calculations return mean, median, mode, , range. working files need available api. sample json data post: { "numbers": [ 5, 6, 8, 7, 5 ] } sample json return response single endpoint called "/mmmr" [abbrev calculations]: { "results": { "mean": 6.2, "median": 6, "mode": 5, "range": 3 } } been searching, trying things hours, not clicking @ all. have class calculate call , returns results calculations already, how "make available via api"? please sample working code, perhaps can understand seeing it.

Apache permission for php to run `git pull` -

i'm running in trouble new vps. created file pull.php code in git folder: <?php $output = shell_exec('git pull'); echo "<pre>$output</pre>"; ?> it working fine on shared hosting on vps it's return null , no 'pull' command executed. when change command 'git pull' 'git status' it's show result : on branch master branch up-to-date 'origin/master'. untracked files: (use "git add ..." include in committed) info.php pull.php test.txt nothing added commit untracked files present (use "git add" track) my folder chmod 777 , php seems can write on properly. 'git pull' on ssh's fine. server : ubuntu 14.x, apache2, php5 i appreciate help! i find weird no output nothing... do have root access? try root in right folder: sudo -u apache git pull see if output then.

java - Read XML file from containing JAR -

i trying read xml file inside of jar. my folder structure this: [root] src (source folder) [my java files] res (source folder) xml lorem_ipsum.xml (xml file wish read) and i'm trying use code read file: documentbuilderfactory dbfac = documentbuilderfactory.newinstance(); documentbuilder db = dbfac.newdocumentbuilder(); classloader cl = thread.currentthread().getcontextclassloader(); inputstream stream = cl.getresourceasstream(path); if(stream == null) { return null; } document doc = db.parse(stream); but it's not working. stream keeps on being null when specifiy /xml/lorem_ipsum.xml path . based on posted directory structure... [root] src (source folder) [my java files] res (source folder) xml lorem_ipsum.xml (xml file wish read) res doesn't seem embedded resource. instead try using new file("res/xml/lorem_ipsum.xml") instead of trying inputstream

php - Return Last Insert ID with PDO -

i have class , extend return id of last inserted row keep getting error: fatal error: call undefined method pdostatement :: lastinsertid () on line 49 my code: class db { public static $instance = null; private $_pdo = null, $_query = null, $_error = false, $_results = null, $_count = 0, $_lastid = 0; private function __construct() { try { $this->_pdo = new pdo('mysql:host=' . config::get('mysql/host'). '; dbname=' . config::get('mysql/db') . '; charset=utf8', config::get('mysql/username'), config::get('mysql/password') ); } catch(pdoexeption $e) { die($e->getmessage()); } } public static function getinstance() { if(!isset(self::$instance)) { self::$instance = new db(); } return self::$instance; } public function query($sql, $

android - Change Layout Background Drawable Color based on Value -

Image
so have android application in sliders used set value multiple parameters. using "google cards" type of layout each slider box. each card own relative layout contained within linearlayout placed within scrollview. change color of card based on value user sets in card, however, problem have color background defined in xml card design. how can change color in xml card design based on value user puts in on slider? also, there way have gradient effect when changing colors. example, 0 strong red, while 10 strong green, 5 yellow , 2.5 mix between red , yellow , 7.5 mix between yellow , green. xml layout background: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle" android:dither="true"> <corners android:radius="2dp"/> <solid android:color="#ccc&quo

android - Make content inside scrollView match display size -

i have scrollview relativelayout inside it. <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true"> <relativelayout android:id="@+id/towrap" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background_color"> i want make relativelayout not fill parent, fill display . i want because when open keyboard, layout gets ugly. i've tried create expandablerelativelayout subclass ondraw this: @override protected void ondraw(canvas canvas) { displaymetrics metrics = resources.getsystem().getdisplaymetrics(); setlayoutparams(new layoutparams(layoutparams.fill_parent, (int)(metrics.heightpixels * metrics.density))); super.ondraw(canvas); } but received error

javascript - Difference between ways to declare a scope in a directive (ways shown inside) -

i'm new angularjs, javascript , html. my question is: ¿what difference between 4 ways declare scope in directive? i'm going show way , write think it. if i'm wrong or right, tell me in ordered way please. this base in directive: var app = angular.module('myapp', []); app.directive('mydirective', function() { return { scope: //here go 4 ways } }); first way: scope: true what understand that: a - new child scope created , child scope inherits parent scope surround it. b - directive have access parent scope models. c - possible insert values in scope. or scope meant give access inherited data? second way scope: { // no content, empty object } a - creates isolated scope. b - scope can't access parent models. c - although scope can't access parent scope, isolated scope can have child scopes. third way //nothing, not declaring scope attribute. fourth way scope: {// content such data binding strategies

encoding - Replacing character in magento product descriptions after import -

i imported on 20k items magento. the original data access db. in descriptions, " showing � for example, original description reads: this arrangement approx. 32" - 34" tall. on magento front-end reads: this arrangement approx. 32�-34� tall. reimporting data not option.... need able either have shown correctly in magento front-end using hack or somehow replace these characters proper characters in mysql database, or somehow change encoding... any suggestions appreciated. hi need save csv in utf-8 format before import

RegEx Multiple Matches -

i'm having trouble regex match. here string: (<a href="http://www.test.com/test/test.jpg">lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>) lorem ipsum dolor <a href="http://www.test.com/test/test.jpg">sit amet</a> consectetur adipiscing elit. the regex pattern i'm using is: /(<)(.*=")(.*)(">)(.*)(<\/.*>)/g the problem it's picking 1 match because of .* before in last matching group in regex pattern. want find 2 matches of pattern (which there in string). how stop @ first instance of > when searching? figure trick. i've heard called 'non-greedy'? i've tried + , ? neither seem work i'm doing. thanks! fyi , fwiw, accepted wisdom on regex not best way parse html... but if you're sticking regex, main problem .* quantifiers eat characters end of string. can fixed adding ? make quantifiers "lazy": .*? the * quantifier means zero o

django variable of one view to another from session -

i m confused on , dont have idea how this.. have view have listed news news table. display news have passed context data in list view. here view class singlenewsview(listview): model = news form_class = searchform template_name = "single_news.html" # def post(self, request, **kwargs): # print "request" # form = searchform(request.user) def get(self, request, pk, **kwargs): #form = searchform(request.user) self.pk = pk self.pub_from = request.get.get('pub_date_from',false) self.pub_to = request.get.get('pub_date_to',false) self.crawlers = request.get.get('crawler',false) print self.crawlers return super(singlenewsview,self).get(request,pk, **kwargs) def get_context_data(self, **kwargs): context = super(singlenewsview,self).get_context_data(**kwargs) context["form"] = searchform if self.pub_from , self.pub_to , self.crawlers: context["something"] = news.

ios - Send commands to PJSIP APP -telnet console iPhone -

actually want build 1 iphone app use pjsip library. have downloaded latest pjsip available. , commandline tool. and successfuly able build pjsua app on iphone.and can see black screen pjsip logo , label displaying- telnet 192.168. . :2323. but dont see console ,where can enter commands,as mentioned in pjsip document. i need initial setup .like how send command etc ,if can. grateful,if can share experince , knowledge me. i've start same things in meanwhile ago too. open cmd or terminal , type in following command: telnet 192.168.1.40 2323 and should working. luck!

c# - wpf splash screen lagging while loading main window -

i doing wpf application , today faced troubles. need show splash screen while initializing mainwindow. code below: public mainwindowview() { onload(); } public void onload() { worker = new backgroundworker(); lw = new waitwindowview(); lw.show(); worker.dowork += delegate(object s, doworkeventargs args) { dispatcher.invoke(new action(delegate() { initializecomponent(); datacontext = new navbarvm(); }), dispatcherpriority.background); }; worker.runworkercompleted += delegate(object s, runworkercompletedeventargs args) { lw.close(); }; worker.runworkerasync(); } above code working. splash screes lagging. your call dispatcher.invoke make code in dowork handler run on ui thread, using backgroundthread pointless. furthermore, can't call initializecomponent on background thread either, not speed things up. the normal way display splash screen can found in answer how

java - Channels.newChanne() will help to achieve actual ZeroCopy -

i have doubt regarding using channels.newchannel(outputstream/inputstream) in zerocopy operation. serve zerocopy. have restriction have send 1st header part(file , user related information) file content. testing, override bufferedoutputstream, on filechannel.transferto call, calling override methods... please me how achieve zerocopy in such circumstances(header+content). part of testing code: string host = "127.0.0.1"; socketaddress sad = new inetsocketaddress(host, zerocopyserver.port); socket s=new socket(); s.connect(sad); outputstream o=s.getoutputstream(); outputstream out=new bufferedoutputstream(o); writablebytechannel ch=channels.newchannel(o); //can use //writablebytechannel ch=channels.newchannel(out); string msg="hi how , doing..."; out.write(msg.getbytes()); out.flush(); string fname = "hello.txt"; string fname2 = "input"; long filesize = new file(fname).length(); filechannel fc = new fileinputstream(fname).getchannel(); f

sql - Select Query to check both or either or condition -

i'm using postgresql 9.1 , wish select single record table. details below : table name : muser fields present in table : userid,username,firstname,lastname,phonenumber , mailid fields selected : userid, mailid, phonenumber request parameter : mailid , phonenumber conditions should satisfied: display record when both present display record when mailid present display record when phonenumber present. expected output: single record (as userid unique) userid, phonenumber , mailid both or 1 if present. i have tried query : select userid, mailid, phonenumber muser phonenumber = ? or mailid = ? it's working fine first 2 conditions not working last condition..when fire query last condition gives records present in query.why so? changes in query? or else assuming when mean "not present", mailid or phonenumber null in database, select userid, mailid, phonenumber muser (phonenumber = ? , (mailid null or mailid = '&

android - Is Yammer API redirection temporary or permanent? -

i have been creating android app calls yammer api retrieve files yammer. recently, found out original yammer file link ( https://www.yammer.com/api/v1/uploaded_files/ ) redirected new url ( https://files.yammerusercontent.com/v2/files/ ). all file api calls broken in app, , have managed fix getting redirected url (its 307 redirection) , re-grab file new url. 307 redirection temporary redirection, know whether temporary change, or works way now? i have not released fixed app production yet not sure whether change take place there's nothing mentioned in yammer api guideline new yammerusercontent.com domain either. the files endpoint using isn't documented currently, unsupported , may not have been communicated developers way end users. can use @ own risk, may need have integration tests check changes. keep eye on yammer requirements page. the *.yammerusercontent.com has been documented in yammer requirements quite time, , there more recent kb article cov

sql - How to deal with DATE column of multiple tables -

i have 5 tables namely transaction, receipt, payment, wutran, mydates. mydates table contains dates.it has 1 single column dt. , remaining tables have 2 columns namely date,amount. have calculate sum of amounts these 4 tables group 'dt' column of mydates. query follows: select m.dt, (sum(t.amount)+sum(r.amount)+sum(p.amount)+sum(w.amount)) sum_amount transaction t, receipt r, payment p, wutran w inner join mydates m on t.[date]=m.dt , r.[date]=m.dt , p.[date]=m.dt , w.[date]=m.dt group m.dt but getting following error: msg 4104, level 16, state 1, line 2 multi-part identifier "t.date" not bound. msg 4104, level 16, state 1, line 2 multi-part identifier "r.date" not bound. msg 4104, level 16, state 1, line 3 multi-part identifier "p.date" not bound. can me out error...... error because of join applicable wutran , mydates , can try other condition where it's not recommended. try this select m.dt,(sum(t.amoun

ios - Animate rotation of SKSpriteNode -

i attempting rotate skspritenode face direction of cgpoint . have managed so: cgpoint direction = rwnormalize(offset); self.player.zrotation = atan2f(direction.y, direction.x); how call skspritenode animate rotation rather being instantaneous. possible keep same speed of rotation in animation no matter sprite should turn? in advance! use skaction : cgpoint direction = rwnormalize(offset); float angle = atan2f(direction.y, direction.x); // speed of rotation (radians per second) float speed = 2.0; float duration = angle > m_pi_2 ? angle/speed : (angle + m_pi_2)/speed; [self.player runaction: [skaction rotatetoangle:angle duration:duration]];

Use of CacheLoader and CacheWriter in Gemfire -

i have client server topology in gemfire. want use cacheloader , cachewriter synchronize in memory gemfire cache rdbms database oracle. should plug in these cacheloader , cachewriter..in client regions or server regions or can choose 1 of these? i server regions. there's no reason why client app should depend on rdbms in case.

c++ - What happens when an object is left uninitialized during a copy constructor or in a assignment operator? -

suppose have vector object 1 of attributes , do't initialize in copy constructor, happen then? if other object does't have default constructor, happen? suppose have vector object 1 of attributes , do't initialize in copy constructor, happen then? i suppose pertaining initializing @ constructor initializer list. if so, default constructor called, seem have answered here... also if other object does't have default constructor, happen? your program not run. more specifically, compiler shoot out error, indicating you're trying (or implicitly trying) use object's non-existing or inaccessible constructor. try see self ;) . a way (read: not the way) get-around these types of objects have them dynamically allocated, is, use std::unique_ptr s of them. in way, delay construction when necessary arguments have been obtained. better way though, if can , should, augment or wrap class of object incorporate move semantics. move semantics, eliminate

css - Changing className vs Changing innerHTML -

i need toggle 2 words (i.e hello & world). have created 2 span s , using css toggling them. can create single div , change innerhtml alone. question 1 valid , efficient? below sample html, css, js code. <div class='enablecss2'> <span class='css1'>hello</span> <span class='css2'>world</span> </div> .css2 { display:none; } .enablecss2 .css2 { display:block; } .enablecss2 .css1 { display:none; } <script> function toggle(el,event) { if(el.classname == '') el.classname = 'enablecss2'; else el.classname = ''; } </script> both valid methods, , in terms of rendering speed of toggle doesn't matter. in terms of efficient coding (= less code same result), innerhtml method better method, because need less html , no css code that: <div class='enablecss2'> hello </d

vb.net - Arithmetic operation resulted in an overflow—blowfish algorithm -

when execute code: dim bytearray() byte = system.io.file.readallbytes("c:\users\fery ferdiansyah\desktop\asd\asd.txt") dim key() byte = system.text.encoding.utf8.getbytes("swagger") dim bf new blowfish2(key) this syntax y = s(0, a) + s(1, b) in function causes arithmetic overflow: private function f(byval x uinteger) uinteger dim ushort dim b ushort dim c ushort dim d ushort dim y uinteger d = cushort((x , &hff)) x >>= 8 c = cushort((x , &hff)) x >>= 8 b = cushort((x , &hff)) x >>= 8 = cushort((x , &hff)) y = s(0, a) + s(1, b) y = y xor s(2, c) y = y + s(3, d) return y end function could me fix function? you can either disable integer overflow checking ( advanced compiler settings dialog box (visual basic) ) or declare y uint64 then return cuint(y , &hffffffff)

ios - I need help getting a normal looking unicode down arrow in a UILabel like this ⬇ -

i down arrow display inside uilabel. ⬇ unicode: u+2b07. show sort order on column header. i have seen code unicode characters display , when use symbol above doesn't display expected rather comes blue down arrow gloss. has seen this? displaying characters "emojis" feature e.g. (controversially) discussed here: https://devforums.apple.com/message/487463#487463 (requires apple developer login). feature introduced in ios 6. a solution (from https://stackoverflow.com/a/13836045/1187415 ) append unicode "variation selector" u+fe0e, e.g. self.mylabel.text = @"\u2b07\ufe0e"; // or: self.mylabel.text = @"⬇\ufe0e"; note on ios <= 5.x, variation selector not necessary , must not used , because ios 5 display box. in swift be mylabel.text = "⬇\u{fe0e}"

javascript - Form post warning message after upgrading jquery -

i have upgraded jquery 1.10.2. using jquery migrate , having warning message "jquery.parsejson requires valid json string" i have not understood how can correct that. can me out best solution of how can remove warning message the javascript follows: function search() { $.ajax({ cache: false, contenttype: "application/json; charset=utf-8", datatype: "html", url: "@url.action("search")", data: json.stringify({mymodel: $("#datefrom").val()}), success: function (data) { $("#newdiv").html(data); }, error: function (request, status, error) { displayerror(parseerrorfromresponse(request.responsetext, "unknown error"), true); } }); } in controller: public partialviewresult search(mymodel mymodel) { retur

java - Unable to locate tools.jar by ant command JAVA_HOME and PATH is set for jdk instead jre -

i using windows 7 java installed in program files , program files (x86). getting such error "unable locate tools.jar. expected find in c:\program files\java\jre7\lib\tools.jar have set path variable `c:\program files\java\jdk1.7.0_51;` java_home `c:\program files\java\jdk1.7.0_51;` but tried ant -diagnostics command java.home c:\programe files\java\jre7\ i had same issue. echo %java_home% : c:\program files\java\jdk1.8.0_51 but ant -diagnostics indicated: java.home : c:\program files\java\jre1.8.0_60 the problem java_home environment variable pointing invalid directory. in case, c:\program files\java\jdk1.7.0_51 not exist, ant goes looking folder , guess pulls jre folder first. the problem c:\program files\java\jdk1.7.0_51 not exist, , ant resets java.home variable first java directory finds: c:\programe files\java\jre7\ in case, had both of these , still did not find correct one: c:\program files\java\jdk1.8.0_60 c:\program files\java\

c# - Why to use delegates in .Net -

i reading article describing use of delegates following example shows use of multicast delegate public delegate void progressreporter(int percentcomplete); class program { static void main(string[] args) { progressreporter p = writeprogresstoconsole; p += writeprogresstofile; utility.hardwork(); } private static void writeprogresstoconsole(int percentcomplete) { console.writeline(percentcomplete); } private static void writeprogresstofile(int percentcomplete) { system.io.file.writealltext("progress.txt", percentcomplete.tostring()); } } public static class utility { public static void hardwork(progressreporter p) { (int = 0; < 10; i++) { p(i); system.threading.thread.sleep(1000); } } } but understanding of code think same can done using class , having same functions define tasks done delegate handler

r - How to fit line in 3d space (not plane) -

Image
how perform fit through dense regions of z <- (x,y) presented on plot attached? the thing tried locfit(z~lp(x,y)) instead of line in 3d space received plane fit.

r - Convert strings representing unit of time or distance to numeric -

i search data.frame column string distances , convert them numeric fields. same on twitter style dates such '3 days ago' using same function. if starting with: x <- c("5 days ago", "1 day ago", "6 days ago") i end with: x <- c(120, 24, 144) any appreciated! if data consist "number days ago" or "number miles" can use regular expressions: > x <- c("5 days ago", "1 day ago", "6 days ago", "21.2 miles", "1 mile") > x[grep(" day",x)] <- as.numeric(gsub("[ daysago]","",x[grep(" day",x)] ))*24 > x [1] "120" "24" "144" "21.2 miles" "1 mile" > x[grep(" mile",x)] <- as.numeric(gsub("[ miles]","",x[grep(" mile",x)] )) > x [1] "120" "24" "144" "

linux - Shell script wget download from S3 - Forbidden error -

i trying download file amazon's s3 using shell script , command wget. file in cuestion has public permissions, , able download using standard browsers. far have in script: wget --no-check-certificate -p /tmp/sodownloads https://s3-eu-west-1.amazonaws.com/mybucket/myfolder/myfile.so cp /tmp/sodownloads/myfile.so /home/hadoop/lib/native the problem bit odd me. while able download file directly terminal (just typing wget command), error pops when try execute shell script contains same command line (script ran >sh myscript.sh ). --2014-06-26 07:33:57-- https://s3-eu-west-1.amazonaws.com/mybucket/myfolder/myfile.so%0d resolving s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)... xx.xxx.xx.xx connecting s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)|xx.xxx.xx.xx|:443... connected. warning: cannot verify s3-eu-west-1.amazonaws.com's certificate, issued ‘/c=us/o=verisign, inc./ou=verisign trust network/ou=terms of use @ https://www.verisign.com/rpa (

gcc - Using the debug information of a executable in a pin tool -

i creating pin tool keep track of bit widths needed variable. keep track of high level(eg c variables) use debug information build in executable. not able find way extract debug info using pin api. please let me know if there pin api function calls out there extract debug info. if not possible pin, alternatives? (for example dynamorio) you're looking symbol information. sadly, pin can't give direct access variable names used in high level language such c or c++. if need information include dbghelp windows, or libelf , libdwarf linux, require 2 different implementations. there information available in pin user guide regarding symbols, , basic functionality access symbol information functions called. pin provides access function names using symbol object (sym). symbol objects provide information function symbols in application. information other types of symbols (e.g. data symbols), must obtained independently tool. pin 2.13 user guide - symbols

php - Post/Get Request not sending parameters -

i trying send username , password through post request login page on localhost. using below code generate request , send page $url='http://localhost/index.php'; $fields = array('username' => 'admin', 'password' => '1234'); curl_setopt($ch,curlopt_url,$url); curl_setopt($ch,curlopt_post,true); curl_setopt($ch,curlopt_postfields,http_build_query($fields)); curl_setopt($ch,curlopt_returntransfer,true); $result = curl_exec($ch); curl_close($ch); echo $result; edit print_r(curl_getinfo($ch)); prints information array ( [url] => http://www.url.com/index.php [content_type] => text/html [http_code] => 200 [header_size] => 380 [request_size] => 182 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 2.234 [namelookup_time] => 0.063 [connect_time] => 0.063 [pretransfer_time] => 0.063 [size_upload] => 28 [size_download] => 2322 [speed_download] => 1039 [speed_upload]

scala - Referencing instance member from anonymous function -

i'm trying define class instances have string , function. in function string parameter used. class tenant(val name: string, exclusion: map[string, int] => boolean) val rule1 = new tenant(name = "baker3", (suggestedfloor: map[string, int]) => suggestedfloor(name) != topfloor) val rule1 = new tenant(name = "cooper2", (suggestedfloor: map[string, int]) => suggestedfloor(name) != groundfloor) which gives error on last use of name: not found: value name . how can that? problem: you trying reference name name in lexical context it's not available: val rule1 = new tenant(name = "cooper2", (suggestedfloor: map[string, int]) => suggestedfloor(name) != groundfloor) — name in context not refer name defined within tenant , instead name name in scope of rule1 definition, of course not exist. code, error disappear of course not want: val name = ??? // `name` gets referenced lambda val rule1 = new tenant(name

Java SSL Socket Programming -

i read sslsocket when had finished chat program java use normal serversocket. trying replace normal serversocket sslsocket, there not on internet found something. whserver class this: class 1 start socket in selected port, if need see other classes edit question: import java.io.ioexception; import java.net.*; import javax.net.serversocketfactory; import javax.net.ssl.sslcontext; import javax.net.ssl.sslsocket; import javax.net.ssl.sslsocketfactory; public class whserver extends thread { private int port; private serversocket server; private channelsmanager manager; sslcontext context; sslsocketfactory sslsf; public whserver(int port, channelsmanager manager) throws ioexception { this.port = port; this.manager = manager; } public void serverstop() throws ioexception{ server.close(); } public whserver(int port) throws ioexception { this(port, new channelsmanager()); } public int getport() { return port; } public vo

c# - instead of clicking 3 buttons, need to click only one button to call click method of remaining buttons -

i have 3 buttons different logic in web page in asp.net, instead of clicking 3 buttons need click 1 button call click method of remaining buttons. how should write code in code behind .cs lets create 3 buttons same onclick handler. default.aspx: <asp:button id="button1" runat="server" onclick="button1_click" text="button1" /> <asp:button id="button2" runat="server" onclick="button1_click" text="button2" /> <asp:button id="button3" runat="server" onclick="button1_click" text="button3" /> default.aspx.cs: protected void button1_click(object sender, eventargs e) { if (sender==button1) { //button 1 logic goes here } else if (sender == button2) { //button 2 logic goes here } else { //button 3 logic goes here } }

gem - sass -v point to the wrong version -

i've 2 version of sass installed on machine: sass-3.2.19 (bundle) sass-3.3.8 with 1 of computer when sass -v see: sass-3.3.8 with other see: sass-3.2.19 the 1 show me "sass-3.2.19" cause me several error when compile projects (using framework bourbon/neat/susy..) because use advanced syntrax. how can make second machine point version sass-3.3.8? p.s. can't specify 3.3.8 in gemfile because i'm using middleman or compass , need version 3.2 thanks tips

Endeca-Hybris integration not working -

i'am trying integrate hybris 4.7.9 endeca. have installed following endeca components. 1)mdex engine 2)platform services 3)endeca workbench 4)cas. i have deployed sample application on endeca side using "d:\endeca\toolsandframeworks\11.0.0\deployment_template\bin\deploy.bat" in hyend2 in admincockpit of hybris have made eac/cas connection appication , made export job. problem not able run job, reports me following error: http://localhost:8500/myappen_en_data/?wsdl returned response code 404 @ com.endeca.itl.service.servicelocator.getservice(servicelocator.java:150) i don't know hybris, since error related endeca, let me try give pointers. cas: check cas , running app name: might have specified app-name-with-locale ( myappen ) somewhere need specify app-name ( myapp ). [the endeca app name without locale called " base application name ". go , check configurations in hybris , endeca]. you may refer this blog (altho

javascript - Gradation color in WebGL with GLSL shader -

i have black color in middle of disk gradation outside. 2 first parts glsl code make shader, problem when : "gl_fragcolor = vec4( vec3( vuv, 0.17 ), 1. ); " ` varying vec2 vuv; void main() { vuv = uv; gl_position = projectionmatrix * modelviewmatrix * vec4(position, 0.8); } ' ' varying vec2 vuv; void main() { gl_fragcolor = vec4( vec3( vuv, 0.17 ), 1. ); } ' var scene = new three.scene(); var camera = new three.perspectivecamera( 45, 1024 / 860, 0.1, 1000 ); var renderer = new three.webglrenderer({ antialias: true}); camera.position.z = 30; var my_shad = new three.shadermaterial({ vertexshader: document.getelementbyid( 'vertex' ).textcontent, fragmentshader: document.getelementbyid( 'frag' ).textcontent }); var radius = 8; var segments = 80; var circlegeometry = new three.circlegeometry( radius, segments ); var disk = new three.mesh(circlegeometry, my_shad); scene.add(disk);

Develop Solution/Web Parts/Apps for SharePoint 2013 in Visual Studio 2012 (From Local Machine) -

i have sharepoint foundation 2013 installed in windows server 2012. is possible develop sharepoint solution/web parts/apps using visual studio 2012 in local machine(windows 7 64bit) without having sharepoint installed in local machine? if need develop sharepoint solution/web parts/apps in visual studio 2012, need install visual studio in server contain share point foundation 2013? cant develop in local machine , deploy server? can me on issue? thanks. try this; • how perform sharepoint development on client workstation 15 feb 2011 bryant sombke in guides, web, windows 16 comments  1 of difficult restrictions sharepoint developer deal can requirement development on sharepoint server.  personally, prefer doing development on local machine, eliminating need establish remote desktop connection different machine in order write code. unfortunately, sharepoint development requires many dll files included installation of sharepoint on server.  make matters worse, sha

ios - Parse analytics not tracking custom events -

i using parse track custom events project. on first version had using: [pfanalytics trackevent: @"some event string"]; // works but decided put track more events, specially in-app purchases, created few more dictionary so: nsdictionary *dict = @{ @"item name" : itemname, @"price" : pricestring }; [pfanalytics trackevent:@"user purchase" dimensions:dict]; but somehow after shipping second version event doesn't show on dashboard, @"some event string" event does. there i'm doing wrong? i've checked keys , values dimensions dictionary appears ok, , i've tried "user purchase" event without dimensions, doesn't work either. it seems these code simple in config inside parse. can't explain why first event kept working, can pfanalytics class have bug? update: seems not familiar dashboard functionality , events being recorded. have go "custom breakdown"

Can I perform `git pull` without password prompt but `git push` with password prompt? -

i have known can use ssh protocol in order perform git pull & git push without password prompt. but want more convenient way. git pull without password prompt git push with password prompt? the reason want preference: i want easiest way git pull code i want confirmation before want git push yes. change push & pull remotes 2 different urls. if git remote -v can change push url git remote set-url --push origin https://github.com/minshallj/wtf.git use url don't have enter password (like git@... ) , 1 requires password push url (like https://... )

Configure Vim to use Xiki -

i have installed xiki per instructions in https://github.com/trogdoro/xiki . have read xiki provides partial support vi. want know how setup vim xiki. can point me in right direction? having no experience xiki, googled this: https://github.com/trogdoro/xiki/tree/master/etc/vim . , here status report: https://github.com/trogdoro/xiki/blob/master/etc/vim/vim_status.notes . hope helps!

cxf - Getting exception while Consuming https Webservice in mule -

i'm trying call https web service using cxf generated client proxies within mule. 99% of time, caused by: org.apache.commons.httpclient.protocolexception: unbuffered entity enclosing request can not repeated. @ org.apache.commons.httpclient.methods.entityenclosingmethod.writerequestbody(entityenclosingmethod.java:487) @ org.apache.commons.httpclient.httpmethodbase.writerequest(httpmethodbase.java:2114) @ org.apache.commons.httpclient.httpmethodbase.execute(httpmethodbase.java:1096)* the app has http inbound end point. mule java transformer tries call webservice using https using cxf generated client proxies. i'm running above said exception. i've provided screenshot mule flow [ http://i.stack.imgur.com/7x9wg.jpg] . appreciated!! mule config xml <cxf:jaxws-service serviceclass="test.service.https.testservice" doc:name="soap" configuration-ref="cxf_configuration" enablemulesoapheaders="fa

python - Efficiently select the best string from keys in a dict -

i'm trying read exif data file, title of image. there multiple fields need checked see if title set. right now, i'm doing bunch of if statements, trying 1 @ time until result not none , if is, applying default title. #set title m.title = exif.get('xmp.dc.subject') if m.title none: m.title = exif.get('xmp.dc.title') if m.title none: m.title = original_filename_noextension my question is, there easier way this? searching can quite long if there lot of keys need checked. m.title = exif.get('xmp.dc.subject') or exif.get('xmp.dc.title') or original_filename_noextension should work. note 'coalesce' falsey values, not none . alternatively, can write function pretty easily: def coalesce(*args): in args: if not none: return usage: m.title = coalesce(exif.get('xmp.dc.subject'), exif.get('xmp.dc.title'), original_filename_noextension)

Setting PHP session variable on website by calling request from another site -

is possible set session variable on php site example b.com calling curl request php site example a.com? here code, sending post request a.com site b.com/extauth.php <?php session_start(); $url = 'http://b.com/extauth.php'; $params = array( 'login' => 'login', 'pwd' => 'pass' ); $ch = curl_init(); $curlconfig = array( curlopt_url => $url, curlopt_post => true, curlopt_returntransfer => true, curlopt_postfields => $params, curlopt_followlocation => true, curlopt_cookiesession => true, curlopt_cookiejar => 'cookie.txt', ); curl_setopt_array($ch, $curlconfig); $result = curl_exec($ch); curl_close($ch); ?> script on extauth.php set session['login'] = true. when open site b.com after sending request curl, session['login'] undefined. <?php session_start(); if(isset($_post['login'])&&($_post['pwd'])){ //ad

mediawiki - How to obtain a list of titles of all Wikipedia articles -

i'd obtain list of titles of wikipedia articles. know there 2 possible ways content wikimedia powered wiki. 1 api , other 1 database dump. i'd prefer not download wiki dump. first because it's huge, second because i'm not experienced querying databases. problem api on other hand couldn't figure out way retrieve list of article titles , if need > 4 mio requests me blocked further requests anyway. question 1. whether there way obtain titles of wikipedia articles via tha api , 2. whether there way combine multiple request/queries one. or have download wikipedia dump? the allpages api module allows that. limit (when set aplimit=max ) 500, query 4.5m articles, need 9000 requests. but dump better choice, because there many different dumps, including all-titles-in-ns0 which, name suggests, contains want (59 mb of gzipped text).

styles - WPF Scrollbar over content -

Image
i working on custom style scrollbar on scrollviewer. working fine want scrollbar on top of content controls width won't break because of scrollbar. as can see here control on top breaks because of scrollbar. guys know how make scrollbars background kind of transparent control behind scrollbar? resource <window.resources> <style x:key="listboxstyle" targettype="listbox"> <style.resources> <style x:key="scrollbarthumbvertical" targettype="{x:type thumb}"> <setter property="overridesdefaultstyle" value="true"/> <setter property="istabstop" value="false"/> <setter property="template"> <setter.value> <controltemplate targettype="{x:type thumb}"> <rectangle x