Posts

Showing posts from February, 2014

javascript - How to validate the text box should take only A B C -

i have text box need validate that.. i mean user can enter either or b or c if enters d z or other things should show popup message please enter or b or c using jquery or javascript? thanks see live i hope want this

input - How to read from console in MATLAB? -

how read string or character matlab console (command window)? see request input complete reference reply = input('do want more? y/n [y]: ', 's'); if isempty(reply) reply = 'y'; end

oracleforms - Oracle Forms - where is the current documentation? -

i spent far long wandering around oracle's website looking latest developer documentation oracle forms (10g or 11g versions preferably). closest came page, none of links clicked brought me useful documentation. http://www.oracle.com/technology/documentation/10g_forms.html i'm looking information on building apps oracle forms. things how use ide, pl/sql syntax creating forms, built-in apis, etc. anyone have better link forms documentation? found version 9 reference guide @ page http://www.oracle.com/technetwork/developer-tools/forms/documentation/10g-forms-091309.html . actual link "book a97289-01" on page http://www.oracle.com/technetwork/developer-tools/forms/documentation/9irefguide-131898.zip

unit testing - Run Rails Tests without Dropping Test Database -

just wondering if there's way run rails tests without dropping database. i'm executing unit tests , using following rake command so: rake test:units . thanks in advance! just in case relevant: rails 3 ruby 1.8.7 (mri) oracle 11g database activerecord-oracle_enhanced-adapter after doing research, have found there isn't way this. test rake tasks drop database, when providing test= option bohdan suggests. by using --trace option, can proven. here output: $ rake test:units test=test/unit/post_test.rb --trace (in /users/johnnyicon/development/ror/test-app) ** invoke test:units (first_time) ** invoke test:prepare (first_time) ** invoke db:test:prepare (first_time) ** invoke db:abort_if_pending_migrations (first_time) ** invoke environment (first_time) ** execute environment ** execute db:abort_if_pending_migrations ** execute db:test:prepare ** invoke db:test:load (first_time) ** invoke db:test:purge (first_time) ** invoke environment ** execute d...

php - documentation of function calls -

how have function calls documented in php ? have : = = = = function_name1(list of args) description of function foo bar (extracted php-doc comments) calls: function_name2(list of args) function_name3(list of args) is called in function4 function5 = = = = = = = = = = = = function_name2(list of args) description of function foo bar (extracted php-doc comments) calls: function_name5(list of args) is called in function1 .. the used documentation standard in php world phpdoc . derived javadoc. large number of ides support phpdoc , means can automate documentation , can gain code completion , other features it. several tools exist autogenerate documentation phpdoc code annotations. phpdocumentor mentioned elsewhere prominent, can use doxygen allows wider range of documentation formats update: phpdocumentor quite outdated , cannot work php5.3 code (tried closures?). there (currently) 2 worthwhile alternatives at: docblox , phpdox . ...

ios - What is the touches canceled event, and how is it different from touches ended -

i don't understand apple means touches canceled event , how called. i'm not sure tim addressed question i'll take shot @ it. touchescanceled called when os needs interrupt user. gives chance clean whatever you've been doing in touchesbegan , touchesmoved. more specifically, called when user puts phone his/her face turning screen off, or if notification incoming call or new text message occurs.

javascript - Can someone tell me the purpose of the second capture group in the jQuery rts regular expression? -

in jeff roberson's jquery regular expressions review proposes changing rts regular expression in jquery's ajax.js /(\?|&)_=.*?(&|$)/ /([?&])_=[^&\r\n]*(&?)/ . in both versions, purpose of second capture group? code replacement of current random timestamp new random timestamp: var ts = jquery.now(); // try replacing _= if there var ret = s.url.replace(rts, "$1_=" + ts + "$2"); doesn't replace matches? thinking same: var ret = s.url.replace(/([?&])_=[^&\r\n]*/, "$1_=" + ts); can explain purpose of second capture group? it's pick next delimiter in query string on url, still works query string. if url is http://foo.bar/what/ever?blah=blah&_=12345&zebra=banana then second group picks "&" before "zebra". that's awesome blog post way , should read it. edit — think it, i'm not sure why it's necessary bother replacing second delimiter. in "...

jquery - Google maps won't load in window -

on website want open div in jquery , show route address google maps. the problem reason map won't load. if go page directly works, if open page via jquery empty page. code: $("#showroute").click(function(e){ e.preventdefault(); $("#shadow").add($("#shadowcontent"),$("#closebox")).remove(); $("body").append('').append(''); $("#shadowcontent").append('sluit venster').append(''); $("#closebox").click(function(c) { c.preventdefault(); $("#shadow").add($("#shadowcontent"),$("#closebox")).fadeout(500); }); $("#shadow").add($("#shadowcontent")).fadein(500); $("#shadowcontent").show().css({'width':'750px','top':'25px','left':'50%','margin-left':'-400px'}); $("#content").load('route.php?from='+$("#routefrom"...

Greasemonkey script on Firefox network error page -

Image
i want run greasemonkey script on firefox network error pages, such (but not limited to) one: can chrome:// urls? if so, they? if not, there way? well, on right track. 2 things: network error pages begin about:neterror , not chrome:// . if try access ww.example.com (missing w) redirected about:neterror?e=dnsnotfound&u=http%3a//ww.example.com/&c=utf-8&d=firefox%20can%27t%20find%20the%20server%20at%20ww.example.com you cannot // @include about:neterror* . but since know url format, can // @include * and check: if (document.documenturi.search('about:neterror') != -1) { dostuffonneterror(); } thanks hints, brock.

how can I detect whether the android phone in Silent mode programmatically -

how identify whether phone in silent mode or not? i using android 1.5. tried using "android.provider.settings.action_sound_settings". not working. use getringermode() method in audiomanager . audiomanager = (audiomanager)getsystemservice(context.audio_service); switch (am.getringermode()) { case audiomanager.ringer_mode_silent: log.i("myapp","silent mode"); break; case audiomanager.ringer_mode_vibrate: log.i("myapp","vibrate mode"); break; case audiomanager.ringer_mode_normal: log.i("myapp","normal mode"); break; }

c# - Is it better to have more number of dll's -

i'm designing application. found make more modularize, number of dll's getting increased. better design have more number of dll's? regards arundhaj this common tricky question. don't overly fragmented dlls, makes quite hard (imo) track , deploy. prefer limited number of more chunky dlls. in addition project/dll management, reduces amount of work "fusion" has when loading things. you should aim reusable components, don't go mad making them too granular - consider "system.windows.forms.dll", example; quite lot in there! vertically, obvious ones keep separate ui / repository / logic concerns; horizontally tend have 1 column of dlls per logical area - can still compartmentalize namespaces , don't have keep dll just 1 thing.

ReSharper search pattern: "Can not parse pattern" -

r# 5.1.1751.8 when perform pattern search for... catch (exception e) {} ...i'm shown error dialog says "can not parse pattern". what pattern cannot parsed? doing wrong? i emailed jetbrains support , got following response: resharper cannot parse part of c# language construct. in case, 'catch(exception e){}' part of try/catch construct. following search empty catch clauses: try { $stmt$ } catch(exception e) { } ( $stmt$ "one or more statements" ).

ruby - rails has_many :through has_many :through -

i'm wondering extent can use associations in rails. take consideration following: class user < activerecord::base has_one :provider has_many :businesses, :through => :provider end class provider < activerecord::base has_many :businesses has_many :bids, :through => :businesses belongs_to :user end class business < activerecord::base has_many :bids belongs_to :provider end class bid < activerecord::base belongs_to :business end i able set these nifty shortcuts user.businesses , provider.bids doing user.bids ? possible associate association, speak? this entirely possible, needs little work. following model definitions used in conjunction nested_has_many plugin can fetch bids belonging user @user.bids class user < activerecord::base has_one :provider has_many :businesses, :through => :provider has_many :bids, :through => :businesses end class provider < activerecord::base has_many :b...

version control - Project files into VCS or not? -

in our company have discussion whether put project files our version control system. think? consider eclipse project file c project contain source , make files , other things. put vcs? if project files meet following criteria: they contain information building source quickly, checkout, commit , basic routines (for developers) parts maybe release can separated internal (if foss project or proprietary, example) they don't change anyone's ide setup or personal preferences they can treated source code internal-only releases, , may have own bugs , patches i don't see major reason why not. makefiles/autotools defs go in rcs (autotools inputs @ least). providing data stored relevant all, , machines (build output directories ...) give go

c# - Reading data from a SAS data source in .Net -

i've been asked read data sas in asp.net application. i've got working code windows forms app. same code doesn't work in asp.net can try it. clean project same references consistently fails. here's i've got connection: sasworkspacemanager.workspacemanager oworkspacemanager = new sasworkspacemanager.workspacemanager(); string xmlinfo = ""; sasworkspacemanager.serverdef oserverdef = new sasworkspacemanager.serverdef(); oserverdef.machinednsname = "server"; oserverdef.protocol = sasworkspacemanager.protocols.protocolbridge; oserverdef.port = <port>; oserverdef.bridgeencryptionalgorithm = "sasproprietary"; oserverdef.bridgeencryptionlevel = sasworkspacemanager.encryptionlevels.encryptuserandpassword; sas.workspace osasworkspace = oworkspacemanager.workspaces.createworkspacebyserver ("", sasworkspacemanager.visibility.visibilityprocess, oserverd...

jquery - How do I manipulate first table cell in table row based on values in second and third table cell -

i manipulate first table cell in table row based on values in second , third table cell. has done each table row. is possible jquery? something work: $(document).ready(function() { $('#tbl tr td:nth-child(1)').each(function() { var siblings = $(this).nextall('td'); $(this).html(siblings.eq(0).html() + siblings.eq(1).html()); }); }); try on this: <table id="tbl"> <tr> <td>one</td> <td>two</td> <td>three</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> </table>

algorithm - Removing shadows from white clear surface -

i have image of object taken in studio. image lighten multiple sources , stands on mate white background. background lighten. most of shadows fall on background eliminated lights there still little light shadows remove. until now, solutions found involved in manual intervention. know if there known methods or if has idea how approach such problem. the object can contain white elements , @ point can't change background color (to green or blue). thanks. if have strong contrast between foreground , background use simple floodfill algorithm stops on hitting large contrast difference classify pixels background , foreground. adjust levels of background saturate shadows white while retaining reasonable edge quality. helps if input data higher resolution output. if have soft edges or need edge quality you'll need employ algorithm each edge pixel estimates background color, foreground color , transparency. approach soft scissors paper siggraph 2007.

sql server - Repeatable Read - am I understanding this right? -

trying understand sql server isolation levels - notably repeatable read. i have sproc starts transaction , puts cursor around data (boo hiss). can fair chunk of data, can take while do. it commit or rollback. during time, before transaction has been closed, if calls method causes of affected rows read, understanding method stall until first method complete. served data (as long time-out doesn't occur first) i think i'm right, question - i?! repeatable read prevents selects lifting shared locks placed until end of transaction. with transaction 1 read committed , can update row in transaction 2 after selected in transaction 1 . with transaction 1 repeatable read , cannot update row in transaction 2 after selected in transaction 1 . the scenarios: read committed 1 select -- places shared lock , lifts it. 2 update -- places exclusive lock. succeeds. 1 select -- tries place shared lock conflicts exclusive lock placed 2. locks. repeatable re...

c# - WPF drag distance threshold -

i have program 2 wpf treeviews allow dragging , dropping between two. problem is, can annoying open / close items on treeviews because moving mouse 1 pixel while holding left mouse button triggers drag / drop functionality. there way specify how far mouse should move before it's considered drag / drop? there's system parameter this. if have point down = {where mouse down event happened} point current = {position in mousemove eventargs} then mouse has moved minimum drag distance if math.abs(current.x - down.x) >= systemparameters.minimumhorizontaldragdistance || math.abs(current.y - down.y) >= systemparameters.minimumverticaldragdistance)

jquery - Displaying information from Twitter and Database in DateTime order -

i working on asp.net mvc website , querying twitter's api return data. have database backend returns posts blog. how can put data in date order , parse view? at moment using http://tweet.seaofclouds.com/ puts data div via jquery have added need data database , twitter when view requested. i'm thinking can make request twitter in controller when page requested, @ same time data database , build viewmodel , parse view eg/ return view(mytwitterdbmodel); would way or have better idea? this have done using twitterizer library. works still not sure if correct: public actionresult blog() { list<post> data = new list<post>(); post p = new post(); p.date = new datetime(2009, 08, 23); p.title = "long time ago"; p.text = "old post"; data.add(p); p = new post(); p.date = datetime.now; p.title = "new post";...

Display dynamically added methods and attributes in python help -

i have class add new methods , properties dynamically. new properties handled overriding __getattr__ , __setattr__ while new methods added directly (obj.mymethod = foo). there way make these show if "help(inst)" inst instance of class? right see methods , attributes have "hardcoded" in source. methods show if "dir(inst)". the issue help(inst) provides information class instance "inst" derived from. say obj derived class a, instead of doing obj.mymethod = foo, if did a.mymethod = foo, show in help(obj) look @ example below , it's output. class a(object): def __init__(self): pass def method1(self): "this method1 of class a" pass = a() help(a) def method2(self): """ method 2 still not associated""" pass a.method2 = method2 # if did a.method2 = method2 # won't show in help() statement below help(a) as per documentation, if argument other...

c# - Drag Drop using SendMessage -

this sounds funny..just little experiment. wanted simulate drag drop of file on application/window using send message. possible? i dont have code application on executable. the application ip messenger . what wanted use "send to" functionality send file .exe ,which will find ipmessenger window , simulate drag drop thr code. the user select file , right click "send to" .exe drag drop code. **note: ip messenger supports drag-drop operation files thx amit there wm_dropfiles message . guess use createtoolhelp32snapshot locate window ip messenger , build dropfiles structure send wm_dropfiles message. the final link codeproject, on creating dropfiles structure: how implement drag , drop between program , explorer . instead of using creattoolhelp32snapshot using findwindow function. here hwnd ip messenger directly, instead of cth32s , locate handle process. when done create dropfiles structure. read comments on codeproject li...

assembly - Strange output with Irvine's WriteString -

the point of following program print out letter "c" combination of every background , foreground color. in library i'm using colors defined 0-15 , following code: mov eax,foreground + (background * 16) call settextcolor here code: include irvine32.inc .data character byte "c" count dword ? background dword 0 .code main proc call clrscr mov ecx, 15 ; our main counter 0-15 colors l1: mov count, ecx ; store our outer loop counter mov ecx, 15 ; set out inner loop counter l2: ; since our color defined so... mov eax,foreground + (background * 16) mov eax, count ; setup our foreground color add eax, background ; setup our background color call settextcolor ; instead of multiplying each background color 16, going ; add 16 each time. add background, 16 ...

perl - Is there an elegant way to store an ontology graph and the definitions/data associated with nodes? -

i have written simple module store , manipulate ontology provided in flat file using perl. this, use graph module excellent. one issue having deal how store textual definitions vertexes in ontology. each term has small text description want store , retrieve. @ moment, graph not support directly, use internal hash. i wondering, there more elegant way of having single data structure store both ontology graph and definitions/data associated nodes? the graph module allows attach attributes vertices , edges. mean when using internal hash? if not, perhaps help: use graph; $g = graph->new; ($v1, $v2) = qw(a b); $g->add_edge($v1, $v2); $g->set_vertex_attribute($_, 'desc', "vertex $_") $v1, $v2; print $g->get_vertex_attribute($_, 'desc'), "\n" $v1, $v2;

How to build an ASP.NET Proxy Site -

i want build proxy site renders url. given url, need replace html links, css links , js urls from href="/original.htm" to href="http://www.myproxy.com/get?www.original.com/original.htm" sort of. how can do? there ready-to-use framework? use asp.net , c#. http://www.codeproject.com/kb/aspnet/asproxy.aspx

javascript - Ajax - maintaining state in the url - no # -

i working on ajax website there 2 search parameters. did mod-rewrite , checking $_get variables can like.. site.com/var1/var2/ -> automatically search based on parameters. now want people search manually, able have url in format. method i've been able find has w/modifying url using.. location.hash = 'foo'; which make like.. site.com/#var1 which isn't nice mod-rewrite. have found works if in search function ajax call have code // avoid appending further variables if there variables if(location.href == 'some absolute website path') location.href = var1+'/'+var2+'/'; this work, forces page load , auto search php/javascript kick in due mod-rewrite. works, involves page refresh rather avoid. any better solutions out there? ideally if able use location.href didn't cause page load once change value, change in url ideal (while maintaining mod-rewrite links, w/out # marks). i using jquery , php. it...

java - how to raise OptimisticLockException -

unable catch optimistic lock exception. one way raise optimisticlockexception using em.flush() try{ //some enitity em.flush() } catch(optimisticlockexception ole){} but dont think best solution beacuse in full database flush. another work around catching ejbexception , find rollbackexception in .. try{ // code } catch (ejbexception ex) { if (ex.getcausedbyexception().getcause().tostring(). indexof("javax.transaction.rollbackexception")!= -1){ // work } } } please have other idea or tell me way better. i think first way reasonable way if want catch optimisticlockexception , refresh data or retry operation. second way, if current transaction not active, there no rollbackexception thrown.

Resources to Write ANSI C++ Code -

the last time heavily used c++ years ago, , strictly done on windows platform. specifically, used microsoft visual studio ide , developed habitual patterns use microsoft's c++ version. example, used void main() instead of standard int main() . now, taking class required develop programs ansi c++ compliant , code compiled using g++. learned system ( "pause" ) not work in g++ , microsoft thing. does know of resources ( sites, tutorials, books ) can learn more better ansi c++ complaint? thank you. i highly recommend these two: comp.lang.c++ usenet newsgroup. if can hold of usenet service provider, , use news reader, should able rid of spam. use eternal-september.org , , lot. read c++ faq . has lot of great information. granted, both not terribly great if want tutorial introduction c++, looks know c++, , need learn more, , correct bad habits. personal experience, above 2 highly useful in doing that. about comp.lang.c++ , make sure read fa...

osx - Where are core dumps written in Mac OS X? -

on mac os x, if send sigquit c program, terminates, there no core dump file. do have manually enable core dumps on mac os x (how?), or written somewhere else instead of working directory? it seems suppressed default. running $ ulimit -c unlimited will enable core dumps, , placed in /cores/ core.pid

python - How to create a custom django filter tag -

i having trouble in getting site recognise custom template tags. have following dir structure: project_name project_name templatetags _ __init __ _.py getattribute.py views _ __init __ _.py index.html views settings.py main.py manage.py urls.py nbproject then have added installed_apps: installed_apps = ( # 'django.contrib.auth', 'django.contrib.contenttypes', # 'django.contrib.sessions', 'django.contrib.sites', 'project_name' ) i reference inside template this: {% load getattribute %} {% header in headers %} <td>{{ obj|getattribute:header }}</td> {% endfor %} the error follows: could not import controllers.eventcontroller. error was: no module named project_name any appreciated this: tia andrew update: the site works cannot template tags work. if remove project_name installed_apps following error: exception value: 'getattribute' not...

Pushdown automaton for (a^n b^n)^m c^m -

i'm stuck building transition functions automaton. i suppose should stack 1 each , unstack each b the number of c's equals number of ab pairs, think should stack 0 each b encounter. thing is: how unstack 1s , add 0s @ same time? don't push 0 onto stack each time encounter b . instead, push 0 onto stack each time encounter b , stack empty or top of stack 0 . so, using nomenclature aabbabcc : read push 1 read push 1 read b pop 1 read b pop 1 stack empty push 0 read push 1 read b pop 1 top of stack 0 push 0 read c pop 0 read c pop 0 stack empty accept string.

java - Swing components naming convention? -

is there naming convention swing components such jbuttons..? or body knows way doing that? thanks afaik, there no special convention swing elements. the best thing can using names explicit possible (as usual). for part try use name of wanted content followed type of component. for example textfield containing age use agetextfield . button used sumbit use submitbutton .

coldfusion - How to handle Script Attack in application -

we facing issues of javascript getting embedded message body, following code snippet of javascript, } {*\htmltag241 var danashimdata="var dsjsfuncs = ,null,,,,[{nm:\"refresh\",lcnm:\"refresh\",flg:0xb},{nm:\ \"install\",flg:0xf},{nm:\"writeln\",flg:0x3f},{nm:\ "gotourl\ \",flg:0xe},{nm:\"addroot\",lcnm:\"addroot\",flg:0xb},{nm:\ \"loadurl\",lcnm:\"loadurl\",flg:0xb},{nm:\"addrule\ ",flg:0xf}, {nm:\"posturl\",lcnm:\"posturl\",flg:0x12},{nm:\ "replace\ \",flg:0x12f},],[{ could please let know if have observed such occurances / findings. any helps appreciated. thanks, sudipta ghosh try use htmlcodeformat() or htmleditformat() . see docs .

mfc - Intercept pasting to a (rich) edit control -

i want override default behavior when text pasted rich edit control. specifically, want paste plain-text, not formatted rich-text. guess boils down getting data different clipboard format, don't know how intercept default behavior first. for reference, have: class mydialog : public cdialog { cricheditctrl m_edit; }; and relevant ddx_control(pdx, idc_edit1, m_edit) set in cpp file. since don't think cricheditctrl has facility built-in control paste-formatting, how can set elegantly? when google, find lots of people manually capturing ctrl+v, etc... not horrible won't work in languages paste key isn't v! you intercept en_update instruction , re-format text when receive that? problem don't know new data has been added. you may, though, find easier override cricheditctrl own , intercept whichevere messages want processing on incoming data , call parent class's implementation of function. way everytime added performing necessary re-formats .....

ado.net - SQL Server CE and C#; Populate a DataSet with ALL the Tables from a SQL Server CE DB -

how populate dataset tables sql server ce database. possible in 1 sql select statement? i know can call separate select statements names of table need data need generic solution dumps tables sql server ce database dataset. thanks select 'select * ' + table_name information_schema.tables run queries. run each query, dumping in same dataset. this works easy. edit: think had problems trying run multiple queries in single go sql ce (even line terminator ; ).

java - statement.getGeneratedKeys() and MySQL -

i've learned hard way last_insert_id in mysql not pool-safe. i.e. if pooling connections, you'll messed insert_ids. how java's statement.getgeneratedkeys() key on inserts? pool-safe? i quoting relevant text mysql connector/j internals here: you should aware, @ times, can tricky use 'select last_insert_id()' query, function's value scoped connection. so, if other query happens on same connection, value overwritten. on other hand, 'getgeneratedkeys()' method scoped statement instance, can used if other queries happen on same connection, not on same statement instance.

c# - ASP.NET HTTP to HTTPS redirect with www prefix -

i using simple code redirect http https on billing landing page: if (!request.issecureconnection) { // send user ssl string servername =httputility.urlencode(request.servervariables["server_name"]); string filepath = request.filepath; response.redirect("https://" + servername + filepath); } i need check , add www url if not in url. need add code accomplish this? like this: if (!servername.startswith("www.")) servername = "www." + servername;

animated gif - How to make favicon animation loop continuously? -

i using favicon on site 30 frames animation. after favicon 30th frame plays, animation stops. i need favicon loop continuously. how can achieve that? i think gif icon not set looping. download unfreeze , check favicon loop. @ here step step tutorial.

jquery - GalleryView - filmstrip navigation w/o changing a picture in a panel -

how navigate thru galleryview filmstrip without changing picture in panel? can not find property this. galleryview pretty popular hope, know how simple. possibility change gallery code, hope there better solution. flag maybe? currently have following settings: $('#gallery').galleryview({ panel_width: 600, panel_height: 300, frame_width: 120, frame_height: 75, transition_interval: 0, background_color: '#222', border: 'none', easing: 'easeinoutback', pause_on_hover: true, nav_theme: 'custom', overlay_height: 52, filmstrip_position: 'top', overlay_position: 'top', nav_theme: 'dark', frame_scale: 'crop', frame_opacity: 0.7, start_frame: 2, fade_panels: false }); set transition_interval: -1 . 0 have specified indicates no interval transition has ended next 1 starts.

html - appending DIV comes vertically -

in below code, progressdiv div getting build up. getting build vertically... need horizontally... shud ? var progressdiv = document.getelementbyid('progressdiv') var div = document.createelement('div'); div.style.display = 'block'; div.style.cssfloat = 'left'; div.style.width = '10px'; div.style.height = '10px'; div.style.backgroundcolor = 'red'; div.style.border = '1px solid black'; progressdiv.appendchild(div); if (progressdiv.childnodes.length == 20) while (progressdiv.haschildnodes()) progressdiv.removechild(progressdiv.firstchild); ah, old ie. if make div span , set style inline-block , , drop float, should work: var progressdiv = document.getelementbyid('progressdiv'); var span = document.createelement('span'); span.style.display = 'inline-block'; span.style.width = '10px'; span.style.height = '10px...

Replace href value in anchor tags of html using XSLT -

i want replace value of href tags in html using xslt. example: if anchor tag <a href="/dir/file1.htm" /> , want replace href value this: <a href="http://site/dir/file1.htm" /> . point want replace relative urls absolute values. i want anchor tags in html content. how can using xslt? thanks. edit: google appliance. display results in frame , links doesn't work in cached page. takes address bar url root. here html in form of string, , displays html based on condition. can suggest way replace href tags in string? this xslt 1.0 transformation : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:param name="pservername" select="'http://myserver'"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-tem...

javascript - Chrome problems -

i have few annoying problems. thing is, when looking firefox every thing work perfect, after try chrome, happens code appears 1 web page (it not time). so, appears in input text display " />" or piece of code of java script, written inside input tag. the web page is: www.kalahoo.eu (do not try in english ) in picture can see problem: http://rhc.si/slike/problem.png thank help!!! can post link exact page error? either way, imagine if use chrome developer tools, should pointed in right direction. might want give try.

html - images stretched in Chrome -

the 2 images in right-hand column of webpage have been vertically stretched 500% of intended size when viewed in google chrome. in firefox/ie fine. the relevant html markup is <div class="right_column"> <div class="photo"> <img height="80%" width="80%" alt="chalet" src="photos/slides/dscf0024.jpg"/> </div> <div class="photo"> <img height="80%" width="80%" alt="bateaux" src="photos/slides/dscf0418.jpg"/> </div> </div> and css is: .right_column { float:right; overflow:hidden; padding:0 5px 0 0; width:275px; } .photo img { border:1px solid #666666; margin-top:30px; padding:4px; } edit i've fixed problem , have removed link webpage (in case of confusion) do not use both. use width="80%" . don't kn...

Losing session in ASP.NET C# -

i'm having problem of losing session variable on website. append @ random times there no particular behavior cause this. can cause of session lost? i've read everywhere on site put session in "sql server" mode written on server, can solution? my server on 1and1 shared hosting, can fault? thanks ! check hosting provider application not being hosted on load balanced server. if server being load balanced, users lose session state information when load balancer sends request server. there 3 settings session state mode property: inproc - store state information locally on server request made (only effective when application being hosted on single server in non-load balanced environment) stateserver - allows specially configured server host state information entire web farm (i believe stateserver began offered on .net framework v2.0). sqlserver - allows specially configured sql server instance store session information web farm [this information var...

C# Combine methods by passing in field type? -

i wasn't sure how title question correctly here i'm trying do. say have class customer has id, firstname, , lastname field. have list of customers , want write 1 method write id, firstname, or lastname console depending on 1 specify. in essense, write 1 method accepts field print out instead of writing 3 seperate methods print out each field type. i know have read how in c# on past few days brain on overload , slipping mind.... any appreciated. public void printcustomer<t>(customer c, func<customer, t> func) { console.writeline("{0} , {1}", c.id, func(c)); } usage: printcustomer(mycustomer, c => c.firstname); or printcustomer(mycustomer, c => c.lastname);

excel - Insert a Row to a Specific Set of Columns -

i'm working on spreadsheet act master copy important information kept track of project. on main sheet have table notes , table contacts set separated several columns , vb code insert new notes or new contacts. however, when insert new note want appear @ top of table , move existing notes down row. there way add row specific set of columns other data kept on cells same row, in different table, not moved? a basic example: dim rng range set rng = worksheets("sheet1").range("a2:d2") rng.insert shift:=xldown ...assuming want insert 1 row of cells above cells located in a2:d2.

graph - javascript framework for relationship visualization -

possible duplicate: graph visualization code in javascript? i need create dynamic visualization nodes , relationships in javascript. what's best framework use? i've briefly reviewed far: flare - it's flash , hasn't been updated in 2 years. javascript infovis toolkit - interaction seems little slow, maybe that's on purpose in demos protovis - documentation looks great, doesn't work in ie @ (can work kind of ie svg adapter?) are these best displaying nodes in graph , interacting them in javascript? infovis seems great compared framework i've seen before, here i've found when looking such framework (a long time ago): jsgraph - if you're looking "simplicity" binviz - visualisation , interaction of graph

grails - Making .war smaller -

there several tutorials , posts here shrinking .war files. however, common technique (to include grails.war.resources = {} in config.groovy) not seem work me. no matter what, grails dumps war file making 25meg .war. has functionality changed? grails 1.3.4 im on 1.2.0 grails war --nojars creates war no jars. you have make sure jars installed on wherever deploying, $tomcat/shared/lib for tomcat.

process management - How do I develop a system of checks and balances for coders -

how get multiple developers working on same wordpress blog or same code type of website be able preview changes have control on , who's changes implemented have ability undo changes if break something? what asking "how manage development team?" you need source control system (of there many, free, good). but having not going fix problem - need development process follow. there many development processes (ideologies) out there, better others, none of them should used in totality (you end using bits , pieces several, use fits needs). the process dictates what developers should do. source control system helps how done. using source control, can branch , merge code, , dictate changes make release version of product. once have source control system in place, , process of reviewing , vetting changes made code, , automated build process (if applicable), end result cleaner - if implemented there should no need "undo changes if break something...

jsf - Primefaces lightBox problem -

i have created page primefaces use lightbox component. i use in dynamic matter create tumbnails on fly servlet call. the first page shows nice , lightbox works expected when load new set of pictures next page pictures shown when click on it, shows original picture in new page, when return previous button , click on a thumbnail works expected. this jsf code: <h:outputlabel id="curpage" value="#{picturebean.currentpage}" /> <h:commandbutton value="next" action="#{picturebean.nextpage}" id="next"> <f:ajax render="lightbox curpage" /> </h:commandbutton> <br/> <p:lightbox height="500px" id="lightbox"> <ui:repeat value="#{picturebean.pictures}" var="pic"> <h:outputlink value="#{pic.url}" title="#{pic.description}"> <h:graphicimage value="#{pic.urlthumb}" s...

osx - how to edit .globalpreferences.plist without logout and login? -

i want make kiosk application on mac. want disable hotkeys can done editing .globalprefernces.plist file requires re-login system not want, similar system preferences application. thanks in advance, amit you don't need edit file (and should not) make kiosk application. see -[nsapplication setpresentationoptions] . includes following options: nsapplicationpresentationdefault = 0, nsapplicationpresentationautohidedock = (1 << 0), nsapplicationpresentationhidedock = (1 << 1), nsapplicationpresentationautohidemenubar = (1 << 2), nsapplicationpresentationhidemenubar = (1 << 3), nsapplicationpresentationdisableapplemenu = (1 << 4), nsapplicationpresentationdisableprocessswitching = (1 << 5), nsapplicationpresentationdisableforcequit = (1 << 6), nsapplicationpresentationdisablesessionterminati...

javascript - Adding days to a date - date getting converted to string -

so i'm trying add number of days date, , i'm getting strange issue: var date = new date(); var newdate = date.getdate() + $('#ddldays option:selected').val(); date.setdate(newdate); so if today 09/29/2010, date 29. if user selects "5" ddldays, assume adding strings together, adding 295 days date. i under impression javascript assume integers? getdate() return string instead of integer? how can fix this? if want add selected value day of month (i.e. 29 + 5), need parse string value int: var newdate = date.getdate() + parseint( $('#ddldays option:selected').val(), 10); but if want new date, rather int, result, can this: date.setdate( date.getdate() + parseint( $('#ddldays option:selected').val(), 10);

jquery: change height of element in upper direction -

i'm trying make "hover" effect change height of li (list) element upward. using jquery, i've managed change height of element downwards. possible change direction upwards? http://www.izrada-weba.com/vedranmarketic/ css file: body{ background-color: #252524; text-align: center; } #centriranje{ width: 1017px; margin-left: auto; margin-right: auto; text-align: left; } #header{ height: 90px; background: url(img/bg-head.gif) repeat-x; margin-top: 20px; } #logo{ height: 90px; width: 237px; float: left; } #izbornik{ width: 780px; height: 90px; float: left; } #izbornik ul{ margin: 39px 10px 0px 0px; padding: 0px; list-style-type: none; overflow: hidden; position: absolute; } #izbornik ul li{ float: left; width: 36px; height: 41px; margin-right: 2px; background-position: top; background-repeat: no-r...

metaprogramming - Ruby (MRI) Syntax Tree nodes documentation -

the meaning of nodes mri's syntax tree can infered. list quite long (source: bin/parse_tree_abc ): :attrasgn, :attrset, :dasgn_curr, :iasgn, :lasgn, :masgn, :and, :case, :else, :if, :iter, :or, :rescue, :until, :when, :while, :call, :fcall, :super, :vcall, :yield, :args, :argscat, :array, :begin, :block, :block_arg, :block_pass, :bool, :cfunc, :colon2, :const, :cvar, :defined, :defn, :dregx, :dstr, :dvar, :dxstr, :ensure, :false, :fbody, :gvar, :hash, :ivar, :lit, :long, :lvar, :match2, :match3, :nil, :not, :nth_ref, :return, :scope, :self, :str, :splat, :to_ary, :true, :unknown, :value, :void, :zarray, :zarray, :zclass, :zsuper since python's ast manipulation builtin library, documentation far better . there place nodes parse tree's syntax tree documented? there no such thing ruby ast, therefore there no documentation it. every implementation has own ast, might or might not documented. besides, talking not abstract syntax tree parse tree (aka concrete s...

c# - Call a method when specific key combination is pressed anywhere in the app, as long as application is currently focused window -

my objective allow users of app bringup i'm calling debug console pressing ctrl + f11 on keyboard. simply put, need call toggledebug(); method, enable debug tracing code , display window. i'd application @ point when ctrl + f11 pressed, regardless of user has focus cursor long application focused window. my app deployed through click once -- partial trust type environment. in old vb6 app, had been using wend loop call doevents() , windows api call... needless say, i'm hoping there better way now. you can handle previewkeydown event of window. public mainwindow() { initializecomponent(); this.previewkeydown += new keyeventhandler(mainwindow_previewkeydown); } void mainwindow_previewkeydown(object sender, keyeventargs e) { if ((e.key == key.f11) && (keyboard.modifiers == modifierkeys.control)) { } }

Flex Tree Custom Tree View -

i have xml string fetched remote object like: <metadata> <system name="a"> <servicegroup name="sg1"> <version id="id1" /> <service name="s1"/> </servicegroup> <servicegroup name="sg2"> <version id="id2" /> <servicegroup name="sg3"> <version id="id3" /> <service name="s2"/> </servicegroup> </servicegroup> </system> . . . . </metadata> as xml sample shows, contains nested servicegroups. have display services,and servicegroups. , ignore else..eg. version services viz. s1 , s2 should leaf nodes, else must parent e.g. ->a --->sg1 ------>s1 ---->sg2 ------>sg3 --------->s2 . . . i tried kind of things, using labelfunctions, labelfield properties tree doesn't help. end un-labelle...

In Eclipse, how do I see the input to Assert.assertEquals when it fails? -

i'm not of eclipse guru, please forgive clumsiness. in eclipse, when call assert.assertequals(obj1,obj2) , fails, how ide show me obj1 , obj2? i'm using jexample , guess shouldn't make difference. edit : here's see: http://img86.yfrog.com/img86/3002/jexample.png . if information in junit view not enough you, can set exception breakpoint on, example, java.lang.assertionerror. when running test, debugger stop before exception being thrown.

Cython conditional compile based on external value -

i try conditionally compile (or generate) c code cython pxd. read can def define aa value , if conditionally generate based on value, how can value outside of pxd file? specifically these 2 cases interesting me now: give command-line define cython, preferrably through cython.distutils setuptools way the extern-ed c header file defines value, , conditionally define using cython based on value (maybe impossible now?) thank you you generate pxi file, , include before doing if (same ./configure generate config.h too.) in kivy setup.py example : c_options = { 'use_opengl_es2': true, 'use_opengl_debug': false, 'use_glew': false, 'use_mesagl': false} print 'generate config.pxi' open(join(dirname(__file__), 'kivy', 'graphics', 'config.pxi'), 'w') fd: k, v in c_options.iteritems(): fd.write('def %s = %d\n' % (k.upper(), int(v))) and then, in pxd : include "config.pxi...

php - Whcms domain whois API doesn't work -

so here code: <?php $url = "http://www.site.com/whcms/includes/api.php"; # not original url, exapmle $username = "user"; # admin username goes here $password = "pass"; # admin password goes here $postfields["username"] = $username; $postfields["password"] = md5($password); $postfields["action"] = "domainwhois"; #action performed api:functions $postfields["domain"] = "whmcs.com"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_timeout, 100); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_postfields, $postfields); $data = curl_exec($ch); curl_close($ch); echo(var_dump($data)); ?> i this: string(44) "result=error;message=invalid ip 89.24.47.30;" what i'm doing wrong? solution found! go admin panel, general settings -> security , add ip address

deployment - Common Controls 6.0 in Windows 2000? -

i'm wanting use grouping in clistctrls, seems have been introduced in common controls 6. cc6 came out xp, have problem windows 2000 , earlier. deploying new version of comctl32.dll seem solution - however, our software has requirement of being standalone executable. is there solution problem? unfortunate information microsoft: unlike earlier versions of comctl32.dll, version 6 not redistributable. way can use version 6 of dynamic-link library (dll) use operating system contains it. found at: http://msdn.microsoft.com/en-us/library/ms997646.aspx

ENOENT while creating a UNIX socket in Ruby -

i'm trying create socket in ruby using require "socket" w = unixsocket.new("socket") and keep running into no such file or directory - socket (errno::enoent) this looks backwards me, because new() supposed create missing file. missing? this super old. please don't try use verbatim anymore. http://blog.antarestrader.com/posts/153 #!/ruby file = 'path/to/my/socket' file.unlink if file.exists(file) && file.socket?(file) server = unixserver.new(file) # return unixsocket once connection made socket = server.accept # socket ready communicate. unixserver makes socket, unixsocket connects existing socket.

java - How can I run initialization code during axis2 startup? -

i have 3rd party library use in webapp. need call init method library during axis2 startup. i can't wait until first request comes in - must done @ startup. in web.xml: <listener> <listener-class>com.my.yourservletcontextlistener</listener-class> </listener> where yourservletcontextlistener has implement javax.servlet.servletcontextlistener , provide initialization code in contextinitialized(..) method. this method called servlet context loaded.

Run a command using PowerShell on each directory with an assumed path component -

i found this question , very similar want couldn't work. i want run process.exe on each subdirectory's xml directory of c:\toprocess. if did hand, first 6 of 50 or commands this: process.exe -switch1 -switch2 -i "c:\toprocess\abx\xml" -o "c:\processed\abx\xml" process.exe -switch1 -switch2 -i "c:\toprocess\dez\xml" -o "c:\processed\dez\xml" process.exe -switch1 -switch2 -i "c:\toprocess\ghm\xml" -o "c:\processed\ghm\xml" process.exe -switch1 -switch2 -i "c:\toprocess\jkq\xml" -o "c:\processed\jkq\xml" process.exe -switch1 -switch2 -i "c:\toprocess\mn0\xml" -o "c:\processed\mn0\xml" process.exe -switch1 -switch2 -i "c:\toprocess\pq2\xml" -o "c:\processed\pq2\xml" but before running commands, have this, because target folders not yet exist: md "c:\processed\abx" md "c:\processed\dez" md "c:\processed\ghm" md "c:\pr...

ruby on rails - Case statement in a view -

i have auditlog things id, action, type, description... what i'd in view like: case description when "created" <li>created styling</li> when "deleted" <li>deleted styling</li> else <li>error</li> end trying learn how in view , correct syntax, resources found on google don't specify. if styling contains lots of tags , html elements, suggest putting them partials: <%= render :partial => @audit_log.description rescue nil %> if description created , render file _created.html.erb in same folder current view if deleted , render _deleted.html.erb automatically. if description else, has no _something.html.erb file, nothing displayed (without rescue nil , error occurs) ====== if want render partial in different folder, <%= render :partial => "some/where/#{@audit_log.description}" %>

c - Delete all shared memory and semaphores on Linux -

how can delete not used semaphores , shared memory single command in ubuntu? here, save , try script (kill_ipcs.sh) on shell: #!/bin/bash me=`whoami` ipcs_s=`ipcs -s | egrep "0x[0-9a-f]+ [0-9]+" | grep $me | cut -f2 -d" "` ipcs_m=`ipcs -m | egrep "0x[0-9a-f]+ [0-9]+" | grep $me | cut -f2 -d" "` ipcs_q=`ipcs -q | egrep "0x[0-9a-f]+ [0-9]+" | grep $me | cut -f2 -d" "` id in $ipcs_m; ipcrm -m $id; done id in $ipcs_s; ipcrm -s $id; done id in $ipcs_q; ipcrm -q $id; done we use whenever run ipcs programs in university student server. people don't cleanup so...it's needed :p

javascript - Get the reference name of an object? -

i have object inside object: function textinput() { this.east = ""; this.west = ""; } textinput.prototype.eastconnect = function(object) { this.east = object; object.west = this; } textinput1 = new textinput(); textinput2 = new textinput(); textinput1.eastconnect(textinput2); puts(textinput1.east.name) // gives undefined. in last statement want print out object's reference name, in case: textinput2. how do that? objects exist independently of variables reference them. new textinput() object knows nothing textinput1 variable holds reference it; doesn't know own name. have tell name if want know. store name explicitly. pass name constructor , store off in .name property it's accessible later: function textinput(name) { // added constructor parameter. this.name = name; // save name later use. this.east = null; this.west = null; } textinput.prototype.eastconnect...

Python and C interaction - callback function -

i'm trying make key logger mac os 1 of research projects. have c code grab keystroke , write them text file. (the following code have taken out not important stuff) what need pyhook, instead of write data text file, pass python callback function c code , make passes key input python, can necessary analysis python. i have how it, have no idea how approach this, not used c programming or python extensions. appreciated. #include <carbon/carbon.h> #include <applicationservices/applicationservices.h> #include <unistd.h> #include <stdio.h> #include <sys/time.h> #define num_recording_event_types 5 #define record 0 #define mouseaction 0 #define keystroke 1 // maximum expected line length, fgets #define line_length 80 #define kshowmouse true osstatus ruirecordingeventoccurred(eventhandlercallref nexthandler, eventref theevent, void *userdata); void preparetorecord(); // install event handler, wait record signal // note keyboard character codes fo...

Transfer files from windows machine to remote solaris machine using python script -

i used following code establish connection between local machine , remote machine : import os, sys, ftplib nonpassive=false remotesite= '10.88.203.21:22' remoteuser='root' remotepass='v-peg8!@#' localdir= "c:\\.." print "connecting" connection=ftplib.ftp(remotesite) print "successfully connected" connection.login(remoteuser,remotepass) if nonpassive: connection.set_pasv(false) but giving me following error: socket.gaierror: [errno 11001] getaddrinfo failed.. can plz me out this. you need specify port separate argument, not in way have in remotesite . try: remotesite = '10.88.203.21' port = 22 connection = ftplib.ftp(remotesite, port) see ftp docs more information.

sql server - Do the order of JOINs make a difference? -

say have query 1 below: select t1.id, t1.name table1 t1 --800,000 records inner join table2 t2 --500,000 records on t1.fkid = t2.id inner join table3 t3 -- 1,000 records on t1.otherid = t3.id would see performance improvement if changed order of joins on table2 , table3. see below: select t1.id, t1.name table1 t1 --800,000 records inner join table3 t3 -- 1,000 records on t1.otherid = t3.id inner join table2 t2 --500,000 records on t1.fkid = t2.id i've heard query optimizer try determine best order doesn't work. version of sql server using make difference? the order of joins makes no difference. what make difference ensuring statistics date. one way check statistics run query in ssms , include actual execution plan. if estimated number of rows different actual number of rows used part of execution plan, statistics out of date. statistics rebuilt when related indexes rebuilt. if production maintenance window allows, update statistics every night. th...

c++ - What is the most effective way to get the index of an iterator of an std::vector? -

i'm iterating on vector , need index iterator pointing at. afaik can done in 2 ways: it - vec.begin() std::distance(vec.begin(), it) what pros , cons of these methods? i prefer it - vec.begin() precisely opposite reason given naveen: wouldn't compile if change vector list. if during every iteration, end turning o(n) algorithm o(n^2) algorithm. another option, if don't jump around in container during iteration, keep index second loop counter.

c# - Receiving a 500 internal server error when I have a '%' symbol in the query string -

i trying diagnose problem client site has come across. when address search on website can specify % symbol wildcard searches. example can search be% return belfast etc. this queries database , redirects results page, passing search criteria in querystring example results.aspx?criteria=search%20criteria%20is%20be% this caused problems if searched %belf %be reserved character in url encoding. therefore coded replace % %25 (url encoding representation of % symbol). works fine on test machine, url results.aspx?criteria=search%20criteria%20is%20%25be . this doesn't work on our clients website reason , can't work out why. page keeps error-ing with: error code: 500 internal server error. request rejected http filter. contact server administrator. (12217) any time search %be %fa %fe etc etc does know if there iis setting or similar? you might have urlscan installed on server. urlscan intercepts requests , reject them if detects invalid ...

c# - Defining my own Where-Method for LINQ to Objects - How do I know which one will get used? -

just testing reasons, defined own where-method linq so: namespace test { public static class linqtest { public static ienumerable<tsource> where<tsource>( ienumerable<tsource> source, func<tsource, bool> predicate) { return new list<tsource> { }; } } } so if use query this, never result: var test = new string[]{ "a", "b", "c" }; var x = y in test y.length > 0 select y; foreach (var element in x) console.writeline(element); my question is: how compiler know extension method supposed called? 1 included in linq, or user-defined one? cheers, chris the rules extension method similar normal method call lookup. short version compiler find of methods , extension methods of name accessible , choose best match among (with non-extension methods being preferred on extension ...

ruby on rails - How do i download prawn pdf file while using form submit? -

def index @forms = form.all respond_to |format| format.html end end def submit respond_to |format| format.pdf {render } end end submit.pdf.prawn file pdf.text "successfully submitted" it possible prawn generate , return pdf without having to save locally... def submit send_data(generate_pdf, :filename => "output.pdf", :type => "application/pdf") end private def generate_pdf prawn::document.new text "hello stackoverflow" end.render end

javascript - Fade in AJAX loaded content? -

var request = new request({ method: 'get', url: 'onlinestatusoutput.html.php', oncomplete:function(response) { $('ajax-content').get('tween', {property: 'opacity', duration: 'long'}).start(0).set('html', response).set('html', response).tween('height', [0, 650]); } }).send(); before load desired content div, have text says "loading content...". what i'd fade out text says "loading content...", , fade in content loaded in ajax request. how accomplish this? i tried using fade('in') , fade('out') methods, didn't work. tried call get() method , set opacity 1 via start(1), didn't work either. you don't need instance of fx.tween , apply start, use element prototype .fade you. only thing need set oncomplete (as cannot async) replace content, remove oncomplete , fade in. check jsfiddle demo: http://www.jsfiddle.net/dimitar/nf...

wordpress - CSS selector to use for sIFR menu -

i've used sifr simple applications headings, i'm trying use 2 different fonts simultaneously - 1 heading , 1 menu. heading works, not menu. i'm using tofurious wordpress theme. section of theme's stylesheet governs menu font , link styles: /*menu colors****************/ #menu { background:#bc7d90; } #menu li { font:11px arial, helvetica, sans-serif; /*menu font styles*/ text-transform: uppercase; color:#fff; /*menu font color*/ } #menu li a:hover { color:#ecd1d9; /*menu font color when hovering*/ } i entered #menu li item replace on sifr settings page, , used code: .sifr-root { font-size:15px; font-weight:normal; color:#fff; } { text-decoration:none; color:#fff; } a:hover { color:#fff; } the font appears - not of styles specified above, , appears on blog in unexpected way. can see example @ address: www.laurenparkinson.com/blog also, actual sub-menu items not appearing @ all. you'll big favor ditching sifr @font-face supported in majo...