Posts

Showing posts from June, 2015

jquery - CSS transitionEnd event still listening to finished transition -

i have 2 div elements namely .parentdiv , .childdiv i using css transition animate both. .childdiv should animate opacity first on transitionend, animate .parentdiv height, call on alert check. so here code : $('.childdiv').addclass('faded').on('transitionend', function(){ $('.childdiv').off('transitionend'); $('.parentdiv') .addclass('no-height') .on('transitionend',event, function() { alert(event.propertyname); }); }); problem: after .addclass('faded') went on execute second transition (which correct). ontransitionend of .parentdiv , event.propertyname has been alerted 'opacity' , being fired .childdiv finishes transition. i want execute when height has been adjusted. don't wrong, "height" being alerted once height transition finished appears reads other transitions a

c++ - Getting value from a pair fails with: TYPENAME does not provide a call operator -

here want do. want store de data http response, headers , data. figured easy way store response , data pair. data fetched lru-cache. lru cache takes key(string) , pair. httpresponse in form of poco c++ httpresponse object. cant string second argument of pair! this->clientcache = new lrupersistentcache<string, pair<httpresponse, string > >(3,cachepath); pair<httpresponse,string> tmp = (*this->clientcache->get(headkey));// pair cout << ((string*)tmp.second()).c_str(); //should second object of pair! // gives: type std::basic_string<char> not provide call operator. writing below gives same error: cout << (*this->clientcache->get(headkey)).second().c_str(); what doing wrong here? cout << ((string*)tmp.second()).c_str(); ^^ you casting string* . should string (or nothing @ all) because second of pair<httpresponse,string> string . and second member not m

selenium webdriver - Telerik test automation find last element by class name -

in specflow acceptance test need find last element given class name, try use htmlfindexpression unable figure out correct expression. element element = webbrowser.currentbrowser.waitforelement(new htmlfindexpression("class=case-note-text"),5000, true) string value = element.innertext; stringassert.areequalignoringcase("testing", value, string.format("abc"));

Passing pointer to member function to parent in c++ -

how can make following code work? can't make members static, parent doesn't know child , don't have access boost. reason don't use virtual functions child class should able define 1-n handlers. class parent { public: void registerfilehandler(string ext, memfuncptr); }; class child : public parent { child() { registerfilehandler("jpg", &child::loadjpg); registerfilehandler("png", &child::loadpng); } void loadjpg(string filename); void loadpng(string filename); }; edit: there many answers. ones works best me use keywords erasure, std::bind , std::function of course rely on c++11. here full compilable example: #include <string> #include <map> #include <iostream> #include <functional> using namespace std; class parent { public: void load(string filename) { // see if can find handler based on extension. for(auto = handlers.begin();it!=handlers.end

jquery fancybox iframe change the href value dynamically -

i have button click , want fancybox load whatever content needed depending on checkboxes can check. checkboxes alter value of url needs displayed in iframe within fancybox. so far can work once, when change again checkboxes see url change on html fancybox won't pop @ all. here button , link fancybox: <button type="button" title="compare" class="button">compare</button> <a class="comparefancy" style="display:none;" href="#"></a> here happens when click button: jquery(document).ready(function() { jquery('.button').click(function(){ var i=0; var prdstring=""; var prdstring = jquery.map(jquery(':checkbox:checked'), function(n, i){ return n.value; }).join(','); var url='<?php echo mage::geturl('catalog/product_compare/index').'items/'; ?>'+

codeigniter - uploading file issue, error not displaying -

i trying restrict file size when user uploads. have following function: function do_upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png|jpeg'; $config['max_size'] = '50'; //$config['max_width'] = '1024'; //$config['max_height'] = '768'; $this->load->library('upload', $config); $fullimagepath; if (isset($_files['userfile']) && !empty($_files['userfile']['name'])) { if (! $this->upload->do_upload('userfile')) { $error = array('file_error' => $this->upload->display_errors()); //print_r($error); $this->load->view('layout/header'); $this->load->view('register', $error);

php - htaccess redirect incomplete task -

a couple of days ago asked question not answer have not quite, i'm sure it’s i'm missing , guys can me... here code: rewriteengine on rewritecond %{http_host} ^monitorbc\.info$ [or] rewritecond %{http_host} ^www\.monitorbc\.info$ rewriterule ^notas\.php?(.*) "https://monitorbc.info/monitor3/notas.php?" [r=301,l] # 1 of links old site = https://monitorbc.info/notas.php?id=699&sec=economia # should end = https://monitorbc.info/monitor3/notas.php?id=699&sec=economia the problem redirect reason redirect stops @ ? sign it’s not completing task. hope i’m making sense time. you can't match against query string in rewrite rule, can match against %{query_string} variable inside rewrite condition. ? have in expression gets evaluated last "p" in "php" optional. since don't seem using query string anyways. remove ? marks. default query string appended target of rule: rewriteengine on rewriteco

azure - Use ACS Management Service via c# to reimport Metadata on IdP -

i'm working on project involving adfs2.0, azure acs , umbraco cms. when create new website, , add relying party applications, , add identity provider in azure, it's supposed push settings umbraco cms also. however, connection umbraco not seem work. can't import identity provider, unless manually go azure, , reimport metadata ws-federation. idp pushed umbraco also. this reimport, c# project, can't seem find possibility ind api is there kind of explanation this, , fix/workaround? i think you're asking whether there way programmatically import federation metadata identity provider in acs. in case, answer yes, supported. make http post following url: https://[namespace].accesscontrol.windows.net/v2/mgmt/service/importfederationmetadata/importidentityprovider the contents of request must be: a management service token in authorization header (see this sample ) an http header "metadataurl" includes url metadata came a post body cont

c# - Digital Certificate Issue -

ok, let me explain situation. want simulate communication between client , server. i created self-signed certificate called "testca" , installed in trusted certification root authorities section. using self-signed certificate, created 2 other certificates, 1 name "servercert" , subject "cn=localhost:2001" , other name "clientcert" , subject name "cn=www.client.com" , installed both in personal section of certificates folder. i deployed web service in iis https using certificate subject name ["cn=localhost:2001"]. web service deployed on [localhost] , port 2001. now, when try browse web service, internet explorer gives me error: the security certificate presented website issued different website's address. security certificate problems may indicate attempt fool or intercept data send server. i don't know why giving me error since subject name of certificate ["cn=localhost:2001"] , we

bash - Remove part of the path in shell -

echo "/dir1/dir2/filename.txt" | sed ???? what should sed expression output /dir1/filename.txt if there other simpler way achieve this, welcome. you can cut : $ echo "/dir1/dir2/filename.txt" | cut -d/ -f1,2,4 /dir1/filename.txt with sed little mess: $ echo "/dir1/dir2/filename.txt" | sed 's/^\(\/.*\)\(\/.*\)\(\/.*\)/\1\3/' /dir1/filename.txt the idea portions of /text \(\/.*\) , print ones want, 1 , 3, \1\3 .

sql server - Best way to create SQL user with read only permissions? -

what best-practice create read-only user specific database? i created new user , granted db_datareader role, however, user still has access master db , other system databases. ok? or should deny access on system tables/databases make more secure? thanks. ok, if create new user, have more default permissions have deny? if ~create login ~create user login.. ~grant execute user will user have execute permissions or have additional permissions active database? hi believe user can view other database in object explorer too. create login me password = 'me', check_policy = off sp_changedbowner 'me' go use master go deny view database me go

MySQL nesting optimization -

Image
i've been trying solve 2 hours now, , can't success attached below response query: select login, sum(gain) weekly_gain gt_history is_closed = 1 , (cmd = 0 or cmd = 1) group week(close_time), login now, is, make average of values, group by login. ideas? simply use query have sub-query. select login, avg(weekly_gain) (select login, sum(gain) weekly_gain gt_history is_closed = 1 , (cmd = 0 or cmd = 1) group week(close_time), login) group login

sql - how to insert multiple values in one field? -

i have query: insert i#journal ( type_, mndnr, obj, status, reason ) values ( 'po', '0177', '000222', 'new', '1' ) this 1 works ok. instead of '1' want insert multiple values in 1 field, '1','2','3' and this: insert i#journal ( type_, mndnr, obj, status, reason ) values ( 'po', '0177', '000222e', 'new', '1,2,3' ) but how if values put there '1','2','3' ? insert i#journal ( type_, mndnr, obj, status, reason ) values ( 'po', '0177', '000222e', 'new', '1','2','3' ) so, can't change '1','2','3' (due of automation) can add before , past string. in result information in reason field should 1,2,3 how th

iphone - push notification script error -

Image
have gone through ' http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2 ' push notification. working me except when run php push.php got log 'push script started (development mode) 1 exiting fatal error: exception 'pdoexception' message 'sqlstate[28000] [1045] access denied user 'pushchat'@'localhost' (using password: yes)' in /users/iphonedev/desktop/push test/pushchatserver/push/push.php:83 stack trace: 0 /users/iphonedev/desktop/push test/pushchatserver/push/push.php(83): pdo->__construct('mysql:host=loca...', 'pushchat', 'd]682#%yi1nb3', array) 1 /users/iphonedev/desktop/push test/pushchatserver/push/push.php(36): apns_push->__construct(array) 2 {main} ' please -2 me, have spent time unable find solution. thats issue of user privileges database. add user browsing phpmyadmin , see below screenshot assistance. add pushchat username , d]682#%yi1nb

sql - Setting date end parameter to 12 months ago -

i have pull comparative data , want set reoport run automatically. to first date range use parameters =dateadd("m", -3, dateserial(year(now()), month(now()), 1)) this start date 3 months ago i.e. 1 jan 2013. =dateadd("d", -1, dateserial(year(now()), month(now()), 1)) this end date, last day of last month 31 mar 2013. i need same dates last year using =dateadd("m", -15, dateserial(year(now()), month(now()), 1)) this start date 15 months ago ie. 1 jan 2012 what use find last day of month 13 months ago, i.e. 31 mar 2012? since you've worked out 31-mar-2013, subtract year using nested dateadd functions: =dateadd("yyyy" , -1 , dateadd("d", -1, dateserial(year(now()), month(now()), 1))) this returns 31-mar-2012 .

mysqli - querying the last inserted data in sql with huge data -

i have profile table object id primary. using script import lacks of users profile table. convenience tracking object id range getting inserted in table. problem data gets inserted in random manner , not able track last object id inserted. have tried select * managed_profile order objectid desc limit 1,1; the issue is giving last data inserted. please me in this. maybe add column timestamp , use in sql order time?

C++ general tree iterator - backward paths -

Image
i'd define iterator on general tree. here example(from wikipedia) of binary one: iterator should allow me traverse tree structure in pre-order. can achieve using std::stack (get node stack, set current one, add it's children stack). but wish nodes, on "backward". nodes @ example picture should visited in following order: f, b, a, b*, d, c, d*, e, d*, b*, f*, g, i, h '*' - means node visited in backward. iterator should store information if "normal" visit, or backward one. which approach take handle that?

Calling a WCF function (with parameters by reference) from VBA code in Excel -

i have developed wcf service working. have vba code in excel wrote following guide - http://damianblog.com/2009/07/05/excel-wcf/ it working, have tested simple functions have parameters , return values - returns results correctly. need pass several parameters reference, set values in function, return. created test function: // interface... [operationcontract] int read(ref int val1, ref int val2); // implementation... public void read(ref int val1, ref int val2) { val1 = 10; val2 = 20; } i call vba module this: val1 = 0 val2 = 0 call service1.read(val1, val2) msgbox val1 msgbox val2 the values in end 20 , 0, instead of 10 , 20. is not supported have more 1 'byref' parameter or doing wrong here? p.s. interesting thing can't declare val1 integer or long because service1.read() call returns exception "type mismatch". seems work variant type. edit: ok, worked around problem returning array of objects function. this: // interface... [op

asp.net - Creation of Text file using web service in same directory using C#.net -

i want create text file using c#.net in same directory in file reside. solution? when trying create got error "access path 'c:\windows\syswow64\inetsrv\test.txt' denied". please help. thanks you not trying create file in same directory web service directory, because when create example new streamwriter("test.txt"), creates file in current working directory of process (asp.net / iis).

Windows phone 8 image uploading to windows azure -

i want upload image windows phone 8 application azure , have searched a lot , found various solutions in windows phone 7 using "phone.storage" , when try install windows phone 8 app , throw error. have tried vaious packages using nuget package manager every 1 installation faild at 'microsoft.windowsazure.configurationmanager 1.7.0.3'. install failed. rolling back... please me resolve issue, , if there exist tutorial , please share . zauk i had similar problem, reason nuget version ships vs2012 rtm doesn't support wp8. can try update nuget package manager latest version. go menu tools -> extensions , updates -> updates -> visual studio gallery -> nuget update restart.

Spring FactoryBean used before it is configured? -

i have 2 factorybeans creating proxies existing beans in application context. factorybeana.getobject() invoked part of singleton pre-instantiation, , attempts autowire returned instance. this autowiring needs bean defined factorybeanb, has not yet been configured (had properties injected). can controlled in such way, sure both factorybeans configured (properties injected) before beans attempted instantiated? edit: autowiring factorybeana objects have worked fine until changed factorybeanb require property injected. after change, see autowiring a-bean try invoke factorybeanb.getobject(), fails properties has not yet been injected. problem caused own mistake. factorybeanb not configured thought.

How does printf in c++ process the arguments that are passed to it? -

this question has answer here: why these constructs (using ++) undefined behavior? 12 answers i have been trying understand how printf processes arguments passed it. more specific can please explain how following outputs occour. int a=1; printf("%d %d %d",++a,a,a++);// outputs: 3 3 1 a=1; printf("%d %d %d",a++,a,a++);// outputs: 2 3 1 a=1; printf("%d %d %d",a,a,a++);// outputs: 2 2 1 a=1; printf("%d %d %d",a,a++,a);// outputs: 2 1 2 a=1; printf("%d %d %d",a,a,++a);// outputs: 2 2 2 the same output occurs cout statement. this code printf("%d %d %d",++a,a,a++);// outputs: 3 3 1 modifies twice in same expression. precise modifies twice without intervening sequence point . because of this code has undefined behaviour , attempt reason futile. compiler can wants, , different compilers di

sql server - Update Sql database via editing Textbox C# -

i've got winform update sql database editing 2 textbox product name , product cost, doesn't update database, here sample code private void simplebutton5_click(object sender, eventargs e) { string id = combobox2.items[combobox2.selectedindex].tostring(); string name = txtprodname.text; string cost = txtproductcost.text; cn.open(); string query = "update [product1] set [product_name]= @product_name,[product_cost]= @product_cost [product_id]= @product_id"; sqlcommand cmd = new sqlcommand(query, cn); cmd.parameters.addwithvalue("@product_id", id); cmd.parameters.addwithvalue("@product_name", name); cmd.parameters.addwithvalue("@product_price", cost); try { cmd.executenonquery(); messagebox.show("update succesfully"); } catch (exception ex) { messagebox.show(ex.message, ap

java - Reading from response body multiple times in Apache HttpClient 4.x -

i'm using apache httpclient 4.2.3 in application. store response of http call so: httpresponse httpresponse = (defaulthttpclient)httpclient.execute(httprequest); the response body inputstream in 4.x api: inputstream responsestream = httpresponse.getentity().getcontent(); my problem need read response body string , byte[] @ various points in application. inputstream used apache eofsensorinputstream, means once reach stream eof, gets closed. there anyway can string , byte[] representations multiple times , not close stream? i've tried wrapping byte array in new bytearrayinputstream , setting request body, doesn't work since response body can reach few gigs. i've tried this , noticed original response stream still gets closed. any pointers welcome. edit: on related note, great if find length of inputstream either without consuming stream or reversing consumption. 1 . think have conflicting requirements: a) it doesn't work since respon

Is raphael.js paper a real canvas? -

i researching graphics use project, , raphael.js came top contender. however, when reading sample code , documentation, shows raphael creates canvas (via paper variable on homepage ), , add stuff it. 2 months later, passerby comes , ask question our project, , explained didn't use raphael (instead chose static svg , d3) because raphael used canvas's, , our project have been disadvantaged using canvas's. raphael expert's out there, canvas in raphael actual html canvas or not? , can link it, you/and or can send pull request explain better upfront. no raphael's paper svg . it kinda strange, because paper object property called canvas contains svganimatedstring fiddle: http://jsfiddle.net/v2dgy/

python - Test if ValidationError was raised -

i want test if exception raised how can that? in models.py have function, 1 want test: def validate_percent(value): if not (value >= 0 , value <= 100): raise validationerror('error') in tests.py tried this: def test_validate_percent(self): self.assertraises(validationerror, validate_percent(1000)) the output of test is: ..e ====================================================================== error: test_validate_percent (tm.tests.models.helpers.helperstestcase) ---------------------------------------------------------------------- traceback (most recent call last): file "/...py", line 21, in test_validate_percent self.assertraises(validationerror, validate_percent(1000)) file "/....py", line 25, in validate_percent raise validationerror(u'error' % value) validationerror: ['error'] assertraises used context manager: def test_validate_percent(self): self.assertraises(validation

R add many columns by a function -

i trying cut number in layers mean next code: x <- matrix(c(6,7,9,9,9,17,19,4,12,2,3,6,7,7),ncol=2) layers <- c(5,10,15,20,25,30,35,40) partitions <- function(u) {cbind(pmin(layers[1],u),t(diff(pmin(layers,u))))} x <- cbind(x,lapply(x[,2], partitions)) the function returns integer partitioned in layers. a = a1 + a2 + .... + a8 example a <- 19 partitions(a) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 5 5 5 4 0 0 0 0 but results not have matrix need. final matrix of 7 x (2 (cols x) + 8 (num of layers in points)) [,1] [,2] [,3] [1,] 6 numeric,8 null [2,] 7 numeric,8 null [3,] 9 numeric,8 null [4,] 9 numeric,8 null [5,] 9 numeric,8 null [6,] 17 numeric,8 null [7,] 19 numeric,8 null > dim(x) [1] 7 3 i tried different forms , ever had errors of dimensions. regards one of these 2 should want > rbind(t(x),sapply(x[,2], partitions)) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,]

html - Change color scheme using BootstrapCDN -

i building website using bootstrap , getting files through bootstrapcdn. best way go modifying color scheme when using bootstrapcdn. better off not use cdn? example - want change color of links. did a{color:#000000} - want know if there better way. thanks! most simplest way. there's no harm in using bootstrap cdn. <link href="bootstrap.min.css" rel="stylesheet"> <link href="bootstrap-responsive.min.css" rel="stylesheet"> <link href="css/custom-bootstrap-override.css" rel="stylesheet"> how fallback twitter-bootstrap cdn local copy

ios - Prevent user from entering UITabBarController with login -

i have login view leads uitabbarcontroller 4 tabs. want when password empty or wrong user prompted stay in same view (the login view) , not tab bar controller. in other words want able view tab bar if password ok (non-empty , correct). possible keep showing login view until provided password correct? ideas? as understand want disable tabbar on time. if use uitabbarcontroller can use - (bool)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller shouldselectviewcontroller:(uiviewcontroller *)viewcontroller { return no; } or can disable userinteractionenabled mytabbar.userinteractionenabled = no; you can add subview uitabbarcontroller example fade out tabbar uiview *view = [[uiview alloc] initwithframe:self.view.bounds]; view.backgroundcolor = [uicolor blackcolor]; view.alpha = 0.3f; [self.tabbarcontroller.view addsubview:view]; [view release];

javascript - Send protobuf(binary) data using rabbitmq stomp -

i have create 1 example rabbitmq stomp using protobuf.js on client side. protobuf example link: https://github.com/dcodeio/protobuf.js send message file content:- var game = builder.build("game"); var car = game.cars.car; var car = new car("rusty", "mayur"); var buffer = car.encode(); var mq_username = "guest", mq_password = "guest", mq_vhost = "/", mq_url = 'http://192.168.0.14:15674/stomp', mq_queue1 = '/queue/a3'; var client = stomp.client(mq_url); function on_connect() { client.send(mq_queue1, { priority: 9}, buffer); } window.onload = function () { client.connect( mq_username, mq_password, on_connect, on_connect_error, mq_vhost ); } receive file content:- var game = builder.build("game"); var car = game.cars.car; var car = new car("rusty", "mayur"); var buffer = car.encode();

javascript - How open select file dialog via js? -

$('#id').click(); it doesn't work on chrome 26 on mac os =( the problem creation "upload" widget can integrated in form. widget consists of 2 parts. first part div initiator button , error/success messages. think way put form second part file input , submit file iframe. after submition fill hidden field in first part in main form or show errors in same. easy way adding file-form main-form, it's prohibited. fix me. using jquery i create input this <button id="button">open</button> <input id="file-input" type="file" name="name" style="display: none;" /> and jquery trigger it: $('#button').on('click', function() { $('#file-input').trigger('click'); }); using vanilla js or when don't want jquery vanilla js example (credits @pascale) <button onclick="document.getelementbyid('file-input').click();">op

android - Unlock screen appears after some delay -

in application, @ end display congratulation screen 15 seconds new activity containing single image, screen becomes black , device gets locked. now click unlock button unlock screen prompt password should come up. after unlock button clicked twice (i.e. @ least after 5 seconds), password prompt appears. what can reason delay in password prompt screen? after searching, came across links, state power saver mode activation or sd card mounting reason delay. if case, when i'm not using app, how come device doesn't face delay? any appreciated. note that if try pressing unlock button after around 10 seconds of black screen appearance, unlock screen shows immediately. finalactivity.java public class finalactivity extends activity { windowmanager.layoutparams params1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); this.getwindo

javascript - Remove draggable containment -

you can add containment dynamically this: $(this).draggable( "option", "containment", "parent" ); how remove containment again? like: $(this).draggable( "option", "containment", "none" ); except doesn't work.. not find methods in api documentation edit: want able drag item no containment. using checkboxes: var denne = $(this); if ($('#containment').is(':checked')) { $(this).draggable( "option", "containment", "parent" ); } $("#containment").each(function(){ if ($(this).prop('checked')==false){ denne.draggable( "option", "containment", false ); } }); depending on want do... you "disable" element no longer draggable. $(this).draggable( "option", "disabled", true ); or change containment boun

sql - Inserting nordic characters in database -

i want insert "special" (nordic) characters in database (ms sql 2012). the script made php, , built on codeigniter. the values looks fine until enter database, starting value testsæt ends being testsæt how fix this? codeigniter configured use utf-8, , database collation danish_norwegian_ci_as

javascript - get back a string representation from computeDigest(algorithm, value) byte[] -

Image
the google app script function computedigest returns byte array of signature. how can string representation of digest? i have tried bin2string() function. function sign(){ var signature = utilities.computedigest(utilities.digestalgorithm.md5, "thisisteststring") logger.log(bin2string(signature)); } function bin2string(array) { var result = ""; (var = 0; < array.length; i++) { result += string.fromcharcode(parseint(array[i], 2)); } return result; } but puts "" in logs if put logger.log(signature); right after call computedigest() , get: [8, 30, -43, 124, -101, 114, -37, 10, 78, -13, -102, 51, 65, -24, -83, 81] as represented in javascript, digest includes both positive , negative integers, can't treat them ascii characters. md5 algorithm, however, should provide 8-bit values, in range 0x00 0xff (255). negative values, then, misinterpretation of high-order bit; taking sign bit. correct, need add 256 negative

ios - TabBarController will hide -

is there protocol tabbarcontroller "will hide" , "will show" actions? there seems none in uitabbarcontrollerdelegate,uitabbardelegate asking because want when tabbarcontroller hides on push. thank you! there no such notifications, how ever in order register events have toggle visibility of tab bar programmatically.

html - ul list not centering in screen -

i have been looking around online , can't see reason why list not centering this html <div id="footer" class="clear"> <ul id="nav2"> <li><a href="#">contact</a></li> <li><a href="https://www.facebook.com/tcstrathclyde?ref=ts&fref=ts"><img src="images/facebook.png" /></a></li> <li><a href="#">about us</a></li> </ul> <div class="copyright"> copyright 2013 teen challenge strathcylde. rights reserved. charity no: sc022209</div> </div><!--footer--> and css #footer { width: 960px; height: 100px; margin: 0 auto; } #footer ul#nav2 { list-style: none; margin: 18px auto; } #footer ul#nav2 li { float: left; padding: 0 0 0 30px; margin: 0 100px 0 0; } #footer ul#nav2 img {position:relativ

Configure OpenEJB for testing - Add other projects EJB to classpath -

i have big project, has lot of sub-projects. for testing, i'm using openejb, , works pretty well. but now, in 1 sub-project, need ejb in sub-project. is possible force openejb load other sub-projects ejbs? how can that? i made work adding dependencies of projects needed test scope in pom.xml.

c# - Pass Enum value as CommandParameter when the Enum is in the ViewModel -

i still learning wpf binding , have been struggling while. have enum store inside viewmodel so: namespace thenamespace { public class frmsetupviewmodel { public enum locationlabeltype {location, sample} ... } } and have button pass 1 of values via commandparameter cannot figure out how work. far, these combinations have tried: //when value inside frmsetupviewmodel, these not work commandparameter="{x:static local:locationlabeltype.location}" //'type not found.' commandparameter="{x:static local:frmsetupviewmodel+locationlabeltype.location}" //'type not found.' commandparameter="{x:static local:frmsetupviewmodel.locationlabeltype.location}" //'type not found.' commandparameter="{binding {x:static local:locationlabeltype.location}}" //'value cannot null' commandparameter="{binding {x:static local:frmsetupviewmodel+locationlabeltype.location}}" //'value cannot nu

The type or namespace name 'Transactions' does not exist in the namespace 'System' (are you missing an assembly reference?) - C# ASP.NET -

we have c# asp.net web application uses system.transactions namespace. using system.transactions; this works fine when developing locally - had add reference first going website --> add reference... the problem after deploying web host (copying on ftp), host doesn't know reference. description: error occurred during compilation of resource required service request. please review following specific error details , modify source code appropriately. compiler error message: cs0234: type or namespace name 'transactions' not exist in namespace 'system' (are missing assembly reference?) working in visual web developer express 2010, don't have references folder built in. saw solution: https://stackoverflow.com/a/13035466/2178080 suggests (but doesn't recommend) copying dll application folder. i'm bit new deploying asp , not sure how include system.transactions library host can find reference. has run issue? edit: went route of copying

ruby - How to post json data with Rest API -

require 'net/http' require 'uri' postdata = net::http.post_form(uri.parse('http://localhost/restapi/index.php/api/posts'), {'id'=>9,'firstname'=>"test","lastname"=>"test"}) puts postdata.body how can send data in json form? @tosend = {"id" =>5,"firstname" => "anurag","lastname" => "arya"} i tried did not work: @tosend.to_json example: require 'rubygems' require 'net/http' require 'uri' require 'json' url = "http://localhost/restapi/index.php/api/posts" uri = uri.parse(url) data = {"id"=>11, "firstname"=>"pwd","lastname"=>"last"} headers = {'content-type' =>'application/json', 'accept-enco

entity framework - Generate pages based on title and content in ASP.net MVC3 -

i looking might not possible, leave community decide that. i have table called content, in table following: title , content . based on information user able input title , content , title page created can go site.com/title , see content page. i sure there more this, how ever that's require guy's help. not looking create cms, instead looking create piece of cms, "page generation" part. i don't have code idea , looking direction take produce code. thoughts? create route hardcoded controller takes string (the title ) parameter. in controller, use title pull content out of database. pass content view (ensuring html sanitized) , display it. routes.maproute( name: "notacms", url: "{title}", defaults: new { controller = "notacms", action = "index" } );

java - Convert OWL axiom to Manchester syntax -

is there way convert owl axiom manchester syntax? know owl-api allow parse sentence in manchester syntax owl functional syntax, need opposite. the owl-api allows read ontology written in functional syntax , convert manchester syntax. example of code write ontology file serialised in manchester syntax: file file = new file("/home/foo/bar.owl"); owlontologyformat format = manager.getontologyformat(ontology); manchesterowlsyntaxontologyformat mansyntaxformat = new manchesterowlsyntaxontologyformat(); manager.saveontology(ontology, mansyntaxformat, iri.create(file)); manager , ontology standard objects owl-api.

sql - Combining and shortening two where clause conditions -

schema: create table #exclgeokeys (xkey int); insert #exclgeokeys values (1), (2); create table #y (name char(1),xkey int); insert #y values ('a',1), ('c',2), ('d',null), ('e',3), ('f',4); can shorten following produces same result , doesn't need section or xkey null ? select * #y xkey not in ( select * #exclgeokeys ) or xkey null; use option not exists operator select * #y t not exists ( select 1 #exclgeokeys t2 t.xkey = t2.xkey ) demo on sqlfiddle option exists , except operators select * #y t exists ( select t.xkey except select t2.xkey #exclgeokeys t2 ) option not exists , intersect operators select * #y t not exists ( select

jquery - Looping over strings in JSON -

my json looks this: {"roomnolist":[{"roomno":"ml100"},{"roomno":"ml100"},{"roomno":"ml100"},{"roomno":"ml100"}]} i want loop on strings , roomno values. this should job in modern browsers: var numbers = obj.roomnolist.map(function(item) { return item.roomno; }; with jquery: var numbers = $.map(obj.roomnolist, function(item) { return item.roomno; }); see also: jquery.map() array.map()

R - using column name as argument for function inside an apply/colwise function -

i have built function determines bins numeric columns , puts output workspace, i'd able apply whole data.frame either apply or colwise function. difficulty have argument needs hold column's name , i'm unsure how go passing column name argument of function being applied? there post that's similar , answer seems have worked in specific instance i'm unsure how translate function requires name of column. thank on this! code , specifics below #setup library(caret) library(plyr) data(germancredit) germancredit<-germancredit[,-nearzerovar(germancredit)] predictors.a<-germancredit[,1:8] #function applied - note part of large of larger function equalfreqbins.derive<-function(derivedataset,characteristic,targetbins=20, minimum=0, boundarymargin=5){ stopifnot(is.numeric(targetbins),is.numeric(minimum),is.numeric(boundarymargin)) ifelse( is.numeric(derivedataset[,characteristic]) , { truebins<-quantile( deri

ToDo Lists App - Table: jQuery append() / after() /.parent().parent().remove() don't work propery or not recognized -

i'm following this, making to-do list stickynotes http://www.paulund.co.uk/create-sticky-notes-to-do-list-in-css-and-jquery i need help. jquery code not work / not recognized browser. i'm trying insert new row when user clicks 'add new' button. i pasted on jsfiddle: ** http://jsfiddle.net/rjjrt/ ** my jquery code: $(document).ready(function(){ // add button click event $("#addnew").click(function(){ addnewrow(); }); }); // add new row when add task button clicked function addnewrow(){ var numrows = $('#tasktable tr').length; $('#tasktable').append(' <tr> <td><input type="text" id="title-'+numrows+'" placeholder="your task name"/></td> <td><input type="text" id="description-'+numrows+'" placeholder="task description"/></td> <td><input type="button" class="deletebutt

javascript - Change input element with jQuery ID selection and css -

i'm trying change background color of input element function using jquery.css syntax. in function, called @ ready event, execute: $("#inputid_1").css("background-color", "red"); but color not become red. i can use: <input type='text' id=' inputid_1 ' style="background-color:blue" /> in html change color. or: $("input").css("background-color", "gray"); in javascript. ability use jquery-id selection doesn't seem work! you can find jsfiddle here . the gaps in html elements id's make difference - remove them out , work wish. so, change: <input type='text' id=' inputid_1 ' style="background-color:blue" /> <input type='text' id=' inputid_2 ' /> to <input type='text' id='inputid_1' style="background-color:blue" /> <input type='text' id='inputid_2' /

javascript - How can I replace a special character with an onclick? -

i found js function collapsible text. function toggle(id) { var e = document.getelementbyid(id); if (e.style.display == '') e.style.display = 'none'; else e.style.display = ''; } </script> and here html : ► title01 text01, text01, text01, text01, text01, text01, text01, text01, text01, what when onclick special character : &#9658; change in 1 : &#9650; , clues ? thanks in advance ! wrap speacial html character &#9658; <span> tag: <a onclick="toggle(this, 'node1')"><span>&#9658;</span> title01 </a> then can change &#9650; after showing hidden element , &#9658; when it's hidden: function toggle(elm, id) { var e = document.getelementbyid(id), = elm.getelementsbytagname('span')[0]; if (e.style.display == 'none') { e.style.display = ''; a.

angularjs - Custom message using standard validation message bubble in Angular JS -

i want create custom validator. examples of doing i've seen involve showing error message switching on span tag. i know how use standard error messaging tool tips show custom validation message custom validator. here's example of standard error message tool tips (press on button!).... <form> <input type="email" name="email" placeholder="email" required="" /> <button>save</button> </form> http://jsfiddle.net/ianian123/nnrrf/ i want create validator confirms 2 password entry boxes same if they're not, shows appropriate message inside tool tip.

extjs - Store.sync() with new record does not import server-generated fields in response -

i have grid row-editing enabled. when add row , call store.sync(), server generates fields on record, , returns full record info in response. however, extjs not seem update copy of record, except id. there way make that, or need write custom code? this excerpt of grid's controller: doneedit: function (editor, e, eopts) { var me = this; // // set loading mask on grid during update (if record changed , valid) // if (e.record.dirty && e.record.isvalid()) { e.grid.showupdatingmask(); e.store.sync({ success: me.onsavesuccess, failure: me.onsavefailure, scope: me }); } else { me.canceledit(editor, e, eopts); } }, // // onsavesuccess() used row editor grids // onsavesuccess: function (batch, options) { var me = this, grid = me.getgrid(); grid.getstore().filter([]); // re-run whatever filters exist, , sort. grid.hidemask(); // update read-only

video streaming - RTSP gstreamer pipepline to Android VideoView -

i'm trying construct gstreamer pipeline on panda rtsp video+audio android 4.1.2 app. android app uses: videoview.setvideourl(uri.parse(":rtsp://...")) to view video. on panda i've built gstreamer-0.10 (to working uvch264_src element take h.264 video logitech c920 camera) , using gst-rtsp-server/exmaples/test-launch serve video+audio via: ./test-launch 'uvch264_src do-timestamp=true mode=2 post-previews=false usage-type=1 iframe-period=2000 peak-bitrate=400000 rate-control=qp auto-start=true name=src ! queue ! video/x-h264,width=640,height=480,framerate=30/1,profile=constrained-baseline ! h264parse ! rtph264pay name=pay0 pt=96 \ alsasrc do-timestamp=true device=plughw:2,0 ! audio/x-raw-int,rate=44100 ! queue ! audioconvert ! ffenc_ac3 ! rtpac3pay name=pay1 pt=97' i can view stream on vlc (audio isn't in sync), android tablet fails play stream. if remove audio portion of pipeline: ./test-launch 'uvch264_src do-timestamp=true mode=2 post

opencart - Checking multiple conditions in PHP 'if' statement -

if($this->request->get['product_id'] == (53 || 52 || 43)){ if (file_exists(dir_template . $this->config->get('config_template') . '/template/product/product2.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/product2.tpl'; } else { $this->template = 'default/template/product/product2.tpl'; } } else{ if (file_exists(dir_template . $this->config->get('config_template') . '/template/product/product.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/product.tpl'; } else { $this->template = 'default/template/product/product.tpl'; } } i wanna achieve if product id 53 or 50 or 43 then...the same thing..but not sure correct this you can store product ids in array use in_array() function: if (in_array($this->request-&g

jquery - Disabling <select> option based on other <select> option -

how disable multiple options in select, in case exact options selected in other selects. found answered question problem similar mine on link: http://jsfiddle.net/dzqeu/ jquery code looks next: $(this).siblings('select').children('option').each(function() { if ( $(this).val() === value ) { $(this).attr('disabled', true).siblings().removeattr('disabled'); } the problem works 2 selects. need total 3 selects should disable possibility same values in selects selected. this code won't work 3 selects: http://jsfiddle.net/dzqeu/968/ tnx in advance note: when select1 set 1, select 2 set 2, can't disable values 1&2 in select3. disables value 2 in select 3... try this:- http://jsfiddle.net/z2yag/ using focus prev value , remove disabled ones. in html have added value -1 default option. <option value="-1">no match</option> var prev = -1; $("select").change(function (

sql - performing multiple separate sums with separate filters on a table -

i have table amount column reference field , id column. need sum amount based on different combinations of id's each reference. there 9 different combinations in total need insert separate table. the best way i've found use cursor , each sum separately, assign amount variable , update table each reference , each combination. hope makes sense! what hoping find out - there better way it? thanks. you like: select sum(case when (id = 9) val else 0 end) conditionalsum dbo.table you can have many of sums different conditions in 1 query.

sql server - distinct merging select results in mssql keeping order of each results -

my website sort of dictionary. when keyword searched want in both 'word' , 'meaning' column , display matches either word or meaning. select count(id) words word @keyword or meaning @keyword select * words word @keyword or meaning @keyword order word but want first show matching words , matching meanings. order not correct when separate them: select count(id) words word @keyword select * words word @keyword order word select count(id) words meaning @keyword select * words meaning @keyword order word this way there duplicates (when keyword matches both word , meaning) and when union them again order won't correct how can done? need count of distinct matching results + distinct matching results first showing matching words , matching meanings. use case statement in order clause distinguish when it's match on word: select * words word @keyword or meaning @keyword order case when word @keyword 0 else 1 end ,

ruby on rails - Trouble Getting Started with RailsSpace -

i using railsspace book learn ror haven't been able past first step - creating project. the issue believe book outdated. says run command rails rails_space once runs command not create app skeleton along folder structure book says would. furthermore when book tells me import rails_space project project created, project importing? steps import invalid can tell - read follows: go file -> new -> rails -> rails project , click next. uncheck generate rails application skeleton , create webrick server boxes. edit default location...etc." check running rails new rails_space , not rails rails_space noted. if have write permissions create app skeleton. consult this documentation if struggling.

asp.net - Internal Server Error with web.config ipSecurity -

this web.config has tags blocking ipaddress <configuration> <connectionstrings> ... </connectionstrings> <appsettings> .... </appsettings> <runtime> .... </runtime> <system.webserver> <security> <ipsecurity allowunlisted="false"> <clear/> <add ipaddress="127.0.0.1" allowed="true"/> <add ipaddress="83.116.19.53" allowed="true"/> </ipsecurity> </security> </system.webserver> </configuration> my intention block other ip except above. above ip address want website accessible . "ipsecurity" tag getting 500 - internal server error , site runs fine without it. i have made sure "ip , domains restrictions" installed on server. please let me know if missing anything. thank you. are editing config hand or through iis manage

php - Allow access to 'subdirectory' created by URL router with Apache -

i have development server website re-developing api backbone. want domain protected outside access, require valid htpasswd user on domains hosted on dev server. this causes problems though because php scripts cannot access api run application. api located @ dev.example.com/api, not actual directory because controlled php url router. have not been able allow access api apache because files not located in actual directory. tried <virtualhost *:80> servername dev.example.com documentroot /path/to/dir <location /api> order allow,deny allow satify </location> </virtualhost> this had old site's development server, worked because api wasn't controlled router located @ /path/to/dir/api . is there way allow access api outside sources (any call domain dev.example.com/api)?

bug in google drive SDK JS api (TypeError: Cannot read property 'sl' of undefined) -

a few weeks ago started noticing strange errors google client api or google drive js api (not sure which, url reference below), have increased in frequency on last few days typeerror: cannot read property 'sl' of undefined this seems affecting windows chrome - typical example of user agent our error logs mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.43 safari/537.31) from see, line .sl this: if(!this.b.headers.authorization){var f=(0,_.hx)(_.p,_.p);f&&f[_.ak.pl.sl]&&(c=f[_.ak.pl.sl].split(/\w+/))} this comes https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.ustvednxb7o.o/m=client/rt=j/sv=1/d=1/ed=1/am=uq/rs=aitrstom1ks5pzveepzkn9qqjeuqzc_qjw/cb=gapi.loaded_0 i know intentionally cryptic, it's beyond me suggest how fix it, appreciate if looks frequency seems increasing. perhaps guard around _ak.pl check if it's not null before executing .sl ? i managed resolve problem reporte

titlebar - How do I make Visual Studio 2012's title bar change color on selection? -

with visual studio 2012, microsoft has apparently abandoned useful ui convention of "having visual distinction whatsoever between selected , unselected window, user can tell hell input appear when start typing". there way fix this? after asking around office, discovered changeable in theme editor extension. microsoft calls title bar "main window -> caption", ensure setting impossible find.

ruby on rails - Integration test best practices -

i looked in stackoverflow , fine one or two questions have similar title one, none of answers i'm asking. sorry if duplicated. in unity tests, there guideline says " one assertion per test ". reading around stackoverflow , internet, commonly accepted rule can relaxed bit, every unit test should test 1 aspect of code, or 1 behavior. works because when test fails can see failed , fixing test not fail again in other point in future. this works rails unit tests, , have been using functional testing without problem. when comes integration tests, implicit should have many assertions in tests. apart that, repeat tests done once in functional , in unit tests. so, considered practices when writing integration tests in these 2 factors: length of integration tests : how measure when integration test should splited in two? number of requests? or larger better number of assertions on integration tests : should repeat assertions presented on unit tests , functional test

Find documents with arrays not containing a document with a particular field value in MongoDB -

i'm trying find documents not contain @ least 1 document specific field value. example here sample collection: { _id : 1, docs : [ { foo : 1, bar : 2}, { foo : 3, bar : 3} ] }, { _id : 2, docs : [ { foo : 2, bar : 2}, { foo : 3, bar : 3} ] } i want find every record there not document in docs block not contain @ least 1 record foo = 1. in example above, second document should returned. i have tried following, tells me if there don't match (which returns document 1. db.collection.find({"docs": { $not: {$elemmatch: {foo: 1 } } } }) update: query above work. many times happens, data wrong, not code. i have looked @ $nin operator examples show when array contains list of primitive values, not additional document. when i've tried following, looks exact document rather foo field want. db.collection.find({"docs": { $nin: {'foo':1 } } })

sockets - pselect problems with FD_ISSET on cygwin -

i'm running cygwin , use pselect monitor socket , filedescriptors child processes. according example found here http://www.linuxprogrammingblog.com/code-examples/using-pselect-to-avoid-a-signal-race , man pages pselect should return number of filedescriptors set in mask fields ( http://linux.die.net/man/2/pselect ). now when connect server pselect returns, fine. when test filedescriptors using fd_isset return true: fd_zero(&readers); fd_zero(&writers); fd_zero(&exceptions); fd_set(fileno(stdin), &readers); fd_set(socket, &readers); pret = pselect(fd_setsize, &readers, &writers, &exceptions, null, &msignalmask); , &readers, &writers, &exceptions, null, &msignalmask); if(pret <= 0) { // ignore continue; } if(fd_isset(fileno(stdin), &readers)) { string s; cin >> s; cout << "stdin: " << s << endl; // blocks because code gets here when // ps

javascript - Jquery slide left to right makes div jump up on slide -

i'm trying create effect when link clicked makes initial div slide left , reveal second div sliding left , when link clicked second div div slides right first div sliding right well. here code far html <div id="box1"> <a href="#" id="click1">click show other div</a> <br> ut accumsan dignissim lorem non posuere.aliquam iaculis nibh ultricies sem amet.class aptent taciti sociosqu ad posuere. </div> <div id="box2" style="display:none"> <a href="#" id="click2">click show other div</a> <br> ut accumsan dignissim lorem non posuere.aliquam iaculis nibh ultricies sem amet.class aptent taciti sociosqu ad posuere. </div> js $(document).ready(function () { $('#click1').click(function () { $('#box1').hide("slide", { direction: "left" }, 1000); $

angularjs - Angular Service "undefined" after first run -

so readingcontroller calls getromanization in main body first time , in turn calls romanize factory service (shown below controller). works fine fist time second time when round when getromanization called @ end of checkromanization romanize service comes undefined in chrome. happens romanize service? why run once? please me have been stuck ages. var readingcontroller = function ($scope, romanize){ $scope.getromanization = function(romanize){ $scope.currentmaterial = $scope.sections[$scope.sectionnumber].tutorials[$scope.tutorialnumber].material[$scope.questionnumber]; romanize.get($scope.currentmaterial).then(function(d){ $scope.romanized = d; }); $scope.$apply(); }; $scope.getromanization(romanize); $scope.$apply(); $scope.checkromanization = function(userromanization){ if ($scope.romanized === userromanization){ $scope.questionnumber++; $scope.getromanization(); }; }

sql - MyBatis doesn't return all the results from the query -

the problem i have query returns 17 records. when use mybatis map has <association> returns 6 records. note doesn't happen other maps, have many other maps associations work fine. query: leave_counts ( select leave_type_id, count(llm.leave_id) count lw_leave_master llm group leave_type_id ) select llt.leave_type_id, llt.leave_type_abbr_tx, llt.leave_type_desc_tx, lc.count count_nm lw_leave_type llt join leave_counts lc on lc.leave_type_id=llt.leave_type_id order llt.leave_type_abbr_tx map: <resultmap id="typecountmap" type="mypackage.myclass"> <result property="count" column="count_nm"/> <association property="type" resultmap="package.mymap"/> </resultmap> <resultmap id="mymap" type="mypackage.myclass2"> <result property="id" column="leave_type_id"