Posts

python - Pyorient query To Json -

i'm using orientdb python 3.5 , create api records. problem got records need serialize these records. here code. from flask import flask, request flask_restful import reqparse, abort, api, resource import pyorient app = flask(__name__) api = api(app) client = pyorient.orientdb("localhost", 2424) client.set_session_token( true ) # set true enable token based client.db_open( "intera", "admin", "admin" ) ### store token somewhere sessiontoken = client.get_session_token() ### destroy old client, equals user/socket/ip ecc. del client ### create new client client = pyorient.orientdb("localhost", 2424) ### set previous obtained token re-attach old session client.set_session_token( sessiontoken ) ### dbopen not needed perform database operations ### set flag again true if want renew token client.set_session_token( true ) # set true client.db_open( "intera", "admin", "admin" ) new_sessiontoken ...

sonata admin - Symfony 2.8: How to prevent editing user's service fields -

i'm newby in symfony, excuse ignorance. in project use sonata user bundle, user entity extended several fields. of them can edited user himself, while others serviceable , can edited admin. question is: how ensure security when editing information user? see 2 ways: 1. use custom validation constraints check user's role. 2. use one-to-one related entity own admin. perhaps there standard ways accomplish task? thanks in advance! upd: problem there 1 entity (user) can edited different places: admin area , public area. naturally, forms admin , public areas different, there possibility attacker can forge form , edit fields accessible administrator. therefore, want protect them @ level of entity. possible? there many cases of security. can use @security has_role('role_admin') annotation action or in twig is_granted display or not field or use custom voter check if user can edit or delete un objet @ this. describe need you.

signals - Can I send a ctrl-C (SIGINT) to an application on Windows? -

i have (in past) written cross-platform (windows/unix) applications which, when started command line, handled user-typed ctrl - c combination in same way (i.e. terminate application cleanly). is possible on windows send ctrl - c /sigint/equivalent process (unrelated) process request terminate cleanly (giving opportunity tidy resources etc.)? the closest i've come solution sendsignal 3rd party app. author lists source code , executable. i've verified works under 64-bit windows (running 32-bit program, killing 32-bit program), i've not figured out how embed code windows program (either 32-bit or 64-bit). how works: after digging around in debugger discovered entry point behavior associated signal ctrl-break kernel32!ctrlroutine. function had same prototype threadproc, can used createremotethread directly, without having inject code. however, that's not exported symbol! it's @ different addresses (and has different names) on different versions...

android - Path to sdk not working when trying to run calabash backdoors -

i trying run calabash-android console run backdoors on project i'm working on every time try run error: $ calabash-android console app//build/outputs/apk/app-debug.apk starting calabash-android console... loading /var/lib/gems/2.3.0/gems/calabash-android-0.9.0/irbrc running irb... warn: did not find 'adb' in standard directory of '/media/jack/os/users/jackb/appdata/local/android/sdk'. calabash therefore take longer load warn: did not find 'aapt' in standard directory of '/media/jack/os/users/jackb/appdata/local/android/sdk'. calabash therefore take longer load warn: did not find 'zipalign' in standard directory of '/media/jack/os/users/jackb/appdata/local/android/sdk'. calabash therefore take longer load error: not locate android dependency error: can read how calabash searching android sdk , how can here: error: https://github.com/calabash/calabash-android/blob/master/documentation/installation.md#prerequisites however ha...

java - Issue when compiling android application -

good evening. taking course in android , having issues compiling app. i following this tutorial. have earlier set requestqueue requests. this mainactivity.java file: package com.ticketapp.emailaddresss.ticketapp; import android.content.intent; import android.net.uri; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.textview; import com.android.volley.request; import com.android.volley.requestqueue; import com.android.volley.response; import com.android.volley.volleyerror; import com.android.volley.toolbox.stringrequest; import com.facebook.accesstoken; import com.facebook.graphrequest; import com.facebook.graphresponse; import com.facebook.httpmethod; import com.facebook.login.loginmanager; import com.facebook.share.model.sharehashtag; import com.facebook.share.model.sharelinkcontent; import com.facebook.share.widget.sharedialog; import java.ut...

sql - Group by clause - output is not as expected -

below sql query list of dates table. select t2.counter_date mydates table1 t1; output: mydates 2014-03-14 00:00:00 2014-05-11 00:00:00 2014-11-03 00:00:00 2014-12-23 00:00:00 2015-01-12 00:00:00 2015-08-08 00:00:00 2016-03-14 00:00:00 2017-03-14 00:00:00 2017-03-19 00:00:00 below solution: select min(t1.counter_date) olddate,max(t1.counter_date) latestdate table1 t1; in following demo can see query giving correct results. problem must in data. edit: after edit clear problem is. once perform following query: select min(date), max(date) tab group date than min(date) has equal max(date) since there 1 date in group.

Django How to catch ModelForm unique together errors -

i have modelform has unique_together constraint on fields. when pass data form , call form.is_valid(), returns false if record exists , if other error occurs. so, want in case record exists(unique_together validation fails) , thing in case form.is_vaid() returns false due other reasons. how achieve ? it have modelform code , traceback errors in both cases give more accurate answer, workaround parse form.errors, corresponding type error or message error , write corresponding code. ps : message should comment under post lack few reputation points, sorry that.