Posts

c - What are #pragma equivalencies in gcc? -

my compiler ignoring: #pragma data_section(..., "iram_init"); and #pragma code_section(..., ".icode"); where ... function. this causing segmentation errors when run program. suppose because incorrect syntax gcc compiler ? equivalent ? thanks (context: on raspberry pi in raspian) the equivalent are: __attribute__((section(".icode"))) void fct1(int toto) { ... } __attribute__((section("iram_init"))) int fct2(void) { ... } __attribute__((section(".var"))) int myvar; but take care linker script (commonly ".ld" gnu tools): thoses sections have defined , mapped correct memory

ios - Why is Swinject model class registered without ".inObjectScope( .Container )" producing a singleton? -

this question people lot of experience of swinject swift. i show problematic code, , question @ bottom. there's quite lot of code, sorry that. this myswinjectstoryboard.swift registration: import swinject extension swinjectstoryboard { class func setup () { defaultcontainer.register( stopwatch.self ) { responder in stopwatch( signals: responder.resolve( signalsservice.self )! ) } defaultcontainer.register( signalsservice.self ) { _ in signalsservice() }.inobjectscope( .container ) defaultcontainer.register( imageservice.self ) { responder in imageservice( signals: responder.resolve( signalsservice.self )! , stopwatch: responder.resolve( stopwatch.self )! ) }.inobjectscope( .container ) defaultcontainer.registerforstoryboard( startupviewcontroller.self ) { ...

node.js - javascript sql.js giving error Uncaught Error: file is encrypted or is not a database -

here <script> tag in html page giving me error: uncaught error: file encrypted or not database <script> var file = "/data/mydb.sqlite"; var db = new sql.database(file); db.run("select * webusers", function(err, rows) { rows.foreach(function (row) { console.log('webusers created user: '+row.username); }); }); </script> as mentioned in comments, constructor doesn't take string, takes uint8array containing sqlite database. one way use ajax request database arraybuffer , transform uint8array. var file = "/data/mydb.sqlite"; var xhr = new xmlhttprequest(); xhr.open('get', file, true); xhr.responsetype = 'arraybuffer'; xhr.onload = function() { var data = new uint8array(this.response); var db = new sql.database(data); db.run("select * webusers", function(err, rows) { rows.foreach(function(row) { console.log('webuse...

sql - prevent any update or delete from table -

i have table added boolean column done when column true want prevent unautorized action (delete, update) on row. i wrote trigger: create trigger productstock_beforeupdate before update or delete on table each row execute procedure trig() create or replace function trig() returns trigger $$ begin if tg_op='update' or tg_op='delete' if old.done=true raise exception 'cant that'; return null; end if; end if; return new; end; $$ if autorized transaction wants change data have first disable trigger. this idea should work when try delete row done=false it returns me "0 rows deleted" , not perform delete. any idea wrong trigger? this caused fact update go through need return new record. delete go through, need return old record. quote manual thus, if trigger function wants triggering action succeed without altering row value, new (or value equal thereto)...

python - How do I prevent `format()` from inserting newlines in my string? -

it might mistake, cmd = 'program {} {}'.format(arg1, arg2) newline between 2 args... program 1\n2 what should put them in 1 line ( cmd need passed system shell)? arg1 contains \n . use strip() cmd = 'program {} {}'.format(arg1.strip(), arg2.strip())

amazon web services - Cloudfront 403 error while accessing files uploaded by another account -

Image
i have cloudfront distribution takes 1 of s3 buckets origin server. files uploaded s3 third party attachment uploader. when try access file in s3 via cloudfront getting 403 forbidden error access denied xml (as below). when manually upload files s3 bucket able access file via cloudfront. the permission both files same except owner of file. file uploaded me manually owner, of file account , file uploaded uploader, uploader. third party attachment uploader gives full access of object bucket owner. also, have restricted bucket access not viewer access. what reasons can cause error? how go debugging this? when second aws account uploads content s3 bucket serving content via cloudfront oai, uploaded file needs have oai canonical id added --grant read=id="oai-canonical-id" when file uploade; add s3 bucket owner grant full=id="bucketownerid". aws cli used perform uploaded. adjust according method used. when file viewed in s3 bucket, permissions have c...

java - What is the difference between a layer and a component? -

my major development framework java spring framework. have write service layers, controller layer, dao layer, repository layer , on. there thousands of tons of layering. think component based development approach become more productive layering. spring calls every java beans component. think there should major difference between component , layer. layer passive component active. component fires events, call life cycle callbacks methods , actively handle task. on other hand layer gives abstraction. fundamental difference between layer , component? concepts of layer , component different, don't replace each other. layer abstraction. abstract business logic database interactions, or http endpoint handlers. layer consists of components. there may multiple components in layer. let's continue concrete examples. have user , group entities in system. have necessary endpoint handlers both, named usercontroller , groupcontroller . these components , form endpoint handle...