Posts

ruby on rails - gocardless webhook signature mismatch -

i going through gocardless getting started guide, when try setup webhook (sandbox mode), don't correct value. the code copy-pasted https://developer.gocardless.com/getting-started/api/staying-up-to-date-with-webhooks/#building-a-webhook-handler and looks this computed_signature = openssl::hmac.hexdigest(openssl::digest.new('sha256'), secret, request.raw_post) provided_signature = request.headers['webhook-signature'] rack::utils.secure_compare(provided_signature, computed_signature) # => false what missing? help

python - How to add language code to URL in Pyramid? -

i've created basic pyramid "hello world" template project , added i18n support. i'm using python 3.5 , chameleon templates ( .pt ) gettext. i can change language through .ini file. now make dynamic , read language code url. urls changed /<language code>/page/{possible params} example /fi/home . don't want add {language} existing routes/views language code parameter hidden , views don't know except when creating links other pages in templates/views. edit: here's attempt using tweens mentioned mikko ohtamaa: added __init__.py : config.add_tween('myapp.tweens.localizertween') tweens.py : import logging pyramid.registry import registry pyramid.request import request log = logging.getlogger(__name__) class localizertween(object): """ set translator based on url """ def __init__(self, handler, registry: registry): self.handler = handler self.registry = registry def __call__(...

python - Update dataframe values by broadcasting series -

Image
trying update portion of dataframe values series. np.random.seed(1) df = pd.dataframe(np.random.randint(1,100,(5,5)),columns =list('abcde')) print df b c d e 0 38 13 73 10 76 1 6 80 65 17 2 2 77 72 7 26 51 3 21 19 85 12 29 4 30 15 51 69 88 with series: ser = pd.series(index =list('cbade'),data = range(-5,0)) c -5 b -4 -3 d -2 e -1 dtype: int64 lets take slice updating criteria = df['a'] < 25 criteria: 0 false 1 true 2 false 3 true 4 false trying: df[criteria] = ser df.loc[criteria,:] = ser etc. desired output: b c d e 0 38 13 73 10 76 1 -3 -4 -5 -2 -1 2 77 72 7 26 51 3 -3 -4 -5 -2 -1 4 30 15 51 69 88 i want honor column index , ignore row index, using boolean criteria , broadcasting. you can fillna series can make df np.nan mask works df.mask(criteria).fillna(ser)

Symfony 3.1 swiftmailer email doesn't send -

i wanted send test email using symfony 3.1 , swiftmailer, doesn't work. reading other solutions, still doesn't work. config.yml: swiftmailer: transport: %mailer_transport% encryption: %mailer_encryption% auth_mode: %mailer_auth_mode% host: %mailer_host% username: %mailer_user% password: %mailer_password% spool: { type: memory } parameters.yml mailer_transport: smtp mailer_encryption: ssl mailer_auth_mode: login mailer_host: smtp.gmail.com mailer_user: user@gmail.com mailer_password: mypass parameters.yml v.2 trying: mailer_transport: gmail mailer_encryption: ssl mailer_auth_mode: login mailer_host: smtp.gmail.com mailer_user: user@gmail.com mailer_password: mypass controller: public function contactaction(request $request) { $name = $request->request->get('name'); $surname = $request->request->get('surname'); ...

curl - C++ Codeblocks + libcurl ends up with link errors -

hi c++ beginner , wanted learn http requests... picked curl because have experience using before php. downloaded version curl website c:\libs win64 x86_64 7zip 7.51.0 binary ssl ssh viktor szakáts 1.81 mb this i've done far on codeblocks: under global compiler settings/search directories/compiler, added path: c:\libs\curl-7.51.0-win64-mingw\include\curl under global compiler settings/search directories/linker, added path: c:\libs\curl-7.51.0-win64-mingw\lib under global compiler settings/linker settings, added paths: c:\libs\curl-7.51.0-win64-mingw\lib\libcurl.a c:\libs\curl-7.51.0-win64-mingw\lib\libcurldll.a -under global compiler settings/compiler settings, box checked before: have g++ follow c++11 standard... (no idea if matters or not...) also, because desperate copied contents of c:\libs\curl-7.51.0-win64-mingw c:\program files (x86)\codeblocks\mingw, step makes no sense me, found online tried... now running code: #include <cstring...

linux - How to write a bash script to test table of logins? -

i've participated in hacking competition in school. came solution didn't knew how code here asking help. the problem involved security breach on server. files gmail usernames:passw had been leaked , we, infosec team, had test logins compromised (if users hadn't changed pw yet) email them. idea was: first, cat files using cat * > merged-file . then, somehow create mechanism test each combination usr + pw on gmail putting flag or creating file successful ones. sorry bad english, i'm not native speaker. you can check username , password using curl curl -u $username:$password --silent "https://mail.google.com/mail/feed/atom" | grep "<title>" it return <title>unauthorized</title> if combination not correct.

linux - Implementation of multiple pipelines and command executions in C -

i have homework asks me create shell executes multiple commands separated pipelines. here code snippet forking childs , executing commands: (int = 0; < commands; i++) { place = commandstarts[i]; if((pid = fork()) < 0) exit(1); else if (pid == 0) { if(i < pipe_counter && dup2(fds[j + 1], 1) < 0) exit(1);// if not last remaining command if(j != 0 && dup2(fds[j-2], 0) < 0) exit(1); // if not first command for(int c = 0; c < 2*pipe_counter; c++) close(fds[c]); if(execvp(argv[place], argv+place)) exit(0); // execute , if returns anything, exit! } j+=2; } for(int = 0; < 2 * pipe_counter; i++) close(fds[i]); while ((wait(&status)) != pid); // program gets point // parent process, should wait completion even though, seems working fine in simple examples, in m...