Posts

java - RSA - bouncycastle PEMReader returning PEMKeyPair instead of AsymmetricCipherKeyPair for reading private key -

i have function reads openssl formatted private key: static asymmetrickeyparameter readprivatekey(string privatekeyfilename) { asymmetriccipherkeypair keypair; using (var reader = file.opentext(privatekeyfilename)) keypair = (asymmetriccipherkeypair)new pemreader(reader).readobject(); return keypair.private; } and returns asymmetrickeyparameter used decrypt encrypted text. below decrypt code: public static byte[] decrypt3(byte[] data, string pemfilename) { string result = ""; try { asymmetrickeyparameter key = readprivatekey(pemfilename); rsaengine e = new rsaengine(); e.init(false, key); //byte[] cipheredbytes = getbytes(encryptedmsg); //debug.log (encryptedmsg); byte[] cipheredbytes = e.processblock(data, 0, data.length); //result = encoding.utf8.getstring(cipheredbytes); //return result; return cipheredbytes; } catch (exception e) { debug.log (...

.net - Thread scheduler that can batch file operations on the same drive to the same thread? -

i'd use rx extensions handle parallelizing of long, file-bound operations. the workflow along these lines: search given file pattern on several drives (let's assume each drive on separate physical device) for each matching file found, queue long file operation to same thread other files on same drive - minimizing random seeks. operations on files on different drives should queued different threads allow parallel processing. my question is: rx scheduler (or combination of schedulers) should use ? for this, it's useful realize each rx observable subscription works serially. is, single subscription of single observable, can sure onnext delegate of 1 item completes before onnext following item starts. by default, onnext delegate executed on current thread (the 1 calls onnext() ), can change using observeon() . what means you should create separate observable each physical drive , observe each on separate thread. 1 way that, if have single observa...

ruby datamapper - rspec - why is "eql" matcher adding data to collection -

i have 2 specs. both test data common before(:all) block. if run both, second 1 fails. putting in logging statements, seems week 1 being added @h_1 twice - happening? it seems somewhere in first block. if comment out first, second 1 passes. don't understand is, in syntax saying 2 add @w_1 @h_1 twice? require 'data_mapper' datamapper::setup(:default, "sqlite3://#{dir.pwd}../data/prod.db") class hobby include datamapper::resource property :id, string, :key => true has n, :weeks, :through => resource end class week include datamapper::resource property :id, integer, :key => true has n, :hobbys, :through => resource end datamapper.finalize.auto_migrate! describe "hobby" before(:all){ @h_1 = hobby.create(:id => "zombies") @w_1 = week.create(:id => 1) @w_2 = week.create(:id => 2) @h_1.weeks << @w_1 @h_1.weeks << @w_2 @...

Can't access the SQL Server engine even from Management Studio -

i installed sql server 2012 express edition on computer (windows 8). when try create database management studio, i'm getting following error: create failed database 'testdb'. (microsoft.sqlserver.smo) create database permission denied in database 'master'. (microsoft sql server, error: 262) when try access visual studio, i'm getting following similar error message: create database permission denied in database 'master'. is there reason that? can't access engine management studio. edit here's connection string <add name="defaultconnection" connectionstring="data source=localhost\sqlexpress;initial catalog=optimumweightdb;integrated security=true; integrated security=true; user id=sa;password=mypassword" " providername="system.data.sqlclient" /> this context class public class owdbcontext : dbcontext { public owdbcontext() ...

Wordpress site in subdirectory, logout function failing -

we have wordpress site in root of our domain. translation plugin use appends domain (in our case czech) /cs - means can run more 1 translation use same database , wp-content main english website. however, added /cs causes logout function fail tries use current directory basis actual site content being pulled from. the actual code being used <?php echo wp_logout_url( $redirect ); ?> . have tried simple html href logout link dynamic , requires unique nonce value validate command. do have ideas how can have logout button uses actual site address (mywebsite.com) rather added 'directory' (mywebsite.com/cs). have far been unable edit wp_logout_url add / before it. ideas? example links: correct: http://www.mywebsite.com/backend?action=logout&redirect_to=index.php&_wpnonce=d8eaf8594a incorrect, resulting in 404 error: http://www.mywebsite.com/cs/backend?action=logout&redirect_to=index.php&_wpnonce=d8eaf8594a actual code being used (relevant logou...

java - Custom SQLite using Android NDK, SQLite source code -

i'm developing app use new google maps (see google play services , libs) , gps localization. in app, have sqlite db composed single table called poi(double latitute,double longitude,varchar(45) poiname) . @ every new gps value (latlng) need query db nearest poi. need use algorithm , wrote of similar in sql. not difficult. right? the real problem is: sqlite doesn't have cos, sin , acos functions. tried follow answare using sqlite source code, android ndk, cygwin (i'm using w8) , project... togethers, reading official doc, no result. is there good tutorial this? or can explain me step-by-step how that? [edit: more info] created in project jni folder , put inside: sqlite source code; android.mk. android.mk #local_path used locate source files in development tree. #the macro my-dir provided build system, indicates path of current directory local_path:=$(call my-dir) ##################################################################### # build sqli...

mysql - Pulling multiple fields from database using forms and php -

i have database multiple rows various fields. i have form contains drop down list. drop down list displays 1 of database fields (field_name) each row in database. when user selects desired entry hits submit, value passed results.php page , can used via $_post. all of works. i way send rest of row's fields correspond row of selected field (not "field_name") database along selected drop down menu. for instance, if have database rows fields named "name", "date", , "age", have database rows "name"s appear in drop down list , once submitted, pass particular name's "date" , "age" on results.php use on page. <html> <head> <title>drop down test</title> </head> <body style="font-family: verdana; font-size: 11px;"> <?php //variables connecting database. $hostname = "abcd"; $username = "abcd"; $dbname = "abcd"; $password = ...