Posts

Showing posts from March, 2010

java - How to change the foreground color of specific items in a List? -

Image
when press button, want change foreground color of selected item in list . so far, tried this: list.setforeground(display.getsystemcolor(swt.color_red)); but changes foreground color of items, not selected one. any ideas how solve this? doing list require custom drawing. better off using table instead (or tableviewer depending on requirements). here example of table want: public static void main(string[] args) { final display display = new display(); shell shell = new shell(display); shell.setlayout(new gridlayout(1, false)); shell.settext("stackoverflow"); final table table = new table(shell, swt.border | swt.multi); table.setlayoutdata(new griddata(swt.fill, swt.fill, true, true)); (int = 0; < 10; i++) { tableitem item = new tableitem(table, swt.none); item.settext("item " + i); } button button = new button(shell, swt.push); button.settext("color selected");

Spring Batch: Job Properties -

how can add property: <property name="myproperty" value="value"/> to batch job definition: <batch:job id="myjob"> <batch:description>description</batch:description> <batch:step id="step0"> <batch:tasklet ref="myjobcls"/> <batch:listeners> <batch:listener ref="myjobklistener"/> </batch:listeners> </batch:step> </batch:job> then can use property in run time. you can have properties in external file or inject in propertyplaceholderconfigurer xml: <bean id="propertyconfigurer" class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="location"><value>my_config.properties</value></property> <property name="properties"> <props> <prop key="myproperty">v

css - horizontally display images on small browser window -

i have photo site noodling , have issue reactive sizing of browser window. images great @ 100%, when size down window landscape images start resize, understand sizing down meet width of browser window. however when small, mimic smartphone, want these images stack, makes more sense images portrait. idea go left right , top bottom when browser small. im kinda rusty @ css , cant remember how done. can please brutha out , point me in right direction can going? im doing thru wp override option, approach should follow css best, im tard more complex. the site here: http://jadanduffinphotography.com/ thanks! -jadan what suggest is: write css make images float: left; , position: relative; inside container div detect orientation of browser window according orientation, set width of container div this should make images display horizontally when possible , make them stack vertically when not. you should take @ this probably.

java - How to download email messages as .msg files -

programatically using java, possible download , save emails exchange server .msg files? if not, there formats possible, can opened outlook the solutions received commercial options me out of scope right now. second part in question if can save in other format. have figured out can save them .eml file can opened in outlook. solve problem me.

c++ - Inputting into a char* declared earlier crashes the program while doing that into a 'just-declared' char* doesn't. Why? -

this code crashes program #include <cstdio> int main() { char *name1; char *name2 = "mark"; gets(name1); puts(name1); return 0; } whereas doesn't #include <cstdio> int main() { char *name1 = "mark"; char *name2; gets(name2); puts(name2); return 0; } why ? using mingw code::blocks ide. you lucky 1 crashes , other doesn't. both of programs produce undefined behavior. char *name2; gets(name2); you need point pointer valid , big enough memory able write it. writing uninitialized pointer. results in undefined behavior. undefined behavior not mandate crash, literally means behavior possible , in case might crash , may not nevertheless incorrect program. ideal solution use std::string . if insist on using char * need point pointer valid memory. e.g. char myarr[256]; char *name2 = &myarr;

c++ - Can I make an assignment operator on a base class that returns sub-class type -

sorry bad title... have base class like: template<class t> class gptr { public: typedef t basetype; gptr& operator=(const basetype& rhs) { ... } }; i want make subclassed specializations like: class graphicptr : public gptr<graphic> { ... }; however base-class assignment operator still returns gptr<graphic> not graphicptr , it's annoying have copy-paste code in case core assignment operator functionality should change later. is there neat way define base-class assignment operator returns type of actual class in use? in c++, base class has no idea of it's children. may add template parameter derived class , use it. template<class t, class derived> class gptr { public: typedef t basetype; derived& operator=(const basetype& rhs) { ... } };

php - Getting days from DateTime() above 30/31 so it doesn't carry over to months -

i'm calculating difference between 2 dates using datetime() , it's working fine. problem want have days format able go above full month 30/31 or higher. $now = new datetime(); $future_date = new datetime($contest->expires_at); $interval = $future_date->diff($now); $enddate = $interval->format("%m month, %d days, %h hours, %i minutes"); the current problem when don't display months, days can go 30/31 , on carried on make new month resetting days count leftover days. want able display 42 days when difference 6 weeks kind of format: $enddate = $interval->format("%d days, %h hours, %i minutes"); is there quick fix or need manually convert timestamp seconds , use own function modulus operators this? you can try: $enddate = $interval->format("%a days, %h hours, %i minutes"); see dateinterval::format in manual. note take care of bug if you're working on windows.

git - How to remove remote repos's directory after I add this directory into .gitignore? -

in beginning, dont put logs/ .gitignore, after git push , logs/ appears in remote, add logs/ in .gitignore , commit , push, logs/ still remains in remote, how remove logs/ in remote ? .gitignore ignores untracked files, once files added repo, tracked until explicitly removed. if don't care keep directory in history, need remove git git rm -r logs , git commit . however, if directory large , increases repository size, follow advice yan zax filter-branch .

xhtml - w3c validator tells an error -

w3c says have unclosed tag. way has xhtml validation output: 1 error line 31, column 9: end tag "div" omitted, omittag no specified ✉ may have neglected close element, or perhaps meant "self-close" element, is, ending "/>" instead of ">". line 19, column 4: start tag here and here xhtml: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <head> <title>phpformtemplate</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <script type="text/javascript" src="phpformtempate/checkform.js"></script> <link rel="stylesheet" type="text/css" href="phpformtempate/css/default.css" /> </head> <body> <div id="errorcontainer"> </div> <d

java - Incorrect file path being used within submodule -

a multi-module project works colleagues fails me. problem arises during test references file , in spring configuration files when reference file. reference never includes sub module folder name, or full file paths don't resolved correctly. for example parentproject parent , childproject sub module. parentproject - childproject - src/test/java/my/package/mytest.java - src/test/resources - xml/myfile.xml - myproperties.properties - myspringconfig.xml if have following in mytest.java : file file = new file("src/test/resources/xml/myfile.xml"); string absolutepath = file.getabsolutepath(); then absolutepath c:\parentproject\src\test\resources\xml\myfile.xml incorrect it's missing childproject folder , throws filenotfoundexception . getting same issue mention of properties files in spring configuration files e.g. in myspringconfig.xml have line: <context:property-placeholder location="

active directory - Data Access Management - Best practices in AD env -

i'm trying collect info, preferably in form of whitepaper or 'best practices manual', on topic of data management access in large organizations. i work in on of those, file structure extremely complicated , it's becoming more , more challenging manage access requests folders. data owners, acls inheritance, folder structure etc. any suggestions please, online resources or books know of? thanks luka i'll answer own question, found part of searching in: windows administration resource kit: productivity solutions professionals and of in technet database under data managment. if anydody else has other sources, please share.

node.js - In Socket.io, how to get the stored cookie information? -

in node application using express, have stored cookie information. need stored cookie information in socket.io. how can this? app.use(function (req, res, next) { res.cookie('cookiename','1', { maxage: 50000, httponly: true }); }); io.sockets.on('connection', function (socket) { //here need access cookie.how can }); finally found answer.the below code cookie information. io.sockets.on('connection', function (socket) { var cookie=socket.handshake.headers['cookie']; });

web services - in 3 layered architecture can i skip business layer for crud operations? -

we have 3 layered application wich every call service layer goes business layer , peresist data layer. components of each layer can call layer below; however because have hundreds of entities , have lots of services related crud operatins many contoverseries raised on our team. some believe sake of maintenance , ease of development it's better call data access crud services doing crud operation , bypassing business layer. on contrary saying have create wrapper data access of each entity in business layer , call these wrapper services , never allow services call data access layer. in idea way should take? ok crud services call data accesses , bypassing business layer? if there no business logic perform, there no reason enforce business layer. 3-tier architecture not arcane protocol, best practice formed assuming business processing. in current application accessing daos directly jsf controllers when there no business process involved. idea given java champion

tsql - SQL Server Row_number in odd/even number? -

i have question querying accounting data. for example, sample data show below table: table_test date amount 2013-01-01 12.00 2013-01-02 13.00 the output should this: date account debit credit 2013-01-01 abccompany 12.00 2013-01-01 vendorcompany 12.00 2013-01-02 abccompany 13.00 2013-01-02 vendorcompany 13.00 initially, think using union statement because may output sequece not important , sample sql show below select date 'date', 'abccompany' 'account', amount 'debit', '0' credit table_test union select date 'date', 'vendorcompany' 'account', '0' 'debit', amount credit table_test output: date account debit credit 2013-01-01 abccompany 12.00 2013-01-02 abccompany 13.00 2013-01-01 vendorcompany 12.00 2013-01-02 vendorcompany 13.00 but se

c - getopt not working correctly when run from unix command line -

i wrote (copied , pasted google , simplified) c program use getopt print out values of arguments passed in unix command line. from unix command line: ./myprog -a 0 -b 1 -c 2 my c code is: #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]) { int i; while ((i = getopt(argc, argv, "abc")) != -1) { switch (i) { case 'a': printf("a = %s\n", optarg); break; case 'b': printf("b = %s\n", optarg); break; case 'c': printf("c = %s\n", optarg); break; default: break; } } return 0; } i want program print out each of values passed e.g. a = 0 b = 1 c = 2 however not printing out @ all. you forget ":" after option argument. if change 1 line while

linux - If statement with 3 checkpoints -

i have small if statement checks if filenames correct. @ first needed 2 names compare within if statement. if [ $name == $name3 ]; qsub calculatecorrelation.sh $i $j fi now want compare 3 names , if correct continue script. first attempt looks not convinced way it. if [ $name == $name3 == $name5 ]; qsub calculatecorrelation.sh $i $j $k fi so how can check 3 names same , continue. i think should able this: if [ $name == $name3 ] && [ $name3 == $name5 ];

Showing text gallery on application first time start up in android -

Image
actually posting question because never worked on , not aware component used implement such functionality. see screen-shot. sample image. not mine work taken google images now on application startup reading android sd card , updating database. in mean time presently progressdialog this now want show 5 image slides. not image slide want single colour backgroung , text should have change every 2 seconds on same backgroung 5 small circles downside. now not able it. image slide show or other native component. asked in chat rooms asked me post here. if can happen without image better because there lot of complexties different device sizes. please me how search it. how implement. try android smartimageview or viewflow

javascript - Validate user input for extra long words in textarea -

i have problem here validating user's input in textarea. user suppose enter description in 1 of textarea feild in form. people put random text 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' or bypass minimum length requirement. now want prevent user typing such long text without spaces since disrupts ui of page. long text entered user without spaces can valid url too. how manage & throw error user correct text if long , isnt valid url ?? ps: dont want split string myself.. want detect , throw error user on client side validation. put end doubts, server side validation in forcibly enter space , save in db. expecting solve problem on client side this 2 step process: determine if words long. if so, determine if valid urls. var validatewordlength = function (str) { var maxlength = 50, // or whatever max length want reurl = /^(ftp|http|https):\/\/[^\s]+$/, // use whatever regular expression url matching feel best wor

c# - How to convert a LambdaExpression to typed Expression<Func<T, T>> -

i'm dynamically building linq queries nhibernate. due dependencies, wanted cast/retrieve typed expression @ later time, have been unsuccessfull far. this not working (the cast supposed happen elsewhere): var functype = typeof (func<,>).makegenerictype(entitytype, typeof (bool)); var typedexpression = (func<t, bool>)expression.lambda(functype, itempredicate, parameter); //fails this working: var typedexpression = expression.lambda<func<t, bool>>(itempredicate, parameter); is possible 'encapsulated' typed expression lambdaexpression? var typedexpression = (func<t, bool>)expression.lambda(functype, itempredicate, parameter); //fails this not surprising, have compile lambdaexpression in order actual delegate can invoked (which func<t, bool> is). so work, 'm not sure if need: // no longer expression , cannot used iqueryable var mydelegate = (func<t, bool>) expression.lambda(functype, ite

html5 - Is it a good practice to put <article>s inside <li>s? -

typically on front page of blog, there several recent blog posts, , each blog post <article> . , blog comments markuped using <article> s, too. my question is: practice put <article> s inside <li> s? used because in own interpretation <article> s presented in way of amount / quantity . when comes listing amount/quantity of elements, <ul> , <ol> best choices. however, maybe need reconsider interpretation because putting <article> s inside <li> s seems misuse of <li> . , want take accessibility account. i'm not sure if doing causes confusions assistive technologies or not. the question comes down to: constitutes list? if it's list of articles, should marked such using <li> . advantage screen reader users screen readers can use semantic markup communicate useful information. example, informing user they've landed on "list of 5 items" helps them understand how content organized, , ho

playframework - Proxy Authorization Required while uploading large files in play 1.2.5 -

i getting proxy authorization required while uploading large files in play 1.2.5. after hitting upload button required action doesnt called.however when upload small sized files dont error.what can reason.please me out. this has nothing play. while can limit size of request (and therefore size of uploadable files) setting value play.netty.maxcontentlength in application.conf , by default there no limit . the problem caused proxy server sits between , play application requires authentication above request size. ask whoever responsible proxy server how circumvent problem (e.g. increasing max. request size or giving authentication credentials proxy).

c++ - Secure configuration file in clients -

in project create configuration file each clients(also can sqlite in each clients instead of configuration file). files include critical information policies. therefore end-user musn't add, delete, change configuration file or in file. i considering use active directory prevent users open folder include configuration file. is there standart way use secure configuration files? edit: of course speed of reading file important security edit2: can't db server because policies must accesible whithout internet connection too. server update file or sqlite tables in periods. , using c++. i'm sorry crush hopes , dreams, if security based on configuration file on client, you're screwed. the configuration file loaded , decrypted application , means values can changed using special tools when application runs. if security important, checks on server, not client.

string - Detecting if a variable can be printed in Lua -

i've got variable number of types - it's string, number, table or bool. i'm trying print out value of variable each time this: print("v: "..v) with v being variable. problem is, when value can't concatenated error: myscript.lua:79: attempt concatenate table value i've tried changing in case manages detect whether or not variable can printed: print("v: "..(v or "<can't printed>")) but had same problem there. there sort of function can use determine if variable can concatenated string, or better way of printing out variables? you can provide values separate arguments print: print("v:", v) this print like v: table: 006ce900 not useful, better crash if it's debugging purposes. see here information on more useful table printing.

angularjs - Is there something like initialize module once in angular? -

can have loading data once in angular module? tried use .run() gets called whenever page accessed. example: there 2 html pages belonging same module: testpage1.html: <html ng-app="myapp"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="js/angular.min.js"></script> <script src="js/jquery-1.8.2.js"></script> <script src="js/app.js"></script> </head> <body> <p><a ng-href="testpage2.html">go page2</a></p> </body> </html> testpage2.html: <html ng-app="myapp"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="js/angular.min.js"></script> <script src="js/jquery-1.8.2.js"></script> <script src="js/app.js"></script> </h

javascript - Delete cache files and free allocated memory for it programmatically -

i building app smarttv (javascript & html5). application slow due ram size on tv , processor speed. i working solve issue. have decided delete cache file whenever new page loads, , user moves page. is solution going (ram & cpu) problem? , how can delete them programmatically? i have tried following code : <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='expires' content='0'> <meta http-equiv='pragma' content='no-cache'> will code set cache file size 0 after call in page? no, not. code tell browser not cache page. apply html page. , not affect resources loaded on page.

trying to understand the whole progress of php scripts running -

i trying understand whole progress of php scripts running. such analyze,compile,... googled online, did not find article it. explanation or documentation? thanks php scripting language, , doesn't compile before running. pretty ever want know can found @ http://www.php.net it documentation, give go.

java - Custom Validator class not working -

i have question here: scenario: have jsf-2, spring (beans wiring) application. have written custom validator, want execute. @facesvalidator("com.test.vali") @named("com.test.vali") public class testvalidator implements validator { @override public void validate(facescontext arg0, uicomponent arg1, object arg2) throws validatorexception { system.out.println("dhkdfkbhdfbkdfksdfdfk"); } } i trying inject validator using following ways: way#1: <h:inputtext value="#{helloworld.name}"> <f:validator binding="#{com.test.vali}" /> </h:inputtext> output when tried render page, threw exception. javax.servlet.servletexception: /testrichfaces.xhtml @17,48 <f:validator> validator id not specified. typically validator id set in constructor validatehandler(validatorconfig) searched lot on this, , verified few ways like: java file in package. way#2 <f:validator v

asp.net mvc - Basic age display helper in mvc using c# -

how implement basic age display helper in mvc using c#. stuck code @ moment , need help. can 1 please give quick help. thanks my code @html.displayfor(model.dob.value) however shows dob in date time format. thinking of doing var newdate = datetime.now.subtract(model.dob.value) @html.display(newdate) but want helper, , not repeat this. please poor student....hahaha you can build helper function, in helpers folder. take in dob , can format out put string. for example public string (this htmlhelper helper, datetime dob){ //do formatting return result; } here link blog may more useful. used similar 1 project. age display tutorial cheers.

opencv - Bag of words training samples -

i have implemented bag of words, working smoothly. but, i'm confused steps , how implement it. i create bow descriptors last step in bag of words create samples, shown here bowde.compute(img, keypoints, bow_descriptor); .. things i'm confused next steps. i know in bow have train , test class (car) non-class (cola), created in bow_descriptor vector class car, have vector samples belong car. here questions have training system , test it. 1- shall make vector of bow_descriptor half of class(cola) , rest non-class(cola) , or have create new bow_descriptor non-class(cola) ? 2- need multi-class classification, after finishing first system class (car), , need train new class (buses+trains , on), shall create new training model each of them, or possible training procedure previous training (i.e. training class bus,train class car in same system)? it not matter whether create 1 object classes or 1 object each class, long use same dictionary classes. creating 1 o

c# - What are the arguments of Dialogs[XlBuiltInDialog.xlDialogPasteSpecial].Show -

vsto excel's pastespecial dialog takes 30 args. i've tried looking everywhere can not find each argument stands for. i trying set defaults pastespecial when dialogue pops up. (c# vsto2007) bool ispaste = globals.thisaddin.application.dialogs[xlbuiltindialog.xldialogpastespecial].show ( type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing); according msdn page, there 4 arguments: paste_num, operation_num, skip_blanks , transpose so example, show dialog transpose checked: bool ispaste =

c++ - Operator New in function call -

void f(a* a) { delete a; }; f(new a()); will delete operator release allocated memory or must create , delete object this: f(a* a) {} a = new a(); f(a); delete a; yes free memory, preferred use smart pointers such std::shared_ptr or boost::shared_ptr prior c++11 instead. in example better set freed pointer null avoid double deallocation avoiding dangling pointer errors. void f(a*& a) { delete a; = null; }; you not able call f(new a()); thru , require pass reference pointer holding variable. in 2nd variant. there should a* = new a(); there thru, indicate a pointer.

php - Make the results from a mysql database search selectable -

i have database containing stock items , webpage allows search through database item type or specific item number. results returned , displayed in table under search form. currently saving results of mysql query array, , printing results of array table. how can make result selectable , have button such 'add' allow me retrieve information database based on selected item. edit - <?php require("header.php"); if(isset($_request['searching'])){ //check if form has been submitted connect('final');//connect db //set values search form $field = $_post['field']; $query = $_post['query']; $query = htmlspecialchars($query); // stop html characters $query = mysql_real_escape_string($query); //stop sql injection $data = mysql_query("select * stock stock.part_number in (select stock.part_number stock upper(stock.$field) like'%$query%')") ;//query db search field in colleumn selecte

c++ - clang 3.2 fails on std::atomic -- a libc++ issue? -

i try compile simple code #include <atomic> int bar = 0; void foo(std::atomic<int>&flag) { bar = flag; } with clang++ 3.2 (downloaded llvm 3.2 llvm.org; on mac os.x 10.8.3 fails error /> clang++ -std=c++11 -stdlib=libc++ -o3 -march=native -c test.cc in file included test.cc:1: /usr/include/c++/v1/atomic:576:17: error: first argument atomic operation must pointer non-const _atomic type ('const _atomic(int) *' invalid) {return __c11_atomic_load(&__a_, __m);} ^ ~~~~~ /usr/include/c++/v1/atomic:580:53: note: in instantiation of member function 'std::_ 1:: _atomic_base::load' requested here operator _tp() const _noexcept {return load();} ^ test.cc:5:9: note: in instantiation of member function 'std::_ 1:: _atomic_base::operator int' requested here bar = done; when use /usr/bin/clang++ instead (which comes os or xcode

javascript - typeAhead for default values on click -

nice use case edit fields type ahead allows click empty field or use alt+down shortcut, , list of recent/default values provided. user not need guess letter type , has useful list of choices start with. question: how can invoke field's typeahead partial refresh event when user enters/clicks empty field, or uses alt+down? expect submited variable defined "var" property empty, handle in code proper choices. <xp:inputtext id="inputtextlookup" styleclass="lotustext" value="#{viewscope.znalostilookup}"> <xp:typeahead mode="partial" minchars="1" var="valuetolookup" ignorecase="true" preventfiltering="true" valuemarkup="true" maxvalues="10"> <xp:this.valuelist><![cdata[#{javascript:return options(valuetolookup);}]]></xp:this.valuelist> </xp:typeahead> &

c# - TPL Dataflow, notification when data block received first item -

i wonder whether possible subscribe one-time notification when first item received in input buffer or processed in data block. aware can set flag within data block create overhead run check flag on each new item. data block processes several million items flag adds unnecessary overhead. is there better way notified on first incoming item? you try creating link maxmessages=1 block processes notification. link removed after delivering single message.

windows - Visual Studio Manual Pages For C -

what windows developers when need man page typical c function ? example, writing c code in visual studio , need remember order of arguments , exact behavior of strcpy. note not looking duplicate linux/os x experience, rather discover easiest, common way obtain information typical windows developer. thanks. for specific question, keep this alphabetical list of functions bookmarked. can install (and other vc++) documentation locally in vs well.

ruby on rails - Load dynamic partial based on Dropdown selection -

i new ruby on rails. please guide me this. tried code doesn't know correct or wrong. i'm loading collection of @customer based on customer have load fields in same form. suppose 1 customer have name,password,agent,address , customer have different attributes. i first create jquery calls display have tried load dynamic partial file. please load dynamic partial file based on customer. here code app/views/customer/new/_form.html.erb <%= simple_form_for(@customer) |f| %> <%= f.input :first_name, placeholder: 'first name', label: 'customer first name' %> <%= f.input :last_name, placeholder: 'last name', label: 'customer last name' %> <%= f.input :email, placeholder: 'user@domain.com', label: 'customer email' %> <%= f.input :customer_id, :collection => customer.all, :prompt => "choose ats",:input_html => {:onchange => "load_customer_content(this)"} %&g

java - Behaviour of String.split() when input is empty -

as title explains query can please explain behavior of following 2 outputs. "".split(",").length gives output 1 where as ",".split(",").length gives output 0 in first case, original string returned, because separator not found. from api docs : if expression not match part of input resulting array has 1 element, namely string.

sublimetext2 - Backspace Tab in Sublime Text 2 -

i have block of code move (2 space/1 tab) backwards. know can select whole block , hit tab move forward how move whole block backwards (to the left)? there 2 options: shift + tab or ctrl + [ (on mac ⌘ + [ )

java - Getting MD5 checksum on the remote server using JSCH -

i writing application requirement transfer files remote sftp server local machine , vice - versa. during file transfer want make sure no data packets lost , corrupted in transit.so idea run md5 checksum on remote file (residing in sftp server) before transfer , start transfer process. once transfer done, run md5 on local file , compare 2 checksums. i using jsch connect sftp server , code in java.but dont know how run md5 on remote file residing in sftp server.my code has md5 on remote file before transfer takes place.any idea on how accomplish please. most unix systems have md5sum command. invoke on remote server retrieve hash. $ md5sum /tmp/test 34a27208f62ff3bdae031c9e8a354ac3 /tmp/test the jsch website contains an example shows how invoke command on remote server. adapted run md5sum command.

html - Scroll automatically horizontally inside a div > table using jquery -

there's table inside div , particular th having id need scroll left right or horizontally. i tried didnt worked.. $('#right-order-panel').scrollto('+=100px', 800, { axis:'x' }); $('#right-order-panel').animate({ scrollleft: "-=" + 250 + "px" }); $('#right-order-panel').scrollleft(300); how can achieve without external plugin? thanks in advance!!!

Getting java.lang.IllegalArgumentException when trying to make a dynamic HTTP endpoint in Mule -

i got http outbound-endpoint method specific url, thing if add variable in path url throw exception... believe not being supported. flow: <flow name="admin_get_graph_data" doc:name="admin_get_graph_data"> <ajax:servlet-inbound-endpoint channel="/admin/get_graph_data" responsetimeout="10000" doc:name="ajax"/> <http:outbound-endpoint exchange-pattern="request-response" host="${graph.url}" port="8081" path="plot/get?graphname=#[json:graph_name]&amp;subgroup=hour&amp;width=100" method="get" doc:name="http" /> <byte-array-to-string-transformer doc:name="byte array string"/> </flow> this exception stacktrace caused by: java.lang.illegalargumentexception: endpoint scheme must compatible connector scheme. connector is: "ajax-servlet", endpoint "http://specific-url/plot/get?graphname=sp

javascript - AMD Module Shaping: How to load only one JS function? -

many javascript libraries have builder tool allow "shape" features of library depend on, both in terms of download bandwidth cost client , in terms of isolating functionality need. for example, many things in sugar.js, don't need or want katakana , hiragana character set handling. trivial example, want able "shape" sugar.js export string.isblank(). is there tool available me? there ongoing effort ecmascript committee in future version of javascript? higher-level languages typescript , coffeescript, offer hidden support such "shaping"? can such "shaping" in c# .net dlls via monolinker . basically, looks me amd handles loader aspect of modern compiler, not handle linker aspect. builders jquery , dojo work specific module, , aren't true linkers, builders. update: google closure compiler compiler takes javascript input , produces javascript output. advanced compilation , externs documentation suggests there api call thi

Stopping user from selecting/unselecting rows in WPF DataGrid -

i have datagrid on wpf page , want prevent user selecting cells. feature needed testing, don't want change in code. after datagrid filled, make sure of rows selected. want make sure user cannot select/unselect rows. i tried setting isenabled = false , ishittestvisible = "false" both of these solutions disable scrollbars. is there way this? why not set ishittestvisible="false" datagridrow or datagridcell objects only? that's easy using implicit style in <datagrid.resources> , , should disable hit-testing on rows or cells, should leave other areas of datagrid functional, such headers or scrollbars <datagrid.resources> <style targettype="{x:type datagridrow}"> <setter property="ishittestvisible" value="false" /> </style> </datagrid.resources>

How to use .net delegate in vba -

i have .net dll written in c# exposes delegates. now, visible in vba object explorer , appear 'class'. how can instantiate , make point vba function same signature , pass c# function takes delegate argument? i should able that, right!? dll registered com interop, there com attributes must decorate delegates or what? thanks, andrei! use late binding, won't able use vba intellisense program, call functions right parameter: for example: instantiate class private obj object set obj = createobject("namespace.class") and use methods class obj.method(a,b,c) if need register ddl programmaticaly, can use shell "c:\windows\microsoft.net\framework\v4.0.30319\regasm.exe c:\mydll.dll /codebase"

c++ - How to handle exceptions from StorageFile::OpenAsync when URI is bad -

i have section of code correctly load images http uris when uris valid cannot figure how catch exception openasync throws when uri invalid (results in 404). the problem when lambda contains call openasync exits, exception thrown; exception not thrown while in try/catch block. the question is: what correct way catch exception thrown storagefile::openasync? auto bm = ref new bitmapimage(); try { uri^ uri = ref new uri("http://invaliduri.tumblr.com/avatar/128"); auto task = concurrency::create_task(createstreamedfilefromuriasync("temp-web-file.png", uri, nullptr)); task.then([] (storagefile^ file) { try { return file->openasync(fileaccessmode::read); } catch (...) { // not catch exception because exception // occurs after lambda exitted } }).then([bm](irandomaccessstream^ inputstream) { try { return bm->setsourceasync(inputstream); } catch (...)

c++ - How to instantiate a template method of a template class with swig? -

i have class in c++ template class, , 1 method on class templated on placeholder template <class t> class whatever { public: template <class v> void foo(std::vector<v> values); } when transport class swig file, did %template(whatever_myt) whatever<myt>; unfortunately, when try invoke foo on instance of whatever_myt python, attribute error. thought had instantiate member function with %template(foo_double) whatever<myt>::foo<double>; which write in c++, not work (i syntax error) where problem? declare instances of member templates first, declare instances of class templates. example %module x %inline %{ #include<iostream> template<class t> class whatever { t m; public: whatever(t a) : m(a) {} template<class v> void foo(v a) { std::cout << m << " " << << std::endl; } }; %} // member templates %template(fooi) whatever::foo<int>; %template(

How to convert float to bytes in little-endian format in OCaml? -

how can convert float bytes in little-endian format ? like 5.05 -> \x33\x33\x33\x33\x33\x33\x14\x40 like this: # let v = int64.bits_of_float 5.05 in = 0 7 printf.printf "%lx " (int64.logand 255l (int64.shift_right v (i*8))) ; done ;; 33 33 33 33 33 33 14 40 - : unit = ()

jsp - Eclipse-HTTP Status 404 -

i know asked this, haven't got answer wanted. i'm trying run jsp page using tomcat, keep getting following error message: http status 404 - /loginweather/ type status report message /loginweather/ description requested resource not available. apache tomcat/7.0.39 the server configured correctly, localhost:8080 functional. here web.xml , .jsp files content: web.xml: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>loginweather</display-name> <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> <

maven - mvn deploy:deploy-file -- Failed to deploy artifacts: Could not find artifact -

i trying add 3rd party vendor's jar our internal nexus repository. i have tried using command: mvn deploy:deploy-file -dgroupid=acme -dartifactid=acme -dversion=1.0 -dpackaging=jar -dfile=c:\tmp\acme-1.0.jar -drepositoryid=nexus -durl=http://myserver:8888/nexus/content/repositories/thirdparty/ with following entry in settings.xml: <servers> <server> <id>nexus</id> <username>myusername</username> <password>mypassword</password> </server> </servers> but error: [error] failed execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7: deploy-file (default-cli) on project standalone-pom: failed deploy artifacts: not find artifact acme:acme:jar:1.0 in nexus (http://myserver:8888/nexus/c ontent/repositories/thirdparty) -> [help 1] any suggestions? some related info... can install local repository fine, using command: mvn install:install-f

sql server - Store XSDs in a table versus XML SCHEMA COLLECTION -

i'm doing maintenance work on application stores xml data in sql server. currently, application uses table store associated xsds. question: since xsd validation being performed in asp.net, there advantage storing xsds in xml schema collection instead? it's fair question... still put in xml schema collection. forces validation of data @ lowest possible level. if it's possible put bad data column, happen. takes developer working on app not careful are, or internal app hitting same table, or of bunch of other situations. it's storing int values in column of type varchar. can it... , maybe application validating data going in there indeed of type int. somehow or other, value "10n" eventually find way column. what? 1 of great things relational db enforces level of data validity, should use every tool @ disposal, including schema collections, imo.

override default new operator for an array of a class C# -

i using pinvokes call native code. if want create array of native objects following public class myclass() { // allocate single myclass; public myclass() { _myclass = myclass_create(); _length = 1; } public myclass(int numargs) { //pinvoke call create array of myclass; _myclass = myclass_array_create(uintptr); _length = numargs; } //access indexed element of myclass public myclass this[int index] { { myclass ret = new myclass(); ret._myclass = myclass_array_element(this._myclass, (uintptr)index); return ret; } } public int length { { return _length; } } public void foo(){ //lots of other code } [dllimport(dll_import_target)] private static extern intptr myclass_create(); [dllimport(dll_import_target)] private static extern intptr myclass_array_create(uintptr numar

Java EE stop application programmatically -

i'm part of project rewrite se application in ee. we're using jboss 7.1.3 our supported application server, trying minimize specific code in interest of portability. a little background on our application...it accepts processing requests systems (mdb/webservice) , fulfills request interfacing number of other systems. system processing auditing database driven. current functionality in existing application application shuts down in event of database connection loss prevent unaudited processing. so, i've been looking around see if there standard way of recreating functionality in portable way. guess i'm wondering if there's standard way of stopping application programatically within application or if have thoughts on providing similar functionality. so far i've seen there may ways hook jboss via jmx , undeploy application or possibly stop mdb delivery...but i'm concerned portability since specific. i'm not concerned portability across ass ac

magento - IE 8 Error - What's the cause? -

i have 2 magento eshops worked in past on major browsers except ie 7. after installed windows xp on computer , accessed eshops ie 8, had heartattack seeing aren't working should. before installing windows xp running windows 7 , websites looking on ie 8. now, same ie version, on different operating systems, gives me headaches! now, can explain me how 'debug' ie 8 parsing engine seeing errors , try modify templates? thanks.

c# - How to organise namespaces within an assembly to reflect design -

i organise assembly code write reflects intended design. received understand namespaces principal way organise types achieve this. the issue have assembly, assembly , say, uses layer of implementation classes. of classes in layer1 part of implementation of layer1 , i'd reflect in way structure code. first thought try make classes in layer1 private, can see this not possible . logically, layer1 exposing classes a1 , b1 , c1 etc. , uses classes a2 , b2 , c2 etc. namespace assembly.layer1 { // "interface layer1" class a1 // ... class b1 // ... class c1 // ... // "implementation of layer1" class a2 // ... class b2 // ... class c2 // ... } // (one file per class) it seems 1 way address put a2 , b2 , c2 etc new namespace, assembly.layer1.layer2 . then, when i'm writing code in top-level namespace , using assembly.layer1 , intellisense shows me classes assembly.layer1 exposes. also, by convention , should refer 1

css - Evenly spaced grid dynamic content -

i'm going have grid of <div> s dynamically generated. each <div> same width. want evenly space them across container. , want them space 3 across, , start again on next line. however, final row may have 1 or 2 <div> s in it, need remain in same 'grid spacing' above rows. basically, want table type spacing, without using tables :) here's example html. below occur on 4 rows, final row having 1 item <div id='container> <div class='item'>content</div> <div class='item'>content</div> <div class='item'>content</div> <div class='item'>content</div> <div class='item'>content</div> <div class='item'>content</div> <div class='item'>content</div> <div class='item'>content</div> <div class='item'>content</div> <div clas

Python numpy - Reproducibility of random numbers -

we have simple program (single-threaded) we bunch of random sample generation. using several calls of numpy random functions (like normal or random_sample ). result of 1 random call determines number of times random function called. now want set seed in beginning s.th. multiple runs of program should yield same result. i'm using instance of numpy class randomstate . while case in beginning, @ time results become different , why i'm wondering. when doing correctly, having no concurrency , thereby linear call of functions , no other random number generator involded, why not work? okay, david right. prngs in numpy work correctly. throughout every minimal example created, worked supposed to. my problem different one, solved it. never loop on dictionary within deterministic algorithm. seems python orders items arbitrarily when calling .item() function getting in iterator. so not disappointed this kind of error, because useful reminder of think when trying rep