Posts

Showing posts from March, 2011

java - How to Test a Database connection with spid? -

if have username, password , jdbc connection url. test db connection using:- drivermanager.getconnection(connectionurl,username,password); but, in case have jdbc url , pksd. how test db url , spid in java? here pksd kind of certificate authentication. it depends on see 'testing database'. want check if server responds incoming connections? can test using jdbc url. open connection (maybe random username/password combination) , see if server responds 'access denied' error or something. if timeout or other connection error, went wrong. if want execute specific query , result of query important test (so query has executed properly), way can test when know username/password can log in sql server , thing. option enable anonymous access database (possibly limited privileges), should think twice before doing this. also, doing fallback possible: drivermanager.getconnection(connectionurl);

xml - Limit number of occurences of an element based on an attribute value -

i have xml looks this: <artifacts count="2"> <artifact> ... </artifact> <artifact> ... </artifact> </artifacts> i looking way enforce number of artifact elements contained in artifact s shall equal value of "count" attribute using xsd schema. even though found possible ways achieve using xsd 1.1 specification, wonder if @ possible without it, i.e based on xsd 1.0 specification. edit: try provide little more context question in order more precise. xml file provided input c++ application. problem development environment enforces usage of xerces v. 2.8.0 library parsing. understanding version not support xsd 1.1 standard. of course, can add code in order check correct number of occurrences of artifact elements after xsd validation. hoping there way avoid code segment , validate input file based on xsd alone. the correct term kind of constraint you'd model assertion . no, assertions not

c++ - Why do I get a segmentation fault when adding ltalloc with MinGW -

i tried build application ltalloc . tried mingw32 4.9.1 , mingw64-32 4.9.2. compiles , links fine when run segmentation fault occurs. debugging pinpointed problem following code: #include <pthread.h> #pragma weak pthread_once #pragma weak pthread_key_create #pragma weak pthread_setspecific static pthread_key_t pthread_key; static pthread_once_t init_once = pthread_once_init; static void init_pthread_key() { pthread_key_create(&pthread_key, release_thread_cache); } static thread_local int thread_initialized = 0; static void init_pthread_destructor()//must called when block placed thread cache's free list { if (unlikely(!thread_initialized)) { thread_initialized = 1; if (pthread_once) { pthread_once(&init_once, init_pthread_key); // <--- causes segsegv pthread_setspecific(pthread_key, (void*)1);//set nonzero value force calling of release_thread_cache() on thread terminate } } } as far know

Python putting r before unicode string variable -

for static strings, putting r in front of string give raw string (e.g. r'some \' string' ). since not possible put r in front of unicode string variable, minimal approach dynamically convert string variable raw form? should manually substitute backslashes double backslashes? str_var = u"some text escapes e.g. \( \' \)" raw_str_var = ??? if need escape string, let's want print newline \n , can use encode method python specific string_escape encoding: >>> s = "hello\nworld" >>> e = s.encode("string_escape") >>> e "hello\\nworld" >>> print s hello world >>> print e hello\nworld you didn't mention unicode, or python version using, if dealing unicode strings should use unicode_escape instead. >>> u = u"föö\nbär" >>> print u föö bär >>> print u.encode('unicode_escape') f\xf6\xf6\nb\xe4r your post had regex tag, m

xcode - libcrypto.a symbol(s) not found for architecture i386 -

xcode 6.3 beta i'm using libcrypto.a in project. my app can compile , run on ipod touch5 (armv7). but when try run app on iphone5 simulator, i'm getting error: "_closedir$unix2003", referenced from: _openssl_dir_end in libcrypto.a(o_dir.o) "_fputs$unix2003", referenced from: _write_string in libcrypto.a(ui_openssl.o) _read_string in libcrypto.a(ui_openssl.o) "_opendir$inode64$unix2003", referenced from: _openssl_dir_read in libcrypto.a(o_dir.o) "_readdir$inode64", referenced from: _openssl_dir_read in libcrypto.a(o_dir.o) ld: symbol(s) not found architecture i386 then checked architectures libcrypto.a i'm using support using command: lipo -info libcrypto.a and result: architectures in fat file: libcrypto.a are: i386 armv7 armv7s arm64 any advice appreciated, :) create new m file anywhere. , define missing function here: #include <stdio.h> #include &

wso2 - How to keep the end point state active permanently irrespective of the end point is up or down? -

how keep end point state active permanently irrespective of end point or down. if timeout occurs endpoint suspended 30000ms(defualt).so in suspension time if request endpoint comes, esb ignore request.so disabling endpoint suspension keep endoint state active always. check post[1] on how disable suspension time. http://miyurudw.blogspot.com/2012/02/disable-suspension-of-wso2-esb-synapse.html

linux - Assembler - adding big (128b) numbers (AT&T assembly syntax) - where to store results? -

i trying add 2 128 bits numbers using att assembly syntax in linux ubuntu 64b , debugging in gdb know after every loop result of adding 2 parts correct how store 4 results together?? considering adding every result stack can't add register content stack, right? doing correctly? real beginner in assembler need uni :/ exit_success = 0 sysexit = 1 number1: .long 0x10304008, 0x701100ff, 0x45100020, 0x08570030 number2: .long 0xf040500c, 0x00220026, 0x321000cb, 0x04520031 .global _start _start: movl $4, %edx clc pushf _loop: dec %edx movl number1(,%edx,4), %eax movl number2(,%edx,4), %ebx popf adcl %ebx, %eax cmp $0, %edx jne _loop popf jnc _end push $1 _end: mov $sysexit, %eax mov $exit_success, %ebx int $0x80

nhibernate - 'Bulk insert' for cascaded list -

i have object cascaded list mapped in following way: hasmany(x => x.products).cascade.alldeleteorphan(); //.batchsize(10000); after adding 20000 products list, commit takes more 30 seconds (while should max 3 seconds). what need kind of bulk insert. follow approach: speed bulk insert operations nhibernate . know solution uses statelesssession anyway, hope configure these things in mapping, adding objects directly list in entity , nhibernate takes care of remaining stuff. setting batchsize on mapping of list seems has no effect. is there way accomplish task in acceptable time? i think batch size in mapping related fetching. can try using configuration in nhibernate config: <property name="adonet.batch_size">250</property>

asp.net web api - web api default action selector -

i have web api 1 in project. can't use web api 2. route config config.routes.maphttproute( name: "images api", routetemplate: "api/objects/{objectid}/{controller}/{action}", defaults: new { controller = "images" }); i post request hit post action of imagescontroller (action named post), , request hit method named get. in both cases 404. i'm missing? this solution: config.routes.maphttproute( name: "images api", routetemplate: "api/objects/{objectid}/{controller}", defaults: new { controller = "images" }); just excluded action routetemplate.

scala - How to transpose an RDD in Spark -

i have rdd this: 1 2 3 4 5 6 7 8 9 it matrix. want transpose rdd this: 1 4 7 2 5 8 3 6 9 how can this? say have n×m matrix. if both n , m small can hold n×m items in memory, doesn't make sense use rdd. transposing easy: val rdd = sc.parallelize(seq(seq(1, 2, 3), seq(4, 5, 6), seq(7, 8, 9))) val transposed = sc.parallelize(rdd.collect.toseq.transpose) if n or m large cannot hold n or m entries in memory, cannot have rdd line of size. either original or transposed matrix impossible represent in case. n , m may of medium size: can hold n or m entries in memory, cannot hold n×m entries. in case have blow matrix , put again: val rdd = sc.parallelize(seq(seq(1, 2, 3), seq(4, 5, 6), seq(7, 8, 9))) // split matrix 1 number per line. val bycolumnandrow = rdd.zipwithindex.flatmap { case (row, rowindex) => row.zipwithindex.map { case (number, columnindex) => columnindex -> (rowindex, number) } } // build transposed matrix. group , sort column in

xcode - WatchKit Upload -

Image
i trying submit watchkit app t itunesconnect. click "archive" , validate , shown message below. have created app id app, extension , watchkit app distribution profiles. going wrong? thanks to sign watch app, need 3 different app ids , each app id needs provision profile. go developer member center add/edit 3 app ids: one main app bundle, may need add entitlements need, app groups , keychain access group . one watchkit extension bundle, may need add entitlements need. one watchkit app bundle. no entitlements needed. delete distribution provision profiles 3 app ids, if exists. add 3 new distribution provision profiles 3 app ids. now go xcode, open preference , go accounts . choose apple id, click view details on bottom right. click refresh button on bottom left, wait list of provision profiles change. in build settings targets, configure code signing part below. try archive again. when submit app, xcode ask confirm provision profile

java - Jackson: different XML and JSON format -

in apache wink based rest project, using jackson jax-rs providers handling both json , xml content type. our response object contains hashmap<string, propertyobject> . map key contains whitespaces , hence can't serialized xml element names. json serialization works fine. json format: { "properties": { "a b c": { "name": "a b c", "type": "double", "value": "2.0" }, "x y z": { "name": "x y z", "type": "double", "value": "0.0" } } } desired xml format <rootelement> <property name="a b c" type="double" value="2.0"> <property nam

calculate Dynamicaly height of DOM in AngularJS -

i want measure height of dom element in angularjs when dom load complete. myapp.directive('domheight',['$timeout',function($timeout){ return{ restrict:'ea', scope:true, link:function(scope,element,attrs){ $(document).ready(function(){ $('.required-wrapper').load(function(){ console.log( $('.required-wrapper').height()); }) }) } } }]) **above code trigger height before dom load ** i try use $timeout this not tested $('.required-wrapper').load(function(){ $timeout(function() { //as far know there no event notify loaded dom has rendered //so use timeout instead console.log( $('.required-wrapper').height()); }, 100); })

java - How to alter dependencies for a generated artifact? -

gradle 2.3; shadow plugin 1.2.1. in build.gradle, use shadow plugin in order repackage dependency, such: shadowjar { relocate("com.google.common", "r.com.google.common"); } i add shadow jar list of artifacts publish: artifacts { archives jar; archives sourcesjar; archives javadocjar; archives shadowjar; } however list of dependencies of shadow jar still contains dependencies of "normal" jar, though has every dependency builtin. is intended behavior? how can make shadow jar exclude or dependency? here @ work had same problem , put in build.gradle of 1 of our projects: def installer = install.repositories.maveninstaller def deployer = uploadarchives.repositories.mavendeployer [installer, deployer]*.pom*.whenconfigured { pom -> pom.dependencies.retainall { it.groupid == 'our.group.id' && it.artifactid == 'some-api' } } this removes dependencies pom.xml except depend

How do I iterate over a hashtable in F#? -

let dic = environment.getenvironmentvariables() dic |> seq.filter( fun k -> k.contains("comntools")) fails compile. i've tried using array.filter, seq.filter, list.filter i've tried getting dic.keys iterate on f# doesn't seem want me coerce keycollection ienumerable . i've tried upcasting hashtable ienumerable<keyvaluepair<string,string>> how walk hashtable returned environment.getenvironmentvariables() ? since environment.getenvironmentvariables() returns non-generic idictionary , stores key/value pairs in dictionaryentry , have use seq.cast first: let dic = environment.getenvironmentvariables() dic |> seq.cast<dictionaryentry> |> seq.filter(fun entry -> entry.key.tostring().contains("comntools")) see relevant docs @ https://msdn.microsoft.com/en-us/library/system.collections.idictionary(v=vs.110).aspx . notice entry.key of type obj , 1 has convert string before checking string contai

javascript - Expected response to contain an object but got an array for GET action -

i'm getting error " error: [$resource:badcfg] error in resource configuration action 'get'. expected response contain object got array " and don't know how fix it. have service angular.module('messages').factory('messages', ['$resource', function ($resource) { return $resource('api/messages/:username', { username: '@username' }); }]); and in controller: $scope.findone = function () { $scope.messages = messages.get({ username: $routeparams.username }); console.log($scope.messages); }; for route have in api controller this exports.read = function (req, res) { res.json(req.message); }; i know have use $resource action isarray = true, don't know put it. tried this: angular.module('messages').factory('messages', ['$resource', function ($resource) { return $resource('api/messages/

swift - Why core data doesn't delete related objects? -

entities driver , car in 1:many relationship. in driver entity in relationship table have relationshipname, car , no inverse when open table graph style in xcode between entities there 2 arrows on car entity , no arrows on driver entity. code deleting object: let somecar:nsmanagedobject = ... let ed = nsentitydescription.entityforname("driver", inmanagedobjectcontext: context!); managedobjectcontext?.deleteobject(somecar); context?.save(nil); but delete driver car intact. reason not deleting related objects?

java - Pattern.split slower than String.split -

there 2 methods: private static void normalsplit(string base){ base.split("\\."); } private static final pattern p = pattern.compile("\\."); private static void patternsplit(string base){ //use static field above p.split(base); } and test them in main method: public static void main(string[] args) throws exception{ long start = system.currenttimemillis(); string longstr = "a.b.c.d.e.f.g.h.i.j";//use long string for(int i=0;i<300000;i++){ normalsplit(longstr);//switch patternsplit see difference } system.out.println((system.currenttimemillis()-start)/1000.0); } intuitively,i think string.split call pattern.compile.split (after lot of work) real thing. can construct pattern object in advance (it thread safe) , speed splitting. but fact is, using pre-constructed pattern much slower calling string.split directly. tried 50-character-long string on them (using myeclipse), direct call consumes half t

typedef an array with const elements using const ArrayType or ConstArrayType in c++ -

i going define arrays fixed size , const elements. tried use typedef , there seems confused: typedef int a[4]; typedef const int ca[4]; const a = { 1, 2, 3, 4 }; ca ca = { 1, 2, 3, 4 }; a[0] = 0; ca[0] = 0; = ca; ca = a; all assignments cause syntax error in code above think a[0] = 0; should legal before test. considering pointers, result easier understand p[0] = 0; , cp = p; correct. typedef int *p; typedef const int *cp; const p p = new int[4]{ 1, 2, 3, 4 }; cp cp = new int[4]{ 1, 2, 3, 4 }; p[0] = 0; cp[0] = 0; p = cp; cp = p; why cv-qualifier behave different on pointer , array? because array has been const pointer, compiler makes implicit conversion? p.s. compiled code on visual studio 2013. these 2 declarations const a = { 1, 2, 3, 4 }; ca ca = { 1, 2, 3, 4 }; are equivalent , declare constant arrays. if run simple program (for example using ms vc++) #include<iostream> typedef const int ca[4]; typedef int a[4]; int main() { st

linux - Unix (ksh) script to read file, parse and output certain columns only -

i have input file looks this: "level1","cn=app_group_abc,ou=dept,dc=net","uid=a123456,ou=person,dc=net" "level1","cn=app_group_def,ou=dept,dc=net","uid=a123456,ou=person,dc=net" "level1","cn=app_group_abc,ou=dept,dc=net","uid=a567890,ou=person,dc=net" i want read each line, parse , output this: a123456,abc a123456,def a567890,abc in other words, retrieve user id "uid=" , identifier "cn=app_group_". repeat each input record, writing new output file. note column positions aren't fixed, can't rely on positions, guessing have search "uid=" string , somehow use position maybe? any appreciated. you can use awk split in columns, split ',' , split =, , grab result. can awk -f, '{ print $5}' | awk -f= '{print $2}' take @ line looking @ example provided: cat file | awk -f, '{ print $5}' | awk -f= '{print

r - Quantiles and data interval for comparison -

i have question regarding use of quantiles determining enveloppe of curve. doing: have continuous variable ("var") turned discrete using cut ("var_cut"), , related variable obtained the continuous variable ("modvar"). i'm doing plotting modvar~var_cut , , want have sense of variability of modvar . here method chose: #df containing var , modvar structure(list(var = c(0.1968, 0.2263667, 0.1769, 0.2318, 0.2001333, 0.2382667, 0.2005, 0.2022667, 0.1699333, 0.2115667, 0.212, 0.2218667, 0.2327333, 0.2224333, 0.1690333, 0.1961333, 0.1756667, 0.2268333, 0.1938667, 0.1983, 0.1914333, 0.1745333, 0.2382, 0.2068333, 0.2509333, 0.221, 0.2075667, 0.2475333, 0.2463333, 0.2354, 0.2335, 0.2382, 0.2636667, 0.1829667, 0.2180333, 0.1703333, 0.2177333, 0.1932667, 0.2281, 0.1960667, 0.1975333, 0.1640333, 0.2021667, 0.2044333, 0.2124, 0.2267, 0.2202333, 0.1648667, 0.1898, 0.168, 0.2225, 0.1899667, 0.1966667, 0.183, 0.16786

production environment - Shared java HashMap in a clustered enviroment -

i've client application requesting information url every 1 second. in server (a servlet & jsp application), in order avoid db access when it's not necessary, it's been implemented next solution. here's snippet: //a static hashmap save last record inserted in db public static map<long, long> values = new hashmap<long, long>(); // lastrecordread sent client if (values.get(id) != lastrecordread) { //access database information //cause last value read different last record inserted ... }else{ //do nothing //it's not necessary access db cause parameters match } this working expected in development environment. the problem comes when have clustered environment. have server deployed in 2 nodes (using jboss), each 1 own hashmap, , own values. depending on node attack, can different values... ¿is there way share hashmap between 2 nodes? looking answer don't need keep 2 maps updated, meaning not calls between nod

PHP Ignoring all but last array element -

i'm playing around basic php site own knowledge , have text file filled "passwords". i've opened text file array page, when search specific element, password shows valid last option, , seems ignore every other element in array. so if password list is passwords 12345 test qwerty when search first 3 elements, says not exist in array. however, if searched last value, 'qwerty' here, match. <?php $file = explode("\n", file_get_contents("passwords.txt")); //call function , pass in list if (isset($_post['submit_login'])) { //set search variable $search = $_post['password']; search_array($file, $search); } else { //echo "you did not search! <br />"; //echo "<a href='searchform.html'>try again?</a>"; } function search_array($array_value, $search_query) { echo "<span><h4>the array list: </h4><span/&

html - Mobile stacking for dotmailer 3 column easy editor - doesn't work on iphone -

i'm using dotmailer 's easy editor create responsive template , going until hit 3 column element need stack. refuses render on iphone! code below, ideas please! <table class="ee_element ee_borders ee_contains_bdr" style="table-layout: auto;" cellspacing="0" cellpadding="0" data-eewidth="600"><tbody><tr><td class="ee_pad ee_bdr" style="padding: 0px; border-top-color: rgb(29, 44, 112); border-top-width: 4px; border-top-style: solid;"><table class="eebdrtbl" style="table-layout: auto;" cellspacing="0" cellpadding="0"><tbody><tr><td class="eeb_width" style="width: 600px;"><table width="100%" class="ee_spacer eev_element" style="width: 600px; table-layout: auto;" border="0" cellspacing="0" cellpadding="0" data-eewidth="600" ee

git - How can I, in one command, create or update a remote? -

i don't know whether remote called origin exists. command git remote add origin gti@gtihub......git throws error fatal: remote origin exists i need add origin remote if not exists, , update if exists. how can in 1 command? (for information, use git version 1.7.3.4.) also, difference between: git remote add origin gti@gtihub......git git remote set-url origin gti@gtihub......git git remote set-url --add origin gti@gtihub......git does 1 of commands want? [...] difference between [...] git remote add <name> <url> adds remote named <name> repository @ <url> . git remote set-url <name> <url> sets url remote called <name> <url> . git remote set-url --add <name> <url> adds new (push) url remote called <name> ; that's not want do. the first command throws error if remote called <name> exists, whereas last 2 commands throw error if no remote called <name>

c# - Move File To Sub-Directories -

moving files easy & clear in .net gets me how move sub-directory example, let's have file in source destination called joe_2.mp3, , need move destination directory , modified sub-folder if 1 exists. if not move straight destination directory. how 1st check sub-directories & if exist find modified 1 , move source file their? this using when straight move directory1 directory2 private string source = @"c:\\first\\"; private string unclear = @"c:\\second\\"; public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { directoryinfo firstcheck = new directoryinfo(@"c:\\first\\"); directoryinfo secondcheck = new directoryinfo(@"c:\\second\\"); ienumerable<string> list1 = firstcheck.getfiles("*.*").select(fi => fi.name); ienumerable<string> list2 = secondcheck.enumeratefiles("*", searchoption.alldirectories).select(fi => fi.name); ienumer

.net - Detect Mouse Hook -

i have application launches problem steps recorder utility ships windows 7 , later records user mouse , keyboard interactions. creating new process instance , launching psr number of command line parameters, including 1 suppresses gui. my app needs wait until utility has set mouse hook before proceeding. i'm able wait until i'm process has started successfully, utility not expose sort of event when has started recording. no gui, process.waitforinputidle() can't tell me when i'm ready proceed either. is there way detect when new low level mouse hook has been set third party application?

c# - Running applications in Run and RunOnce Registry programmatically -

i have developed custom shell written in wpf/c# replaces explorer.exe shell on windows 8.1 system. runs fine, except run applications in run/runonce registry locations. main issue there seems no standard way of putting entries in registry - have double-quotes around entries, don't; run through rundll32 , have entry point defined followed comma-separated arguments; have space separated arguments; have few executables in 1 entry. there service or executable can call run these entries, or stuck trying figure out way parse best possible , using process.start()? thanks help! i had similar project @ work. following code more-or-less wrote. can't guarantee it's foolproof seemed work registries tested against. public static class processhelper { const string registrysubkeyname = @"software\microsoft\windows\currentversion\run"; public static void launchstartupprograms() { foreach (string commandline in getstartupprogramcomm

iis 8.5 - Cannot get authentication working in IIS 8.5 -

we have installed basic , windows authentication iis 8.5 on our windows 2012 server cannot server prompt client credentials. under "authentication" feature have 2 options (despite restarting iis numerous times): anonymous authentication: disabled asp.net impersonation: disabled when set anonymous disabled 401 no authenticate headers. when enable 200 anonymous. we've tried sorts of settings in web.config , here current situation: <system.web> <authentication mode="windows" /> <authorization> <deny users="?"/> </authorization> </system.web> solved running iis admin console administrator (thanks question #8067448). reason new authentication options (basic , windows) appear , enabled. sheesh microsoft!

tomcat6 - Update Tomcat to point at custom domain -

to navigate local tomcat installation use http://localhost:8080 can tomcat configured when run locally still navigates http://localhost:8080 can specify different host name ? e.g when navigate http://<machine_name>.com:8080 redirects http://localhost:8080 . this local development. think may need modify hosts file : http://en.wikipedia.org/wiki/hosts_%28file%29

Magento recently viewed products not working -

i facing problem showing viewed products in product page. here local.xml code: <catalog_product_view translate="label"> reference name="root"> <action method="settemplate">page/1column.phtml <block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/></block></reference> here footer.phtml code: <div class="footer-container"> <div class="footer"> <?php $manipage = $this->geturl(''); $currenturl = mage::helper('core/url')->getcurrenturl(); $url = mage::getsingleton('core/url')->parseurl($currenturl); if ($manipage == $currenturl){ echo $this->takecategory(12,1) /*12 = brands category 1 = show images*/ ; } ?>

ember.js - Filter values in the controller -

Image
i want filter products depending of selected category can selected drop-down menu. products belongto category what have change in controller filter products depending of chosen value of drop-down menu? how can add empty field in drop-down menu , display products when chosen? here current ember cli code: app/routes/index.js import ember 'ember'; export default ember.route.extend({ model: function() { return { categories: this.store.find('category'), products: this.store.find('product') }; } }); app/controllers/index.js import ember 'ember'; export default ember.controller.extend({ selectedcategory: null, categories: function(){ var model = this.get('model.categories'); return model; }, products: function(){ var model = this.get('model.products'); return model; }.property('selectedcategory') }); app/templates/index.hbs <p> {{view "select&qu

MySQL Query with PHP and Send Data to JavaScript -

edit: i have number input id on it. in mysql database, have table ids , list of options separated commas id. i'll take 1 of database records example: id "ham_and_cheese" , options "mayonnaise, salad cream, chutney, no dressing". person selects 1 on number input id "ham_and_cheese". then, 1 drop down appear options: "mayonnaise, salad cream, chutney, no dressing" (each own option). if choose 2, 2 dropdowns appear, 3 3 appear, etc. i new ajax great if me out. my new code: ... <td><input type='number' min='0' max='5' name='ham_and_cheese_amount' /></td> ... <td id='ham_and_cheese_dressing'></td> ... function changedropdown(name, amount){ //gets id. var newname = name.replace("_amount", ""); //gets div drop down go in. var el2 = document.getelementbyid(newname + "_dressing"); //if number 0 selected in num

comparing python datetime to mysql datetime -

i'm complete beginner, have test mysql db set up. trying check if backup start time listed in database before 12pm on current day. time entered table using following: update clients set backup_started=now() id=1; what trying is: now = datetime.datetime.now() today12am = now.replace(hour=0, minute=0, second =0,) dbu.cursor.execute('select id, company_name, backup_started,\ backup_finished clients backup_started>' + today12am) data = dbu.cursor.fetchone() print (data) i understand trying compare datetime.datetime string , having problems. question best way accomplish this? error: typeerror: cannot concatenate 'str' , 'datetime.datetime' objects make query parameterized : dbu.cursor.execute(""" select id, company_name, backup_started, backup_finished clients backup_started > %s""", (today12pm, ))

How to access repo directory in a Perl program in Openshift? -

i hit 404 error when use following code in index.pl (i create 1 perl app in account) my $hello_link = "$env{'openshift_repo_dir'}hello.pl"; click <a href="$hello_link"><font color="ff00cc">here</font></a> run hello world cgi.</br> when log web autortl-rdlgen.rhcloud.com , click on ¨here"to run hello program. error message showed not found the requested url /var/lib/openshift/550f4df1fcf933b971000030/app-root/runtime/repo/hello.pl not found on server. i have uploaded hello.pl repo directory , can find after ssh account: [autortl-rdlgen.rhcloud.com repo]\> ls -tr hello.pl hello.pl you need use relative link "./hello.pl" instead of using other link env variable, showing complete filesystem path perl file. you may want check out perl tutorials started perl web programming: http://www.tutorialspoint.com/perl/perl_cgi.htm

Gigya socialize.removeConnection cannot remove last connected account -

as in documentation in removeconnection found 2 flags need: removeloginid: if social identity being removed last social identity , associated login id last login id. in case operation fails without removing anything. lastidentityhandling: determines how handle attempts remove last login identity. may either "soft" or "fail" : "soft" - indicates gigya remove stored information related connection, except mapping between user account , social user. way gigya deletes information user account remains accessible if user ever tries login again using same social identity. using 2 flags trying remove connections exists account. lastidentityhandling:soft removeloginid:true when trying remove first 1 - ok, when last - returns {"errormessage": "not supported", "errordetails": "last identity cannot removed", ... } do have ideas go? it seems request didn't fulfi

javascript - Incorrect mouse event zooming in windows surface using easeljs / createjs -

i have website uses createjs , canvas. objects have associated click event. works in browsers , mobile devices, except in windows surface. if zoom in windows surface click event lost when screen moves. works when matched (0,0) screen. example: http://intelisen.com/apok/simple.html zooming , moving no longer works circle click event. any suggestions? thank you

python - How do I load an index (Dow, Nasdaq) with Zipline? -

loading individual stocks no problem struggeling loading stock indexes while thought should share. if want load index zipline add stock parameter this: data = load_from_yahoo(stocks=['aapl', '^gspc', '^ixic'], indexes={}, start=datetime(2014, 1, 1), end=datetime(2015,4,2)) this load both apple's stock prices, nasdaq composite , s&p500.

testing - C# Web Service Unit Tests -

i have following entity: amount currency - string value - decimal i have wcf service uses entity , want make unit test class. my problem want test invalid values value in entity , if try assign in in c# amout m = new amout{currency = "eur", value = "aaaa"} gave error. how can test situation? for example can make following request in soapui: <itc1:amount> <itc2:currency>eur</itc2:currency> <itc2:value>aaaaaa</itc2:value> </itc1:amount> and error service. i want make same unit test. i hope can me. are looking : [testmethod()] [expectedexception(typeof(knownexceptiontype))] public void test() { //do throws knownexceptiontype }

javascript - jQuery throws uncaught error on smarty code -

i have following error message uncaught error: syntax error, unrecognized expression: [value={if isset($smarty.post.id_state)}{$smarty.post.id_state|intval}{/if}] which originating code: $('.id_state option[value={if isset($smarty.post.id_state) {$smarty.post.id_state|intval}{/if}]').prop('selected', true); i not sure why throws such error, since code following (literallly next line) works charm the following code works normally $('.id_state_invoice option[value={if isset($smarty.post.id_state_invoice)}{$smarty.post.id_state_invoice|intval}{/if}]').prop('selected', true); your code: {if isset($smarty.post.id_state) {$smarty.post.id_state|intval}{/if} needs be: {if isset($smarty.post.id_state)}{$smarty.post.id_state|intval}{/if}

php - Composer: Prefer VCS Repository over Packagist -

i'd use adldap/adldap library in php based project. while maintainer of package has not added package packagist, have included composer.json file. so, normally, i'd add following my composer.json , , go day. "repositories": [ { "type": "vcs", "url": "https://github.com/adldap/adldap" }], "require": { /* other packages */ "adldap/adldap":"4.04" }, however, won't work, because adldap/adldap claimed by different project in packagist , , composer assumes want packagist package. (making things more complicated, packagist package fork of original project, , fork isn't accepting upstream changes). is there way tell composer prefer version configured vcs repository? or stuck forking package myself, changing name, , pointing composer fork? (or 1 of other forks maintained work around issue?) the problem package that, "v4.0.4" version branch doesn&

ios - Making beautiful transitions at PageViewController -

i want make custom transition in pageviewcontroller: while user moves next slide (scroll) background image dissolves image. such effect have apple weather (except there background video). what i've done: i've made uiviewcontoller background image (that image need change). i've placed containerview in uiviewcontroller, containerview have embed pageviewcontroller. uiviewcontroller -> containerview -> pageviewcontroller at point i'm stuck, have working pageviewcontroller shared background image (from top uiviewcontroller), have no idea go next. now can catch page changing delegate (main viewcontoller): func pagechanged(currentpage: int) {} and default delegate method (pageviewcontoller) (i have 2 slides, don't know how better): func pageviewcontroller(pageviewcontroller: uipageviewcontroller, didfinishanimating finished: bool, previousviewcontrollers: [anyobject], transitioncompleted completed: bool) { let prevcontroller = previousviewc