Posts

php - OAuth2 token, message: '{ "error" : "access_denied" }' returned when I try to update Google Calendar using OAuth (Service Account) -

i using google standard library php using calendar service , have set service account type oauth 2.0 authentication through google api console. my main objective update user's google calendar (eg: user@organisationname.com) (when user not online) through batch. eg. updating event in users calendar. when user logs in application (using oauth2.0) he/she provide permission application "manage calendars","view calendars" , "perform these operations when i'm not using application" following code used login using oauth2.0 <?php require_once '../../src/google_client.php'; require_once '../../src/contrib/google_calendarservice.php'; session_start(); $client = new google_client(); $client->setapplicationname("google calendar php starter application"); $client->setclientid('xxxxx-flue2a9o5ll602ovrhaejlpm9otgjh1r.apps.googleusercontent.com'); $client->setclientsecret('xxxxxxxxxx'); $client...

Use of 1=2 in a SQL query -

someone please explain meaning of '1=2' in below sql query. select e.empid, e.empname, country = case when t.active = 'n' , 1 = 2 'not working anymore' else c.country_name end, t.contract_no employees e (nolock) inner join contract t on t.contract_no = e.contract_no left join country c (nolock) on e.country_id = c.country_id thanks edit:- corrected slight mistake existed in example sql query given me. @ :- query mentioned here example version of big working query on have reoslve something. have created sample scenario of sql query sake of simplicity of question. when t.active = 'n' , 1=2 'not working anymore' simple, above condition never become true . result c.country_name

oracle apex - Validation to detect text in numeric field -

i'm trying prevent users crashing create new product apex page. on create page have text field:product_name , numeric field: product_quantity. currently when enter text in product_quantity field , click 'save' following error: error processing validation. ora-01722: invalid number i have investigated error thought in apex, if selected numeric field, detect whether user entered text or numeric characters? is there method display validation message if user has entered text, shouts, otherwise enables user save new entry? update i know why happening dont know how solve it. i recreated page , worked. added 2 pieces of validation in page processing , when try error in intial post. if disable them works again. validation use not exists find whether entered value exists in table before add it. if validation kicks in after looking whether numerical value has been entered. stopped validation looking @ associated item, , turned off 'when button pressed' s...

javascript - What is a clean way to send a body with DELETE request? -

i need send request body delete requests using $resource the way see change: https://github.com/angular/angular.js/blob/master/src/ngresource/resource.js from var hasbody = action.method == 'post' || action.method == 'put' || action.method == 'patch'; to var hasbody = action.method == 'post' || action.method == 'put' || action.method == 'patch' || action.method == 'delete'; is there better way override this? when alter content type header can do: $httpprovider.defaults.headers["delete"] = {'content-type': 'application/json;charset=utf-8'}; or similar... ive googled maybe ive missed obvious (not first time). in advance. this works. $scope.delete = function(object) { $http({ url: 'domain/resource', method: 'delete', data: { id: object.id }, headers: { "content-type": "applicat...

Git Local Changes History Location On Hard Drive -

i new git. using git extension , want ask if make changes , commit locally not push yet. local history stored??? have directory cloned repository server. location local commit history stored or stored anywhere in c drive? git stores internal data in hidden folder .git . in root of project checkout.

Assigning Python function to ctypes pointer variable -

i have following c source compile dll: int (*pfuncextb)(int a, int b); int funcb(int a, int b) { return funcextb(a, b); } int funcextb(int a, int b) { return pfuncextb(a, b); } what want make pfuncextb "point" python function, in python: from ctypes import * def add(a, b): return + b mutdll = cdll.loadlibrary("my.dll") pfuncextb = (pointer(cfunctype(c_int, c_int, c_int))).in_dll(mutdll, 'pfuncextb') funcb = mutdll.funcb funcb.argtypes = [c_int, c_int] funcb.restype = c_int pfuncextb.contents = cfunctype(c_int, c_int, c_int)(add) print funcb(3 , 4) after expect following call return 7 print funcb(3, 4) but get: traceback (most recent call last): .................. print funcb(3, 4) windowserror: exception: access violation reading 0x00000001 so doing wrong here? possible have python function "assigned" ctypes pointer-to-function variable? edit: after seeing mark tolonen's workaround (a set function point...

database - python sqlalchemy not filling in the row -

hello new sqlalchemy , have problems inserting data in column. import sqlalchemy sqlalchemy import create_engine sqlalchemy.ext.declarative import declarative_base sqlalchemy import column, integer, string, foreignkey, boolean sqlalchemy.orm import relationship, backref sqlalchemy.orm import sessionmaker engine = create_engine('sqlite:///test.db') base = declarative_base() class users(base): __tablename__ = 'users' id = column(integer, primary_key=true) name = column(string, unique=true) password = column(string) email = column(string) def __init__(self, name, password, email): self._name = name self._password = password self._email = email base.metadata.create_all(engine) session = sessionmaker(bind=engine) session.configure(bind=engine) session = session() dm_user = users("dungeonmaster", "123", ...