Posts

Showing posts from May, 2013

javascript - Can I override onbeforeunload for a particular element? -

i have page quite bit of work , don't want user able navigate away page (close browser, hit button, etc.) without getting warning. found onbeforeunload event (which think ie-specific, works fine me project uses lots of activex) works great. problem is, want user able click on little "help" icon in upper-right corner , pop window @ time. causes onbeforeunload fire, though main window never goes anywhere , page never unloads. the javascript function runs when onbeforeunload event runs puts text event.returnvalue. if ascertain, somehow, icon 1 clicked not put text event.returnvalue in situation. how have page figure out? let me guess: "icon" link javascript: url? change real button, real link, or @ least put functionality in onclick event handler (that prevents default behavior). problem solved. <!-- clicking link nothing. no onbeforeunload handler triggered. nothing. , put in before return false bit... ...and onunload handler still not cal...

linux - Using C++ classes in .so libraries -

i'm trying write small class library c++ course. i wondering if possible define set of classes in shared object , using them directly in main program demos library. there tricks involved? remember reading long ago (before started programming) c++ classes worked mfc .dlls , not plain ones, that's windows side. c++ classes work fine in .so shared libraries (they work in non-mfc dlls on windows, that's not question). it's easier windows, because don't have explicitly export symbols libraries. this document answer of questions: http://people.redhat.com/drepper/dsohowto.pdf the main things remember use -fpic option when compiling, , -shared option when linking. can find plenty of examples on net.

oop - Destructor or Deconstructor? -

in daily life , while reading books i've seen term destructor deconstructor. but correct name method? it destructor used cleanup stuff when object die. called automatically if specified when object going removed/die. more info: http://en.wikipedia.org/wiki/destructor_%28computer_science%29

What is the preferred operating system for web programmers, client or server? -

which os prefer program on? client or server there school of though if doing (mostly) web programming (or other server based code), should use server os dev machine, since that's closer environment app running. update: should add, directed windows crowd ok, know you're talking windows but... i used develop on windows deployment on *nix servers. sure there lots of gotchas way of working, kind of used it. in october 2005 switched linux, experiment, never went back. there steep learning curve. thought knew *nix pretty after 10 years of dealing it, knew nothing compared amount learned using on desktop machine. workflow has been smoother developing , deploying similar platforms. more recently, have started pick servers running ubuntu server, closely match our ubuntu desktop development machines. if talking difference between desktop , server edition, i'd guess needn't worry it. if you're developing on 1 os deployment on another, i'd consid...

java - Creating user info bean in JBoss -

i'm little bit stuck in problem right now: i've got jboss portal runs on jboss 4.2.3 . there running webapps on machine provide portlets users. need centralized solution: every time user logs in want create session bean user information hold. i'm using spring in webapps - information. how can achieve this? session bean must created asap when login occurs - can catch safely spring apps. several thoughts: is there possibility recognize login via listener? should use filter , check if request.getremoteuser() isn't null? maybe smth <bean id="userinfo" class="com.s.userinfo" scope="session"/> in application-context? 'session' can changed 'conversation', maybe.

xcodebuild - xcode: calculate expression when Debug -

can xcode calculate value of expression while debugging? i mean ms visual studio, there "watch" window, debugger can input expressions composed local variables, , vs calculate value. can similar thing done in xcode? how? use run/show/expressions window. can use print (or p ) command in console window (the 1 (gdb) prompt).

php - How do I HTML Encode all the output in a web application? -

i want prevent xss attacks in web application. found html encoding output can prevent xss attacks. problem how html encode every single output in application? there way automate this? i appreciate answers jsp, asp.net , php. you don't want encode html, want html-encode user input you're outputting. for php: htmlentities , htmlspecialchars

c# - How do you declare a Predicate Delegate inline? -

i'm using c#. so have object has fields, doesn't matter what. have generic list of these objects. list<myobject> myobjects = new list<myobject>(); myobjects.add(myobject1); myobjects.add(myobject2); myobjects.add(myobject3); so want remove objects list based on criteria. instance, myobject.x >= 10. use removeall(predicate<t> match) method this. i know can define delegate can passed removeall, know how define inline anonymous delegate, instead of creating bunch of delegate functions used in once place. there's 2 options, explicit delegate or delegate disguised lamba construct: explicit delegate myobjects.removeall(delegate (myobject m) { return m.x >= 10; }); lambda myobjects.removeall(m => m.x >= 10); addition: performance wise both equal. matter of fact, both language constructs generate same il when compiled. because c# 3.0 extension on c# 2.0, compiles c# 2.0 constructs :)

timer - Android ViewFlipper showPrevious after 300ms -

hey. started android. i'm using viewflipper layout 2 linearlayouts. first layout has button switches second layout. add timer switch first layout after 3000ms. tried thread did not work (can not communicate ui element of other thread). my code: public class test extends activity { viewflipper f; linearlayout l1; linearlayout l2; button b1; thread s; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); f = (viewflipper) findviewbyid(r.id.f); l1 = (linearlayout) findviewbyid(r.id.l1); l2 = (linearlayout) findviewbyid(r.id.l2); b1 = (button) findviewbyid(r.id.b1); updateswitch = new thread() { @override public void run() { try {sleep(3000); } catch (interruptedexception e) { } {f.showprevious();} } }; b1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view ...

vb.net - Easiest way to add a Header and Footer to a Printing.PrintDocument (.Net 2.0)? -

what's easiest way add header , footer .net printdocument object, either pragmatically or @ design-time? specifically i'm trying print 3rd party grid control (infragistics gridex v4.3), takes printdocument object , draws it. the resulting page contains grid , it's contents - add header or title identify printed report, , possibly footer show printed it, when, , ideally page number , total pages. i'm using vb.net 2.0. thanks help! the printdocument object fires printpage event each page printed. can draw text/lines/etc print queue using printpageeventargs event parameter: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx dim withevents when pass grid, can handle event.

javascript - info window custom close button -

i have instance of google.maps.infowindow, , has custom closing button. triggered onclick event. however, if click on close button, info window closed, expected, new marker appears on map, on place info window use be. looks onclick="infowindow.close()" placereclamemarker(event.latlng); simultaneously. var map; var infowindow; function initialize() { var latlng = new google.maps.latlng(47.030698, 28.850098); var myoptions = { zoom: 15, center: latlng, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map( document.getelementbyid("map_canvas"), myoptions); google.maps.event.addlistener(map, 'click', function (event) { placereclamemarker(event.latlng); }); } function placereclamemarker(location) { var marker = new google.maps.marker({ position: location, draggable: true, ...

php - Wildcard Subdomain Exceptions -

i have wildcard subdomain enabled , dynamically parse url passing as-is index.php (ex. somecity.domain.com ). now, wish create few subdomains static can install different application , not co-mingle current 1 (ex. blog.domain.com ). my .htaccess reads: rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] can manipulate .htaccess achieve need? can done through apache? your .htaccess nothing useful, apache configured directoryindex index.php. well, move domain.com/a domain.com/index.php, doubt want. your wildcard virtualhost works because have serveralias *.domain.com in configuration, or single virtualhost , dns pointing address of server. (when have single virtualhost, shows request, , first listed virtualhost default one) you have create new virtualhosts static domains, leaving default 1 as, well, default 1 :) check these tutorials explain all.

calendar - Synchronisation algorithms -

are there references synchronisation algorithms? i'm interested in algorithms synchronize following kinds of data between multiple users: calendars documents lists , outlines i'm not looking synchronization of contents of directories a la rsync ; interested in merging data within individual files. syncml standard data synchronization of things associated someone's personal organizer. nokia , motorola both using heavily few years ago, don't know current state. icalendar calendar synchronization format specification, , caldav implementation of icalendar atop webdav protocol. google searches ical or icalendar turn ical application supplied apple part of mac os x. keep looking down list of results until see looks protocol.

how to get selected date on DateField Adobe Flex Datagrid ItemRenderer -

i trying selected date on datagrid. used itemrenderer display datefield on datagrid. <mxatagridcolumn datafield="dt" headertext="date of transaction" itemrenderer="mx.controls.datefield" rendereriseditor="true" editordatafield="selecteddate"/> thanks! calling renderers wrong way round, have renderer bubble event out selecteddate , id of data item rendering. handle event outside of renderer.

HTTPS with Visual Studio's built-in ASP.NET Development Server -

Image
is there way access visual studio's built-in asp.net development server on https? as of can use iis express develope , test in ssl. here complete article explaning how use iis express , visual studion 2010 develope websites in ssl next then this working ssl @ development time easier iisexpress introducing iis express

advertising - Difference between Ad company statistics, Google Analytics and Awstats on adult sites -

i have problem. have web page adult content , several past months had ppc advertisement on it. , i've noticed big difference between ad company statistics of page, google analytics data , awstats data on server. for example, ad company tells me, have 10k pageviews per day, google analytics tells me, have 15k pageviews , on awstats it's around 13k pageviews. system should trust? should write own (and reinvent wheel again)? if so, how? :) the joke is, have web page, "normal" content (mmorpg fan site) , numbers +- equal in 3 systems (ad company, ga, awstats). think it's because it's not adult oriented page? and final question, totally offtopic, know ad company pays per impression , don't mind adult sites? thanks answers! first, should make sure not mix »hits«, »files«, »visits« , »unique visits«. have different meaning , called differently. recommend definitions if confused terms. awstats has correct statistics, because has access acces...

Java Swing - Multiple column headers in a JTable? -

Image
is there way create multiple column headers in jtable ? mean, there 1 row, need 2 of them same format (headerlike), , combine cells of 1 of headers. i need this: header0 | header123 | header4 header0 | header1 | header2 | header3 | header4 is there way? nick meyer kindly reply, while content in address little out of date. run jre 1.7 , didn't works expected can altered work correct. alter made follow /* * add these code in groupabletableheader */ public void updateui(){ // setui(this.getui()); tablecellrenderer renderer = getdefaultrenderer(); if (renderer instanceof component) { swingutilities.updatecomponenttreeui((component)renderer); } } /* * add these code in groupabletableheaderui in 2 places, must know */ if (renderer == null) { renderer = header.getdefaultrenderer(); } /* * change getsize method in columngroup */ public dimension getsize(jtable table) { component c...

winapi - Overlapped I/O on anonymous pipe -

is possible use overlapped i/o anonymous pipe? createpipe() not have way of specifying file_flag_overlapped, assume readfile() block, if supply overlapped-structure. no. explained here , anonymous pipes not support asynchronous i/o. need use named pipe. there's example code on msdn here , here .

Triangular c++ edge calculation -

i have been working on source code, nothing seems go right. revised source code extremely appreciated, or @ least visual solution errors. here following problem: write program reads 3 edges triangle , determines whether input valid. input valid if sum of 2 edges greater third edge. here sample runs of program: enter 3 edges 1, 2.5, 1 [enter] can edges 1, 2.5, , 1 form triangle? false here have far source code": #include <iostream> using namespace std; bool valid (int tri_a, int tri_b, int tri_c); bool triangle; int main () { int a; int b; int c; cout << "enter 3 edges: "; double edge1, edge2, edge3; cin >> edge1 >> edge2 >> edge3; bool isvalid = (edge1 + edge2 > edge3) && (edge1 + edge3 > edge2) && (edge3 + edge2 > edge1); cout << " enter 1st value: "; cin >> a; cout << " enter 2nd value: "; cin >> b; cout << " enter 3rd value: "; cin >...

How can I open a cmd window in a specific location? -

how can open cmd window in specific location without having navigate way directory want? you may want @ this "powertoy" microsoft : open command window here this powertoy adds "open command window here" context menu option on file system folders, giving quick way open command window (cmd.exe) pointing @ selected folder.

.net - Can I use System.Core.dll/System.Collections.Generic.HashSet in powershell? -

i'd use hashset in powershell script. think i've figured out how instantiate generic collection objects doing: [type] $strtype = "string" $listclass = [system.collections.generic.list``1] $listobject = $base.makegenerictype(@($t)) $mylist = new-object $setobject this works fine lists , dictionaries, when try create hashset get: unable find type [system.collections.generic.hashset`1]: make sure assembly containing type loaded. so looks need load system.core.dll can't seem powershell load assembly. example calling [system.reflection.assembly]::loadwithpartialname("system.core") causes exception: "loadwithpartialname" "1" argument(s): "could not load file or assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089' or 1 of dependencies. system cannot find file specified." any pointers? powershell 2.0 makes easier 1) adding add-type cmdlet loading assembly , 2) up...

c# - How can I access the backing variable of an auto-implemented property? -

in past declared properties this: public class myclass { private int _age; public int age { get{ return _age; } set{ _age = value; } } } now can do: public class myclass { public int age {get; set;} } my question is, how can access private variable created automatically using notation? i rather access private variable , not public accessor 'age'. there default notation access private variable, or not possible? the aim of new automatic properties reduce amount of boilerplate code need write when have simple property doesn't need special logic in or set. if want access private member these properties use, that's few reasons: you need more simple get/set - in case, should avoid using automatic properties member. you want avoid performance hit of going through or set , use member directly - in case, i'd surprised if there performance hit. simple get/set members very easy inline, , in (admittedly li...

Threshold for showing View in Android -

i have ui layout that's comprised of single outer layout contains 3 internal layouts. internal layouts header, body , footer. i cause top, header view become hidden if it's forced shrink past threshold. contains logo image, , if shrinks past point, i'd rather hide completely. what's best way this? there way accomplish statically in layout xml? if not, need subclass view , listen resizes? there way? subclass view override onlayout or onmeasure methods. when view decides width , height. after onmeasure completed, can call this.getmeasuredheight() , check if below threshold. if is, hide it.

Create a table with table keys in Lua with the C API -

in lua, can create table keys tables: t = {} t[{1,2}] = 2 i know how analogous thing using c api. is, writing c function callable lua, return table table keys. tried push table key , use lua_settable, seems nothing. edit: relevant code: lua_createtable(l, 0, n); for(i = 0; < n; ++i){ // push key table lua_createtable(l, 2, 0); for(j = 0; j < 2; ++j){ lua_pushinteger(l, j+1); lua_pushinteger(l, j); lua_settable(l, -3); } // push value table lua_createtable(l, 4, 0); for(j = 0; j < 4; ++j){ lua_pushinteger(l, j+1); lua_pushnumber(l, j); lua_settable(l, -3); } lua_settable(l, -3); } edit : being dumb; used lua_objlen(l, -1) @ end check on size of table, returns 0 since there no integer keyed entries. also, in lua code processed table, used ipairs instead of pairs . silly mistake. pushing table key , using lua_settable right thing do. likely, forgot push on value , did t =...

Expose an event handler to VBScript users of my COM object -

suppose have com object users can access via call such as: set s = createobject("server") what i'd able allow user specify event handler object, so: function serverevent msgbox "event handled" end function s.ondosomething = serverevent is possible and, if so, how expose in type library in c++ (specifically bcb 2007)? this how did recently. add interface implements idispatch , coclass interface idl: [ object, uuid(6eda5438-0915-4183-841d-d3f0aedfa466), nonextensible, oleautomation, pointer_default(unique) ] interface iserverevents : idispatch { [id(1)] hresult onserverevent(); } //... [ uuid(fa8f24b3-1751-4d44-8258-d649b6529494), ] coclass serverevents { [default] interface iserverevents; [default, source] dispinterface iserverevents; }; this declaration of cserverevents class: class atl_no_vtable cserverevents : public ccomobjectrootex<ccomsinglethreadmodel>, public ccomcoc...

iphone - Dealing with different IPs assigned to device via Edge and 3G when connecting to a Microsoft Load Balacing environment -

i'm working on mobile web application targeted toward webkit-based browsers on devices such iphone, android, etc. i've noticed when , iphone switches edge 3g or vice-versa new ip address assigned device, makes sense. the problem i'm connecting web application sitting on 2 windows server 2003 servers load balanced microsoft's network load balancing services. web app makes initial connection , sent 1 of 2 servers. load balancing software looks @ first 3 octets of ip (class c) , uses future requests ensure future requests sent original server. the problem when mobile device switched edge 3g (particularly iphone at&t provider) new ip address assigned device , of time new ip addresses 3rd , 4th octets different, thereby causing load balancing unable determine server send request to. has else found problem when developing mobile web application? if so, solution? any ideas other getting rid of load balancing , using single server appreciated. best case...

android getting a contacts nickname -

anyone have luck querying contacts nickname given phone number or contacts name? thanks http://developer.android.com/reference/android/provider/contactscontract.commondatakinds.nickname.html have view on question: retrieve contact's nickname . and question: get contact info android contact picker

php - Comparing runtimes -

i trying accurate runtime comparisons of php vs python (and potentially other language have include). timing within script not problem timing within script not account moment request made run script output. 1) worth taking such things account? 2) assuming worth taking account, how do this? i'm using mac i've got access linux commands , i'm not afraid compile/create command me, don't know how write such command. if idea compare languages, i'd outside them not relevant comparison purposes. nonetheless can use time command measure , can compare timing within script. like this: $ time script.php hi! real 0m3.218s user 0m0.080s sys 0m0.064s it give clock time, user time (php interpreter) , sys time (os time) if thinking web, gets lot harder because mixing webserver overhead , not easy compare if, say, using wsgi v/s mod_php. you'd have hook probes webserving parts of chain well

Doctrine DQL: Select entities having children/relations to FK table -

assuming setup teachers (id, name) students (id, name, teacher [fk]); how select in dql teachers have students? guess like select t entities\teachers t count(t.students) > 0 but know count(t.students) > 0 wrong ... use then? update now abt many many self referencing relationship? user can teacher or student or both ... code below ... whats dql getting users have students? /** @entity @table(name="users")) */ class user { /** * @id @column(type="integer") * @generatedvalue(strategy="auto") */ private $id; /** * @column(type="string", length="30") */ private $name; /** * @manytomany(targetentity="user", inversedby="teachers") * @jointable(name="teachers_students", * joincolumns={@joincolumn(name="teacher", referencedcolumnname="id")}, * inversejoincolumns={@joincolumn(name=...

java - jpa hibernate composite foreign key mapping -

i having trouble setting jpa mappings entities. have parent entity defined following. @entity @table(name="eif_instance_hdr") public class instanceentity implements serializable{ private static final long serialversionuid = 1l; @id @generatedvalue(generator="eif_inst_gen") @sequencegenerator(name="eif_inst_gen",sequencename="eif_instance_seq") @column(name = "eaih_id") private long eaihid; @column(name = "ead_id") private long eadid; @onetomany(targetentity=instancenotifyentity.class, mappedby="instance",fetch=fetchtype.eager, cascade = cascadetype.all) private list<instancenotifyentity> userdetails = new arraylist<instancenotifyentity>(); } i have child entity w/ composite key, , foreign key primary key of table follows: @entity @table(name="eif_inst_notified") public class instancenotifyentity implements serializable{ private static final long serialversionuid = 1l; @id @manyto...

language agnostic - What's the shortest code to cause a stack overflow? -

to commemorate public launch of stack overflow, what's shortest code cause stack overflow? language welcome. eta: clear on question, seeing i'm occasional scheme user: tail-call "recursion" iteration, , solution can converted iterative solution relatively trivially decent compiler won't counted. :-p eta2: i've selected “best answer”; see this post rationale. contributed! :-) all these answers , no befunge? i'd wager fair amount it's shortest solution of them all: 1 not kidding. try yourself: http://www.quirkster.com/iano/js/befunge.html edit: guess need explain one. 1 operand pushes 1 onto befunge's internal stack , lack of else puts in loop under rules of language. using interpreter provided, eventually--and mean eventually --hit point javascript array represents befunge stack becomes large browser reallocate. if had simple befunge interpreter smaller , bounded stack--as case of languages below--this program cause more no...

c# - Using reflection to call an ASP.NET web service -

say have asmx web service, myservice. service has method, mymethod. execute mymethod on server side follows: myservice service = new myservice(); service.mymethod(); i need similar, service , method not known until runtime. i'm assuming reflection way go that. unfortunately, i'm having hard time making work. when execute code: type.gettype("myservice", true); it throws error: could not load type 'myservice' assembly 'app_web__ktsp_r0, version=0.0.0.0, culture=neutral, publickeytoken=null'. any guidance appreciated. i'm not sure if best way go it. obvious way me, make http request, , call webservice using actual http or post. using method, i'm not entirely sure how you'd set data sending web service. i've added sample code in vb.net dim httprequest httpwebrequest dim httpresponse httpwebresponse dim responsereader streamreader dim url string dim responsetext string url = "http://www.example.co...

jquery - fullcalendar adding events from mysql json - adding eventClick returns blank page -

i pulling events calendar using json , php. know trying add evenclicks or mouseover events the calendar , when blank page. js knowledge rather novice @ point i'm stuck heres calendar script $(document).ready(function() { $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,basicweek,basicday' }, editable: false, events: "json-events.php", loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); } }); }); pretty basic, , heres json mysql_select_db($databasedb, $connectitdb); $sql= "select id, title, description, url, email, stime, etime, eventdate, date_format(eventdate, '%y-%m-%dt%h:%i' ) startdate events order startdate desc"; $check = mysql_db_query($databasedb, $sql, $connectitdb) or die(mysql_error()); $events = array(); while ($row = mysql_fetch_assoc($check)) { $eventarray['id'] = $row['...

.net - Performing validation on a databound object after the property has been updated -

i have basic form controls databound object implementing inotifypropertychanged interface. add validation couple of properties dont want go through implementing idataerrorinfo sake of validating couple of properties. i have created functions perform validation , return error message (if applicable) in object. call these functions form when relevant properties on object have changed, , setup errorprovider control in form error messages have been returned validation functions. i have tried hooking event handlers validating , lostfocus events, these seem fire before object updated, , hence not validating correct data. when leave textbox, go in , leave again validation runs against correct data. is there event can hook can call these validation functions after property on object has been updated? or better off implementing idataerrorinfo interface? i'm not sure problem is, saying can't property set until control loses focus? if so, need set binding upda...

tortoisesvn - SVN externals sub folder changes not showing in view log (tortoise svn) -

svn externals allow make svn folder appear if it's @ location. use having common folder shared across of projects in svn. i have /trunk/common folder in svn share via several different project. example: project1 : /trunk/project1/depends project2 : /trunk/project2/depends project3 : /trunk/project3/depends project4 : /trunk/project4/depends each of these depends folders empty, have svn:external defined point /trunk/common folder. the problem when view log within of projects: /trunk/projectx/ not show changes svn:externals. using tortoise svn svn client. does know how change behavior? show log of /trunk/projectx include changes defined svn:externals well. this not possible current release of subversion, other explicitly calling svn log on target of externals directory you can try issueing feature request @ the apache subversion website

textbox - How do I get an auto-scrolling text display on .NET forms - e.g. for credits -

need show credits screen want acknowledge many contributors application. want automatically scrolling box, credits roll @ end of film. a easy-to-use snippet make multiline textbox. timer may insert line after line , scroll end after that: textbox1.selectionstart = textbox1.text.length; textbox1.scrolltocaret(); textbox1.refresh(); not best method it's simple , working. there free controls available auto-scrolling.

PHP similar_text case sensitive -

ok comparing strings using similar_text() result being affected fact case sensitive. there way turn off somehow in php.ini or something? convert strings lowercase have compared using strtolower()

tsql - Are indexes on temporary tables deleted when the table is deleted? -

would following sql remove index - or have removed separately? create table #tbl (field int) create nonclustered index idx on #tbl (field) drop table #tbl yes are. can search in mssql create index article said there: "indexes can created on temporary table. when table dropped or session ends, indexes , triggers dropped."

java - Modifying JVM parameters at runtime -

does know if possible modify jvm settings @ runtime (e.g. -dname=value)? need little trick run java stored procedure (oracle 10g). assuming mean system properties (-d...; -d picks data model) system.setproperty(...) may want.

webforms - Disappearing checkbox label in ASP.Net 3.5 DetailsView control -

i have web form button , detailsview control on it. in button's click event change detailsview control insert mode can add records: detailsview1.changemode(detailsviewmode.insert) everything works fine, except checkbox in detailsview. when detailsview goes insert mode, text describing checkbox disappears. checkbox works fine. why text disappearing , how can fix it? i able fix problem changing template field. not sure why wouldn't work other way.

Automated tool for Silverlight XAP deployment with web services -

are there tools, or processes deploying web services , silverlight applications rely on those, , have able automatically change web services url , port numbers in configuration files automatically? right finding myself having change web service configuration on server , have edit configuration inside xap. pain when deploying small iterations several servers (test, sales, demo, production, etc.). know write custom code, want avoid if can. it's painful forgetting make change , getting call later tester. for 1 of our projects had similar problem our servicereferences file. our solution define several servicereferences, .config each build configuration. eg. servicereferences.clientconfig.qadeploy, servicereferences.clientconfig.debug, etc . the project generates xap has post-build event copy appropriate config file output location: copy "$(projectdir)servicereferences.clientconfig.$(configurationname)" "$(projectdir)servicereferences.clientconfig...

editor - How do I move to end of line in Vim? -

i know how move around in command mode, specifically, jumping lines, etc. command jump end of line on? just $ (dollar sign) key. can use a move end of line , switch editing mode (append). the opposite of a i (insert mode @ beginning of line), aside.

Free open source Widgets for ASP.NET? -

is there free open source widgets (igoogle-like widgets) framework asp.net can build own widgets , can used commercial use (sites developed can sold). i checked dropthings , kalitte require licence. thanks blogengine.net includes widgets implementation supporting multiple zones not drag&drop support. might check out.

c++ - How to retrieve all keys (or values) from a std::map and put them into a vector? -

this 1 of possible ways come out: struct retrievekey { template <typename t> typename t::first_type operator()(t keyvaluepair) const { return keyvaluepair.first; } }; map<int, int> m; vector<int> keys; // retrieve keys transform(m.begin(), m.end(), back_inserter(keys), retrievekey()); // dump keys copy(keys.begin(), keys.end(), ostream_iterator<int>(cout, "\n")); of course, can retrieve values map defining functor retrievevalues . is there other way achieve easily? (i'm wondering why std::map not include member function so.) while solution should work, can difficult read depending on skill level of fellow programmers. additionally, moves functionality away call site. can make maintenance little more difficult. i'm not sure if goal keys vector or print them cout i'm doing both. may try this: map<int, int> m; vector<int> v; for(map<int,int>::iterator = m.begin(); != m.end...

.net - Iron python, beautiful soup, win32 app -

does beautiful soup work iron python? if version of iron python? how easy distribute windows desktop app on .net 2.0 using iron python (mostly c# calling python code parsing html)? i asking myself same question , after struggling follow advice here , elsewhere ironpython , beautifulsoup play nicely existing code decided go looking alternative native .net solution. beautifulsoup wonderful bit of code , @ first didn't there comparable available .net, found html agility pack , if think i've gained maintainability on beautifulsoup. takes clean or crufty html , produces elegant xml dom can queried via xpath. couple lines of code can raw xdocument , craft queries in linq xml . honestly, if web scraping goal, cleanest solution find. edit here simple (read: not robust @ all) example parses out house of representatives holiday schedule: using system; using system.collections.generic; using htmlagilitypack; namespace govparsingtest { class program { ...

A good pattern/solution to the social web user issue of point whoring? -

take social website digg or stack overflow somehow lets users reward points stories, questions, etc.. what happens quite similar process lead rise of tabloid newspapers feed headlines , no content readers. users smart enough figure out strategies maximize point rewards regardless of whether strategy harmonized goal of website or not. i identify following problems people swamp more general , more entertaining questions answers. answering more specific questions requires actual domain knowledge. getting points tied involving users. given random web crowd unfortunately means generic, subjective, argumentative , unspecific entries. as creator of social website have unique chance influence social behavior towards favorable direction. think influence system has on behavior of people far outweighs initial seed of users. i'm interested in patterns/solutions aim solve problem in terms of: ranking algorithms expert systems limiting/creating ways of social interaction...

Changing CIL code into Native code in C# -

possible duplicate: is there way compile .net application native code? when compile c# application, compiled cil code, interpreted framework when ran, im wondering if possible generate native x86 exe file stub application(s). this way not possible directly open applications in decompiler. p.s cannot use obfuscator anything. there tool called salmander .net linker offered high price. i've never used it, see no point in doing that. offical website you try virtualizing application using thininstall or xenocode virtualization studio . i've used xenocode's product embed .net runtime application , worked great. generates native packed executable assemblies inside.

Infinite recursion in jQuery plugin subfunction -

i wrote following jquery plugin: (function($){ $.fn.imageslide = function(options){ $(this).imageslide.nextslide(); console.log("imageslide"); }; $.fn.imageslide.nextslide = function(){ console.log("nextslide"); $this = $(this); }; })(jquery); some background: i want image slider plugin, crossfade backgrounds (for performance reasons cannot use supersized plugin). want expose several functions user: imageslide plugin "constructor" , several other functions, e.g. imageslide.nextslide , imageslide.previousslide , enable user perform these actions outside plugin. the imageslide function needs call imageslide.nextslide function , slide in (or fade in) first image. problem: it seems line $this = $(this); triggers infinite recursion of imageslide.nextslide function. why happening? it seems $.fn.imageslide.nextslide = function(){}; not right way expose function in jquery plugin. how supposed this...

OpenID for android apps that require SignIn -

i fresh developer on googles android platform - htc desire arrived last week. now need way sign in existing application (java, running on jetty). server application developed using spring security 3.0.2 in case, want support following: if user has set android phone googlemail/google-account (and users do) want use account credentials automagically log in server app. is there android framework supporting use-case? or there alternatives? i read: http code.google.com intl/de-de/apis/accounts/docs/openid.html how sign in app on google appengine described here: http://blog.notdot.net/2010/05/authenticating-against-app-engine-from-an-android-app i think want use accountmanager to find out type google account is, use like: authenticatordescription[] types = maccountmanager.getauthenticatortypes(); // (authenticatordescription type : types) { log.d("account types", type.type); } then like accountmanager maccountmanager = accountmanager.get(context);...

silverlight 4.0 - How to access a value based on siblings or parent in datagrid databinding -

sorry wordy title - battling work out if problems caused by bad class design (likely) ignorance (very likely) both (most likely) i have spent ages googling due not understanding problem it's harder find solution. basically, have "day" class has observablecollection of period called periods. each period has length of time. have method/property of day class (totaltimeupuntilthisperiod) takes in period , returns amount of time of periods until point. i need put period level though datagrid can bind (it's itemssource set day.periods , it's datacontext set day). however, have calculation in day period instances don't know siblings , feels wrong if child walked tree parent level , summed children. my thinking - period should have no "state" ie. no idea of in day in relation it's siblings - job of day class. so, if class design correct - how can access datacontext in bound datacolumn? tried write converter take in period , parent da...

iphone - Offline web application + ipad bug -

i trying simple (all front-end) application working offline on ipad, safari keep telling not connected internet. i uploaded cache manifest, added addtype text/cache-manifest .manifest in .htaccess i use 1 ajax request, but, store in localstorage , check navigator.online, should offline use localstorage item, on ajax error use localstorage item i don't know investigate next. work on safari desktop , can view app offline. the prototype url : http://www.position-absolute.com/creation/ipadproto/demos/main/index.html figured out was. indeed safari bug. application working in safari having issues on ipad. i upgraded ipad 3.2.2 , working well!

xsd - Recursion in an XML schema? -

i need create xml schema validates tree structure of xml document. don't know occurrences or depth level of tree. xml example: <?xml version="1.0" encoding="utf-8"?> <node> <attribute/> <node> <attribute/> <node/> </node> </node> which best way validate it? recursion? if need recursive type declaration, here example might help: <xs:schema id="xmlschema1" targetnamespace="http://tempuri.org/xmlschema1.xsd" elementformdefault="qualified" xmlns="http://tempuri.org/xmlschema1.xsd" xmlns:mstns="http://tempuri.org/xmlschema1.xsd" xmlns:xs="http://www.w3.org/2001/xmlschema" > <xs:element name="node" type="nodetype"></xs:element> <xs:complextype name="nodetype"> <xs:sequence minoccurs="0" maxoccurs="unbounded">...

Java obfuscation - ProGuard/yGuard/other? -

this along similar lines these recent questions: best java obfuscation application size reduction creating non-reverse-engineerable java programs however, 1 ends recommending yguard , other proguard neither mention both. wonder if comparison of each 1 , hear peoples experiences both sides of fence. looking @ comparison chart on proguard website angled towards proguard. real-world experience of each - 1 produces smaller output? 1 harder decompile from? java versions supported each? personally i'm particularly interested j2me point of view please don't limit discussion that. proguard better product; if take time go through settings j2me. specifically j2me there far better (commercial) product called mbooster i've been getting around 25% improvement in size on application after been through proguard. better zip compression on jar file , comprehensive support class merging , preverification.

Do you use Microformats, RDF, Dublin Core or another type of semantic markup? -

do use of these technologies? ones current , hence sensible include in site? documentation on seems relatively sparse, , usage of of them limited, search engines better, relevant more? i use microformats whenever can. makes sense anyway, when have address block, may want style elements differently other elements, , makes super easy. it's not microformats hard figure out. there has been couple of instances where, because using microformat, able re-use markup of portion of site somewhere else (as include), , not have change markup, styling. finally, ever since stated exploring microformats, got better @ writing semantic markup , better @ naming css classes.

php vs regex for counting data -

i have array, have same data: data range 115x0101-115x0200 115x0101-115x0200 115x0101-115x0200 the 115x mean production code..this unimportant. concern @ 4 digits behind can counting. 1. want script read or search "0101" , "0200" 115x0101-115x0200 2. have tried using regex count them become 200-101=100 3. "115x0101-115x0200" repeated until there 20 data 4. after reached 20, show result @ page: data range 100 if raw data, easiest way extract using regular expression, you've mentioned. you'll want (in php): # database $sql_results = array( '115x0101-115x0200', '115x0101-115x0200', '115x0101-115x0200', ); foreach($sql_results $row) { preg_match_all('/\d{4}/', $row, $matches); #200 #101 echo intval($matches[0][1]) - intval($matches[0][0]) + 1; } for each row, preg_match find groups of 4 digits ( \d{4} ) , plac...

How to position one element relative to another with jQuery? -

i have hidden div contains toolbar-like menu. i have number of divs enabled show menu div when mouse hovers on them. is there built-in function move menu div top right of active (mouse hover) div? i'm looking $(menu).position("topright", targetel); tl;dr: (try here ) if have following html: <div id="menu" style="display: none;"> <!-- menu stuff in here --> <ul><li>menu item</li></ul> </div> <div class="parent">hover on me show menu here</div> then can use following javascript code: $(".parent").mouseover(function() { // .position() uses position relative offset parent, var pos = $(this).position(); // .outerwidth() takes account border , padding. var width = $(this).outerwidth(); //show menu directly on placeholder $("#menu").css({ position: "absolute", top: pos.top + "px", ...

syntax - What are your language "hangups"? -

i've read of recent language vs. language questions interest... perl vs. python , python vs. java , can 1 language better another? one thing i've noticed lot of have very superficial reasons disliking languages. notice these things @ first glance , turn off. shun languages result of features we'd learn love or ignore in 2 seconds if bothered. well, i'm guilty next guy, if not more. here goes: ruby: ruby example code see uses puts command, , that's sort of childish yiddish anatomical term. result, can't take ruby code though should. python: first time saw it, smirked @ whole significant whitespace thing. avoided next several years. hardly use else. java: don't identifiersthatlooklikethis. i'm not sure why exactly. lisp: have trouble parentheses. things of different importance , purpose (function declarations, variable assignments, etc.) not syntactically differentiated , i'm lazy learn what's what. fortran: uppercase hurts...

c# - Getting the schema for a table -

given sqlconnection object how can schema single table? i trying other day , seemed able schema dataset i'd gotten running query, schema info connection seemed related tables available , not actual details on tables. i'm sure there simple way this. i think accessing schema query (via getschematable) way it. can run query returns no rows (select * table 1=2) if schema you're interested in. you should use keyinfo commandbehaviour execute source query, otherwise not information returned guaranteed accurate command.executereader(commandbehavior.keyinfo)

Take a screenshot of a window using C# .NET - missing pixel information -

i attempting take screenshot of window using c# .net calling windows api. came following code: public void screenshotwindow(intptr windowhandle) { rect rect = new rect(); getwindowrect(windowhandle, out rect); int width = rect.right - rect.left; int height = rect.bottom - rect.top; intptr windowdevicecontext = getwindowdc(windowhandle); intptr destdevicecontext = createcompatibledc(windowdevicecontext); intptr bitmaphandle = createcompatiblebitmap(windowdevicecontext, width, height); intptr oldobject = selectobject(destdevicecontext, bitmaphandle); bitblt(destdevicecontext, 0, 0, width, height, windowdevicecontext, 0, 0, captureblt | srccopy); selectobject(destdevicecontext, oldobject); deletedc(destdevicecontext); releasedc(windowhandle, destdevicecontext); image screenshot = image.fromhbitmap(bitmaphandle); deleteobject(bitmaphandle); screenshot.save(...

blackberry - pause the player -

i want pause player. on code perform start , stop. how pause player. i think player.stop() pause player. according blackberry docs. public void stop() throws mediaexception stops player. pause playback at current media time.

html - Embedding a java applet in Wordpress -

i have applet works alright on page . references .class file. (unfortunately, have lost source, , jar files.) i want reference here , not start. because cannot find class file. applet tag looks this <applet code="/applets/language/languageengineapplet.class" width="1174" height="402"> <embed code="/applets/language/languageengineapplet.class" width="1174" height="402" type="application/x-java-applet" pluginspage="http://www.java.com/en/download/manual.jsp"/> </applet> i know .class file there, because i can link it . i'm stumped why won't work. i put applet in page on it's own. problem not java version, class name , path , package interacting somehow. had put in directory on own, html file referenced in directory.

http - Large JSP response is truncated :( -

i have jsp accessed through jboss. renders list (a search result). if response gets big, approximately larger 200k response truncated. can see how page ends in middle of tag in firefox. ie totally freaks out fiddler. responses smaller 200k no problem. anyone has experienced this? don't know problem... suggestions welcome. if jsp renders complex html page, might browsers tripping on own feet. can retrieve page via wget or curl? truncated then, too?

How do I delete messages from MSMQ using the Computer Management tools in Windows XP -

computer management -> services , applications -> message queues how delete message specific queue? seems me there way cannot find right now. well, isn't possible delete poison message mmc. you can try queueexplorer , maybe out, or have programmically solve issues

asp.net - Add Item from Dropdownlist to ListBox using JQuery -

how can add user selected dropdownlist listbox using jquery? , when post page should able retrieve "id, name" listbox. <asp:dropdownlist id="ddlperson" datasourceid="ods_person" datavaluefield="id" datatextfield="name" runat="server" width="221px" /><br /> <asp:listbox id="lstperson" runat="server" width="245px" font-bold="true" forecolor="green" selectionmode="multiple"> </asp:listbox> <br> to add items dropdown can use following script <script type="text/javascript"> $(function () { $('[id$=items]').change(function (e) { var option = $('<option/>').html($(e.currenttarget).val()); $('[id$=listbox]').append(option); }); }); </script> ...

RegEx to select everything between two characters? -

i trying write regex selects between 2 characters. for example, when regex encounters '§' want select after '§' sign, until point regex encounters ';' . tried lookbehind , lookahead, don't trick. so example " § 1-2 bla; " should return " 1-2 bla" . any appreciated! how about "§([^;]*);" the selected characters between § , ; available match group 1.

Checking for duplicates in a complex object using Linq or Lambda expression -

i've started learning linq , lambda expressions, , seem fit finding duplicates in complex object collection, i'm getting little confused , hope can put me on path happy coding. my object structured list.list.uniquecustomeridentifier i need ensure there no duplicate uniquecustomeridentifier in entire complex object. if there duplicates, need identify duplicated , return list of duplicates. unpack hierarchy project each element uniqueid property group these id's up filter groups groups have more 1 element project each group group's key (back uniqueid) enumerate query , store result in list. var result = mylist .selectmany(x => x.innerlist) .select(y => y.uniquecustomeridentifier) .groupby(id => id) .where(g => g.skip(1).any()) .select(g => g.key) .tolist()

javascript - Android Web Development...Div width (more likely inner text) is changing in pixels based on device zoom -

i developed application interfaces institution's emergency alert system. how works is, when there alert, on of institution's web pages displays scrolling marquee @ top of page put there javascript using protoype , scriptaculous. all of works on desktop browsers (ie6-8, chrome, safari, firefox, opera). works on iphones. problem rendering on android. in researching problem initially, found css property mobile devices (namely webkit) -webkit-text-size-adjust, keeps mobile devices resizing text when zooming , changing screen orientation. have set property 'none' stated many articles. below picture of screen shots android emulator. left screen shot shows 1x magnification of page. spacing between each of messages should be. right screen shot shows page zoomed in. messages overlap, text size rendered differently, , div width not wide enough contain text. http://www.themonkeyonline.com/spacing-example.jpg here code places div on page: var marquee = new element( ...

css - Can I put a <style>...</style> tag within the body of a HTML file to send in email? -

since lot of email clients ignore head tag, can embed inline stylesheet in body? the short answer no. gmail strips tag , it's content. hotmail, yahoo! mail , windows live mail not strip style-tags in body-element. but take @ "the ultimate guide css" html email on @ campaign monitor.

Is it possible to use MSBuild to build a .NET 1.1 VB project w/ Crystal Reports? -

i have project crystal reports files doesn't seem build correctly if upgrade vs 2005 , .net 2.0. think reason new version of crystal reports incompatible older report format. since running vista, , .net 2003 doesn't work correctly on vista, want able build using msbuild target .net 1.1 framework. possible? .net 1.1 doesn't use msbuild, can convert project vs 2005, , use called msbee back-target project 1.1 runtime. i've never tried it, that's best bet.

header - Setting Return-Path with Python sendmail for a MIME message -

hi set "return-path" header mime message send python. basically, tried : message = mimemultipart() message.add_header("return-path", "something@something.com") #... smtplib.smtp().sendmail(from, to, message.as_string()) the message receive have "return-path" header set same content "from" one, if explicitly add "return-path" header. how can set "return-path" header mime message sent through smtplib's sendmail in python ? thanks in advance. return-path set smtp protocol, it's not derived message itself. it'll envelope address setups. the proper way accomplish is: msg = email.message_from_string('\n'.join([ 'to: michael@mydomain.com', 'from: michael@mydomain.com', 'subject: test email', '', 'just testing' ])) smtp = smtplib.smtp() smtp.connect() smtp.sendmail('something@something.com', 'michael@mydomain...

google cloud datastore - App Engine - ReferenceProperty and custom indexes -

this follow-up question drew sears' answer discussion: app engine datastore - data model question if model bucket reference property in object kind , want query objects in bucket 1234 size > 1000. query "where bucket = key('bucket', 1234) , size > 1000". i'm assuming require custom index on bucket , size properties. assumption wrong? if not, model #2 in original question (dynamic kinds) way make work automatic indexes? hope there's way. thanks, keyur you're correct: require custom index. dynamic kinds 1 way around - though kludgy 1 - there may others. can tell more structure of these entities, kinds of properties users can declare, , valid queries on properties?

objective c - UITextField editing issue - iPhone SDK -

i having issue uitextfields in iphone app hoping here may have seen before. i have few uitextfield's on screen, , when tapped , keyboard appears covered. overcome this, animated view move with: -(void)moveviewupfromvalue:(float)fromoldvalue tonewvalue:(float)tonewvalue keep:(bool)keep { cabasicanimation *theanimation; theanimation=[cabasicanimation animationwithkeypath:@"transform.translation.y"]; theanimation.duration=0.25; theanimation.repeatcount=1; if(keep) { [theanimation setremovedoncompletion:no]; [theanimation setfillmode:kcafillmodeforwards]; } theanimation.fromvalue=[nsnumber numberwithfloat:fromoldvalue]; theanimation.tovalue=[nsnumber numberwithfloat:tonewvalue]; [self.view.layer addanimation:theanimation forkey:@"animatelayer"]; } this, visually, works great, however, when go edit (hold screen down magnifying glass), doesn't appear. interaction retained in position before m...

apache - mod_rewrite docroot to multiple subfolders dependant on subfolder name -

i've been trying rewriterules working , successful when using 1 host, not multiple. i'm wanting " http://preview.domain.com " point " http://preview.domain.com/dir1 " or " http://preview.domain.com/dir2 ", etc. dir1 , dir2 contain proxypass points real domain. here have : rewritecond %{request_uri} !/dir1 rewriterule ^(.*)$ /dir$1 [r] <location /dir1> proxypass http://dir1.com </location> i can't dir2 rules work beside ones above. wanting make dynamic if possible 70 folders , growing. " http://preview.domain.com " domain point dev server show dev content instead of prod content without having modify website code. provide help? i don't understand you're trying do. if want http://preview.domain.com/nameofsite/path map http://nameofsite.com/path (where nameofsite placeholder whatever domain name you're using), use rewriterule ^/([^/]+)(/.*)$ http://$1.com$2 [p] and wouldn't hav...

c# - Remove link from treeview parent node -

is there way can keep text of parent node remove link? treeview parent node used header, no navigation. great. thanks. private void bindnodes(string ptid) { if (ptid != "") { int patientid = convert.toint32(ptid); dbconnection dbobj = new dbconnection(); if (session["activepatient"] != null) { string[] subchild = new string[4]; subchild[0] = "demographics"; subchild[1] = "medication reviews"; subchild[2] = "drug testing & monitoring"; subchild[3] = "other program"; treenode otrparent = new treenode(); //trv_patient.parentnodestyle = "none"; //otrparent.selectaction.style.add("display", "none"); treenode otrsubchild1; treenode otrsubchild; (int = 0; < 4; i++) { ot...

asp.net mvc - What is .net 3.5 sp1? -

(1) service pack ? (2) want work mvc. have installed visual studio 2008 tried install mvc 1.0 there error have install 3.5 sp1.then necessary install 3.5 sp1 or 3.5 .net framework installed automatically when installed vs 2008 ? (3) tried download 3.5 sp1 of 2.8 mb, if install then, able install mvc 1.0 ? yes, need install service pack. yes, 3.5 installed .net 2008 mvc 1 released after vs2008 , needs updates. yes, if install service pack should able install mvc 1. it sounds have bootstrap installer service pack, if not can http://msdn.microsoft.com/en-us/netframework/cc378097.aspx however should start asp.mvc 2 instead - there's nice new features.

Does SQL Server automatically discard unnecessary joins? -

if submit query sql server 2005 contains number of left join clauses table joined never referenced, joins still happen or sql server intelligent enough discard them? obviously wouldn't able discard inner joins [false assumption! see answers] potentially change result, can left joins? a left join potentially multiply result set if there many matches. so therefore still evaluated.

javascript - A sticky situation for jQuery slideshow -

i'm required develop slideshow (not existing one) jquery. able change picture function created named changepic (takes image link). incorporates fading animation jquery library. for slideshow i'm trying use while loop. kind of works, except doesn't wait animation finish. how i, a) wait animation finish, b) delay changing picture display picture couple of seconds? also tried settimeout, , doesn't work. edit: basically changing image this: function changepic(imglink){ var imgnode = document.getelementbyid("galleryimg"); $(imgnode).fadeto(500, 0, function(){ $(imgnode).attr("src", imglink); $(imgnode).fadeto(1000, 1); }) } and slideshow code this, shouldn't. function slideshow(gallerylinks){ var i=0; while (i<gallerylinks.length){ changepic(gallerylinks[i]); i++; } } you try ditching while loop, , going perpetually recursive function... on .animate, add timeout ...