Posts

Showing posts from September, 2010

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 =

javascript - jQuery Waypoints sticky nav when scrolling up via a click is 1px off -

i'm close tearing hair out waypoints. first of all, i'm far being experienced in javascript. i'm using waypoints 1) fix nav top of screen @ point (this works fine) , 2), highlight nav items when sections reached. works except when click nav item requires waypoint direction up, e.g. click "exceptional value" , "destinations." you'll notice waypoint seems pixel off , "exceptional value" still highlighted. if scroll pixel, "destinations" highlights. way replicate behavior... clicking nav items scroll down works fine. here js: http://jsfiddle.net/treud/ . here site it's implemented on: http://ifb.thepinkrobot.com/ . help... it's appreciated. <!-- waypoints --> <script type="text/javascript"> $(document).ready(function(){ $('.nav-container').waypoint(function(direction) { $('nav#main').toggleclass('sticky', direction === 'down'); }

magento - Add all my EAV attributes to a product -

so going thru alan storm's magento tutorials , completed page eav attributes. http://alanstorm.com/magento_advanced_orm_entity_attribute_value_part_1 it worked flawlessy, have couple questions. have xml feed trying read products , storing in db. while works, , added new table created, when in admin under manage-->products, there no products listed. i noticed in admin when go catalog-->manage attributes, don't see new eav attributes. explanation, , looking @ new db tables, see actual product data & attribute meta data being stored; in newly created tables. but to: see these new products saving db in manage products in admin make sure new eavs added (based on xml field names) associated these items when placed in main admin product view i followed code exactly, changed names based on experiment: foreach ($xml $c) { $car = mage::getmodel('vehicleimport/eavvehicle'); ... ... ... $car->save(); }

sql - Complex Subquery into Self Join from sqlzoo task 10 -

i trying solve task 10 http://sqlzoo.net/wiki/self_join here select in select: select distinct astops.name, bbstops.name route join route b on a.company=b.company , a.num = b.num join stops astops on a.stop = astops.id join stops bstops on b.stop = bstops.id astops.name = 'craiglockhart' , bstops.name in ( select aastops.name route aa join route bb on aa.company=bb.company , aa.num = bb.num join stops aastops on aa.stop = aastops.id join stops bbstops on bb.stop = bbstops.id bbstops.name = 'sighthill' ) this sql code not work, because can't use table's name defined in inner 'in' select. solution change 'in' select subquery self join. question how in example? i believe answer close this: select astops.name, cstops.name route join route b on a.company=b.company , a.num = b.num join route c on b.compa

php - I need to loop a check - not sure how -

i have script uploads file given directory. when file uploaded need launch second script. this code used in '$newfile' variable location/name of uploaded file. if (isset($_post['submitbtn'])) { if(file_exists($newfile)) { include ('nextscript.php'); } } this works small files, larger files (5mb) fails apparently because file_exists check being done (ie before file completes uploading). i read 'sleep()' function can used delay , loop checks not understand how use it. can explain how might able use in situation?? - or there different more suitable method delay check or loop until file finishes uploading?

javascript - alert when user attempts to enter key into textbox -

so i've been searching bit code alert user message (i know how alert) when try enter sort of text blank textbox. here code. add cause sendmsg() function called? <script> function sendmsg() { alert ("change msg content here"); } </script> here html: <body> <input type="text" name=""> </body> this might work: <input type="text" name="foo" onkeyup="sendmsg()" /> i.e. if understood question. cheers.

c++ - Currency denomination -

trying use proper currency denomination game. currency stored string (i.e. can't change due professor) , in order of platinum, gold, silver , copper. example, if initialize currency "0.1.23.15" means have 0 platinum, 1 gold, 23 silver , 15 copper. i need able covert higher denomination, however. mean? example if have 105 silver pieces (i.e. 0.0.105.0), should show 1 gold , 5 silver (i.e. 0.1.5.0). i bolded problem within setcost method. checking if number greater 100 , if -- make column 0, go previous element , add 1 ascii value giving proper carry. unfortunately, debugger showing "/x4" being dumped element instead of "4". know why , how can change it?? edit: edited code , works long don't enter number above 100. having brain lapse on how make work numbers larger 100. this of sloppiest code have ever written. please gentle. :( void potion::setcost(std::string cost) { char buffer[256]; std::string currencybuffer [4];

c# - Kinect skeletal data to transit to another event -

i working on project in visual studio kinect. wondering how detect skeletal data user, play sound , transit event. this basic skeletonframeready event: private void kinect_skeletonframeready(object sender, skeletonframereadyeventargs e) { using (skeletonframe skeletonframe = e.openskeletonframe()) // open skeleton frame { if (skeletonframe != null && this.skeletondata != null) // check frame available { skeletonframe.copyskeletondatato(this.skeletondata); // skeletal information in frame } } } my goal of application use skeletal data detect user, , transit xaml file. possible? thank you time.

iphone - is it possible to change the style of uitableview in two different views? -

this question has answer here: can programmatically change style of uitableview after it's been created? [duplicate] 3 answers i have table , have declared style grouped table style in view did load have button on click of want change style of same table. initially setting in view did load method: tableobj= [[uitableview alloc]initwithframe:cgrectmake(5,50,310,300)style:uitableviewstylegrouped]; but on button click event setting tableview fram , style see below code tableobj.frame=cgrectmake(5,50,310,300); tableobj style=uitableviewstyleplain; but gives error.....assignment readonly property ?? according docs, uitableview's style property declared thus: @property(nonatomic, readonly) uitableviewstyle style that readonly keyword means can value of property, can't set it. can set style when create table using -initwithframe:style:

vba - Macro to open a excel in shared path -

hi able open excel files in desktop. not able open excel in shared path. file not found error message displayed need help...!!! path starts 2 backslashes "\..\.....\" sub open_hari() dim r long r = 1 10 if cells(r, 1).value <> "" workbooks.open filename:=sheet1.cells(r, 1).value end if next r end sub i had no problem opening file of form \\myshare\etc\file.xlsx vba. tried running code, , worked me point found non-empty cell... once found file , opened it, code automatically started looking @ cells in new workbook (i had file name in row 6; file opened, , code looked @ row 7 in newly opened file. did not have valid file name in it). if cause of problem, solution set range before start scrolling through it... : sub open_hari() dim mycells dim c set mycells = range(sheet1.[a1], sheet1.[a10]).cells each c in mycells if c.value <> "" workbooks.open filena

java - The type TransactionCallback is not generic; it cannot be parameterized with arguments [Ao entity] -

in below stuff, shows me error "the type transactioncallback not generic; cannot parameterized arguments " in eclipse editor. import com.atlassian.sal.api.transaction.transactioncallback; ao.executeintransaction(new transactioncallback<entityissues>() // (1) { @override public todo dointransaction() { //storing stuff } }); <dependency> <groupid>com.atlassian.sal</groupid> <artifactid>sal-api</artifactid> <version>2.0.17</version> <scope>provided</scope> </dependency> my javase version - 1.7.0 any idea why not taking generic object ? you remove generic parameterization: new transactioncallback()

bash - Wildcard single file -

given following files $ ls bar.txt baz.txt qux.txt i save first txt file variable. tried this $ var=*.txt but saves files $ echo $var bar.txt baz.txt qux.txt i using wildcard if possible, , extglob okay. files here not have spaces in name solution work files spaces. after using kamituel’s answer realized can work too $ set *.txt $ echo $1 bar.txt use this: $ var=(*.txt) $ echo $var bar.txt key here use parentheses - putting elements array. echo $var prints first element array ( bar.txt ). can see printing whole array: $ echo ${var[@]} bar.txt baz.txt qux.txt

c++ - Quickly locating error message in MSCV 2010 -

Image
when compile c++ project , have errors, see errors need open find window , search 'error' inside output window. isn't better way go on error messages? thank you to expand on comment earlier, error list window can shown clicking view->error list main menu or pressing ctrl + w , e . with error list window visible errors detected during compilation should clickable within window once compilation has failed.

How to create a "unique" socket in zeromq? -

i'm experimenting simple actor model in haskell, each actor: is haskell thread has zeromq pull socket upon receives messages some actors "well known", have indefinite lifetimes, , hence have socket bound known port. other actors short lived , transient, , hence need random free port assigned them. i unaware of ability of zmq3 allow binding ephemeral port, described here: http://api.zeromq.org/3-2:zmq-tcp hence, transient actors have code tries bind free port within given range. works intended, brings light zmq behavior causes me problems: if transient actor closes it's port , exits, , new transient actor starts, it's bind same port os old one. in circumstance outstanding or subsequent messages queued old actor received new one. how can avoid this? if bound transient actors sockets using wildcard system assigned ephemeral port, still potentially see problem? how can generate new unique pull socket tcp transport guaranteed distinct others?

arrays - Unresolvable perl error? -

use strict; @array = (); @nums = [3, 4]; foreach $i ( 0 .. 10 ) { foreach $j ( 0 .. 10 ) { $nums[0] = 4+1; push @{ $array[$i] }, @nums; } } print $array[6][2][0]. "\n"; as 1 can see if run code, doesn't run properly. however, if comment out line "$nums[0] = 4+1;", runs fine. going on? can immutable arrays pushed onto others? @nums array, , assign array reference (with brackets [] ). so, change proper array declaration: my @nums = (3, 4); use strict; use data::dump; @array = (); @nums = (3, 4); foreach $i ( 0 .. 10 ) { foreach $j ( 0 .. 10 ) { $nums[0] = 4+1; push @{ $array[$i] }, @nums; } } dd @array; #-- output: ( [5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4], [5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4], [5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4], [5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4], [

c# - How to set default display value for data gridview? -

i using data grid view. have list of object lets say. class abc{ public int i{get;set;} public long b{get;set;} } //in form load list<abc> objlist = new list(); listpopulate(); // populate list. datgridvew.dtasource = objlist; i want show "-" objabc.i value = 0 , want show "good" objabc.b = 1000 tried cell default format in vain. can please me out ? you can use event that, like: datagridview.cellvaluechanged event or use datagridview.cellformatting event this: private void datagridview1_cellformatting(object sender, datagridviewcellformattingeventargs e) { datagridview dgv = (datagridview)sender; if (dgv.columns[e.columnindex].name == "i" && e.rowindex >= 0 && dgv["i", e.rowindex].value int) && (((int)dgv["i", e.rowindex].value) == 0) { e.value = "-"; e.formattingapplied = true;

firefox - How to exclude amazon.com from a Greasemonkey script? -

i've specific greasemonkey 1.8 /firefox 20 script ( auto-view spoiler boxes ) works great on sites, on amazon.com destroys layout. i've tried exclude amazon.com in script settings, not work. since amazon.com defaults https:// i've set exception in user script -> auto-view spoiler boxes -> options -> user settings: include pages: *http://* excluded pages: *https://* yet, script still work on every website (yes, i've cleared browser cache). on script settings tab, non-editable included pages section contains: http://forums.kingdomofloathing.com/vb/showthread.php* what i'm doing wrong? how exclude amazon.com greasemonkey script? reference the include , exclude rules greasemonkey . don't use *http://* or *https://* leading asterisk yield unexpected results. not amazon pages use https. in user settings, can use http://* included pages , these 4 lines excluded pages : http://amazon.com/* http://*.amazon.com/* h

c# - Putting DBContext scope to IService -

i have web app , windows service app. the web app injects ipersonservice mvc controllers. the windows app uses ipersonservice . the service takes 3 dependencies on ipersonrepo, iaddressrepo, iemploymentrepo example. the implementations of repositories take dbcontext entity framework use. in web app can register dbcontext bind<mycontext>().toself().inrequestscope(); in windows service trickier. leave dbcontext transient seems wrong. so thought make services scope determine life cycyle of dbcontext unsure how go make sure worked web app , windows service app. any appreciated if it's important 3 repos use same dbcontext instance, can this: var context = new dbcontext(...); bind<ipersonrepo>().to<personrepo>().withconstructorargument("dbcontext", context); bind<iaddressrepo>().to<addressrepo>().withconstructorargument("dbcontext", context); bind<iemploymentrepo>().to<employmentrepo>().wit

iphone - removing an object from a fetchedResultsController fetchedObjects -

is possible remove object fetchedresultscontroller fetchedobjects? for example have following code: nspredicate *predicate = [nspredicate predicatewithformat:@"pack.packname in %@", allowedpacknames]; (int = 0; < [tempfetchresults.fetchedobjects count]; i++){ author *author = [tempfetchresults.fetchedobjects objectatindex:i]; nsset *filteredquotes = [author.quotes filteredsetusingpredicate:predicate]; if ([filteredquotes count] > 0){ author.quotes = filteredquotes; } else { //remove author fetchedobjects array } } how can this? to remove object data store: [self.managedobjectcontext deleteobject:object]; [self.managedobjectcontext save:nil]; [self.fetchedresultscontroller self.fetchedresultscontroller.fetchrequest]; [tableview reloaddata]; to remove object fetched results controller array, need change pr

html - Custom IE8 tooltip for title="tooltip description" -

there possibility use css in order style title="title description" on ie8? without use jquery? like: html <a href="#" title="tooltip description">this must toltip</a> css a[title]:hover{ background: lime; border:1px solid #eaeaea; opacity: .6; position: absolute; } no, title popup managed browser. content isn't interpreted html , can't style it. if want styled popup, have generate using javascript. in related question show how can (here jquery can adapt vanilla js). demonstration

c++ - Problems with de-registering of COM (advanced installer) -

definition of problem: hangs sometime during com de-registering , says the setup unable automatically close requested applications. please ensure applications holding files in use closed before continuing installation . extension unloaded , uninstalled. definition of environment: i created kind of dummy shell namespace extension tests. implements icontextmenu , methods return s_ok , nothing else , rgs file is hkcr { xxx.sergz.dummyshellext.1 = s 'dummynse class' { clsid = s '{6c0fbe00-9898-4bb0-806f-3ed7d2f1170d}' } xxx.sergz.dummyshellext = s 'dummynse class' { curver = s 'xxx.sergz.dummyshellext.1' } noremove clsid { forceremove {6c0fbe00-9898-4bb0-806f-3ed7d2f1170d} = s 'dummynse class' { progid = s 'xxx.sergz.dummyshellext.1' versionindependentprogid = s 'xxx.sergz.dummyshellext' forceremove programmable

c++ - Most efficient way of accessing coordinates -

given following definition union { double coords[3]; struct { double x,y,z; }; } p; it possible access coordinates of 3d point both index , name (both ways have advantages). equivalent? more precisely: following expressions ... p.coords[0] ... p.x ... ... p.coords[1] ... p.y ... ... p.coords[2] ... p.z ... (pairwise, each line) generate same (assembly) code? there difference in efficiency between 2 ways of accessing coordinate? p.x,... might faster, there's not difference 1 notice. when use array, there time spent on multiplication size of each double in given index desired memory address; in other method ( p.x,... ) compiler knows address accessing calculation not required. however, if compiler smart enough figure out constant numbers, there no difference.

url rewrites magento 1.7 -

i change url rewrites remove category out of url example url/category/subcategory (before rewrite) url/subcategory (after rewrite) and works perfect when index management regenerate default how stop changing them original want new rewrite stay takes forever bring them back! go admin -> system -> index management -> select catalog url rewrites , change index mode "manual update". thats it. done.

select - CSS - Set <div>s with "position: absolute" not to overlap each other -

i have table n columns. each column has predefined width, , inside each column th , there div containing actual header text, , div containint dropdown menu. this simplified structure of table: <table> <tr> <th> <div>text</div> <div><select>...</select></div> </th> <tr> ... ... </table> the predefined width column can cause text splitted in more 1 line. when happens, elements inside th rearrange position, causing misaligment column's select .. what need do, find way have every select aligned each other, possibly anchored bottom of th . http://jsfiddle.net/sezsz/2/ <- here i've made example of i'm working on. the 2nd table shows table without style (except th width): notice misalignment between first , second select . the 1st table, instead, has styles applied. can see, second column text overlapped select.. tryed solve prob

railstutorial.org - Update Authorization (Ruby on Rails Tutorial) -

mike hart's tutorial on adding authorization presented below code ( link original code listing) . why method update make call sign_in @user . seems redundant me before_filter :correct_user should guarantee client signed in because of current_user?(@user) in method correct_user . class userscontroller < applicationcontroller before_filter :signed_in_user, only: [:edit, :update] before_filter :correct_user, only: [:edit, :update] . . . def edit end def update if @user.update_attributes(params[:user]) flash[:success] = "profile updated" sign_in @user redirect_to @user else render 'edit' end end . . . private def signed_in_user redirect_to signin_url, notice: "please sign in." unless signed_in? end def correct_user @user = user.find(params[:id]) redirect_to(root_path) unless current_user?(@user) end end because user forced update passwor

sql update - Can anyone spot the mistake in this SQL statement? <resolved> -

i'm trying add row database if not exist or update row if does. going wrong? i've looked @ thousand times , think may missing silly... update classes set (duration='44', inmodule='actions', editionsfor='vocus vpr - basic edition//vocus pr - enterprise edition//', objectives='objective 1//objective 2//objective 3//', prereq='prerequisite 1//prerequisite 2//prerequisite 3//', points='training point 1//training point 2//training point 3//', contentlink='www.aol.com', otherinfo='this internal info', summary='this brief summary of class') title='this class title' if @@rowcount=0 insert classes (title, duration, inmodule, editionsfor, objectives, prereq, points, contentlink, otherinfo, summary) values ('this class title','44','actions', 'vocus vpr - basic edition//vocus pr - enterprise edition//', 'objective 1//objective 2//objective 3//&

android - saving bitmap after translation saves bitmap with black area -

i have used custom view contains canvas draw bitmap, overlay, shapes etc. custom view added relative layout in activity. problem while translate image on canvas edit bottom portion of image, edits after editing when save bitmap saved bitmap contains part of original bitmap shown @ time of save....remaining part of bitmap not shown on screen bcoz of translation not saved black part bitmap.... solution problem..? thanks. private void settingbitmaptodraw() { // todo auto-generated method stub resultbitmap=bitmap.createscaledbitmap(resultbitmap, width, height, true); matrix matrix=new matrix(); matrix.setrotate(to_degree); tempbitmap=bitmap.createbitmap (resultbitmap, 0, 0, width, height, matrix, true); if(bitmap!=null) { bitmap.recycle(); bitmap=null; } bitmap=bitmap.createbitmap(width, height, tempbitmap.getconfig()); canvas=new canvas(bitmap); invalidate(); }

coq - Easy way to simplify expression within anonymous function? -

assume need prove following: x: nat (fun _ : nat => 0) = (fun y : nat => if beq_nat x y 0 else 0) since y not in environment, looks can't destruct on beq_nat x y simplify right-hand side. there simple way simplify expressions within anonymous function? besides being able massage 2 functions equal, there way deduce 2 functions same showing produce same value on inputs? edit: realize might asking impossible, since functions not same, it's when applied argument produce same value. i'm not sure how coq interprets this. i believe case of referred functional extensionality , want prove 2 functions extensionally equal (they behave same caller's point of view). you cannot prove directly in coq (since = definitioinal equality, not true), if wish to, can require module: http://coq.inria.fr/stdlib/coq.logic.functionalextensionality.html which provide axioms functional extensionality. can call tactic extensionality y. give access y .

php - Custom pagination route using CakePHP 2.3.1 -

i using cakephp 2.3.1 , have problem paginator component. my goal pages like: example.com/abruzzo example.com/abruzzo/2 example.com/abruzzo/3 i have created follow route: router::connect('/:regione/:page', array('controller'=>'regions','action'=>'home'), array('page' =>'[0-9]+')); router::connect('/:regione', array('controller' => 'regions', 'action' => 'home')); (as can see first route work handle page param) now, handle page param correctly, added follow line regionscontroller's beforefilter . public function beforefilter() { $this->request->params['named']['page'] = (isset($this->request->params['page'])) ? $this->request->params['page'] : 1; } because read paginator componenet ad ['named']['page'] instead of ['page'] directly. first question: is correct? nee

c# - Join the HashCode magic -

am started testing hash function on uniqueness of generated hashcodes algorithm. , wrote next text class test when same hashcode generated. class program { static void main(string[] args) { var hashes = new list<int>(); (int = 0; < 100000; i++) { var vol = new volume(); var code = vol.gethashcode(); if (!hashes.contains(code)) { hashes.add(code); } else { console.writeline("same hash code generated on {0} retry", hashes.count()); } } } } public class volume { public guid driverid = guid.newguid(); public guid computerid = guid.newguid(); public int size; public ulong versionnumber; public int hashcode; public static ulong curdriverepochnumber; public static random randomf = new random(); public volume() { size = randomf.next(1000000, 1200000);

java - Mapping an enum in hibernate hbm? -

i have enum below. public enum exampleenum { one(1), two(2); private int action; private exampleenum (int action){ this.action = action; } /** * @return action */ public int getaction() { return action; } /** * @param action action set */ public void setaction(int action) { this.action = action; } } i need save integer values not 1 , two. how can that? have below config in hbm: <property name="action"> <column name="action" /> <type name="org.hibernate.type.enumtype"> <param name="enumclass">com.exampleenum</param> </type> </property> do need have other configuration save integers? please me! thanks! ` <class name="package.class" table="database table name"> <id name="get/set parameter....your first

opengl - Rendering translucent objects in a complex scene -

so stuck following problems scenegraphs , translucent objects... problem want render multiple translucent objects in 1 scene. know have render opaque objects first , translucent front. working well... more or less... but real problem example have 1 translucent cube, in white (or other color) , alpha value example of 0.5. internal structure of cube given in wavefront obj file , order of single planes of cube given. dont order single planes of object because in scene >1000 objects , >1000 vertices of each object, order objects whole. if render single planes of object , move around, there comes moment, when 1 plane nearer 1 rendered before other one. , second 1 not being rendered because depth buffer not allowing this, error in rendering. shutting down depth buffer not solution: need because there may complex objects translucent , opaque. any hints how can achieve objects, if complex , both opaque , translucent, rendered in correct way ? basically have following:

asp.net send auto mails not workign on shared hosting server -

i want send automatic email on condition application.and application hosting account type shared hosting. i using asp.net mvc2.0. i have worked according below article send auto mails : http://www.codeproject.com/articles/12117/simulate-a-windows-service-using-asp-net-to-run-sc its working on local system not production server(shared hosted account). can 1 suggest me way it?

database - Insert data from Datagridview to Datatable in C#? -

i capable of inserting data datagridview datatable using c#. fail update data datagridview datatable using c# windows application? (int = 0; <= dgvspplrfrm.rows.count-1;i++) { drlocal = dtlocalc.newrow(); drlocal["splr_slno"] = dgvspplrfrm.rows[i].cells[0].value; drlocal["splr_cntctnm"] = dgvspplrfrm.rows[i].cells[1].value; drlocal["splr_cntctdesig"] = dgvspplrfrm.rows[i].cells[2].value; drlocal["splr_cntctmoblno"] = dgvspplrfrm.rows[i].cells[3].value; drlocal["splr_cntctemail"] = dgvspplrfrm.rows[i].cells[4].value; dtlocalc.rows.add(drlocal); } make sure datatable contains column want copy. careful columnname of datatable datagridview . can try : public datatable getdatatable() { datatable dtlocalc = new datatable(); dtlocalc.columns.add("splr_slno"); dtlocalc.columns.add("splr_cntctnm

sonarqube - Sonar-Eclipse Integration -

i integrating sonar version-3.2 eclipse juno(version-4.2). have installed plugin through eclipse "install new software".... after integration when add sonar server in eclipse going eclipse preferences window ask sonar server url, username , password,i provide these details (assuming username , password of sonar) , click on test connection through "unable connect" message. do know reason behind this?? what significance of username , password here?? kindly revert in case have idea on it.. thanks in advance!! you need have sonar 3.4 or higher on server access eclipse juno. older versions can accessed helios , indigo.

javascript - Enter text in Datepicker textfield -

i'm using jqueryui add datepicker textfield. works fine, because of i'm not able type text textfield. can add date through datepicker. but want users able enter things now in textfield. entering manual text blocked can see in example fiddle: http://jsfiddle.net/kugzd/ is there anyway change behavior? just add constraininput: false datepicker option $(function() { $('.date').datepicker({ constraininput: false }); }); check documentation demo: http://jsfiddle.net/kugzd/2/

OpenLayers - turn off selection of map in IE -

i have map in div, when user clicks outside div , drags map, map gets selected , turns blue, , it's bit unsettling user has click around number of places before blue color goes away. i found following css properties can set none in .olmap class , turns selection off map in chrome, firefox, safari , opera, not in ie. .olmap { -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; } does know of property set these turn off selection of map in ie? you can use -ms-user-select: none; ie 10+. for earlier versions of ie try: <div unselectable="on"> </div>

symfony - Insert data from form to database -

what want next: create simple form formbuilder when form submitted result saved database particular user ( based on id ) in addition code controller: public function helloaction(request $request, $id){//displaying individual results particular user// // find username in view// $em = $this->getdoctrine()->getmanager(); $query = $em->createquery('select b acmewebbundle:baza b b.id = :id' ) ->setparameter('id',$id); $total = $query->getresult(); $baza = new baza (); $em = $this->getdoctrine()->getmanager(); $em->persist($baza); $form = $this->createformbuilder($baza) ->add ('rating','choice',array('label'=>'test44','choices'=>array( '1'=>'1', '2'=>'2', '3'=>'3',

debugging - errors not shown in Firebug console with dojo/when promise -

newbie dojo. don't understand why js errors not written firebug console when happening in resolved promise handler of dojo/when function. synchronous code, errors written. when error happens, erroneous line shown in firebug script view. i'm using dojo 1.8 ff 19.0 , firebug 1.11.2. there has try catch block somewhere along code, prevents dojo/when throw errors. you can add functionality adding try catch block yourself, check out jsfiddle: http://jsfiddle.net/kymkf/1/ try{ should.bombandloganerrorinfirebug(); //this not log error in firebug! why? } catch(e) { alert("error"); }

bash - Using wget to "checkout" svn repository -

i have poorly laid out svn repository don't have permission re-structure. there several subprojects spread across repo @ various depths repository root. want able check out of trunks (but not branch or tag folders) regardless of depth at. figure problem wget solve. initial use of wget looked this: wget -r -x 'tags' -i "base/of/repo" "http://www.urlrepo.com/" a few issues ran while running command: wget still grabbed tags folder though thought -x flag should exclude them the downloaded files placed folder "base/of/repo", isn't terrible, nice not save path thoughts? you can recursively bash , svn using sparse checkout. something like: svn co --depth immediates svn://repo/trunk then on each subfolder, if 'tags': svn --set-depth empty tags else: svn --set-depth infinity dirname

android - Can not play video from my internal application directory -

it looks can not play videos stored in internal application directory. i have videos stored in /data/data/my.package.org/files/ and i'm trying play file there using string fpath = "/data/data/my.package.org/files/video.mpg" intent intent = new intent(intent.action_view); intent.setdataandtype(uri.parse(fpath), "video/*"); but both android default video player , external videoplayer (mx player) 'this video can not played". whereas when i'm saving videos sd card played fine. why that? put video in assets folder , use code play video mediaplayer inputstream = getresources().getassets().open("video.mpg"); or put video in assets folder and... string fpath = "/data/data/my.package.org/assets/video.mpg" intent intent = new intent(intent.action_view); intent.setdataandtype(uri.parse(fpath), "video/*");

c# - Replace all non-word characters with a space -

i have regex [a-za-z] and string, such as hi! string. i want replace charcters not in regex space. so, i'll end with hi string how done? var cleaned = regex.replace(given, "[^a-za-z]", " ");

sharepoint - Date compare filter using XSLT? -

i have "date available" column had column type of "single line of text." values in m/dd/yyy format. following search filter used without issue: (number(ddwrt:formatdatetime($needby,1033,'yyyymmdd')) >= number(ddwrt:formatdatetime(string(@arsdateavailable),1033,'yyyymmdd')) or $needby = '') but column type had changed "date , time" , filter doesn't appear working. because column type changed? how can modify filter make work? this convert date number can use compare other dates (that have been converted way): ddwrt:datetimetick(ddwrt:gendisplayname(string(@arsdateavilable)))

java - android equivalent code for graphics2D -

i have been trying android equivalent code following :- private bufferedimage user_space(bufferedimage image) { bufferedimage new_img = new bufferedimage(image.getwidth(), image.getheight(), bufferedimage.type_3byte_bgr); graphics2d graphics = new_img.creategraphics(); graphics.drawrenderedimage(image, null); graphics.dispose(); return new_img; } i want android equivalent of graphics2d. have been searching while , found out canvas in android can similar tasks performed graphics2d class here main problem i'm not getting android equivalent of whole process being performed in code. please asap... android not have bufferedimage or graphics2d found out. i'm not java developer (just android) i'm not 100% sure on you're trying achieve, seems me you're creating copy of image. here few classes you'll using type of manipulation: bitmap : that's bufferedimage, it's object stores bytes image (possibly large object

asp.net - Force Browser and Document Mode to ie9 in ie10 -

this code: <meta http-equiv="x-ua-compatible" content="ie=9" /> seems change document ie9 , not browser. ideas other hitting f12 , changing manually? a site can not set browser mode. browser mode chosen before browser requests content site. specifies how browser identified site, such ua string. as mentioned, document mode can set author including x-ua-compatible meta element, or doctype used. overrides default set browser browser mode. changing browser mode useful using ie test how earlier version of ie handle site. can change on local machine (but not site whole) changing in f12 tool. the user (and developer) can change browser mode clicking on compatibility view icon in url field. machine, , not users. the way change browser mode globally site added ms’ compat view list. don’t want unless site uses ton of old ms vendor specific code, , not updated. you can read more @ http://blogs.msdn.com/b/ie/archive/2010/10/19/testing-sites-wit

ruby - Rendering a template based on object type in Rails -

i'm writing small forum app users can create different types of forums. example, announcements, discussions, or questions forum. the forum model has many posts, , forum_type column. render posts#show using different template, based on @post.forum_type column. so each forum, based on type, have distinct appearance posts. how can without littering code if @post.forum_type == 'something' ... ? delegation. write post renderer, , implement 1 concrete renderer subclass per forum type: class post attr_accessor :forum_type end class baserenderer def renderer_for(post) # create correct renderer post here end def render_post(post) renderer = renderer_for(post) renderer.to_html # return results end class forumapostrenderer def initialize(post) @post = post end def render # render post forum here\ end end class forumbpostrenderer def initialize(post) @post = post end def render #render post forum

asp.net mvc - Problems with DbContext in Class Project -

background : i have web api project , class library project in same solution share same model classes. both projects share same database , both use dbcontext read/write data. the web api project set in typical unitofwork pattern , works fine. the class project bit different. specify connection string in constructor instead of web.config file: class mycontext : dbcontext { public mycontext(string connectionstring) : base() { // force me use eager loading this.configuration.lazyloadingenabled = false; // init connection string this.database.connection.connectionstring = connectionstring; database.setinitializer <cfcalccontext> (null); } ... dbsets ... protected override void onmodelcreating(dbmodelbuilder modelbuilder) { ... modelbuilder details ... } } i use web api call function defined in class library. when attempt query database using class library error. the problem : i

javascript bigger than if statement not working correctly -

i no expert in javascript, hope can me out. i have following code, reason thinks statement true delvnum=document.getelementbyid("deliverynum").value; delvqty=document.getelementbyid("delvqty"+id).value; orderqty=document.getelementbyid("orderqty"+id).value; if (delvqty>orderqty) { alert("can't deliver more " + orderqty + ", trying deliver " + delvqty + ". please fix!"); document.getelementbyid("delvqty"+id).focus(); return; } the error message show quantity of each var, , correctly being passed through. you comparing strings , not numbers. use parseint or parsefloat if (parsefloat(delvqty)>parsefloat(orderqty)) or if (parseint(delvqty,10)>parseint(orderqty,10))

c++ - Java JNI with C function using gsl. -

i trying use jni in order call function defined in c. weird because when run java program, 1 mistake , other times different one. here are: 82 [main] java (5556) c:\windows\system32\java.exe: *** fatal error - cygheap base mismatch detected - 0x612708f0/0x17ff08f0. problem due using incompatible versions of cygwin dll. search cygwin1.dll using windows start->find/search facility , delete recent version. recent version *should* reside in x:\cygwin\bin, 'x' drive on have installed cygwin distribution. rebooting suggested if unable find cygwin dll. java.lang.unsatisfiedlinkerror: c:\cygwin\home\juli▒n\pruebas_jni\caracterizacion.dll: se realiz▒ un acceso no v▒lido la ubicaci▒n de memoria @ java.lang.classloader$nativelibrary.load(native method) @ java.lang.classloader.loadlibrary1(unknown source) @ java.lang.classloader.loadlibrary0(unknown source) @ java.lang.classloader.loadlibrary(unknown source) @ java.lang.runtime.loadli

windows - NSIS to install ruby gems -

this function have in nsis script: function rubydependencies detailprint "installing web runtime environment dependencies..." execwait "gem install rails –v2.3.8" execwait "gem install rake –v0.8.7" execwait "gem uninstall rake –v10.0.3" execwait "rake gems:install" detailprint "dependencies installed." functionend i have tried: execwait '"gem install rails -v2.3.8" $0' and nothing displaying on $0, gem list remained empty. any help? thanks, telmo cardoso edit: i'm still having problems. i'm using: nsexec::exectolog '"$instdir\runtime\ruby\bin\gem.bat" install --ignore-dependencies --no-rdoc --no-ri rails -v=2.3.8' and generating: could not find valid gem '-v=2.3.8' and install latest one. weird being passed in parameter. when run command outside installer, works supposed. any help? the correct syntax execwait 

asp.net mvc - DropDownList with Enum Kendo UI -

i'm working on updating application use kendo ui , have run issue binding enum dropdownlist. 2 issues having 1) value not contain enum value , instead contains "today" (should 0), , 2) display value "last10days" instead of "last 10 days" in description tag. looked , couldn't find place has used kendo ui display description text , include numerical value instead of text. appreciated. view <div class="span6"> @html.labelfor(m=> m.dateranges) @(html.kendo().dropdownlistfor(m => m.dateranges) .bindto(enum.getnames(typeof(searchdateranges)).tolist()) .htmlattributes(new { value = "today" }) .datatextfield("text") .events(e => e.change("datechange"))) </div> <div class="span6"> @html.labelfor(m => m.status) @(html.kendo().dropdownlistfor(m=> m.status) .bindto(enum.getnames(typeof(searchstatuscriteria)).tolist()) .htmla