Posts

Showing posts from September, 2013

css - Making two elements starting in the same html row -

Image
i've got small icon appearing , sentence afterwards, in next line. code so: (apart more things) <td class="workview-cell"> {{#if isavailable}} {{#if isloaded}} a<img id="privileged-access-step-icon" src="{{urlroot}}/images/crown16sb2.png" alt="test" title="test" /> {{else}} b<img id="privileged-access-step-icon" src="{{urlroot}}/images/crown16sb2.png" lt="test" title="test" /> {{/if}} {{/if}} {{#if showlink}} <a href="#" class="workview-link {{linkproperties.linkclass}} theme-link-color {{#if showlinkwideonly}}wideonly{{/if}}" title="{{linkproperties.title}}">{{description}}</a> c{{#if showlinkwideonly}}<span class="narrowonly">{{description}}</span>{{/if}} {{else}} {{description}} {{/if}} </td> the css associated is:

c# - Convert Selected PowerPoint Shapes (or DrawingML) to XAML -

i need convert selected powerpoint shapes xaml can place equivalent vector-based shape inside wpf app (the xaml end result has scalable - converting image defeats purpose of i'm trying do). i'm open variety of ways accomplish this, including writing powerpoint addin (if me access bezier point coordinates of selected shapes in powerpoint). i'm not familiar enough powerpoint addins know if possible or not. my first approach copy powerpoint shapes clipboard, , convert clipboard contents objects can understand , generate xaml there. if can drawingml representation (through art::gvml clipformat), it's unclear how convert drawingml xaml (looks weeks of error-prone work create scratch). there other formats available on clipboard (emf, system.drawing.imaging.metafile, powerpoint 12.0 internal shapes), appear dead ends. any suggestions? you can try this: powerpoint shape wmf microsoft.office.interop.powerpoint.application app = new microsoft.office.inte

c# - How to get Session from Asp.Net Session State with desktop application -

i have site created in asp.net mvc , control of session following sessionstate <sessionstate mode="inproc" stateconnectionstring="tcpip=127.0.0.1:42424" sqlconnectionstring="" cookieless="false" timeout="60" /> i need sessions asp.net session state desktop application. how this?

javascript - Set Data Attribute using DataSet API -

following way data attribute tag using dataset api. <div data-color="red">apple</div> var color = document.queryselector('div').dataset.color how set data attribute? can create new data attributes? will automatically appended element? please provide answer example. thanks. you can set data- attribute via same dataset mentioned or element.setattribute() yes, demonstrated in code example below. can dataset or setattribute . yup. css can style them because of this. see div[data-price]:after style in example. var div = document.queryselector('div'); var data = div.dataset; div.innerhtml += ' ' + data.color; data.color = 'yellow'; div.innerhtml += '; ' + data.color + '. <br/>'; data.type = 'golden delicious'; div.setattribute('data-price', '$1.00'); div.innerhtml += 'this div has following attribute/value pairs:'; (var = 0;

javascript - generate random id number within angular template just once -

i know way generating random id in angular template once page loads. problem facing every second different id in 2 spans. want same on both places , dont want change value every second. here simple template: <main class="has-header has-padding"> <div id = "command">-id:<span>{{vm.getrandomid()}}</span> -connect -run</div> <hr> <div id = "command">-id:{{vm.getrandomid()}}</div> my controller: 'use strict'; (function() { angular .module('myapp') .controller('mycontroller.ctrl', mycontroller); mycontroller.$inject = ['$scope']; function screensharingctrl($scope) { angular.extend(this, { getrandomid:getrandomid }); function getrandomid() { return math.floor((math.random()*6)+1); } } })(); sorry if duplicate question. appreciated! thank you! just change binding {

Arduino.Read Serial, create String, search into the string, clean String -

i trying work sim900, trying do, is: 1- read serial port, 2- input string, 3- search parameter in string, 4- clean string. code simple, cant understand doing wrong. if make similar, or knows how graceful. thank jose luis string leido = " "; void setup(){ // serial1 baud rate serial.begin(9600); serial1.begin(9600); } string leido = " "; void setup(){ // serial1 baud rate serial.begin(9600); serial1.begin(9600); } void loop() { //if (serial1.available()) { serial.write(serial1.read()); } // sim900 if (serial.available()) { serial1.write(serial.read()); } // pc leido = leerserial(); serial.println(leido); if (find_text("ready",leido)==1){leido = " ";} } string leerserial(){ char character; while(serial1.available()) { character = serial1.read(); leido.concat(character); delay (10); } if (leido != "") { serial1.println(leido);r

node.js - bodyParse error suppression -

i'm using bodyparser express accept json requests. whenever pass in incorrectly formed json object returns nasty error via endpoint , logs console well. following error: syntaxerror: unexpected string @ object.parse (native) @ parse (/users/ddibiase-mbp/documents/projects/theride_api/node_modules/body-parser/lib/types/json.js:88:17) @ /users/ddibiase-mbp/documents/projects/theride_api/node_modules/body-parser/lib/read.js:108:18 @ done (/users/ddibiase-mbp/documents/projects/theride_api/node_modules/body-parser/node_modules/raw-body/index.js:239:14) @ incomingmessage.onend (/users/ddibiase-mbp/documents/projects/theride_api/node_modules/body-parser/node_modules/raw-body/index.js:285:7) @ incomingmessage.g (events.js:199:16) @ incomingmessage.emit (events.js:104:17) @ _stream_readable.js:908:16 @ process._tickcallback (node.js:355:11) syntaxerror: unexpected string @ object.parse (native) @ parse (/users/ddibiase-mbp/documents/project

c++ - Ensure float to be smaller than exact value -

i want calculate sum of following form in c++ float result = float(x1)/y1+float(x2)/y2+....+float(xn)/yn xi,yi integers. result approximation of actual value. crucial approximation smaller or equal actual value. can assume values finite , positive. tried using nextf(,0) in code snippet. cout.precision( 15 ); float = 1.0f / 3.0f * 10; //3 1/3 float b = 2.0f / 3.0f * 10; //6 2/3 float af = nextafterf( , 0 ); float bf = nextafterf( b , 0 ); cout << << endl; cout << b << endl; cout << af << endl; cout << bf << endl; float sumf = 0.0f; ( int = 1; <= 3; i++ ) { sumf = sumf + bf; } sumf = sumf + af; cout << sumf << endl; as 1 can see correct solution 3*6,666... +3.333.. = 23,3333... output get: 3.33333349227905 6.66666698455811 3.33333325386047 6.66666650772095 23.3333339691162 even though summands smaller should represent, sum not. in case applying nextafterf sumf give me 23.3333320617676 smaller. work? po

sql results, How to count points for duplicate names for each name in php code -

i have sql table in website nourena note : want edit php code <?php // make connecion mysql_connect('host', 'host user', ''); // select database mysql_select_db ('database name'); $sql="select * database_name"; $records=mysql_query($sql); ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>الاحصائيات النهائية لمسابقة اكتوبر</title> </head> <body> <table> <tr> <th style="width: 40px;">pos.</th> <th style="">name</th> <th style="width: 60px;">points</th> <tr> <?php while($database_name=mysql_fetch_assoc($records)) { echo "<tr>"; echo "<td>".$database_name[toplist_id]."</td>"; echo "<td>&quo

html - Javascript - checking if frame is empty -> TypeError: e is null -

i tried check if frame "content1" , "content3" empty or not , resizing them. but error: "typeerror: e null" window.setinterval(function(){ check(); }, 50); function check() { var content1 = document.getelementsbyname("content")[0].contentdocument.body; var content3 = document.getelementsbyname("content3")[0].contentdocument.body; if(isempty(content3)) { if(isempty(content1)) setproperties("0px, *, 0px"); else setproperties("35%, *, 0px"); } else setproperties("25%, 40%, 35%"); window.localstorage.clear(); } function isempty(e) { return (e.offsetwidth!=0 || e.innerhtml!="\n"); } function setproperties(value) { document.getelementsbytagname("frameset")[1].cols = value; } https://jsfiddle.net/ecytve7w/8/ referencing jsfiddle, seems issue doctype. changing dtd under fiddle options "html 4.01 frameset" seems

Python multiprocessing and an imported module -

i have 2 processing running access imported module that: import foo def bar(): while true: foo.a = true def baz(): while true: print foo.a p1 = process(target=bar) p2 = process(target=baz) p1.start() p2.start() it seems each process have own instance of module foo, bar() changes value true, in baz() it's false. workaround? unlike threads, separate processes not share memory. there ways, however, to share data between separate processes . 1 way use mp.value : foo.py : import multiprocessing mp = mp.value('b', false) then script import time import foo import multiprocessing mp def bar(): foo.a.value = true def baz(): in range(10**5): print foo.a.value if __name__ == '__main__': p2 = mp.process(target=baz) p2.start() time.sleep(0.5) p1 = mp.process(target=bar) p1.start() yields 0 0 0 ... 1 1 1 ... for sharing boolean value, mp.event perhaps better option: foo.py : import mult

excel - Concatenate formula with rowcount -

i trying enter concatenate formula in cell vba. result writes keep returning false... need use rowcount, since table grows longer , need row. this latest code tried, again no avail: .offset(rowcount, 0) = formula = "=concatenate(p" & rowcount & "j" & rowcount & "dg" & rowcount any suggestions appreciated. you're not creating string , need change = formula = .formula = . also, i'm assuming rowcount defined somewhere? change: .offset(rowcount, 0) = formula = "=concatenate(p" & rowcount & "j" & rowcount & "dg" & rowcount to: .offset(rowcount, 0).formula = "=concatenate(p" & rowcount & ",j" & rowcount & ",dg" & rowcount & ")"

ios - No such module FBSDKCoreKit error -

i trying add facebook sdk ios 9.0 swift app in xcode. did install according fb-dev instructions. however, when add header appdelegate.m file import fbsdkcorekit keep getting message saying "no such module 'fbsdkcorekit'" error . based on read elsewhere i have cleaned build , re-installed xcode , updated os x i have double checked plist , framework files fb lists in instructions, nothing has seemed missing. i have set "allow non-modular includes in framework modules" setting yes in build settings. nothing seems work. not know go here , have done hours of research trying find solution. when importing frameworks, make sure have selected " copy if needed " . version after xcode 6.3 seem giving issues if part not ticked.

java - How can I tell my database that some changes are made by hibernate and not by other application? -

i'm new in working hibernate , i've got isue. work oracle db , hibernate+maven+netbeans. purpose able changes in database authorized app. making changes sql console or others programs should not possible. made table in database: create table data( name char(30), day integer, month integer, year integer ); and trigger restricts access on database: create or replace trigger tri_block before insert or update or delete on data begin if to_number(to_char(sysdate,'hh24')) < 12 or to_number(to_char(sysdate,'hh24')) >= 12 or to_char(sysdate,'dy') in ('sun','sat') raise_application_error (-20000, 'changes can not made'); end if; end; and hibernateutil.java : package com.scooby.util; import com.scooby.data; import org.hibernate.sessionfactory; import org.hibernate.cfg.annotationconfiguration; public class hibernateutil { private sta

c - Can I pass the string in PHP extension by reference with separating from other variables? -

i have example code: zend_begin_arg_info(arginfo_refstring, 0) zend_arg_info(1, s1) zend_end_arg_info() const zend_function_entry refstring_functions[] = { php_fe(refstring, arginfo_refstring) php_fe_end }; php_function(refstring) { char *s1; int s1_len; if (zend_parse_parameters(zend_num_args() tsrmls_cc, "s", &s1, &s1_len) == failure) { return; } s1[0] = 'x'; } and php code: $s1 = 'hello'; $s2 = $s1; refstring($s1); var_dump($s1, $s2); i expect: string(5) "xello" string(5) "hello" but got: string(5) "xello" string(5) "xello" how can separate $s2 $s1 , keep ability change $s1 inside function? i known separate_zval , co., did not help... this happens because of mechanism called copy on write . after lines: $s1 = 'hello'; $s2 = $s1; $s1 , $s2 both independent variables (zvals), point same(!) data in memory - because bo

api - LibraryThing ThingAuth -

i have work librarything api , did librarything'document said. but after authorization step, want make api call access member's account infomations, didn't provide me api url. anybody have solution stuff?

vbscript - Running a .vbs file from .bat with variable path -

i'm trying run .vbs file through batch program (.bat). catch .vbs file , .bat file in different directories. also, want use variable path user can launch .bat program through correct directory. a simple version of .bat script like: cscript "c:\users\username\directory\file.vbs" but, want use variable directory looks this: cscript %variable% test.vbs here's have far: for /f "tokens=3 delims=\" %%a in ("%cd%") set user=%%a set "base=c:\users\" set "end=\folder 1\folder 2\" set "basepath = %base%%user%%end%" set "vbsname=test.vbs" cscript %basepath% %vbsname% pause the "users" directory of current user available in userprofile environment variable. following run .vbs file batch file: cscript "%userprofile%\folder 1\folder 2\test.vbs"

mdx hierarchy return parent and child in query -

i have following query with member [measures].[period key] axis(1).item(1).item(1).hierarchy.currentmember.uniquename member [measures].[year key] [dim date].[year].currentmember.uniquename select { [measures].[valuation] ,[measures].[period key] ,[measures].[year key] } on 0 ,( [dim date].[hierarchy].[quarter].allmembers ,[dim platform].[platform key].allmembers ) on 1 [cube]; i want year key return uniquename in hierarchy instead, want use in parameter. in form cause errors field definition expecting result in hierarchy form. possible? assuming hierarchy year-semester-quarter-month-date, how using [dim date].[hierarchy].currentmember.parent.parent.uniquename if have year-quarter-month-date in place, [dim date].[hierarchy].currentmember.parent.uniquename what doing it's looking @ current quarter , returning it's corresponding year going in hierarchy tree using .parent function.

mysql - SQL Lite retrieve Proper Record -

Image
i have table named chatthreadmember. attaching data of table problem conveyed properly. i trying fetch such chatthreadid contains receiverinteral i'll pass. for ex. when pass following 3 receiverinternals 'f7269470-b8c9-447c-8e85-555d9ecf82b6' '79d49515-a34c-47a7-bde8-667778b0327c' '9e682e2b-fb3c-41f3-9192-abfd97d5a8f5' i should 6ce1f6a9-8254-4d5a-8c9d-fec680b60b2f chatthreadid chatthreadid contains 3 receiverinternals. trials getting df04a5d4-e586-4398-b8db-13b411eoed5d along 6ce1f6a9-8254-4d5a-8c9d-fec680b60b2f don't need. my query is: select  cth.chatthreadid chatthreadmember cth cth.receiverinternal in ('f7269470-b8c9-447c-8e85-555d9ecf82b6','79d49515-a34c-47a7-bde8-667778b0327c','9e682e2b-fb3c-41f3-9192-abfd97d5a8f5') , cth.chatthreadid not in( select cth.chatthreadid chatthreadmember cth cth.receiverinternal in (select cth.receiverinternal chatthreadmember cth cth.receiverinternal not in ('f7269

javascript - $scope.$apply not updating on page refresh -

i have subscribed signalr events. on notification updating textbox using $scope.$apply. works fine. if page refreshed using f5 or browser reload button, receiving signalr events but, textbox not getting updated. i missing anything? on notification signalrhub.client.notify = function (data) { $scope.$apply(function () { $scope.upgraderesult += data.message; }); } what browser version using? if testing using ie, f5/refresh retrieve cached page unless change settings under internet options->general tab->browsing history subsection->settings default- check versions of stored pages selected 'automatic'. modify 'every time visit page' - should bypass caching page , changes made on page should reflect. although may not resolve impediment if caching not issue, useful tip consider nevertheless avoid caching problems.

python - ValueError: could not convert string to float -

i have text file contains data. data follows join2_train = sc.textfile('join2_train.csv',4) join2_train.take(3) [u'21.9059,ta-00002,s-0066,7/7/2013,0,0,yes,1,sp-0019,6.35,0.71,137,8,19.05,n,n,n,n,ef-008,ef-008,0,0,0', u'12.3412,ta-00002,s-0066,7/7/2013,0,0,yes,2,sp-0019,6.35,0.71,137,8,19.05,n,n,n,n,ef-008,ef-008,0,0,0', u'6.60183,ta-00002,s-0066,7/7/2013,0,0,yes,5,sp-0019,6.35,0.71,137,8,19.05,n,n,n,n,ef-008,ef-008,0,0,0'] now trying parse string function splits each of lines of text , convert labeledpoint. have included line converting string elements float the function follows from pyspark.mllib.regression import labeledpoint import numpy np def parsepoint(line): """converts comma separated unicode string `labeledpoint`. args: line (unicode): comma separated unicode string first element label , remaining elements features. returns: labeledpoint: line converted `labe

hash - Perl: Get key value -

i'm trying key values hash inside module: module.pm ... $logins_dump = "tmp/logins-output.txt"; system("cat /var/log/secure | grep -n -e 'accepted password for' > $logins_dump"); open (my $fh, "<", $logins_dump) or die "could not open file '$logins_dump': $!"; sub userlogins { %user_logins; while (my $array = <$fh>) { if ($array =~ /accepted\s+password\s+for\s+(\s+)/) { $user_logins{$1}++; } } return \%user_logins; } sub checkuserlogins { $logincounter; $userstocheck = shift @_; if (exists %{userlogins()}{$userstocheck}){ $logincounter = %{userlogins{$userstocheck}}; #how many logins? } else { $logincounter = "0"; } return \$logincounter; } script.pl $userlogincounter = module::checkuserlogins($userstopass); i pass usernames script , check if username in hash, if is, need return number of logins, i'

r - Time series of length 0 from the timeSeries package has dubious timestamps -

it seems "timeseries" of length 0 has 2 timestamps, 0 , 1. assignment of length 0 vector doesn't cause error message, number , values of timestamps unchanged. assignment of timestamps themselfs results in error message: > library(timeseries) > x <- timeseries( matrix(0:3,2,2) ) > settime(x) <- timesequence(as.date("2015-01-01"),as.date("2015-01-02"),by=as.difftime(1,units="days")) > # --------------------- > # exspected: > > head(x,2) gmt ss.1 ss.2 2015-01-01 0 2 2015-01-02 1 3 > gettime(head(x,2)) gmt [1] [2015-01-01] [2015-01-02] > nrow(head(x,2)) [1] 2 > length(gettime(head(x,2))) [1] 2 > # --------------------- > # exspected: > > head(x,1) gmt ss.1 ss.2 2015-01-01 0 2 > gettime(head(x,1)) gmt [1] [2015-01-01] > nrow(head(x,1)) [1] 1 > length(gettime(head(x,1))) [1] 1 > # --------------------- > # not exspected: > &

yocto - Unable to use automatic PR service -

i've been trying use bitbake pr service . i've followed instructions in https://wiki.yoctoproject.org/wiki/pr_service , added these lines local.conf file: prserv_host = "localhost:0" inherit += "buildhistory" buildhistory_commit = "1" i expected pr values of recipies incrementing automatically after each change, still same setting prserv_host need, , works me. turns pr=r1 r1.1, r1.2, r1.3 on each build. if isn't working, version of oe-core using?

mixed models - R mlogit-Error system is computationally singular: reciprocal condition number -

i using library(mlogit) in r , stuck @ particular data set looks this customerid item price calories choice 1 200 1.99 490 no 1 312 4.99 887 no 1 560 5.19 910 no 1 700 4.79 690 no 1 909 4.89 660 no 1 1705 4.00 840 no there 187 items in total , 4 customerid(1,2,3 , 4). each customer presented choice set of 187 items selects 1 based on price , calories. price , calories remain same 4 customers. > str(data) 'data.frame': 748 obs. of 5 variables: $ customerid: int 1 1 1 1 1 1 1 1 1 1 ... $ item : factor w/ 187 levels "200","231","232",..: 1 11 14 15 18 25 33 34 36 39 ... $ price : num 1.99 4.99 5.19 4.79 4.89 4 4 4 4 6.21 ... $ calories : int 490 887 910 690 660 840 1638 1559 1530 1559 ... $ choice : factor w/ 2 levels "no ","yes": 1 1 1 1 1 1 1 1 1 1 ... i format

javascript - Drawing a Line3 in Threejs -

Image
i want draw line3 in threejs , here code it: start = new three.vector3(20, 10, 0); end = new three.vector3(200, 100, 0); var line = new three.line3(start, end); scene.add(line); the code doesn't give error doesn't draw line either. in same program, have sphere: var initscene = function () { window.scene = new three.scene(); window.renderer = new three.webglrenderer({ alpha: true }); window.renderer.setclearcolor(0x000000, 0); window.renderer.setsize(window.innerwidth, window.innerheight); window.renderer.domelement.style.position = 'fixed'; window.renderer.domelement.style.top = 0; window.renderer.domelement.style.left = 0; window.renderer.domelement.style.width = '100%'; window.renderer.domelement.style.height = '100%'; document.body.appendchild(window.renderer.domelement); var directionallight = new three.directionallight( 0xffffff, 1 ); directionallight.position.set( 0, 0.5

jquery - Export array to excel xlsx in javascript -

there 1 requirement in javascript export data (array or array of objects) excel xlsx. exported data csv unable same xlsx. tried many api github can used libraries , export xslx there little it. tried using stephen-hardy/xlsx.js, sheetjs/js-xlsx etc. for exporting csv used click here ! same cant done xlsx. i tried xlsxwriter convert , write javascript array or array of object xlsx no result. now m badly stuck because of requirement. found out similar post of mine requirement click here ! please guys give me solution if any a while ago, wrote following article, described how export data jqgrid "real" .xlsx file: export jqgrid excel this cached jqgrid's data javascript variable, posted server, save excel. excel file created using openxml libraries. this should point in right direction. alternatively, might try library: alasql (i haven't tried though.)

r - zoo error - $ operator is invalid for atomic vectors -

i've created zoo object in order apply hargreavessamani et (evapotranspiration) function this package. the input data file here , code i've used below notes. require(evapotranspiration) require(zoo) data("constants") oakpark<- read.csv("oakparkr.csv", header=true) #fill blanks in csv nas na.fill(oakpark,na) #convert zoo oakpark <- as.zoo(oakpark) #create zoo series required variables pe.data <- oakpark[ ,c(3,5)] #defining function , associating data function class funname <- "hargreavessamani" class(pe.data) <- funname then when applying function: results <- et(pe.data,constants) i following error: error in data$tmax : $ operator invalid atomic vectors i've tried converting large zoo data frame , trying again et function works on zoo series, didn't work either. other pages '$ operator invalid atomic vectors' seem suggest changing format of data, need find way around without doing that.

python - PyQt no module named -

i try use pyqt 5.5 python 3.5. installed python 3.5 (c:\python3) , intalled pyqt 5.5 (c:\python3\lib\site-packages\pyqt5). type import pyqt5.qwidgets and have following error importerror: dll load failed: no module named pyqt5.qwidgets my os windows 8 x32 it's not helped: importerror: no module named pytqt5 importerror: no module named pyqt5 - osx mavericks pyqt5 , qtgui module not found solved: problem gone when installed python 3.4 instead of python 3.5

animation - Can I replace the avatar used in the three.js example morphtargets_human with my own avatar? -

i trying use three.js example morphtargets_human , replace avatar used own avatar. studied files used in example , cannot see why cannot replace it. created avatar morph targets (1 morph target + default) , skeleton. exported morph targets morph animation , skeleton skeletal animation (it seems morph targets , skeletal animation required work). when open javascript file on browser, can see dat gui controls, avatar not displayed. how can make work? additional files: umich_ucs.js , ucscharacter.js , ucs_config.json , detector.js , dat.gui.min.js , three.min.js , orbitcontrols.js jsfiddle: link var screen_width = window.innerwidth; var screen_height = window.innerheight; var container; var camera, scene; var renderer; var mesh; var mousex = 0, mousey = 0; var windowhalfx = window.innerwidth / 2; var windowhalfy = window.innerheight / 2; var clock = new three.clock(); var gui, skincon

java - Problems with accessing HashMaps from other classes -

i writing plugin using spigot (pretty bukkit) i'm having problems accessing hashmap 1 class in another. here hashmap , getter: private map<string, integer> compplayers = new hashmap<string, integer>(); public map<string, integer> getcompplayers(){ return compplayers; } i able see if hashmap contains keys within class such here: if(args[0].equalsignorecase("join")){ if(compplayers.containskey(p.getname())){ p.sendmessage(chatcolor.red + "you part of competition"); return false; } yet in listener class, can't seem access properly. here's section of code in listener class: public class competitionlistener implements listener { private pluginmain plugin; public competitionlistener(pluginmain plugin){ this.plugin = plugin; } @eventhandler public void onblockplace(blockbreakevent e){ player p = (player) e.getplayer(); p.sendmessage("blockbreakevent"); if(plugi

java - Spacebar shortcut for JMenuItem -

i'm working on menu-driven java swing application. has 4 5 menus have 4 or more menu items. defined shortcuts menu item using jmenubar#setkeyaccelerator(keystroke key) . when define spacebar shortcut , press space , fires event first jmenuitem or selected menu item. here code snippet: jmenuitem item = new jmenuitem("do something"); item.setkeyaccelerator(keystroke.getkeystroke(keyevent.vk_space, 0)); how add spacebar menuitem works fine. i spot problem, added toolbar having button , button automatically focused, that's why when press space, press button on jtoolbar

ios - Azure Mobile Service Offline Data Sync - Error on pullWithQuery -

i using azure mobile service backend. data structure implemented , tested crud calls using fiddler. seems right. then implemented offline data synchronization client ios device. btw followed tutorial: https://azure.microsoft.com/en-gb/documentation/articles/app-service-mobile-ios-get-started-offline-data-preview/ my problem when try synchronize data using pullwithquery function. errror: 2015-08-19 11:36:12.525 hykso[1820:330268] logged in facebook:10155931659265500 2015-08-19 11:36:30.285 hykso[1820:330522] error error domain=com.microsoft.windowsazuremobileservices.errordomain code=-1302 "{"message":"an error has occurred."}" userinfo=0x14671c30 {nslocalizeddescription={"message":"an error has occurred."}, com.microsoft.windowsazuremobileservices.errorresponsekey=<nshttpurlresponse: 0x14584de0> { url: https://hyksomobileservice.azure-mobile.net/tables/athlete?$top=50&__includedeleted=true&$skip=0&__systempro

regex - javascript regexp for word boundary detection with parenthesis -

i have string "i robot, have been named 456/m(4). forget name (it not mean anything)" now extract words string use regular expression: /\b[\w\s]+\b/g it returns me words in string except there word "456/(4" instead of "456/(4)". understand due fact word boundary, there way not legal word boundary since there no "legal" starting parenthesis? i made better now. want. \b(?>\([\w\/]+\)|[\w\/])+ regex101 if want version that's javascript friendly: ((?:(?=(\([\w\/]+\)|[\w\/]))\2)+) just use capture group #1 here. regex101

vbscript - VBS Object required error, 800A01A8 -

hello i'm trying debug script inherited below. error on line 71 char 6. object required 'ofile' i don't have vbs experience please gentle. script takes scan , uploads doc archive server, gives unique filename etc. haven't figured out 'ofile' yet :/ 'feb 18, 2005 dim ofso set ofso = createobject("scripting.filesystemobject") hiddencount = 0 'wscript.echo wscript.arguments(0) if wscript.arguments.count = 1 , ofso.folderexists(wscript.arguments(0)) set scanfiles = ofso.getfolder(wscript.arguments(0)).files each ofile in scanfiles if ofile.attributes , 2 hiddencount = hiddencount + 1 end if next else set scanfiles = wscript.arguments end if filecount = scanfiles.count - hiddencount 'wscript.echo hiddencount 'wscript.echo filecount 'wscript.quit() set oie = wscript.createobject("internetexplorer.application") oie.left=50 ' window position oie.top = 100 ' , other properties o

Accessing level values (answer codes) in R from Limesurvey export -

Image
i'm analysing data limesurvey questionnaire in r. 1 of survey questions asks people country of origin , uses dropdown list of countries. i've created labelset 3-letter iso country code limesurvey answer code , country name label: when exporting limesurvey data r, both codes , labels saved r syntax file. codes saved 'level' factor, , label of course used label (abbreviated clarity): data[, 7] <- as.character(data[, 7]) attributes(data)$variable.labels[7] <- "which country from?" data[, 7] <- factor(data[, 7], levels=c("afg","ala","alb", ..., "zmb","zwe"),labels=c("afghanistan","Ã…land islands","albania", ..., "zambia","zimbabwe")) names(data)[7] <- "q3_nationality" however, cannot figure out how access 3-letter iso code in r? great iso code, can feed rworldmap joincountrydata2map() function , plot data on map. (i know can pass c

video - VLC 2.2 and Levels -

i have application i've written provide simulated mp4 camera streams "black box". use irony quotes because don't have access sources, have support contract vendor makes it. this black box supports h.264 level 2.2. not use sdp, expects camera streams 640x480 @ 30hz. understand reasonably standard output surveillance cameras. so application using vlc (libvlc specific) stream mp4 files device. have working fine (with one minor exception , that's separate issue). however, vlc 2.1.5. when tried upgrading latest 2.2.1, instead of videos on other side of our black box seeing whiteish-gray squares. our vendor looked on wireshark dumps, , told me vlc 2.2.1 stream reporting level 5.1 instead of 2.2, , using high profile instead of baseline or main. looks vlc trying "upgrade" (transcode?) video on me, , that's messing reader on black box. is there way old behavior vlc 2.1.5 back, or force use level , profile of choosing? h.264 profiles

symfony - symfony2 FOSUserBundle generate alphanumeric username -

in symfony project have different types of users: 2 admin accounts ids 1 , 2 , username can 100 account company ids of 3-102 , username must aa001 aa100 , accounts ordinary users username aa101, aa102, ... the 2 admin accounts , accounts of company create symfony command generate them. my question how generate user name others use registration form first register username aa101 , on my first idea : recover id max (maxid) , use ($username = 'aa'.maxid-1) happens if 2 users register @ same time second idea : persist entity , id (afterpersist events) , use ($username = 'aa'.id-2) method avoids risk of having same user name both accounts put in username before persist i don't know start , method best. advice or idea helpful ps:sorry english my solution now the user class <?php namespace fm\fmbundle\entity; use doctrine\orm\mapping orm; use fos\userbundle\model\user baseuser; /** * @orm\entity * @orm\table(name="fos_user") *

php paypal - Is email and password valid? -

i trying integrate paypal's php api. i want user login paypal check credentials, if user authenticate, want save email database. is functionality possible paypal's api. appreciated. paypal has product this: it's called log in paypal. https://developer.paypal.com/docs/integration/direct/identity/log-in-with-paypal/ this directs user paypal log in; after successful login user returned, along identity token can (are encouraged/expected to!) use key user session. the paypal session establishes can used initiate paypal payment (if, example, user shops on site , ready pay you). or can send user agree billing agreement future payments, etc etc. in short, have many options if want move "just" identity checking ability pay, agreeing pay or make future payments, etc.

How do I customize the navigation drawer in Android Studios? -

Image
how customize navigation drawer this: i cant find tutorials customize navigation drawer. can please help? you can use materialdrawer library has nice api , set custom view want drawer this: drawer = new drawerbuilder() .withactivity(this) .withcustomview(myview) .build();

python - How to select a row from a 2D tuple -

this straightforward thing can't it. how go selecting "rows" (i use word row lack of better one) 2d (or nd) tuple? a = [0,1,2,3] b = [4,5,6,7] c = (a,b) i.e., how result ([1,2],[5,6]) c? i've tried c[:][1:2] result ([4, 5, 6, 7],) you use comprehension: tuple(x[1:3] x in c)

php failed to open stream: No such file or directory -

i have 3 files: database.php, intialize.php , config.php. 3 files located under folder named: usr/loca/nginx/html/phpcode/php/999_projects/test/include/ database.php <?php echo "before"; require_once('initialize.php'); echo "after"; echo lib_path; ?> initialize.php <?php // directory_separator php pre-defined constant // (\ windows, / unix) defined('ds') ? null : define('ds', directory_separator); defined('site_root') ? null : define('site_root', $_server["document_root"].ds.'phpcode'.ds.'php'.ds.'999_projects'.ds.'test'); defined('lib_path') ? null : define('lib_path', site_root.ds.'includes'); // load config file first require_once(lib_path.ds.'config.php'); ?> config.php <?php // database constants defined('mysql_dsn') ? null : define("mysql_dsn", "mysql:host=localhost;dbname=talkbac

r - How to parse JSON with fromJSON on a dataframe column? -

i have following data.frame 1 column called "json" , 2 rows of json data: df <- data.frame(json = c('{"client":"abc company","totalusd":7110.0000,"durationdays":731,"familysize":4,"assignmenttype":"long term","homelocation":"australia","hostlocation":"united states","servicename":"service abc","homelocationgeolat":-25.274398,"homelocationgeolng":133.775136,"hostlocationgeolat":37.09024,"hostlocationgeolng":-95.712891}', '{"client":"abc company","totalusd":7110.0000,"durationdays":731,"familysize":4,"assignmenttype":"long term","homelocation":"australia","hostlocation":"united states","servicename":"service xyz","homelocationgeolat":-25.274398,"ho

Run a Powershell command (not script) from Excel VBA -

i've searched so, , can find plenty of examples of running powershell script vba, can't find examples of running simple command. for example, works: dim retval variant retval = shell("powershell ""c:\myscript.ps1""", vbnormalfocus) but not: dim retval variant dim pscmd string pscmd = "powershell " & _ chr(34) & "get-scheduledtask" & _ " -taskname " & chr(34) & "my task" & chr(34) & _ " -cimsession mylaptop" & chr(34) retval = shell(pscmd, vbnormalfocus) debug.print pscmd 'pscmd = powershell "get-scheduledtask -taskname "my task" -cimsession mylaptop" i know write ps command file, execute script, , delete file, not seem elegant. to run inline powershell command, you'll need use -command param , surround statement quotes. it'll easier if use single quotes within command. try out: pscmd = "powershel

windows - How do I get the number at the end of a string in batch? -

i'm writing batch command file uses local machine's hostname, , need extract number @ end of string. how number @ end of string in batch? input: w2008r2t001 w2008r2t002 w2008r2t003 w8_1_901 qatest84 qatest85 qatest86 desired output: 001 002 003 901 84 85 86 here little batch script written myself. @echo off setlocal enableextensions enabledelayedexpansion set "hostname=w2008r2t001" set /p "hostname=enter host name (default %hostname%): " call :getnumber "%hostname%" if "%number%" == "" ( echo host name has no number @ end. ) else ( echo found number @ end of host name is: %number% ) pause endlocal goto :eof :getnumber set "number=" set "stringtoparse=%~1" set "digits=0123456789" :checklastchar if "!digits:%stringtoparse:~-1%=!" equ "%digits%" goto:eof set "number=%stringtoparse:~-1%%number%" set "stringtoparse=%stringtoparse:~0,-1%&

sql server 2008 r2 - How to using UPDATE and SELECT in one Transaction SQL -

i have table: [dbo].[product] data : id name 01 keyboard 02 monitor 03 mouse 04 ram 05 hdd and : have 1 transaction: begin tran update product set name = 'xxx' id = 01 select name name_in_trans product id = 01 commit tran select name name_out_trans product id = 01 result: name_in_trans xxx name_out_trans xxx i don't know result correct or incorrect ! me , explain it, ! the first select within same transaction update, see non-committed data in transaction - in case, xxx value. second select after transaction committed, @ point query should see updated data. long story short - both queries should see xxx , expected behavior.

Javascript/JQuery Math.random to onclick fade to -

i making simple game school project , basic idea when press button start game random images fade in , have click many of them can in 30 seconds. using math.random , javascript if statements , jquery built in onclick , fadeto. function not working , dont know why.here html <!doctype html> <html> <head> <title>my test game</title> <!-- css --> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body> <h1>click many can in 30 seconds</h1> <input id="clickme" type="button" value="clickme"onclick="randomnumfunc();" /> <!-- game area --> <div id="game-area"> <div id="circle1"></div> </div> <!-- javascript/jquery --> <script src="js/jquery.js"></script> <script src="js/script.js"></script> </body> css: body { background-

php - login using curl not working with captcha -

Image
i trying home page after login using curl don't know why not displayed. think wrong in code; please check code , let me know whats wrong in code i tried every thing fails every time seen possible login in website, have 1 software login trial version , wanted build same thing in php <?php $file_contents=file_get_contents("https://www.irctc.co.in/eticketing/loginhome.jsf"); $dom = new domdocument(); @$dom->loadhtml($file_contents); $xpath = new domxpath($dom); $imgs = $xpath->query('//*[@id="cimage"]'); foreach($imgs $img) { $imagesrc=$img->getattribute('src') . php_eol; } ?> <?php //initial request login data if(isset($_request['submit'])) { $user='ansari4all'; $pass='ansari4all'; $captcha=$_request['j_captcha']; $submit=$_request['submit']; $ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://www.irctc.co.in/eticketing/lo