Posts

Showing posts from March, 2010

java - Openshift application deployed successfully but not updated -

i've been trying forever deploy java application jboss 7 server on openshift, but, although deployment log says application has been deployed successfully, deploy not being honoured. old version of application being served user , modules added under .openshift/config/modules not taken account. i connected through ssh application , can see deployment under repo folder, war under dependencies/jbossas/deployments not correct, it's old one. i migrated hibernate, problem? i'm puzzled here since no errors getting displayed in server logs. made modifications in index.html not getting displayed. the deployment log says: remote: client_message: artifact: ./root.war still deploying[k remote: /var/lib/openshift/534346184382ec47bc00025b/jbossas[k remote: artifacts deployed: ./root.war[k remote: -------------------------[k remote: git post-receive result: success[k remote: activation status: success[k remote: deployment completed status: success[k ssh://534346184382ec47bc000...

iOS app install animation using CSS3 -

Image
i'm trying develop javascript-based file uploader, i'm trying recreate same animation ios 7 uses new app install: any ideas of how can achieve using css3? i've created basic jquery plugin similar effect: http://jsfiddle.net/ideatic/kl69s/1/ to use it, call plugin progress value argument: $('#element').loader(25);

jquery - Check if has class -

this html: <div id="gallery"> <div class="item"></div> <div class="somethingelse"></div> <div class="item"></div> <div class="somethingelse"></div> <div class="item active"></div> <div class="somethingelse"></div> <div class="item"></div> </div> now, each item want add number in div, did this: function initmenu() { $( ".gallery-menu" ).html(""); var columns = $('.item').length; ( var = 0; < columns; i++ ) { $( ".gallery-menu" ).append( ); } } initmenu(); now simple 0 1 2 3 in gallery-menu div good. now want check if active . added check this: function initmenu() { $( ".gallery-menu" ).html(""); var columns = $('.item').length; ( var = 0; < columns; i++ ) { ...

Generating a trinomial tree with arrays - Python -

i have simple problem cann't figure out. have following code: r = [np.array([100])] in range(2): r.append(np.concatenate((r[-1][:1]*1.5, r[-1]*0.5))) this produces @ each iteration: [array([100]), array([ 150., 50.])] [array([100]), array([ 150., 50.]), array([ 225., 75., 25.])] the idea of code generate structure similar binomial tree up=1.5, down=0.5. 100 go 150, down 50. in next time step, 150, go 225 or 75; , 50 75 or 25. but now.... want use generate trinomial tree. up=1.5, middle=stays same=1, down=0.5. so iteration should produce [array([100]), array([ 150., 100., 50.])] [array([100]), array([ 150., 100., 50.]), array([ 225., 150., 75., 150., 100., 75., 75., 50., 25. ])] this generates kind-of non recombinant structure. dont know how modify code it. closest got is: r.append(np.concatenate((r[-1][:1]*1.5,r[-1][:1]*1, r[-1]*0.5))) but doesnt make result: [array([100]), array([ 150., 100., 50.]), array([ 225., 150., 75., 50., 25...

sql - Oracle JDBC Diagnostics with JBoss EAP 6.1 -

how can log sql in jboss eap 6.1. i'm using oracle. link resource: oracle jdbc diagnostics http://docs.oracle.com/cd/b28359_01/java.111/b31224/diagnose.htm#ciaieeff i'm using ojdbc6_g jdbc driver. myjdbcloggingconfig.properties: .level=config oracle.jdbc.level=config oracle.jdbc.handlers=java.util.logging.filehandler java.util.logging.filehandler.level=config java.util.logging.filehandler.pattern=c:/work/jdbc.log java.util.logging.filehandler.count=1 java.util.logging.filehandler.formatter=java.util.logging.simpleformatter java vm parameters in jboss-tools (eclipse): -djava.util.logging.config.file=c:/work/myjdbcloggingconfig.properties but did not results. can wrong configuration ? i think can use jboss 7 standard jdbc logging this: http://middlewaremagic.com/jboss/?p=1050

PHP Url Relative and Absolute -

i have class: class pagebuilder { public function getheader() { include(dirname(dirname(__file__)) . '/template/header.php'); } } which when called insert header file page. good. $page_builder->getheader(); in header.php top of html file includes menu. problem is, depending on pagebuilder gets called changes menu link url s. how make sure relative root folder. dirname(__file__) doesn't work because turns url file:/// , don't want append entire http://www.blahblah.com/blah because if relative root doesn't matter of that. edit so posted can use $_server[''] 1 reliable, no doubt php have put in blinding caveats. see thinking $_server['server_addr'] or $_server['server_name'] or $_server['http_host'] ..... going $_server['http_host'] .. result fail. just prefixing / resolves localhost root links localhost/admin/profile.php rather localhost/testapp/admin/profile.php , have...

java - update on many-to-one hibernate relationship no works -

i have problem hibernate relationship many-to-one. my system commercial proposal controller, has responsible proposal user entity. when proposal create , set responsible, has no problems, works fine. when change responsible , update, changes object, can see in datatable, has no update in database. if refresh on page update disapears. @entity @table(name = "proposal") public class proposal implements serializable { @id @generatedvalue private integer id; @manytoone private user responsible; ............ dao code public void update(proposal proposal) { this.session.update(proposal); } in user class don't make annotation relationship, it's unidirectional relationship. class proposal yet use user class make user's bag, participants, , relationship unidirectional relationship too. i tried make annotations in user class no works too. user class annotations @entity @table(name="user...

tortoisesvn - How to disable svn-needs-lock by default? -

after got fresh workstation computer, there different svn setup. files create have svn:needs-lock property set default. wasn't case in past , not need because there little concurrent developers here. could please tell me how configure computer not set property default? system: windows 7 svn client: tortoisesvn there can various reasons why have svn:needs-lock property automatically applied on versioned files: you have enable-auto-props = yes set in [miscellany] section of %appdata%\subversion\config file (subversion runtime configuration area) , [auto-props] section configured set svn:needs-lock on every file. you have tsvn:autoprops property applied on folders in repository. you use subversion 1.8 client , repository has svn:auto-props property applied on it's root or project's root. have missed something?

Visualize 3D objects from fusion table in google earth api -

i want visualize google fusion table data, google earth api. for google map, possible simple 2d geometry: ##javascript var map = new google.maps.map(..) layer = new google.maps.fusiontableslayer({ map: map, ... }); how visualize 3d-polygon's geometry google earth api? it pity, there impossible render complex 3d polygins directly google fusion table..

movement - Bullet direction in c# -

i trying make game have turret rotates mouse position, , on click firing bullets towards mouse position. problem using method (below) doesn't make bullets go straight, since can go in up, down , 45 degree diagonal direction. also, can't figure out way make bullets continue direction after reaching mouse position. suspect whole approach problem may wrong... (as i'm new c#). appreciated, thank you. private void timer1_tick(object sender, eventargs e) { int x = picturebox1.location.x; int y = picturebox1.location.y; if (picturebox1.location.x < cursor.position.x - picturebox1.width / 2) { x = x + 3; picturebox1.location = new point(x, y); } if (picturebox1.location.x > cursor.position.x - picturebox1.width / 2) { x = x - 3; picturebox1.location = new point(x, y); } if (picturebox1.location.y > cursor.position.y - picturebox1.height / 2) { y = y - 3; picturebox1.location = new point(x, y); } if (picturebox1.location.y ...

Number of 4.0 and above devices using ldpi assets in android? -

i have seen is worth time producing ldpi assets android applications these days? , http://developer.android.com/about/dashboards/index.html#screens cannot find statistics per version. is available anywhere? reason ask believe ldpi devices using old android versions, verify before dropping ldpi assets. here can find list of android devices , specs, including android version , screen density: http://checkscreensize.appspot.com/record/lod.htm hope helps you.

javascript - Finding the font in a css file with regex -

i attempting string regex find fonts used in css file. far have follows. var regexp = /font-family:(\w+);/; var matches = regexp.exec("font-family:arial; font-family:berch;"); //matches[1] contains value between parentheses console.log(matches); this matches 'arial'. how can make carry on searching find 'berch'? add g modifier regex. var regexp = /font-family:(\w+);/g; g (global) modifier says not stop after first match , match pattern can. also don't use exec . use string.match . "font-family:arial; font-family:berch;".match(/font-family:(\w+);/g);

Titanium Android module for pdf -

has found way open or view pdf file on android? is there module in titanium open pdf file within android app. either use , intent open in end-users pdf reader if need open in app can use library: https://marketplace.appcelerator.com/apps/6897?restoresearch=true#!overview intent: try { var f = ti.filesystem.getfile('your.pdf'); ti.android.currentactivity.startactivity(ti.android.createintent({ action: ti.android.action_view, type: 'application/pdf', data: f.getnativepath() })); } catch (err) { var alertdialog = titanium.ui.createalertdialog({ title: 'no pdf viewer', message: 'we tried open pdf failed. want search marketplace pdf viewer?', buttonnames: ['yes','no'], cancel: 1 }); alertdialog.show(); alertdialog.addeventlistener('click', function(evt) { if (evt.index == 0) { ti.platform.openurl('http://search?q=pdf'); } }); }

devstack - Accesing instance ip in LAN of openstack -

i have installed devstack in ubuntu machine , im able to run instance of ubuntu image .. instance ip gets assigned automatically (i.e) private ip , floating ip not working in other machines in lan , working in same machine .. working in sense showing default apache page "it works" have installed lamp server in instance os . how can access instance ip in other machines connected locally i.e in same network you should enable arp proxy , ip forwarding: echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp iptables -t nat -a postrouting -o eth0 -j masquerade see more details at: http://barakme.tumblr.com/post/70895539608/openstack-in-a-box-setting-up-devstack-havana-on-your

int - cucumber floating point numbers -

when generate a cucumber phrase such then should have result 180.123 the code generated in intellij @ least is @then("^i should have result (\\d+).(\\d+)$") public void i_should_have_result_(int arg1, int arg2) throws throwable { // express regexp above code wish had throw new pendingexception(); } is there way single double rather having join 2 ints? if modify gherkin step to then should have result "180.23" its implementation be @then("^i should have result \"([^\"]*)\"$") public void i_should_have_result(string arg1) throws throwable { // express regexp above code wish had throw new pendingexception(); } which quite easy convert float.

ios - Get NSURLConnection response (from a helper class) inside method of a different class -

i have class, "webapi", handles web api calls, class uses nsurlconnection through asynchronous delegate-based calls. whenever object needs communicate web api use instance of webapi , call required method shown below in case of signing in make folowing call appdelegate: - (void)applicationdidfinishlaunching:(nsnotification *)anotification { webapi *webapi = [[webapi alloc] init]; [webapi performloginwithusername:@"test1@myserver.com" andpassword:@"password"]; } the problem once performloginwithusername:andpassword call made, code progresses on , any/all response received in delegate methods implemented in webapi.m. this real issue because need able response codes , data received within class method call webapi, originated . able : - (void)applicationdidfinishlaunching:(nsnotification *)anotification { webapi *webapi = [[webapi alloc] init]; webapiresponse * webapirespnse = [webapi performloginwithusername:@"test1@myse...

ios - Coredata database prepopulation is not filled -

i'm trying prepopulate coredata database sqlite file, don't understand why database not filled. sqlite file filled data need , added in bundle ressources. here persistentstorecoordinator method int appdelegate : - (nspersistentstorecoordinator *)persistentstorecoordinator { if (persistentstorecoordinator != nil) { return persistentstorecoordinator; } nsstring *storepath = [[self applicationdocumentsdirectory] stringbyappendingstring:@"myapp.db"]; nserror *error = nil; nsfilemanager *fm = [nsfilemanager defaultmanager]; if (![fm fileexistsatpath:storepath]) { nsstring *defaultstorepath = [[nsbundle mainbundle] pathforresource:@"myapp" oftype:@"db"]; if (defaultstorepath) { [fm copyitematpath:defaultstorepath topath:storepath error:null]; } } nsurl *storeurl = [nsurl fileurlwithpath:storepath]; nsdictionary *options = [...

c - ssl_connect does nothing at all (observed in wireshark) -

Image
i have code cross compiled 2 devices. on 1 device code works flawlessly, on other ssl_connect nothing. info both devices: device 1: (working) cpu: powerpc @ 220mhz ram: 128mb sd-ram linux 2.6.24.6 device 2: (not working) cpu: powerpc @ 133mhz ram:32mb sd-ram linux 2.4.21 here's code i'm using after sending ehlo , starttls: static ssl_ctx *ctx = null; static ssl *ssl = null; void createtlssession(int sockfd) { int retvalue=0; printf("creating tls session...\n"); ssl_library_init(); ssl_load_error_strings(); openssl_add_all_algorithms(); //ctx = ssl_ctx_new(tlsv1_client_method()); ctx = ssl_ctx_new(tlsv1_client_method()); //(ssl_ctx_set_options(ctx, ssl_op_no_compression); //ssl_ctx_set_mode(ctx, ssl_mode_release_buffers); if (ctx == null) { printf("failed initialize context\n"); return; } ...

django - No Reverse Match Why? -

i error whenever try open localhost:8000 happens homepage of app i'm working on. noreversematch @ / reverse 'category_detail' arguments '()' , keyword arguments '{}' not found. 1 pattern(s) tried: ['category/(?p<slug>[\\-\\w]+)/$'] below {% url %} use in template, models.py, urls.py , views.py what happening? doing wrong? #in template. <a href="{% url 'category_detail' %}" class="button tiny">view</a> #my urls.py django.conf.urls import patterns, url . import views urlpatterns = patterns('', url(r'^$', views.home.as_view(), name='home'), url(r'^categories/$', views.mycategory.as_view(), name='all_categories'), url(r'^category/(?p<slug>[-\w]+)/$', views.categorydetail.as_view(), name='category_detail'), url(r'^tip/(?p<slug>[-\w]+)/$', views.toolkitdetail.as_view(), name='toolkit_detail'), ) #m...

powershell - Strange behaviour with Add-Member. Get-Member doesn't return any value -

Image
if write following code and, u can see, use get-member null: $usertoadd = new-object psobject $usertoadd | add-member -membertype noteproperty -name "name" -value ([adsi]$_.path).name[0] $usertoadd | add-member -membertype noteproperty -name "email" -value ([adsi]$_.path).mail[0] $usertoadd | add-member -membertype noteproperty -name "daysleft" -value $daystillexpiring $usertoadd | add-member -membertype noteproperty -name "expirationtimestamp" -value $expirationtimestamp.tostring("dd/mm/yyyy alle ore hh:mm:ss ") $usertoadd | add-member -membertype noteproperty -name "samaccountname" -value ([adsi]$_.path).samaccountname[0] $usertoadd | get-member -verbose get-content $usertoadd but variable have value, because when use get-content following error, containing correct value: get-content : cannot find drive. drive name '@{name=xxxxxxxxx; email=xxxxxxxxxx; daysleft=13; expirationtimestamp=27/04/2014 alle ore 10...

qt4 - How to find Version of Qt? -

how know version of qt using.when open qt creator shows welcome qt creator 2.3.in build setting shows qt version qt 4.7.1. please me. all version info in pyqt5.qt: from pyqt5 import qt vers = ['%s = %s' % (k,v) k,v in vars(qt).items() if k.lower().find('version') >= 0 , not inspect.isbuiltin(v)] print('\n'.join(sorted(vers))) prints pyqt_version = 328193 pyqt_version_str = 5.2.1 qopenglversionprofile = <class 'pyqt5.qtgui.qopenglversionprofile'> qt_version = 328192 qt_version_str = 5.2.0 qversion = <built-in function qversion> qwebkitmajorversion = <built-in function qwebkitmajorversion> qwebkitminorversion = <built-in function qwebkitminorversion> qwebkitversion = <built-in function qwebkitversion> the functions can called too: >>> vers = ['%s = %s' % (k,v()) k,v in vars(qt).items() if k.lower().find('version') >= 0 , inspect.isbuiltin(v)] >>> print('\n...

javascript - Unit Testing a AngularJS service? -

hey, need testing service. i have service: myservice.js and controller: angular.module('mycontrollers', []) .controller('myctrl2', ['$scope', 'fnencode', function ($scope, fnencode) { $scope.encoded1 = ""; $scope.encoded2 = ""; $scope.encoded3 = ""; $scope.encode1 = function() { $scope.encoded1 = fnencode.encodeuui(fnencode.encodefunctionalnumber($scope.numbertoencode)); }; $scope.encode2 = function() { $scope.encoded2 = fnencode.encodeuui(fnencode.encodefunctionalnumber($scope.numbertoencode)+ fnencode.encode2($scope.encodewith2)); }; $scope.encode3 = function() { $scope.encoded3 = fnencode.encodeuui(fnencode.encodefunctionalnumber($scope.numbertoencode)+ fnencode.encode3($scope.encodewith3)); }; }]); the service doing when enter 123 in text field outputs me 00050...

javascript - JQuery ajax JSON result to text input value -

i have autocompleter, working fine, wanted add "autofiller" means, if select 1 of "companies" "autocompleter" should results db companies. the json response is: [ { "idfirma": "2222", "firmenname": "test", "strasse": "test", "plz": "", "ort": "test", "l‌​and": "", "webseite": "", "region": "", "aktiv": "1" } ] what got far: $(document).ready(function() { $(function() { $( "#firma_neu" ).autocomplete({ source: "./firma_suche.php3", open: function(event, ui) { var firmenname = $("#firma_neu").val(); }, select: function(event, ui) { event.preventdefault()...

Play two sounds simultaneously using AVPLayer iOS -

i'm using 2 instances of avplayer . first player audio working fine moment second audio starts there small fraction of time in first audio stops. for first player have made singleton class. second player. avasset *asset = [avasset assetwithurl:url]; avplayeritem *playeritem = [avplayeritem playeritemwithasset:asset] //avplayeritem *playeritem=[avplayeritem playeritemwithurl:url]; [self.player replacecurrentitemwithplayeritem:playeritem] [self.player play];

html - CSS not working in mozilla firefox version 29 beta 7 -

i have problem getting following code work in mozilla firefox. using version 29 beta 7. following css not working in firefox works absolutely fine in chrome. reason not able find out. please help. css code: input[type="file"] { border: 1px solid #333; box-sizing: border-box; display: inline-block; font-size: 14px; margin: 0; padding: 8px; position: relative; background-color: #fff; overflow: hidden; width: 100%; -webkit-appearance: none; -webkit-box-sizing: border-box; z-index: 1; } input[type="file"]:after { /* mask no file chosen label */ background-color: #fff; content: ''; display: block; height: 100%; position: absolute; top: 0; left: 0; width: 100%; z-index: 10; } input[type="file"]::-webkit-file-upload-button { /* style button */ background: #fff; color: #555; font: inherit; padding: 0; position: relative; border: none; text-align: left; position: relative; z-index: 100; ...

python - Can I disallow delete queries on all instances of a resource in tastypie? -

let's have resource named res, instances accessible thourgh url: .../api/res/<res_id>/ i'd clients allowed send delete queries on specific instances (so on above url), not delete instances @ 1 time sending delete on root url resource 'res' (.../api/res/), how can configure tastypie that? you'll have implement own authorization described in the documentation : class customauthorization(authorization): def delete_list(self, object_list, bundle): raise unauthorized("you cannot delete multiple objects @ once.") # or return [] raising error return http 401 status code, while returning empty list return http 200 status code. both not delete items. you can create subclass of of default authorization classes inherit behaviour, or can create own class , implement required methods. edit : found out, easiest way specify list_allowed_methods attribute in resource's meta: class myresource(models.modelreso...

java - BigDecimal formatting -

i'd format bigdecimal in java 8 characters (including seperator), rounding half-up. examples: 12345.6789 -> "12345.68" 123 -> " 123.0" 0.12345678 -> "0.123457" 1.5 -> " 1.5" 0.0045 -> " 0.0045" 12 -> " 12.0" the result must have leading spaces fill 8 characters. what's easiest way? i'm pretty sure not best way, it's 1 way. first note if numbers have more 6 digits before period, or more more width - 2 digits before period, format .0 not work anymore. string.format() uses half rounding method, can use first step output 8 characters. bigdecimal b = new bigdecimal(0.0045); string format = "%8f"; string str = string.format(format, b); output: 12345.678900 123.000000 0.123457 1.500000 0.004500 12.000000 123456.000000 by default string.format() uses precision of 6 bigdecimal . custom precision, need know how many digits be...