Posts

Showing posts from May, 2013

php - GROUP_CONCAT with LEFT OUTER JOIN of two tables -

select table1.value, table2.additionalinfo table1 left outer join table2 on table1.id=table2.id i try output this value additionalinfo blah something, somethingelse, more blah2 null blah3 stuff but value additionalinfo blah blah somethingelse blah more blah2 null blah3 stuff i tried use group_concat , group_concat(distinct) select group_concat(table1.value), table2.additionalinfo table1 left outer join table2 on table1.id=table2.id order table1.value when add group_concat , order table1.value lists 1 additionalinfo per value none of values , doesn't repeated additionalinfos. moved order around no avail. i think need group_concat on additionalinfo column , not on table1.value select table1.value, group_concat(distinct table2.additionalinfo) additionalinfo table1 left outer join table2 on table1.id=table2.id group table1.value order table1.value

logstash - Exception in thread ">output" org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [30s] -

log stash 100% disaster me. using ls 1.4.1 , es 1.02 in same machine. here how start logstash indexer: /usr/local/share/logstash-1.4.1/bin/logstash -f /usr/local/share/logstash.indexer.config input { redis { host => "redis.queue.do.development.sf.test.com" data_type => "list" key => "logstash" codec => json } } output { stdout { } elasticsearch { bind_host => "127.0.0.1" port => "9300" } } es set: network.bind_host: 127.0.0.1 discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"] and wow..this get: /usr/local/share/logstash-1.4.1/bin/logstash -f /usr/local/share/logstash.indexer.config using milestone 2 input plugin 'redis'. plugin should stable, if see strange behavior, please let know! more information on plugin milestones, see http://logstash.net/docs/1.4.1/plugin...

How to evaluate multiple limits in a matrix array MATLAB -

this question: suppose next 2 arrays: z = [1 2;3 6;2 4]; y = [1 2 3 5 2 3 5 7 1 0 4 6] now want this: x = {[1 2];[3 5 2 3];[2 3 5]} as can see, variable "x" has corresponding values of vector "y", positions contained variable z. thinking in this: fun = @(c) y(c(1,1):c(1,2)); x = arrayfun(fun,z) but doesn't work :(, idea? x = arrayfun(@(n) y(z(n,1):z(n,2)), 1:size(z,1), 'uni', 0);

javascript - facebook manipulate image from link service -

if paste link in private message in facebook, thing gets biggest image off site. there way create script call facebook servers given url , returned link javascript? the idea create input given url in , return url of image. the idea when put url in facebook comment/message/post, facebook tries give users more url string hard read, giving no idea link might say. so avoid difficulty , give user more info link without visiting link itself, facebook access content of url parse way , meta content it, if meta data missing they'll parse other images off web page , present in better way. about question if understand goal correctly, don't need involve facebook in this, write server side (php script) details of url , use it. can finds tons of such scripts. doing in php have no issue cors. give try if still face problem present try here @ stackoverflow. sure thousands of users in problems. cheers

jquery - Difficulty with integrating with given css -

Image
a css has been provided me ,i trying integrtae put code in css . this css <div data-role="collapsible"> <h3>popcorn</h3> <div class="prd-items-detials"> <ul> <li class="head"> <form> <input type="checkbox" name="checkbox-mini-0" id="checkbox-mini-0" data-mini="true"> <label for="checkbox-mini-0">small pack 150g</label> </form> </li> <li class="prd-items-qt"> <div class="col"> <i class="minus"></i> <i class="qt">12</i> <i class="plus"></i> </div> <div class="col"> ...

actor - How to cancel (or just interrupt) a scala.concurrent.Future? -

i have java library performs long running blocking operations. library designed respond user cancellation requests. library integration point callable interface. i need integrate library application within actor. initial thought this: import scala.concurrent.future import scala.concurrent.executioncontext.implicits.global val callable: java.util.concurrent.callable[void] = ??? val fut = future { callable.call() } fut.onsuccess { case _ => // continue on success path } fut.onfailure { case throwable => // handle exceptions } i think code work in as not block actor. don't know how provide way cancel operation. assume while callable processing, actor receives message indicates should cancel operation being worked on in callable, , library responsive cancellation requests via interrupting processing thread. what best practice submit callable within actor , sometime later cancel operation? update to clear, library exposes instance of java.util.concurrent.call...

javascript - SignalR 2.0 - Accessing hub without proxy -

with following html/js code able call signalr 2.0 hub if html/js , hub resides on same server. <!doctype html> <html> <head> <title>test signalr 2.0</title> <style type="text/css"> .container { background-color: #99ccff; border: thick solid #808080; padding: 20px; margin: 20px; } </style> </head> <body> <div class="container"> <input type="text" size=100 id="message" /> <input type="button" id="sendmessage" value="send" /> </div> <ul id="discussion"></ul> <!--script references. --> <script src="scripts/jquery-1.6.4.min.js"></script> <script src="scripts/jquery.signalr-2.0.3.min.js"></script> <script src="/signalr/hubs"></script> <script type="text/javascript"> $(function () ...

php - Webpage is loading to mid-page position -

i using iframe import contact-form php page. however, in firefox , iphone, rather page loading positioned @ top normal, page loading mid-page expose first form field. example; http://www.soflorealty.com/help.html what causing this? if can't correct that, there work around force page load @ top? the problem may caused first input on form on iframe, input has html5 autofocus attribute. try removing attribute , see if solves issue.

java - box2d - How do I render lights in a proper way? -

can modify darkness on screen when using ray handler in libgdx box2d world? when put lights on sprites different because light on top of them. can render lights color of sprite same, though lighted source? yes. can modify darkness setting ambient light. instance: rayhandler.setambientlight(0.5f); makes 50% brighter. also, if find lights on sprites cause of difference in colour, might want set light's colour white , set alpha lower (just tweak around until think looks good).

Reuse ASP.NET MVC 5 code to build RESTfull Web Api -

cenario website: asp.net mvc 5 managing models, controllers , views. api: restful web api managing models, controllers , returning json the problem: code duplication in bl. redoing same logic in both places. the approach have in mind: take bl out of website mvc , keep in web api in separated vs solution the website consumer of web api about content negotiation, think in 2 options: web api "knows" format return (viewresult, json or xml) , serialize/deserialize in bl depending of requesting (website, mobile apps, etc.). advantage see keep taking advantage of typed model render view in website web api return json , consumer app handle result in client questions: is approach practise? which better: web api returning json or smart web api "knows" format return? like @david said, don't need consume web services in mvc controllers. design in such way mvc , api layers "view" business layer. so, in case thinking in terms...

android - Get HTML in String Array? -

how can display html in string array strings.xml please me! much jave code: details.settext(html.fromhtml(getresources().getstring(r.array.ge))); strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="ge"> <item> <![cdata[<sup><small>១</small></sup> កាល​ដើម​ដំបូង​ឡើយ ព្រះ​បាន​បង្កើត​ផ្ទៃ​មេឃ និង​ផែនដី។]]> ២ ឯ​ផែនដី​បាន​ខូច ហើយ​នៅ​ទទេ មាន​សុទ្ធ​តែ​ងងឹត​នៅ​គ្រប​លើ​ជំរៅ​ទឹក ហើយ​ព្រះវិញ្ញាណ​នៃ​ព្រះ​ក៏​រេរា​នៅ​ពី​លើ​ទឹក ៣ នោះ​ព្រះ​ទ្រង់​មាន​ព្រះបន្ទូល​ថា ចូរ​ឲ្យ​មាន​ពន្លឺ​ឡើង ដូច្នេះ ពន្លឺ​ក៏​មាន​ឡើង។ ៤ ព្រះ​ទ្រង់​ឃើញ​ពន្លឺ​នោះ​ក៏​យល់​ថា​ជា​ល្អ​ហើយ រួច​ទ្រង់​ញែក​ពន្លឺ​ពី​ងងឹត​ចេញ ៥ ទ្រង់​ហៅ​ពន្លឺ​ថា​ជា​ថ្ងៃ ហើយ​ហៅ​ងងឹត​ថា​ជា​យប់ នោះ​ក៏​មាន​ល្ងាច​មាន​ព្រឹក​ឡើង ជា​ថ្ងៃ​ទី​១។ ៦ បន្ទាប់​មក ព្រះ​ទ្រង់​មាន​ព្រះបន្ទូល​ថា ចូរ​ឲ្យ​មាន​ប្រឡោះ​នៅ​កណ្តាល​ទឹក ដើម្បី​ញែក​ទឹក​ចេញ​ពី​គ្នា ៧ ទ្រង់​ក៏​ធ្វើ​ប្រឡោះ​នោះ ទាំង​ញែក​ទឹក​ដែល​នៅ​ក្រោម​ប្រឡោះ​ចេញ​ពី​ទឹក​ដែល​នៅ​លើ​ប្រឡោ...

ios - Writing NSDictionary with custom objects to file -

this question has answer here: correct way save/serialize custom objects in ios 4 answers i have nsdictionary array of custom objects, called maclass es. try writing dict file, simple method: - (void)writedicttofilewithcontent:(nsdictionary *)contentdict { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *filepath = [documentsdirectory stringbyappendingpathcomponent:@"/userdata.txt"]; [contentdict writetofile:filepath atomically:yes]; } and read using - (nsdictionary *)readfromdict { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *filepath = [documentsdirectory stringbyappendingpathcomponent:@...

asp.net - HttpModule endless redirect -

i'm using httpmodule try , redirect users login page if they're not authenticated, reason it's endlessly redirecting page without landing anywhere. here's module: using system; using system.web; using system.web.security; public class authenticationmodule : ihttpmodule { public authenticationmodule() { } public string modulename { { return "authenticationmodule"; } } public void init(httpapplication app) { app.beginrequest += (new eventhandler(application_beginrequest)); } private void application_beginrequest(object source, eventargs e) { httpapplication app = (httpapplication)source; httpcontext context = app.context; httprequest request = context.request; httpresponse response = context.response; if (!request.isauthenticated && !request.rawurl.contains(formsauthentication.loginurl)) { ...

odf - Editing `ods` file in C++ code -

i need edit libreoffice calc document programmatically in c++. know there odfkit library, uses webodf , looks doesn't support editing .ods files. is there alternative can deliver me feature? libreoffice has api, called uno , controlling process. if need more complicated, simplest route. if need simple transformation, other option unpack file plain old zip library ( libzip , libarchive , ...) , modify xml manually. the opendocument site mentions lpod, web seems defunct , while search comes looks relevant, not sure whether there usable.

java - Nested "System.out.print" output -

why program: import java.io.*; public class testpage { public static void main(string [] args) { pri(); } public static int p2 (int x) { system.out.print("p"); return x * x + 1; } public static void pri ( ) { int y = 3; system.out.print( p2(y) + "-" + p2(y)); } } output this: pp10-10 specifically, why output on each side of - different when method calls same? java evaluate operands of binary operator such + before performing operation. means p2(y) called twice before concatenations happen. 2 method calls each print p before concatenations, system.out.print prints 10-10 . the jls, section 15.17.2 , covers this: the java programming language guarantees every operand of operator (except conditional operators &&, ||, , ? :) appears evaluated before part of operation performed.

linux - gnuplot doesn't work through ssh command -

so have csv, , have plt file. run gnuplot plt-file.plt , png born. but if run ssh sameuser@samemachine 'gnuplot plt-file.plt' pngcario error. the csv: sar.csv time, average io writes 4/15/2014 22:28, 6.040546875 4/15/2014 22:28, 7.943100586 4/15/2014 22:29, 8.686162109 4/15/2014 22:29, 7.693891602 4/15/2014 22:30, 8.579804688 4/15/2014 22:30, 7.900537109 the plt: clear reset print "sar" set terminal pngcairo transparent enhanced font "arial,25" fontscale 1.0 size 1920, 1080 set key outside bottom center box title "sar" enhanced set key maxrows 4 set key font ",25" spacing 1 samplen 2.9 width 2 height 1 set xlabel "time (hours)" font ",25" set ylabel "utilization (%)" font ",25" set output "./sar.png" set title "sar" font ",35" set datafile separator "," set timefmt "%y-%m-%d %h:%m:%s" set ytics font ...

mysql - PHP URL Shortener: Shortener.php returning an error message -

so creating url shortener site based off of youtube tutorial (phpacademy) due lack of experience in php , mysql, feel i'm picking quickly, receive error message when submitting url. parse error: syntax error, unexpected 'update' (t_string) in /home/langers/public_html/r/shorten/classes/shortener.php on line 37 however ,in code, line mentions , t_string 'update' implies unexpected, needed in tutorial. <?php class shortener { protected $db; public function __construct() { //demo purposes $this->db = new mysqli('localhost', 'langers_langers', 'password','langers_website'); } protected function generatecode($num){ return base_convert($num, 10, 36); } public function makecode($url){ $url = trim($url); if(!filter_var($url, filter_validate_url)) { return ''; } $url = $this->db->escape_string($url); //che...

javascript - KnockoutJS cannot delete object from observableArray -

i have following code: var testvm = { things: ko.observablearray([ { id: 1, name: "apple" }, { id: 2, name: "banana" }, { id: 3, name: "orange" }, { id: 4, name: "pineapple" }, { id: 5, name: "pear" } ]), deletething: function (data) { var things = testvm.things; var index = things.indexof(data); // debug... console.log('data', data); console.log('index', index); if (index > -1) { things.splice(index, 1) } }, deleteapple: function () { this.deletething({ id: 1, name: "apple" }); } }; ko.applybindings(testvm); with html: <ul data-bind="foreach: things"> <li> <a data-bind="click: $root.deletething">x</a>&nbsp;|&nbsp; <span data-bind="text: name"></span> </li> </ul> <a data-bind="click: deleteapple">delete appl...

c# - XAML Binding from ItemsControl Template -

i have view has viewmodel set datacontext. viewmodel has boolean property, call "isineditmode". how bind usercontrol in datatemplate (marked "binding isineditmode") viewmodel on outside? <itemscontrol itemtemplate="{staticresource homeitemtemplate}"> <itemscontrol.resources> <datatemplate x:key="homeitemtemplate"> <utils:persontextbox property="{binding isineditmode}"/> </datatemplate> </itemscontrol.resources> </itemscontrol> you can use relativesource binding outer itemscontrol, , bind data context: <utils:persontextbox property="{binding relativesource={relativesource ancestortype=itemscontrol}, path=datacontext.isineditmode}"/>

unix - To be able to log into Facebook while using MediaWiki -

i'm struggling understand need piece of work have assigned. question follows, plus have mediawiki installed on unix machine. as standard mediawiki requires each user to create an account. use an extension to allow  users to “log in with facebook”. they will then be able to link their account already created on the private wiki with their facebook account.   stackoverflow questions on actual programming implementation, not installing other software. there mediawiki extension allows facebook integration: http://www.mediawiki.org/wiki/extension:facebook you need install extension following directions.

c++ - How are function definitions determined with header files? -

when using separate files in c++, know functions can declared using header files this: // myheader.h int add(int num, int num2); // mysource.cpp int add(int num, int num2) { return num + num2; } // main.cpp #include "myheader.h" #include <iostream> int main() { std::cout << add(4, 5) << std::endl; return 0; } my question is, in situation, how compiler determine function definition of add(int,int) when myheader.h , main.cpp have no references @ mysource.cpp? as, if there multiple add functions (with same arguments) in program, how can make sure correct 1 being used in situation? the function declaration gives compiler enough information generate call function. the compiler generates object file specifies names (which, in case of c++ mangled specify arguments, namespace, cv-qualifiers, etc.) of external functions object file refers (along list of names defines). the linker takes object files, , tries match every n...

javascript - Reordering element names based on their position in parent with jquery -

<div class="content"> <div> <input type="text" name="newname[name]0"/> <div> <input type="text" name="newname[utility]0"/> <div> <textarea name="newname[text]0"></textarea> </div> </div> </div> <div> <input type="text" name="somename[name]1"/> <div> <input type="text" name="somename[utility]1"/> </div> <div> <textarea name="somename[text]1"></textarea> </div> </div> ... etc ... </div> what's efficient way use jquery's selector reorder input elements (input, textarea) based on current position? ie, if user deletes newname[name]0 div parent element, somename[name]1 moved , shoul...

sharepoint 2013 - How To Add JSLink For Calendar Event -

i'm using sharepoint 2013 , want utilize client side rendering feature using jslink, when editing web part calendar new event, in "miscellaneous" there no field jslink, how modify render new event using jslink ?. it not possible. see this discussion. after hour's worth of research found problem. microsoft targets invalid, event, , survey list types ignore client rendering. unless create own webpart not ever able use of jslink properties these list types. maybe @ microsoft can explain here why have crippled or proper approach common problem be. yet reason calendar piece of garbage in sharepoint 2013! also this answer: there no ootb way attach javascript calendar view (no property exposed listview). workaround can create own jquery or javascript , add on calendar view page adding reference in content editor webpart on page., however have quick dirty solution. add sripteditor yout page, below calendar , insert: var oldeditlink = editlink2; editli...

python - Convert number to string scientific notation fixed length -

i have normal float number such "1234.567" or "100000". convert string such precision fixed , number in scientific notation. example, 5 digits, results "1.2346e003 , "1.0000e005", respectively. builtin decimal number -> string functions round if can, second number "1e005" when want more digits. undesirable since need numbers same length . is there "pythonic" way without resorting complicated string operations? precision = 2 number_to_convert = 10000 print "%0.*e"%(precision,number_to_convert) is asking for?

onclick - VB.net Disable-Deactivate Left Click Handle-Event-Function On AxWindowsMediaPlayer -

whenever axwindowsmediaplayer1 on fullscreen , click on it, either stops player or starts playing again moment paused. there anyway disable touch/click on player forever? i should mention i've added this: axwindowsmediaplayer1.enablecontextmenu = false axwindowsmediaplayer1.ctlenabled = false the first 1 disables option menu appears when right click on media player , second 1 disables main functions such double clicking go fullscreen none of 2 solves little problem. edit: still haven't find way solve pfff. if can me, feel free , post it. there maybe possible way disable play-pause button function forever? addhandler mpocx.mousemoveevent, addressof domousemove private sub domousemove(byval sender object, byval e axwmplib._wmpocxevents_mousemoveevent) onmousemove(new mouseeventargs(mousebuttons.none, 0, e.fx, e.fy, 0)) end sub ' ... not sure if these have effect mpocx.uimode = "none" mpocx.ctrlenabled = false mpocx.enablecontextmenu =...

c# - Actions with variable argument count -

i'm working unity networking, , i'm writing method calls 1 on network. have bunch of methods like void call<a>(action<a> method, arg) { _networkview.rpc(method.method.name, rpcmode.others, arg); } void call<a,b>(action<a,b> method, arg1, b arg2) { _networkview.rpc(method.method.name, rpcmode.others, arg1, arg2); } ... , on there variants call on specific player , system make work photon cloud. there whole lot of these methods, , it's getting cluttered. now, wondering if it's possible have action can have amount of arguments. can make like: void call(action method, params object[] args) { _networkview.rpc(method.method.name, rpcmode.others, args); } is possible? thanks! actions variable argument count it possible: public delegate void paramarrayaction<v>(params v[] variableargs); public delegate void paramarrayaction<f, v>(f fixedarg, params v[] variableargs); public delegate void paramarraya...

c++ - How to pass additional array to Thrust's min_element predicate -

i'm trying use thrust's min_element reduction find next edge in prim's algorithm. iterate on graph edges. comparison function: struct compareedge { __host__ /*__device__*/ bool operator()(edge l, edge r) { if (visited[l.u] != visited[l.v] && visited[r.u] != visited[r.v]) { return l.cost < r.cost; } else if (visited[l.u] != visited[l.v]) { return true; } else { return false; } } }; unfortunately code cannot run on device, because use visited array, mark visited nodes. how can pass array predicate make usable device-executed code? there number of ways can handled. present 1 approach. please note question how pass arbitrary data set functor, i'm trying show. i'm not trying address question of whether or not proposed functor useful comparison predicate thrust::min_element (which i'm not sure of). one approach have statically defined array: __device__ int...

sql - How can I update the value of multiple rows to a different specified value in the same column? -

say have table there product ids, product desc., , language of each desc. if there description null value american-english, update british-english version of description product. there way using update command in sql? i prefer syntax updating values in 1 table values in (or in case same) table, b/c easy change update...set select testing , see values updated. update p_us set p_us.product_desc = p_gb.product_desc dbo.product p_us inner join dbo.product p_gb on p_us.productid = p_gb.productid p_us.language_code = 'us' , p_gb.language_code = 'gb' , p_us.product_desc null ; and can swap out first 2 lines above quick testing see updated: select p_us.productid, p_us.product, olddesc = p_us.product_desc, newdesc = p_gb.product_desc

Search Through All Between Values SQL -

i have data following data structure.. _id _begin _end 7003 99210 99217 7003 10225 10324 7003 111111 i want through every _begin , _end , return rows input value between range of values including values (i.e. if 10324 input, row 2 returned) i have tried filter not work.. where @theinput between a._begin , a._end --this works convert(char(7),'10400') >= convert(char(7),a._begin) --but adding breaks , returns nothing , convert(char(7),'10400') < convert(char(7),a._end) this obvious answer... select * <your_table_name> @theinput between a._begin , a._end if data string (assuming here don't know db) add this. declare @searcharg varchar(30) = cast(@theinput varchar(30)); select * <your_table_name> @searcharg between a._begin , a._end if care performance , you've got lot of data , indexes won't want inc...

readline - Does rust 0.10 have a rl package? -

i'm starting use rust create little toy command prompt applicationusing gnu readline library. started using c foreign function interface came across in rust 0.8 . the crate has module extra::rl appears readline tools needed. question is, present in rust 0.10 , if it? if not, packaged external module, , if can find it? thanks in advance. use std::c_str; #[link(name = "readline")] extern { fn readline (p: *std::libc::c_char) -> * std::libc::c_char; } fn rust_readline (prompt: &str) -> option<~str> { let cprmt = prompt.to_c_str(); cprmt.with_ref(|c_buf| { unsafe { let ret = c_str::cstring::new (readline (c_buf), true); ret.as_str().map(|ret| ret.to_owned()) } }) } fn eval(input: &str) { println! ("{}", input); } fn main() { loop { let val = rust_readline (">>> "); match val { none => { break } _ => { ...

jquery - Class attribute not working on EditorFor/TextBoxFor -

i'm trying apply js plugin on table rows populated list property on model object. however, neither @class attribute taking. jquery $(document).ready(function ($) { //these work $('#homephone').mask("(999) 999-9999? x99999"); $('#businessphone').mask("(999) 999-9999? x99999"); $('#mobilephone').mask("(999) 999-9999"); $('#faxnumber').mask("(999) 999-9999? x99999"); $('#birthdate').mask("99/99/9999"); $('#homezip').mask("99999?-9999"); $('#mailingzip').mask("99999?-9999"); $('#locationzip').mask("99999?-9999"); $('#lifeeapercent').mask("9.99"); $('#varpercent').mask("9.99"); //these don't $("#relcodeeffdate").datepicker({ dateformat: 'mm/dd/yy' }); $("#reldistcode").numeric(); }); razor @for (i...

nested struct using pointers c++ -

i newbie of c++. using c++11 standards , mingw64 understand nested struct. but not able figure out wrong following program. trying use nested struct using pointers. not want use "new" keywords this. also, understand leaking memory in program. #include<iostream> struct model{ int a; double b; struct shape { int c ; double d; }; shape *pshape; }; int main(){ model *m ; m->a = 2; m->pshape->c=3; delete m; printf("done\n"); } please me in understanding wrong , best , clean way of using nested struct c++11. in above program pointer "pshape" destroyed when program goes out of scope ? regards, avi thank comments. learning more guys learn book. comments informative humorous. thank guys. based on suggestion here attempt. please let me know if think has flaws: #include<iostream> using namespace std; struct model{ int a; double b; struct shape { int c ; double d; } *ps...

Word 2010 VBA Macro: loop to end of document -

i have recorded simple macro find word "quantity", go end of line , insert carriage return. need repeat end of document , quit, or else i'll have infinite loop. the code: selection.find.clearformatting selection.find .text = "quantity:" .replacement.text = "" .forward = true .wrap = wdfindcontinue .format = false .matchcase = true .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end selection.find.execute selection.endkey unit:=wdline selection.typeparagraph change code this, note use of wdfindstop. selection.find.clearformatting selection.find .text = "quantity:" .replacement.text = "" .forward = true .wrap = wdfindstop .format = false .matchcase = true .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end while selec...

c# - Threading in Producer-Consumer pattern -

first sorry bad english. 've code reading .csv file, 1 one , after read, 'll removed. .csv file format this: id name parentid ------------------------ 0 [root] 1 0 2 b 0 3 c 1 4 d 2 and result be [root] _a __c _b __d just tree. can execute on 1 file , after first time, consumer never wakes again, please me fix or explain how call reason , way fix. thanks lot. class program { static producerconsumer prdcos; static string[] file; static void main(string[] args) { string directory = ""; prdcos = new producerconsumer(); console.cancelkeypress += new consolecanceleventhandler(console_cancelkeypress); directory = input_directory(); file = null; while (true) { if (check_exist(directory) == true) break; else { console.writeline("please reinput \n...

$PATH being ignored in python virtualenv for bin -

i have virtualenv, , in virtualenv i'm attempting run fabfile. the fabfile starts this: import httlib2 when try execute fab --list to list of available tasks, instead get: traceback (most recent call last): file "/usr/local/cellar/python/2.7.5/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/fabric/main.py", line 658, in main docstring, callables, default = load_fabfile(fabfile) file "/usr/local/cellar/python/2.7.5/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/fabric/main.py", line 165, in load_fabfile imported = importer(os.path.splitext(fabfile)[0]) file "/users/user/documents/code/fabfile.py", line 5, in <module> import httplib2 importerror: no module named httplib2 yet when do: $ python python 2.7.5 (default, aug 13 2013, 10:53:21) [gcc 4.2.1 compatible apple llvm 4.2 (clang-425.0.28)] on darwin type "help", "copyright", "credits" or "license...

osx - Installing Ruboto on Mac using Homebrew-ed Sdk -

i trying install ruboto gem on mbp retina. have installed sdk , ndk on computer using homebrew install service , have them pathed such. however, here problem. when trying use 'ruboto setup', system keeps informing me cannot find "platform sdk android-19". have added path platform/android-19 folder in .bash_profile, refuses see such. hints how might correct or work around this? "ruboto setup" expects platform sdks installed in directory parallel "android" command: <android-sdk>/tools/android <android-sdk>/platforms/android-19 you need ensure android sdk installation follows structure or file issue in ruboto tracker ( https://github.com/ruboto/ruboto/issues ) , ask "ruboto setup" support android sdk installation using homebrew. an alternative uninstall android sdk , let "ruboto setup" install scratch.

javascript - Is jQuery.off() needed when you use one()? -

if bind event handler one() (i want run once), still need unbind off() after event handler finishes? $(el).one('transitionend', function(e){ $(el).off('transitionend'); necessary? }); no, $.off() not needed @ all. once event fires once, handler removed.

php - Opencart: change image folder -

i've got opencart 1.5.5.1 , tried change image folder unexpected results. my opencart installed on www.example.com/opencart/ i changed config.php , admin/config.php follows: // http define('http_server', 'http://example.com/opencart/'); // https define('https_server', 'https://example.com/opencart/'); // dir define('dir_application', '/home/example/public_html/opencart/catalog/'); define('dir_system', '/home/example/public_html/opencart/system/'); define('dir_database', '/home/example/public_html/opencart/system/database/'); define('dir_language', '/home/example/public_html/opencart/catalog/language/'); define('dir_template', '/home/example/public_html/opencart/catalog/view/theme/'); define('dir_config', '/home/example/public_html/opencart/system/config/'); define('dir_image', '/home/example/public_html/opencart/image2/'); defi...

decreasing the width of bar graph in matlab -

Image
i wrote code below make bar graph problem width of bar big , need make width thinner, when change fig properties whole graph become smaller .. help? x = [2,3,4,5,6]; y = [80.32,95.2,92.6,75.6,65.7] figure; bar(x,y,'b'); you can use third input argument bar specifies width: bar(x,y,.4,'b'); %// change ".4" needed

javascript - jQuery : change span value on option select -

working on project client... want change value of span of #sandy based on selection choice of dropdown. instance if option text 1 selected, span #sandy say: "this #sandy2", if option text 2 selected, span #sandy "this not #sandy2". <!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.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <title>sandbox test</title> <script> function checkfield(val) { alert("the input value has changed. new value is: " + val); } </script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> = 0; $(document).ready(function () { $("#clientname...

java - PostgreSQL and Hibernate JPA not working -

i'm trying use jpa in wildfly (which uses hibernate) postgresql. turned on hibernate.show_sql can execute same query in pgadmin iii. query 1 ( edit: issuemanager_sch schema. without in pgadmin query fails "relation not exist" error): select issuetypet0_.id_issue_type id_issue1_3_, issuetypet0_.name name2_3_ issuemanager_sch.issue_type issuetypet0_ when executed hibernate showed in both postgresql log , wildfly log : relation "issuemanager_sch.issue_type" not exist character 87 however, when copy (to grant i'm executing exact same query), paste , run query in pgadmin iii it's executed , results. what possibly wrong configurations? (i tried both quoted , unquoted queries , results same: fails hibernate, works in pgadmin iii) persistence.xml <?xml version="1.0" encoding="utf-8"?> <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1"> <persistence-unit name=...

python - Django model field dependent on instance -

i trying create model field dependent on instance (specifically instance of foreign key). example: class user(models.model): name = models.charfield() ... class entry(models.model): user = models.foreignkey(user) file = models.filefield(upload_to=user.name) as can see, want file "upload_to" parameter dependent on user. there easy way this? upload_to may callable, such function, called obtain upload path, including filename. this callable must able accept 2 arguments, , return unix-style path (with forward slashes) passed along storage system. def _upload_to(instance, filename): return str(instance.user.name) class entry(models.model): user = models.foreignkey(user) file = models.filefield(upload_to=_upload_to)

PHP/MySQL Table Update Issue -

alright have mysql database setup bunch of usernames, passwords, , other details. have 1 "administrator" section on site want able edit users information when needed. so far have page called president_admin.php (code below), displays table name, username, , password of user, link update user. have table working correctly, displays information , all. update link, takes users id in table, sends page called studentedit.php (code below) retrieves id of user, , fills 3 text fields username, password, , name fine. works. so fill out fields test , see if let me update variables in database, , press submit goes page called studentupdate.php (code below). page connects database, , uses , if display , error if not update. goes through fine , says update.... indeed not. can @ code , me out. i've been stuck on hours. please note code snip, secured , has more page. i'm teen trying best here... sorry if scrutiny coding world. president_admin.php <?php ...