Wednesday, 15 April 2015

How to configure ambient framework within a Tridion CWA web app -



How to configure ambient framework within a Tridion CWA web app -

i'm adding ambient framework within existing tridion cwa java web application , have questions regarding mapping of java filters (ambient framework filter vs cwa filters)

in sdl cwa 2011 sp1 documentation (online portal) say:

16 - if intend utilize ambient info framework in combination cwa, open web.xml file in web-inf/ folder , add together following:

<filter> <filter-name>ambient info framework</filter-name> <filter-class>com.tridion.ambientdata.web.ambientdataservletfilter</filter-class> </filter> <filter-mapping> <filter-name>ambient info framework</filter-name> <servlet-name>content delivery web service</servlet-name> </filter-mapping>

i don't understand filter-mapping. in web-app there no content delivery web service.

my questions:

1 - means ambient info framework requires installation of content delivery web service work ? me filter-mapping of ambient info filter should same mapping of cwa request filter

<filter-mapping> <filter-name>cwa</filter-name> <url-pattern>my-mapping</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ambient info framework</filter-name> <servlet-name>my-maping</servlet-name> </filter-mapping>

2 - pagefiledistributionfilter & binaryfiledistributionfilter ?

3 - there recommanded filter order ? cwa filters configured before ambient info filter ex ?

any help much appreciated. in advance.

on #1: it's documentation defect, should instead:

class="lang-xml prettyprint-override"><filter> <filter-name>ambient info framework</filter-name> <filter-class>com.tridion.ambientdata.web.ambientdataservletfilter</filter-class> </filter> <filter-mapping> <filter-name>ambient info framework</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

on #2, yes still need 2 of course.

on #3, suspect should have ambient framework loaded first, recommendation non-cwa web apps (your filters utilize ambient framework, instance)

tridion tridion-2011 tridion-content-delivery ambient

objective c - Change text of smjobbless dialog kAuthorizationEnvironmentPrompt -



objective c - Change text of smjobbless dialog kAuthorizationEnvironmentPrompt -

smjobbless has dialog prompt tells user installing helper tool , type password proceed. alter text.

instead of changing text, next code puts custom text @ origin , still displays default text. missing or doing wrong?

// creating auth item bless helper tool , install framework authorizationitem authitem = {ksmrightblessprivilegedhelper, 0, null, 0}; // creating set of authorization rights authorizationrights authrights = {1, &authitem}; nsstring *prompttext = @"customized text. privilege?\n\n"; authorizationitem dialogconfiguration[1] = { kauthorizationenvironmentprompt, [prompttext length], (char *) [prompttext utf8string], 0 }; authorizationenvironment authorizationenvironment = { 0 }; authorizationenvironment.items = dialogconfiguration; authorizationenvironment.count = 1; // specifying authorization options authorization authorizationflags flags = kauthorizationflagdefaults | kauthorizationflaginteractionallowed | kauthorizationflagextendrights; // open dialog , prompt user password osstatus status = authorizationcreate(&authrights, &authorizationenvironment, flags, authref);`

use kauthorizationrightexecute instead of ksmrightblessprivilegedhelper short text inquire input password.. , utilize kauthorizationenvironmentprompt environment can add together additional text in origin of tips..

objective-c authorization

oracle - Removing "duplicate" groups in SQL -



oracle - Removing "duplicate" groups in SQL -

i'm trying rid of duplicate groups in sql, problem they're not really duplicates.

i have table this:

a | b 0 | 1 2 | 3

however, table adds b, end final table:

a | b 0 | 1 2 | 3 -------- 1 | 0 3 | 2

what i'm trying homecoming distinct pairs (the first table), , i'm having issues it. hints much appreciated!

try this:

select distinct (case when < b else b end) first, (case when < b b else end) sec t

if using oracle (which assumption sqlplus), can simplify to:

select distinct least(a, b), greatest(a, b) t

sql oracle

excel - Find column starting with "Email" VBA -



excel - Find column starting with "Email" VBA -

i have limited knowledge of vba. however, help of google did script searches column called email. if finds it looks if in column commas. if yes, changes commas dots. however, solution case sensitive. if column name different, doesn't work. far know there 2 different options used in files script clean 1. email 2. email - personal email

i able create script work in email starting columns. tried specify "email*" didn't work. can help me?

sub mysample() sheets("data").activate dim cell excel.range dim ws excel.worksheet dim integer dim j integer each ws in excel.thisworkbook.sheets = ws.cells(1, excel.columns.count).end(excel.xltoleft).column j = 1 if ws.cells(1, j).value = "email" cells.replace what:=",", replacement:=".", lookat:=xlpart, _ searchorder:=xlbyrows, matchcase:=false, searchformat:=false, _ replaceformat:=false end if next j next ws sheets("automation").activate msgbox "removing commas in emails - done!" end sub

i'd recommend utilize different approach: instead of looping trough cells of 1st column - utilize excel search identify e-mail column:

lookupstring = "email" set searchrange = activeworkbook.activesheet.range("1:1").find(lookupstring, lookin:=xlvalues, lookat:=xlpart, matchcase:=false)

with options given you'll find lookupstring value match, regardless of position , case in column name. replace activeworkbook.activesheet. part names of wb / sheet required.

further may utilize returned searchrange properties, such column, farther processing of info in column. luck!

excel vba excel-vba

jquery - Javascript loading incorrectly in firefox -



jquery - Javascript loading incorrectly in firefox -

first, apologies reads this. i've run fair number of js issues, , intractable i've ever seen. i'll best give clear description, may have revise it.

i have next page loading within inline frame in sugarcrm:

<head> <link rel="stylesheet" href="style/style.css" /> </head> <body> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script type="text/javascript" src="js/index_controller.js"></script> <table class="form_text" style="width: 100%; height: 100%;" cellpadding="5"> <tr> <td><iframe id="map_frame" style="width: 100%; height: 100%; overflow-y: hidden; border: solid 1px #dddddd" scrolling="no" src="map.php?<?php foreach ( $_request $key => $value ) { echo $key . "=" . $value . "&"; }?>"></iframe> </td> ... </td> </tr> </table> </div> <script type="text/javascript"> parent.$("iframe").each(function(iel, el) { if(el.contentwindow === window) { var to_remove = $(el).parent().prev(); $(to_remove).remove(); $(el).css("border", "none"); } }); $(document).ready(function(){ updatemap(); }); </script> </body>

and in iframe in page, have this:

<head> <link rel="stylesheet" href="style/style.css" /> <!--[if lte ie 8]> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.ie.css" /> <!--[endif]--> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.css" /> <script src="js/jquery-1.9.1.js"></script> </head> <body> <script type="text/javascript" src="../include/dashletcontainer/containers/dcmenu.js"> </script> <script type="text/javascript" src="js/arraylist.js"></script> <script type="text/javascript" src="js/custom_map_controls.js"></script> <div id="map" style="height: 100%"></div> <form action="../index.php" method="post" name="detailview" id="formdetailview"> <input type="hidden" name="module" value=""> <input type="hidden" name="record" value=""> <input type="hidden" name="return_action"> <input type="hidden" name="return_module"> <input type="hidden" name="return_id"> <input type="hidden" name="module_tab"> <input type="hidden" name="isduplicate" value="false"> <input type="hidden" name="offset" value="1"> <input type="hidden" name="action" value="editview"> <input type="hidden" name="sugar_body_only"> <input type="hidden" name="prospect_id" value=""> </form> <script type="text/javascript" src="js/map_icons.js"></script> <script type="text/javascript" src="js/map_controller.js"></script> <script src="js/leaflet-0.4.5.js"></script> </body>

the leaflet-0.4.5.js script, when evaluated, creates globally available object known l, gives access leaflet mapping framework's functions. in map_controller.js, add together special features l.map, function creating actual map objects. works fine in chrome, , works fine in firefox when load page straight in browser tab. when load intended, in sugarcrm page within inline frame, error "l.insert function name here not defined" in js console. if refresh iframe without reloading entire sugarcrm page, map appears expected. i'm working around catching exception , forcing page reload when occurs, i'd know why happening in first place. i've rewritten map controller functions utilize l contained within $(document).ready() function (using jquery that) , tried putting leaflet script tag @ top of body on page it's supposed load, , still no luck.

your problem using $(document).ready on parent page.

that run html parser done parsing parent. it's reaching within iframe , depending on various scripts within iframe having been loaded, may not @ point yet. it's race between http response toplevel page , http responses scripts in subframe, basically.

the right way run initialization onload or @ to the lowest degree point domcontentloaded (which $(document).ready hooks into) has fired on child.

javascript jquery firefox leaflet

javascript - What is the difference between $("selection") and $("selection", $(this)) -



javascript - What is the difference between $("selection") and $("selection", $(this)) -

i have seen utilize of $(this) , understand within function, have seen in selector well, fail understand when or if valuable. here 2 examples can utilize , work, doing valuable...

here added $(this) in selectors

(function($) { $(".deliver").on('mouseenter',function(){ $(this).css({'width':'600px'}); $(".form_jquery",$(this)).fadein(1000).css({'display':'block'}); $(".componentheading",$(this)).css({'display':'none'}); }); ...

here original script

(function($) { $(".deliver").on('mouseenter',function(){ $(this).css({'width':'600px'}); $(".form_jquery").fadein(1000).css({'display':'block'}); $(".componentheading").css({'display':'none'}); });

i have kept know standard utilize of (this) in both , noting using in anonymous function in case factors in.

$(".componentheading",$(this))

only searches .componentheading elements under current $(this) element (in particular case it's .deliver entered mouse) whereas

$(".componentheading")

searches them in whole document.

http://api.jquery.com/jquery/#jquery1

javascript jquery anonymous-function

Entity Framework (5) LINQ methods return entire entity collection THEN apply filter -



Entity Framework (5) LINQ methods return entire entity collection THEN apply filter -

i have code this:

user rvalue = null; var userbyid = new func<user, bool>(x => x.userid.equals(userid, stringcomparison.invariantcultureignorecase)); if (this._context.users.any(userbyid)) { var user = this._context.users .include("nested.associations") .single(userbyid); rvalue = user; } homecoming rvalue;

i started profiling query, , noticed ef not applying func<> sql query, collection in-mem after returning entire .users set.

interestingly, next generates query right clause filtering userid:

user rvalue = null; //var userbyid = new func<user, bool>(x => x.userid.equals(userid, stringcomparison.invariantcultureignorecase)); if (this._context.users.any(x => x.userid.equals(userid, stringcomparison.invariantcultureignorecase))) { var user = this._context.users .include("nested.associations") .single(x => x.userid.equals(userid, stringcomparison.invariantcultureignorecase)); rvalue = user; } homecoming rvalue; why ef not build predicate var generated sql? is there way re-use predicate code can remain clean , readable, , have ef stuff generated sql?

ef cannot interpret compiled il code (which func is). need guess original code reflector does. that's not attractive design selection framework doesn't work way. when inline lambda not func. look is analyzable. search "c# look trees" find out more.

yes: utilize expression<func<user, bool>> variable.

entity-framework

html - How to crop and align images next to each other? -



html - How to crop and align images next to each other? -

on grammar page there's main 590px x 183px image @ top , 5 121px x 137px images @ bottom, aligned horizontally next each other:

the bottom images resized crop of main image @ top. in screenshot example, 3rd image @ bottom resized crop of image @ top, buses. if click on first bottom images (books) take page books image @ top (like buses above).

all long-but-hopefully-clear introduction, inquire how can horizontally-align the bottom images resized crop of images @ top? bottom images cropped , resized offline, , uploaded new files. visit 5 pages linked bottom images, 1 has download 10 image files. if resize , crop (and still have images horizontally aligned), 5 files. tried margin-left (and height) resize , crop:

<img style="height:135px; margin-left:-290px;" src="http://www.imparare-inglese.it/uploads/1/1/1/6/11169156/7674785.png"/> <img style="height:135px; margin-left:-610px;" src="http://www.imparare-inglese.it/uploads/1/1/1/6/11169156/6647450.png"/>

but set margin-left on 2nd img, 2nd image goes on first. how prevent that? missing?

example tables: http://jsfiddle.net/eznag/

place image within div, apply width, height, float:left, position:relative , overflow:hidden on div containing image, absolute position image required. if image needs faux/css resize, apply in css too.

* { padding:0; margin:0; } .panels { float:left; } .placeholder { width:200px; height:200px; float:left; overflow:hidden; margin:0 20px 0 0; } .placeholder img { /*width:100%;*/ } <div class="panels"> <div class="placeholder"> <img src="http://www.jakss.co.uk/common/images/shell/header/client-logo.png" /> </div> <div class="placeholder"> <img src="http://www.jakss.co.uk/common/images/shell/header/client-logo.png" /> </div> <div class="placeholder"> <img src="http://www.jakss.co.uk/common/images/shell/header/client-logo.png" /> </div> </div>

http://jsfiddle.net/seemly/pmuzy/

if reinstate width:100%; on .placeholder img in jsfiddle, provides effect want, or @ to the lowest degree gives head start?

html css image margin negative-margin

jquery - overflow hidden ruining hover menu -



jquery - overflow hidden ruining hover menu -

i'm having big problem "overflow: hidden" getting added @ runtime hidden "ul" in dropdown menu.

the code create menu items display correctly on hover is:

$(document).ready(function() { $("ul#main_nav li.has_children").hover(function() { $(this).children('ul').stop(true,true).slidedown(200); }, function() { $(this).children('ul').stop(true,true).slideup(150); }); });

the menu runs smoothly grandchildren aren't displaying. on closer inspection via inspect element, see overflow: hidden remaining on "ul" when it's parent hovered upon.

if add together .css("overflow", "hidden"); grandchildren show slidedown no longer animated.

weirdly, works on firefox. i'm not sure why overflow:hidden getting set, i'm not sure go next.

would appreciate help!

jquery css drop-down-menu overflow

c++ - Problems of using srand() in libraries -



c++ - Problems of using srand() in libraries -

there wide utilize of srand()/rand() calls in 3rd party libraries, predefined seeds. problem arises when combining different libraries in same process. it's hard ensure right sequence of calls, mix of srand() , rand() calls possible. problem inability take seeding value on application level. general rule, should avoid using srand() in libraries (including open source), leaving task of seeding applications?

for reasons mentioned, among others, it's improve practice in real life applications utilize boost::random or c++11 random library

c++ c random software-design

ruby - Rails Forem installation assistance -



ruby - Rails Forem installation assistance -

so i'm quite new rails , such , i've been trying install past few hours , have been getting next error when trying run rails s, or if seek install rails g forem:install

/usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load': /home/forem/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (syntaxerror) ...sion_store :cookie_store, key: '_forums_session' ^ /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in

load' /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in load_dependency' /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in load' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:588 /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587:in each' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587 /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in instance_exec' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in run' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:55:in run_initializers' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in each' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in run_initializers' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:136:in initialize!' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in send' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in method_missing' /home/forem/config/environment.rb:5 /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in load_dependency' /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:103:in require_environment!' /usr/lib64/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/commands.rb:25 script/rails:6:inrequire' script/rails:6

so there i'm missing here or...?

the 1 downloaded one: https://github.com/radar/forem.heroku.com

the error you're getting due fact you're using ruby 1.9+ hash syntax in older version of ruby not back upwards it. need either upgrade ruby 1.9.2 or 1.9.3, or alter sec line of session_store.rb file be:

# sure restart server when modify file. forums::application.config.session_store :cookie_store, :key => '_forums_session'

ruby-on-rails ruby gem forem

backbone.js - Backbone best place for custom event bind & custom even trigger -



backbone.js - Backbone best place for custom event bind & custom even trigger -

i have custom event triggered upon user interaction on bbone view of collection, , i'd signal changes on unrelated view. utilize custom event.

//a global event object pub-sub model var vent = backbone.extend({}, backbone.event); var c1 = backbone.collection.extend(); var v1 = backbone.view.extend( events: { 'click .appointment': 'clickcallback' }, clickcallback: function(){ vent.trigger('appointment:selected', apptprops); } ); var c1obj = new c1([{...}, {...}]); var v1obj = new v1({ collection: c1obj });

so when user clicks on .appointment element of collection view v1obj, announce appointment:selected event.

now want different view v2 react event. best place bind "appointment:selected" event? in initialize() of view v2 (case 1) or in initialize() of collection/model of v2 (case 2) or somewhere else? i'm trying clarify what's best practice, if any.

case 1:

var v2 = backbone.view.extend( initialize: function(){ vent.on('appointment:selected', this.apptselected, this); }, appselected: function(apptprops){ ... } );

case 2:

var c2 = backbone.collection.extend( initialize: function(){ vent.on('appointment:selected', this.apptselected, this); }, appselected: function(apptprops){ ... } );

as far understand, philosophy of bbone upon user interaction, manipulate info , not modify markup, thought beingness info changes cascade views. if so, reply original question case 2?

i think idiomatic thing be:

represent state of "selected" inclusion in collection when user clicks .appointment, view1 adds appointment model selectedappointments collection view2 binds normal collection lifecycle events (add, remove, reset) of selectedappointments , re-renders accordingly both views take collection in options argument initialize

just side note of backbone 0.9.9 backbone object can used application-wide event bus instead of vent object.

events backbone.js triggers bind

soap - Consuming WCF Service with Digest authentication from Java -



soap - Consuming WCF Service with Digest authentication from Java -

i want create client in java connects web service requires digest authentication. since not familiar java , java stack, i've made research , came across jax-ws, axis2, xcf, , metro. have learned jax-ws api , there reference implementation in jdk lacks digest authorization support.

my first effort utilize axis2 since there built-in back upwards in eclipse ide. next code seems follow digest authentication workflow somehow still fails authorization in end.

service1stub stub = new service1stub(); httptransportproperties.authenticator authenticator = new authenticator(); list<string> authschemes = new arraylist<string>(); authschemes.add(authenticator.digest); authenticator.setauthschemes(authschemes); authenticator.setusername("doman user"); authenticator.setpassword("domain password"); authenticator.setpreemptiveauthentication(true); options options = stub._getserviceclient().getoptions(); options.setproperty(org.apache.axis2.transport.http.httpconstants.authenticate, authenticator); options.setproperty(org.apache.axis2.transport.http.httpconstants.chunked, org.apache.axis2.constants.value_false); getdata getdata = new getdata(); getdata.setvalue(25); getdataresponse info = stub.getdata(getdata); system.out.println(data.getgetdataresult());

my sec effort utilize metro framework errors related jaxb versions.

java.lang.linkageerror: jaxb 2.1 api beingness loaded bootstrap classloader, ri needs 2.2 api.

i have utilize jdk 1.6.0_03 guess happening because of jdk version mismatch, don't want utilize suggested "endorsed directory mechanism" because might cause lots of troubles during deployment.

i totally lost , looking simplest, quickest , up-to-date way of consuming web service requires digest authentication in java? preferably little dependencies possible.

java classloading mess, sorry. root cause there no strong names there in .net world, , hence runtime linker takes whatever match comes first on classpath, regardless of whether that's library version code compiled against. osgi scheme solves problem, never gained mainstream adoption.

the error message cited:

java.lang.linkageerror: jaxb 2.1 api beingness loaded bootstrap classloader, ri needs 2.2 api.

is uncharacteristically useful , specific, of time happens instead you're left staring @ nosuchmethoderror or of sort. on time, larn recognise these library version mismatches. in case, library author(s) have written code recognize mutual error case , print improve error message (bless 'em).

rant over, here's info hope set on right track:

java classloaders hierarchical , resolution bottom-up but there's blessed class loader @ root of hierarchy that's responsible loading core runtime library vendor shenanigans have led lot of stuff getting included in core runtime library shouldn't have been in there, it's shortcut becoming dominant in otherwise darwinistic selection process. jaxb 1 of these things, you've found out. jaxb2 pretty decent, evolves independent of core runtime and, well, here are. the jdk , jre installation has folder called lib\endorsed can add together jar files need loaded root loader, bypassing what's in rt.jar.

in summary, if manually add together 2.2 version of jaxb library %java_home%\lib\endorsed, should override included 2.1 version , web service client deploy. have happen on every scheme run web service client, until jdk updated 7.x version included jaxb 2.2. if same jvm running other jaxb based applications, these may or may not break result.

yes, painful. tangent investigate deliberately utilize older version of metro that's built jaxb 2.1. long you're bound deploying on 1.6.0_03, may improve option, despite losing of recent improvements in metro.

updated: here's blog post on topic. contains links farther information.

java soap jax-ws axis2 java-metro-framework

admin - restrict wordpress user to only edit users with same meta key value -



admin - restrict wordpress user to only edit users with same meta key value -

i have wordpress site set up, within there master admin, have user role manager alter subscriber role able add together new users. have restricted subscriber making new users new role have created "player".

i have added custom field each user called "game". subscriber can alter , "player"' custom field. player cannot alter value.

i need alter "all users" page when subscriber signs in, show list of users have same cutom field value "game".

i have tried sorts of different plugins , tried own dablle @ changing code nil has worked :(

any help appreciated

andy

got code q&a, remove ability other users view administrator in user list?.

you need tweak bit adapt roles , capabilities, much changing meta_key , meta_value values. i've added check $pagenow sure fire in /wp-admin/users.php.

add_action( 'pre_user_query', 'filter_users_wpse_10742' ); function filter_users_wpse_10742( $user_search ) { global $pagenow; if( 'users.php' != $pagenow) return; $user = wp_get_current_user(); if ( $user->roles[0] != 'administrator' ) { global $wpdb; $user_search->query_where = str_replace('where 1=1', "where 1=1 , {$wpdb->users}.id in ( select {$wpdb->usermeta}.user_id $wpdb->usermeta {$wpdb->usermeta}.meta_key = '{$wpdb->prefix}user_level' , {$wpdb->usermeta}.meta_value != 10)", $user_search->query_where ); } }

wordpress admin user-roles

html - CSS Sentence Case -



html - CSS Sentence Case -

this question has reply here:

convert uppercase letter lowercase , first uppercase in sentence using css 9 answers

is there way format "sentence case"? e.g. "this sentence 1. sentence 2. sentence 3. alter -> sentence 1. sentence 2. sentence 3.

css can convert first letter of each word, not first letter of each sentence. need utilize javascript here:

<html> <head> <script language="javascript"> <!-- function fixcapitalstext (text) { result = ""; sentencestart = true; (i = 0; < text.length; i++) { ch = text.charat (i); if (sentencestart && ch.match (/^\s$/)) { ch = ch.touppercase (); sentencestart = false; } else { ch = ch.tolowercase (); } if (ch.match (/^[.!?]$/)) { sentencestart = true; } result += ch; } homecoming result; } function fixcapitalsnode (node) { if (node.nodetype == 3 || node.nodetype == 4) // text or cdata { node.textcontent = fixcapitalstext (node.textcontent); } if (node.nodetype == 1) (i = 0; < node.childnodes.length; i++) fixcapitalsnode (node.childnodes.item (i)); } // --> </script> </head> <body onload="fixcapitalsnode (document.body);"> first sentence. sec sentence. 3rd sentence. </body> <html>

html css html5 css3

amazon web services - How to define block_device_mappings when using boto.ec2.autoscale.launchconfig.LaunchConfiguration(), -



amazon web services - How to define block_device_mappings when using boto.ec2.autoscale.launchconfig.LaunchConfiguration(), -

i'm trying using boto create launch configuration auto scaling, don't know how define block_device_mappings.

the code snapshots this:

dev_sdf = boto.ec2.blockdevicemapping.ebsblockdevicetype(snapshot_id = self.sna_data.id) bdm = boto.ec2.blockdevicemapping.blockdevicemapping() bdm['/dev/sdf'] = dev_sdf lc = launchconfig.launchconfiguration(connection = self.as_conn, name = lc_name, image_id = self.ami.id, instance_type = self.instance_type, key_name = aws_key_name, security_groups = self.security_groups, spot_price = self.price, block_device_mappings = [bdm]) self.as_conn.create_launch_configuration(lc)

but got:

boto.exception.botoservererror: botoservererror: 400 bad request <errorresponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/"> <error> <type>sender</type> <code>validationerror</code> <message>1 validation error detected: value null @ 'blockdevicemappings.1.member.devicename' failed satisfy constraint: fellow member must not null</message> </error> <requestid>7289473c-7bc1-11e2-a07c-93de372a2cc0</requestid> </errorresponse>

how should define block_device_mappings?

i don't think code loads mappings in can ever work.

i've create pull request against boto code should pull device mappings across properly:

https://github.com/pasc/boto/tree/bdm_for_autoscaling_groups

amazon-web-services boto autoscaling

iphone - SDImageCache - imageFromMemoryCache returns nil -



iphone - SDImageCache - imageFromMemoryCache returns nil -

i'm using latest version of sdwebimage (sdimagecache), , saving image code

[[sdimagecache sharedimagecache] storeimage:image forkey:@"1"];

and i'm sure image have been saved successfully, because i've checked app folder, there image existing in it.

and i'm using

uiimage *image = [[sdimagecache sharedimagecache] imagefrommemorycacheforkey:@"1"];

to read image out, image object returns nil. problem be? give thanks you!

when use:

- (void)storeimage:(uiimage *)image forkey:(nsstring *)key

the image saved in disk cache.

the implementation like:

- (void)storeimage:(uiimage *)image forkey:(nsstring *)key { [self storeimage:image imagedata:nil forkey:key todisk:yes]; }

so if need retreive image disk, can utilize next method instead:

- (void)querydiskcacheforkey:(nsstring *)key done:(void (^)(uiimage *image, sdimagecachetype cachetype))doneblock;

the default disk cache type sdimagecachetypenone, if need specify cache type utilize sdimagecachetype enum.

enum sdimagecachetype { /** * image wasn't available sdwebimage caches, downloaded web. */ sdimagecachetypenone = 0, /** * image obtained disk cache. */ sdimagecachetypedisk, /** * image obtained disk cache. */ sdimagecachetypememory };

hope, it'll help you.

iphone ios xcode sdwebimage

android - Corona Facebook Login -



android - Corona Facebook Login -

i had implemented facebook single sign on in app. discovered did not work if user had fb app installed on phone. resolved generating key hash facebook, worked again. since upgraded corona business relationship trial pro version. facebook not working again. still using android debug key when building apk file, , have tried original hash key had , made one, can't work. solutions?

hy, had same. steps : create tutorial facebook login illustration corona. try, thats work installed facebook app. after implement facebook login app in example.

that resolution us.

but cant nil exact, got app developer update/bugfixes.

android facebook-graph-api corona

CakePHP blank screen admin functions on remote server -



CakePHP blank screen admin functions on remote server -

i have problems "backend" on page. on localhost works great (admin panel, add/edit articals, add/edit news, add/edit users), on remote server, when request eg. add together artical or edit artical blank page no view, utilize debug 2, , google google every every day night nil :(, can helps me, , tell me problem? thanky much

this caused having whitespace after php close.

go through any/all files might getting hit, , rid of ending close php tag all-together. if it's php file, there's no need close it, , it's practice not to, keeps stuff happening.

cakephp

Passing values from radio button to another page (Windows Phone) -



Passing values from radio button to another page (Windows Phone) -

i have testpage.xaml in run test questions. have set maxcount=10 when have 10 questions test end. want create settingpage.xaml 3 radio button 10 , 15 , 20 when user check 1 of them set maxcount , chooce number of question test 'll have .

windows-phone-7 radio-button

c# - How to parse XML in a Windows Phone 7 application -



c# - How to parse XML in a Windows Phone 7 application -

could tell me how parse xml-string receive wcf-rest service?

my webserive xml-string looks like

<ws> <info> <name>beta</name> <description>prototyps</description> </info> <pages> <page> <name>custom</name> <description>todo</description> </page> ...many other pages... </pages> </ws>

an phone sourcecode:

public void downloadcompleted(object sender, downloadstringcompletedeventargs e) { if (!e.cancelled && e.error == null) { var reply = xelement.parse(e.result).descendants("ws"); // null ... } }

if seek parse through xdocument.load(e.result) exception: file not found.

i want "unique" info of info-node , list of page-nodes values

update if seek load root-element via var item = xdoc.root.descendants(); item assigned whole xml-file.

update 2 seems problem occurs namespaces in root-element. namespaces xdocument parse webservice output not correctly. if delete namespaces works fine. explain me issue? , there handy solution deleting namespaces?

update 3 handy way removing namespaces1

with simple xml if know format wont change, might interested in using xpath:

var xdoc = xdocument.parse(e.result); var name = xdoc.xpathselectelement("/ws/info/name");

but multiple pages, maybe linq xml

var xdoc = xdocument.parse(xml); var pages = xdoc.descendants("pages").single(); var pageslist = pages.elements().select(x => new page((string)x.element("name"), (string)x.element("description"))).tolist();

where page simple class:

public class page { public string name { get; set; } public string descrip { get; set; } public page(string name, string descrip) { name = name; descrip = descrip; } }

let me know if need more explanation.

also select info without xpath:

var info = xdoc.descendants("info").single(); var infoname = info.element("name").value; var infodescrip = info.element("description").value;

c# windows-phone-7 xml-parsing webservice-client

java - Unable to call an instance method from Clojure. -



java - Unable to call an instance method from Clojure. -

i'm new java , clojure. previous experience in mutual lisp, thought give clojure try. i'm unable figure out few basic things.

this actual java code.

import syntaxtree.*; import visitor.*; public class main { public static void main(string [] args) { seek { node root = new microjavaparser(system.in).goal(); system.out.println("program parsed successfully"); } grab (parseexception e) { system.out.println(e.tostring()); } } }

when run code, outcome expected.

└──╼ java main < ../input/factorial.java programme parsed

in clojure tried :

(ns clj-assign2.core) (defn -main [] (def root (.goal (microjavaparser. (. scheme in)))) (println "successfully parsed"))

but when code run, next exception raised :

└──╼ lein run < ../assign2/input/factorial.java exception in thread "main" java.lang.illegalargumentexception: no matching field found: goal class microjavaparser @ clojure.lang.reflector.getinstancefield(reflector.java:271) @ clojure.lang.reflector.invokenoarginstancemember(reflector.java:300) @ clj_assign2.core$_main.invoke(core.clj:7) < --- snipped --- >

what doing wrong here?

maybe missing import statement in clojure program?

java clojure leiningen clojure-java-interop

html - Top-fixed navbar jittering on Android browsers while scrolling? -



html - Top-fixed navbar jittering on Android browsers while scrolling? -

visit webpage uses navbar that's fixed top using android device.

example 1: next web

example 2: test page built (you'll have scroll downwards little bit fixed navbars)

is me, or else see navbar "jitter" when scroll page? there can prepare it? see issue on samsung galaxy s3 running jelly bean chrome, dolphin browser hd, , stock browser. reason, cannot replicate issue asus transformer tf101 tablet.

android html css

ios - How to customize Push and Pop animations in a navigation based app -



ios - How to customize Push and Pop animations in a navigation based app -

i have navigation based application , want alter animation of force , pop animations here: how alter force , pop animations in navigation based app

i tested , it's worked fine!

i'm quit new in ios , want know if can custom transition. scale , fade navigationcontroller.

i animation on feedly app when click on content.

thank help!

ios ipad uinavigationcontroller catransition

mysql - Common SQL Queston, Finding Counts of a Group By MAX -



mysql - Common SQL Queston, Finding Counts of a Group By MAX -

i'm simple problem, can't seem wrap head around , can't think of keywords up. i'd avoid hacking bad solution when i'm there's efficient way this.

basically, have mysql table comments, have ids , dates submitted, , want users able edit these comments. when comment edited, i'd create new entry in table same id comment beingness edited, new date.

so when i'm selecting list of comments, want utilize select max(datesubmitted) ... grouping id, i'd count of number of ids grouped each one, know how many times comment has been edited.

i think should this:

select id, count(1) "number of edits" comments grouping id;

merged with:

select id, max(`datesubmitted`), comment comments grouping id;

if want latest comment text date edited , count:

select a.id, a. maxdatesubmitted, a.numcomments, b.comment (select id, max(`datesubmitted`) "maxdatesubmitted", count('id') "numcomments" comments grouping id) inner bring together comments b on a.id = b.id , b.datesubmitted = a.maxdatesubmitted;

note: assumes no 2 edits have same date , time (down precision of time portion). in case, think valid assumption.

if want latest edit date , count:

select id, max(`datesubmitted`) "maxdatesubmitted", count('id') "numcomments" comments grouping id

mysql sql group-by

git - Unable to clone from a repo from different user -



git - Unable to clone from a repo from different user -

on local, there 2 user accounts.

1) user 2) hadoop

i develop code on user , re-create in hadoop utilize it..

so instead of going long route, thought, maybe can force code repo , pull @ other end

while able force code user repo

but when seek pull code hadoop.. getting error?

remote: permission denied (publickey). abort: no suitable response remote hg!

though, facing issues mercurial, there might overlap among git users well.. hence tagging them sense free untag if thinks, problem doesnt applies @ end.

any clues? thanks

that's ssh telling hadoop user doesn't have access ssh server mercurial repo sitting behind. whatever did set key user same thing hadoop.

git mercurial

gruntjs - Using coffeescript with basic Yeoman project. -



gruntjs - Using coffeescript with basic Yeoman project. -

i've used yeoman create quick project skeleton using yo webapp generator command. in resulting gruntfile see it's setup compile coffeescript seems sticking compiled files in tmp folder.

coffee: { dist: { files: { '.tmp/scripts/coffee.js': '<%= yeoman.app %>/scripts/*.coffee' } }, },

how these included in project during development. i'm not using requirejs.

the yeoman docs unclear on how utilize coffeescript. mention gets automatically compiled.

using yeomen 1.0.0-rc1.4. use:

$ yo angular --coffee

the resulting project has controller , app scripts in coffeescript.

grunt configuration file remains in js (what not problem).

running

$ grunt test

runs tests , seems fine.

$ grunt server

is doing 1 expects (build app, test it, starts server, opens app in web browser , starts watching changes, if alter coffee script file, reflected in web broser.

documentation states, 1 can utilize yo add together particular pieces

angular:controller angular:directive angular:filter angular:route angular:service angular:decorator angular:view

each can called --coffee switch , script in coffeescript, e.g.:

yo angular:controller user --coffee

coffeescript gruntjs yeoman

c# - Create Two Executables from Single Project in Visual Studio? -



c# - Create Two Executables from Single Project in Visual Studio? -

i have solution in visual studio 2012 has 2 projects:

main application settings application

they both reference same info file , utilize same info model files (in main application project).

what i'd allow user either open settings application interdependently or open setting window within main application. way can modify settings while application running, or not. also, changes made while running instantly reflected.

i tried adding settings application project dependency main application, open window, create circular dependency; because setting application relies on main apps info model.

how can tidy code allow user open settings window within application or via external executable?

you should have 3 projects:

shared info model class library main application ui settings ui

that way main ui can depend on settings ui without causing circular dependency.

or of course of study set 3 within same single executable project, , not have settings ui separate binary...

c# visual-studio

iphone - iOS api for real time traffic data (like geoloqi and Waze) -



iphone - iOS api for real time traffic data (like geoloqi and Waze) -

i have been visiting services api website can't find looking for. question more aimed @ resources utilize rather how should done.

my iphone app requirement able track users nearby, commuting , locate them on map. additional requirement maybe texting them, phone call them, have video session them etc. on high level, convert like

get user details based on longitude , latitude get know if registered users of service subscribed sending message user/users call user using iphone phone api or dedicated app session video call

waze 1 of them. while open source, there quite less documentation on how 1 can utilize backend real time traffic data.

then there geoloqi paid, has ios sdk rich api. cannot find sections useful me when requirements listed above. believe there must many apps relying on such useful service. if of them open source / tutorials, useful resource me feasibility of geoloqi. geoloqi charges users using api, of import me know features come @ cost .

for level of data/information interested in, , functionality, should create own app, dont think need apis.

you can find , send coordinates of people using app server. need determine distance between them, see if in zone of talking, or whatever other functionality have listed above.

to determine distance between 2 people, reply should helpful: calculate distance between 2 gps coordinates

iphone ios api sdk gps

ios - Create an array of CGPoints by pairing values from two different NSArrays -



ios - Create an array of CGPoints by pairing values from two different NSArrays -

how create array of cgpoints pairing values 2 different nsarrays in objective-c?

lets have array "a" values: 0, 1, 2, 3, 4 , have array "b" values: 21, 30, 33, 35, 31

i create array "ab" cgpoint values: (0,21), (1,30), (2,33), (3,35), (4,31)

thanks help.

note objective-c collection classes can hold objects, have assumed input numbers held in nsnumber objects. means cgpoint structs must held in nsvalue object in combined array:

nsarray *array1 = ...; nsarray *array2 = ...; nsmutablearray *pointarray = [[nsmutablearray alloc] init]; if ([array1 count] == [array2 count]) { nsuinteger count = [array1 count], i; (i = 0; < count; i++) { nsnumber *num1 = [array1 objectatindex:i]; nsnumber *num2 = [array2 objectatindex:i]; cgpoint point = cgpointmake([num1 floatvalue], [num2 floatvalue]); [pointarray addobject:[nsvalue valuewithcgpoint:point]]; } } else { nslog(@"array count mis-matched"); }

ios objective-c nsarray cgpoint

java - JProfiler memory views -> Object size -



java - JProfiler memory views -> Object size -

i have next classes in application:

class { string somestring; locale somelocale; map<integer, b> somemap = new hashmap<integer, b>(); fillmap() { // logic fill map instances of b } } class b { // lots of filled collections }

i'm doing profiling session jprofiler identify memory problems. on memory view tab, aggregation level classes, have illustration 2000 instances of a, total size of 156kb.

my question size means? size of references object or size of filled members of (i'm wondering map)? guess it's somehow reference size wanted create sure of this.

the dynamic memory views not show retained sizes, shallow sizes.

to see retained sizes, go heap walker, double click on class create new object set. then, click on "calculate retained , deep size" in header.

this gets retained size entire class, although retained sizes single instances may more interesting. that, go "references" view or "biggest objects" view.

java profile jprofiler

javascript - Change the background color of an attribute of CSS by the click of an image -



javascript - Change the background color of an attribute of CSS by the click of an image -

i'm looking have background color of content attribute fade color upon user clicking color image.

i assume going wrong way , grateful help.

i hope post correctly. apologies if not. i've been browser long time , have decided register.

http://jsfiddle.net/whiteslevin7/lacfa/9/

<body> <div id ="wrapper"> <section id ="logo"> </section> <section id ="header"> </section> <div id="accessibility"> <ul> <li><a data-color-id="1" href="#"><img src="images/red-color.jpg"></a></li> <li><a data-color-id="2" href="#"><img src="images/blue-color.jpg"></a></li> <li><a data-color-id="3" href="#"><img src="images/grey-color.jpg"></a></li> <li><a data-color-id="4" href="#"><img src="images/purple-color.jpg"></a></li> </ul> </div> <section id="content"> <article> </article> </section> </div>

a{ color: #ffffff; text-decoration: none; font-size: 85%; border: 0; } a:hover{ color: #000000; font-size: 85%; } #header{ height: 170px; background: url(images/banner.jpg) no-repeat center ; padding: 0px; } #logo{ height: 109px; background: #9bbdc7 url(images/logo.jpg) no-repeat center; border-style: none; padding: 0px; } #accessibility li { float: left; padding: 0 20px 0 0; list-style: none; } #accessibility li { color: #cfcfcf; font-size: 16px; font-weight: bold; text-decoration: none; transition: 0.2s linear; -webkit-transition: 0.2s linear; -moz-transition: 0.2s linear; } #wrapper { width: 960px; margin: 10px auto; text-align:left; min-width: auto; } #content { width: 100%; background: #eff6f4; float: left; transition: background 4s linear; -webkit-transition: background 4s linear; -moz-transition: background 4s linear; } article{ background: #f9f6f6; border: 1px solid black; padding: 20px; margin-bottom:10px; margin-top:10px; } function changebg(currentitem) { var bg = 'null'; currentitem = number(currentitem) switch (+currentitem) { case 1 : bg = '#9cc8bc'; break; case 2 : bg = '#9ca7c8'; break; case 3 : bg = '#c8bc9c'; break; case 4 : bg = '#c89cbd'; break; default : bg = '#eff6f4'; } $('#content').css('background', bg); } jquery('#accessibility li a').bind('click', function() { changebg(this.id); homecoming false; });

issues: (1) wrap event handler within ready(). (2) set style valid element, #content.

working code: live demo

html

<div id ="wrapper"> <section id ="logo"></section> <section id ="header"></section> <div id="accessibility"> <ul> <li><a id="1" href="#"><img src="images/red-color.jpg"></a></li> <li><a id="2" href="#"><img src="images/blue-color.jpg"></a></li> <li><a id="3" href="#"><img src="images/grey-color.jpg"></a></li> <li><a id="4" href="#"><img src="images/purple-color.jpg"></a></li> </ul> </div> <section id="content"> <article> </article> </section> </div>

script

function changebg(currentitem) { var bg = 'null'; switch (+currentitem) { case 1 : bg = '#9cc8bc'; break; case 2 : bg = '#9ca7c8'; break; case 3 : bg = '#c8bc9c'; break; case 4 : bg = '#c89cbd'; break; default : bg = '#eff6f4'; } $('#content').css('background', bg); } jquery(document).ready(function() { jquery('#accessibility li a').on('click', function() { changebg(this.id); homecoming false; }); });

javascript jquery css switch-statement

c++ - Double-free error in execution after deleting pointer in deconstructor -



c++ - Double-free error in execution after deleting pointer in deconstructor -

i have class containing fellow member pointer dynamically allocated in constructor follows:

class record { public: record(unsigned short numbytes, char* bufrecord); ~record(); unsigned short size() {return m_numbytes;} private: unsigned short m_numbytes; char* m_bufrecord; }; record::record(unsigned short numbytes, char* bufrecord) { m_numbytes = numbytes; m_bufrecord = new char[numbytes]; for(unsigned short i=0; i<numbytes; i++) m_bufrecord[i] = bufrecord[i]; } record::~record() { delete m_bufrecord; }

it copies input buffer dynamically allocated fellow member buffer. proceed utilize class follows, in constructor of class:

class file { public: file(const char* filename); ~file(); unsigned int numrecords() {return m_records.size();} record getrecord(unsigned int numrecord) {return m_gdsrecords[numrecord];} private: std::ifstream m_file; std::vector<record> m_records; }; file::file(const char* filename) : m_file(filename, ios::in | ios::binary) { while(!m_file.eof()) { char bufnumbytes[2]; char* bufrecord; unsigned short numbytes; m_file.read(bufnumbytes, 2); numbytes = (bufnumbytes[0] << 8) + bufnumbytes[1] - 2; bufrecord = new char[numbytes]; m_file.read(bufrecord, numbytes); record record(numbytes, bufrecord); m_records.push_back(record); delete bufrecord; } }

however, when instantiate class, next error, seems state i'm double-freeing m_bufrecord:

*** error in `./a.out': double free or corruption (fasttop): 0x0000000001cb3280 ***

i'm guessing problem lies insertion of class containing pointer vector element, , destructor beingness called twice on same pointer i'm not sure how happens. doing wrong here?

this case of rule of three. if class needs free resources in destructor, needs declare re-create constructor (and re-create assignment operator), either re-create owned resource, manage shared ownership or prevent beingness copied.

c++ memory-management vector double-free

wpf - Raise an event in datagridview to update database for delete or update MVVM method -



wpf - Raise an event in datagridview to update database for delete or update MVVM method -

i think missing simple doing multiple step method data. allow me run through simpler version of doing in example.

i have observable collection implements inotifypropertychanged

the observable collection of class 'poco' simple poco class makes these 2 properties:

personid int { get; set; } name string { get; set; }

i have entity sql info model maps simple database table contains same meta values in poco class , let's simple illustration has 3 row values:

personid, name 1, brett 2, emily 3, test

the observable collection wired in modelview so:

observablecollection<poco> _pocos; pocoentities ee = new pocoentities(); public observablecollection<poco> pocos { { if (_pocos == null) { list<poco> mes = this.getpocos(); _pocos= new observablecollection<poco>(mes); } homecoming _pocos; } set { _pocos = value; onpropertychanged("pocos"); } } list<poco> getpocos() { homecoming ee.vpoco.select(p => new pocoview() { personid = p.personid, name = p.name }).tolist(); }

i have current item wired such.

poco _currentpoco; public poco currentpoco { { homecoming _currentpoco; } set { _currentpoco = value; onpropertychanged("currentpoco"); } }

4 , 5 guts of modelview wire them view of datagrid such:

<datagrid x:name="datagrid" itemssource="{binding pocos}" currentitem="{binding currentpoco}" />

this part not get, how update database's entity model in near real time? collection wired fine , updating, how tell database happened? if set event 'celleditending' or 'selectionchanged' , seek implement update proc entity model bombs in modelview. if stick code behind works, kind of, not seem capture 'after' changed value.

even using icommand property , implementing relay command done in mvvm. these methods won't work. curious if on thinking , type of interface can bake in refreshing database you. can handle inserting docs , using method populate or refresh datagrid able alter values in datagridview , update database directly.

summary: in simplest way possible wanting update database alter datagridview , observablecollection changes 2 sync each other.

there 2 categories of changes here:

the collection changes, i.e. items added and/or removed. track these changes, create vm hear observablecollection's collectionchanged event , utilize newitems , olditems properties figure out info add together and/or remove db. properties on 1 of poco instances changes, e.g. alter name of person. alter not trigger collectionchanged event collection still same.

for #2 implement simple viewmodel poco class handles updates properties. after all, poco should considered business object , should not exposed view directly. each pocovm holds reference single poco instance.

edit

i added more or less of code used in experiement, except stubbed database since have no thought using , how works. doesn't matter long returns lists of items , can tell update single item.

xaml same yours except added grid (readonly) show changes 1 time got accepted mysticaldblayer. got rid of currentitemas using pocovm maintain track of item editing.

<grid> <grid.rowdefinitions> <rowdefinition /> <rowdefinition height="auto"/> <rowdefinition /> <rowdefinition height="auto"/> </grid.rowdefinitions> <textblock>input-grid</textblock> <datagrid grid.row="1" itemssource="{binding pocos}"/> <textblock grid.row="2">readonly-grid</textblock> <datagrid grid.row="3" itemssource="{binding pocos, mode=oneway}" isreadonly="true"/> </grid>

view model (datacontext of xaml) goes file. database connection might vary based on use, have observable collection populate same way do, except create new pocovm (viewmodel) every poco and add together new pocovm observablecollection instead of poco itself.

class vm { observablecollection<pocovm> _pococollection = new observablecollection<pocovm>(); public observablecollection<pocovm> pocos { { if (_pococollection.count == 0) { _pococollection = new observablecollection<pocovm>(); ienumerable<poco> pocos = mysticaldblayer.getitems(); foreach (poco poco in pocos) { _pococollection.add(new pocovm(poco)); } } homecoming _pococollection; } } }

and pocovm every time seek update value of 1 of cells (only name update:able code number has getter), corresponding setter called in class. here can write db , deed based on whether worked out or not.

class pocovm : inotifypropertychanged { private poco _datainstance = null; public pocovm(poco datainstance) { _datainstance = datainstance; } public uint number { { homecoming _datainstance.number; } } public string name { { homecoming _datainstance.name; } set { if (string.compare(value, _datainstance.name, stringcomparison.currentcultureignorecase) == 0) return; if (!mysticaldblayer.updatepoco(_datainstance, new poco(_datainstance.number, value))) return; _datainstance.name = value; onpropertychanged("name"); } } public event propertychangedeventhandler propertychanged; void onpropertychanged(string property) { if (propertychanged == null) return; propertychanged(this, new propertychangedeventargs(property)); } }

wpf entity-framework mvvm datagridview

android - Jar mismatch! action bar sherlock and facebook sdk -



android - Jar mismatch! action bar sherlock and facebook sdk -

im writing app uses action bar sherlock , facebook sdk. hence imported 2 libraries project , , error saying have 2 jars of android-support-v4.jar

"found 2 versions of android-support-v4.jar in dependency list not versions identical (check based on sha-1 @ time). versions of libraries must same @ time."

what can do? can set 1 of jars other library? supposed identical, sizes diff..i dont wana go , change/delete libraries in sourcode. ideas?

jar mismatch problem happened because there 2 versions of android-support-v4.jar in dependency list 1 of them included in facebook sdk library , other in actionbarsherlock library.

the prepare problem delete android-support-v4.jar 1 of these 2 library , re-create other android-support-v4.jar instead of deleted one, in way sure have same version of jar file in both libraries , ride of build error.

android facebook

cookies - Phantomjs and sessions -



cookies - Phantomjs and sessions -

i can't maintain session surfing through website 1 time logged in.

i can login on site (i specify whatever page is, after login redirected homepage) have move page. first tried page.open() page.evaluate changing location.href window property, in both cases unfortunately result i'm not logged in anymore. traced login status rendering page on every page load event incremental png names (1.png, 2.png, etc) . tried --cookies-file=cookies.txt param didn't help much.

my questions are: best way "move" through site pages phantomjs? there specific way handle sessions in these cases (maybe sending cookies manually on each .open(), saying)?

thanks help.

sessions require cookies. have add together argument in phantomjs.

--cookies-file=/path/to/cookies.txt

look here more info.

edit : cookies.txt contains ?

session cookies login phantomjs

idl programming language - Scrambling an array in idl -



idl programming language - Scrambling an array in idl -

i wondering if there module in idl 1 can utilize scramble array of floating point numbers. tried using scramble.pro problem returns integers, , if seek utilize float doesn't homecoming exact numbers entered, example:

array = [2.3, 4.5, 5.7,8.9] scr_array = scramble(array) print, scr_array output: 4 2 8 5

and if utilize float:

print, float(scr_array)

the output is:

4.0000 2.0000 8.0000 5.0000

any ideas?

try using this sampling routine, asking elements:

idl> array = [2.3, 4.5, 5.7,8.9] idl> scramble_indices = mg_sample(4, 4) idl> print, scramble_indices 1 3 0 2 idl> print, array[scramble_indices] 4.50000 8.90000 2.30000 5.70000

idl-programming-language scramble

iframe - Hidden Form Field Page Title Referer -



iframe - Hidden Form Field Page Title Referer -

i trying page title show within iframe form. of our pages named match titles need have hidden form field pulls referring page.

<input type='text' name='referrer' value='<?=$_server['http_referer']?> '

this works shows http://www.domain-name.com/this-page-title.php

is there way remove url http://www.domain-name.com/

and replace dashes spaces along removing .php

thus "this page title" display in form field.

thanks appreciate help.

forms iframe field hidden referer

ruby on rails - Reaching 'tickets' that belongs to 'projects' that a user owns -



ruby on rails - Reaching 'tickets' that belongs to 'projects' that a user owns -

in project management app i'm working on, i'm working on page managing tickets, want should contain of following:

- tickets user has created - tickets belongs projects user has created

the tricky part utilize right code in controller, need help. '@users_tickets'works fine, '@owned_projects'. however, lastly thing creating array contains of tickets belongs projects user owns, need help me (yes, understand poor seek each loop totally wrong way go here).

how can accomplish want?

tickets controller:

1. def manage 2. @users_tickets = ticket.where(:user_id => current_user.id) 3. @owned_projects = project.where(:user_id => current_user) 4. 5. @owned_projects.each |project| 6. @tickets_for_owned_projects = ticket.where(:project_id => project.id) 7. end 8. end tables:

tickets table:

project_id ticket_status_id user_id title description start_date end_date

projects table:

user_id title description start_date end_date

if you're using has_many association, should simple as

class user < activerecord::base has_many :projects has_many :tickets has_many :project_tickets, through: :projects, class_name: 'ticket', source: :tickets #... end class project < activerecord::base has_many :tickets #... end # in tickets controller def manage @tickets = current_user.tickets @tickets_for_owned_projects = current_user.project_tickets end

upd: approach above should work. i'm literally falling asleep right , can't define wrong here. appreciate if looked it.

here's way around though.

class user < activerecord::base has_many :projects has_many :tickets def project_tickets result = [] self.projects.each |project| result << project.tickets end result.flatten end #... end

ruby-on-rails database ruby-on-rails-3 table

mysql - update row based on order in resultant table -



mysql - update row based on order in resultant table -

i'm writing online math testing program, , working on scripts calculate rank each user got. next code works, cringe every time see it.

get_set() puts result of query $users

function rank_users_in_test($tid){ $globals['db']->get_set($users,"select user,test user_results test=$tid order points desc,time"); // $users in order rank order $rank = 1; foreach ($users $u){ $globals['db']->query("update user_results set world_rank=$rank user={$u['user']} , test={$u['test']}"); $rank++; } }

the query in loop makes me cry bit. question is, there way mysql can automatically update each user's rank based on order appeared in result on first query? there related question here, not utilize update.

i'm using mysql 5.

thanks ring0 above, next reduced running time minutes mere seconds :d

create table temp ( rank int auto_increment, user int, test int, primary key(rank) ); insert temp(user,test) (select user,test user_results test=$tid order points desc,time); update user_results ur, temp t set ur.world_rank=t.rank ur.user=t.user , ur.test=t.test; drop table temp;

mysql sql

grails - How to configure AtmosphereHandlerService: No AtmosphereHandler found message? -



grails - How to configure AtmosphereHandlerService: No AtmosphereHandler found message? -

i create atmosphere handlers dynamically. in case of server restart, since created handlers lost, "no atmospherehandler found" exception. want configure message, , send client, client can send request re-create new handler. how can this?

grails websocket comet atmosphere

model view controller - sencha touch sort list by Distance -



model view controller - sencha touch sort list by Distance -

i want sort list of locations distance(displayed in list). have code sould work since new whole mvc thing, not sure place create work.

maybe can help me:

var geocoder = new google.maps.geocoder(); var geo = ext.create('ext.util.geolocation',{ autoupdate: false, listeners: { locationupdate:{ scope: this, fn: function(geo){ var haversindedistance = function(lat1,lon1,lat2,lon2){ if(typeof(number.prototype.torad)=="undefined"){ number.prototype.torad = function(){ homecoming * math.pi/180; } } var r = 6371; //km var dlat = (lat2-lat1).torad(); var dlon = (lon2-lon1).torad(); var lat1 = lat1.torad(); var lat2 = lat2.torad(); var = math.sin(dlat/2)*math.sin(dlat/2)+ math.sin(dlong/2)*math.sin(dlon/2)*math.cos(lat1)*math.cos(lat2); var c = 2*math.atan2(math.sqrt(a),math.sqrt(1-a)); var d = r*c; // km or miles //return d*0.621371192; //miles homecoming d; }; var store = ext.getstore('locationsstore'); store.suspendevents(true); store.each(function(location){ var lat2 = parsefloat(location.get(geocoder.geocode( { 'address': saddress}, function(results, status) { })))||0; var lon2 = parsefloat(location.get(geocoder.geocode( { 'address': saddress}, function(results, status) { })))||0; //var lat2 = parsefloat(location.get('lat'))||0;//try set geocode on ish //var lon2 = parsefloat(location.get('lon'))||0; if(lat2 && lon2){ var distance = haversinedistance(geo.getlatitude(),geo.getlongitude(),lat2,lon2); location.set('distance',distance); } }, this); store.resumeevents(); store.filter('distance',/\d/); store.sort('distance');//check if not done or can not done somewhere else list.setmasked(false); } }, locationerror:{ scope: this, fn:function(geo,btimeout,bpermissiondenied,blocationunavailable,message){ console.log([geo,btimeout,bpermissiondenied,blocationunavailable,message]); if(btimeout){ ext.msg.alert('timed out getting location.'); }else{ ext.msg.alert('error getting location. please create sure location services enabled on device.'); } list.setmask(false); } } } }); geo.updatelocation();

i found solution.just adding listener navigation/list view should it. had much in controller decided set straight view.

list model-view-controller sorting sencha-touch distance

Is there a way to extract the state of a flash object with javascript? -



Is there a way to extract the state of a flash object with javascript? -

i want extract actual visual state of flash object , contents of current frame javascript. want able reapply state different flash object on separate page, new flash object looks same original. html5 canvas lets easily, can done flash? note not have command of page has flash content, javascript included on page.

this might help out, assuming command flash js screenshot flash movie

javascript flash

javascript - Removing elements from a DOM copy -



javascript - Removing elements from a DOM copy -

i wanted remove element re-create of main dom cannot work.

basically trying remove h2 element duplicate dom , homecoming modified code in alert whatever have tried far original dom still.

<html> <head> </head> <body> <h2>test</h2> <script type="text/javascript" id="customscript"> var page = document.documentelement; var temppage = document.documentelement; temppage.removechild("h2"); // remove not working temppage.getelementbyid("h2").innerhtml = ""; // remove not working </script> <input type="button" value="get pages code" onclick="alert(temppage.innerhtml)"> </body> </html>

if possible rather not utilize jquery or yui etc , want utilize regular javascript.

there 2 parts question , doing them both incorrectly.

temppage same object page. assignment different variable not create copy--it lets access same object via name. need explicitly create copy. your attempts h2 element both incorrect. removechild() won't work because: it requires node object, not string. documentelement <html> element, <h2> element kid of <body>, not <html>. getelementbyid() won't work because <h2> element not have id attribute.

how is:

var temppage = document.documentelement.clonenode(true); // re-create document var h2 = temppage.queryselector('h2'); // find h2 element h2.parentnode.removechild(h2); // remove h2 element

if queryselector not available, much more tedious task still possible using normal dom manipulation. need learn dom manipulation

however finish code can't fathom why need clone page. this:

function textcontent(node) { homecoming node.textcontent || node.innertext || ''; } var h2 = document.getelementsbytagname('h2')[0]; var h2text = textcontent(h2);

javascript dom

iphone - PhoneGap Page scroll up after Keyboard appearance in iOS devices that makes the PhoneGap page corrupted -



iphone - PhoneGap Page scroll up after Keyboard appearance in iOS devices that makes the PhoneGap page corrupted -

i trying develop chatting application using phonegap ios devices. application has header shows logged user, footer user can write text message, , list view placed in body display messages.

i updated latest version of jquerymobile (1.3.0) issue still appearing within application. have attached snapshot shows how layout becomes corrupted. (http://i.stack.imgur.com/rslft.png)

i tried several solutions making page not scrollable (set uiwebviewbounce false) , not scalable (user-scalable=no) , other user interface changes, issue not solved.

does have thought how prepare this? (like refresh after soft keyboard appearance)

in order prepare issue temporarily (because shows breaks while keyboard showing), can set "keyboardshrinksview" "true" in configuration file (config.xml) or add together it:

<widget> ... <preference name="keyboardshrinksview" value="true" /> <plugins>...

iphone ios cordova layout iphone-softkeyboard

Concat column value and variable with specific length in MySQL -



Concat column value and variable with specific length in MySQL -

i have table products , table categories. here sample data products

id | product_name | category_id 1 | leath machine | 1 2 | drilling machine | 1 3 | boring machine | 1

and here category table

id | name | symbol 1 | smt equipment | smt

i want select display me results this

id | product_name | category_id | code 1 | leath machine | 1 | smt00001 2 | drilling machine | 1 | smt00002 3 | boring machine | 1 | smt00003

how cai that.

select `products`.`id`, `product_name`, `category_id`, concat(symbol, lpad(products.id,5,'0')) code products inner bring together categories on products.category_id = categories.id;

here sqlfiddle results.

sql fiddle demo

mysql

perl multiline find and replace, can't get newline working -



perl multiline find and replace, can't get newline working -

i have directory on linux host several property files want edit replacing hardcoded values placeholder tags. goal have perl script reads delimited file contains entries each of property files listing hardcoded value, placeholder value , name of file edit.

for example, in file.prop have these values set

<connection targethosturl="99.99.99.99" targethostport="9999"

and want replace values tags shown below

<connection targethosturl="targethost" targethostport="port"

there several entries similar have match on unique combination of ip , port need multiline match.

to wrote next script take input of delimited filename, delimited ||. go file config directory , read in values hardcoded value, tag, , filename edit. read in property file, substitution , write out again.

#!/usr/bin/perl $config = $argv[0]; chomp $config; $filename = '/config/' . $config; ($hard,$tagg,$prop); open(datafile, $filename) or die "could not open datafile $filename."; while(<datafile>) { chomp $_; ($hard,$tagg,$prop) = split('\|\|', $_); $*=1; open(input,"</properties/$prop") or die "could not open input $prop."; @input_array=<input>; close(input); $input_scalar=join("",@input_array); $input_scalar =~ s/$hard/$tagg/; open(output,">/properties/$prop") or die "could not open output $prop."; print(output $input_scalar); close(output); } close datafile;

inside config file have next entry

<connection targethosturl="99.99.999.99"(.|\n)*?targethostport="9999"||<connection targethosturl="targethost1"\n targethostport="port"||file.prop

my output shown below. puts hoped newline literal \n

<connection targethosturl="targethost"\n targethostport="port"

i can't find way \n taken newline. @ first thought, no problem, i'll 2nd substitution like

perl -i -pe 's/\\n/\n/o' $prop

and although works, reason puts ^m characters @ end of every line except 1 did replacement on. don't want 3rd replace strip them out.

i've searched , found other ways of doing multiline search/replace interpret \n literally.

any suggestions?

my output shown below. puts hoped newline literal \n

why insert newline when string doesn't contain one?

i can't find way \n taken newline.

there isn't any. if want substitute newline, need provide newline.

if used proper csv parser text::csv_xs, set newline in info file.

otherwise, you'll have write code handle escape sequences want code handle.

for reason puts ^m characters @ end of every line except 1 did replacement on.

quite opposite. removes 1 line did replacement on.

that's home programs represent carriage return. have file cr lf line ends. utilize dos2unix convert it, or leave because xml doesn't care.

perl

Android: Async Thread Issue -



Android: Async Thread Issue -

i have app loading info text files , storing info each file separate arraylist. told load info on async thread though app not crash loading oncreate method (it takes approx 12 seconds load of info text files arraylists).

i have attempted set async thread, have run issue. brand new async threads, not know/yet understand of details (i trying piece info different sources). here relevent code:

@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_name); new loaddata().execute(); arraylistelement = arraylist1.get(0); } private class loaddata extends asynctask<void, void, void> { progressdialog dialog; protected void onpreexecute() { dialog = new progressdialog(classname.this); dialog.setprogressstyle(progressdialog.style_spinner); dialog.show(); } @override protected void doinbackground(void... arg0) { // todo auto-generated method stub populatearraylists(); homecoming null; } /*protected void onprogressupdate() { } protected void onpostexecute() { }*/ }

i getting indexoutofboundsexception (invalid index 0, size 0) @ lastly statement in oncreate method.

all want load info on separate thread because though app not crash, told should it. ui thread should handle of rest. app working fine until added async thread code.

how files read can seen here: android: asynch thread needed?

what doing wrong?

you returning null doinbackground, of course of study fails. utilize asynctask it's meant do. work correctly, need correctly define asynctask appropriate type paramaters.

instead of making populatearraylists have side effects of updating other field, have method like:

void list<foo> getlistoffoo() { arraylist<foo> listoffoos = getthelistsomehow(); homecoming listoffoos; }

for example:

public class myactivity extends activity { public void dosomething(list<string> stringlist) { //do here } class myasynctask extends asynctask<void, void, list<string>> { @override protected list<string> doinbackground(void... params) { arraylist<string> listofstrings = getlistofstrings(); homecoming listofstrings; } @override protected void onpostexecute(list<string> strings) { super.onpostexecute(strings); dosomething(strings); } private list<string> getlistofstrings() { arraylist<string> stringlist = new arraylist<string>(); //this you'd perform expensive operation bufferedreader br = null; seek { br = new bufferedreader(new inputstreamreader(getassets().open( "text1.txt"))); string text; while ((word = br.readline()) != null) { stringlist.add(text); } } grab (ioexception e) { e.printstacktrace(); } { seek { br.close(); // stop reading } grab (ioexception ex) { ex.printstacktrace(); } } homecoming stringlist; } } }

android android-asynctask android-activity

javascript - Converting string to expression -



javascript - Converting string to expression -

is there way convert string expression?

my string: var1 == null && var2 != 5

i want utilize string status of if(), if(var1 == null && var2 != 5)

use eval. do

if (eval(" var1 == null && var2 != 5")) { }

javascript

java - Reading a file, getting the current position and reading backwards -



java - Reading a file, getting the current position and reading backwards -

i'm using bufferedreader class search occurrence in big file reading line line.

how can current position when occurrence found ? then, how can read in reverse file starting @ position ?

i searched on net consistent solution haven't found.

public static void main(string[] args) throws exception { filereader fr = new filereader("sample.txt"); bufferedreader reader = new bufferedreader(fr); string line = ""; arraylist<string> linee = new arraylist<string>(); while ((line = reader.readline()) != null) { if (line.equals("bb")) break; linee.add(line); } reader.close(); (int = linee.size() - 1; >= 0; i--) system.out.println(linee.get(i)); }

java file

objective c - How can I debug an HTTP POST sent from my iPhone app? -



objective c - How can I debug an HTTP POST sent from my iPhone app? -

i'm using next code upload image server:

// dictionary holds post parameters. can set post parameters server accepts or programmed accept. nsmutabledictionary* _params = [[nsmutabledictionary alloc] init]; datamanager *manager = [datamanager sharedmanager]; [_params setobject:[manager token] forkey:@"token"]; [_params setobject:[nsstring stringwithformat:@"%d",[manager site_id]] forkey:@"site"]; nsstring *boundaryconstant = @"----------v2ymhfg03ehbqgzcako6jy"; nsstring* fileparamconstant = @"image"; nsurl* requesturl = [nsurl urlwithstring:@"https://mysite.com/api/upload/"]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request setcachepolicy:nsurlrequestreloadignoringlocalcachedata]; [request sethttpshouldhandlecookies:no]; [request settimeoutinterval:30]; [request sethttpmethod:@"post"]; nsstring *contenttype = [nsstring stringwithformat:@"multipart/form-data; boundary=%@", boundaryconstant]; [request setvalue:contenttype forhttpheaderfield: @"content-type"]; nsmutabledata *body = [nsmutabledata data]; (nsstring *param in _params) { [body appenddata:[[nsstring stringwithformat:@"--%@\r\n", boundaryconstant] datausingencoding:nsutf8stringencoding]]; [body appenddata:[[nsstring stringwithformat:@"content-disposition: form-data; name=\"%@\"\r\n\r\n", param] datausingencoding:nsutf8stringencoding]]; [body appenddata:[[nsstring stringwithformat:@"%@\r\n", [_params objectforkey:param]] datausingencoding:nsutf8stringencoding]]; } nsdata *imagedata = uiimagejpegrepresentation(saveimage, 1.0); if (imagedata) { [body appenddata:[[nsstring stringwithformat:@"--%@\r\n", boundaryconstant] datausingencoding:nsutf8stringencoding]]; [body appenddata:[[nsstring stringwithformat:@"content-disposition: form-data; name=\"%@\"; filename=\"image.jpg\"\r\n", fileparamconstant] datausingencoding:nsutf8stringencoding]]; [body appenddata:[@"content-type: image/jpeg\r\n\r\n" datausingencoding:nsutf8stringencoding]]; [body appenddata:imagedata]; [body appenddata:[[nsstring stringwithformat:@"\r\n"] datausingencoding:nsutf8stringencoding]]; } [body appenddata:[[nsstring stringwithformat:@"--%@--\r\n", boundaryconstant] datausingencoding:nsutf8stringencoding]]; [request sethttpbody:body]; nslog(@"%@",body); nsstring *postlength = [nsstring stringwithformat:@"%d", [body length]]; nslog(@"sending request length: %@",postlength); [request setvalue:postlength forhttpheaderfield:@"content-length"]; [request seturl:requesturl]; nsurlconnection *conn = [[nsurlconnection alloc]initwithrequest:request delegate:self];

watching server logs seek , upload, don't lot of information:

82.132.x.x - - [06/feb/2013:15:37:45 +0000] "-" 400 0 "-" "-"

compare query same app:

82.132.x.x - - [06/feb/2013:15:36:13 +0000] "get /api/sites/?token=blah http/1.1" 200 269 "-" "my%20app/1.0 cfnetwork/609.1.4 darwin/13.0.0"

how can figure out going wrong? request malformed in way, causing error 400. there tool can utilize inspect it?

wireshark should allow inspect what's beingness sent / received.http://www.wireshark.org/download.html

objective-c http

php - How to search specific user's tracks by tag with the Sound Cloud API? -



php - How to search specific user's tracks by tag with the Sound Cloud API? -

i want search tracks tag relating user name i.e. royal opera house.

for example:

http://api.soundcloud.com/users/royaloperahouse/tracks/?client_id=238947hsgdhsdg&tags=eric

tells me need utilize q parameter. humour search:

http://api.soundcloud.com/users/royaloperahouse/tracks/??client_id=238947hsgdhsdg&tags=eric&q=e

and list of sounds whole of sound cloud not ones relating user. if seek , search tracks api (not users) , limit query &user_id videos relating users not 1 specific royal opera house.

the ultimate aim find tracks royal opera house has uploaded relating specific artist. @ moment way solving getting of our uploaded tracks (37 @ present) , iterating through match tracks relevant tag. our music list grows start problem.

thanks.

i haven't used api before, after few tests think i've found problem.

you shouldn't utilize users first url segment because aren't searching users, searching tracks filtered username , tags.

instead utilize tracks first url segment, , utilize q parameter filter username. can utilize use tags parameter well.

test url: http://api.soundcloud.com/tracks?q=username&tags=tag

sc.get('/tracks/', {q:'royaloperahouse', tags: 'insights' }, function(result) { console.log(result[0].tag_list); });

to honest still not understand q parameter. in api documentation find references in tracks, users, etc , in search page talk haven't found documentation q parameter filtering in each query type. in tracks username (and possible user id)

if consuming api, should inquire soundcloud team in google grouping more meaning of parameter.

php json api soundcloud

rmi - Has LocateRegistry.createRegistry(int port) changed in java 1.7? -



rmi - Has LocateRegistry.createRegistry(int port) changed in java 1.7? -

we have several server side components in our architecture. each component uses jmx expose various internal attributes. initialization done follows:

try { registry registry = null; for(int = _serverinfo.getjmxstartport(); <= _serverinfo.getjmxendport(); i++) { seek { registry = locateregistry.createregistry(i); if(registry != null) { _statusport = i; logger.info("using jmx port: "+_statusport); break; } } grab (exception e) { _statusport++; } } mbeanserver mbs = managementfactory.getplatformmbeanserver(); _abstractservicecontroller = new abstractservicecontroller(this); objectname mbeanname = new objectname("myserver:name=myserver service"); mbs.registermbean(_abstractservicecontroller, mbeanname); jmxserviceurl url = new jmxserviceurl("service:jmx:rmi:///jndi/rmi://:"+_statusport+"/jmxrmi"); jmxconnectorserver cs = jmxconnectorserverfactory.newjmxconnectorserver(url, system.getenv(), mbs); cs.start(); } grab (throwable e) { logger.error("unable register mbean jmx"); e.printstacktrace(); }

i guess have 2 questions.

does right?

the bigger question is, while runs fine on java 1.6 (each subsequent server on host uses next available port, since locateregistry.createregistry(i) throws exception if port unavailable), not on 1.7. result, next exception when sec server attempts jmxconnectorserver.start(). know if behavior changed createregistry? if so, there else should do?

2013-02-07 15:34:28,451 info [main] using jmx port: 9500 2013-02-07 15:34:28,929 error [main] unable register mbean jmx java.io.ioexception: cannot bind url [rmi://:9500/jmxrmi]: javax.naming.namealreadyboundexception: jmxrmi [root exception java.rmi.alreadyboundexception: jmxrmi] @ javax.management.remote.rmi.rmiconnectorserver.newioexception(rmiconnectorserve.java:826) @ javax.management.remote.rmi.rmiconnectorserver.start(rmiconnectorserver.java:431) @ com.theatre.services.framework.abstractservice.run(abstractservice.java:306) @ com.theatre.services.reporttree.treeserverimpl.run(treeserverimpl.java:690) @ com.theatre.services.framework.launcher.main(launcher.java:99) caused by: javax.naming.namealreadyboundexception: jmxrmi [root exception java.rmi.alreadyboundexception: jmxrmi] @ com.sun.jndi.rmi.registry.registrycontext.bind(registrycontext.java:139) @ com.sun.jndi.toolkit.url.genericurlcontext.bind(genericurlcontext.java:226) @ javax.naming.initialcontext.bind(initialcontext.java:419) @ javax.management.remote.rmi.rmiconnectorserver.bind(rmiconnectorserver.java:643) @ javax.management.remote.rmi.rmiconnectorserver.start(rmiconnectorserver.java:426) ... 3 more caused by: java.rmi.alreadyboundexception: jmxrmi @ sun.rmi.registry.registryimpl.bind(registryimpl.java:131) @ sun.rmi.registry.registryimpl_skel.dispatch(unknown source) @ sun.rmi.server.unicastserverref.olddispatch(unicastserverref.java:390) @ sun.rmi.server.unicastserverref.dispatch(unicastserverref.java:248) @ sun.rmi.transport.transport$1.run(transport.java:159) @ java.security.accesscontroller.doprivileged(native method) @ sun.rmi.transport.transport.servicecall(transport.java:155) @ sun.rmi.transport.tcp.tcptransport.handlemessages(tcptransport.java:535) @ sun.rmi.transport.tcp.tcptransport$connectionhandler.run0(tcptransport.java:790) @ sun.rmi.transport.tcp.tcptransport$connectionhandler.run(tcptransport.java:649) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908) @ java.lang.thread.run(thread.java:662) @ sun.rmi.transport.streamremotecall.exceptionreceivedfromserver(streamremotecall.java:273) @ sun.rmi.transport.streamremotecall.executecall(streamremotecall.java:251) @ sun.rmi.server.unicastref.invoke(unicastref.java:377) @ sun.rmi.registry.registryimpl_stub.bind(unknown source) @ com.sun.jndi.rmi.registry.registrycontext.bind(registrycontext.java:137) ... 7 more

does right?

no. creating registry can fail several reasons, not because port in use. registry cannot null after createregistry(), testing pointless. if you're trying find free port, open (and close) serversocket(). then create registry on port if worked.

the bigger question is, while runs fine on java 1.6 (each subsequent server on host uses next available port, since locateregistry.createregistry(i) throws exception if port unavailable), not on 1.7.

see above. creating registry can fail if there 1 running on port, in jdk. in before jdks fail if there 1 running on port in same jvm.

java rmi jmx

Importing data from web page with diffrent Dates in excel using VBA code -



Importing data from web page with diffrent Dates in excel using VBA code -

i don't know how import info web site ,which need since 1st of july 2012 until present. ideas guys?? don't know how since url changes. want import info since july 2012 until can through html source of web page?

sub websitee() activesheet.querytables.add(connection:= _ "url;http://www.epexspot.com/en/market-data/intraday", destination:=range( _ "$a$1")) .name = "intraday" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xltables .webformatting = xlwebformattingnone .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false union(columns(3), columns(4), columns(5), columns(7), columns(8), columns(9)).delete end end sub

next iteration: can phone call downloadperiod , should drop info on number 1 worksheets per day in jan 2012. please test , can go on next iteration of code.

sub downloaddayfromuser() dim sinput string sinput = inputbox("enter date in yyyy-mm-dd format") phone call websitee(sinput) end sub sub downloadperiod() dim downloadday date downloadday = #1/1/2012# while downloadday < #1/2/2012# ' create new workbook set info activeworkbook.worksheets.add ' phone call web service today phone call websitee(format(downloadday,"yyyy-mm-dd")) ' increment day downloadday = downloadday + 1 loop end sub sub websitee(sdate string) activesheet.querytables.add(connection:= _ "url;http://www.epexspot.com/en/market-data/intraday/" & sdate & "/", destination:=range( _ "$a$1")) .name = "intraday" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xltables .webformatting = xlwebformattingnone .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false union(columns(3), columns(4), columns(5), columns(7), columns(8), columns(9)).delete end

end sub

excel vba date webpage