Posts

Showing posts from June, 2013

c# - How to ensure a struct with a string array as a field would follow value semantics while assigning to another variable -

in msdn documentation mentioned " structs copied on assignment. when struct assigned new variable, data copied, , modification new copy not change data original copy. " i have struct has string array field inside it. struct myvar { private readonly string[] value; myvar(string[] ival) { value = ival; } } when assign 1 struct variable how ensure string array copied (deep copy) assigned variable. you can't in c# because there's no way intercept compiler-generated code copy struct's data 1 another. the thing can make struct immutable. that means: when create struct, make defensive copy of mutable reference types store inside struct (such string array in example). do not pass mutable reference type objects can mutate them. do not expose mutable reference types struct. mean couldn't expose string array struct. don't mutate reference types held in struct. in example, couldn't change contents of string arr...

vb.net - How to use .Net dll in Java -

i have dll created in vb.net. how can use functions in java. i found jni while searching on google , not getting it. there simple documentation example. i recommend java native access (jna) easier using jni. lets have dll functions, create java interface has same method signatures functions in dll. for example public interface nativeexample{ public int method1(string param1); public boolean mehthod2(); } now following way load dll (assuming name nativelib.dll) nativeexample nativeexample= (nativeexample) native.loadlibrary("nativelib", nativeexample.class); once have this, can call method dll via java methods. `nativeexample.method("test");` `nativeexample.method2();` for mappings of datatypes between java , native, please refer the link above. here one more example .

javascript - Three.js Mesh animation and texture mapping -

i did research , learn how export obj file .js file can imported json model of three.js. how can animated such model ? have bird model in .js format need learn flap wings. further more when downloaded obj file internet free model contains texture images object when import obj in 3d modelling software blender 3d, cannot load texture has location right inside obj file when open text editor. when convert .js format has right location located bmp images texture mapping, fail load when load model in webgl, using json model. can please point me in right direction can learn thinks, great if know , me right away in answer. please, need form guys . code of js model file { "metadata" : { "formatversion" : 3, "generatedby" : "blender 2.66 exporter", "vertices" : 2652, "faces" : 4798, "normals" : 2652, "colors" : 0, "uvs" : [1202], ...

c# - dropdown list item selection in asp.net -

i using below code bind dictionary object dropdown list , select value dropdown list. protected void page_load(object sender, eventargs e) { dictionary<int, string> dict = new dictionary<int, string>(); dict.add(1, "apple"); dict.add(2, "bat"); dict.add(3, "cat"); ddl.datasource = dict; ddl.datavaluefield = "key"; ddl.datatextfield = "value"; //will display in ddl ddl.databind(); } protected void btn_click(object sender, eventargs e) { string key = ddl.selectedvalue; string value = ddl.selecteditem.text; } whatever value selected in ddl getting '1' in key , "apple" in value. wrong in code? that because binding list on each post back, should check ispostback like protected void page_load(object sender, eventargs e) { if(!page.ispostback) // better if refactor binding code method ...

shell - Execute Windows scripts from a remote Rundeck server -

i installed rundeck server in 1 linux machine. tomcat running in windows 7 machine. now, want stop , start tomcat service in windows machine creating job in rundeck (on linux machine). is possible? yes, possible. install cygwin, including openssh-server windows machine. generate public key rundeck server user , add .authorized_hosts file on windows machine. ensure have port 22 or alternate port accessible ssh. in rundeck, create new job fires tomcat executable or commands prefer starting/stopping service. it may prefix rundeck job command $path variables if connecting user account has trouble locating executables in windows/cygwin environment.

machine learning - Weka - Adding a unique identifier -

i running logistic regression using weka on set of values unique identifiers. run historical data training data. in case, don't care values classified categories. once done, run current data test data , need keep track of values classified categories. how can maintain unique identifiers each category not them included variable in regression?

objective c - Angel.co API for IOS -

i trying connect angel.co api using ios/objective-c? but not know how start. can please me? how integrate angel.co api in ios? i don't know api is, assuming web site, have send get, post, put or delete http requests. that, set nsurlrequest http method, url, , optionally filling in body data, hand nsurlconnection send request off server , give return data. to correctly, you'll have api documentation whatever web server you're talking to, or if can't find (i.e. provide no api), view source of web pages using "view source" in browser , reverse-engineer requests looking @ form fields, link urls etc.

java - How Web Server responds when it gets "Options" Request? -

i want implement options method in http web server. didn't yet find tutorial of working of method. made 1 code implements method, code @ end of question. but think working of server used wrong. can tell me exact method/ steps how server respond, when gets options request. waiting kind response. client code public class client { public static void main(string[] args) { httpclient client = new httpclient(); client.getparams().setparameter("http.useragent", "test client"); optionsmethod method = new optionsmethod("http://localhost:8080"); try { int returncode = client.executemethod(method); if(returncode == 405 ) { system.out.println("the options method not implemented uri"); } else { header[] header = method.getresponseheaders(); for(int = 0; < header.length; i++) { system.o...

php - missing array $_POST when used $_POST = array_map('trim', $_POST); -

i have check box named check_user_id[] like: <input type="checkbox" value="87" name="check_user_id[]" class="waiting_user"> <input type="checkbox" value="88" name="check_user_id[]" class="waiting_user"> <input type="checkbox" value="89" name="check_user_id[]" class="waiting_user"> before page load use trim $_post = array_map('trim', $_post); all valus getting not $_post['check_user_id'] value directly on variable name $check_user_id b'coz register_globals on want value in $_post['check_user_id'] any way ? trim function works on strings . $_post array , can contain strings , arrays . if want trim strings in multidimensional array, should use or write recursive function. or perform trimming manually on each element of array: foreach($_post['check_user_id'] &$check){ $ch...

sql - Append X amount of results from one query to X amount of results from another (with no foreign key join) -

this query brings results this: select distinct date dwh.product_count april, 2013 march, 2013 february, 2013 january, 2013 i'd append many results ^that^ brings results query: select distinct p_id dwh.members a 5 7 8 ...etc so results this: 5 april, 2013 5 march, 2013 5 february, 2013 5 january, 2013 7 april, 2013 7 march, 2013 7 february, 2013 7 january, 2013 etc.... what type of query bring these results? select id, dt (select distinct p_id id dwh.members) s cross join (select distinct date dt dwh.product_count) t

c# - Datepicker format is getting changes when i open form in edit mode -

i have set datepicker format "dd/mm/yy". when open form insert data @ time taking right value. when open form in edit mode datepicker automatically changes format "mm/dd/yy". dt.format = datetimepickerformat.custom; dt.customformat = "dd/mm/yy"; please try piece of line may you. convert.todatetime(date database).tostring("dd/mm/yy"); thanks, anvesh

shell - Trim the first 11 seconds from an mp3 file -

i'm trying write script takes off first 11 seconds more 100 mp3 files. can use "split" command it? or there mac cli program can use? try ffmpeg. ffmpeg -i infile.mp3 -ss 11 outfile.mp3 in case ffmpeg not support mp3 encoding, try below: ffmpeg -i infile.mp3 -ss 11 /tmp/outfile.wav lame /tmp/outfile.wav outfile.mp3 you need install these packages though :)

collections - ArrayList of ArrayList of ints in Java? -

i working on writing sudoku solver , want grid stored arraylist of arraylist of ints...each spot have arraylist of ints of possible numbers (or definite value). arraylist<arraylist<int>> sudoku_board = new arraylist <arraylist<int>>(); java throwing me error saying "dimensions expected after token" on ints. generic type parameters require reference types, rather primitive types. use list<arraylist<integer>> sudoku_board = new arraylist <arraylist<integer>>(); also when coding interface use interface reference type, in case list . appears within generics should remain implementation type due non co-variance of generics . from @assylias comment, more generic type of list is list<list<integer>> list = new arraylist<list<integer>>(); this allow list implementations types other arraylist added should refactoring necessary later.

Reading Data Sets from XML c# -

Image
i have simple class designing log messages on hosted website. to store messages, have created simple class structure: public class storedmsg { public storedmsg() { } public string { get; set; } public string date { get; set; } public string message { get; set; } } these messages written , read using storedmessages : list<storedmsg> class. this original format of read method: public void read() { //string xmlpath = webpage.server.mappath(xml_path); if (file.exists(xmlpath)) { using (var xr = new xmltextreader(xmlpath)) { storedmsg item = null; while (xr.read()) { if (xr.nodetype == xmlnodetype.element) { if (xr.name == head) { if (item != null) { this.add(item); } item = new storedmsg(); } else if (xr.name == from) { item.from = xr.readelementstring(); } else if (xr.name == date) { item.date = ...

Avoid duplicating code when writing junit code for a method called by another one -

i'm new junit. have 2 methods in tested class. method call method b. in b, there condition cases need cover when writing test case. so, in case, if write test b, a, tested code duplicated. have idea case? the code looks like: class example{ public void a(){ assert b(); vara ++; } public boolean b(){ if (case1){ var1b ++; if (case 1.1){ var2b++; return false; } } var3b --; return true; } } thanks. use mockito (or mocking framework), mock method b when testing a, , make return want: example example = spy(new example()); when(example.b()).thenreturn(true); // call a() , test should when b() returns true.

ios - IBM Worklight: FT_Open_Face failed: error 2 when using custom fonts -

i have been using 2 versions of wl app; 1 uat & other production. few days getting error in uat version. however, code both versions remain same. because of this, uat app fonts coming different. i using benton , helvetica using css @font-face { font-family: 'helveticaneueltstd-roman'; src: url('fonts/helveticaneueltstdroman/helveticaneueltstdroman.eot'); src: url('fonts/helveticaneueltstdroman/helveticaneueltstdroman.eot?#iefix') format('embedded-opentype'), url('fonts/helveticaneueltstdroman/helveticaneueltstdroman.woff') format('woff'), url('fonts/helveticaneueltstdroman/helveticaneueltstdroman.ttf') format('truetype'), url('fonts/helveticaneueltstdroman/helveticaneueltstdroman.svg#helveticaneueltstdroman') format('svg'); } @font-face { font-family: 'bentonsansbold'; src: url('fonts/benton/bentonsans-bold.eot'); src: url('fonts/benton/bentonsans-bold....

excel vba - Merge multiple PivotTables for multiple workbooks to create a master PivotTable -

Image
i've found code i've (mostly) modified use, getting error on grouping function. have folder has (at present) 3 workbooks in them. each workbook formatted same sheet names fields within each sheet. each workbook has 2 pivottables derived same unique data source (a third sheet in workbook). i need able to, in new workbook, run script allow me choose workbooks common folder want combine 1 master pivot table. source data looks this: (slashes used after names each column , after data in row 2 there differentiate different columns (12 in total, l inclusive)) row 1 - line / sort / sub-cat / part / para / page / deliv / action / owner / duedate / status / datecomp row 2 - 2 / b / confrnc / 2 / 2.2.1 / 8 / attend / attend / john / 23-may-13 / notstarted / (blank) each workbook has data source sheet set this, multiple rows of data. each workbook has pivot table compiles: rows: sub-cat; action; owner; status columns: duedate values: count of action ...

java - EXCEPTION :Async operation timed out - When reading input stream in servlet -

i got exception exception :async operation timed out when reading input stream in servlet. code read input stream : servletinputstream rdata = request.getinputstream(); int contentlength = request.getcontentlength()!=-1?request.getcontentlength():0; byte[] ar_byte = new byte[contentlength]; rdata.read(ar_byte, 0, request.getcontentlength()); json_str = new string(ar_byte, "utf-8"); i got exception @ line rdata.read(... when application running in websphere 6.1 didnt when running in tomcat 6.0 stacktrace exception : java.net.sockettimeoutexception: async operation timed out @ com.ibm.ws.tcp.channel.impl.aiotcpreadrequestcontextimpl.processsyncreadrequest(aiotcpreadrequestcontextimpl.java:157) @ com.ibm.ws.tcp.channel.impl.tcpreadrequestcontextimpl.read(tcpreadrequestcontextimpl.java:109) @ com.ibm.ws.http.channel.impl.httpservicecontextimpl.fillabuffer(httpservicecontextimpl.java:4130) @ com.ibm.ws.http.channel....

algorithm - A simple code to detect the permutation sign -

supposed have array of integers: 1 2 5 3 7 6 what simple enough algorithm determines if or odd permutation of numbers in sorted fashion (i.e. 1 2 3 5 6 7 )? performance not terribly important here; i'd rather have simple code. simple code(assume n numbers stored in array a): int f() { int cnt=0; for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) if (a[i]>a[j]) cnt++; return cnt%2; } if f() returns 0, permutation , returns 1, odd.

javascript - Code working in IE but not in FF -

i have requirement user type in textbox , textbox filed suggestions database. user select option , on clicking add button text added tag in dynamic html table can removed later. have working fine problem code working in ie. when running page in firefox not running , not showing error. testing purpose have replaced hiddenfields textboxes. can type in "text" , "value" textboxes , click on add skill buttons. work in ie not in ff. waiting suggestions. here complete code: <%@ page language="c#" autoeventwireup="true" codefile="addskills.aspx.cs" inherits="addskills" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>autocomplete</title> <style type="text/css"> .wrapper ...

azure - SQL Connection Issues... next steps -

we've released new game on facebook uses sql azure , we're getting intermittent connection timeouts. i dealt earlier , implemented 'retry' solution seemed have dealt transient connection issues. however, game out i'm seeing happen again. not often, happening. when happens, try logging sql azure management web portal , connection timeout there too. same trying ssms. the query first 1 of game , it's simple select on table 4 records. after 4 minutes, timeouts stop , day or two. since these players around country, don't have direct contact users. i'm looking advice on how can figure out what's going on. thanks, tim fyi: http://apps.facebook.com/relicball/ depending on how compute have in front of database put in limit on connection pools can created connection string. trying setting if example have 2 compute in front of database. max pool size=70; sql database can handle 180 connections hard limit. can find example when...

Maven profile execution -

i have problem , not identify reason until now. i have maven project has several modules. 1 of these modules webservices client. so, during development, when running install in maven, needs access local server generate client. when run plugin generate release of project, clients should point production server. to set key property ${server.address} used point server when generating clients. there 1 profile which, when active, key property rewrites address production server. what's going on? running mvn install generating correctly, ie, pointing local server. when generate release using command mvn release:prepare -b release:perform -denv=prd not rewriting variable should. the strange thing if run mvn install -denv=prd, generates correctly, pointing production server. could give me hint of change work in release cycle? <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=...

ruby on rails - A mailing service that includes newsletter and newsletter templating -

i need allow users fill in own newsletter content , deliver own lists. complete newsletter engine have have following key features: html editor , uploading images. ensure delivery. emailing list , handle unsubscribe issues. reports on emails status (opened, marked spam, bounce ...etc). now need make rails app contain fulfill these key features. have looked @ emailing services sendgrid, postmark, postageapp , others. can support points except first one. need integrate email templating , editor engine ease creating new content newsletters. there service provide me such feature? or there mailing service facilitate creating such feature? another option campaign monitor . here api , here editor

css - Resource interpreted as Stylesheet but transferred with MIME type text/html (IIS) -

i following warning in chrome: " resource interpreted stylesheet transferred mime type text/html." happens when running website in browser iis 8 (on windows 8). if run website visual studio (2010) using file system have no issues (meaning css has been applied website , website viewed expected). i've read through posts on issue, have not yet been able resolve it. if can give me suggestions, great. actually, found out in case happened rights (permissions)-issue. had @ mime-types before in iis , we're set accordingly, css set "text/css". when added users-group have permissions on website-folder have "read & execute, list folder contents , read" -permissions set allow, solved issue. conclusion may due using different root websites-folder iis you're css "cannot accessed" properly. though think problem you're mime type settings in iis, may user-group (you need add iis_iusrs-group if haven't already) wasn't...

Android Eclipse Creating .android folder on Wrong Drive -

i have ssd c: operating system on etc. large e: of programs/storage on it. first installed eclipse on e: came across lot of problems due eclipse wanting in c: default ".android" folder. after searching site used workaround fix these problems such worked: mklink /j "c:\users\john doe.android" "e:\john doe.android" i getting different errors have decided start scratch in c: not have more problems down line. have deleted e: stuff , lives on c: when start eclipse still creates .android folder on e: , not in c: should be. link created above? have unlink somehow now. deleted folder keeps creating again. thought seeing eclipse files located on c: create .android folder on c: also.

linux - Compressing multiple cpanel account into separate .tar.gz files -

my whm incremental backup remote server. question how can compress directories separate file , move different folder. example main_dir ---account1 ---account2 ---account3 the second directory should have this sec_dir ---account1.tar.gz ---account2.tar.gz ---account3.tar.gz i want create cronjob compress account in main_dir move them sec_dir thx you can use below command compression change directory main_dir cd main_dir tar -cvzf fullpathto/sec_dir/account1.tar.gz account1 or for in ls fullpath-of-main_dir ; nice -n 19 /bin/tar -cvzf fullpath-of-sec_dir/$i.tar.gz fullpath-of-main_dir/$i; done ls dir in ' ' commas. mean use ' in starting , in last ls fullpath-of-main_dir

java - Comparison against Double.TYPE and Double.class -

actually not question, since provide answer right away, don't fall same thing: i wanted check (using reflection) if field primitive or 1 of wrapper classes. i checked using cl.isprimitive() , comparisons c==boolean.type , according debugger, boolean.type.tostring returns "boolean", instead of "boolean". double.type == double.class return true . double.class != double.type return true . they (double.class , double.type) somehow represent same thing, don't ask me why... if want compare against double , compare against double.class . if want compare against double , compare against double.class or double.type . though haven't tested primitives, should same other primitives , wrappers. i hope save @ least many minutes took me write this.

sql server - SQL GROUP BY, adding a column from another table works but produces inaccurate information -

so here original query: select batting.playerid, sum(g) 'g', sum(ab) 'ab', sum(r) 'r', sum(h) 'h', sum(doub) '2b', sum(trip) '3b', sum(hr) 'hr', sum(rbi) 'rbi', sum(sb) 'sb', sum(cs) 'cs', sum(bb) 'bb', sum(so) 'so', sum(ibb) 'ibb', sum(hbp) 'hbp', sum(sh) 'sh', sum(sf) 'sf', sum(gidp) 'gidp', master.namelast, master.namefirst, batting join master on batting.playerid = master.playerid master.namelast @lastname + '%' group batting.playerid, master.namelast, master.namefirst here new query: select batting.playerid, sum(g) 'g', sum(ab) 'ab', sum(r) 'r', sum(h) 'h', sum(doub) '2b', sum(trip) '3b', sum(hr) 'hr', sum(rbi) 'rbi', sum(sb) 'sb', sum(cs) ...

verilog - Is there a function equivalent for $sformat? -

i'm writing systemverilog code , notice $sformat system task, not function. there function equivalent $sformat? i'd following inside function: assert(my_dto_h.a == 10) else begin `ovm_error("component", $sformat("my_dto_h.a should 10, not %0d", my_dto_h.a)) end unfortunately, i'm getting the following run-time error questasim 10.2: ** error: (vsim-pli-3029) component.sv(105): expected system function, not system task '$sformat'. yes, $sformatf from lrm: the system function $sformatf behaves $sformat except string result passed function result value $sformatf , not placed in first argument $sformat . $sformatf can used string value valid. variable_format_string_output_function ::= $sformatf ( format_string [ , list_of_arguments ] ) example: string s; s = $sformatf("value = %0d", value);

javascript - prevent jQuery animate() reset on mouseout -

i'm trying fade out menu items exept 1 user hovers over. when using jquery's animate() function on opacity property kind of works. i set opacity of menu items exept hovered .25, , when hover off looks great, when hover directly on item, opacity off items reset 1, , animated down .25. is there way prevent this?

xml - Why is ControllerClassNameHandlerMapping needed -

i thought controllerclassnamehandlermapping mapping url controller (after removing controller portion) doesnt seem case example. if remove "/navigation" mapping navigation controller (see below) 404 errors. <bean class="org.springframework.web.servlet.mvc.support.controllerclassnamehandlermapping" /> <bean name="navigationcontroller" class="com.mvc.controller.navigationcontroller"> <property name="methodnameresolver"> <bean class="org.springframework.web.servlet.mvc.multiaction.propertiesmethodnameresolver"> <property name="mappings"> <props> <prop key="/navigation/menu">menuhandler</prop> </props> </property> </bean> </property> </bean> in code snippet above need pass property key /navigation/menu thought if /navigation ma...

javascript closures onreadystatechange -

why code not parsed when change var comments_switcher = (function(){ var switcher = null; var show = 'show comments'; var hide = 'hide comments'; function init(){ if ( switcher == null ) switcher = document.getelementbyid("comments_switch"); } function switched_on(){ return switcher.value == show; } return { trigger : function(do_init){ if ( do_init ) init(); switcher.value = switched_on() ? hide : show; } } })(); into var comments_switcher = (function(){ var switcher = null; var show = 'show comments'; var hide = 'hide comments'; function init(){ if ( switcher == null ) switcher = document.getelementbyid("comments_switch"); } return { trigger : function(do_init){ if ( do_init ) init(); switcher.value = switched_on() ? hide : show; }, ...

.net - How to print text to bottom left corner in page in C# -

code below used print order. order can have variable number of lines written out first drawstring call. text bottom line1 bottom line2 must appear in bottom left corner in page. code below uses hard coded value e.marginbounds.top + 460 print this. how remove hard-coded value text printed in bottom of page ? var doc = new printdocument(); doc.printersettings.printername = "pdfcreator"; doc.printpage += new printpageeventhandler(providecontent); doc.print(); void providecontent(object sender, printpageeventargs e) { e.graphics.drawstring("string containing variable number of lines", new font("arial", 12), brushes.black, e.marginbounds.left, e.marginbounds.top); e.graphics.drawstring("bottom line1\r\nbottom line2", new font("courier", 10), brushes.black, e.marginbounds.left, e.marginbounds.top + 460); } measure string, move height bottom? ...

Difference Between Function and Predicate In Alloy 4? -

i'm having hard time understanding difference between predicates , functions in alloy 4. i've read section 4.5.2 in software abstractions it's still not clear me. can me understand? a function represents parameterized expression gets inlined @ every invocation site. a predicate represents formula, i.e., boolean expression, in sense kind of function returns boolean expression. difference in alloy can "run" , "check" predicates, using alloy "run" , "check" commands. running predicate instructs alloy find model predicate holds, whereas checking predicate instructs alloy check if there exists model predicate not hold.

ruby - How do I concatenate a string in a while loop? -

i want read lines in loop , concatenate them: d = "" while s = gets d = d.concat(s) end puts d after cancel loop cntrl + z (on windows), output last string read in loop. tried + , << same result. you can in two ways way: d = "" while s = gets d << s end puts d edit: marc-andré lafortune noticed using += not idea, leave << method here.

java - check against empty form field -

i'm pretty new java bear me. i've got simple script processes form data , sends error log. i've got simple null check suppose if phone field isn't filled in don't send error log. reason it's not working. i'm getting in error log string "phone number associated account:" ideas? string phone = request.getparameter("phonenumber"); string showphone = (phone != null) ? " phone number associated account: " + phone : ""; log.error(showphone); i'm not sure framework you're using, null object , empty string not same in java. might want try: string showphone = (phone != null && phone.trim().length()>0) ? " phone number associated account: " + phone : ""; the && phone.trim().length()>0 ensure string has content.

Access not importing relationships for MySQL linked tables -

Image
i have linked mysql database access database file. working fine except relationships in mysql database not appearing in access. i have made plenty of relationships in mysql tables using foreign keys, these relationships not reflected in access. kindly me import relationships mysql database access. software i'm using: mysql version 5, microsoft office 2013, access file format: .accdb while true mysql foreign key constraints don't show default in relationships tab in access, constraints still in place in mysql , still enforced linked tables. for example, have 2 mysql tables, [customers] , [orders], foreign-key constraint on [orders]. if link tables in access , try insert row [orders] linked table [customerid] not match [customerid] in [customers] linked table insert fails: odbc --insert on linked table 'orders' failed. [mysql][odbc 5.2(w) driver][mysqld-5.5.29-0ubuntu0.12.04.2]cannot add or update child row: foreign key constraint fails (`z...

Powershell - redirect executable's stderr to file or variable but still have stdout go to console -

i'm writing script download several repositories github. here command download repo: git clone "$repositoryurl" "$localrepodirectory" when run command displays nice progress info in console window want displayed. the problem want able detect if errors have occurred while downloading. found this post talks redirecting various streams , tried: (git clone "$repositoryurl" "$localrepodirectory") 2> $errorlogfilepath this pipes errors stderr file, no longer displays nice progress info in console. i can use tee-object so: (git clone "$repositoryurl" "$localrepodirectory") | tee-object -filepath $errorlogfilepath and still nice progress output, pipes stdout file, not stderr; i'm concerned detecting errors. is there way can store errors occur in file or (preferably) variable, while still having progress info piped console window? have feeling answer might lie in redirecting various streams other stream...

Hibernate 4.2 exception: Element type "hibernate-mapping" must be declared -

i have been struggling fix error long time kindly me in this. i getting error: hhh000196: error parsing xml (2) : element type "hibernate-mapping" must declared. please me fix this: my pom.xml looks this: <dependency> <groupid>javax.validation</groupid> <artifactid>validation-api</artifactid> <version>1.0.0.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>4.2.1.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.2.1.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid...

error on building cross gcc - "exec -I -

i getting error on building cross compile version of gcc: /c/projects/vo/gcc/gccobj/./gcc/xgcc -b/c/projects/vo/gcc/gccobj/./gcc/ -b/usr/l ocal/i686-linux-gnu/bin/ -b/usr/local/i686-linux-gnu/lib/ -isystem /usr/local/i6 86-linux-gnu/include -isystem /usr/local/i686-linux-gnu/sys-include -g -o2 -o 2 -i/c/projects/vo/gcc/gcc-4.7.3/libgcc/../winsup/w32api/include -g -o2 -din_gcc -dcross_directory_structure -w -wall -wwrite-strings -wcast-qual -wstrict-prot otypes -wmissing-prototypes -wold-style-definition -isystem ./include -g -din _libgcc2 -fbuilding-libgcc -fno-stack-protector -dinhibit_libc -i. -i. -i../../ ./gcc -i/c/projects/vo/gcc/gcc-4.7.3/libgcc -i/c/projects/vo/gcc/gcc-4.7.3/libgc c/. -i/c/projects/vo/gcc/gcc-4.7.3/libgcc/../gcc -i/c/projects/vo/gcc/gcc-4.7.3/ libgcc/../include -i/c/projects/vo/gcc/gcc-4.7.3/libgcc/config/libbid -denable_d ecimal_bid_format -dhave_cc_tls -duse_emutls -o _chkstk_s.o -mt _chkstk_s.o -md -mp -mf _chkstk_s.dep -dshared -dl_chkstk -xa...

java - Need Assistance Understanding execution of Program -

i reviewing practice problem , want know sequence how program came answer of ---> 2 1 having trouble understanding main driver call. understand usage of methods. the code is: public class test { public static void main(string[] args) { int[] x = {1, 2, 3, 4, 5}; increase(x); int[] y = {1, 2, 3, 4, 5}; increase(y[0]); system.out.println(x[0] + " " + y[0]); } public static void increase(int[] x) { (int = 0; < x.length; i++) x[i]++; } public static void increase(int y) { y++; } } the code demonstrating difference between (effectively) call-by-reference (in first increase method) , call-by-value (in second increase method). in fact, both methods use call-by-value, in first case value reference object (the array) , in second case int (a single value array). the code int[] x = {1, 2, 3, 4, 5} creates array. when call increase(x) calling first increase method. method iterates through elements of array , in...

performance - MySQL query speed or rows read -

sorry lots of useless text. important stuff told on last 3 paragraphs :d recently had mysql problem in 1 of client servers. out of blue starts sky-rocking cpu of mysql process. problem lead finding , optimizing bad queries , here problem. i thinking optimization speeding queries (total time needed query execute). after optimizing several queries towards colleague starting colleague started complaining queries read many rows, rows table (as shown explain). after rewriting query noticed that, if want query read less rows - query speed suffers, if query made speed - more rows read. and didn't make me sense: less rows read, execution time longer and made me wonder should done. of course perfect have fast query reads least rows. since doesn't seem possible me, i'm searching answers. approach should take - speed or less rows read? pros&cons when query fast more rows read , when less rows read speed suffer? happens server @ different cases? after googling find ...

.net - Using Entity Framework and Transient Fault Handling Block WITHOUT Azure -

i have several apps rely on repository using ef 4. sometimes, sql operation fail because (i.e. timeout, failed connection, etc.). i want use transient fault handling application block, not using azure. there seems proliferation of info out there azure scenarios, no info on using "barebones" approach. worry if use azure detection strategies, won't work. anyone know can find info on how best use this? i able started looking here: http://hmadrigal.wordpress.com/2012/04/23/automatic-retries-using-the-transient-fault-handling-from-enterprise-libraries-entlib/ you have write own detection strategy class. in case looks this: public class entityframeworktransienterrordetectionstrategy : itransienterrordetectionstrategy { #region itransienterrordetectionstrategy members public bool istransient(exception ex) { if (ex sqlexception) { return true; } else return false; } #endregion } i...

Intercepting ADD to detect if it is an ADD through a collection in Entity Framework 5 -

i have kinda 2 questions can answered separately. q#1 i trying save round trips database server. here's algo: insert 2 entities (to ids generated database) use ids returned call stored procedure passing ids the stored procedure takes ids , populates adjacency list table using store directed acyclic graph. currently have round-trip rdbms each parent-child relationship, plus 1 insert of entities. i known stuff this: public override int savechanges() { foreach (var entry in this.changetracker.entries().where(e => e.state == system.data.entitystate.added).tolist()) { if (entry.entity irobot) { entry.reference("owner").currentvalue = skynet; } } return base.savechanges(); } so wondering if there way can detect entitystate.added "add" done similar following code: var robot = new robot(); skynet.robots.add(robot); db.add(skynet); db.savechanges(); so can this: (note psuedocode) ...