Posts

Showing posts from June, 2010

jsf - JSF2.2 Annotated Validation not working -

i developing application using tomcat 7, jsf 2.2.6 (mojarra), hibernate validator 4.3.1 , have come across documented bug shown here: https://java.net/jira/browse/javaserverfaces-3183 . i have patched temporarily using fix given in answer on question: https://stackoverflow.com/a/21700488/1089995 , until such time 2.2.7 released publicly. however when attempt use annotations on fields, such @notnull, @size, etc, these ignored - there no relevant stack trace this, no error occurs , annotations ignored during validation phase. page.xhtml <input type="text" placeholder="e.g. joe bloggs" jsf:id="txtadminname" jsf:validator="#{bean.validateadminname}" jsf:value="#{bean.model.adminname}"/> model.java //model bean bean validation, not applied field. @size(min = 3, max = 50, message = "please enter between 3 , 50 characters.") private string adminname; bean.java //the model bean bean validation, shown below.

Neo4j embedded online backup using Java in Ubuntu -

i using neo4j(embedded) enterprise edition 1.8.3. tried online backup using code below def backup_data() { val backuppath: file = new file("d:/neo4j/data/backup/") val backup = onlinebackup.from( "127.0.0.1" ) if(backuppath.list().length > 0) { backup.incremental( backuppath.getpath(), false ) } else { backup.full( backuppath.getpath() ); } } the above code working fine in windows got error client not connect localhost/127.0.0.1:6362 same code in ubuntu. should change make work in ubuntu?

javascript - Leaflet.markercluster cluster added to DOM event -

i'm trying customize marker clusters appear pie charts, using chart.js library. i've overridden iconcreatefucntion additional calculations necessary , set data, transform icons actual charts, need call additional js when cluster icon added dom. how can hook leaflet.markercluster's "cluster icon added" event? ok, figured out. it's simple adding like: cluster.on 'add', (event) -> # stuff event.target, l.markerclustergroup instance to iconcreatefunction hope helps else out 1 day...

jquery - Issue in iterating the array in javascript -

i have array named a[] contains city_id , city name then doing edit , details such cityid , countryid ,etc and save in var b= cityid now cityname , appending field textbox i iterating array thru each function function f1() { jquery(a). each(function(m) { if(this.city_id(from array a) == cityid) if(c== "") { c += this.cityname; } else { c += ","+ this.cityname; } }); } c global var problem on click of edit c bombay , delhi , puna but again next time if click on radio button fetch details gets appended bombay , delhi , puna , chennai instead of clearing first one. try this.. here each obj in array. $.each( a, function( i, val ) { if(i.city_id== cityid) if(c== "") { c += this.cityname; } else { c += ","+ this.cityname; } });

c# - EventWaitHandle.Close() - what type of call this is sync or Async? -

i have eventwaithandle wait receive events. once, receive event. supposed release resources used eventwaithandle. releasing events using eventwaithandle.close(). my question after calling eventwaithandle.close(). should wait or sleep times release resources?

excel - Report generation based on multi lookup and dynamic columns -

i little stuck report trying generate in excel , hoping help. here summary of trying do: table 1 has 1 column called people (it’s list of employees) table 2 has 1 column called countries (it’s list of relevant countries) table 3 has 3 columns called person, country , date. there 1 entry every person each time review country. so data like: person | country | date john | uk | 10/01/2013 paul | uk | 15/01/2013 john | france | 15/01/2013 bob | spain | 16/01/2013 the report need produce 1 shows has/hasn't checked each country. columns ‘person’, uk, france, spain (and other unique value country table). there 1 single row each person yes/no value in relevant column if person has reviewed country i.e. table 3 contains value matches value person , country. so clear report should similar to: person | uk | france | spain john | yes

javascript - jQuery: How to toggle H1 tags at different time intervals? -

i need toggle 2 h1 tags. first 1 needs displayed 3 seconds on screen, , second needs displayed 8 seconds on screen. i need jquery solution. try code. html <h1> first h1 </h1> <h1> second h1 </h1> jquery <script type="text/javascript"> $(document).ready(function(){ //initially hide second h1 $("h1:nth-child(2)").hide(); function show_second_h1(){ $("h1:nth-child(1)").hide(); $("h1:nth-child(2)").show(); settimeout(show_first_h1,8000); } function show_first_h1(){ $("h1:nth-child(1)").show(); $("h1:nth-child(2)").hide(); settimeout(show_second_h1,3000); } settimeout(show_second_h1,3000); }); </script> it call show_first_h1() , show_second_h1() @ given time-interval 1 one show respective h1 tag. demo jsfiddle edit: if have control on html , can set id h1 following simplified code

excel - Insert a column chart that shows the number of values found in a range of rows -

Image
assume have data follows: id; author; customer ticket 1; john; alice ticket 2; john; bob ticket 3; ken; charles ticket 4; ken; darren (i use ; symbolize end of cell/column) i want produce column chart has 1 column per unique value author , height of column number of times value occurs. in example, have 2 columns ( john , ken ) , each 2 in size. how do that? i think want achieved pivottable author rows , count of author sigma values select data , insert column chart:

java - How to replace the value of '0' in a given pattern? -

i new in java, , trying replace value of "0's" "x" @ index "0,1,7,13,20,21,22, , 23" in below given sequence of 0 , 1's. , code far given. problem due can not obtain desired result. 001111 101110 100010 110000 public class task { public static void main (string args[]) { file file = new file("c:\\netbeansprojects\\task\\src\\file.txt"); bufferedreader reader = null; try { reader = new bufferedreader(new filereader(file)); string text = null; //array lis declaration arraylist<string> list = new arraylist<>(); while( (text = reader.readline()) != null){ list.add(text); } //printing array list. system.out.println("print array list\n"); for(string d:list){ // system.out.println(d); } //convert arraylist 2darray

Code coverage report from jacoco.exec file using ant -

i trying generate code coverage report jacoco.exec file using ant. my ant build is: <?xml version="1.0"?> <project xmlns:jacoco="antlib:org.jacoco.ant" name="example ant build jacoco" default="rebuild"> <description> example ant build file demonstrates how jacoco coverage report can itegrated existing build in 3 simple steps. </description> <property name="src.dir" location="./java"/> <property name="result.dir" location="./target"/> <property name="result.classes.dir" location="./classes"/> <property name="result.report.dir" location="${result.dir}/site/jacoco"/> <property name="result.exec.file" location="./jacoco.exec"/> <!-- step 1: import jacoco ant tasks --> <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"&g

multithreading - Java make sleeping threads do work in a thread pool -

i have thread pool fixed number of working threads (say 4). continiously fetch new runnables executor. of these runnables have long period sleep call, waiting thread interrupted it: runnable runnable = new runnable() { @override public void run() { //do preparation doprework(); //wait other runnable interrupt me try { thread.sleep(40000); } catch(interruptedexception e) { } //finish work doafterwork(); } } so question is: when fetch first 4 runnables executor, working threads sleeping , other incoming runnables(a lot of them, because continiously incoming) queued , have wait available threads. there way, can use sleeping threads execute new incoming runnables, maintaining others sleeping? no, sleeping thread sleeping. can't make else. what should add scheduled task delayed amount of time want. free current thread , allow else. scheduledexecut

regex - .htaccess RewriteRule for directory -

i use rewriterule following www.mysite.com/xyz or www.mysite.com/xyz/ ==> should go www.mysite.com/page.php?var=xyz www.mysite.com/xyz.html www.mysite.com/xyz.htm www.mysite.com/xyz.php or other extension ==> should not rewritten only when there's no file extension, rewrite rule should used thanks! put code in document_root/.htaccess file: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^.]+?)/?$ /page.php?var=$1 [l,qsa]

javascript - Replace element on click -

when developing apps android through phonegap using html there noticeable flicker when switching pages. caused loading in new html file. can avoided replacing element on click , having fade in? i don't mind using javascript or jquery can't seem find way using html , css. i'm creating childrens interactive story/book. clicking goback or goforth buttons load in new content, without effecting buttons. it's best understand causing flicker, since you've given no information go on, there's not can that. it's pretty easy replace element plain javascript: function replaceelem(origelem, newelem) { var parent = origelem.parentnode; parent.insertbefore(newelem, origelem); parent.removechild(origelem); } if want fade new element in, can css transition or library supports animations. if want new element fadein on top of old element, have play games overlapping objects , positioning , remove old element after new element faded in. d

c# - Windows WebHDFS Client to Cloudera Hadoop -

we have windows application communicating fine via webhdfs client (in incubator phase) http:/ /hadoopsdk.codeplex.com/wikipage?title=webhdfs%20client&referringtitle=home cloudera hadoop installation. next phase establish kerberos authentication via http. having difficulty finding on topic between windows client , linux/apache server. most of examples i've seen using curl --negotiate mechanism : http://hadoop.apache.org/docs/r1.0.4/webhdfs.html#delegation+token+operations everything else i've found .net has been low level http://msdn.microsoft.com/en-us/library/ms995331.aspx is there out there can use or going have write custom code? i found solution problem being misunderstood how kerebros snego implemented. for of in same predicament hope helps..the authentication done between client (windows machine) , kdc (linux) @ time of users logon of client (for 1 configuration). after ticket has been issued webhdfs communication can established in more secure m

hadoop - Error running a MapReduce streaming job using Python -

i'm trying run mapper , reducer code (*disclaimer - part of solution training course) mapper.py import sys line in sys.stdin: data = line.strip().split("\t") if len(data) == 6: date, time, store, item, cost, payment = data print "{0}\t{1}".format(1, cost) reducer.py import sys stotal = 0 trans = 0 line in sys.stdin: data_mapped = line.strip().split("\t") if len(data_mapped) != 2: continue stotal += float(data_mapped[1]) trans += 1 print transactions, "\t", salestotal keeps throwing error: undef/bin/hadoop job -dmapred.job.tracker=0.0.0.0:8021 -kill job_201404041914_0012 14/04/04 23:13:53 info streaming.streamjob: tracking url: http://0.0.0.0:50030/jobdetails.jsp?jobid=job_201404041914_0012 14/04/04 23:13:53 error streaming.streamjob: job not successful. error: na 14/04/04 23:13:53 info streaming.streamjob: killjob... streaming command failed! i've tried both explicitl

html - How can I put a div tag to automatically go UNDERNEATH a position:relative div -

i've been getting web development , i've begun test abilities creating own websites. i've run problem though. website structured position:fixed header stay is. because of this, had include in text container underneath position:relative. the problem having footer literally inside text container. want footer @ bottom of content* (hence, footer) unable so. this code far: (html) <html> <head> <title>bigbeno37's test page</title> <link rel="stylesheet" type="text/css" href="reset.css" /> <link rel="stylesheet" type="text/css" href="stylesheet.css" /> </head> <body> <div class="header"> <h1 class="headertext"> bigbeno37's site </h1> <ul class="menu"> <li><a href="#">co

graphics - what format of pic can genereate mimap in opengl-es -

as title, used use .dds , did work,now use type of .png , can generate mipmap? here functions using: glteximage2d(…) .or maybe glubuild2dmipmaps(…) better choice? dds image format contains precalculated mipmaps. far quality goes, precalculated mipmaps offer best quality, since can downsampled offline advanced filter kernels lancozs, without having care runtime efficiency. png not contain additional mipmap levels have compute mipmaps @ runtime. should not use glubuild2dmipmaps this. 1 function known exhibit buggy behavior in conditions , furthermore unconditionally resample images power-of-2 dimensions, although since opengl-2 non power-of-2 dimensions fine texture images. instead should load base level image glteximage2d(…) , use glgeneratemipmap(…) (available since opengl-3) build mipmap image pyramid there. if don't use opengl-3, can use sgis_generate_mipmap extension, if available. however advised online mipmap generation may yield not results offline gen

css - DIV color not displaying properly in IE -

Image
i developing application in oracle apex custom theme. application run in browser except ie, ie doesn't show color expecting. this result comes chrome browser. now in internet explorer 8 (ie8) messed up, color effect not displaying properly. here css 1,2,3,4 <div> .top-tabs .tab:nth-child(1),.head1 .region-header { background-color: #014fa2; } .top-tabs .tab:nth-child(2),.head2 .region-header { background-color: #1e69b9; } .top-tabs .tab:nth-child(3),.head3 .region-header { background-color: #3481d2; } .top-tabs .tab:nth-child(4),.head4 .region-header { background-color: #58a1f0; } here html <ul class="top-tabs"> <li class="tab"> <a href="#"> <div class="top-tab-nr">1</div> <div class="top-tab-label">admission<br>application</div> </a> </li> <li class="tab"> <a href=&qu

symfony - Symfony2 - Callback validator on collection -

in symfony2 i'm tying use callback validate form, callback never called. class wherein callback is, called in main form through collection. here code... main class : class inscriptiontype extends abstracttype { /** * @param formbuilderinterface $builder * @param array $options */ public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('inscriptionreponses','collection',array('label'=>false, 'type'=>new inscriptionreponsetype(), 'error_bubbling'=>false, 'by_reference'=>false)) ; } } inscriptionreponse class : use symfony\component\validator\constraints assert; use symfony\component\validator\executioncontextinterface; /** * inscriptionrepon

c# - Lync InvalidStateException when changing contact relationship -

trying change accesslevel of contacts, never succeeds unless use accesslevel.default. here's i've got currently: private void beginsearchcallback(iasyncresult r) { object[] asyncstate = (object[])r.asyncstate; contactmanager cm = (contactmanager)asyncstate[0]; try { searchresults results = cm.endsearch(r); if (results.allresults.count == 0) { console.writeline("no results."); } else if (results.allresults.count == 1) { contactsubscription srs = cm.createsubscription(); contact contact = results.contacts[0]; // change relationship contact.beginchangesetting(contactsetting.accesslevel, accesslevel.colleague, setprivacycallback, contact); } else { console.writeline("more 1 result."); } } catch (searchexception se) { console.writeline("search failed: " + se.re

php - Yii Framework not saving value for field to DB -

i new php, , working on project uses yii framework. have added new field our database, , reason isn't being passed database. alter table profiles add organization_id int(10); i altered validation, thought issue include field. public function rules() { // note: should define rules attributes // receive user inputs. return array( array('participant_list_id, organization_id', 'numerical', 'integeronly'=>true), array('participant_list_name, organization_id', 'required'), array('participant_list_name', 'unique', 'message' => 'the name exists.'), array('participant_list_name', 'length', 'max'=>64), array('participant_list_desc', 'length', 'max'=>255), // following rule used search(). // @todo please remove attributes should not searched. arr

javascript - Jquery doesn't work on HTML tags which via called by AJAX -

i have unordered list <ul id="showlist"></ul> if user calls ajax function fills list items like <ul> <li>a</li> <li>b</li> <li>c</li> <li>d</li> </ul> my problem begins after that. have <script> tag @ , of page. says when down button pressed make first child of <ul> blue. nothing <script> $(body).keydown(function(e) { if(e.keycode == 40){ $("#showlist:first-child").attr("style","background-color:blue"); } }) </script> how can solve problem? use $('body') instead of $(body) . you have issue selector: $("#showlist li:first-child") working example: http://jsfiddle.net/hf6lf/ also, mentioned in post script @ end of page. if had script in head, need wait dom ready body element exist. might safer bind handler document , exist.

Return Collections Counter Result as JSON with Python -

i not super familiar python i'm working on script needs return json object python php. problem i'm having use of collections counter , not not being valid json encode (actually won't compile, makes sense). i getting 1 error: valueerror: keys must string here snippet of code: # make sure items in set unique items = collections.counter(tuple(item) item in all_items) # print json response print json.dumps({ 'items': items, 'position': [ravg, gavg, bavg] }) this counter looks like: counter({(11, 11, 15): 8452, (151, 131, 153): 7336, (26, 29, 35): 7324, (83, 81, 100): 5080, (113, 106, 126): 5012, (54, 56, 61): 4627, (193, 193, 194): 3783, (13, 124, 157): 822}) json allows keys strings, , tuples. try: items = collections.counter(str(tuple(item)) item in all_items) or maybe items = collections.counter(str(item) item in all_items) (depending on how you'd them formatted in json)

ruby on rails - How to create circular images using Prawn -

is possible clip or apply mask image using prawn. for example, i'm embedding image pdf using image http://path/to/image . image square, pdf design requires circle. with html/ css apply radius image achieve effect. there way similar prawn? based on sunil-antony's answer, came following solution (using save_graphics_state enclose drawing instructions, see prawn documentation): prawn::document.generate("x.pdf") image_width = 200 image_x = 100 image_y = 100 save_graphics_state soft_mask fill_color 0,0,0,0 fill_circle [image_x + image_width/2, image_y - image_width/2], image_width/2 end image "example.jpg", at: [image_x, image_y], width: image_width, height: image_width end end

css - Clip the vertical and horizontal overflow of <pre> tag outside of its container, and show scrollbars -

i have div specific size (300px 300px). inside div pre tag snippet of source code. snippet can of arbitrary size. i'm trying style div , pre tag source code not wrap horizontally unless there line break. , if there overflow, should not visible, , scroll bars should displayed. should work both horizontal , vertical overflow. so far have vertical scroll bar, text gets wrapped horizontally. here css (mostly copied stackoverflow's code formatting): pre { max-height: none\9; padding: 5px; font-family: consolas, monaco; margin-bottom: 10px; overflow: auto; text-overflow: clip; width: 300px; height: 300px; } and here example of html: <div class="item" data-handle=".snippetheader"> <h5 class="snippetheader">snippet7</h5> <div class="code"> <pre> <code> dword winapi valuefunc(lpvoid arg){ //printf(&quot;thread created\n&quot;); x = (i

c# - Versioning using Attribute Routing in ASP .net WEB API -

i trying implement versioning using attributerouting in web api. have defined 2 folders under controllers called v1 , v2. have multiple controllers in each folder. in product controller define routeprefix [routeprefix("v1/product")] , [routeprefix("v2/product")] when go uri v1/product works fine, v2/product executes code in v1 folder. attribute routing support versioning or have related routes well. route defined config.routes.maphttproute( name: "defaultapi", routetemplate: "{namespace}/{controller}/{id}", defaults: new { id = routeparameter.optional} ); my product controller looks like namespace api.controllers { [routeprefix("v1/product")] public class productv1controller : apicontroller { private dbcontext db = new dbcontext(); public dynamic get() { //gets products } } the code in v2 product is namespace api.controllers { [routeprefix(&quo

php - jQuery is working on click of Cancel Button -

i have 1 class reference stock function. , have file contain php , jquery. in php code check if product in stock equal zero, confirm box pop up. problem when click on cancel button, ajax still run function of class , update data in database observed alert success did not load. how fix? sorry bad english. php file: <?php if($record['product_in_stock']<=0){?> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script type="text/javascript" language="javascript"> if(confirm('product in stock empty now, want continue?')){ alert('ok'); var order_id="12059"; $.ajax({ url:'components/com_virtuemart/classes/check_product_instock.php', type:'post&#

sql - i have a set of account numbers to which i have to map 12 months data in respective months column -

i have set of account numbers .i need map values 12 months against account numbers in respective month. while using update query throws more 1 value being thrown . please suggest. upate balances set inrambfeb14=feb14.inramb feb14 balance.accountno=feb14.accountno cte ( select accountno,max(inramb) inramb feb14 group accountno ) update balances set inrambfeb14 = cte.inramb cte join balances bal on bal.accountno = cte.accountno this give max value update... for more suitable answers should give input data & expectation clearly

eclipse - Android projects no longer run -

recently eclipse has made changes me. when create new project java file , xml layout file no longer automatically created. isn't big problem because can create them on own, haven't been able run project on emulator, , no longer able run projects on phone. when try run application appears in compiler: [2014-04-24 04:06:16 - accelerometer_test] performing sync [2014-04-24 04:06:16 - accelerometer_test] automatic target mode: using device '############' [2014-04-24 04:06:17 - accelerometer_test] application deployed. no need reinstall. [2014-04-24 04:06:17 - accelerometer_test] /accelerometer_test/bin/accelerometer_test.apk installed on device [2014-04-24 04:06:17 - accelerometer_test] done! any ideas of why installing apk , not launching project? checked updates, said none found. new android programming, i'm not sure if accidentally changed setting or not. edited devices serial number (wasn't sure if should private or not). help. change workspace

php - How to send data to wordpress via post method? -

the wordpress admin backend has features create contact form, is, the admin first design form @ panel there short code generated , when admin put short code @ post, automatically create form however, wonder there way create html , directly post data page? because, no matter generate wordpress or not, still html form , code this <form action="/test/?preview=true&amp;preview_id=599&amp;preview_nonce=f15a57ac32&amp;post_format=standard#wpcf7-f533-p599-o1" method="post" class="wpcf7-form" novalidate="novalidate"> <div style="display: none;"> <input type="hidden" name="_wpcf7" value="533"> <input type="hidden" name="_wpcf7_version" value="3.7.2"> <input type="hidden" name="_wpcf7_locale" value="en_us"> <input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f533-p599-o1

json - Deserialize Java Set<Enum> using FlexJson -

im trying use flexjson deserialize json object in spring roo controller exception being thrown cannot resolve it. daysofweek.java public enum daysofweek { sunday("sunday"), monday("monday"), tuesday("tuesday"), wednesday("wednesday"), thursday("thursday"), friday("friday"), saturday("saturday"); private final string description; daysofweek(string description){ this.description = description; } public string tostring(){ return description; } } calldetail.java public class calldetail extends calendarevent { @notnull private string title; @notnull @enumerated private callfrequency frequency; @elementcollection(targetclass = daysofweek.class) @enumerated private set<daysofweek> daysofweek; } calldetailcontroller.java @requestmapping(method=requestmethod.post, headers={"accept=application/json&

c# - How to check first textbox value is in second textbox textmode -

i have 2 textboxes: textbox1 textbox2 i want when first textbox have valid date second textbox's value become next week like: if(textbox1.text== textbox2.textmode) { txtdateto.text = datetime.parse(txtdatefrom.text, system.globalization.cultureinfo.invariantculture).adddays(7).tostring("mm/dd/yyyy"); } use textchanged event of txtdatefrom like: private void txtdatefrom_textchanged(object sender, eventargs e) { var styles = datetimestyles.none; datetime datevalue; if(datetime.tryparse(txtdatefrom.text, system.globalization.cultureinfo.invariantculture, styles, out datevalue)) { textbox2.text = convert.tostring(datevalue.adddays(7)); } else { textbox2.text = "invalid datetime inserted in txtdatefrom;"; } } make sure connect event correctly, example using designer @ event section of textbox.

Java EE 7 Form based authentication -

i'm working on web application based on java ee 7, postgresql , application server glassfish 4. need implement form based authentication, , secure url knowing : the users , roles/groups (whatever called) stored in database. i wanted application "standard" possible (i.e using jsf , jpa, , no other framework spring, struts ...) after research, found java ee provided standard authentication mechanism called jaspic. so, focused research on jaspic , read multiple stackoverflow q/a , articles written arjan tijms (it's impossible find stackoverflow q/a related java ee without 1 of answers or comments, him way) : http://arjan-tijms.blogspot.fr/2012/11/implementing-container-authentication.html http://arjan-tijms.blogspot.fr/2013/04/whats-new-in-java-ee-7s-authentication.html http://arjan-tijms.blogspot.fr/2014/03/implementing-container-authorization-in.html my question : jaspic allow me need (form authentication + url restriction roles) , worth effort use

node.js - node-mysql multiple statement in one query -

i'm using nodejs 10.26 + express 3.5 + node-mysql 2.1.1 + mysql-server version: 5.6.16 . i got 4 delete's , want 1 database request, connected delete commands ";"... fails always. var sql_string = "delete user_tables name = 'testbase';"; sql_string += "delete user_tables_structure parent_table_name = 'testbase';"; sql_string += "delete user_tables_rules parent_table_name = 'testbase';"; sql_string += "delete user_tables_columns parent_table_name = 'testbase';"; connection.query(sql_string, function(err, rows, fields) { if (err) throw err; res.send('true'); }); it throws error: error: er_parse_error: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'delete user_tables_structure parent_table_name = 'testbase';delete fr' @ line 1 but if paste sql in phpmyadmin successful... if write in single query's s

How do I install TypeScript? -

i have version 0.9.1.1. ran following: c:\test>npm install -g typescript npm http https://registry.npmjs.org/typescript npm http 200 https://registry.npmjs.org/typescript npm http https://registry.npmjs.org/typescript/-/typescript-1.0.0.tgz npm http 200 https://registry.npmjs.org/typescript/-/typescript-1.0.0.tgz c:\users\david\appdata\roaming\npm\tsc -> c:\users\david\appdata\roaming\npm\nod e_modules\typescript\bin\tsc typescript@1.0.0 c:\users\david\appdata\roaming\npm\node_modules\typescript but when run tsc get: c:\test>tsc version 0.9.1.1 syntax: tsc [options] [file ..] what else need install latest version? update: c:\test>where tsc c:\program files (x86)\microsoft sdks\typescript\tsc.exe c:\program files (x86)\microsoft sdks\typescript\tsc.js c:\users\david\appdata\roaming\npm\tsc c:\users\david\appdata\roaming\npm\tsc.cmd tsc.exe 0.9.1.1 , tsc.cmd 1.0.0.0 i removed visualstudio 0.9.1.1 addin , it's - tsc.cmd , that's 1.0.0.0 thank al

heroku - Where are my assets files stored? -

as have read, heroku recommends pointing cdn directly @ dynos rather using asset_sync, therefore did this: # config/environments/production.rb config.action_controller.asset_host = "<my distribution subdomain>.cloudfront.net" the origin of distribution dcaclab.com cnames of distribution assets.dcaclab.com so, after pushed rails 4 app heroku, found assets served cloudfront's distribution, like: http://<my distribution subdomain>.cloudfront.net/assets/features/multiple%20circuits-edbfca60b3a74e6e57943dc72745a98c.jpg what don't understand, how assets files got uploaded cloudfront's distribution?! also, can find them? thought uploaded s3 bucket assets empty. can enlighten me please? if files being served cloudfront distribution , not being pulled s3 bucket "assets" thought, have set cloudfront distribution use custom origin such web server (s3 buckets normal/standard origins). if have set cloudfront distribution use w

dom - How to get element width/height with margin, padding, border in Native JavaScript (no jQuery) -

looking reliable method calculate element's width/height + margin - padding + border using native js , xbrowser (ie8+) ta if you're dealing pixel values margin, padding , border properties, can following: // we're assuming reference element in variable called 'element' var style = element.currentstyle || window.getcomputedstyle(element), width = element.offsetwidth, // or use style.width margin = parsefloat(style.marginleft) + parsefloat(style.marginright), padding = parsefloat(style.paddingleft) + parsefloat(style.paddingright), border = parsefloat(style.borderleftwidth) + parsefloat(style.borderrightwidth); alert(width + margin - padding + border); if you're dealing other kinds of values (like ems, points or values auto ), refer this answer .

osx - QT use unzip on OS X -

i'm trying unzip within application. need work on os x. for reason cannot unzip file: qprocess *proc = new qprocess( ); proc->start("unzip", qstringlist("testfile.zip")); any ideas i'm doing wrong? there 2 things can try. 1. instead of "unzip", use "/usr/bin/unzip", ie, provide full path of program. 2. use 1 big string, not string list. this: proc->start("/usr/bin/unzip testfile.zip");

javascript - How to get all elements with a specified href attribute -

let i've elements href=/href_value/ attribute. how elemenets such href attribute has href_value value? heres version work in old , new browsers seeing if queryselectorall supported you can use calling getelementsbyattribute(attribute, value) here fiddle: http://jsfiddle.net/ghrqv/ var getelementsbyattribute = function(attr, value) { if ('queryselectorall' in document) { return document.queryselectorall( "["+attr+"="+value+"]" ) } else { var els = document.getelementsbytagname("*"), result = [] (var i=0, _len=els.length; < _len; i++) { var el = els[i] if (el.hasattribute(attr)) { if (el.getattribute(attr) === value) result.push(el) } } return result } }

powershell vmware powerCLI automatic script -

i making script run in powershell (powercli) vmware. try automatic report exported csv file dont know how resolve couple of problems. all parameters dont know how export them. "virtual machine working location" can export disks mashine, don't know how export path folders. domain / workgroup name of computer when try export name name domain "name.domainname.com" (that strange because vm not in domain, there in workgroup) name mean name inside of os not in esxi, because esxi name of vm this $name = (get-vm name_maschine|select-object name).name or simple when in loop parameter name of mashine, export parameter less important parameters 4 . name of vcenter in host working the name of datacenter in host working code: connect-viserver -server ip-addres -user root -password password get-view -viewtype virtualmachine | %{ new-object psobject -property @{ # mashine name 'mashine name' = $_.name #date when

android - MapView fix not compling -

i following error mapview: "cameraupdatefactory not initialized" many posts out there suggest adding: mapsinitializer.initialize(this); ide telling me: "googleplayservicesnotavailableexception never thrown" my code below: xml: <com.google.android.gms.maps.mapview android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> and code run it: mapview = (mapview) header.findviewbyid(r.id.mapview); map = mapview.getmap(); try { mapsinitializer.initialize(this); } catch (googleplayservicesnotavailableexception e) { e.printstacktrace(); } // updates location , zoom of mapview cameraupdate cameraupdate = cameraupdatefactory.newlatlngzoom(new latlng(43.1, -87.9), 10); map.animatecamera(cameraupdate); first off, getting compiler warning because mapsinitializer.initialize(this); not throw googleplayservicesnotavaila

PHP 5.2.17 - preg_replace_callback() doesn't work -

function: function parse_csv($csv_string, $delimiter = ",", $skip_empty_lines = true, $trim_fields = true){ $enc = preg_replace('/(?<!")""/', '!!q!!', $csv_string); $enc = preg_replace_callback( '/"(.*?)"/s', function ($field) { return urlencode($field[1]); }, $enc ); $lines = explode("\n",$enc); return array_map( function ($line) use ($delimiter, $trim_fields) { $fields = $trim_fields ? array_map('trim', explode($delimiter, $line)) : explode($delimiter, $line); return array_map( function ($field) { return str_replace('!!q!!', '"', urldecode($field)); }, $fields ); }, $lines ); } works fine on php 5.3.x, in 5.2.17 getting error: parse error: syntax error, unexpected t_function in /

osx - How can I make any icon on the Mac dock bounce? -

i able make app's icon on dock, application, bounce keyboard command. there way can this? it need work on application icons, example ever application in use, keyboard command make icon bounce when application opening - although preferably bounce once. i presume sort of script? thanks

Excel VBA Not Saving in Current Directory -

here code below excel vba batch save excel files in directory pdf. uses msofiledialogfolderpicker user's input. everything works except doesn't save in current directory original files, saves in folder above. please let me know need add or change saves in same folder. thanks. sub batchprocessing_exceltopdf() application.filedialog(msofiledialogfolderpicker) .title = "select folder location" .buttonname = "select" .show .allowmultiselect = false cmdselectinput = application.filedialog(msofiledialogfolderpicker).selecteditems (1) & "\" end mypath = cmdselectinput mytemplate = "*.xls*" ' set template. myname = dir(mypath & mytemplate) 'retrieve first file while myname <> "" workbooks.open mypath & myname pdfsaveas workbooks(myname).close (true) 'close myname = dir 'get next file loop msgbox "finished excel batch pro

razor - ASP.NET Display Templates - No output -

i have model: public class definitionlistmodel : list<definitionlistitemmodel> { } then have display template (partial view) setup in displaytemplates: @model company.product.models.definitionlistmodel <dl> @foreach (var definition in model) { html.displayfor(m => definition); } </dl> which calls default display template because each item definitionlistitemmodel : @model company.product.models.definitionlistitemmodel @html.displayfor(m => m.term, "definitionterm"); @html.displayfor(m => m.description, "definitiondescription"); and definitionterm template looks this: @model object @{ if (model != null) { string s = model string; if (s != null) { <dt>@s</dt> } else { // other types , models used. // last resort. <dt>@model.tostring()</dt> } } } a breakpoint placed in last te

newrelic - How to diagnose intermittent uwsgi errors? -

first let me briefly describe our set before ask question proper: we have web application server (virtual machine) running django application. nginx @ front, uwsgi running under that, newrelic application wrapper followed django et al., database separate postgresql server located via smartstack (synapse/nerve) the issue face (happened once 2 weeks ago, , twice in last 2 days), 1 or 2 of uwsgi worker processes trip , start producing "django.db.utils.interfaceerror: connection closed" on of requests. slightly redacted stack trace (user , application_name): traceback (most recent call last): file "/home/user/webapps/application_name/local/lib/python2.7/site-packages/newrelic-2.8.0.7/newrelic/api/web_transaction.py", line 863, in __call__ file "/home/user/webapps/application_name/local/lib/python2.7/site-packages/newrelic-2.8.0.7/newrelic/api/function_trace.py", line 90, in literal_wrapper file "/home/user/webapps/application_name/local/

python - Implementing product upload dynamically using Django 1.6 -

so using admin interface add product information different items on site. looking add product information models template view, every time add new product using admin interface, template generate new li tag current product information , picture used of entered data within admin interface. i have not yet implemented template logic in views.py yet stumped on how wrap head around making whole process happen. can guide me on how implement solution? thank you! here code below: models.py from __future__ import unicode_literals django.db import models django.utils.translation import ugettext_lazy _ import datetime class designer(models.model): name = models.charfield(max_length=254, blank=true, null=true) label_name = models.charfield(max_length=254, blank=true, null=true) description = models.textfield(null=true, blank=true) specialites = models.charfield(max_length=254, null=true, blank=true) image = models.imagefield(upload_to='images/designers/mai