Posts

Showing posts from August, 2012

php - Strange behaviour of PHPUnit + Xdebug + PhpStorm -

i'm using phpstorm + xdebug + phpunit in shell on debian. works fine there strange behaviour, boring. when run phpunit command in shell, first break phpstorm show me in /usr/local/bin/phpunit in line check php version... but don't have put breakpoint in file. if (version_compare('5.6.0', php_version, '>')) { fwrite( stderr, 'this version of phpunit requires php 5.6; using latest version of php highly recommended.' . php_eol ); die(1); } in addition, file large remains blocked several seconds before can go ahead. any suggestion? make sure run | break @ first line in php scripts un-checked. but not here. if so: setting/preferences | languages & frameworks | php | debug uncheck force break @ first line when script outside project option -- based on description 1 responsible behaviour.

hibernate - grails postgressql not creating tables -

hi using grails 3 following dependency in build.gradle runtime group: 'org.postgresql', name: 'postgresql', version: '9.4.1209' my application.yml has following config hibernate: cache: queries: false use_second_level_cache: true use_query_cache: false region.factory_class: 'org.hibernate.cache.ehcache.ehcacheregionfactory' datasource: pooled: true jmxexport: true driverclassname: org.postgresql.driver username: postgres password: test environments: development: datasource: dbcreate: create-drop url: jdbc:postgresql://localhost:5432/devdb test: datasource: dbcreate: update url: jdbc:postgresql://localhost:5432/testdb production: datasource: dbcreate: update url: jdbc:postgresql://localhost:5432/proddb properties: jmxenabled: true initials

python - To redirect os.system() output to a .txt file -

i'm new python. have list of unix commmands ("uname -a","uptime","df -h","ifconfig -a","chkconfig --list","netstat -rn","cat /proc/meminfo","ls -l /dev") , want run them , redirect entire output .txt file. searched lot didn't proper solution, or understood things wrongly. i'm able output on stdout loop can't redirect file. def commandsoutput(): command = ("uname -a","uptime","df -h","ifconfig -a","chkconfig --list","netstat -rn","cat /proc/meminfo","ls -l /dev") in command: print (os.system(i)) commandsoutput() this answer uses os.popen , allows write output of command in file: import os def commandsoutput(): commands = ("uname -a","uptime","df -h","ifconfig -a","chkconfig --list","netstat -rn","cat /proc/m

javascript - How can I show SVG file on React Native? -

i want show svg files (i have bunch of svg images) thing couldn't find way show. tried use image , use components of react-native-svg don't work that. , tried native way it's hard work show svg image. example code: import svg, { use, image, } 'react-native-svg'; <view> <svg width="80" height="80"> <image href={require('./svg/1f604.svg')} /> </svgrn> </view> also know react native doesn't support svg think fix problem tricky way (with/without react-native-svg) after try many ways , libraries decided create new font (with glyphs app) , add svg files it, use "text" component custom font. hope have problem svg in react-native.

c# - How to set max FileSize of uploaded file with if-statement? -

i created <asp:fileupload id="fileuploadpassfoto"> on webpage. (asp.net , c#) i want check if uploaded file(image) bigger 6000kb. if true, file wont accepted , error message displayed. stored uploaded file following: (code behind) system.drawing.image photo = system.drawing.image.fromstream(fileuploadpassfoto.postedfile.inputstream); now want check if image bigger 6000kb. it works photo.size > size(6000kb). any suggestions? you can check this: decimal size = math.round(((decimal)fileuploadpassfoto.postedfile.contentlength / (decimal)1024), 2); if(size > 6000) { // size greater 6000kb }

c# - How to search string for a specific substring and get a number associated with that substring? -

i newbie learning c# , task @ hand: have text file json in it. in text file there multiple lines , each paragraph separated next through empty line. i want number associated substring "label " + number. see below. this example of input text file: {"menu": {"header": "menu", "items": [{"id": 27}, {"id": 0, "label": "label 0"}, null, {"id": 93}, {"id": 85}, {"id": 54}, null, {"id": 46, "label": "label 46"}]}} {"menu": {"header": "menu", "items": [{"id": 81}]}} {"menu": {"header": "menu", "items": [{"id": 70, "label": "label 70"}, {"id": 85, "label": "label 85"}, {"id": 93, "label": "label 93"}, {"id": 2}]}} what i'v

octave - How to calculate Hamming distance in matlab for two vectors? -

i need calculate hamming distance between 2 vectors in octave. searching in internet, found hamming distance using function: pdist (), doesn't give me result, because pdist() missing function in octave. w= pdist([208 15 217 252 128 35 50 252 209 120 97 140 235 220 32 251], [231 174 143 43 125 66 49 143 48 139 81 103 154 229 93 229],1) i grateful if me please.

c# - Sign XML with digital signature -

i'm working web-service requires digitally signed xml posted via http post request. gave me 1 file (key.dat) should apply xml. how can it? you can take on here : private static xmlelement getxmldigitalsignature(xmldocument x, asymmetricalgorithm key) { var signedxml = new signedxml(x) { signingkey = key }; var reference = new reference { uri = "", transformchain = new transformchain(), }; reference.addtransform(new xmldsigenvelopedsignaturetransform()); signedxml.addreference(reference); signedxml.computesignature(); return signedxml.getxml(); } var signature = getxmldigitalsignature(xmldocument, algorithm); xmldocument.firstchild.appendchild(xmldocument.importnode(signature, true));

javascript - Download Svg as png doesnt work on IE11 -

the svg d3 graph needs downloaded.i have used savesvgaspngjpgsvg initiate download .the code works fine on other browsers expect ie11. fiddle i have tried : svgasdatauri(svg, {}, function(svg_uri) { render_width=1000; render_height=1000; var canvas = document.createelement('canvas'); canvas.height = render_height; canvas.width = render_width; document.body.appendchild(canvas); // create image , draw svg onto canvas var image = new image; image.onload = function() { canvas.getcontext('2d').drawimage(this, 0, 0, render_width, render_height); }; image.src = svg_uri; settimeout(function(){//download_in_ie(canvas, 'filename' + '.png'); if (canvas.mstoblob) { //for ie var blob = canvas.mstoblob(); window.navigator.mssaveblob(blob, 'dicomimage.png'); } }, 3000); }); using mssaveblob suggested in given l

swift2 - swift background BLE scanning with scanForPeripheralsWithServices UUID not taken into account -

i'm performing ble devices scan in specific thread. if want app run in background, need specify scanforperipheralswithservices specific range of services. when launching following (with nil) : func startscanning() { print("start scanning...") if let central = centralmanager { central.scanforperipheralswithservices(nil, options: nil) } } i can find ble device uuid "b737d0e7-af53-9b83-e5d2-922140a92e00", apple documentation mentioned cannot ruined in background mode. then if specify uuid function: func startscanning() { print("start scanning...") if let central = centralmanager { let ble = [cbuuid(string: "b737d0e7-af53-9b83-e5d2-922140a92e00")] central.scanforperipheralswithservices(ble, options: nil) } } scan never called. miss ?

r - Make a number of dataframes by using loop -

i have data frame "df" following: df=data.frame(time=as.factor(rep(c(0.01*(1:100)),each=49)), roi=rep(1:49,100), area=runif(4900, 5.0, 7.5),hours=(rep(1:10,each=490))) the df split 10 smaller data frames based on column "hours" x=split(df,df$hours) in each sub-data frame 1 new data frame "br[i] made following: br1=data.frame(x$`1`[c(1,round(nrow(x$`1`)*(1:4)/4)),]) br1$min=c(0,15,30,45,60) br2=data.frame(x$`2`[c(1,round(nrow(x$`2`)*(1:4)/4)),]) br2$min=c(0,15,30,45,60) ... br10=data.frame(x$`10`[c(1,round(nrow(x$`10`)*(1:4)/4)),]) br10$min=c(0,15,30,45,60) the question how made 10 data frames "br" automatically without repeat such above commands in many time? thanks response! try: lapply(split(df,df$hours), function(x) { br=data.frame(x[c(1,round(nrow(x)*(1:4)/4)),]) br$min=c(0,15,30,45,60) return(br) })

android - Firebase email authentication? -

i'm trying use firebase (email authentication) android app. don't recieve error msg., doesn't work. i'm stuck somewhere , cant solve. need help. thanks. package name same (firebase , app). i imported json file in project app folder. sign-in method = email/password = enabled database rule published: { "rules": { ".read": true, ".write": true, } } this build.gradle : buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' } } allprojects { repositories { jcenter() } } this build.gradle (app): apply plugin: 'com.android.application' android { compilesdkversion 24 buildtoolsversion "24.0.1" defaultconfig { applicationid "com.mypack.kim" minsdkversion 16 targetsdkversion 22 } buildtypes { release { minifyen

heidisql - SQL count and sum query -

i have query shows model,brand , category of equipment , engineer installed equipment,the commission earned doing job , county equipment installed. used query display distinct models installed engineers if engineer installed same equipment in county display equipment once county same equipment displayed again if engineer installed in county. query: select distinct models.model,brands.brand, categories.name, equipments.commission, equipments.engineer_name, counties.name equipments inner join models on equipments.model = models.id inner join brands on equipments.brand = brands.id inner join categories on equipments.category = categories.id inner join agencies on equipments.agency = agencies.id inner join counties on agencies.county = counties.id inner join clients on agencies.client = clients.id equipments.engineer!='all' order counties.name asc,equipments.engineer_name i want use count display how many times equipment installed same engineer in county , use sum calculat

python global variable between modules -

i have 2 modules , i'm trying modify global variable in first module second module. app.py : import time glob=0; def setval(val): global glob glob = val print "glob = "+glob def bau(): while(1): if(glob): print"glob set" else: print"glob unset" time.sleep(1) bau() start.py : from app import setval app.setval(1) i not able understand why in start.py full content of app.py included , not function want. second don't understand why running first app.py , start.py , start.py not modify value of global variable in app. i not able understand why in start.py full content of app.py included , not function want. you misunderstand how import works. runs script importing , then binds things defined inside. if wish import function script not supposed other declarations, i.e. remove bau() line. so declare functions, classes , constants inside scripts , in 1 root script

python - Calculating the stock price volatility from a 3-columns csv -

i looking way make following code work: import pandas path = 'data_prices.csv' data = pandas.read_csv(path, sep=';') data = data.sort_values(by=['ticker', 'date'], ascending=[true, false]) data.columns i have 2 dimensional array 3 columns, data looks this: date;ticker;price 20151231;a un equity;41.81 20151230;a un equity;42.17 20151229;a un equity;42.36 20151228;a un equity;41.78 20151224;a un equity;42.14 20151223;a un equity;41.77 20151222;a un equity;41.22 20151221;a un equity;40.83 20151218;a un equity;40.1 20091120;pcg un equity;42.1 20091119;pcg un equity;41.53 20091118;pcg un equity;41.86 20091117;pcg un equity;42.23 20091116;pcg un equity;42.6 20091113;pcg un equity;41.93 20091112;pcg un equity;41.6 20091111;pcg un equity;42.01 now, want calculate x-day realized volatility x came input field , x should not bigger number of observations. the steps need taken: calculate log return each line take returns , run standard deviation

c++ - timeout and select() not working as expected -

i'm trying communicate server using rcon protocol take control on gamesever. far using exisiting c# library library quite buggy , therefore i'm writing own application in c++ i'm able use both on windows , on linux server. so far worked out pretty i'm running problems when try set timeout using select() find out if server still started , responding commands. during first run of application select() returns right value, after closing , running again, results weird. my code pretty looks this: #include <stdio.h> #include <iostream> #include <iomanip> #include <sstream> #include <string.h> #include <unistd.h> // socket includes #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> // other includes #include "main.h" #include "crc32.h" int main() { struct sockaddr_in server; int mysocket, slen = sizeof(server); char buffer[2048];

How can I remove a sub array from a big array in php? -

this question has answer here: how filter array condition 7 answers here array, want remove dynamically: array ( [fields] => id [number] => 0 [meta_query] => array ( [relation] => , [0] => array ( [key] => role [value] => array ( [0] => subscriber [1] => author [2] => custom-one [3] => custom-two ) [compare] => in ) [1] => array ( [key] => country [value] => united states [compare] => = ) [2] => array ( [key] => near_by_place [value] => someplace [compare] => ) ) [order] => asc [meta_key] => last_name [orderby] => meta_value ) i wan

r - How to change negative x axis breaks (labels) of ggplot2 bar graph into positive ones? -

i have dataframe looks one: df <- structure(list(gender = c("male", "male", "male", "female", "female", "female", "male", "male", "male", "male", "male", "female", "female", "female"), agegroup = c("-24", "25-34", "45-54", "-24", "25-34", "35-44", "-24", "25-34", "35-44", "65-", "unknown", "-24", "25-34", "35-44"), n = c(-2, -4, -1, 3, 4, 1, -3, -14, -1, -1, -2, 3, 3, 1), n2 = c(2, 4, 1, 3, 4, 1, 3, 14, 1, 1, 2, 3, 3, 1), location = c("here", "here", "here", "here", "here", "here", "there", "there", "there", "there", "there", "there", "there", "there")), .na

java - How can I add print from ArrayList in AWT? -

i'm trying print out contents of arraylist in awt using for-loop. however, when try compile code , run it, nothing shown. i'm new java, i'm not sure causing this. import java.applet.applet; import java.awt.*; import java.awt.event.*; import java.time.*; import javax.swing.*; import java.util.arraylist; public class timedisplay extends applet { private city washingtondc, beijing, london, tokyo, moscow, timeretrieval; string temp; string []cities = {"washingtondc", "beijing", "london", "tokyo", "moscow"}; string [] gmt = {"-4", "+8", "+1", "+9", "+3"}; arraylist displaystrings; boolean displaytype; public void init() { washingtondc = new city("-4", "washington d.c."); beijing = new city("+8", "beijing"); london = new city("+1", "london"); tokyo = new city("+9",

installation - Cannot get MajorUpgrade to work with setup produced with different installer -

Image
i have problem getting wix installer major upgrade when previous versions installer made different toolkit. have product defined this: <product version="!(bind.fileversion.baustatik.exe)" id="*" name="die anwendungen" language="0" codepage="1252" manufacturer="d.i.e. software gmbh" upgradecode="6dca3bad-77e9-41ae-8f72-b92de136c499"> <package installerversion="400" compressed="yes" installscope="permachine" installprivileges="elevated" /> <majorupgrade allowdowngrades="no" allowsameversionupgrades="no" downgradeerrormessage="es ist bereits eine neuere version von [productname] installiert." /> ..... other stuff the above produces msi. msi chained inside bundle. bundle defined this: <bundle name="die anwendungen" version="!(bind.packageversion.the32bitmsi)" manufacturer="

android - Custom color kit by Style -

how create custom colors kit themes? in styles.xml <style name="dark" parent="@style/theme.appcompat"> <item name="bluestyled">#229</item> </style> in values-v21/colors.xml <color name="bluestyled">?bluestyled</color> but app crashes when try set color, e.g.: android:background="@color/bluestyled" first, define colors in res/values/colors.xml : <color name="dark_color">#229</color> <color name="light_color">#6161ff</color> create attribute you're gonna use color in /res/attrs.xml : <resources> <attr name="blue_styled" format="reference"/> </resources> define items in styles same name name of attribute , desired colors values: <style name="dark" parent="@style/theme.appcompat"> <item name="blue_styled">@color/dark_color</ite

javascript - How to return text from an element into variable in Protractor -

here's deal - gettext() method returns promise, it's okay in case when using inside of expect() , when i'm trying return string value of element variable, returns promise. here code: var text = mainpage.counter().gettext().then((text) => { return text; }) is there way text , assign variable? a promise’s value resolved promise, should check post : how return response asynchronous call? so in case - var data = mainpage.counter().gettext().then((text) => { return text; }); // @ point data still managed promise! data.then((text) => { console.log(text); // text printed! });

r - Select upper and lower values and create a new column with random values -

i have data set 30 rows , 2 columns. example: value <- c(305.19, 30.19, 126.97, 178.89, 640.01, 189.28, 15.92, 219.79, 178.89, 911.61, 178.89, 18.28, 305.19, 322.90, 126.97, 12.97, 178.89, 12.97, 322.90, 158.92, 322.90, 219.79, 911.61, 219.79, 911.61, 325.90, 322.90, 911.61, 158.92, 322.78) date <- c("1997-05-01","1997-05-02","1997-05-03","1997-05-04","1997-05-05", "1997-05-06","1997-05-07","1997-05-08","1997-05-09","1997-05-10", "1997-05-11","1997-05-12","1997-05-13","1997-05-14","1997-05-15", "1997-05-16","1997-05-17","1997-05-18","1997-05-19","1997-05-20", "1997-05-21","1997-05-22","1997-05-23","1997-05-24","1997-05-25", "

github - OpenSSL.SSL.Error: [('SSL routines', 'SSL3_GET_RECORD', 'decryption failed or bad record mac')] -

i trying clone repository bit bucket sharing other member of our group...but fetch error during cloning... cloning 'industryprime'... password 'https://abhragh@bitbucket.org': remote: counting objects: 20143, done. remote: compressing objects: 100% (5741/5741), done. error: rpc failed; curl 56 ssl read: error:1408f119:ssl routines:ssl3_get_record:decryption failed or bad record mac, errno 0 fatal: remote end hung unexpectedly fatal: eof fatal: index-pack failed what can do?

css - How can I set the font color in a Kendo chart header? -

my css file looks this: #productgrid .k-grid-header .k-header { background-color: blue; color: white !important; } this works background-color not font color! my grid code looks this: @(html.kendo().grid<productsummary>() .name("productgrid") .columns(columns => { columns.bound(c => c.product); columns.bound(c => c.quantity); columns.bound(c => c.value).clienttemplate("£#= kendo.tostring(value, \"n2\") #"); columns.bound(c => c.percentage).title("%"); }) .htmlattributes(new { style = "height: 550px;" }) .scrollable() .sortable() .datasource(datasource => datasource .ajax() .read(read => read.action("products_read", "products", new { region = viewbag.regions[model.regionpos].value })) ) my colleague helped me fix this. turns out header hyperlink. #productgrid .k-link { color: #ffffff !important; }

c# - 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' -

i want access root url of web application windows forms application. string rooturl = billing_xml_webtracking.webform1.rooturl; string url = rooturl + "/webform1.aspx"; webbrowser1.navigate(url); so have added below code web.config of web application : <assemblies> <add assembly="system.runtime, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a"/> </assemblies> and final code of web.config file is <configuration> <system.web> <compilation debug="true" targetframework="4.0"> <assemblies> <add assembly="system.runtime, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a"/> </assemblies> </compilation> <pages controlrenderingcompatibilityversion="3.5" clientidmode="autoid"/> </system.web> </configuration> but while building solution, giving below error ty

javascript - Checkbox doesn't want to toggle enable disable field -

i have check box , field. default field needs disabled. check box checked, field should enable. i've tried literally every answer here no luck. i've tried css failed there too. when try of samples in fiddle or ever else work, in project don't. what have simple test when click #clicker , field disables/enables. works perfectly. know javascript work, don't require libraries whatsoever. need adjust code work when check box checked or not. this have; <script type="text/javascript"> $().ready(function() { $('#clicker').click(function() { $('#form_secondapprover').each(function() { if ($(this).attr('disabled')) { $(this).removeattr('disabled'); } else { $(this).attr({ 'disabled': 'disabled' }); } }); }); }); here pure javascript solution answer !!

php - Javascript scope and sequentiality issue -

i want id query , display in html. i want keep things in separate javascript files, because in future, retrieve json php , filter based on checkboxes, radio buttons, etc. , display result. in moment, blank page, , id value not shown, i'm doing wrong. http://localhost:10600/js1/index.php?id=5 index.php <html> <head> <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script> </head> <body> <div class="results"></div> </body> </html> <script type="text/javascript" src="config.js"></script> <script type="text/javascript" src="display.js"></script> <script type="text/javascript" src="sequence.js"></script> config.js function getid() { id = "<?php echo $_get['id']; ?>"; } display.js funct

c# - System.NullReferenceException when initialization -

this question has answer here: what nullreferenceexception, , how fix it? 33 answers i have window named 'mainwindow' 2 frames named 'mainframe','sidepanel' , in 'mainwindow', when click 'btn1' 'sidepanel', 'mainframe' navigated 'frame1' page. in 'frame1', have border control child. mainwindow.xaml.cs: ((mainwindow)app.current.mainwindow).mainframe.navigate(new frame1()); frame1.xaml: <border> </border> frame1.xaml.cs: public frame1() { initializecomponent(); var page = ((mainwindow)app.current.mainwindow).mainframe.content page; var border = page.content border; } i'm having "system.nullreferenceexception" when initializing border page.content=null. if click 'btn1' 2nd time, initialized 'system.windows.controls.border'. want res

android - Toogle button font color and drawableft selector -

xamarin, android. made selector changes background colors: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false"> <shape> <solid android:color="#aaaaac"/> <corners android:radius="6dp" /> <padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" /> </shape> <drawable drawableleft="@drawable/male"/> </item> <item android:state_checked="true"> <shape> <solid android:color="#357fca" /> <corners android:radius="6dp" /> <padding android:left="5dp" android:top="5dp" android:righ

c++ - Cmake: check if system include directory -

is possible cmake 2.6 (or higher, if not possible in version) check whether include directory marked system (e.g. compile isystem gcc flag, see 2.8 system headers )? for example, include directories of current target with: get_property(_target_include_dirs directory ${cmake_current_source_dir} property include_directories) how know ones marked isystem ? thanks looking @ cmake source, whether include directory added include_directories marked system seems tracked in cmake internals, , not available consumption inside cmakelists.txt ¹. however, target property interface_include_directories (populated target_include_directories either public or interface ), there target property named interface_system_include_directories : add_library(testlib test.cc) target_include_directories(testlib system interface /target_system) get_property(_system_include_dirs target testlib property interface_system_include_directories) message("system: ${_system_include_di

For upgrade Django 1.9.7 to 1.9.9 "webpackJsonp is not defined" appears in admin page menu -

i testing elements of django-cms django, when upgrade django 1.9.7 django 1.9.9 javascript error on admin django-cms on menus page "webpackjsonp not defined" issued static bundle .../cms/js/dist/bundle.admin.pagetree.js. after google turnaround, trouble seems linked bundle building. downgrade django 1.9.7 , it's ok thanks pagetree bundle /cms/js/dist/bundle.admin.pagetree.min.js cannot used without /cms/js/dist/bundle.admin.base.min.js included before it. what important reference them using {% static_with_version %} template tags come cms_static library.

amazon web services - EC2 unhealthy instance -

elb show instance available in appropriate zone unhealthy. i'm tried make request instance own health-check endpoint received 503. curl -i public-ip:port/target-healthy-endpoint http/1.1 503 service temporarily unavailable date: thu, 04 aug 2016 17:25:10 gmt connection: close content-type: text/html; charset=iso-8859-1 what mean, , should look? on aws doc found this: solution 3: ensure have healthy instances in every availability zone load balancer configured respond in. verify looking @ healthyhostcount in cloudwatch. if indeed pinging public ip address of ec2 instance, , curl ing health check url returning 503 error code, stop thinking of elb issue. won't find solution in aws docs. the pure fact ec2 instance responding 503 on it's own accord. sign-in ec2 instance , fix problem until responds 200 status code using curl . may configuration issue http server (iis, apache, other). as aside, since ec2 instance fronted elb, ec2 instance should reside in

python - multiprocessing is not doing multi process -

in python have created 4 process open multi tabs simultaneously tabs opened in sequence not parrellelly. code : from selenium import webdriver multiprocessing import process selenium.webdriver.common.keys import keys def func1(driver): driver.find_element_by_tag_name('body').send_keys(keys.control + 't') driver.switch_to.window(driver.window_handles[-1]) driver.get('http://www.rediff.com') driver.implicitly_wait(20) driver.get('http://yatra.com') driver.implicitly_wait(50) driver.get('http://makemytrip.com') def func2(driver): driver.find_element_by_tag_name('body').send_keys(keys.control + 't') driver.switch_to.window(driver.window_handles[-1]) driver.get('http://www.stackoverflow.com') driver.implicitly_wait(10) driver.get('http://www.facebook.com') driver.refresh() def func3(driver): driver.find_element_by_tag_name('body').send_keys(key

java - TypeUtils says "null" is instance of "Object.class"? -

regarding following code org.apache.commons.lang3.reflect.typeutils says null type of object.class . isn't incorrect ? public static void main(string args[]) { boolean bool = null; if (typeutils.isinstance(bool, object.class)) { system.out.println("bool isinstance object-true"); } else { system.out.println("bool isinstance object-false"); } } i agree you. isinstance() method misleading. should rather isassignable() since documentation indicates : checks if given value can assigned target type following java generics rules. and null not instance of object class since null not instance. but result accurate according documentation since null can assigned object type. , when implementation, can see code calls isassignable() method : public static boolean isinstance(final object value, final type type) { if (type == null) { return false; } return value == null ? !(type instanc

php - TYPO3: Add custom set functions in extension controller -

i'm creating extension visitors sign page. when signing up, should create fe user in backend disabled (and manually enabled admin). i'll need set disable field 1 when creating fe user. this function inside controller: /** * action create * * @param \vendor\fereg\domain\model\dummy $newdummy * @return void */ public function createaction(\vendor\fereg\domain\model\dummy $newdummy) { // vars $title = $newdummy->gettitle(); $atitle = $newdummy->getatitle(); $fname = $newdummy->getfname(); $lname = $newdummy->getlname(); $street = $newdummy->getstreet(); $city = $newdummy->getcity(); $post = $newdummy->getpost(); $phone = $newdummy->getphone(); $fax = $newdummy->getfax(); $email = $newdummy->getemail(); $org = $newdummy->getorg(); $cat = $newdummy->getcat(); $field = $newdummy->getfield(); $uname = $newdummy->getuname(); $ppass = $newdummy->getppass(); $c

javascript - Page title in ui routing -

i using ui route. want set page title if title static or hard code, it's working fine want set page title based on dynamic state. here code: .state('sportsbrief', { url: '/sportsbrief', controller: 'homecontroller home', templateurl: html.sports_brief, title:"sportsbrief" }) .state('page',{ url:'/page/:page', templateurl:function(value){ return"views/"+value.page+".html" }, controller:"staticpagecontroller", title:value.page }) i want set page title state page. you can use angular-ui-router-title in app allows dynamic title update. https://github.com/nonplus/angular-ui-router-title ref: updating title tag using angularjs , ui-router

javascript - Ajax request failed to execute showing error message -

i have been using $.ajax method call api validation & subsequently processing request. trying call request fails each time saying following error: exception: [exception... "the uri scheme corresponds unknown protocol handler" nsresult: "0x804b0012 (ns_error_unknown_protocol)" location: "js frame :: http://localhost:90/project/assets/plugins/jquery/jquery.min.js :: .send :: line 5" data: no] my code sample this: $('#signupprocess-form').on('click', function (e) { var dataobject = {firstname: $('#userfirstname').val(), lastname: $('#userlastname').val(), email: $('#useremail').val(), password: $('#userpassword').val()}; console.log(dataobject); $.ajax({ url:'localhost:90/project/php/scripts/validation/signup/validation-signup.php', type: 'post', data: dataobject, datatype: "j

html - Bootstrap navbar - fixed on mobile on horizontal website -

i'm making horizontal website. i've tried setting top menu (navbar) position:fixed or giving navbar-fixed-top class, experimenting %, on mobile (iphone 5 @ least) end navbar either taking width of entire page (so menu button on right , visible when scroll last page), either it's visible on first page , scrolls away when scroll right. here's simplified code: html: <body> <nav class="navbar"> here goes typical boostrap navbar construction </nav> <div class="big-wrap"> <section id="one"> </section> <section id="two"> </section> <section id="three"> </section> <section id="four"> </section> </div> </body> css: html {position: relative;} html, body {height: 100%} .big-wrap {position: absolute;width: 400%} section {float:left;width:25%;} how can make

Subtract a string in R -

i have string this: phrase <- "this_is.//the_first?the_second" and result want subtract string based on ? , take result this >phrase_new[1] "this_is.//the_first?" >phrase_new[2] "the_second" i try not working. please there idea this? phrase_new <- sub("[:?:]", "", phrase) if want split character, better use strsplit : > strsplit(phrase, "?", fixed = true) [[1]] [1] "this_is.//the_first" "the_second"

How to move position of chart in excel by Java POI -

Image
i want add row in excel java poi , try both shiftrows() function , createrow() function both function can add row in excel below chart position remain , not move i move (shift down) position of chart i use poi version 3.9 can give me advice or idea move position of chart image as fact, data range of chart not changed. need not move position of charts need increase data range of chart thanks!! the shifting of drawing anchors determine chart positions possible. method void insertrowsshiftshapes(sheet sheet, int startrow, int n) drawing anchors affected of row inserting process sheet. the correcting of chart data ranges affected of row inserting sheet complicated said already. not tested , not ready yet. provide working draft. hope useful start point further programming. for running code ooxml-schemas-1.3.jar needed mentioned in apache poi faq a resource documentation of ooxml-schema objects me grepcode examples: cttwocellanchor , ctpiechart , ctp

rust - How to link main.rs to lib.rs dynamically? -

i have crate both src/lib.rs , src/main.rs . main.rs using extern crate programname (which lib.rs ) , uses functions lib.rs , it's submodules. the documentation on linking says: pure-rust dependencies statically linked default can use created binaries , libraries without installing rust everywhere. how can change behavior binary created main.rs dynamically linked library produced lib.rs ? i've added following cargo.toml [lib] path = "src/lib.rs" crate-type = ["dylib"] [[bin]] name = "programname" path = "src/main.rs" but not compile , gives me errors like: error: cannot satisfy dependencies `std` shows once help: having upstream crates available in 1 format make go away if add "rlib" lib section, compiles, binary not linked against libprogramname.so

c++ - BlueTooth connection faliure -

environment ubuntu 16.04 standard usb bluetooth dongle c++ bluez running root problem description while hcitool & sdptool operate, code fail connecting sdp errno == 2 ( enoent ), following failing code: m_psdpsession = sdp_connect(bdaddr_any, bdaddr_local, sdp_retry_if_busy | sdp_wait_on_close); why 'sdp_connect' failing? how can have resolved ? edit /usr/lib/systemd/system/bluetooth.service , includ flag in execstart option. execstart=/usr/libexec/bluetooth/bluetoothd --compat then $ systemctl daemon-reload $ systemctl restart bluetooth.service

java - Which is best way to mapping request bean object to hibernate domain model object? -

for api application development using spring boot , hibernate on java 8, need store bean object values(for example bookid, bookname, bookdescription) db. please find sample classes beanobject.java package com.example; public class beanobject { private string bookid; private string bookname; private string bookdescription; /** * @return bookid */ public string getbookid() { return bookid; } /** * @param bookid bookid set */ public void setbookid(string bookid) { this.bookid = bookid; } /** * @return bookname */ public string getbookname() { return bookname; } /** * @param bookname bookname set */ public void setbookname(string bookname) { this.bookname = bookname; } /** * @return bookdescription */ public string getbookdescription() { return bookdescription; } /** * @param bookdescription bookdescription set

r - Creating functions in a for loop with lists -

i scratching head @ following problem: i creating 2 functions inside loop parameters depend on dataframe. each function put inside list. printing parameters inside loop shows eachh function defined. yet, when use outside of loop, last parameters used both functions. following example should make clearer. dt <- data.frame(color = c("red", "blue"), = c(3,9), b = c(1.3, 1.8)) function_list <- list() (col in dt$color) { <- dt$a[dt$color == col] b <- dt$b[dt$color == col] foo <- function(x) { a*x^b } print(paste(col, foo(1))) function_list[[col]] <- foo } [1] "red 3" [1] "blue 9" function_list[["red"]](1) [1] 9 function_list[["blue"]](1) [1] 9 to note, inspired following question: r nested loop write multiple functions , plot them the equivalent solution assign , get works (my answer previous question). the re

sql - Pass temp table to EXEC sp_executesql -

how can pass temp table (@table) exec sp_executesql @query set @query = 'select gsname, ' + @cols + ' ( select gsname, [thour], numoftransactions @table ) x pivot ( max([numoftransactions]) [thour] in (' + @cols + ') ) p ' what have here not temporary table , table-valued parameter . table-valued parameters declared using user-defined table types. can use table-valued parameters send multiple rows of data transact-sql statement or routine, such stored procedure or function, without creating temporary table or many parameters. sp_executesql support table-valued parameters, must of declared type. -- so, first must declare user-defined table type create type udtyb_test table(gsname nvarchar(100), thour time, numoftransactions int); go -- can create table-valued parameter declare @table udtyb_test; -- , store there data insert @table (gs

java - Making Eclipse's subversive auto update and perform a maven build on schedule? -

i have right 2 maven projects on eclipse mars installation, project a, , project b, depends on a. idea perform svn -> update head of both projects, maven -> build/install of project a, same project b, when arrive @ work date. i've been looking around , seems last questions on topic years ago , suggested setup continuous integration server on machine. problem that, reason, i'm not machine admin (been given configured installation), seems installing jenkins out of question. so, there's way automate, through eclipse, process? you may doing outside eclipse using schedule service of os for windows: go start menu -> programs -> accessories -> system tools -> task scheduler , follow instructions here for linux: use crontab . the maven command svn updat mvn scm:update . may combine build command e.g. mvn scm:update clean install write commands in batch(win)/sh(linux) file according os , manage execution schedule service mentioned abov

sql server - T-SQL Get View query after "AS" -

Image
i have view name " _report_territories " if run below query exec sp_helptext '_report_territories' result displays below screen question: how can view query after " create view [dbo].[_report_territories] as " ? any appreciated. thanks. put results of sp_helptext in temporary table, make string , need declare @t table ( [text] nvarchar(max) ) declare @sql nvarchar(max) ='' insert @t exec sp_helptext 'vcities' select @sql =@sql+ [text] @t select substring(@sql,1,charindex('as',@sql)+ len('as')) will give you: create view vcities note: solution may unrelevant if view name contains as

How do I compare strings in Java? -

i've been using == operator in program compare strings far. however, ran bug, changed 1 of them .equals() instead, , fixed bug. is == bad? when should , should not used? what's difference? == tests reference equality (whether same object). .equals() tests value equality (whether logically "equal"). objects.equals() checks nulls before calling .equals() don't have (available of jdk7, available in guava ). consequently, if want test whether 2 strings have same value want use objects.equals() . // these 2 have same value new string("test").equals("test") // --> true // ... not same object new string("test") == "test" // --> false // ... neither these new string("test") == new string("test") // --> false // ... these because literals interned // compiler , refer same object "test" == "test" // --> true // ... should call objects.equals() o

jquery - SHOW/HIDE table rows -

i have user interface now need row "hello" need hidden @ first , when user check checkbox row "hello" shown , other "comino , dropdownlists" hide. i tried code , first row hiding dont know hide second row , show when checkbox checked this fist row(not code here becuase quite long): <table class="table table-striped" id="tablecountry"> <thead> <tr> <th>country</th> <th>monday</th> <th>tuesday</th> <th>wednesday</th> <th>thursday</th> <th>friday</th> <th>saturday</th> <th>sunday</th> </tr> </thead> <tr class="row2"> <td><?php echo $_sess

c# - How to add EntityObject Generator in Visual Studio 2015? -

i have installed latest entity framework version (entityframework.6.1.3) in vs2015. have added ef in project , deleted 2 .tt files ( edmx_file_name.tt , edmx_file_name.context.tt ) dbcontext. now trying add ef 6.x code generation template open model in ef designer, right-click on design surface , select add code generation item . to add code generation in objectcontext need install ef 6.x entityobject generator. downloaded here . but couldn't install in vs 2015. how solve this? since until now, no entityobject generator template supported in visual studio 2015, alter solution is, open solution visual studio 2013, open edmx diagram, right click, select "add code generation item", see "ef 6.x entityobject generator", if cannot see it, go "online" menu, , see "ef 6.x entityobject generator c#" display. select entityobject generator , click "add" button add data access layer project. tt auto generate entityobject

Python: Best way to frame a loop with 2 alternating tasks -

i have list of items need process. easy enough: simple for x in list . however, commands inside loop need different, on alternating basis. n = 0 handled 1 way, n = 1 different way; n = 2 same n = 0 . note n , x different! at moment, way can think of doing incremental counter , if statements. i'm presuming there's easier way? hope makes sense. thanks you use enumerate , modulo alternate: li = ['a', 'b', 'c'] idx, ch in enumerate(li): if idx % 2 == 0: # else: # b

meteor - validateDOMNesting(...): #text cannot appear as a child of <tr> -

i creating reusable component table , facing warning in console is:- validatedomnesting(...): #text cannot appear child of <tr>. here sample code :- this render method in checking value of object if json make linkable row otherwise simple text. return ( <div classname="table-responsive" id={self.props.tableid}> <table id="table3"classname="table table-bordered"> <tbody> { this.isjson(self.props.columns.labels[0]) ? (this.props.records.map((record, index) => { return self.makelink( record, index) })) : (this.props.records.map((record, index) => { return ( <tr key = { index } > { self.props.columns.labels.map((label, index) => { return ( <td key = { index } > { self.rendertabledata(index, record) }

Firebase - uploading images when internet is offline -

firebase has great option of using database , sending data db if offline, , when connection again, sends automaticlly data db. is possible firebase storage? send images if internet offline, , when internet on again, send images files automaticlly? if so, how can it? if not firebase, other option? thanks yes. firebase storage client supports resuming uploads. see firebase storage documentation uploads ( ios , web , android ). from there android: uploadtask = mstorageref.putfile(localfile); sessionuri = uploadtask.getuploadsessionuri(); //save sessionuri persistent storage in case process dies. and resume: //resume upload task left off when process died. //to this, pass sessionuri last parameter uploadtask = mstorageref.putfile(localfile, new storagemetadata.builder().build(), sessionuri); update (20160809) one way handle sessionuri: when create uploadtask , sessionuri , store app's sharedpreferences . when uploadtask completes, r