Posts

Showing posts from August, 2015

Rails engine ActiveRecord models I18n -

i have rails app depends on separate engine (stored in vendor/engine_name ). engine has activerecord object bar : module foo class bar < activerecord::base # has attribute bar_attr end end in engine's config/locales/en.yml file, i've tried: en: activerecord: attributes: bar_attr: "test" i've tried: en: activerecord: attributes: bar: bar_attr: "test" and: en: activerecord: attributes: foo: bar: bar_attr: "test" but no matter what, when call foo::bar.human_attribute_name("bar_attr") parent app, "bar attr" (e.g. default human attribute name). note same problem occurs foo::bar.model_name.human when try translations using: en: activerecord: models: ... i'm not sure if app/engine structure relevant, i've tried above 3 en.yml formats within parent app's translations file too, no luck. what missing these mod

html - Customize text size in bootstrap button -

i trying create "download app store" button using twitter bootstrap. the issue having trying make "app store" text larger "download the" text above it. here html , css using. .fixed-hero .hero-text { padding-top: 90px; width: 65%; color:#fff; font-family: century gothic, sans-serif; font-size: 2.2em; line-height: 1.5em; } .fixed-hero .hero-button { padding-top: 60px; width: 65%; } .btn.btn-large.btn-danger{ border-style:solid; border-width:1px; border-color:#fff; background-image: linear-gradient(to bottom, rgb(204, 81, 81), #990000); text-align: left; } <div class="hero-button text-center"> <a href="#" class="btn btn-large btn-danger"> <i class="icon-apple icon-3x pull-left"></i> <div> download app store </div>

how can I run the Thales "NC" diagnostic host command from linux / cygwin console -

i run thales nc (perform diagnostics) host command directly linux / cygwin console. how can done? assuming have xxd , nc (netcat) installed, can peform following: $ echo '0006303030304e43' | xxd -r -p | nc localhost 9998 !0000nd007b44ac1ddee2a94b0007-e000 the command 0006303030304e43 broken down follows: 0006 = command length in hex (i.e. length of 0000nc ) 30303030 = 4 byte header 0000 in hex 4e43 = 2 byte command nc in hex !0000nd007b44ac1ddee2a94b0007-e000 - response hsm. if don't have xxd , can use perl : echo '0006303030304e43' | perl -e 'print pack "h*", <stdin>' | nc localhost 9998 update 1: simpler solution: echo -ne '\x00\x06\x30\x30\x30\x30\x4e\x43' | nc localhost 9998 update 2: pure perl solution: perl -e 'use io::socket::inet; $sock = new io::socket::inet(peeraddr=>"localhost:9998") or die; $sock->send(pack "h*","0006303030304e43")

How to mark a file as unmodified in CVS -

i checked out file, , changed it, don't want commit change. there way fake cvs thinking file not modified? want similar "flush" command in perforce. i using tortoisecvs , command line. if content different between version , server's cvs think modified , needs submitted. best bet explicitly list files want checkin when run 'cvs commit'.

Working on a multi-language (C++/JavaScript) project in eclipse -

i working on codebase uses mixture of c++ , javascript, , use eclipse ide. i have installed both cdt , jsdt, i'm wondering how use them together. is necessary create separate project c++ code , separate project javascript code? in code hierarchy, c++ , javascript files mixed together, it's not there 1 folder each. or possible seamlessly use 2 languages in same project? the best way go here create 2 separate projects. when create c++ project, can add javascript project referred project. way can exchange resources.

javascript - Show geoJSON properties in jQuery Mobile Panel -

first off i'm novice @ js please bear me if simple task complete. i'm using stock leafletjs popup bubble display properties geojson. however, utilize jquery mobile panel display properties geojson file when clicked on, similar openlayers example here . in advance! update: here js using load geojson stock popup leaflet: $.getjson(dict[geojson variable goes here], function(data){ l.geojson(data, { style: style, oneachfeature: function (feature, layer){ if (feature.properties.something == 0){ return layer.bindpopup("<b><em>" + feature.properties.name + "</em> label<br />label</b>");} else if (feature.properties.attacks == 1){ return layer.bindpopup("<b><em>" + feature.properties.name + "</em> label<br />" + feature.properties.something + " label</b>");} else {

if statement - nested IFs or multiple condition in single IF - perl -

i have piece of code multiple conditions in perl if (/abc/ && !/def/ && !/ghi/ && jkl) { #### } will every condition evaluated @ once on every line? i can prioritize conditions using nested if s if (/abc/){ if (!/def/){ ....so on } && short-circuits. evaluates rhs operand if needed. if it's lhs operand returns false, && value. for example, use feature qw( ); sub f1 { "1"; 1 } sub f2 { "2"; 0 } sub f3 { "3"; 0 } sub f4 { "4"; 0 } 1 if f1() && f2() && f3() && f4(); output: 1 2 so following 2 lines same: if (/abc/) { if (!/def/) { ... } } if (/abc/ && !/def/) { ... } in fact, if compiles and operator, above close to (/abc/ , !/def/) , { ... }; (/abc/ && !/def/) , { ... };

Jquery validation and TinyMCE 4.0.1 -

since updated tinymce version 4.0.1 jquery validation not longer working. in version 3.x, script works without problems. can use onchange_callback function @ ...? has had idea or same problem before? my tinymce config: tinymce.init({ language : "de", mode : "textareas", theme : "modern", height: 250, statusbar : false, relative_urls : false, // update validation status on change onchange_callback: function(editor) { tinymce.triggersave(); $("#" + editor.id).valid(); }, // theme options ... </script> my validation code: $(document).ready(function() { // update underlying textarea before submit validation tinymce.triggersave(); ... ... validator.focusinvalid = function() { // put focus on tinymce on submit validation if( this.settings.focusinvalid ) { try {

Inject Spring Bean as Endpoint with Jersey SpringServlet -

migrating jax-rs service cxf on jersey because of issues wls 12. i have interface has jax-rs annotations , 2 classes implement (one being class fulfills default functionality , 1 stubbed implementation). in cxf, can use property drive implementation class fulfills rest request through spring injection: <alias name="restproxyapi${restproxyapi.sib:impl}" alias="restproxyapiendpoint" /> <jaxrs:server id="jaxrs.restproxyapi" address="/"> <jaxrs:servicebeans> <ref bean="restproxyapiendpoint" /> </jaxrs:servicebeans> </jaxrs:server> i don't see way jersey. jersey seems want me use spring's component scanning , declare package api endpoint existw in. not want do. there way in jersey can utilize bean id resource jersey uses fulfill request coming springservlet? i've been looking solution of issue while well. however, think there's no such mechan

html - Cascade rows below header rows in a table -

i've created table website has rows underneath headings. there going multiple headers , want table show headers when first displayed, , display below rows when button header clicked. there way of doing this? i've been looking cascading tables have shown drop-down menus, isn't i'm looking for. (links, explanations, code) appreciated! below example of 1 of headings , of following rows in table. further clarify example, i'd want make row displaying "current location" shown , following rows (rural, suburban, metropolitan--types of locations) not visible until current location clicked or button there clicked. <table border="1" cellpadding="5%"> <tr><th align=left>current location</th></tr> <tr> <td>rural</td> <td>total value</td> <td>average value</td> <td>percentage of total</td>

sorting - OpenGL, alpha blending with packed buffer and multiple textures -

i'm drawing simple 2d scene containing rectangles. have 1 floatbuffer put x, y, z, r, g, b, a, u, , v data each vertex. draw using gldrawarrays , gl_triangle_strip , keeping rectangles separate degenerate vertices. to facilitate use of multiple textures, keep separate float arrays each texture's draw calls. texture binded, float array put floatbuffer, , draw. next texture binded , continues until have drawn of textures render. i use orthographic projection can use z coordinates , gl_depth_test setting depth independently of draw order. to use alpha blending, every piece of advice on internet seems say: gles20.glenable(gles20.gl_blend); gles20.glblendfunc(gles20.gl_src_alpha, gles20.gl_one_minus_src_alpha); this works fine per each texture's "draw", because have draw calls sorted in buffer front before drawing. have no way correctly draw texture2 under partially transparent texture1 because of depth test , texture1 being drawn before texture2. textu

Command line app: Unix cd command -

my mac os command line application making unix calls such as: system("rm -rf /users/stu/developer/file); perfectly successfully. so why following not changing current directory? system("cd /users/me/whatever"); system("pwd"); //cd has not changed because system() executes command specified in command calling /bin/sh -c command , , returns after command has been completed. so each command executed independently, each in new instance of shell. so first call spawns new sh (with current working directory), changes directories, , exits. second call spawns new sh (again in cwd). see man page system() . the better solution to not use system . has inherent flaws can leave open security vulnerabilities. instead of executing system() commands, should use equivalent posix c functions. everything can command-line, can c functions (how think utilities work?) instead of system("rm -rf ...") use this . instead

r - Appending list index number to matrix items as a new column -

simple question no doubt. taking starting point: l = matrix(1:6, ncol=2) lst = list(l, l) how can add list index fresh column each matrix? e.g. [[1]] [,1] [,2] [,3] [1,] 1 4 1 [2,] 2 5 1 [3,] 3 6 1 [[2]] [,1] [,2] [,3] [1,] 1 4 2 [2,] 2 5 2 [3,] 3 6 2 ... assuming matrices have varying numbers of rows. i've attempted various permutations of lapply no luck. in advance. slightly simpler. practically problem involving applying function each element of 2 (or 3, or n) objects in order can given mapply or map solution (thanks, @mnel): mapply(cbind, lst, seq_along(lst), simplify=false) # ...and map being wrapper mapply no simplification map(cbind, lst, seq_along(lst)) [[1]] [,1] [,2] [,3] [1,] 1 4 1 [2,] 2 5 1 [3,] 3 6 1 [[2]] [,1] [,2] [,3] [1,] 1 4 2 [2,] 2 5 2 [3,] 3 6 2

Error importing a file to PostgreSQL -

this question has answer here: postgres error on insert - error: invalid byte sequence encoding “utf8”: 0x00 5 answers i'm trying import tab separated values file postgresql database using "copy" command. problem is fails on line error message error: invalid byte sequence encoding "utf8": 0x00 the bad line can found in this file . it still fails when try import single-line file. i tried open file looks normal text file , cannot find anyway resolve problem. schema of table looks like create table osm_nodes ( id bigint, longitude double precision, latitude double precision, tags text ); i use following command copy file cat bad_lines2 | psql -c "copy osm_nodes stdin delimiter ' '" (note: delimeter above tab character) i use (postgresql) 9.2.3. thanks help. i found error. text contains &qu

javascript - How to bind click event on image added using CSS 'background-image' property in jQuery -

here fiddle link i guess question clear title itself. still, looking way bind click event on image added using css's background-image property. i know, have achieved similar functionality ( of placing image on input field using this way or this way ) positioning <img> tag on input box , handling required events way didn't seem flexible input fields of varying width , height or if wrapping div doesn't have position:relative; property. if adding event on image loaded background-image not possible how make later approach more flexible. hope have conveyed issues clearly. thanks. something appears work: $('.cross').click(function(e) { var mouseposinelement = e.pagex - $(this).position().left; if (mouseposinelement > $(this).width()) { $(this).val(''); } }); link example

linux - RPM ignore conflicts -

i have bunch of rpm files in folder. trying install them using: rpm -ivh *.rpm rpm can take care of correct installation order. on of these rpms have newer version installed in system example: package info-5.0-1 (which newer info-4.13a-2) installed /opt/freeware/man/man1/infokey.1 install of info-4.13a-2 conflicts file package info-5.0-1 is there way ignore old .rpm file , resolve dependency new version installed? thought of --force option. how --force resolves conflicts? overwrites them older version or ignores them leaving new version? any thoughts welcome. the --force option reinstall installed packages , overwrite installed files other packages. don't want normally. if tell rpm install rpms directory, this. rpm can not ignore rpms listed installation. must manually remove unneeded rpms list (or directory). you can remove old rpm , rpm resolve dependency newer version of installed rpm. work, if none of installed rpms depends on old version. if n

angularjs - Yeoman "yo build:minify" or ""yo build" fails on Win7 -

i'm trying latest version of generator-angular working win7x64. i've installed generator angular using "npm install -g generator-angular." if create project yo angular , run yo build:minify following error: you don't seem have generator name build:minify installed. can see available generators npm search yeoman-generator , install them npm install [name]. see 15 registered generators run yo `--help` option. if create project yeoman init angular , run yeoman build get done, without errors. i believe yeoman command outdated. thoughts on how yo working? $ yeoman build became $ grunt build . please read migration guide .

jQuery .toggle event deprecated, What to use? -

since jquery .toggle event method deprecated. suppose use simulate event (alternate clicks)? add outside of document.ready $.fn.clicktoggle = function(a, b) { return this.each(function() { var clicked = false; $(this).click(function() { if (clicked) { clicked = false; return b.apply(this, arguments); } clicked = true; return a.apply(this, arguments); }); }); }; then use following replicate .toggle functionality: $("#mydiv").clicktoggle(functiona,functionb); found on jquery forums

python - Flask-Admin & Authentication: "/admin" is protected but "/admin/anything-else" is not -

i'm trying customize admin views flask , flask-superadmin, however, index view , subviews apparently not using same is_accessible method: edit : managed figure out doing wrong. needed define is_accessible in every view class. well-accomplished mixin-class, show in fixed code: app/frontend/admin.py ( fixed & working code ) from flask.ext.security import current_user, login_required flask.ext.superadmin import expose, adminindexview flask.ext.superadmin.model.base import modeladmin ..core import db # admin views should subclass authmixin class authmixin(object): def is_accessible(self): if current_user.is_authenticated() , current_user.has_role('admin'): return true return false # view gets used admin home page class adminindex(authmixin, adminindexview): # use custom template admin home page @expose('/') def index(self): return self.render('admin/index.jade') # base view other admin pages c

multithreading - Android database best practices? -

what "android way" implement database framework? the 2 goals: it should generic enough "database" can sqlite database or on network. it should multi-thread safe. ( updated: "thread safe", mean should not run in main ui thread, database calls should not conflict each other, , system should know how communicate results main ui thread.) updated: should know configuration changes (like changing phone orientation) this i've gathered here , android docs: use loadermanager querying data. create contentprovider (1 & 2 makes thread safe) put class between contentprovider , data. however, creating, updating, , deleting data? far can tell, loadermanager queries. should using asyncqueryhandler? update: asyncqueryhandler doesn't know configuration changes. i've read fragments may way go. or... i'll have make sure asyncqueryhandler implementation handles configuration changes. (1) pretty easy: put class between con

web services - Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ws"&#xD; -

i have created web service using jax-ws. when access web service getting following response: <?xml version='1.0' encoding='utf-8'?><s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:body><s:fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>s:client</faultcode><faultstring>couldn't create soap message due exception: xml reader error: com.ctc.wstx.exc.wstxparsingexception: undeclared namespace prefix "ws"&#xd; @ [row,col {unknown-source}]: [1,169]</faultstring></s:fault></s:body></s:envelope> my web service is: @webservice public interface helloservice { @webmethod string hello(@webparam(name = "name")string msg); } public class helloserviceiml implements helloservice { @override string hello(string msg){ return "hello" + msg; } } public class mainws { /** * @param args */

How to avoid 400 error in spring mvc when binding as java Bean -

i'm using spring mvc. in controller, want parameter java bean order. order bean has several parameters, 1 of them duedate (java.util.date). @requestmapping("/toaddorder") public modelandview addorder(order order, bindingresult bindingresult){ return new modelandview("redirect:tovieworder"); } @initbinder protected void initbinder( webdatabinder binder) throws servletexception { binder.registercustomeditor(byte[].class, new bytearraymultipartfileeditor()); simpledateformat dateformat = new simpledateformat("yyyy-mm-dd"); dateformat.setlenient(false); binder.registercustomeditor(date.class, new customdateeditor(dateformat, false)); } problem if not set value duedate before submiting form controller. meet error. bad_request , because duedate null or "". so, want know, how avoid problem? solutions can found follows. 1. js check before submit form. 2. not binding order, parameters

javascript - How can I map a prototype function to an array of objects that have that prototype? -

is there way in javascript handle on object prototype function guaranteed object in question? particularly got pita situation when wanted map array of objects of proper type such function. ended being window. yes did pull function proper place internally refers 'this'. know call , apply not how might use them handle sort of situation. is there way short of explicit loop instead of using map? oddly apparently not same thing re 'this' object_with_the_prototype.some_prototype_function() would if instead have [object_with_the_prototype].map(this.some_prototype_function) how come? i think looking this: [object_with_the_prototype].map(function(thisobject) { thisobject.some_prototype_function(); } );

runtime - How to execute PHP commands dynamically at run time? -

i wonder there way let's dynamically load piece of code @ run time? instance have simple "switch...case" statement this: switch($choice) { case 'help': load_from_db('help'); break; case 'about': load_from_db('about'); break; } and have database: | keyword | command | require('help.php'); echo 'under construction.'; "load_from_db" function capable of reading db (we know how this) , execute corresponding command stored in database (my question part). another example simple "textarea" form user can write php code within , submit form. @ server side code executed , result wil shown user (i know not safe, example). any ideas? you can use, should avoid, http://de.php.net/eval

cordova - Phonegap: Retrieve all images & videos from camera roll/albums and display in a single page -

is possible ? im trying create custom view images/videos opposed default picker. yeah ! definitely, can make custom picker. have modify html , css looks , deploy `control/logic' in js. you can find js same here. have fun !

node.js - How to run AngularJS end to end tests on Jenkins? -

how can run angularjs end end tests on jenkins? far understand, e2e tests require web server. i can run e2e tests locally karma while node.js web server script running. see these links: using testacular jenkins angularjs e2e testing karma

3d - OpenGL,SOIL: Can I load a small png file or any size I want? -

i'm learning opengl , used soil lib map texture(png file) quad (follow nehe tutorials).nehe used image size 256x256. can use smaller picture ?(any size or power of 2 size) ? load texture function: int loadgltextures() { texture[0] = soil_load_ogl_texture ( "nehe.png", soil_load_auto, soil_create_new_id, soil_flag_mipmaps | soil_flag_invert_y | soil_flag_ntsc_safe_rgb | soil_flag_compress_to_dxt |soil_flag_power_of_two ); if(texture[0] == 0) return false; //glgentextures(1, &texture[0]); glbindtexture(gl_texture_2d, texture[0]); gltexparameteri(gl_texture_2d,gl_texture_min_filter,gl_linear); gltexparameteri(gl_texture_2d,gl_texture_mag_filter,gl_linear); return true; // return success } i think have re size picture photoshop or same software , aware picture size should power of 2 , between 64 , 256.

vb.net - Unable to resolve WCF "Metadata publishing for this service is currently disabled" error -

i'm branching out .net web services , unfortunately newbie @ it. i've decided build wcf service instead of asp.net service because of online recommendations. ultimate goal learn ios , other mobile programming. i'm familiar vb.net , c# standard , web applications. i'm receiving "metadata publishing service disabled" error when trying test url. i've research , tried implementing "fixes" issue, still come short. can please @ code , see i'm doing wrong? webconfig file <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" strict="false" explicit="true" targetframework="4.0" /> <customerrors mode="off"/> </system.web> <connectionstrings> </connectionstrings> <system.servicemodel> <services> <services> <service name="cct_main_srv.service1" b

AM/PM Distinction when formatting datetime field from sqlite into datetime field in R -

i have pulled data sqlite table r. 1 of columns string, datatime in sqlite. in following format: time_json number 1 2013-07-08 01:06:02 6 2 2013-07-08 01:08:01 6 3 2013-07-08 01:12:01 6 4 2013-07-08 01:14:01 6 5 2013-07-08 01:16:01 6 i need format time_json field proper date time in r, , account am/pm distinction. nothing i've tried works. thanks kindly. this seems work, using formats listed in ?strptime : test <- c("2013-07-08 01:06:02 am", "2013-07-08 01:06:02 pm") as.posixct( test, format="%y-%m-%d %i:%m:%s %p" ) result: [1] "2013-07-08 01:06:02 est" "2013-07-08 13:06:02 est"

php - set query string in admin login panel in codeignitor -

i have created admin login panel. here model, view, controller file. if login unsuccessful, want sent querystring . after fetching querystring value want set message incorrect email/password . i think have modify in catalog_model.php or else?? my controller(d:\wamp\www\codeigniter\application\controllers\admin\catalog.php) class catalog extends ci_controller { public function __construct() { parent::__construct(); $this->load->library('session'); $this->load->model('catalog_model'); } function index() { $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); $this->load->view('admin/templates/header'); $this->form_validation->set_error_delimiters('<div class="error_admin">', '</div>'); $this->load->database(); $this->form_validation->set_rules('email', 'email

php - Download CodeIgniter older version 2.x -

i new in codeingniter. , dont want download latest version http://ellislab.com/codeigniter i want work older version of codeigniter , think not available on http://ellislab.com/codeigniter http://ellislab.com/codeigniter/user-guide/installation/downloads.html if click on link on above page, redirect http://ellislab.com/codeigniter can tell me , can download older version. thanks you should able fork via github . if couldn't find it, located on release tab.

android - Calling a function in a currently displayed fragment from Application -

i hav fragment in mainactivity displays loading pic of now, while call function in xmlreader application class mainactivity itself. xmlreader uses asynctask read xml file online server. after execution, need alert fragment shows loading pic refresh else. question how alert displayed fragment? or atleast alert activity can call different fragment. read somewhere putting broadcast listener overkill, way? if want access current visible item in viewpager: // activity int position = mviewpager.getcurrentitem(); fragment currentitem = msectionspageradapter.getitem(position); if want callback activity fragment: // call custom method update() in activity fragment ((mainactivity) getactivity()).update();

javascript - What is the Exact Function to Popup a Window? -

this code popup box: <?php $getbtsid = $_request['uid']; $btsid = substr($getbtsid, 0, -1); ?> <center> <?php confunc($db); // connection function $congestedsite = mysql_query("select * `rollout_tracker` `site_id` '%".$btsid."'"); while($rows = mysql_fetch_array($congestedsite)) { echo "<b>bts id:</b> " . $btsid . "<br />"; echo "<b>sector id:</b> " . substr($getbtsid, -1) . "<br />"; } echo "<br /><br /><br />"; echo '<a href="javascript:window.close();">close window</a>'; ?> and how popup box called: echo "<a href=javascript:popcontact('btsdetails.php?uid=" . $row["bs_id"] . "')>" . $row['bs_id'] . "</a>"; and javascript function goes below: function popcontact(url) { var popup_width = 600; var po

java - apache poi showInPane - parameter in short data type -

i making excel file using apache poi library. after creating excel file more 32767 rows, can't set showinpane because of toprow parameter in short data type. when pass more 32767 row variable, gives me error. java.lang.illegalargumentexception: row index may not negative @ org.apache.poi.ss.util.cellreference.<init>(cellreference.java:133) @ org.apache.poi.ss.util.cellreference.<init>(cellreference.java:127) @ org.apache.poi.ss.util.cellreference.<init>(cellreference.java:119) @ org.apache.poi.xssf.usermodel.xssfsheet.showinpane(xssfsheet.java:2380) is there way can set toprow overriding short data type maximum value? showinpane apache javadoc void showinpane(short toprow, short leftcol) sets desktop window pane display area, when file first opened in viewer. parameters: toprow - top row show in desktop window pane leftcol - left column show in desktop window pane http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/s

linux - How to set encoding to PostgreSQL data base? -

i cant see cyrillic symbols in postgresql 9.1 on linux mint. want create new bd cyrillic encoding. says: create database ekb_1 encoding 'cp1251' template postgistemplate; but error: postgres=# create database ekb_1 encoding 'win1251' template postgistemplate; error: encoding win1251 not match locale ru_ru.utf-8 ПОДРОБНОСТИ: chosen lc_ctype setting requires encoding utf8. i try add lc_type 'ru_ru.win1251' not help. whats wrong? this work this: create database dbname encoding 'win1251' lc_ctype='ru_ru.cp1251' lc_collate='ru_ru.cp1251' template template0; if ru_ru.cp1251 locale doesn't exist, create sudo locale-gen ru_ru.cp1251 (ubuntu-style, assume mint similar in regard) , restart postgres (it doesn't pick new locales dynamically, , error message confusing). the postgistemplate db accepted template if has same encoding, unlikely given context. presumably it's in utf-8 . in case, ther

What is the difference between Consumes.For, Consumes.Selected, Consumes.All and Consumes.Context in MassTransit? -

i've started looking @ masstransit , writing classes handle messages. when implement interface consumes<t> 4 options: all , selected , for<t> , context . difference between 4 , when should them used? all gives messages consume. context context<tmessage> if need it. selected allows accept or reject messages before gets consumer. for<t> sagas, don't think there's use case outside of that. starting off, using all right answer.

asp.net - how to add button in gridview dynamically -

i creating gridview dynamically... want add buttons in , add relative rowcommand events. please me this. how create gridview's dynamically in code for (int = 0; < dtemployees.rows.count; i++) { tablerow tr = new tablerow(); tablecell tc = new tablecell(); gridview gv = new gridview(); gv.id = "gv" + dttasks.rows[i]["taskid"].tostring() + dtemployees.rows[i]["empid"].tostring(); datatable dt = dttasks.clone(); foreach (datarow dr in dttasks.rows) { if (dr["empid"].tostring() == dtemployees.rows[i]["empid"].tostring()) { dt.rows.add(dr.itemarray); } } gv.datasource = dt; gv.databind(); tc.controls.add(gv); tr.cells.add(tc);

php - jQuery Form Validation redirect if success validation -

i have jquery login form function check user validation. here js : $(document).ready(function() { $('#button_sign_in').click(function(){ console.log('login'); $.ajax({ url: "login", type: "post", data: $('#login_form').serialize(), success: function (data) { //console.log('data:'+data); if (data.user) { $('#lblusername').text(data.user.username); } else { $('#button_sign_in').shake(4,6,700,'#cc2222'); $('#username').focus(); } }, error: function (e) { console.log('error:'+e); } }); }); }); the logic is, if wrong username or pas

Retrieving data stored as image as string in SQL Server 2005 -

i need retrieve xml file stored image data in sql server. i using query - select convert(varchar, convert(binary, zd.validcontent)) zonedata zd join contentitem ci on zd.itemid = ci.itemid id = @dpathid i text but result returns small portion of xml file - <?xml version="1.0" encoding=" please help. thanks. char , varchar : char [ ( n ) ] varchar [ ( n | max ) ] when n not specified in data definition or variable declaration statement, default length 1. when n not specified when using cast , convert functions, default length 30. so, please specify suitable length (e.g. max shown in @devart's answer, or more appropriate value)

wso2esb - WSO2 ESB: message processor exponential redelivery -

i use message processors on wso2 esb 4.7.0 , need deliver message endpoint (which can unavailable). how implement exponential back-off redelivery strategy? this scenario can covered through dead letter channel, please refer following link on how can done. http://docs.wso2.org/wiki/display/integrationpatterns/dead+letter+channel

c# - Undo redo in window form and gridcontrol -

i have window form has multiple control , grid-view control , want add undo redo functionality form 20 levels,please help. dtstates = new datatable(); datacolumn dcindex = new datacolumn("id", typeof(int)); dcindex.autoincrement = true; dcindex.autoincrementseed = 1; dcindex.autoincrementstep = 1; dtstates.columns.add(dcindex); dtstates.columns.add("control", typeof(object)); dtstates.columns.add("type", typeof(object)); dtstates.columns.add("value", typeof(string)); dtstates.columns.add("controlid", typeof(string)); this datatable record action of form.but in case of gridview ,i confuse how record , maintain changes. your gridview show data datatable or better list. need save data. in fact datasource. save objects need deep copy ( how do deep copy of object in .net (c# specifically)? ) of it. need list hold dif

c# - How to get the xml node value in string -

i tried below code value of particular node, while loading xml exception thrown: exception: data @ root level invalid. line 1, position 1. xml <?xml version="1.0"?> <data xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <date>11-07-2013</date> <start_time>pm 01:37:11</start_time> <end_time>pm 01:37:14</end_time> <total_time>00:00:03</total_time> <interval_time/> <worked_time>00:00:03</worked_time> <short_fall>08:29:57</short_fall> <gain_time>00:00:00</gain_time> </data> c#: xmldocument xml = new xmldocument(); filepath = @"d:\work_time_calculator\10-07-2013.xml"; xml.loadxml(filepath); // exception occurs here xmlnode node = xml.selectsinglenode("/data[@*]/short_fall"); string id = node["short_fall"].innertext

css bootstrap alignment issue -

i'm having troubles aligning things in table row. have hyperlink , inline-form made of 1 textbox , 1 button. problem button goes next line instead of being aligned textbox. problem occurs in chrome, works fine in ie10 i use twitter bootstrap css. jsfiddle illustrates problem : http://jsfiddle.net/tq9qm/ can me ? the code of jsfiddle: <table class="view-header"> <tbody> <tr> <td> <span>edition du mandat </span> </td> <td> <div class="pull-right"> <a style="float: left;"> <span class="pointer">more options</span> </a> <form class="form-inline" placeholder="n° de contrat, nom/numéro de client"> <input class="input-xxlarge ng-dirty" type="text" placeholder="n° de contrat, nom/numéro de clien

java - Setting webapprootkey no-web.xml -

i'm migrating web app spring 3.2 , enjoying web.xml-free configuration. 1 part that's remaining setting webapp root key, did in web.xml so: <context-param> <param-name>webapprootkey</param-name> <param-value>webapproot</param-value> </context-param> i know spring creates default key, in case i'm running multiple versions of same war , need set key different value in each. optimally i'd take value properties file , use rootkey. i imagine somewhere here: public class webappinitializer implements webapplicationinitializer { private static final logger logger = logger.getlogger(webappinitializer.class); @override public void onstartup(servletcontext servletcontext) throws servletexception { // create root appcontext annotationconfigwebapplicationcontext rootcontext = new annotationconfigwebapplicationcontext(); rootcontext.register(appconfig.class); servletcontext.addlistener(new webapprootlisten

coldfusion - How do I inject a Coldbox plugin into every handler? -

we have plugins used throughout coldbox application. is there way globally inject these without having manually specify property each one? i've looked through wirebox docs , can't see relevant. (entirely possible i'm overlooking something; it's long , dense page.) it seem decorating frameworksupertype might way this, can't find mention of doing that. i'll point out stack overflow requires logging in , typing subject :) there several ways accomplish , way works. the first call getplugin("myplugin") everywhere want use since getplugin() method available in every handler, view, , layout. the second use mixin injection , place following @ top of every handler , access plugin variables scope: property name="myplugin" inject="coldbox:plugin:myplugin"; the third have handlers extend base handler joel suggested , place di property in base handler. the fourth, mentioned, use aop aspect , bind init() method every

javascript - How to highlight on mouseover without wiping out select control -

in openlayers trying highlight features of vector layer cursor moves on them. can make work. i'm trying make features selectable , have popup box when they're clicked. works too. what cant make work both of them @ same time. hoverselect seems overide popup select. i've based code on http://dev.openlayers.org/releases/openlayers-2.11/examples/highlight-feature.html few differences. know why hover select , select can't coexist? select = new openlayers.control.selectfeature(vector_layer, {clickout: true}); vector_layer.events.on({ "featureselected": onfeatureselect, "featureunselected": onfeatureunselect }); map.addcontrol(select); select.activate(); select.handlers['feature'].stopdown = false; select.handlers['feature'].stopup = false; //removed overrode select selecthover = new openlayers.control.selectfeature(vector_layer, {hover: true}); function

tcl - How to read number count of words? -

how read number count of words? lines has format: vertices_count x, y x, y x, y (x, y pair can in same line) for example: 3 12.5, 56.8 12.5, 56.8 12.5, 56.8 i read vertices_count number of words(escaping comma): so above example reading words should be: 12.5 56.8 12.5 56.8 12.5 56.8 set fh [open f r] gets $fh num read $fh data close $fh set number_re {-?\d+(?:\.\d*)?|-?\d*\.\d+} set vertices {} foreach {_ x y} [regexp -inline -all "($number_re),\\s*($number_re)" $data] { lappend vertices $x $y if {[llength $vertices] == $num * 2} break } puts $vertices # => 12.5 56.8 12.5 56.8 12.5 56.8 while {[llength $vertices] < $num * 2} { gets $fh line foreach {_ x y} [regexp -inline -all "($number_re),\\s*($number_re)" $line] { lappend vertices $x $y if {[llength $vertices] == $num * 2} break } } close $fh

c# - Add currency symbols to `TextBlock` -

i'm working on windows phone 8 app need show currency symbol in textblock either in xaml or via programmatically. obtain such i've use unicode characters . while using statement <textblock text="&#xf01;"/> //i got characters using <textblock text="&#xf001;"/> //i got square box //note: &#xf001; or &#xf01; not currency symbol so question how add currency symbol $ yen , indian rupee , etc. using xaml or c#, tried lot far not success. answer appreciated. thanks actually using wrong format of currency code. here list of currency code . correct format use currency symbol is <textblock text="&#x20b9;"/> //for indian currency still valuable answers, found , working.

jenkins - How to change value of name column in cobertura report -

Image
i using cobertura plugin in jenkins code coverage. want change value of name column in project coverage summary on per-report basis. is there way change this. want give project name on there. here fork of plugin asking (project name instead of "cobertura coverage report"). https://github.com/andytompkins/cobertura-plugin right uses project name. suppose become configurable item? i'll glad work on more if else needed, , package changes in way upstream take them. the relevant code changed in coverageresult.java. added method: public string getjobname() { abstractproject job = owner.getproject(); return job.getname(); } and in index.jelly changed reference it.name it.getjobname(). <td>${it.getjobname()}</td> it bit harder make on per-report basis. report not have name or title field - , plugin not control format, reads it. i using javascript project uses karma , karma-coverage. running forked plugin in production jenkins.

mod rewrite - Apache dynamic subfolders -

i need setup apache deals 2 different disk locations , maps different sites dinamically based on subfolder on urls: http://localhost1/site1.com/ http://localhost1/site2.com/ http://localhost2/site3.com/ ... that map respectively to: c:\folderone\site1.com\public_html c:\folderone\site2.com\public_html c:\foldertwo\site3.com\public_html ... i've found examples use mod_vhost_alias, mod_alias , mod_rewrite different things, have not been able implement need. thanks. to redirect sites dynamically, try following: in apache's sites-available folder, should have file called 000-deafult.conf, or similar. need edit file redirecting. however, way can redirect sub folder dynamically if domain have indicates subfolder use, sort domains according tld's. therefore suggest like: usecanonicalname off <virtualhost *:80> servername vhosts.fqdn serveralias www.*.com virtualdocumentroot /c/com/%2/public_html </virtualhost> <virtualhost

java - Is Java7 intelligent in collecting objects if they are not used further in a scope, although the scope has not completely ended -

consider following code: public class bitsettest { public static void main(final string[] args) throws ioexception { system.out.println("start?"); int ch = system.in.read(); list<integer> numbers = getsortednumbers(); system.out.println("generated numbers"); ch = system.in.read(); rangeset<integer> rangeset = treerangeset.create(); (integer number : numbers) { rangeset.add(range.closed(number, number)); } system.out.println("finished rangeset"); ch = system.in.read(); bitset bitset = new bitset(); (integer number : numbers) { bitset.set(number.intvalue()); } system.out.println("finished bitset"); ch = system.in.read(); //system.out.println(numbers.size()); //system.out.println(rangeset.isempty()); //system.out.println(bitset.size());

Image not in the right place[HTML/CSS] -

i want image(near-logo.png) in header-content div, in header div. image @ moment in left side, has in left side of header-content div. header div 100% width, header-content div 946px width. <!doctype html> <html> <head> <title>webpage</title> <link type="text/css" rel="stylesheet" href="stylesheet.css"/> </head> <body> <div id="header"> <div class="header_content"> <img src="img/near-logo.png"/> </div> </div> </body> </html> body { margin:0; padding:0; } #header { background-color:#353c3e; height:80px; width:100%; position:relative; } .header-content { width:946px; position:absolute; margin:0 auto; } i see 2 problems: first thing, have mistake in css, class in div <div class="header_conten

sql - LIKE not working with NVARCHAR -

i have sql query this: select * hr_companies namelang2 '111კომპანია' but returns no rows. see hr_companies table has column named namelang2 of varchar type. used ltrim rtrim still nothing returned. please suggest how fix problem facing now. try this: declare @tabe table(id int ,data nvarchar(max)) insert @tabe values (1,n'नाम'),(2,n'गणेश') select * @tabe data n'%गणे%' output: id data 2 गणेश

jquery - Keep count for element with different ids -

i trying create thumbs up/down rating demo http://jsfiddle.net/hfnl9/1/ var ups = 0; $('.rating .voteup').on('click', function () { var currentid = $(this).attr('href'); ups = ups + 1; $(currentid + ' > .up').html(ups); return false; }); var downs = 0; $('.rating .votedown').on('click', function () { var currentid = $(this).attr('href'); downs = downs + 1; $(currentid + ' > .down').html(downs); return false; }); however keeps count elements different ids, please see fiddle (click both thumbs ups or thumbs down see mean). how resolve this? try this $('.rating .voteup').on('click', function () { var = $(this).closest('div').find('.up'); up.text(parseint(up.text()) + 1); return false; }); $('.rating .votedown').on('click', function () { var down = $(this).closest('div').find('.down');