Posts

Showing posts from June, 2010

SQL ordered filtering from multiple columns -

i have table below, being used both mysql , sqlite, sorted columns a, b, c in ascending order: # | | b | c -------------------------- 0 | 40 | 55 | blue 1 | 60 | 65 | red 2 | 60 | 65 | rose 3 | 60 | 65 | yellow 4 | 80 | 21 | green 5 | 85 | 12 | blue i want figure out "next" row after given row. example, if i'm looking @ row #2: a=60, b=65, c="rose" i want able figure out row #3 next 1 (i don't have # ids use in case). my naive approach this: select * table (a >= 60 , b >= 65 , c > "rose") or (a >= 60 , b > 65) or (a > 60) order a, b, c asc limit 1 is there better way this? thanks exclusive branches only slight change... think >= can = : select * table (a = 60 , b = 65 , c > "rose") or (a = 60 , b > 65) or (a > 60) order a, b, c asc limit 1 ids don't help you can add ...

Adding a product programatically to wordpress woocommerce website -

i'm quite new in wordpress , woocommerce plugin , create app add products programatically website using plugin. thought writing directly database in wp_posts , wp_postmeta tables. however, i've read php woocommerce functions, know nothing , write php code. is solution provided clean enough? otherwise how use php functions provided woocommerce? thanks lot!

paypal - Can a HTTP server receive HTTPS request (node.js)? -

i reading paypal documentation how implement ipn server receive payment notification (from paypal post requests), noticed requests in encrypted https, , implement server non-secured http. there issue if this? can use library use https on non-secured server? you cannot receive https request http server. won't connect. starters, won't on right port default , if try force correct port, https request won't connect http server. instead, can use https server in node.js app explained here in nodejs https module . can http server receive https request (node.js)? no, cannot. is there issue if this? yes, not connect. can use library use https on non-secured server? no, cannot. https connections not connect http server. all payment related stuff should done on secured https connection if change client use http instead of https, should not and, i'd guess paypal prevents either client library or license because last thing want people imp...

Making HTML Inactive -

i trying use javascript , replace function in javascript replace spaces in variable " <br /> ". clarify, not want break, want literally " <br /> ". how make " <br /> " invalid html? i'm sorry if newbie question, can't find answer anywhere. use code: &lt;br /&gt; this uses html "entities" < , > ("less than" , "greater than")

c# - XmlSerializer Complex Attributes -

i have xmlserializer , class layer member called scale of type vector2 in it. want vector2 serialized point in xaml, attribute. want produce this: <layer scale="1.0,1.5" /> instead of this: <layer> <scale> <x>1.0</x> <y>1.5</y> </scale> </layer> is possible?

c - Get Ip address of a local device from its Mac address -

i have local device connected router , can access mac address through existing code. how can find ip address of device using mac address in c? "arp" might providing details, need ip address independent protocol. if requirements allow make use of arp indirectly (that is, relying on standard networking behavior rather coding arp queries yourself)... your best answer find mac address in local arp cache, exposed in /proc/net/arp . of course, there's going data there device if host has seen traffic on network. this answer has suggestions dealing situation: basically, run sort of network scan generate traffic every ip address on network, , mine local arp table answer.

ios - Weird squishing when updating UIImageView frame after rotating with CGAffineTransform -

Image
i have 2 buttons , 1 uiimageview in main view. 1 button tries rotate uiimageview 30 degrees, , other updates frame of uiimageview itself. i wouldn't expect setting frame affect visually, instead seems "squish" image if it's in rotation other default orientation. stumbled upon this, wanted update uiimageview's frame in order change x , y coordinates after rotating. as result, rotate button seems work fine long never push update frame button. if push second button while view ever rotated, however, squishes image state don't understand, or know how undo. video of second button "squishing" image: https://streamable.com/ba7zd video of second button "squishing" while rotation isn't default orientation: https://streamable.com/vo3cd what's reason happening? this question , this question both seem capture similar scenario, i'm unsure how apply either solution. in viewcontroller: @iboutlet weak var dog: uiimageview! ...

ansible - Symlink pointing to folder outside of Vagrant root on host machine -

i'm using virtualbox , vagrant, , inside project files have symlinks files outside of project, e.g. oh host machine (osx), have following folder structure: /documents/vhosts/mysite/this-is-a-symlink mysite folder in sync'd in vm /var/www/html this-is-a-symlink points folder in dropbox, e.g. /dropbox/some-folder. problem vm isn't seeing files symlink pointed to. vagrant file: vagrantfile_api_version = "2" # require yaml module require 'yaml' configuration = yaml::load(file.read("#{file.dirname(__file__)}/config.yml")) vagrant.configure(vagrantfile_api_version) |config| config.vm.box = configuration["box_name"] config.vm.hostname = "ansible" config.vm.network :private_network, ip: configuration["ip_address"] config.vm.synced_folder "mysite", "/var/www/html", id: configuration["project_name"], create: true, :owner => 'ubuntu', :gr...

android - Indoor map and wayfinding - Mazemap -

i planning use mazemap api create android app indoor map , wayfinding university. university 140,000 square meters , i'm afraid cant afford pay if use mazemap. what pros , cons of using mazemap kind of project? there free alternatives mazemap? note: philippines, google indoor maps not supported. note mazemap mapping platform rather indoor positioning. i.e. not used indoor navigation mobile phone (they have partners additional charge) part of mapping area set of routes , points of interest purpose of providing web/mobile api present maps , show routes between 2 points etc. alternative can micello (also not free), , point im not aware of free tools efficiently. can try use osm indoor module that. never did since seemed lot of work seems (google indoorosm). disclaimer: im founder of shimeba - apps venues pedestrian navigation including indoor/outdoor mapping needed.

xml - Android: SeekBar - downward compatibility of colorAccent -

when try change color of seekbar via ...tint, tells me available api 21 up. my question is: devices under api 21 show seekbar in color defined under "coloraccent" or there single standart color used in cases? if yes, if change color applying alternative style has desired color "coloraccent", work on devices under api 21? will devices under api 21 show seekbar in color defined under "coloraccent" or there single standart color used in cases? yes , if activity extends appcompatactivity , if theme have parent appcompat theme , handle version support. if yes, if change color applying alternative style has desired color "coloraccent", work on devices under api 21 this way do, create custom style seekbar , apply it. can test emulator in android studio. hope helps.

soap - Unable to create java classes from WSDL using codehaus.mojo jaxb2-maven-plugin -

i unable create java classes using jaxb2-maven-plugin wsdl. see empty jaxb2 folder crated under target , dont see java classes in it. have wsdl placed correctly under resources folder itself. able create java classes other wsdl except below one. can please tell me whats problem below wsdl: below wsdl: <?xml version="1.0" encoding="utf-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetnamespace="http://xyz.retail.abc/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:tns="http://xyz.retail.abc/"> <types></types> <message name="createcustomer_input"> <part name="firstname" type="xsd:string"></part> <part name="homephone" type="xsd:string"></p...

selenium - ITest with different browser version via webdriver -

i'm starting write test scenario selenium web driver , test via different firefox , ie versions. so, downloaded geckodriver , selenium webdriver itself. question is, version of selenium webdriver, firefoxdriver (gecko driver) , ie driver in order test scenario in different browser versions? example firefox since version 35 , ie since version 7. is there references see firefox version works gecko driver , webdriver versions? this helps https://www.browserstack.com/automate/capabilities better way check change log in http://www.seleniumhq.org/download/ exp: gecko https://github.com/mozilla/geckodriver/blob/release/changes.md , webdriver https://raw.githubusercontent.com/seleniumhq/selenium/master/java/changelog

javascript - How to scroll down when hover an image? -

i want when hovering image, scroll down end of image. i have 2 question: how scroll end of image when user hover on it? currently, start hover on image, wasn't scrolled end of image. how control speed of scroll when hovering on image? my code: body { margin: 2px auto; width: 500px; } .pic { width: 48%; height: 200px; overflow: hidden; margin: 0 auto; display: inline-block; position: relative; cursor: pointer; } .pic:before { width: 100%; height: 200px; background: rgba(0, 0, 0, 0.5); position: absolute; top: 0; } .pic:after { color: #fff; font-size: 18px; position: absolute; top: 50%; left: 50%; margin: -20px -25px; border: 1px solid rgba(255, 255, 255, 0.5); padding: 10px; } img { max-width: 100%; cusor: pointer; } .pic:hover img { animation: moveslideshow 3s linear; } @keyframes moveslideshow { 100% { transform: translatey(-60%); } } .pic:hover .pic...

osx - Compiling c++ with VSCode on Sierra -

Image
i'm trying basic c++ coding on macbook pro vscode. on windows machine had install g++ , add path, easy. i'm on sierra now, went through terminal install g++ (literally typing g++ , installed me because didn't want all of x-code). when try , compile stuff, green squiggly line under #include statements , won't compile. is there anyway compile on windows? (edit: http://www.edparrish.net/common/macgpp.php#compiling -tutorial used install g++)

c++ - Unable to insert smart pointer into map -

i trying insert smart pointer, p_pointer pointing towards foo class map, program not compile. therefore tried use normal pointer foo* , program compile. far, have been able use p_pointer normal pointer without issue surprised not work. if can explain me why not work... *additionally, have posted here , people have complained code being messy before. time made use of code blocks function "format use astyle". please let me know if still not enough. #include <iostream> #include<map> #include<string> using namespace std; template <class t> class p_pointer { public: t* cp; size_t* refptr; size_t* counter() { return refptr; } //default constructor p_pointer():cp(0),refptr(new size_t(1)) {} p_pointer(t*t):cp(t),refptr(new size_t(1)) {} //copy constructor p_pointer (const p_pointer&s):cp(s.cp),refptr(s.refptr) { ...

javascript - Create a custom http service that will request external JSON file. pure angularjs only -

i have http service call external json files , load grid. my problem need create custom http service use same in different controllers. function of custom service should same (requesting external json file) $http.get('../json/permanentemployees.json'). success(function(data, status, headers, config) { $scope.masterarray = data; }). error(function(data, status, headers, config) { $scope.errormessage = "requested grid data file not exist"; }); this current http service. appreciated.please use angularjs only wrap code in factory , use it. think better use factory in situation, refer here . p.s. unable create mockup of request json, please check json. jsfiddle: here app.factory('customhttpservice', function($http){ return { getrequest: function(url) { return $http.get(url). success(function(data, status, headers, config) { return {data: data, errormessage: "success"}; }). error(fu...

Showing 400 bad request when try to post file via rest API with Ruby -

i'm try post file using restclient ruby on rails, have try conver below curl command: curl -h 'authorization: bearer access_token' -f 'file=@file_path' https://api.com/api when converting restclient below: res = restclient::request.new( method: :post, url: 'https://api.com/api', :payload => { :file => file.new("#{rails.root}/public/sample.docx" , 'rb') }, :headers => { :authorization => "bearer 155c5e5c4feea51b386fdfe204abc60b7f4025fb91988519de869525217b4702", :content_type => "multipart/form-data" } ) res.execute on code showing 400 bad request what i'm doing wrong code? thanks your post duplicate of 1 ruby - uploading file using restclient post in case, try changing content_type application/vnd.openxmlformats-officedocument.wordprocessingml.document list of mime types can foun...

jquery - Ajax POST Request in Larvael -

i'm sending value named text <script> tag in .blade.php file controller using post ajax request. if not write $.post function gives me output of text value in console. when write ajax request send data controller value not pass. in short, want pass value view controller , unable that. have tried youtube tutorials , previous stack overflow questions. visited laracasts problem not solved. doing wrong? please help. thank you. shopreq.blade.php: {{csrf_field()}} <script> $(document).ready(function(){ $('.ouritem').click(function(event){ var text=$(this).text(); $('#additem').val(text); console.log(text); $.post('shopreq',{'text':text,'_token':$('input[name=_token]').val()}),function(data){ console.log(data); }); }); }); </script> web.php: route::post('shopreq','usercont...

java - Not throwing Null Pointer Exception for Object Type Even default value is NULL -

package sample; public class sample4array { public static void main(string[] args) { int a[] = new int[10]; system.out.println(a[1]); for(int i=0;i<a.length;i++) { system.out.println(a[i]); //default value 0 } integer x[] = new integer[10]; for(int i=0;i<x.length;i++) { system.out.println(x[i]); //default value null & not throwing exception. } } } to consider; first loop returns 0 default value & second loop default value null it's not throwing exception when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int: int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named n...

sql server - Trigger will not fire at all after bulkcopy -

i want update inserted records after using bulkcopy insert them database. want have written trigger update me after insert. trigger works fine if insert records 1 after other refuses work after bulkcopy insert. i have added fire trigger ( sqlbulkcopyoptions.firetriggers & sqlbulkcopyoptions.checkconstraints ) connection still not work. this trigger wrote: create trigger [dbo].[trigger_assessment] on [dbo].[assessment] after insert begin set nocount on declare @a int declare @b int select @b = exam_score, @a = ca inserted update assessment set final_ca = ca*0.3, final_exam = exam_score * 0.7, f_score = ((ca * 0.3) + (exam_score * 0.7)) exam_score = @b , ca = @a end and bulk copy: dim koneksi_excel new system.data.oledb.oledbconnection("provider=microsoft.ace.oledb.12.0; data source='" & path1.text & " '; extended properties=""excel 12.0 xml;hdr=yes""") ...

node.js - Cant get the value of parameters -

why can't value of parameters in json file bot creates automatically within api.ai. there wrong within code? please need help. a new error is response not defined @ exports.hellohttp.functions.https.onrequest (/user_code/index.js:28:19) i need value within parameter: { "id": "74eba596-e0e4-4738-9a07-9ac2d4844a47", "timestamp": "2017-08-20t07:37:09.699z", "lang": "en", "result": { "source": "agent", "resolvedquery": "1", "action": "update_user_info", "actionincomplete": false, "parameters": { "cur-job": "job", "number-job": "1", "yr-exp": "12" } the cloud functions firebase sdk create cloud functions , setup triggers: const functions = require('firebase-functions'); const admin = require('firebase-...

Cannot authenticate with MediaWiki 1.28 API -

Image
i'm having problems authenticating mediawiki api in mediawiki 1.28. the api: https://www.mediawiki.org/wiki/api:main_page my exact attempt: https://github.com/tomasbjerre/git-changelog-lib/tree/feature/medawiki how i'm doing it: authenticating http://localhost:8889/w posting to: http://localhost:8889/w/api.php?action=query&meta=tokens&format=json&type=login got cookie: mediawiki_session=pnbmq5t2cq8gsnv4cm74lb6f3aa5vbeb; path=/; httponly response: {"batchcomplete":"","query":{"tokens":{"logintoken":"bc18a93aedd4993634ddb8e28e6cd60259993ca3+\\"}}} using logintoken: bc18a93aedd4993634ddb8e28e6cd60259993ca3+\ posting to: http://localhost:8889/w/api.php?action=login&format=json using cookie: mediawiki_session=pnbmq5t2cq8gsnv4cm74lb6f3aa5vbeb; path=/; httponly post content: lgname=user%40botuser&lgpassword=*&lgtoken=bc18a93aedd4993634ddb8e28e6cd60259993ca3%2b%5c response: {"login...

zend framework - ZF3: SharedEventManager injection in EventManager for ZfcUser -

i'm trying modify form of zfcuser , found explanation: https://github.com/zf-commons/zfcuser/wiki/how-to-modify-the-form-objects-used-by-zfcuser however it's not working expected. after debugging last night found 1 side leads me attach method of sharedeventmanager: https://github.com/zendframework/zend-eventmanager/blob/master/src/sharedeventmanager.php#l61 and other side execute trigger out of zfcuser login form, lead me eventmanager: https://github.com/zendframework/zend-eventmanager/blob/master/src/eventmanager.php#l75 i modified code debugging this: error_log('check sharedeventmanager'); if ($sharedeventmanager) { error_log('sharedeventmanager there'); $this->sharedmanager = $sharedeventmanager; $this->setidentifiers($identifiers); } i added debugging before , after trigger out of zfcuser\form\login: https://github.com/zf-commons/zfcuser/blob/3.x/src/zfcuser/form/login.php#l70 error_log('before zend login form tri...

image - Java installation in Kali -

Image
hello issue install java in kali linux machine when used java in terminal show command not found. and 1 more issue of command use have same issue command not found

reactjs - Flow type errors due to missing data prop after applying apollo's graphql() HOC -

after reading post how easy add flow types graphql infused object figured i'll give try. since post in june flow has had major upgrade 0.53 , can't basic example work class component. i'm not sure if it's upgrade or in original definition react-apollo isn't working out. question : how class version of component work? here's example code: // @flow import * react 'react'; import gql 'graphql-tag'; import { graphql } 'react-apollo'; import type { operationcomponent, queryopts } 'react-apollo'; const hero_query = gql` query getcharacter($episode: episode!) { hero(episode: $episode) { name id friends { name id appearsin } } } `; type hero = { name: string, id: string, appearsin: string[], friends: hero[] }; type response = { hero: hero }; type props = { data: queryopts & response, } const withcharacter: operationcomponent<response, props>...

c++ - How to find the position of a digit and use them -

#include <iostream> #include <math.h> #include <string> #include <sstream> using namespace std; int main() { string input; int value, cout << "input number: " << endl; cin >> input; const int count = input.length(); istringstream buffer(input); buffer >> value; if (count == 4) { my program suppose count length of number, if it's 4 encode digits. eg. 1234 turns other digits. question how take each individual digit , use them. eg. take (1+1)/10, or (3+2)/10. you can character in string using bracket notation, e.g input[0] first character in string.

ruby on rails - Heroku: download and restore database -

my heroku rails app has following database settings production default: &default adapter: sqlite3 pool: 5 timeout: 5000 production: <<: *default database: db/production.sqlite3 as can see there no password in database. downloaded database commands heroku pg:backups:capture heroku pg:backups:download now want restore database, command should run restore database? this worked me pg_restore -d myapp_development -u rails_dev -c latest.dump here, local development database myapp_development , local database username rails_dev , latest.dump backup database file downloaded server. command above ask password should password associated user rails_dev.

amazon s3 - Adapting to the disappearance of the IMDb datasets -

so freely available imdb datasets disappear @ end of 2017. from understand, must: identify (register personal account access) pay money (once free quota used up, though actual price may minuscule) write code (though looks you're downloading .gz files, simple) some questions arise this: what data format like? there's brief example on page, have actual file showing how titles, years, votes, etc. formatted , linked? what options if don't want go along regime? there freely available copies of datasets somewhere? other freely available film databases exist @ least cover movies , tv series minimum of interest released since 2017 onward. talking paywall the new files amount 360 megabytes of data, understand of s3 pricing, inside free cap unless you'll download many times month. what data format like? they seem dumps of database tables. as example, here beginning of title.basics.tsv.gz: tconst titletype primarytitle originaltitle...

e commerce - Data Validation Implementation -

when doing data validation such email or user registration, choice in implementation? client-side, server-side or other choice? it's convenience users client side validation, have server side validation because client side validation can turned off or dodged.

How to logout via url at wordpress? -

i have logout user @ wordpress top bar disabled , no logout option available @ page. is there general link logout wordpress? /wp-login.php?action=logout is used in past. references: https://codex.wordpress.org/function_reference/wp_logout_url https://developer.wordpress.org/reference/functions/wp_logout_url/

ios - processing push data when app closed, app open and app in background -

i have following fund in app delegate: func application(_ application: uiapplication, didreceiveremotenotification data: [anyhashable : any]) { // print notification payload data print("push notification received: \(data)") let dictpayload = data nsdictionary if let data = dictpayload.value(forkey: "aps") as? nsdictionary { let link = data.value(forkey: "link") as? string print("link: \(link!)") userdefaults.standard.set(link, forkey: "link_from_push") userdefaults.standard.synchronize() } basically, push notification contains data link in app. when user opens app, need log user on automatically, bunch of stuff , open link. my code works fine when app open. receive push, extract link no problem. on other hand when app closed or in background, didreceiveremotenotification not being called, , guessing isn't being called because userdefaults.standard forkey: "link...

firebase - Can't choose "Cloud Test Lab Device Matrix" in Deployment Target Options in Android studio 2.3.3 -

i following tutorial on how test android app in cloud using firebase test lab android studio when click ----run=>edit configuration=>plus(+)=>android instrumented tests=>deployment target options dropdown. can't find "cloud test lab device matrix" in dropdown. can't find related topic problem. idea how solve this?

CouchDB Proxy Authentication security - user roles confusion -

on user auth success auth server generates token , passes client. the docs client has add following headers: x-auth-couchdb-username: username; x-auth-couchdb-roles :comma-separated (,) list of user roles; x-auth-couchdb-token: authentication token. does mean client defines own roles on every request? why can't add 'admin' list of roles then? a client uses or requests resources server. "the client" in case proxy/auth server, not web browser. (the documentation stand clarified bit.) so yes, proxy/auth server, client couchdb, should set header appropriate. by extension, should not pass through x-auth-couch headers received its client (presumably web browser).

Passport strategy for user authentication in hyperledger composer angular2 app -

i first-timer in implementing user authentication on web application. below details app: its hyperledger composer angular2 application generated using yo hyperledger-composer command existing set of username , password available user identities issued in composer. should use passport-saml strategy suggested in https://github.com/bergie/passport-saml ? or there better option considering yo generates angular2 app (many angular 1.x examples available other strategies passport-local , passport-http)? what details need existing database if passport-saml best option? i checked using passport-http on hyperledger composer rest api , doesn't seem answer (here user wants use userid , usersecret). see here -> https://hyperledger.github.io/composer//integrating/enabling-rest-authentication.html you can use composer_providers environment variable - specify - passport strategies rest server should use authenticate clients of rest api. choose, strategy best suited...

java - Upgrading Spring and Hibernate libraries -

we upgrading libraries in our application. these old maven dependencies <maven-war-plugin.version>2.3</maven-war-plugin.version> <maven-release-plugin.version>2.1</maven-release-plugin.version> <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version> <maven-soapui-plugin.version>4.0.0</maven-soapui-plugin.version> <maven-failsafe-plugin.version>2.9</maven-failsafe-plugin.version> <maven-jetty-plugin.version>6.1.25</maven-jetty-plugin.version> <build-helper-maven-plugin.version>1.7</build-helper-maven-plugin.version> <!-- ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo --> <!-- dependency versions --> <!-- ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo --> <cxf.version>2.7.12</cxf.version> <spring.version>3.0.6.release</spring.version> <slf4j.version>1.6.1</slf4j.version> <hiberna...