Posts

Showing posts from September, 2010

php ajax url parameter -

is there concern if expose our php page in ajax, url param? i've seen website able hide .php or .aspx page. below production code. way improvise if poorly written it? $("#login-submit").click(function(e){ e.preventdefault(); var vusername = $("#username").val(); var vpassword = $("#password").val(); $.ajax({ url: "postlogin.php", type: "post", data: {'action':'login-submit','username':vusername,'password':vpassword}, datatype: "json", success: function(data) { if(data.status == 'success'){ window.location.replace("index.php"); }else if(data.status == 'false'){ $('#errmsg').fadein('slow'); $("#errmsg").html(data.errmsg); }else{

ios - How to get plain text of mobile communication from iPhone -

i know if there possibility plain text logs of mobile network communication iphone. expect iphone has set developer mode . @ point don't know options have set exactly. for app development there need know information sent device rest-servers. has idea how solve this? greets!

c# - ASP.net: How to handle non-valid model with foreign keys -

i have model foreign keys: public class route : idbentity { [key] public int id { get; set; } [display(name = "flight number")] [required(errormessage = "flight number required")] public string flightnumber { get; set; } [display(name = "aircraft")] [required(errormessage = "aircraft required")] public int? aircraftid { get; set; } [foreignkey("aircraftid")] public virtual aircraft aircraft { get; set; } } on call of show view or edit view use retrieve object: public new async task<route> get(int id) { return await context .set<route>() .where(e => e.id == id) .include(e => e.aircraft) .firstordefaultasync(); } and works great. but if edit method received non-valid model, try return model view : [httppost] public async task<iactionresult> edit(tentity e) { if (!modelstate.isvalid) return view(e); var issucce

asp.net - c# check date is weekend or weekday -

dayofweek today = datetime.today.dayofweek; if (today == dayofweek.sunday || today == dayofweek.saturday) { clientscript.registerstartupscript(gettype(), "alert", "alert('" weekend"');", true); } else { clientscript.registerstartupscript(gettype(), "alert", "alert('" weekday"');", true); } from line above able find if today weekend or weekday now want date user input tried fail, my text input format : 2016-10-04 string dateinput = datetextbox.text; dayofweek today = datetime.dateinput.dayofweek; use datetime.parseexact parse string datetime string dateinput = datetextbox.text; //"2016-10-04" datetime dtresult = datetime.parseexact(dateinput, "yyyy-mm-dd", cultureinfo.invariantculture); dayofweek today = dtresult.dayofweek;

shell - How to sort alphabet first and then numeric in unix -

suppose have file containing 1 column: 1 2 b 0 the expected outcome: a b 0 1 2 if use sort alone, outcome become 1->2->a->b not want. there way can sort alphabet first , numeric? thanks. sort -g <inputfile b 0 1 2 additional example: cat inputfile 1 0 2 3 sd 35 76 23 asd sort -g inputfile asd sd 0 1 2 3 23 35 76

java - PhoneGAP, Cordova : Modifying Android project to load external URL -

i trying hands on cordova , phonegap. tutorials available, able create cordova app command-line, , add android platform via below mentioned commands. imported android project in android studio. phonegap takes html, css content, modified index.html load external url, didn't work. doing wrong? how can point application load external url? there many other suggestions saw, none of them have data do. thank you. also, when changed in config.xml file index.html url, opened chrome instance instead of opening in app. commands : cordova create hello com.example.hello helloworld cordova platform add android --save cordova build mainactivity.java : public class mainactivity extends cordovaactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // enable cordova apps started in background bundle extras = getintent().getextras(); if (extras != null && extras.getboolean("cdv

selenium - Unable to create new remote session with chromedriver -

i using selenium-server-standalone-2.53.1 , chromedriver 2.22 , acceptance running perfectly. when ran today using same version started fail throwing unable create new remote session error. after upgrading selenium-server-standalone-3.0.1 , chromedriver-2.25, it's throwing same error. cant figure out why case. i'm new selenium , appreciate help. after upgrade error nov 08, 2016 4:27:54 pm org.openqa.selenium.remote.protocolhandshake createsession info: attempting bi-dialect session, assuming postel's law holds true on remote end nov 08, 2016 4:27:54 pm org.openqa.selenium.remote.protocolhandshake createsession info: falling original oss json wire protocol. nov 08, 2016 4:27:54 pm org.openqa.selenium.remote.protocolhandshake createsession info: falling straight w3c remote end connection org.openqa.selenium.sessionnotcreatedexception: unable create new remote session. desired capabilities = capabilities [{browsername=chrome, version=, platform=any}], required capab

javascript - SVG: Issue with multiple masks in different svg -

Image
i came across strange problem using svg filter , masks. let's have svg file containg these filters , masks: <filter id="om-outline"> <femorphology result="offset" in="sourcegraphic" operator="dilate" radius="3"/> <fecomposite in="offset" in2="sourcegraphic" operator="out" result="stroke" /> <feflood flood-color="#79868d" result="color-red-2" /> <fecomposite in="color-red-2" in2="stroke" operator="in" result="bevel_41" /> </filter> <mask id="outline-mask"> <rect cx="0" cy="0" width="341" height="375" fill="black"/> <!-- more elements here create silhouette of actual svg graphic --> </mask> using filter , mask, creates nice outline arround animating svg graphic everything working expected far now, when add

64bit - NSString stringWithFormat In Objective C getting EXC_BAD_ACCESS with iPad Pro & Xcode 8 -

i have used below function xcode 7.3, working fine ipad2 device getting exc_bad_access ipad pro, due 64 bit architecture far understanding please suggest solution should correction can here .... + (nsstring *)stringwithformat:(nsstring *)format array:(nsarray*)arguments { nsrange range = nsmakerange(0, [arguments count]); nsmutabledata* data = [nsmutabledata datawithlength:sizeof(id) * [arguments count]]; [arguments getobjects:(__unsafe_unretained id *)data.mutablebytes range:range]; nsstring* result = [[nsstring alloc] initwithformat:format arguments:data.mutablebytes]; return result; }

pyspark - Accessing dataframe derived using LabeledPoint -

i have created dataframe , have 2 column names derived using labeledpoint object. problem facing whenever trying access dataframe using 'label' or 'features' column names says column object not callable i have used selectexpr object followed min(label) df.selectexpr("max(label) max_value","min(label) min_value")) any suggestion of handling such dataframe appreciated the data types of dataframe follows - [('features', 'vector'), ('label', 'double')]

kendo ui angular2 - RangeSlide: how to enable it? -

i'm looking how enable range slider on kendo slider angular 2: here component page: http://www.telerik.com/kendo-angular-ui/components/inputs/slider/ so thanks. diego currently kendo ui slider angular 2 cannot used range slider.

angularjs - Whats difference between $http.post of angular vs $.post of jquery -

whats difference between $http.post of angular vs $.post of jquery. $http.post() vs $.post() is $http.post() internally uses $.ajax of jquery or makes own xmlhttprequest? i facing issue angular $http.post method not working asp.net web api they doing same task, difference in syntax. call underlying xmlhttprequest request server. $http.post doesn't call $.post , angular doesn't depend on jquery.

aframe - Changing src of <a-box> with JavaScript -

i able change src of img element addressing it's id. first define element id "lol". <img id="lol" src="" /> i click button activates function, changes src: <script> document.getelementbyid('lol').setattribute('src', `data.value[0].thumbnailurl); </script>` now while works img tag, not work a-box element: <a-box id="lol" src="flammer.png" position="-10 0.5 1" rotation="0 45 0" width="1" height="1" depth="1"></a-box> any appreciated, thanks. works me after bit of tweaking. run in chrome. <!doctype html> <html> <head> </head> <body > <p>open inspector , @ src parameter of a-box boo.png</p> <a-box id="lol" src="flammer.png" position="-10 0.5 1" rotation="0 45 0" width="1" height="1" depth="1"></

image - Scrape Url in tableview cell in swift -

i showing title, description, url , images, when displaying in uitableview cell images displaying twice. images of scrape url taking time load. can 1 guide how can fix this? i have detected scrape url using : swiftlinkpreview the image loading/downloading data web should in asynchronous mode. our ui element doesn't have impact. , displaying twice use reuse identifier. downloading can follow below thread. swift async load image

sql - how to update multiple values null using multiple case statements -

this table: site_name | date& time | poweroutput ----------+-------------------------+------------------ act0001 | 2013-07-21 01:00:00.000 | 196.852984494331 act0001 | 2013-07-21 02:00:00.000 | 0 xyz0001 | 2013-07-21 03:00:00.000 | 196.852984494331 xyq0001 | 2013-07-21 04:00:00.000 | 196.958395639561 xys0001 | 2013-07-21 05:00:00.000 | 0 xyd0001 | 2013-07-21 06:00:00.000 | 197.20098185022 xye0001 | 2013-07-21 07:00:00.000 | 0 xyg0001 | 2013-07-21 08:00:00.000 | 0 cfg0001 | 2013-07-21 09:00:00.000 | 197.412144323522 acb0001 | 2013-07-21 10:00:00.000 | 0 bdf0001 | 2013-07-21 11:00:00.000 | 0 olk0001 | 2013-07-21 12:00:00.000 | 196.886233049016 i have table , trying update values in places of "zero's". if there 1 0 able update table, if there consecutive zero's finding difficult update table. the logic : ((previous value-next value)/previous value)*100 <5 if true should i

php - Find Average Time -

i need find average time. of students exam taken time. have start time , end time. , total count. gives error on line. $start_dateav = new datetime($start_time_av); fatal error: uncaught exception 'exception' message 'datetime::__construct(): failed parse time string (19/12/2015 01:55:13 pm) @ position 0 (1): unexpected character' in e:\xampp\htdocs\mock\report.php:117 stack trace: #0 e:\xampp\htdocs\mock\report.php(117): datetime->__construct('19/12/2015 01:5...') #1 {main} thrown in e:\xampp\htdocs\mock\report.php on line 117 function average_time($total, $count, $rounding = 0) { $total = explode(":", strval($total)); if (count($total) !== 3) return false; $sum = $total[0]*60*60 + $total[1]*60 + $total[2]; $average = $sum/(float)$count; $hours = floor($average/3600); $minutes = floor(fmod($average,3600)/60); $seconds = number_format(fmod(fmod($average,3600),60),(int)$rounding); return $hou

excel - Macro for data in variable location -

so let’s see how can explain this. i’m new vba , macros, , think i’m trying complex me @ moment. i have data want in .html file. if open excel, data appears in column a, i’m interested in data regarding banana’s spots. because there nothing appears once, need find “this want” in column, , want copy next 18 rows there , paste in a4 (because have formula in other cells use data cells i’m pasting it) the problem i’m having have 2 types of bananas, , in different folders, it’s variable location. so 2 types banana , banana+ banana data in: \folder\quality\banana\v9.9\completed there folder per lot of banana (i.e. lot 123) , inside folder there results folder, , inside folder report.html the same goes banana+, data in: \folder\quality\banana+\v.2.1\completed same before, folder per lot data folder, results folder, , report.html inside. hope make sense. this got far sheet called “fruit” lotnumber in cell b1 path in cell f1 (that comes after select banana type drop down)

javascript - VB or Kofax Script format string -

when have more 1 "xxx.xxx.xx" or "xxx,xxx,xx" how can replace result in format (1000,12)? need exemple language not important. input test case: 1000 .12 1,000.12 1.000.12 1,000,12 1000,,12 1000.12 output: 1000,12 try this string[] inputs = { "1000.12", "1,000.12", "1.000.12", "1,000,12", "1000,,12", "1000.12" }; (int = 0; < inputs.count(); i++) { inputs[i] = inputs[i].replace(".", ""); inputs[i] = inputs[i].replace(",", ""); string output = inputs[i].substring(0, inputs[i].length - 2) + "," + inputs[i].substring(inputs[i].length - 1); console.writeline(output); } console.readline();

Initialize views of activity in android -

is necessary initialize views of activity in oncreate() only. can tell me best initializations of views of activity . thanks no need initialize view if not modify it. you can initialize in activity lifecycle wish(before accessing). but is said best practice initialize in oncreate(). why: if see lifecycle oncreate called when app page not shown. onstart called when app partially visible & onresume called when visible. so, want ready before seeing it. 1 reason. another findviewbyid bit more expensive. so, don't want see when app visible. onstart & onresume may call multiple time when go page. so, it's preferable initialize once , multiple time. so, choice yours now.

java - @Value Annotation and a Database PropertyPlaceHolderConfigurer -

i've got 2 propertyplaceholderconfigurer in spring xml. first 1 obtains application properties file. second 1 obtains user properties database , looks this: <myconfiguration> <bean id="databaseproperties" class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="systempropertiesmodename" value="system_properties_mode_override" /> <property name="properties"> <bean class="org.apache.commons.configuration.configurationconverter" factory-method="getproperties"> <constructor-arg> <ref bean="propertiessource" /> </constructor-arg> </bean> </property> </bean> <bean id="propertiessource" class="org.apache.

jmeter - How to create Test plan for dependent REST API's? -

i have 3 rest api's, each 1 of them dependent on each other, how create test plan them, jmeter firing urls non sequential order want in sequential order, when check on "view result tree" getting 403 error. are in same thread group? if so, ought fire sequentially in order.

mysql - Getting syntax error while inserting string of XML data in column of data type LongText -

i using sql server 5.0 , sql query browser 1.1 insert `service_settings` (`service_id`,`settings`) values (17,'<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<securitydatarepository>\r\n <securitypricesheet> \r\n <first50pages>1</first50pages>\r\n <additionalpages>0.5</additionalpages>\r\n <staasliteprice>500</staasliteprice>\r\n <serviceunitprice>600</serviceunitprice>\r\n <toolunitprice>1200</toolunitprice>\r\n </securitypricesheet>\r\n</securitydatarepository>'); i getting syntax error( error no. 1064 ) while inserting string in column of datatype longtext have gone through previous threads like this did not work me .

How can this SQL statement throw the following exception? -

how can statement: delete passage passageid not in ( select passageid preendedpassages_passages union select frompassageid severalvisit union select topassageid severalvisit union select registerpassageid stationobjects registerpassageid not null union select beginpassageid stationobjects beginpassageid not null union select endpassageid stationobjects endpassageid not null ) throw exception? the delete statement conflicted foreign key constraint "fk_statobj_begpasid". conflict occurred in database "db.mdf", table "dbo.stationobjects", column 'beginpassageid'. i have no clue, happened. beginpassageid foreign key on passageid. edit: consider not in. want delete passages don't exist in 1 of related tables. works, happened once. thank you. it means passage parent table. , stationobjects child table. trying remove passageid passage table present in stationobjects table well. first try remove passag

algorithm - Detect quadrilateral from grayscale image -

Image
i'm looking method detect quadrilateral based on grayscale images this. the actual solution i've made based on houghlines , has 2 problems: as parametric method, small changes on input image gives me 2 different rectangles. the outputs not precise borders of rectangle in input image thick. can recommend me method ? i'm looking @ this article seems slow method.

Python writing files in parallel crashes computer randomly -

i writing piece of code takes input user code , each code creates file , writes something. have write 10k files, code wrote computer randomly crashes. after 40 files written, after 2500. def createuseritemfinalarray(user): stringfile = "/home/alvin/pycharmprojects/recsys/files/tagssimilaritycb/userfinalarrayscosine/" stringfile += str(user) + ".csv" interacteditems = userinteractiondict[user] interactedjobsmatrix = itemattributematrix[interacteditems, :] open(stringfile, "w") csvfile: writer = csv.writer(csvfile, delimiter="\t", quoting=csv.quote_none) writer.writerow(['nonzerocolumns', 'nonzerovalues']) if (len(interacteditems) == 0): writer.writerow(['[]', '[]']) else: simmatrix = sp.sparse.csc_matrix( cosine_similarity(interactedjobsmatrix, comparationmatrix, dense_output=false)) simmatrix = simmatrix.to

javascript - node express: mock authorize function in app.get -

i'm practicing simple .get methods in node/express. i'm following example of book, have no session variable , have no templates; i've commented lines , i've replaced them simple .send method, , i've replaced simple hardcode variable: authorized. i'm getting error: referenceerror: res not defined the problem have no res variable, because control pass first on authorize function. function authorize(req, res, next){ authorized = true; // if(req.session.authorized) return next(); if(authorized) return next(); res.send('not-authorized'); } app.get('/secret', authorize, function(){ // res.render('secret'); res.send('secret'); }); app.get('/sub-rosa', authorize, function(){ // res.render('sub-rosa'); res.send('sub-rosa'); }); thanks comments, solution is: function authorize(req, res, next){ authorized = true; // if(req.session.authorized) return next();

Add checkboxes to a specific column using Javascript or jquery while displaying a table -

i displaying data in table this: name country place number ashwin india delhi 123 sita india ajmer 456 and on. i want add checkboxes on hover column , allow user able select multiple values column. instance, user can select delhi , ajmer or delhi . please jquery or javascript code this? try - html - <table border="1" id="demo"> <tr> <th>name</th> <th>country</th> <th>place</th> <th>number</th> <th>check</th> </tr> <tr> <td > ashwin </td> <td> india </td> <td> delhi </td> <td> 123</td> <td><input type="checkbox" id="chk1" style="display:none"></td> </tr> <tr> <td > sita </td> <td> india </td> <td> ajmer </td> <td

jvm - Can't be able to store logout time on COMPUTER'S LOGOUT using Java Shutdown Hook -

i trying store time database when user logs-off or logs-in computer when logs computer off not store current time database if press ctrl+c on console or terminate program netbeans stores logout time too. doing wrong ? please me out this. below code. thank in advance. public void logouttime() throws exception { runtime.getruntime().addshutdownhook(new thread(new runnable() { @override public void run() { simpledateformat sdf1 = new simpledateformat("hh:mm:ss"); string time = string.format(sdf1.format(calendar.gettime())); globals.globalclockbean.setlogout_time(time); try { cd.insert(globals.globalclockbean); } catch (exception ex) { logger.getlogger(clockcontroller.class.getname()).log(level.severe, null, ex); } system.out.println("closing: logged out @ yayyyyyyyyy: " + time); system.out.println(sdf1.format(c

php - Why if($tech[0] == "HTML") is not working in the following code and the echo output is not generated -

in following code, if condition not working?? when echoing code $tech[0] giving output html, when doing in mentioned way if condition not working. may know reason when giving code <?php if(1) { echo "hey"; } ?> output generated hey. code follows: <?php include('connection.php'); //$row=array(); if(isset($_get['id']) && !empty($_get['id']) && $_get['action']== 'edit'){ $fetch ="select * students id=".$_get['id']; $selectrow =mysqli_query($conn,$fetch); $row =mysqli_fetch_array($selectrow); $tech = explode(',',$row['technologies_known']) ; if($tech[0] == "html") { echo 'hey'; } } ?> after row please check if getting in arrays. echo '<pre>'; print_r($row); also after explode please check again printing array echo '<pre>'; print_r($tech);

javascript - Filter duplicate options from select using Jquery -

Image
question: got 2 option name try , restrock , when @ try option add macbook pro assigned box , after that, go restock option add same product call macbook pro , system allow user add again. that, how can check when try option aldready got macbook pro when user try add again in restock option system auto remove mac book pro try option , add new macbook pro restock option??? code write function addselectedproducts(row_lab) { $('#product_placeholder'+row_lab+' :selected').each(function() { $(this).remove(); $('#related'+row_lab+' option[value=\'' + $(this).attr('value') + '\']').remove(); $('#related'+row_lab).append('<option value="' + $(this).attr('value') + '">' + $(this).text() + '</option>'); $('#product_added input[value=\'' + $(this).attr('value') + '\']').remove();

How to move range input using Selenium (in Python)? -

i have been using python selenium quite time , have been happy until got new requirement supposed set sliders on web-page ( here ) values , let page run scripts update page results. my problem how set slider min , max knobs () using python selenium. have tried example here , code below. #! /usr/bin/python2.7 import os import time selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver import actionchains import datetime import time import mysql.connector def check2(driver, slidebar, sliderknob, percent): height = slidebar.size['height'] width = slidebar.size['width'] move = actionchains(driver); # slidebar = driver.find_element_by_xpath("//div[@id='slider']/a") if width > height: #highly horizontal slider print "off set: ", percent * width / 100 move.click_and_hold(sliderknob).move_by_offset(500, 0).release().perform() else: #highly vert

html - css issue in table, styling not showing fully -

Image
got styled css table reason row styling being cut off, css inspector showing obvious error. attached css , table example of issue see codepen using background on td instead of tr solve problem. table.striped tr:nth-child(even) td { background-color: #fff; } table.striped tr:nth-child(odd) td{ background-color: #efefef; } updated codepen

wordpress - BuddyPress - Edit Front-End User Profiles as WP Admin -

we have wordpress site buddypress community, edit areas of users' profiles on front-end have ask them login, able edit these when logged in wp admin. i've seen various posts change requests few years ago nothing detailing how can achieved.

java - Angularjs Unified view of two lists -

i'm working in app angularjs , java spring server application. i got table takes data 2 lists containing objects different correlated: object in list 1: {id, category_id, unit_cost, qty} , coming db_table1. object in list 2: {id, category_id, unit_cost, qty} , coming db_table2. the objects correlated category_id , differ in id , qty. there may cases when given category_id 1 of 2 objects exists. i want show component rows follow object_1.id, category_id, unit_cost, obj1.qty, obj1.qty*cost obj2.qty, obj2.qty*cost (one row per category_id). rows must include cases, so: when category there both obj1 , obj2 when category there obj1 or obj2 which efficient method of build list ? on client side in component controller on server side, in spring service

java - Null pointer exception populating a new array -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i trying implement vector of generic data type type taken input user such : package com.example.genericvector; import java.util.scanner; public class genericvector <generic_type>{ private int length; private generic_type [] vector; genericvector(generic_type element){ this.vector[0] = element; } public void allocate_size(int length){ } public void push_back(generic_type element){ } public void display(generic_type [] vector){ for(generic_type element : vector) system.out.print(element); system.out.println(); } public static void main(string[] args) { scanner scanner = new scanner(system.in); system.out.print("enter data type of vector : "); string vec

php - I can't search in my script -

why when use "ab cdefgh" script read "ab" , not read after space ? <?php $con = @mysqli_connect($host,$user,$pass,$db_name); if (isset($_get['c']) , isset($_get['v'])) { $license = $_get['v']; $mac = $_get['c']; $mac_query = mysqli_query($con,"select * app mac='$mac'"); $fetch_query = mysqli_fetch_array($mac_query); if ($fetch_query == 0 ) { $license_query = mysqli_query($con,"select * app license='$license'"); if (mysqli_fetch_array($license_query) > 0 && $license !=='') { $insert = mysqli_query($con,"update app set mac='$mac'"); } else { print "unexpected license"; } } else { $mac_query = mysqli_query($con,"select * app mac='$mac'"); $fetch_mac = mysqli_fetch_array($mac_query); if ($fetch_mac['active'

debugging - IntelliJ: breakpoints in Scala tests won't get hit -

Image
i'm trying debug test in scala project. intellij runs tests successfully, breakpoints in tests never hit. the breakpoints inside tested classes hit during test , assume problem scalatest . as can see on screenshot, breakpoints set in various places in tests, intellij won't recognize them, , finishes debugging. is there way make intellij hit breakpoints in scala tests? upd1: i not run tests sbt , run them scala intellij plugin, this:

node.js - Create Keystone list object without initial dialog? -

is there way create keystone list (model) item such initial dialog skipped during creation? i want create item on detail page , enforce lot of fields required not work on dialog files , textarray. i've tried setting initial: false and still not work. there's autocreate option lists skip create dialog when "new item" button clicked; catch have created, saved , loaded item in order render details view. so won't able use built in required functionality validate fields want have required; however, implement custom validation in pre-save hook skipped initial save when item new, , enforces validation rules subsequent saves. having said that, if using keystone 4 (currently in beta) complex fields file , textarray work required fields in create dialog; if have problems getting them work initial fields, please open issue on keystone's github repo!

Google Apps Script trigger quota and limitations -

i use form submit trigger form processing on spreadsheets. form submit process may take while complete(approximately 30secs). responses submitted in form trigger's processing time may exceed quota of triggers run time 6 hours google apps work/edu/gov. number of triggers per script limit 20. are there workarounds these problem. it may depend on type of quota is. provided in document - best practices , list improve performance of scripts. minimize calls other services use batch operations avoid libraries in ui-heavy scripts use cache service also, blog google apps script talks workarounds quotas increase code complexity adding delays, increasing intervals of each functions , splitting of script smaller parts. hope helps.

python - Misunderstood timezone conversion -

i'm converting datetime timezone (from europe/paris america/guadeloupe). result not expect: import pytz import datetime tzinfo = pytz.timezone('europe/paris') datetime_with_timezone = datetime.datetime( 2000, 1, 1, 0, 0, 0, tzinfo=tzinfo ) print(datetime_with_timezone) new_tzinfo = pytz.timezone('america/guadeloupe') print(datetime_with_timezone.astimezone(new_tzinfo)) produces: 2000-01-01 00:00:00+00:09 1999-12-31 19:51:00-04:00 why datetime_with_timezone contain +00:09 ? this seems known issue, according pytz documentation : unfortunately using tzinfo argument of standard datetime constructors ‘’does not work’’ pytz many timezones. the documentation provides further advice that the preferred way of dealing times work in utc, converting localtime when generating output read humans.

concatenation - how to add a prefix to the entire column in m.s office? -

i have data this: a 1 2 3 i want this a x1 x2 x3 i able using '=("x"&a1)' formula , getting in column "b". a b 1 x1 2 x2 3 x3 but if delete column a, result getting changed. how can expected result?

mysql - The logic of field type in relationship -

i have tables user preferences currency , language , ... currency structure , sample records : id | title | slug ----+------------+-------- 1 | dollar | usd 2 | ca dollar | cad 3 | euro | eur 4 | swiss franc| chf language structure , sample records : id | title | code | flag ----+-------------+-----------+---------- 1 | english | en | img/flags/en.png 2 | french | fr | img/flags/fr.png i want create relation between these tables , users tables, want know field better foreign key ? example in currency table currency.id or currency.slug ? if see sql speed should go currency.id because finding integer value lots many rows (in thousands) would faster finding varchar . but here see currency won't more 500 can use both won't affect speed. you can use both in particular example: currency.id or currency.slug

vba - Converting UTC time to Local in UserForm -

i'm new on platform , have make codes in vba school. have userform1 in textbox1 utc time in format hh:mm. in combobox2 have option choose 'plus' or 'minus'. in textbox2 have option select 1 12 using spinbutton1. i'm totally lost, sum of textboxes local time. can me? thanks in advance! g. mark

InitilizeExt() for encoder is failing for openH264 -

i implementing openh264 in solution. facing issue calls initialize() [for encoder basic parameter] , initializeext() [for encoder extension parameter]. returning 1(cminitparaerror). verified samples provided in link https://github.com/cisco/openh264/wiki/usageexampleforencoder . still failing. is there specific things need set? sample code given below; sencparamext param; encoder->getdefaultparams(&param); int rv = encoder->initializeext(&param); have tried console sample, welsenc.cpp, in codec\console\enc\src. works me.

android - How to exclude this particuar class from ProGuard obfuscation -

i want exclude class being obfuscated proguard - com.example.myapp.thisparticularclass.java how can that? i looked other answers packages, or class members or using gson annotations ps: , if thisparticularclass extends class, should keep parent class obfuscation well? use such statement: -keep class com.example.myapp.thisparticularclass or: -keep public class * extends com.example.myapp.thisparticularclass

javascript - Rally custom app creation using node.js step by step -

i new rally. want create custom application using node.js toolkit. in application want retrieve iteration details startdate , enddate , display them in html. i unable find step-by-step guide this. i able example @ https://github.com/rallytools/rally-node/wiki/user-guide , don't understand how make custom application out of it(to use within dashboard custom html). please suggest how achieve or if not right approach please suggest alternative this. thanks. the node toolkit great writing integrations live outside of agile central. if you'd display within custom html panel on dashboard or custom page in agile central you'll need write app using app sdk .

node.js - Node - Is it more memory efficient to require module inside setInterval versus outside? -

i have node file i'm using service file/daemon on linux server. something this: const m = require('./local-module') setinterval(m, duration) that module exports function, contains 'global' variables, i've noticed how variables same each time function called, makes sense me. that has me wondering whether like: setinterval(() => { require('./local-module')() }), duration) is more memory efficient? doing 1 way have benefits on other? calls require() cached , returning same instance. whether var thing = require('thing'); thing.stuff() or require('thing').stuff() it's same instance of "thing" each time. for readability , convention, putting requires @ top more common. however, since loads require modules when file loads (on app start), might not testing paths or mocking or initialization sequences. doing require() in middle of code loads module when called, can lazy it, helpful.

c++ - LLVM execution engine cannot find my function -

i using llvm's executionengine run module. module contains function called blub returns 5 . in c: int blub() { int x = 5; return x; } here c++ code executing "blub": // print out of functions, see (auto& function : m->functions()) { std::cout << function.getname().str() << std::endl; } auto engine = enginebuilder(std::move(m)).create(); engine->finalizeobject(); using myfunc = int(); auto func = (myfunc*)engine->getpointertonamedfunction("blub"); auto result = func(); std::cout << "result " << result << std::endl; it should print out names of functions (just "blub") , result, "5". however, error instead: blub llvm error: program used external function 'blub' not resolved! so function indeed in module, cannot resolved executionengine . missing step? from the documentation of getpointertonamedfunction (emphasis mine): getpointertonamedfunc

how to pass class name to javascript function parameter -

i struggling on passing class name (only number 11 , 22) function parameter. code is: document.queryselector(".show-11-22,.show-11-33,.show-33-55,"); i want pass number class (.show-**11**-**22**,.show-**11**-**33**,.show-**33**-**55**) function parameter number , size respectively function mydata(number,size){ //some code } mydata(number,size) //so mydata(11,22) mydata(11,33) mydata(33,55)

tfs - How do you share code between two VSTS build tasks? -

i need share typescript classes between 2 vsts build tasks. understand, compiled files required in task folder able function build task. current scenario: have common files in common folder in root folder of vsts code base. have 2 task , b utilize these classes. when package code ignores common folder. is possible achieve in above scenario? please advice. thanks. this can't achieved. each build task independent of each other. may have add classes both task respectively. here sample of vsts task in github reference: vsts-tasks/tasks/

PHP script with query on DB2 -

i have portion of script: //agent d4 offline events last 24h $q_d4_offline_last24h = "select distinct node, lastoccurrence, inps_close_timestamp reporter.reporter_status alertkey = 'm_sw_mid_mon_ser_sts_006c_all' , nodealias '%:d4' , lastoccurrence > date(current_date -1 days)"; $db2_reporter_conn = new ldbproxy(); if(!$db2_reporter_conn->connect_db2("192.168.8.245:50001", "reporter", "itmuser", "tivoli")) die ('e:connessione al db2 fallita:' . $db2_reporter_conn->errormsg); $connettore = $db2_reporter_conn->query($q_d4_offline_last24h) or die("e:errore nella query: " . $db2_reporter_conn->errormsg); while($row = $db2_reporter_conn->fetch($connettore)){ if(!isset($offline[$row['node']])){ $offline[$row['node']] = array(); } $offline[$row['node']]["data inizio: " . subs

javascript - Get direction between two 3d vectors using Three.js? -

i have 2 points: v1 = (0, 0, 0); v2 = (10, 4, -3); i want direction between these 2 points can raycast point v1 v2. how do that? the pattern follow create direction vector v1 v2 this: var dir = new three.vector3(); // create once reuse ... dir.subvectors( v2, v1 ).normalize(); direction vectors in three.js assumed have unit-length. in other words, must normalized. if direction vector use when raycasting not have length equal 1, not accurate results. three.js r.82

bash - creating a unix script to sort and process files -

situation: i have folder on desktop named unsorted_files contains approximately 1gb of varying file types (jpg,gif,docx,png, wav,mid,csv) etc etc. in addition this, have 3 further directories on desktop hold dedicated filetype (jpg,gif,docx). the actual directory names these dedicated directories are: jpgdirectory gifdirectory docxdirectory problem: i create bash script can run through terminal on mac os 10.10.5 separate , process these files types unsorted_files folder , place them newly created directories dependant on file type. ie. jpg files in folder unsorted_files upon execution of script sent jpgdirectory , gif files dispatched gifdirectory the 1 caveat is, file types out (jpgdirectory, gifdirectory, docxdirectory) must sent miscellaneous how achieve objective bash script perspective or perhaps can done using solely terminal commands. to automate mkdir , mv command in bash, put 'for' loop 1 below. code: #!/bin/bash unsorted_path=&quo

java - Where to pack native libs in Jar -

i'm building library uses native code ( *.dll on windows, lib*.so on linux). should pack files in jar? right when i'm running example uses native api (thorough) library, need add param -djava.library.path=<path_to_dll_or_so> . can somehow show java library path? for packing i'm using gradle build , jar

ios - Can't make User Defined Runtime Attributes work -

Image
i able use "user defined runtime attributes " xcode storyboard build nice pop through container view. unfortunately, can't make works , can't figure out why ! i found many topics (eg: is possible set uiview border properties interface builder? ) deal doesn't work me... ! here attribute inspector of containerview embed uiview (i tried implement containerview uiview no success). i added extension transform uicolor cgcolor expected : extension calayer { var borderuicolor: uicolor { set { self.bordercolor = newvalue.cgcolor } { return uicolor(cgcolor: self.bordercolor!) } } } does think missing ? thank in advance ;) instead of layer.bordercolor , use layer.borderuicolor in user defined runtime attributes. double click key name , add ui .

java - Constant label updation from different class in javafx-fxml -

i unable change text of label other class. need update date , time on main screen, while may able perform other functions too, simultaneously. have used timesetting class, extends thread , in it's run() method, i've called updation command in infinite loop, using settext() , slept method second. on running this, nothing happens , on closing output window, error saying nullpointerexcpetion here's code 2 classes : fxmldocumentcontroller.java package crt; import java.io.ioexception; import java.net.url; import java.util.date; import java.util.resourcebundle; import javafx.event.actionevent; import javafx.fxml.fxml; import javafx.fxml.fxmlloader; import javafx.fxml.initializable; import javafx.scene.parent; import javafx.scene.scene; import javafx.scene.control.label; import javafx.stage.modality; import javafx.stage.stage; import javafx.stage.stagestyle; public class fxmldocumentcontroller extends thread implements initializable { @fxml protected label check;

Iterate over two dictionaries in one loop in python -

i have 2 dictionaries. 1 has chapter_id , book_id: {99: 7358, 852: 7358, 456: 7358} . here 1 book example, there many. , 1 same chapter_id , information: {99: [john smith, 20, 5], 852: [clair white, 15, 10], 456: [daniel dylan, 25, 10]} . chapter ids unique through books. , have combine in way every book gets information chapters contains. {7358:[[99,852,456],[john smith, claire white, daniel dylan],[20,15,25],[5,10,10]]} . have file dictionary, each book has ids of chapters has. know how looping on both dictionaries (they used lists). takes ages. why dictionaries , think can manage 1 loop on chapters. in head come looping on books , on chapters. ideas appreciated! final result write in file, not important if nested dictionary or else. or @ least think so. if open using other packages might want have on pandas , allow many things , fast. here example based on data provided... import pandas pd d1 = {99: 7358, 852: 7358, 456: 7358} df1 = pd.dataframe.from_dict(d1, "in

Error exit status 127 on installation of KDE desktop on ubuntu 14.04 LTS -

i tried install kde desktop on ubuntu 14.04 lts. @ end of installation, got error: processing triggers install-info (5.2.0.dfsg.1-2) ... /etc/environment: line 3: $: command not found dpkg: error processing package install-info (--unpack): subprocess installed post-installation script returned error exit status 127 processing triggers fontconfig (2.11.0-0ubuntu4.2) ... errors encountered while processing: install-info e: sub-process /usr/bin/dpkg returned error code (1) in other window message appear: processing triggers fontconfig (2.11.0-0ubuntu4.2) ... errors encountered while processing: install-info e: sub-process /usr/bin/dpkg returned error code (1) my linux version is: cat /proc/version linux version 3.16.0-77-generic (buildd@lgw01-09) (gcc version 4.8.4 (ubuntu 4.8.4-2ubuntu1~14.04.3) ) #99~14.04.1-ubuntu smp tue jun 28 19:17:10 utc 2016 here data machine: ar-it07201 description: space-saving computer product: optiplex 9020 (optiplex 9020

javascript - Hide dropdown div with jQuery on mouseout -

Image
i know there hundreds of topics regarding this, none of them seemed work me. want dropdown hide when mouse leaves element jquery, get: codepen example . jquery: $(document).ready(function() { $('.expand').click(function(e) { e.preventdefault(); $('section').slideup('normal'); if ($(this).next().is(':hidden') === true) { $(this).addclass('on'); $(this).next().slidedown('normal'); } }); $('section').hide(); }); $('section').mouseleave(function(){ $(this).hide(); }); i've tried following: $('section').hide(); $('.section').on('mouseout',function(){ $(this).hide(); }) yet, nothing seems work correctly , gives me same result. how can fix this? working example . you should use settimeout()/cleartimeout() functions solve problem you've attach mouseleave event button class dropbtn , both mouseleave/mouseleave events (usi

javascript - Why am I getting "TypeError: Cannot read property 'value' of null" when using getElementById? -

in following code: function transact() { if(document.getelementbyid('itctobuy').value!='') { itctobuy = parseint(document.getelementbyid('itctobuy').value); } if(document.getelementbyid('steamtobuy').value!='') { steamtobuy = parseint(document.getelementbyid('steamtobuy').value); } if(document.getelementbyid('reltobuy').value!='') { reltobuy = parseint(document.getelementbyid('reltobuy').value); } if(document.getelementbyid('airtobuy').value!='') { airtobuy = parseint(document.getelementbyid('airtobuy').value); } if(document.getelementbyid('bsnltobuy').value!='') { bsnltobuy = parseint(document.getelementbyid('bsnltobuy').value); } updatevalues(); } the function's executed simple onclick of button. there 5 textarea elements , user may input number in any, , upon clicking b