Posts

Showing posts from September, 2012

java - SQLException w/ Tomcat 7.0 JDBC connection pool and MySql -

i'm trying use new tomcat 7.0 jdbc connection pool , mysql. says here can drop latest tomcat-jdbc.jar tomcat/lib directory in tomcat 6.0 environment, , that's i've done. i'm using spring initialize , instantiate datasource per examples around web: <bean id="mydatasource" class="org.apache.tomcat.jdbc.pool.datasource" destroy-method="close" p:driverclassname="${driver_class}" p:url="${url}" p:username="${username?root}" p:password="${password}" p:initialsize="10" p:initsql="select dts dt_tm_ts read ur" p:minidle="10" p:maxidle="100" p:maxactive="100" p:maxwait="6000" p:jmxenabled="true" p:jdbcinterceptors="org.apache.tomcat.jdbc.pool.interceptor.connectionstate;org.apache.tomcat.jdbc.pool.interceptor.statementfinalizer" p:removeabandoned="true" p:removeabandonedtimeout="60" p:logabandoned=...

delphi - Plotting a TChart with time as the X-axis -

i have series of 3,600 values, 1 every second hour. want chart them single series, using tchart in delphi 7. the values should plotted on y-axis. should pass addxy() x-axis value? count of points? i want label x-axis mm:ss, how do that? need beyond this? ... chart1.series[0].xvalues.datetime := true; chart1.bottomaxis.datetimeformat := 'nn:ss'; i have been stuck while one. can post sample code? thanks if not wrong, want series1.addxy(<pass data value>, <pass value>, '', clred); series1.addxy(now, 1, '', clred); series1.addxy(now + ( 1 /(24*60*60)), 2, '', clred); //after 1 seconds series1.addxy(now + ( 2 /(24*60*60)), 3, '', clred); //after 2 seconds

c# - Monotouch EKEvent Notes not being saved -

what doing wrong here? currentevent.title prints correctly. currentevent.notes blank.. public void calendarevents() { ekeventstore store = new ekeventstore(); ekcalendar calendar = store.defaultcalendarfornewevents; // query event if (calendar != null) { // add new event ekevent newevent = ekevent.fromstore(store); newevent.title = "lunch @ mcdonalds"; newevent.calendar = calendar; newevent.startdate = datetime.now.date; newevent.enddate = datetime.now.date.adddays(4); newevent.availability = ekeventavailability.free; newevent.notes = "hello"; store.saveevent(newevent, ekspan.thisevent, new intptr()); // searches every event in next year nspredicate predicate = store.predicateforevents(nsdate.now,datetime.now.adddays(360),new ekcalendar[] {calendar}); store.enumerateevents(predicate, delegate(ekevent currentevent, ref bool stop) { // perform check event type console.writel...

javascript - Why object's name modified when there is a master page in asp.net projects? -

i creating asp.net project have 1 master page pages. why object's name example div id="div1" changed ctl00_ div1 when object in master page? it ensure uniqueness of id. the master page can include content multiple sources, prepends each id ensure unique across sources. value prepended represents content section content within.

osx - How to "do shell script with administrator privileges" as a regular user and not as root? -

i'm running applscript runs shellscript through terminal. i want able use "do shell script administrator privileges" terminal runs script root, , not regular user (which admin). the reason want run not root (except obvious reasons) use ~ sign user can log in , run script locally (f.e. write log file straight user's desktop). the other reason want run not root because use visex installer during shell script not run root. this applescript use (thanks regulus6633 applescirpt): set thefile "myscriptname.sh" -- launch application admin privileges , pid of set thepid (do shell script "/applications/utilities/terminal.app/contents/macos/terminal > /dev/null 2>&1 & echo $!" administrator privileges) integer -- bundle identifier of pid can application delay 0.2 tell application "system events" set theprocess first process unix id thepid set bi bundle identifier of theprocess end tell -- runs terminal shellscript s...

tesseract - Tessnet2 for .Net - exits at the tessocr.Init call -

i have .net console app running in visual studio 10, windows vista home premium. trying tessnet2 example work. here code: ocr ocr = new ocr(); using (var bmp = new bitmap(@"c:\aaa\a-nsl\caselines\scanned documents\test_scan_04.jpg")) { var tessocr = new tessnet2.tesseract(); tessocr.init(@"c:\users\paul\documents\visual studio 2010\projects\tessnet2wpf\consoleapplication1\bin\debug", "eng", false); tessocr.getthresholdedimage(bmp, rectangle.empty).save("c:\\temp\\" + guid.newguid() + ".bmp"); // tessdata directory must in directory exe console.writeline("multithread version"); ocr.doocrmultithred(bmp, "eng"); console.writeline("normal version"); ocr.doocrnormal(bmp, "eng"); } the application exits code 1 @ tessocr.init call. i have placed 9 eng language files ...

c - Should I remove unnecessary `else` in `else if`? -

compare two: if (strstr(a, "earth")) // a1 return x; if (strstr(a, "ear")) // a2 return y; and if (strstr(a, "earth")) // b1 return x; else if (strstr(a, "ear")) // b2 return y; personally, feel else redundant , prevent cpu branch prediction. in first one, when executing a1, it's possible pre-decode a2. , in second one, not interpret b2 until b1 evaluated false. i found lot of (maybe of?) sources using latter form. though, latter form looks better understand, because it's not call return y if a =~ /ear(?!th)/ without else clause. your compiler knows both these examples mean same thing. cpu branch prediction doesn't come it. i choose first option symmetry.

python - gui design question -

i use tkinter, question general. this first time i'm designing gui. each of objects modeled class. don't understand how tie gui class hierarchy rest of class hierarchy. for example, have creatures: # before had gui in code class creature: def current_position() # returns real-time x, y coords # ... i want display them circles move around on canvas. seemed reasonable me graphical representation of movement should provided method update_display in class creature . however, means class creature has know details gui. in addition, class app(tkinter.tk) redraw method need know list of existing creature instances in order call update_display methods. that's way dependency. what's right approach? the accepted pattern called model/view/controller. have controller object both knows creatures (your "model") , gui (your "view"). controller responsible connecting two. example, view have "draw_creature" method accepts c...

java - How to bind one implementation to a few interfaces with Google Guice? -

i need bind 1 class implementation of 2 interfaces. , should binded in singleton scope. what i've done: bind(firstsettings.class). to(defaultsettings.class). in(singleton.class); bind(secondsettings.class). to(defaultsettings.class). in(singleton.class); but, obviously, leads creation of 2 different instances, because binded different keys. my question how can that? guice's wiki has a documentation use case . basically, should do: // declare provider of defaultsettings singleton bind(defaultsettings.class).in(singleton.class); // bind providers of interfaces firstsettings , secondsettings // provider of defaultsettings (which singleton defined above) bind(firstsettings.class).to(defaultsettings.class); bind(secondsettings.class).to(defaultsettings.class); there no need specify additional classes: think in terms of provider s , answer comes rather naturally.

c# - What could be causing different behaviour remotely on asp.net site -

i have site have developed in asp.net. on debugging site hosted using iis7 noticed bug, cannot reproduce when run locally in vs, meaning can't see error. bug occurs on check box changed event of devexpress check box. connects database using devart.postgres sql component , linq. however, same connection anywhere else in project. same code works elsewhere in project. error is: the requested name valid, no data of requested type found. part of code in if statement checks if textbox blank if not run code within if statement, interestingly enough if text box blank code runs, must in if statement? commented out of code , tried again , still not run. beginning lost objectivity problem, hope can help. the error have posted suggests there problem resolving address. example, when check checkbox, in code tries resolve valid address, dns server doesn't recognise it. doing involve name resolution? can share code causes error?

jsf - java.lang.IllegalArgumentException: null source -

we have application uses jsf2 , spring. application works fine when deployed. happens if went through following steps: open login page of application. redeployed application on server. tried login using opened login page, , shows following exception: javax.servlet.servletexception: null source @ javax.faces.webapp.facesservlet.service(facesservlet.java:321) @ org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:237) @ org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:167) root cause java.lang.illegalargumentexception: null source @ java.util.eventobject.<init>(eventobject.java:38) @ javax.faces.event.systemevent.<init>(systemevent.java:67) @ javax.faces.event.componentsystemevent.<init>(componentsystemevent.java:69) @ javax.faces.event.postrestorestateevent.<init>(postrestorestateevent.java:69) @ com.sun.faces.lifecycle.restoreviewphase.d...

stl - Get vector of pointers from vector in C++ -

is there easy way of creating vector of pointers elements of vector? i.e. easier below std::vector<t*> fn(std::vector<t> &v) { std::vector<t*> r; (int = 0; < v.size(); i++) { r.push_back(&v[i]); } return r; } edit: incoming vector reference as @benoit suggested, bad idea store these pointers. if really want it, can use std::transform this: template<class t> struct address { t* operator()(t& t) const { return &t; } }; template<class t> vector<t*> fn(vector<t>& v) { vector<t*> r; transform(v.begin(), v.end(), back_inserter(r), address<t>()); return r; } int main( void ) { vector<int> a; a.push_back(0); fn(a); }

scala - How to abstract from type of immutable value performing its transformations? -

i want incapsulate real type of immutable solution object in implementation of modifier can’t find way avoid downcasts. how can write listeners independent on type of solution without making them have type parameter? the following code illustrates downcasts unvoidable if listener unaware concrete type of solution. trait solution {} //immutable abstact class trait listener(val modifier: modifier) { def onchange(isolution: solution): solution } trait modifier { //implementations use different descendants of solution def addlistener(listener: listener) def emptysolution: solution def transfrom1(isolution: solution): solution //downcast of argument can’t avoided in implementations of these def transfrom2(isolution: solution): solution } class listener1 extends listener { //should independent solution concrete type. current implentation meets requirement introducing downcasts in modifier. val modifier: modifier def onchange(isolution: solution) = mo...

cursor - How to Delete phone number from contact in android? -

i want delete (e.g. mobile number) android database. passing query follow public class contactdemo extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); string number = "2222"; long id = getid(number); int = getcontentresolver().delete(rawcontacts.content_uri, rawcontacts._id+"=?", new string[]{id.tostring()}); system.out.println("deleted"+i); } public long getid(string number){ uri uri = uri.withappendedpath(phonelookup.content_filter_uri, uri.encode(number)); cursor c = getcontentresolver().query(uri, new string[]{phonelookup._id}, null, null, null); while(c.movetonext()){ return c.getlong(c.getcolumnindex(phonelookup._id)); } return null; } } but deleting entire contact. what ...

heap - Choose Mysql engine for processing a big "type-value" table -

my task delete entities not affected during operation database. created separate table have 2 columns, first represets name of table , second id of record in table. create table edited_entities ( table varchar(50) not null, id bigint(20) not null) for example if have table create table puppy( id bigint(20) not null, name varchar(20) not null) and record in it id | name 1 | rex if edit record put following data edited_entities: table | id puppy | 1 then need delete non affected entities (which ids not in edited_entities table) , following: delete puppy id not in (select ee.id edited_entities ee ee.table= 'puppy'); i wonder best engine such kind of operation (mysql)? default db engine innodb. thought memory (heap) not sure if can faster delete operation. if have suggestion how can optimise required operation glad here it. i don't whant add additional columns puppy table. memory will faster, since do...

devexpress - Design and Modelling for DexExpress eXpressApp Framework -

the devexpress xaf basis work you, creates database based on business objects, , dynamically generates ui based on these, basic functions add, delete, sort etc. present. this leaves me wondering how go designing , modelling application built on framework. model business objects, or identify functions provided framework , include them in details model down sequence diagram level, being done 'external' calls feel wasting valuable time. i hoping experience modelling application designs specific framework can give me advice on areas should focus on. @profk: correct looking visual designer business models? if so, afraid xpo (xaf) not provide such functionality. however, can use free third-party tools modeling , such liekhus ado.net entity data model xaf extensions hope find information helpful.

iphone - Simulate a 'Home Button' click -

after reading there no proper way exit iphone app , there way programmatically send home button click on device, minimise app? "apple developers don't this." acceptable answer :) thanks "apple developers don't this." :-) @ least when aiming appstore.

sql - instead of trigger and text ntext datatype -

possible duplicate: how manipulate text, ntext data sql server trigger how can manipulate text , ntext data type of instead of trigger. can give me sample. thanks you should in msdn issue. using text, ntext, , image data in instead of triggers

java - how to extract this using regex -

i need extract this example: www.google.com maps.google.com maps.maps.google.com i need extraact google.com this. how can in java? split on . , pick last 2 bits. string s = "maps.google.com"; string[] arr = s.split("\\."); //should check size of arr here system.out.println(arr[arr.length-2] + '.' + arr[arr.length-1]);

matching this html element in regex? (without lazy matching!) -

i'd match between tags. what's regex that? a bit <tr[^>]*>.*?</tr> but i'd not use lazy evaluation. i want match each pair regex above, not using lazy evaluation. instead of matching lazily, use negative lookahead (if flavour supports that). example translate to <tr[^>]*>((?!</tr>).)*</tr> of course, should not use regex parse html, might have guessed comments question. =) these expressions may fail horribly on nested tags, comments, , javascript.

ios - calculations in objective-c not returning the correct value -

please check out piece of code, more hourstep calculations. int h = [[timearray objectatindex:0] intvalue]; int m = [[timearray objectatindex:1] intvalue]; int s = [[timearray objectatindex:2] intvalue]; int mm = [[timearray objectatindex:3] intvalue]; nslog([nsstring stringwithformat:@"time h:%d, m:%d, s:%d, mm:%d", h, m, s, mm]); //time h:13, m:7, s:55, mm:105 float hourstep1 = m / 60; float hourstep2 = h + hourstep1; float hourstep3 = hourstep2 / 24; float hourstep4 = hourstep3 * 15; int hour1 = ceil(hourstep4); nslog([nsstring stringwithformat:@"hourstep1: %f, hourstep2: %f, hourstep3: %f, hourstep4: %f result: %d", hourstep1, hourstep2, hourstep3, hourstep4, hour1]); //hourstep1: 0.000000, hourstep2: 13.000000, hourstep3: 0.541667, hourstep4: 8.125000 result: 9 float hourstep5 = ((h + (m / 60)) / 24) * 15; nslog([nsstring stringwithformat:@"hourstep5: %f", hourstep5]); //hourstep5: 0.000000 i have broken down calculation various steps c...

How to keep a Servlet session? -

i have written simple servlet want test old session kept when refresh browser. doesn't instead creating new session every time refresh page. isn't supposed create new session when close browser? i'm using servletrunner instead of running on tomcat, can problem? import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class sessionplay extends httpservlet { public void doget (httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { resp.setcontenttype("text/html"); //get session object httpsession session = req.getsession(true); string id = session.getid(); printwriter out; string title = "session play"; // write data of response out = resp.getwriter(); out.println("<html><head><title>"); out.println(title); out.println(id); out.println("</title></head><bod...

.net 4.0 - vb.net Add Watch stop when value changes -

i know in older versions of visual studio, there "add watch" option can choose stop execution when value of field changed. using vs 2010, , can't figure out how hit breakpoint when value of field changes. any ideas? data breakpoints remember, description matches. used processor feature, requires address of variable , size, processor automatically generates trap when detects write memory address. nice debugging tool. sadly no longer available in managed code, garbage collector messes because moves objects around while compacting heap. changes address. interface between garbage collector , debugger isn't strong enough allow debugger track these moves while compacting taking place @ runtime. no doubt avoid serious amount of overhead. the next best thing got property setter. can set breakpoint on it.

php - posting hidden value -

hey there, have 3 pages: (1) bookingfacilities.php (2) booking_now.php (3) successfulbooking.php , link together. i want pass data bookingfacilities.php successfulbooking.php using hidden field/value. however, data doesn't print out in successfulbooking.php. here codes: from 'booking_now.php': $date="$day-$month-$year"; from 'successfulbooking.php'; <input type="hidden" name="date" id="hiddenfield" value="<?php print "$date" ?>"/> i appreciate project due tomorrow :( you should never assume register_global_variables turned on. if is, it's deprecated , should never use way. refer directly $_post or $_get variables. form posting, you'd want code along lines of this: <input type="hidden" name="date" id="hiddenfield" value="<?php echo $_post['date'] ?>" /> if doesn't work right away, print out $_...

sql - Multiple joins to same table -

i have set of tables , data create table item ( id int primary key, name varchar ); create table property ( id int primary key, name varchar ); create table value ( id int primary key, value varchar ); create table item_value ( item int not null references item(id), property int not null references property(id), value int not null references value(id) ); insert item (id, name) values (1, 'item1'), (2, 'item2'); insert property (id, name) values (1, 'prop1'), (2, 'prop2'); insert value (id, value) values (1, 'val1'), (2, 'val2'); insert item_value (item, property, value) values (1, 1, 1), (2,2,2 ); i want result set: name value_1 value_2 --------------------------- item1 val1 <null> item2 <null> val2 and use query: select i.name name, v1.value value_1, v2.value value_2 item left join item_value iv on iv.item = i.i...

database - Rollback a certain amount of transactions during deveopment? -

are there tools around monitor db transactions transparently , allow batch rollback? similar dbunit offers not in context of unit test longer period of time (say test lasts 5-10 minutes, done in ui , not in automated test) like: developer integrates new feature , tests interactively. 10 minutes, data messed , wants go safe state of database. backups / snapshots not suitable here database pretty large , going backup / snapshot time consuming. more lightweight preferred. btw, windows sql server 2008 standard used, cannot use snapshots @ all. technology stack application java / jpa / hibernate. thanks! i don't know of available achieve describe. have manage own transactions on connection database. you start transaction @ beginning of tests , roll @ end has side effect of locking tables preventing others using db. you might want @ using sqlite database, loaded test data, use "throw away". it's fast , great testing.

Zend framework deployment on the shared hosting -

i want deploy project made in zend framework shared hosting. project has such structure: application docs library obsolete public scripts tests this have done: i copied zend folder (all library files) library folder i copied structure above public_html/projects/project (so if type www.mydomain.com/projects/project/public run project i tried click on link redirected me www.mydomain.com/projects/project/public/somecontroller/someaction unfortunately see white, empty page. locally (using zend server ce) worked here looks zend doesn't recognize should url , redirecto appropriate action. what have missed? greetings! the reason see empty page instead of errors error_reporting off default on production server. you may change settings concerting displaying errors , exceptions in application.ini . the other cases errors not displayed goes wrong in view (eg. view helpers), must return string, not exception. things check: paths include_path permissions...

java - How can I move the first word to the end? -

enter line of text. no punctuation please. java language have rephrased line read: is language java this example, , know char method, don't know how move first word end. string method can use? what do: split sentence using string.split(); create list items reorder list join list items using space implementation in plain java: final string s = "java language"; final list<string> list = new arraylist<string>(arrays.aslist(s.split("\\s+"))); list.add(list.size() - 1, list.remove(0)); final stringbuilder sb = new stringbuilder(); for(final string word : list){ if(sb.length() > 0){ sb.append(' '); } sb.append(word); } system.out.println(sb.tostring()); implementation using guava : final string s = "java language"; final list<string> list = lists.newarraylist(splitter .on(charmatcher.whitespace) .omitemptystrings() .split(s)); list.add(...

Java's Math.Pow() function returning confusing results -

i working math.pow() function, , have following code: double monthlyrate = (0.7d / 12); int loanlength = 3; double powertest = math.pow(1.00583, 36); double powerresult = math.pow((1 + monthlyrate),(loanlength * 12)); when run through debugger, values become powertest => 1.2327785029794363 powerresult => 7.698552870922063 the first correct one. i've stepped math.pow function on both of assignment lines. powertest, parameters math.pow double => 1.00583 double b => 36.0 for powerresult, double => 1.0058333333333333 double b => 36.0 i know issue way floating point math performed machine, i'm not sure how correct it. tried doing following before calculation poor results: monthlyrate = math.round(monthlyrate * 1000) / 1000; 1 + monthlyrate 1.0583... , not 1.00583 .

air - How to develop Augmented Reality application for Android -

i develop augmented reality application on htc nexus 1 mobile phone android using flash professional cs5 , adobe air 2.5. i found couple of online sources showing how develop ar application using webcam , flash , have found useful follow , understand basics of ar. for example: augmented reality using webcam , flash http://www.adobe.com/devnet/flash/articles/augmented_reality.html introduction augmented reality http://www.gotoandlearn.com/play.php?id=105 i have watched other videos regarding air android applications gotoandlearn website , did of such as: air android – part 1 air android – part 2 publishing air android applications air android gpu acceleration introduction augmented reality however, didn't manage work on android phone (doing nothing , run slow). i ask few questions on following: 1) develop augmented reality application on android, done using same method one's above? 2) need use other software other showing on video , adobe air 2.5...

ruby on rails - Carrierwave; multiple uploaders or just one? -

i have post model , podcast model. both models have attribute titled: image . i'm using 1 carrierwave uploader (named imageuploader) handle both models. have 2 questions before go production. dumb question : is ok use same uploader 2 different models when both have same attribute name file attachements? sorry if seems obvious main question : i want create 3 versions of each blog post image (thumb, large, sepia) , 1 version of each podcast image (thumb). do need use 2 uploaders or can namespace 1 i'm using? again seems obvious. i have written second uploader in time taken me ask these questions you can use same uploader on different models if have different attribute names. e.g. class post mount_uploader :image, imageuploader end class podcast mount_uploader :photo, imageuploader end whether or not you'd want different matter. in case, i'd create different uploaders each model, because have different requirements. can use subclasse...

apache - ssl svn user login problem -

i've subversion server, on apache (on windowsxp), accessible on net using http. wanted use ssl/https access it. haven't messed around forcing http -> https yet, , can login using http:// fine. however, if use https://, login fails, , "authentication required!" 401 error message. i guess it's configuration issue on server(?), haven't found solution yet. any ideas? you have basic http setup, have configure ssl certificates / authorization secure http. see following setup: http://svnbook.red-bean.com/en/1.0/ch06s04.html http://ubuntuforums.org/showthread.php?t=51753 http://wiki.freaks-unidos.net/apache2%20ssl%20and%20subversion%20in%20debian

sql server - How to get count and value using one t-sql statement? -

here trying get:- select column1, count(column1), count(column2) table1 i know query invalid. there way can values of column1 , count of column1 , count of column2. the on clause modifies aggregate range allow query happen want select column1, count(column1) on (), count(column2) on () table1 edit: above sql server 2005+ edit 2: the cross join/count solution in sql server 2000 not reliable under load. try multiple connections, note @@rowcount never equals t2.cnt in connection 2 --connection 1 set nocount on; drop table dbo.test_table; go create table dbo.test_table ( id_field uniqueidentifier not null default(newid()), filler char(2000) not null default('a') ); go create unique clustered index idx_id_fld on dbo.test_table(id_field); go while 1 = 1 insert dbo.test_table default values; --connection 2 select t2.cnt, t1.id_field, t1.filler dbo.test_table t1 cross join (select count(*) cnt dbo.test_table) t2 select @@rowco...

How do I re-trigger a WebKit CSS animation via JavaScript? -

so, i've got -webkit-animation rule: @-webkit-keyframes shake { 0% { left: 0; } 25% { left: 12px; } 50% { left: 0; } 75% { left: -12px; } 100% { left:0; } } and css defining of animation rules on box : #box{ -webkit-animation-duration: .02s; -webkit-animation-iteration-count: 10; -webkit-animation-timing-function: linear; } i can shake #box this: document.getelementbyid("box").style.webkitanimationname = "shake"; but can't shake again later. this shakes box once: someelem.onclick = function(){ document.getelementbyid("box").style.webkitanimationname = "shake"; } how can re-trigger css animation via javascript without using timeouts or multiple animations? i found answer based on source code , examples @ css3 transition tests github page . basically, css animations have animationend event fired when animation...

c# - Where would the responsibility to handle this event be placed? -

i have navigationbar.cs user control. have navigationitem.cs user control. here's code both: using system; using system.collections.generic; using system.componentmodel; using system.drawing; using system.data; using system.linq; using system.text; using system.windows.forms; namespace uboldi.customui { public partial class navigationbar : usercontrol { public navigationbar() { initializecomponent(); } public list<navigationitem> navigationitems { private get; set; } public navigationitem selecteditem { get; set; } } } using system; using system.collections.generic; using system.componentmodel; using system.drawing; using system.data; using system.linq; using system.text; using system.windows.forms; namespace uboldi.customui { public partial class navigationitem : usercontrol { public navigationitem() { initializecomponent(); } private image _pictu...

asp.net 2.0 - How to download html using WebClient residing on the own server? -

how make webclient connect , download htm page. know confusing let me retierate: i have written code using webclient download htm string of http://www.someserver.com/invoice.aspx . webclient code resides in invoice.aspx page , hence giving me error "a connection attempt failed because connected party did not respond after period of time". not sure how way around can download htm page page itself. i indebted forever can not use querystring parameter in webclient method call? check querystring parameter , if not exist render page , ignore webclient call.

android - What is wrong with my Text-To-Speech in my CountDownTimer? -

hey all, i'm trying put text-to-speech in countdowntimer. "there x seconds left" after amount of time. started using texttospeech , i'm not sure i'm doing.. package com.android.countdown; import java.util.locale; import android.app.activity; import android.os.bundle; import android.os.countdowntimer; import android.view.view; import android.speech.tts.texttospeech; import android.widget.button; import android.widget.textview; import android.view.view.onclicklistener; public class countdown extends activity implements texttospeech.oninitlistener{ countdowntimer counter1; countdowntimer counter2; countdowntimer counter3; int interval = 1; texttospeech tts; public string formattime(long millis) { string output = "0:00"; long seconds = millis / 1000; long minutes = seconds / 60; seconds = seconds % 60; minutes = minutes % 60; string secondsd = string.valueof(seconds); ...

sql server - How to make grid results show "<" rather than "&lt;"? -

this code: somefield + ' <' + cast(count(anotherfield) varchar(6)) + '>' generates following result in grid view: blah &lt;blah2&gt; how can ensure html entities show character equivalents? i'm surprised wasn't able find google answer. thanks. here's larger snippet: select stuff(( select ', ' + somefield + ' <' + cast(count(anotherfield) varchar(6)) + '>' sometable someabbrev somefield = someoutsidefield group somefield order somefield asc xml path('') ),1,1,'') somefields blablabla inner join blablabla left join blablabla left join blablabla order somedatefield asc you can @ technique used here or may simpler bypass xml technique , try example below. this example returns tables columns comma delimited string. create function dbo.columnstring(@table_id int) returns n...

Installing MySQL on Snow Leopard using MacPorts -

i trying install mysql5 on snow leopard, having trouble. here terminal log: users-macbook-pro:~ sam$ sudo port install mysql5password: ---> computing dependencies mysql5 ---> fetching mysql5 ---> verifying checksum(s) mysql5 ---> extracting mysql5 ---> applying patches mysql5 ---> configuring mysql5 ---> building mysql5 ---> staging mysql5 destroot ---> installing mysql5 @5.1.53_0 mysql client has been installed. if want mysql server, install mysql5-server port. ---> activating mysql5 @5.1.53_0 ---> cleaning mysql5 users-macbook-pro:~ sam$ sudo port install mysql5-server password: ---> computing dependencies mysql5-server ---> fetching mysql5-server ---> verifying checksum(s) mysql5-server ---> extracting mysql5-server ---> configuring mysql5-server ---> building mysql5-server ---> staging mysql5-server destroot ---> creating launchd control script #########################################################...

php - Ajax form jQuerymobile not loading content -

the send button sending info mail, page doesn't load content on .php . <div data-role="content"> <form method="post" action="sendcontactomovil.php"> <fieldset> <div data-role="fieldcontain"> <label for="nombreyapellido">nombre y apellido:</label> <input type="text" name="nombreyapellidom"><br/> </div> <div data-role="fieldcontain"> <label for="mail">correo electronico:</label> <input type="text" name="mailm"> </div> <div data-role="fieldcontain"> <label for="telefono">telefono:</label> <input type="text" name="telefonom"> </div> <div data-role="fieldcontain"> <label for="consulta" style="vertical-align:top">consulta:</labe...

c# - The problem is about sending email in ASP.NET -

protected void sendemail(object sender, eventargs e) { smtpclient smtpclient = new smtpclient(); mailmessage message = new mailmessage(); try { mailaddress fromaddress = new mailaddress("fromemail", "from me"); mailaddress toaddress = new mailaddress("toemail", "to you"); message.from = fromaddress; message.to.add(toaddress); message.subject = "testing!"; message.body = "this body of sample message"; smtpclient.host = "smtp.host.com"; smtpclient.credentials = new system.net.networkcredential("username", "password"); smtpclient.enablessl = true; smtpclient.port = 587; smtpclient.send(message); statuslabel.text = "email sent."; } catch (exception ex) { statuslabel.text = ...

PHP / MySQL - Create array of distinct values, query db table for data associated with those values, and loop for each -

i'm not of php programmer, hope can me this. i'm trying distinct values competitor column, create array of them, retrieve share1-share12 values each of distinct values based on number of variables, , output competitors , share1-12 values. below format of data table along mess of code i've been cobbling together: state|bigcat|competitor|metric|share1|share2|share3|share4|share5|share6|share7|share8|share9|share10|share11|share12 <?php $product = $_get['product']; $cat = $_get['cat']; $state = $_get['state']; $metric = $_get['metric']; $table = $product ."_specs_states"; $q = " select distinct(competitor) competitor $table"; $result = $dbc->query($q) or die("unable execute query<br />" . $dbc->errno . "<br />" . $dbc->error); $r = $result->fetch_array(); $competitors = array(); {...

asp.net mvc - Turn menu options on/off from Masterpage depending on user privs -

i have been trying find way access master page control in order show/hide menu option. in mp, have: <div id="menucontainer"> &nbsp; <ul id="menu"> <li id="menuhome"><%= html.actionlink("home", "index", "home")%></li> <li id="menunewhire"><%= html.actionlink("new hire", "index", "newhire")%></li> <li><%= html.actionlink("software", "index", "software")%></li> <li><%= html.actionlink("hardware", "index", "hardware")%></li> <li><%= html.actionlink("telecom", "index", "telecom")%></li> <li><%= html.actionlink("about", "about", ...

testing - What would be a good Android tablet to buy to test code? -

i’m producing android app customer. not have android device. have suggestions on android device should test code on real device? could cheap one? i bought tablet development testing , has been invaluable, recommend others it. in theory android devices pretty same, isn't true in reality. android developers better if have more 1 device test on - it's dangerous assume "it works on phone, it'll work ok on other devices" - no. i think have 3 options: buy cheap tablet. may not approved google, may missing stuff, e.g. geolocation apis, gmail, market etc. may not have gps, won't have 3g. makes bad tablet, great testing. bought cheap 1 , it's made clear how android apps blow if they've not been tested on device that's v different phone. i'm amazed how many apps don't use exception handling round gps lookup, app fails (including tweetdeck). buy motorola xoom. it's first google-approved tablet, , first honeycomb tablet. looks ...

excel formula using a variable with a range of values -

so have formula single variable = 1-h/145442 value h needs analyzed values of 0 36000 , display answer. how do in excel p.s. not excel please clear thanks, josh since these basic functions of spreadsheets works every spreadsheet program, know of openoffice/libreoffice calc , of excel, , of course lotus 1-2-3, mother of spreadsheets. in a1 type 0, in a2 1. select a1. in name field combo, type in a1..a36001 <enter> (to select range). menu edit / fill / series. should have filled selected range values 0 36000. in b1 enter =1-a1/145442 <enter>. in name field combo, enter b1..b36001 select range. press <ctrl+u> fill range formula. excel increment row number , treat column letter static (b2: =1-a2/145442, b3: =1-a3/145442, ...). this should it. if not work, need instruction software (version) or got wrong let me know.

Best practice for asynchronous c api design -

i'm design c api functionality , make asynchronous exposed functionality may take time. using blocking api not idea user of api need make many simultaneous calls. what right way design interface can notify user asynchronous operation has completed? i can think of several different approaches, can't aware of best practices this. have experiences similar api:s? in example, intention return int containing answer. callback function: typedef void (*callback_function)(int, void *); /* calls callback function answer , cookie when done */ error_code dosomething(callback_function, void *cookie); polling: error_code dosomething(void *cookie); /* blocks until call has completed, returns answer , cookie */ error_code waitforsomething(int *answer, void **cookie); platform specific event queue /* windows version, api calls postqueuedcompletionstatus when done */ error_code dosomething( handle hiocompletionport, ulong_ptr dwcompletionkey, ...

java - how to "toString()" GWT EntityProxy derivatives for logging and debugging? -

gwt 2.1.1 has framework - requestfactory entityproxy , stuff. i looking way serialize runtime instances implement entityproxy debugging , logging etc. not care format long human readable. more specific have provided apache commons lang reflectiontostringbuilder may there way use json serialization mechanics gwt has inside? if yes how make bit more readable? import org.apache.commons.lang.builder.reflectiontostringbuilder; string stringrep = reflectiontostringbuilder.tostring(this); there @ least 2 solutions: first: based on idea thomas broyer public static string tostring(entityproxy entityproxy) { defaultproxystore store = new defaultproxystore(); swap.requestfactory.getserializer(store).serialize(entityproxy); return store.encode(); } which produce this: {"v":"211","p":{"1@2@biz.daich.swap.shared.dto.useraccountproxy":{"o":"persist","r":"2","y":1,"t...

The install log for a WIX-based installer indicates the installation process occurs twice, making custom actions occur at unexpected times -

i have wix installers 2 c# custom actions (cas) first default settings, , save settings provided during installation. the load custom action runs after="costfinalize" the save custom action runs after="installfiles"... check out log file, though... you'll see phases inexplicably occur twice in particular installation run, first time failing perform tasks occur during phases (such during installfiles, no files installed until second occurrence of installfiles phase in single install). this problem, because save function must operate on app.config file deployed install folder, after first ocurrence of installfiles, file has not yet moved expected location, causing load of fail during save custom action.... looking further through installation, you'll see phases repeat, time deploying files during installfiles, custom action no longer runs @ point, ran after first instance... what happening here? log file === logging started: 1/25/2011 16...