Posts

Showing posts from January, 2015

css - How to make a column bold in HTML output -

Image
below powershell script. produces nicely formatted html table. i'd make single column bold (full % column). can't life of me think of way it. i've tried inserting bold tags in different places , tried thinking of way use replace since numbers change in columns can't think of way it. $symmid = 1555 $command1 = symfast -sid $symmid list -association -demand $command2 = symcfg -sid $symmid list -thin -pool -detail -gb $basedir = "c:\ts\scripts" $timestamp = get-date -format ddmmyyyy $cssfile = "$basedir\csstemplate.css" $css = get-content $cssfile $command1 > $basedir\archive_vp\archive_$timestamp.txt $command2 > $basedir\archive_pool\archive_$timestamp.txt $regex = '(?ms)p o o l s(.+?)\r\n\s*\r\n' $command2 = $command2 -join "`r`n" $command2 = [regex]::matches($command2,$regex) | foreach {$_.groups[1].value} $command2 = $command2 -split "`r`n" | select -skip 5 $command2format = $command2 | % { $column = ...

php can run the python programm from php shell but not on the webbrowser -

i have python script uses ipyhon , can executed when run terminal using php -a (interactive shell), when type localserver/rdmip_ke.php (test.php script wrtten gedit in ubuntu) nothing happens , see blank page. idea why? <?php $command = escapeshellcmd('/home/administrator/desktop/rdmip_ke.py'); $output = shell_exec($command); echo $output; ?> just update: checked log file , gives me list of errors example pyplot: file "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2460,ax = gca() in plot but again said before python program works fine , can executed php if run php shell. don't understand what's going on.

scala - Gatling - convert json response to List of case classes -

gatling 2.0. i'receiving server following json of events: [ { "a":"a","b":"b","c":"c","d":"d"}, { "a":"a1","b":"b1","c":"c1","d":"d2" }, { "a":"a2","b":"b2","c":"c2","d":"d3" } ] now store in session list of event classes case class event(a:string:b:string,d:string) i'm trying following jsonpath("$.chats.chat[0].events.event").oftype[seq[any]].transform(_.map{ l => some(event(l(0).asinstanceof[string], l(1).asinstanceof[string],l(3).asinstanceof[string])).saveas("events") but line not compile: please help. after fetch list session, can by: val events = session("events").as[seq[events]] thanks. you're using transform , takes extract result , tr...

ios - Making beautiful transitions at PageViewController -

i want make custom transition in pageviewcontroller: while user moves next slide (scroll) background image dissolves image. such effect have apple weather (except there background video). what i've done: i've made uiviewcontoller background image (that image need change). i've placed containerview in uiviewcontroller, containerview have embed pageviewcontroller. uiviewcontroller -> containerview -> pageviewcontroller at point i'm stuck, have working pageviewcontroller shared background image (from top uiviewcontroller), have no idea go next. now can catch page changing delegate (main viewcontoller): func pagechanged(currentpage: int) {} and default delegate method (pageviewcontoller) (i have 2 slides, don't know how better): func pageviewcontroller(pageviewcontroller: uipageviewcontroller, didfinishanimating finished: bool, previousviewcontrollers: [anyobject], transitioncompleted completed: bool) { let prevcontroller = previousviewc...

mysql - Setting up Usernames and Passwords on Icecast Server 2 -

i have icecast server 2 set on digital ocean. using "butt - broadcast using tool" broadcast mountpoint on server inputting password , icecast username. now, trying set sign webpage need interface icecast server config file, , add user names , passwords people sign up. what best way this? wordpress -> mysql -> icecast? webform -> icecast? ? also, can host on same droplet icecast server? any sample code snippets, tutorials, links, documentation appreciated. icecast has simple yet powerful url authentication capability against arbitrary http/https ends. can used both listener clients , source clients. needed parse request sent , reply confirmation header. for further details, refer official documentation on topic. you can either run on same machine or somewhere else. point url.

Saving a Huffman Tree compactly in C++ -

let's i've encoded huffman tree in compressed file. have example file output: 001a1c01e01b1d i'm having issue saving string file bit-by-bit. know c++ can output file 1 byte @ time, i'm having issue storing string in bytes. possible convert first 3 bits char without program padding byte? if pads byte traversal codes tree (and codes) messed up. if chop 1 byte @ time, happens if tree isn't multiple of 8? happens if compressed file's bit-length isn't multiple of 8? hopefully i've been clear enough. the standard solution problem padding. there many possible padding schemes. padding schemes pad number of bytes (i.e., multiple of 8 bits). additionally, encode either length of message in bits, or number of padding bits (from message length in bits can determined subtraction). latter solution results in more efficient paddings. most simply, can append number of "unused" bits in last byte additional byte value. one level up, start ...

java - Why does AbstractStringBuilder.append behave differently for MIN_VALUE? -

consider following methods in java.lang.abstractstringbuilder long public abstractstringbuilder append(long l) { if (l == long.min_value) { append("-9223372036854775808"); return this; } int appendedlength = (l < 0) ? long.stringsize(-l) + 1 : long.stringsize(l); int spaceneeded = count + appendedlength; ensurecapacityinternal(spaceneeded); long.getchars(l, spaceneeded, value); count = spaceneeded; return this; } integer public abstractstringbuilder append(int i) { if (i == integer.min_value) { append("-2147483648"); return this; } int appendedlength = (i < 0) ? integer.stringsize(-i) + 1 : integer.stringsize(i); int spaceneeded = count + appendedlength; ensurecapacityinternal(spaceneeded); integer.getchars(i, spaceneeded, value); count = spaceneeded; return this; } why abstractstrin...

javascript - $routeParams undefined when passing to new view & controller -

fairly new angularjs , webapi here, , figure best way learn doing. apologies in advance if question seems simple - i've spent day flipping through stackoverflow , tried them all. i have separate master & detail view, both own controller. trying pass selected id through details controller can query database using id, though getting "undefined" on $routeparams. i'm unsure if missing simple, or whether i'm approaching correctly. the controller doesn't seem when inject '$routeparams' either. my app.js module: var app = angular.module("projectdashboardmodule", ["ngroute"]); app.config(['$routeprovider', '$locationprovider', function ($routeprovider, $locationprovider) { $routeprovider .when("/", { templateurl: "/home/index" }) .when("/project", { templateurl: '/project/index', controller: 'projectcrudcontroller' }) .when("/pro...

mysql - Setting PHP Query into a nested array -

i trying use php logically store of data in nested associative arrays, , whenever loop through data or need reference data refer array pointer rather doing new queries each time. for example: my query is $query = $db->query(" select c.id campaign_id, c.campaign_title, c.start_date campaign_start_date, c.end_date campaign_end_date, cat.id category_id, cat.category_title, n.id nominee_id, n.title nominee_title, u.id voter_id, u.fullname voter_name campaign c left join categories cat on cat.campaign_id = c.id left join category_nominees cn on cn.category_id = cat.id left join nominees n on n.id = cn.nominee_id left join category_votes cv on cv.campaign_id = c.id , cv.category_id = cat.id , cv.nominee_id = n.id left join users u on u.id = cv.user_id c.active = 1 order u.fullname, c.campaign_title, cat.category_order, cat.category_title, cn.nominee_order, n.title ") or die(mysqli_error()); and i...

reactjs - React Transition group not firing -

i tried create simple transition react transition group, can't work- transitions aren't working. did used unique key. for example did simple 2 image fade in fade out component: var reactcsstransitiongroup = react.addons.transitiongroup; var image = react.createclass({ getinitialstate: function () { return ({imglink: 'http://belaumi.com/wp-content/uploads/2014/11/3d-animated-frog-image.jpg', status: 1}) }, update: function () { console.log(this); if (this.state.status==1) { this.setstate({ imglink: 'http://www.codefuture.co.uk/projects/imagehost/demo/di/kxy1/image-b%c3%a9b%c3%a9-facebook-8.jpg', status:2}) } else { this.setstate({ imglink: 'http://belaumi.com/wp-content/uploads/2014/11/3d-animated-frog-image.jpg', status:1}) } } , render: function () { return ( <div> <div classname='container'> ...

http - Get real client IP in OpenShift? -

i tried an application , , used way ban send more 5 empty requests server, problem then, got blocked, , because seen 1 unique ip. in code , used way x-real-ip doesent work on openshift, how then? here how ip: x_real_ip = self.request.headers.get("x-real-ip") remote_ip = self.request.remote_ip if not x_real_ip else x_real_ip update: '127.3.165.129', none) when doing print(self.request.remote_ip, x_real_ip) you want "x-forwarded-for" header visitors ip address. seeing ip address of reverse proxy users go through before ending @ application/gear. you can refer article in developer center more information how requests routed on openshift: https://developers.openshift.com/en/managing-port-binding-routing.html

How to add a custom CSS file in ExtJs 5? -

in extjs 4, included custom css this: <!-- <x-compile> --> <!-- <x-bootstrap> --> <link rel="stylesheet" href="bootstrap.css"> <script src="ext/ext-dev.js"></script> <script src="bootstrap.js"></script> <!-- </x-bootstrap> --> <script src="app.js"></script> <!-- </x-compile> --> <link rel="stylesheet" href="/custom/css.css" type="text/css" charset="utf-8" /> the fact link css comes after <x-compile> section makes loaded later , rules in custom.css override rules in compiled extjs theme css. in extjs 5.0, doesn't work anymore. despite of including custom css after microloader, theme css loaded after custom.css : <script id="microloader" type="text/javascript" src="bootstrap.js"></script> <link rel=...

Set the font line height of a Xamarin.Forms Label -

i have xamarin.forms label showing several lines of text , increase line height make text more readable. the font properties available on label control , on span controls seem limited font face, size , style. how can change line height? you'll need custom control , render can inherit existing ones , handle additional properties. ios (idk android) can use // goes in forms project public class customlabel : label{ // make bindable, shortened simplicity here public double lineheight {get;set;} } // goes in ios project, 1 in android project // notice attribute before namespace [assembly: exportrendererattribute (typeof(customlabel), typeof(customlabelrenderer))] namespace mynamespace{ public class customlabelrenderer: labelrenderer protected override void onelementchanged (elementchangedeventargs<frame> e){ base.onelementchanged(e); // sample only; expand, validate , handle edge cases needed ((uilabel)base.control).font.lineheight = ((customlab...

Calculate average using XQuery -

i need calculate average of each courses using xquery. here's xml code : <?xml version="1.0" encoding="iso-8859-1" ?> <?xml-stylesheet href="class.xsl" type="text/xsl" ?> <university> <student><sname>charlie parker</name> <course sigle="inf8430" note="69" /> <course sigle="inf1030" note="65" /> <course sigle="inf1230" note="73" /></student> <student><name>miles davis</name> <course sigle="inf8430" note="65" /> <course sigle="inf1030" note="77" /> <course sigle="inf1230" note="83" /></student> <student><name>john coltrane</name> <course sigle="inf9430" note="24" /> <course sigle="inf1030" note="64" /> <course sigle="inf1230" note="...

javascript - Does the page visibility API actually support OS screen lock? -

according w3 page visibility specification , mozilla's page visibility api documentation , page visibility api supports detecting if browser window hidden because of os lock screen. unfortunately, of examples have found seem indicate not supported. cannot example js code or of js code report browser hidden when lock screen (on windows or os x). of examples have tried: http://ie.microsoft.com/testdrive/performance/pagevisibility/default.html https://jsfiddle.net/wvupj/ https://jsfiddle.net/fakj0puw/1/ none of these report page hidden when lock os. not supported though documentation indicates otherwise? because have insert code able link jsfiddle... var results = document.getelementbyid('results'); function handlevisibilitychange() { if (document.webkithidden) { results.innerhtml = results.innerhtml + 'hidden.<br>'; } else { results.innerhtml = results.innerhtml + 'visible.<br>'; } } document.addeventlistener(...

watchkit - Is it possible to implement dynamic notifications on Apple Watch without a launchable app? -

i've designed custom notification app i'm working on apple watch. notifications because of current technical limitations don't want build launchable app or glance until have mic , speaker access. possible display dynamic notifications without having app icon on home screen of watch or watch app mandatory have dynamic notification @ all? no, need add dynamic notification scene in watch app. if want read more information i'd refer page: https://developer.apple.com/library/ios/documentation/general/conceptual/watchkitprogrammingguide/customzingthepushnotificationinterface.html#//apple_ref/doc/uid/tp40014969-ch6-sw1

c# - Taking over a DotNetNuke website. Getting errors -

the project saved website. vpning server , opening machine. when trying build getting 60 errors (all same). class.property.get must declare body because not marked abstract or extern class.property.set must declare body because not marked abstract or extern i spent hours yesterday going through many questions reported same error , kept leading more , different errors. figured perhaps maybe lack of knowledge on dotnetnuke , reset scratch in hopes maybe recognize have went wrong. this 1 of properties reporting error (15 in total each get;set) public int creditscore{ get; set; } i open vs click file - open - website , give path website on vpn. opens in vs fine. my page properties project are: (if other info valuable here let me know) .net framework 2.0 i've never worked dotnetnuke before hoping there configuration issues need make , build fine. the code written in version of .net allowed: public int someproperty { get; set; } (.net 3.5 or 4.0?) ...

itext - can BR tag work inside TD with XmlWorker? -

<td>text text text</br>text text<td> is legitimate html - throws error xmlworker 5.5.5 , itext 5.5.5 com.itextpdf.tool.xml.exceptions.runtimeworkerexception: invalid nested tag br found, expected closing tag td. if remove 'br' code works, of course not multiline row this not fixed using white-space:pre in td css, , converting 'br' carriage return, new line ignored itext is feature/ issue/ never been asked before thing? or missing not in examples? html file... link this invalid xhtml: <td>text text text</br>text text<td> this valid xhtml: <td>text text text<br />text text<td> please change </br> <br /> . because when xml parser encounters closing tag </br> without having encountered opening tag <br> first, throw exception because xml invalid. note <br /> shorthand <br></br> (an opening tag followed closing tag).

c++ - What's the result of a & b? -

this awkward, bitwise , operator defined in c++ standard follows (emphasis mine). the usual arithmetic conversions performed; the result bitwise , function of operands . operator applies integral or unscoped enumeration operands. this looks kind of meaningless me. "bitwise , function" not defined anywhere in standard, far can see. i , function well-understood , may not require explanation. meaning of word "bitwise" should rather clear: function applied corresponding bits of operands. however, constitute bits of operands not clear. what gives? this underspecified. issue of standard means when refers bit-wise operations subject of few defect reports. for example defect report 1857: additional questions bits : the specification of bitwise operations in 5.11 [expr.bit.and], 5.12 [expr.xor], , 5.13 [expr.or] uses undefined term “bitwise” in describing operations, without specifying whether value or object representation in view. ...

xml - Cannot load local css in Spring MVC 4 (eclipse) -

i think have config correctly, cannot load css. seems never work. have googled of results, none of them work me. not sure doing wrong. pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.alias</groupid> <artifactid>yayawine</artifactid> <packaging>war</packaging> <version>0.0.1-snapshot</version> <name>yayawine maven webapp</name> <url>http://maven.apache.org</url> <properties> <spring.version>4.0.1.release</spring.version> </properties> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</vers...

Can I include a custom payload or value with amazon affiliate links? -

i'd able tag affiliate links information can map successes information inside of system. is there way can include custom identifier or payload of data affiliate link amazon allow me inspect when receive report of successful sales? the thing found tracking ids manage tracking ids page. however ids limited 100 values default (you need contact amazon more). answered me: i understand you'd view reporting within products advertising api. all reports housed on associates account view activity of links. we offer multiple tracking ids associates can track activity of individual links , accurately. you can create 100 tracking ids in account visiting account settings section of associates central. you'll find link in account information section labeled manage tracking ids: https://affiliate-program.amazon.com/gp/associates/network/your-account/manage-t ... once you've created additional tracking ids, view these ids, ...

.htaccess - UWSGi, how to convert wordpress htaccess into plugin router_redirect -

i convert htaccess: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress into format required uwsgi (as explained here: http://uwsgi-docs.readthedocs.org/en/latest/internalrouting.html ). i think should write this: plugins = router_redirect route-if = exists break route-label = index route = .* index.php but i'm not expert of uwsgi. appreciated. thanks route-if-not = exists:${document_root}/${path_info} setpathinfo:/index.php this should enough, or if want use rewrite action (it fixes script_name too, needed on php) route-if-not = exists:${document_root}/${path_info} rewrite:/index.php

r - Quantiles and data interval for comparison -

i have question regarding use of quantiles determining enveloppe of curve. doing: have continuous variable ("var") turned discrete using cut ("var_cut"), , related variable obtained the continuous variable ("modvar"). i'm doing plotting modvar~var_cut , , want have sense of variability of modvar . here method chose: #df containing var , modvar structure(list(var = c(0.1968, 0.2263667, 0.1769, 0.2318, 0.2001333, 0.2382667, 0.2005, 0.2022667, 0.1699333, 0.2115667, 0.212, 0.2218667, 0.2327333, 0.2224333, 0.1690333, 0.1961333, 0.1756667, 0.2268333, 0.1938667, 0.1983, 0.1914333, 0.1745333, 0.2382, 0.2068333, 0.2509333, 0.221, 0.2075667, 0.2475333, 0.2463333, 0.2354, 0.2335, 0.2382, 0.2636667, 0.1829667, 0.2180333, 0.1703333, 0.2177333, 0.1932667, 0.2281, 0.1960667, 0.1975333, 0.1640333, 0.2021667, 0.2044333, 0.2124, 0.2267, 0.2202333, 0.1648667, 0.1898, 0.168, 0.2225, 0.1899667, 0.1966667, 0.183, 0.16786...

javascript - how to make a shadow in HTML canvas -

i need draw canvas rect shadow has shadows on 4 sides of rect , similar div has style "box-shadow":"0px 0px 5px 5px" try this <div style="box-shadow: 0 0 5px 5px red; height: 40px; width:100px;"> test </div>

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e7AmlG/django-filter -

im trying run pip install on pip_requirements.txt ( readthedocs local install) file in cygwin within virtualenv , running issues. python version:python 2.7.8 pip version: pip 6.0.8 virtualenv: 12.0.7 here console output . whats odd cannot find directory , never creates temp directory. install works fine on linux, running issues on windows box. appreciated!

java - Add character to trigger JTextPane line wrapping -

i have jtextpane can display text containing nomenclature long strings of characters, numbers , dashes ("-"). have word wrapping turned on but, appears work on white space (" ", tab, etc). i'd add dash character trippers line wrap. tried adding space or tab character after each dash trigger wrap but, not non-wrapped portions. has been able trigger line wrap in jtextpane on character default ones? well found "hack solution" works but, not 1 prefer. used replaceall add "\r" character after each dash character. caveat; work in java 7 under windows 7 approach might not apply other os's or future java versions. can't endorse approach general solution question working me. addition of "\r" not show in un-wrapped text trigger wrapping other white space. text.replaceall("-","-\r");

java - OptimisticLockException Ebean even with @Version -

i tried update row in db using ebean in play! framework program. here class of entity update. transaction.java @entity @table(name = "transactions") public class transaction extends model{ @id @generatedvalue public int id; @onetoone @joincolumn(name = "car_fk") public car car; @onetoone @joincolumn(name = "user_lender_fk") public user user; @version public timestamp from_date; @version public timestamp to_date; public boolean availability; // true -> available. public string status; } and here metho use update it: transaction transaction = new transaction(); transaction.car = concernedcars.get(i); transaction.user = currentuser; transaction.from_date = tools.stringandroidtotimestamp(datefrom); transaction.to_date = tools.stringandroidtotimestamp(dateto); transaction.status = constants.waiting_for_answer; try{ ebean.update(transaction); }ca...

php - JavaScript Arrays and MySQL -

i trying connect database php , put values returned mysql query javascript string array. here code have far. javascript code: var nodressing = document.getelementbyid("temp1").innerhtml; var nodressingnew = nodressing.split(','); alert(nodressingnew); i alerting list debugging purposes. here php code (i know connects database successfully): <div id="temp1" style="display: none;"> <?php include "/home/pi/config.php"; $toprint = ""; $connect = mysqli_connect("localhost", $name, $pass, "items"); if(mysqli_connect_errno()){ echo "<p>failed connect products database!</p>"; } $result = mysqli_query($connect, "select * products options=''"); while($row = mysqli_fetch_array($result)){ $id = $row['id']; $toprint .= $id . ","; } ...

jquery - mouseenter and leave with slide -

i want slideup div when mouse hit minimized element , slide down when user leaves it: $('#managerpane').mouseenter(function(){ $('#managerpane').height(300).slideup(); }); $('#managerpane').mouseleave(function () { $('#managerpane').height(60).slidedown(); }); <div id="managerpane" style="position:absolute;left:10px;bottom:0px;z-index:1000;height:60px; background:white; overflow-x: auto; max-width: 76%;" > <div>.childs..</div> </div> the div slides , down. what's wrong? during slideup div height becomes 0 (slowly) mouse pointer no longer on div. on next mouse move leave event triggered , hence slidedown,mouse again comes on div. result in multiple mouseenter mouseleave events , hence div goes , down. when mouse moved triggers mouseenter event height increased 300 slidesup height animated 0 which leaves mouse outside div when mouse moved triggers mouseleave event height = ...

jsf 2 - Reusing JSF2 View Scoped Bean on facelets templating -

i have common task choose 1 or more 'localizacaoto' before doing else on page. currently logic of data retrieval/process/ajax events , on maintained on viewscoped bean called "seletorlocalizacaomb" , i’d use multiple instances of same bean on same page. firstly used composite component when chose node, stored on last bean on page. if had 3 instances declared on testeseletormb: @named @viewscoped public class testeseletormb implements serializable { @inject @getter @setter private seletorlocalizacaomb instanceone; @inject @getter @setter private seletorlocalizacaomb instancetwo; @inject @getter @setter private seletorlocalizacaomb instancethree; } no matter component on page used, instancethree hold values. based on research understood composite component not ideal solution problem. so changed ui implementation , used facelets create 'template' named seletor.xhtml. <ui:composition xmlns:ui="htt...

I am looking for regex which returns false if it finds particular words anywhere in the paragraph in Java -

in our application allowing users write html scripts , don't want save script if contains particular words onmouseover, onclick etc. e.g. if user enter script below regex should return false. if not contain words should allow user has entered. <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td><b onclick="alert('wufff!')">click me!</b></td> <td width="190"><b onmouseover="alert('wufff!')">click me!</b></td> </tr> </tbody> i tried regex , did not work: ^(?=((?!onmouseover\s*=|onclick).)*$)(?=[\p{l}\p{p}\p{n}\p{so}\p{sc}\s+%26&=&amp%\\\-_|<>/]+)$ you can use alternatives check if unwelcome words appear in input text. (?s)^((?!cellpadding|cellspacing|onmouseover).)*$ i guess question not parsing html , validating input in specif...

javascript - AJAX Search on 2 Elements -

i working on project using classic asp (not idea) , ajax uses access database pull data from. have following form: <form action="" id="autocomplete-search"> <div class="simplesearch"> <label for="intesearch">start typing name</label> <input type="text" onkeyup="showcustomer(this.value)" id="intesearch" onfocus="disable_submit()"> </div> the javascript have @ top of page following: function showcustomer(str) { // remove white space name entered on search screen str = str.replace(" ", ""); var xmlhttp; if (str=="") { document.getelementbyid("txthint").innerhtml="no records found"; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=f...

vb.net - Addition and Subtraction of Random Numbers -

i trying make simple math game made of 3 forms. first form title screen has button start game. when button pressed make form 2 visible. form 2 generate 2 random numbers , either “+” or “-“ symbol , begin timer. user inputs answer text box , clicks “check answer” button, display either “correct” or “incorrect” label. want repeat 5 times , final time display form 3 show total time taken , number of correct answers. so far in first form have: public class startform public randomnumber new random() private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click me.hide() questionform.show() questionform.num1.text = randomnumber.next(1, 100) questionform.num2.text = randomnumber.next(1, 100) questionform.mathsymbol.text = randomnumber.next(1, 10) if questionform.mathsymbol.text = 1 questionform.mathsymbol.text = "+" elseif questionform.mathsymbol.text = 2 questionform.mathsymbol.text = ...

c# - How to perform background task without blocking the GUI but transfer back information to main thread? -

i following: have button , table on gui. when press button, task started this task while loop, giving me data on each iteration how can run loop , obtain data each iteration of in main gui table, without blocking gui? important, because while stop condition again button on gui. i have tried using backgroundworker , cannot figure out how send data @ every loop iteration (???) can result @ end, not target. if launch worker in loop (but not have loop in worker), not work. private void continuouscoordinateaquisition(object sender, doworkeventargs e) { while (continuouspositionaquisitionflag == true) // while monitoring not stopped, positions { // xyzwpr world coordinates robotcoordinatesxyzwprworld xyzwprworld = robi.getrobotposition_xyzwpr_world(); something........... retuns values need in gui // sleep defined time system.threading.thread.sleep(1000); // wait } } the calling be backgroundw...

java - Set up Accumulo table through api -

new accumulo, , may sound silly, wondering how setup table through api? documentation lacking. have been able find conn.tableoperations().createtable("mytable"); as setting locality groups: hashset<text> metadatacolumns = new hashset<text>(); metadatacolumns.add(new text("domain")); metadatacolumns.add(new text("link")); hashset<text> contentcolumns = new hashset<text>(); contentcolumns.add(new text("body")); contentcolumns.add(new text("images")); localitygroups.put("metadata", metadatacolumns); localitygroups.put("content", contentcolumns); conn.tableoperations().setlocalitygroups("mytable", localitygroups); map<string, set<text>> groups = conn.tableoperations().getlocalitygroups("mytable"); from documentation, want know how take first approach , build table. build columns. thanks in advance! there no inherent schema table set up...

Add Azure WebJob to mobile service hosted in App Service -

with new azure mobile app services in azure mobile services apparently gains same webjob support websites have had while. following article deploy webjobs using visual studio according section 'enable automatic webjobs deployment web project' should able add web job right click on project. none of these options show mobile service project in vs. i can add webjob project solution manually, not add webjobs-list.json file mobile service project article suggests. does know why add web job context menu doesn't show when right-clicking on mobile service project? or manual steps required configure project , appropriate webjobs-list.json file? update: have manually added webjobs-list.json file main project copying format initial template project , adjusted web job project path in it. deploying mobile service azure web app doesn't pick web job. it should work. created new mobile app, downloaded quickstart, right-clicked web project ( appname-code ), , able...

PHP - Attach HTML to Image/Jpeg Response -

the code below: if($file = $mongogridfs->findone(array('_id' => new mongoid($fileid)))) { $filename = $file->file['filename']; $filebytes = $file->getbytes(); header('content-type: image/jpeg'); header("content-length: " . strlen($filebytes)); ob_clean(); echo $filebytes; } returns response mongo .jpg file. how include response html? eg. <div id='container'> <img ... /> <!-- image generated script , stored in $filebytes --> <br> <span class='description'>this image</span> </div> i want not make <img src='...'> linked saved file on filesystem. is possible? you cannot return 2 resources within same http response. can inline image data (see embedding base64 images more details browser compatibility , other possible issues inline images). like: <img src="data:image/jpeg;base64,<?=base64_encode($filebytes...

c# - How to customize Pivot headers? -

i new windows phone 8.1 app development, want know how customize pivot header properties font, foreground colour, size, etc. can't find of these properties. so, hope me. create resource dictionary ( if don't have 1 ) add-new item-resource dictionary apply on app.xaml <application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <!-- styles define common aspects of platform , feel required visual studio project , item templates --> <resourcedictionary source="assets/style/customstyle.xaml"/> </resourcedictionary.mergeddictionaries> </resourcedictionary> </application.resources> add template resource dictionary <style x:key="custompivotstyle" targettype="pivot"> <setter property="margin" value="0,0,0,0"/> <setter property=...

java - Replacing programs with batch issue -

i want create auto-updater of program. in java part looks like int pid = kernel32.instance.getcurrentprocessid(); string cmd = folder + "update.bat" + " " + currentloc + " " + updateloc + " " + integer.tostring(pid); runtime.getruntime().exec(cmd); and batch contains set "name=gamedrive logs viewer.exe" set "myname=update.bat" taskkill /pid %3 taskkill /pid %3 del "%1\%name%" move "%2\%name%" "%1" "%1\%name%" del "%2\%myname%" so, i'm killing current program , delete it. move new version old folder, run new version, , delete bat file. bat file works when call cmd sending parameters. nothing happend when i'm trying use java program. found, dialog windows creating current program have same processid. (i tested bat). so, guess batch called java program same processid , kill himself. right? , if yes - can how that? i guess n...

SQL CASE WHEN STATEMENt into PHP VARIABLE -

i have problem: i have sql statement: select amount cicmpy inner join (select dealercode, sum(amount) amount (select dealercode, log logtlimit,temporarycreditlimit temporarycreditlimit, case when temporarycreditlimit>0 temporarycreditlimit else log end amount log_data status = 1 group dealercode) x on x.dealercode=debcode debnr not null , ltrim(debcode) = '21021287'` and want statement php $query variable. try this,it solve error. $sql = "put query"; //put query in php variable $result = mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($result)) { stuff... } for more reference

linux - Environment variable with spaces in a string - How to use them from /proc/pid/environ -

i set variable spaces in string new bash: var='my variable spaces' /bin/bash and if want start new bash same environment, like: env=$(cat /proc/self/environ | xargs -0 | grep =) env -i - $env /bin/bash but thing is, in /proc/self/environ , variable without quotes. last command throws a: env: variable: no such file or directory how can work around limitation? ps: simplified version of following issue: https://github.com/jpetazzo/nsenter/issues/62 i think answer here not use shell script set things up. using higher-level language makes easier parse /proc/<pid>/environ useful. here's short example: #!/usr/bin/python import os import sys import argparse def parse_args(): p = argparse.argumentparser() p.add_argument('pid') p.add_argument('command', nargs=argparse.remainder) return p.parse_args() def main(): args = parse_args() env = {} open('/proc/%s/environ' % args.pid) fd: env...

jquery ajax anonymous function when trying to pass form data -

i trying pass input file field through jquery ajax , getting anonymous function in chrome inspector console says because of line in script: $.ajax({ heres code run after have <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> $("#sendcoverimageform").click(function(e){ e.preventdefault() var mform = $("#sendformone").serialize() $.ajax({ type: "post", url: "{% url 'ajax_coverimage' %}", data: mform, success: function(data){ console.log(data) $("#coverimagemodal").modal("hide"); }, error: function(data){ var obj = data.responsejson $("#modalmessage").html("<p style='color:red;'>" + obj + "</p>") }, ...

c# - Change folder icon color programmatically -

i wanted changed color of folder icon of windows. possible means of shell or modifying desktop.ini through c#? if want programatically, start looking @ portable executable file format (wikipedia entry). resources section (.rsrc, see section 6.9) should contain icon. using information, can write tool modify icon.

node.js - Generic route handlers for express -

i trying make generic handlers rest style routes in express app. they defined in object merged properties defined in specific route files. merging of properties working fine. issue have in somehow passing model object handler's anonymous function. the code below clearest attempt showing i'm trying do, fails model lost in anonymous function's scope. /** * model mongoose model object */ routedefinitions: function (resourcename, model) { routepath = api_prefix + resourcename.tolowercase(); var routeproperties = { getbyid: { method: 'get', isarray: false, auth: true, url: routepath + '/:id', handlers: [function (req, res, next) { model.findbyid(req.param('id')).exec(res.handle(function (model) { console.log(model); res.send(model); })); }] }, getall: { me...

sql server - Indexed view usability -

i have indexed view: create view ptv.vw_mokiniai_2 schemabinding select t1.year_name, t2.person_id, t2.year, t2.person_position, count_big(*) [aggregated number] table1 t1 inner join table2 t2 on t1.year = t2.year group t1.year_name, t2.person_id, t2.year, t2.person_position with unique clustered index on columns t1.year_name, t2.person_id, t2.year, t2.person_position i need query optimizer use indexed view on query select t1.year_name, count_big(distinct t3.person_id) [persons_per_year] table1 t1 inner join ( select t2.person_id, t2.year, t2.person_position table2 t2 group t2.person_id, t2.year, t2.person_position ) t3 on t1.year = t3.year group t1.year_name the query must derived table, because cognos generates query , not want edit multidimensional model. have idea how done? maybe way optimize query remove de...

javascript - click event in google maps and AJAX -

i have map have markers try when user click on marker make ajax request in php file , ajax send json lat/long of marker , lat/long of user in php file file make query in db , return json array geometries of result. when run mozila consol hasnt show error if put alert(ar.latstart); frond of ajax show data. json data var coords = {'latstart': latpos , 'longstart' : longpos , 'latend' : latitude , 'longend' : longitude}; the event of google maps google.maps.event.addlistener(marker, 'click', function() { var latitude = this.position.lat(); var longitude = this.position.lng(); var coords = {'latstart': latpos , 'longstart' : longpos , 'latend' : latitude , 'longend' : longitude}; getcoords(coords); }); the ajax function getcoords is function getcoords(ar) { alert(ar.latstart); //the alert show values hasnt have problem $.ajax({ url...