Posts

Showing posts from August, 2014

How do I get the id or name of an element in watir? -

watir can find text on page: <span id="i1" name="n1>some text</span> e.text.include?("some text") but how can name or id of span, when know "some text" e.text.findinpage("some text").parentelement.id (should "i1") e.text.findinpage("some text").parentelement.name (should "n1"); something exists in watir? browser.span(:text => "some text").id => "i1" browser.span(:text => "some text").name => "n1" tested on windows, ruby 1.8.6, watir 1.6.5, internet explorer driver.

php - Implementing Form that Might Result in Different Queries -

i have form needs allow people search hikes, hiking groups, or hikers, depending on radio button choose within form. obviously, in either of these 3 cases, query of different tables in database, , have different usability down road. shouldn't process of these in 1 place assuming. guys agree? what might practice way handle such case? tried redirecting request single form processing modules, had trouble making post request in url trying redirect. ideas/suggestions appreciated, alex i don't see problem handling 1 form. pass on search type , build appropriate query based on type, search terms, etc. if queries totally different, sounds input gathering pretty simple. may want display results different pages, processing can handled 1 form , 1 script. quick example: //get variables out of post if ($search_type == "hike") { //put hike query, results //call script display hikes } elseif ($search_type == "group") { //put group q...

Google Earth KML -

how links cities curve (line) in kml google earth? first, since on i'm assuming asking kml perspective , not in desktop application. need have coordinates of 2 cities. create kml document following docs using coordinates in coordinates element (note don't need "lookat" element, bring camera relevant area): <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <document> <name>linestring.kml</name> <open>1</open> <lookat> <longitude>-122.36415</longitude> <latitude>37.824553</latitude> <altitude>0</altitude> <range>150</range> <tilt>50</tilt> <heading>0</heading> </lookat> <placemark> <name>unextruded</name> <linestring> <extrude>1</extrude> <tessellate>1</tessellate> ...

How to find with javascript if element exists in DOM or it's virtual (has been just created by createElement) -

i'm looking way find if element referenced in javascript has been inserted in document. lets illustrate case following code: var elem = document.createelement('div'); // element has not been inserted in document, i.e. not present document.getelementbytagname('body')[0].appendchild(elem); // element can found in dom tree jquery has :visible selector, won't give accurate result when need find invisible element has been placed somewhere in document. here's easier method uses standard node.contains dom api check in element in dom: document.body.contains(my_element); cross-browser note : document object in ie not have contains() method - ensure cross-browser compatibility, use document.body.contains() instead. (or document.head.contains if you're checking elements link, script, etc)     notes on using specific document reference vs node-level ownerdocument : someone raised idea of using my_element.ownerdocument.contains...

contextmenu - InstallShield 2009: Remove a dll (being used by explorer.exe for context menu) during uninstall without any warning message -

install shield premier 2009: basic msi project have dll supposed removed during uninstall. but dll being used explorer.exe , used generating windows explorer context menus icons(same menu items, icons see when right click on file/folder , see winrar items, icons ). manually , have unregister dll , close explorer.exe task manager , again run explorer.exe. can delete dll. so install shield how delete dll without problem(as see while uninstalling winrar or other software there no problem no message boxes shown , related context menu icons removed).

java - Hessian vs Tibco rv -

i'm looking contrast tibco rv , hessian in terms of performance - java application. any pointer me started appreciated. thanks. depends mean "performance". i have had lot of tibco experience no hessian can comment of rv side of things. rv makes efficient (and mean efficient) use of network , server resouces, makes extensive use of tcp/ip broadcast avoid sending same message n clients. additionally messages not sent directly clients end point on machine forwards message clients logged on machine. additionaly core product several years old , designed run on considered quite modest harware circa 1995 ( single processer 200 mhz 256mb memory sparcstation have been typical server end! ) on todays hardware can handle vast volume of messages while sitting twoards bottom of "top" list. there couple of downsides (compared webshpere mq); transactional support limited , not mq or database standards plus there no built in guarenteed delivery or "...

sql - Auto Increment Problem -

using sql server table1 id name 001 raja 002 ravi 003 suresh 004 kamal ... i need create new table , make identity each column tried query insert table2 select * table1 expected output s.no id name 1 001 raja 2 002 ravi 3 003 suresh 4 004 kamal ... i create new table , made s.no column identity in table. creating identity number each row, delete row, again inserted, identity created last row next number onwards. example s.no id name 1 001 raja 2 002 ravi 3 003 suresh 4 004 kamal ... delete rows, again inserted. s.no id name 5 001 raja 6 002 ravi 7 003 suresh 8 004 kamal ... expected output identity should start number 1 onwards whenever deleting rows table. need query help that's not how identity works. deleting stuff won't reset identity field. have reseed it: dbcc checkident ( ‘databasename.dbo.yourtable’,reseed, 0) -- start 1

html - Print perfect web word processor? -

i'm looking web based word processor. i'd prints user sees on screen. it's internal app don't need available through internet. you find very hard have consistent experience on screen , on users's computers. if can control environment point can force users use same browser on same os you'll fine, otherwise should try more hybrid approach. can have slight print variations works fine. google docs uses verry interesting method presenting info user before printing. they convert page pdf, prior printing , there can see printed or not. if you're go, shot. if not can come textarea , keep iterating.

scala - Declaring functions two ways. What is the distinction? -

are these 2 function declarations different? if not, why have different tostring values? scala> def f: (int) => int = x=> x*x f: (int) => int scala> def f(x: int) = x*x f: (int)int the first no-argument method f1 returns function1[int, int] . scala> def f1: (int => int) = (x: int) => x * x f1: (int) => int the second 1 argument method f2 takes an int , returns int . scala> def f2(x: int): int = x * x f2: (x: int)int you can invoke f1 , f2 same syntax, although when call f1(2) expanded f1.apply(2) . scala> f1 res0: (int) => int = <function1> scala> f1(2) res1: int = 4 scala> f1.apply(2) res2: int = 2 scala> f2(2) res3: int = 4 finally, can 'lift' method f2 function follows. scala> f2 <console>:6: error: missing arguments method f2 in object $iw; follow method `_' if want treat partially applied funct ion f2 ^ scala> f2 _ res7: (int) => int = <function1...

iphone - UILabel not updating -

sorry basic question, bugs me while now. i create details view uitable , try dynamically set labels, not updating: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { myobject *tmpobj = [[myobject objectatindex:indexpath.section] objectatindex:indexpath.row]; myviewcontroller *tmpvc = [[myviewcontroller alloc] initwithnibname:@"nibfile" bundle:nil]; [tmpvc.mylabel settext:tmpobj.mytitle]; // debugger shows text: mytitle = "mytext" nslog(@"%@", tmpvc.mylabel); // nslog shows null [self.navigationcontroller pushviewcontroller:tmpvc animated:yes]; [tmpobj release]; } the connections in interface builder set. connections tab file owner shows 'mylabel' - 'label (mylabel)' any ideas why value not coming through? a few more observations: i have ibaction connected. method called when click connected button. i got few pointers nslog-statement, whether should ...

mysql - Foreign key pointing to different tables -

i'm implementing table per subclass design discussed in previous question . it's product database products can have different attributes depending on type, attributes fixed each type , types not manageable @ all. have master table holds common attributes: product_type ============ product_type_id int product_type_name varchar e.g.: 1 'magazine' 2 'web site' product ======= product_id int product_name varchar product_type_id int -> foreign key product_type.product_type_id valid_since datetime valid_to datetime e.g. 1 'foo magazine' 1 '1998-12-01' null 2 'bar weekly review' 1 '2005-01-01' null 3 'e-commerce app' 2 '2009-10-15' null 4 'cms' 2 '2010-02-01' null ... , 1 subtable each product type: item_magazine ============= item_magazine_id int title varchar product_id int -> foreign key product.product_id issue_number int pages int copies int close_date da...

does lucene search function work in large size document? -

i have problem when search lucene. first, in lucene indexing function, works huge size document. such .pst file, outlook mail storage. can build indexing file include information of .pst. problem large sometimes, include words. so when search using lucene, can process front part of indexing file, if 1 word come out part of indexing file, couldn't find word , no hits in result. when separate indexing file several parts in stupid way when debugging, , searching every parts, can work well. so want know how separate indexing file, how size should limit of searching? cheers , wait 4 reply. ++++++++++++++++++++++++++++++++++++++++++++++++++ hi,there, follow coady siad, set length max 2^31-1. search result still can't include want. simply, convert doc word string array[] analyze, 1 doc word has 79680 words include space , symbol. when search word, return 300 count, has more 300 results. same reason, when search word in part of doc, couldn't find. //////////////set...

php - Does the curl library execute javascript inside pages? -

i'm working few pages javascript executes form submission on page load. does curl library automatically execute javascript in web pages? if does, there way return changed dom instead of default 1 i'm returning simple curl code. here's currentcode: $curl_handle=curl_init(); curl_setopt($curl_handle,curlopt_url,$url); $buffer = curl_exec_follow($curl_handle,10); curl_setopt($curl_handle,curlopt_header, 0); curl_setopt($curl_handle,curlopt_followlocation, 1); $buffer = curl_exec($curl_handle); no, not. not apply css styles either.

vim & git submodules: how to put my own files into submodules? -

i using vim pathogen , plugins installed submodules. works great, i've got problem 1 plugin - xptemplate. requires putting personal code snippets specific directory "bundle/xptemplate/personal/". i've created personal snippet ruby , put in "bundle/xptemplate/personal/ruby/ruby.xpt.vim" , works... doing "git submodule update" reverts work. , updating plugins thing time time. disadvantage cannot clone vim config on machine - had copy file manually. is there way right? thought adding "personal/*" .gitignore file in "bundle/xptemplate". have not tested it, if worked solve problem reverting work submodule update, , not allow me push snippets github. i appreciate help. this independent of vim , pathogen, general answer how submodules can used. if want modify submodule of project, must following: end new commit checked out in submodule (for example committing it) add updated submodule superproject, , commit that ...

Bazaar split and & Rich Roots -

i make directory of branch seperate repository. bzr split <dir> looks coomand bzr: error: use feature must upgrade branch @ file:///c:/blahblah/ format supports rich roots. what mean the current trunk you're using (at c:\blahblah ) not support rich roots (older versions of bazaar use pack-0.92 default, apparently not rich-root compatible). you need use bzr upgrade upgrade branch, error message says. couple of possible arguments bzr upgrade include: --rich-root --rich-root-pack --1.9-rich-root try bzr upgrade more details, or see bazaar's page on upgrading branches .

regex - Java regular expression -

i want replace 1 of these chars: % \ , [ ] # & @ ! ^ ... empty string (""). i used code: string line = "[ybi-173]"; pattern cleanpattern = pattern.compile("%|\\|,|[|]|#|&|@|!|^"); matcher matcher = cleanpattern.matcher(line); line = matcher.replaceall(""); but doesn't work. what miss in regular expression? there several reasons why solution doesn't work. several of characters wish match have special meanings in regular expressions, including ^ , [ , , ] . these must escaped \ character, but, make matters worse, \ must escaped java compiler pass \ through regular expression constructor. so, sum step one, if wish match ] character, java string must "\\]" . but, furthermore, case character classes [] , rather alternation operator | . if want match "any of characters a , b , c , looks [abc] . character class [%\,[]#&@!^] , but, because of java string escaping rules , special meaning ...

sphinx4 - how to setup the sphinx with netbeans -

i have configured sphinx4 eclipse. for these steps have used. copy java , config files src folder all necessary jar files (in lib). lib folder added root of project build jar files (jsapi files too) change configuration file , give proper path test java file but in netbeans dont understand how proper steps. can me. jar files should added "libraries" rite. after adding them how build them. in netbeans dont show src folder. java files , configuration files should go source packages folder rite. can me this. please if have sphinx4-1.0beta6 can open folder netbeans project. open netbeans, click open project, navigate sphinx folder , open it. netbeans project file type of version. assume work in later versions also. have no clue why sphinx doesn't on website.

get - POST data in Lua -

i'm learning lua @ moment. need able access post , data. i'm trying find out how equivalent of php $_post , $_get in lua. this depends on web server running in, , intermediary libraries using. in apache 2.3, using included mod_lua, be function my_handler(r) -- uri params local simple, full = r:parseargs() -- post body local simple, full = r:parsebody() end where simple table of key -> value (what want of time) , full key -> [value1, value2, ...] cases of duplicately named params. fuller examples available @ http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/test/htdocs/test.lua?revision=728494&view=markup

Best way to daemonize Java application on Linux -

while found question being answered here on sw several times, didn't find concluding answer best approach. i'm not looking use external wrapper, found them launching java process under nice level lower potentially lowers performance, seems shell methods left. i far found 3 different shell methods: start-stop-daemon redhat daemon init.d function nohup on start / disown after start what people using, , can recommend reliable method? thanks. while standard answer seems jsvc , have been using djb's daemon tools great way make daemon. i have java, python , few shell scripts running daemons, simple way start/stop them , great logging. i've used run daemontools root on initctl designed, after few months decided run manually, under normal user, , using svscan-start nicer logging.

android - How to maintain the position of ListView -

possible duplicate: maintain/save/restore scroll position when returning listview how can maintain position of listview in activity when go activity (by launching intent) , come (press button)? thank you. declare global variables: int index = 0; listview list; and make reference listview in oncreate() : list = (listview) findviewbyid(r.id.my_list); next, in onresume() , add line @ end: list.setselectionfromtop(index, 0); lastly, in onpause , add following line end: index = list.getfirstvisibleposition();

html - Cross Browser Issue -

my background in winforms programming , i'm trying branch out bit. i'm finding cross-browser issues frustrating barrier in general, have specific 1 can't seem work through. i want display image , place semi-transparent bar across top , bottom. isn't ultimate goal, of course, demonstrates problem i'm having in relatively short, self-contained, code fragment let's go it. the sample code below displays intended in chrome, safari, , firefox. in ie8, bar @ bottom doesn't appear @ all. i've researched hours can't seem come solution. i'm sure dumb rookie mistake, gotta start somewhere. code snippet... <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript" language="javascript"> </script...

iis 6 - Where is the IIS 6 SMTP badmailfrom list? -

one of our applications started erroring out , result hundreds of error emails being sent in matter of seconds. got email sender (seems address, not ip) banned. use iis 6 smtp server. entry bad mail file: diagnostic-code: smtp;553 sorry, envelope sender in badmailfrom list (#5.7.1) i remove email sender list, cannot find it. search web location, didn't turn anything. any on appreciated. thanks, darren the error although recorded on server hosting iis originated our 3rd party email host. email address being used send email blocked email host. calling them , getting them remove email address block list resolved issue.

c# - Changing memory value of a unmanaged code in a managed code -

how change memory value of unmanaged code in managed code, i'm creating hack game. pinvoke using writeprocessmemory() .

c - How to terminate read() when EOF is not encountered? -

i building client/server model using sockets, using named pipes, mkfifo(). a client writes output name pipe, , read input in server using: while ((n = read(fd_in, &newchar, 1)) == 1) { /* ... */ } i reading 1 character @ time, until encounter 2 characters: <'cr'><'lf'>. make code in such way if client not terminate <'cr'><'lf'> after time maybe, can discard , proceed client, otherwise next client have wait, maybe infinitely. is there way please terminate execution of read()? if has not returned in 2 seconds, interrupt read , discard read characters, , start reading again please? thank help, jary try passing o_nonblock flag when open read-end of fifo. should change behavior read returns right away if number of requested characters not in pipe.

How can I retrieve column descriptions from an access database in C#? -

i trying retrieve column descriptions ms access columns using c# (the text entered user in table designer describe purpose of column). how 1 go this? thought maybe extendedproperties in column hold when datatable through oledbconnection , loop through columns, extendedproperties has count of 0. edit: thanks, remou, did trick. below quick test in c# catalog cat = new adox.catalogclass(); adodb.connection conn = new adodb.connection(); conn.open(_connectionstring, null, null, 0); cat.activeconnection = conn; adox.table mhs = cat.tables["mytablename"]; string test = mhs.columns["columnofinterest"].properties["description"].value.tostring(); using adox catalogue, can @ field property description, in vba: catdb.activeconnection = "provider=microsoft.jet.oledb.4.0;" & _ "data source=" & currentproject.fullname set tbl = catdb.tables("new...

python - Passing parameter to base class constructor or using instance variable? -

all classes derived base class have define attribute called "path". in sense of duck typing rely upon definition in subclasses: class base: pass # no "path" variable here def sub(base): def __init__(self): self.path = "something/" another possiblity use base class constructor: class base: def __init__(self, path): self.path = path def sub(base): def __init__(self): super().__init__("something/") i use python 3.1. what prefer , why? there better way? in python 3.0+: go parameter base class's constructor have in second example. forces classes derive base provide necessary path property, documents fact class has such property , derived classes required provide it. without it, relying on being stated (and read) somewhere in class's docstrings, although state in docstring particular property means. in python 2.6+: use neither of above; instead use: class base(object): d...

Lookup by an arbitrary identifier in MSMQ? -

is there way assign identifier message in msmq, later locate message (if it's still in queue) identifier? being more specific, need unique identifier under control, not assigned msmq. you use messages label property if want use identifier created before message sent. the message lookupid identifier not accessible until message has been sent.

c++ - Are there any Visual Studio add-ins for true 'smart tabs'? -

'smart tabs' concept allows automatically insert tab character block indentation , space characters in-block formatting. it's described here . unfortunately, visual studio's 'smart tabs' option in text editor settings indents text on enter press. same name, different , near useless thing :). so, maybe knows of visual studio addin can change how 'tab' key work insert tab characters , space characters according rules mentioned above? hints welcome. update: need c++. according comments, resharper can this, basic , c#. if no 1 comes "as-you-type" utility, astyle convert-tabs , indent=tab options reformat code after-the-fact.

ios - Display of results is delayed by 5s in UISearchDisplayController -

my uisearchdisplaycontroller performs asynchronous searches via nsoperationqueue . however results table not visually update until approximately 5s after nsoperation calls [searchdisplaycontroller.searchresultstableview reloaddata] . - (bool) searchdisplaycontroller:(uisearchdisplaycontroller*)controller shouldreloadtableforsearchstring:(nsstring*)searchstring { [searchqueue cancelalloperations]; nsinvocationoperation *op = [[[customsearchoperation alloc] initwithcontroller:controller searchterm:searchstring] autorelease]; [searchqueue addoperation:op]; return no; } my customersearchoperation updates tableview so: - (void) main { // perform search [searchdisplaycontroller setcontents:results]; [searchdisplaycontroller.searchresultstableview reloaddata]; } the problem ui updates must occur on main thread, , reloaddata being called background thread via nsoperationqueue . you can use nsobject method performselectoronmainthread:with...

api - Getting the GUID for any given path to sharepoint -

i'm trying guid of given sharepoint url. don't mind using api or webservices or sharepoint's database. if write function, it's signature be: //get guid path. string getguidfrompath(string path){} i had lead: spcontentmapprovider doesn't seem right info. thank you! depends - what's context of current request? code running in context of sharepoint request? if can use spcontext.current.web.id otherwise, code @ least running on 1 of sharepoint servers? if you'll need use: // given url http://mysharepointsite.com/sites/somesite/somesubsite using(spsite site = new spsite("http://mysharepointsite.com/sites/somesite")) { using(spweb web = site.openweb("somesubsite")) { guid webid = web.id; } // or guid rootwebid = site.rootweb.id; }

routing - ASP.NET MVC generates URLS starting with '/', are relative possible? -

asp.net mvc helpers generates urls slash, use <base /> tag project, possible place application folder. possible generate relative urls without first slash? thanks! use syntax images... <img src="<%=resolveurl("~/content/images/mylogo.jpg")%>"/> ...and of urls calculated based upon root of domain, making them work in page.

dynamic - PHP incomplete code - scan dir, include only if name starts or end with x -

i posted question before yet limited mix code without getting errors.. i'm rather new php :( ( dirs named in series "id_1_1" , "id_1_2", "id_1_3" , "id_2_1" , "id_2_2", "id_2_3" etc.) i have code, scan directory files , include same known named file each of existing folders.. problem want modify bit code include directories names: ends "_1" starts "id_1_" i want create page load dirs ends "_1" , file load dirs starts "id_1_".. <?php include_once "$root/content/common/header.php"; include_once "$root/content/common/header_bc.php"; include_once "$root/content/" . $page_file . "/content.php"; $page_path = ("$root/content/" . $page_file); $includes = array(); $iterator = new recursiveiteratoriterator( new recursivedirectoryiterator($page_path), recursiveiteratoriterator::self_first); ...

linq to sql - What does DataContext.GetTable<TEntry> do? -

consider have datacontext db , , there entity class user . when system.data.linq.table<user> table = db.gettable<user>(); called first time, pull data database immediately, use deferred execution, or data loaded database when db initialized? until enumerate collection no data loaded

validation - How can I validate the configuration of windsor castle -

i want assert registrations valid, i.e no dependency missing , there no circular dependencies. i'd in application (and not in unit-test) i'd able fail-fast if configuration invalid. want accomplish without resolving (and instantiating) components - scanning dependency graph. idea on how can that? the motivation trial-and-error nature of configuring complex applications. i'd prefer fail-fast behavior in case of badly configured container. btw - inspiration came automapper's assertconfigurationisvalid() method. you can't 100% sure windsor dynamic organism , not can statically analyzed. handlers may in waitingdependency state yet app may 100% working since @ resolution time dependencies provided dynamicparameters , isubdependencyresolver s or ilazycomponentloader s. there plans include functionality you've mentioned windsor, given above constraints, provide value. i suggest having good, solid verifiable conventions decide goes container , n...

sorting - Optimal algorithm for returning top k values from an array of length N -

i have array of n floats, , wish return top k (in case n ~ 100, k ~ 10) is there known optimal solution path problem? could provide c algorithm? edit: there 2 problems here: sorted , unsorted. interested in unsorted, should faster! method 1 since k small, can use tournament method find kth largest. method described in knuth's art of programming, volume 3, page 212. first create tournament on n-k+2 elements. knockout tennis tournament. first split pairs , compare members of pairs (as if 2 played match , 1 lost). winners, split in pairs again , on, till have winner. can view tree, winner @ top. this takes n-k+1 compares exactly. now winner of these n-k+2 cannot kth largest element. consider path p tournament. of remaining k-2 pick one, , follow path p give new largest. sort of redo tournament previous winner being replaced 1 of k-2 elements. let p path of new winner. pick k-3 , follow new path , on. at end after exhaust k-2, replace largest -infini...

c++ - can not find my lib files to link -

i trying find lib file created. changed configuration type static lib. rebuild application. when go debug folder in windows, see .lib file. when create new application , try add "additional library directories" go exact folder , not show up. you should use project - linker - input - additional dependencies add created library. so, directories not want change. there 2 simple ways include lib in new project. first 1 - copy lib new projects folder , add it's name @ additional dependencies input field. the second - add new project same solution , set it's dependency first project. way library linked automatically.

html - Smarty inserts PHP function in <BODY> instead of inside <TD> -

i have simple php function in admin.php function accountmenu() { if (isset($_session['user_id'])) { ?> <a href="update_profile.php">update profile</a><br> <a href="update_email.php">update e-mail address</a><br> <a href="logout.php">logout </a> <?php } } i assign variable function in dashboard.php //smarty paths here include 'admin.php'; $accountmenu = accountmenu(); $smarty->assign('accountmenu', $accountmenu); $smarty->display('dashboard.tpl'); and try display via dashboard.tpl <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td width="160" valign="top"> {$accountmenu} </td> <td width="732" valign="...

iterator - How to remove the last element of a jQuery selection? -

i use jquery selector : $('#menus>ul>li>a') i'd to iterate selector result without last one: $('#menus>ul>li>a').removelast().each(fct()); ofcourse function "removelast()" doesn't exist, there equivalent ? thanks. you can use :not selector or .not() method: $('#menus>ul>li>a:not(:last)') or $('#menus>ul>li>a').not(":last")

nhibernate - reading from multiple databases in one class -

im newbee nhibernate , following. i have 2 classes classa, classb, many-to-one relation table data classa not in same database table data classb. classa { public int id {get; set;} public string name {get; set;} public int classb_id {get; set;} } classb { public int id {get; set;} public string somethingelse {get; set;} } my mapping <class name="classa" table="classatable"> <id name="id"> <generator class="native" /> </id> <property name="name" /> <many-to-one name="classb" column="classbid" /> </class> is possible using nhibernate create mapping can readed selecting first databasea, after databaseb ? cannot find solution how set configuration, works. if have helpfull links, please let me know ! thanks ! nhibernate not support cross-db object graphs. cannot create association between classs , b when , b live on ...

java - How to add property counted in DB to @Entity class? -

i have entity. , need object contains value, call 'depth'. query may 'select b.id, b.name, b..., count(c.id) depth entity b, centity c ...' . i've created class nonhibernateentity extends entity. , results of query written above stored list of nonhibentity, consists of fields of entity (as extended), , property 'depth'. make setting aliastobean results transformer: .setresulttransformer(transformers.aliastobean(nhentity.class)). but, annoying , inconvenient - specify aliases of needed fields. , then, if want save 1 of object db - session.saveorupdate((enity)nhibentity) - there exception nhibentity isn't hibernate entity. i heard storing 'entity' field in nonhibentity (aggregation, not inheritance). seems rather inconvenient too. think? appropriate solution? a formula column mapping may suitable needs. try first. if causes performance issues fear, might try mapped class hierarchy field in child, , mapping both same table. ...

php - Improve my Zend Stored Procedure calling code -

i'm wondering how can improve zend code calls stored procedure. @ moment i'm using mysql db, , action function in controller below works, seems nasty. public function callspaction() { $param = $this->_request->getparam('param', 0); $bootstrap = $this->getinvokearg('bootstrap'); $config = $bootstrap->getoptions(); $mysqli = new mysqli( $config['resources']['db']['params']['host'], $config['resources']['db']['params']['root']['username'], $config['resources']['db']['params']['root']['password'], $config['resources']['db']['params']['dbname']); $rs = $mysqli->query(sprintf('call mystoredprocedure(%d)',$param)); if(mysqli_error($mysqli)) { throw new exception(mysqli_error($mysqli), mysqli_errno($mysqli)); } $this-...

email - Oracle PL/SQL UTL_SMTP raising a 501 5.1.7 Bad sender address syntax -

when send e-mails using package utl_smtp getting error when executing comand utl_smtp.mail: 501 5.1.7 bad sender address syntax i passing olny e-mail second parameter. occurs smtp servers. code this: sfrom := 'myemail@myserver.com'; utl_smtp.mail(connection, sfrom); does know how fix this? thanks in advance. sending email can bitch, see post of creator: http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html if happening of smtp servers, check logs of servers see complain about. may knowledge smpt bit dusty, can't connect server , tell him deliver email arbitrary addr. ask admin details.

javascript - How to edit php file and return wordpress blog entries in multiple columns? -

i using same theme site http://foreignpolicydesign.com/v3/ . however, test site not distribute blog entries in columns what might causing problem? suspecting whatever sets $col_class set x1 ~ xn, cannot find source of variable. here code: <?php include (templatepath . '/tanzaheader.php'); // [grid column setting] $col_w = 200; // width of grid column $gap_w = 35; // padding + margin-right (15+15+5) $max_col = 5; // max column size (style div.x1 ~ xn) // * additional info * // check "style.css" , "header.php" if change $col_w , $gap_w. // - style.css: // div.x1 ~ xn // div.grid-item // div.single-item // ... , maybe #sidebar2 li.widget. // - header.php: // griddefwidth in javascript code. // // if want show small images in main page always, set $max_col = 1. // [grid image link setting] $flg_img_f...

delphi - Circular reference fix? -

i have player class in separate unit follows: tplayer = class private ... fworld: tworld; ... public ... end; i have world class in separate unit follows: tworld = class private ... fplayer: tplayer; ... public ... end; i have done way player can data world via fworld, , other objects in world can player data in similar manner. as can see results in circular reference (and therefore not work). have read implies bad code design, can't think of better other way. better way it? cheers! every once in while called for, , this: //forward declaration: tworld = class; tplayer = class private fworld: tworld; public end; tworld = class private fplayer: tplayer; public end;

Slow Startup for Java Web Start Application -

i'm using netbeans ide develop java web start application launch web , use eclipselink jpa access remote mysql database. i'm using swing application framework manage life cycle app. when launch application netbeans takes 7 second application load, when use netbeans ide create web start distribution package (with jar , jnlp files) takes 60 seconds launch. also, "verifying application"/"downloading application" progressbar window seems run every time launch app though copy of has been cached. from users point of view, 1 first sees splash screen 1 2 seconds, "verifying application"/"downloading application" progressbar window 5 20 seconds , nothing 40 seconds before application launches. the app code written such should show before jpa starts loading persistence unit (so doubt that's problem), thought i'd mention in case. update: method createentitymanagerfactory slow web start having looked further, i've found me...

sql - i want to insert values from table1 to table2 with incremantal value -

i tried id value not changing, getting value first record , set value rest... insert table1 (id,b,c,d) (select (select max(id)+1 table1),x,y,z table2 where... ) use identity column . can this: insert table1 (b, c, d) select x, y, z table2 ... if don't want use auto-increment column can same effect using adding row number of row instead of adding 1. syntax works in mainstream sql databases (not mysql though): insert table1 (id, b, c, d) select (select max(id) table1) + row_number() on (order x), x, y, z table2 ...

php - CakePHP - Route configuration -

i working on cakephp , totally newbie php/cakephp. can please tell me wrong route configuration here? router::connect( '/news/:q/:page', array('controller' => 'news', 'action' => 'ondemand', 'mode'=>'news', 'page'=>1), array('pass'=>array('q','mode','page'), 'page' => '[\d]+')); when access page /news/123 or /news/123/1, tries find action '123' in news controller. basically want if user types /news/android , want capture 'android' query , return results. if there may results, need support pagination i.e. url becomes /news/android/(2...n) . you can this: router::connect('/news/*', array('controller' => 'news', 'action' => 'ondemand')); have ondemand function declared as: public function ondemand($subject, $page = null) when user requests /...

flash - How do I play just a specific section of a video in a web page? -

it there way of displaying videos on website allow me show clip of video without physically slicing file actual clips? edit: specifically, i'd play clips using open source flash player. make specific clips, time consuming , maintenance nightmare. second edit: youtube won't work because important able control views these videos. also, web application running off of classic lamp stack. the free flow video player play video files , includes source code , api functions change seek position: http://flowplayer.org/

android - Set Locale programmatically -

my app supports 3 (soon 4) languages. since several locales quite similar i'd give user option change locale in application, instance italian person might prefer spanish on english. is there way user select among locales available application , change locale used? don't see problem set locale each activity since simple task perform in base class. for people still looking answer, since configuration.locale deprecated can use api 24: configuration.setlocale(locale); take in consideration minskdversion method api 17. full example code prior api 17: resources resources = getresources(); configuration configuration = resources.getconfiguration(); displaymetrics displaymetrics = resources.getdisplaymetrics(); configuration.setlocale(locale); resources.updateconfiguration(configuration,displaymetrics); edit from api 25 updateconfiguration(configuration,displaymetrics) deprecated, should use createconfigurationcontext(configuration) , documentation here f...

visual sourcesafe - Revision/Source control feature in DropBox -

i'm looking webbased solution dropbox or solution integrate dropbox can control files microsoft visual sourcesafe check in/out system. thanks in advance. if want version control code web-based interface, suggest check out github (git) , unfuddle (subversion). hosted solutions, dropbox have features need version control source code. if you're desperate try , use dropbox source code control, it's been asked before. try searching stackoverflow questions on dropbox this one .

c# - ~1 second TcpListener Pending()/AcceptTcpClient() lag -

probably watch video: http://screencast.com/t/owe1owvko see, delay between connection being initiated (via telnet or firefox) , program first getting word of it. here's code waits connection public idlserver(system.net.ipaddress addr,int port) { listener = new tcplistener(addr, port); listener.server.nodelay = true;//i added testing, has no impact listener.start(); connectionthread = new thread(connectionlistener); connectionthread.start(); } private void connectionlistener() { while (running) { while (listener.pending() == false) { system.threading.thread.sleep(1); }//this part lag console.writeline("client available");//from point on runs fast tcpclient cl = listener.accepttcpclient(); thread proct = new thread(new parameterizedthreadstart(instancehandler)); proct.start(cl); } } (i having troub...

c++ - replacing new with macro conflicts with placement new -

i've got massive application (several million loc, , tens of thousands of files), , i'm trying use debug crt detect memory leaks. i'm trying macro-ize new so: #define _crtdbg_map_alloc #include <crtdbg.h> #ifndef new_debug #define new_debug new(_normal_block, __file__, __line__) #define new new_debug #endif now, app big, me, ideally, put in header file , include in tens of thousands of cpp files. not fun task. i've attempted place in common header file in our sdk, included in every translational unit. the problem i'm running seems clash stl header files, , compiler emits errors when placement new used. can change in own code, using pragma's , disabling new macro. not problem there. it's stl header files use placement new, can't change. i've figured out work-around , rearranging include directives in cpp files. example: // doesn't compile #include "new_redirect.h" #include <map> // instance // compile #include ...

Delphi Wmi Query on a Remote Machine -

we use wmiset wmi queries on remote machines. works in delphi 2007 not available delphi xe. i found code wmi queries previous question use wmi delphi . code snippet provided in answer no. 5 works on local machine, need know if possible execute wmi query on remote machine. even if connect remote machine administrator credentials, eolesyserror: access denied exception. regards, pieter. pieter. before connect remote machine using wmi must enable dcom access specified user in remote machine. read these articles understand , fix problems connecting remote machines using wmi. securing remote wmi connection connecting wmi remotely starting windows vista troubleshooting error code 80070005 - access denied (great page find solution connections problems) additionally here leave more clear code connect wmi in remote machine. check part eoleexception exception processed error code , found cause of issue. program wmiremote; {$apptype console} uses sysutils,...

c# - What is the best solution for saving user application data locally? -

i adding contact functionality program, , want save contact list of each individual user, best solution this? new xml , databases , don't know best or if there database solution saves locally. it depends on platform targeting , size , complexity of data structures want persist. open , readable format xml or json or else preferable larger applications things sqlite database or custom save format might appropriate. so, biggest things consider are: support platform/language of choice importance of human-readability/hackability (could desirable or undesriable, , note impacts ability of third party developers build applications consume saved data) size speed of accessing data (with potential tradeoff of how memory take load memory @ once) for combinations of plain text file works, gives near-universal language , platform support, human readable , editable, tend large fair amount of data. larger applications, sqlite database right answer though have check , ma...

community framework in PHP -

i looking framework in php can give me out of box implementation of features like: adding users main site. users can create individual groups. other users can send invitation join groups. (like linkedin has it) group notice board, pubic , private announcements etc groups can have different themes etc... most of frameworks have seen revolves around blogging (cms) or stores. is there open source framework designed such use or atleast has these features? (even if has features , opensource can think of customizing it) you can use joomla framework , jomsocial community solution.

delphi - how to use TEmbeddedWB or TWebbrowser in separate instance? -

possible duplicate: how use twebbrowser on diffent cache? i wanted twebbrowser or tembeddedwb open in separate instance. login multiple accounts. think done cookies, me? i think might barking wrong tree here. after long @ type of issue on number of months came conclusion way programmatically have separate embedded browsers using different caches have them in different applications , run applications different users. suspect cache configuration built embedded browser works seamlessly equivalent actual browser, i.e. can share cookies, etc. suprised if find else works ;-)

In Javascript, a function starts a new scope, but we have to be careful that the function must be invoked so that the scope is created, is that so? -

in javascript, immerged in idea function creates new scope, think following anonymous function create new scope when being defined , assigned onclick: <a href="#" id="link1">ha link 1</a> <a href="#" id="link2">ha link 2</a> <a href="#" id="link3">ha link 3</a> <a href="#" id="link4">ha link 4</a> <a href="#" id="link5">ha link 5</a> <script type="text/javascript"> (i = 1; <= 5; i++) { document.getelementbyid('link' + i).onclick = function() { var x = i; alert(x); return false; } } </script> but in fact, anonymous function create new scope, that's right, when being invoked, so? x inside anonymous function not created, no new scope created. when function later invoked, there new scope alright, i in outside scope, , x gets value, , 6 anyways. the following co...

javascript - Dynamically load _gallery_ (not album) in SlideShowPro using SWFObject -

i have been successful in dynamically loading album in ssp before, using ssp standalone. did this: var flashvars = { xmlfilepath: "http://site.com/ssp_director/images.php?album=5" } what i'm looking now, though, dynamically load gallery when page loads, using text entered in javascript, or flashvars i'd assume. i'm using actionscript 3 this, i'm not sure if have ssp instance in flash. i'm not as3, following advice or tutorials can muster. i'm using ssp director, gallery xml urls similar above in example code. i'd elated if possible, otherwise have find alternative solution. help! reading flashvars in as3 not simple used in as2. here's code this: import flash.display.loaderinfo; var fvars = loaderinfo(this.root.loaderinfo).parameters; var xmlfilepath="http://site.com/ssp_director/images.php?album="+fvars.albumid; assuming you'll have flashvars variable named albumid passed in object/embed tag. ...

.NET 4.0 Generic Invariant, Covariant, Contravariant -

here's scenario faced with: public abstract class record { } public abstract class tablerecord : record { } public abstract class lookuptablerecord : tablerecord { } public sealed class userrecord : lookuptablerecord { } public interface idataaccesslayer<trecord> trecord : record { } public interface itabledataaccesslayer<ttablerecord> : idataaccesslayer<ttablerecord> ttablerecord : tablerecord { } public interface ilookuptabledataaccesslayer<tlookuptablerecord> : itabledataaccesslayer<tlookuptablerecord> tlookuptablerecord : lookuptablerecord { } public abstract class dataaccesslayer<trecord> : idataaccesslayer<trecord> trecord : record, new() { } public abstract class tabledataaccesslayer<ttablerecord> : dataaccesslayer<ttablerecord>, itabledataaccesslayer<ttablerecord> ttablerecord : tablerecord, new() { } public abstract class lookuptabledataaccesslayer<tlookuptablere...

c# - Datetime string formatting and CultureInfo -

i suprised see fxcop complaining wasn't specifying cultureinfo in following: string s = day.tostring("ddd"); surely format string param in tostring independent of cultureinfo ? there way cultureinfo affect returned string? edit: sorry, total fail of question. it's obvious "ddd" should dependent on culture settings. thinking more of case datetime.now.tostring("dd-mm-yy") , looks fxcop doesn't in fact complain in instance. there article on msdn on how extract day of week specific date . find many different examples on culture on page, including one: datetime datevalue = new datetime(2008, 6, 11); console.writeline(datevalue.tostring("ddd")); // displays wed datetime datevalue = new datetime(2008, 6, 11); console.writeline(datevalue.tostring("ddd", new cultureinfo("fr-fr"))); // displays mer.

checking if all elements in a drop down menu are present with selenium testing using ruby? -

hi how can check if elements in array created present in drop down menu using selenium testing? i have dosent seem work animals = ["snake","cat","dog"] def validate_all_animals_exist(selenium) animals.each { |animal| assert selenium.is_element_present(animal), "expected category [#{animal}] present" } end thanks in advance you need use verifyselectoptions call verifyselectoptions(selectlocator, pattern) generated getselectoptions(selectlocator) arguments: * selectlocator - element locator identifying drop-down menu returns: array of option labels in specified select drop-down gets option labels in specified select drop-down. so be assert_equal "123123", page.get_select_options("foo").join(",")

javascript - jQuery Draggable - Getting out of containment - Chrome Bug -

i realized there bug jquery draggable in chrome, doesn't exist in firefox , internet explorer. have div #drag-container /450x80/ , 3 draggable objects inside. /150x0/ , when move them lowest point ,let them , drag again lower position 0,80 + 14 = 0,94 px. let them , drag , 14 px lower again. is there fix ? working demo: http://jsfiddle.net/ucmqq/ here code: <style> .draggable { width: 150px; height: 0px; cursor:move; } <?php if($userinfo->use_colors != '0'): ?> #drag-container { width: 450px; height:80px; background-color:<?=$userinfo->background?>; } <?php else: ?> #drag-container { width: 450px; height:80px; background:url(/backgrounds/<?=$userinfo->image?>); } <?php endif; ?> </style> <script language="javascript"> $(function() { $( "#draggable" ).draggable({ cursor: "move",containment: 'parent', scroll: false, st...

.net - Overwriting dlls in MEF -

right now, i'm trying separate out set of changing classes own dll , dynamically load them using mef. problem whenever try , overwrite dll while app running, says it's in use. is there anyway configure mef let me overwrite dll , pick changes while app still running? this not mef issue - appdomain standard setup locks dll's touched. check http://www.vistax64.com/powershell/26164-reflection-assembly-loadfile-locks-file.html similar issue not involveind mef. basically, not run on dll's, make copy first , work on copy ;) check http://bartdesmet.net/blogs/bart/archive/2006/07/29/4146.aspx appdomain shadowcopy mechanism ;)

iphone - remove Annotation removes random amount of annotations at a time -

i've got code erase annotations (pins) in mkmapview without erasing blue dot (userlocation). problem erasing pins i've added in seemingly random numbers. when it's called through ibaction removes first 5 click again removes next 3, next 2, last one. when pressed need remove latest pin...etc. etc. for (int = 0; < [mapview.annotations count]; i++ ) { if ([[mapview.annotations objectatindex:i] iskindofclass:[myannotation class]]) { [mapview removeannotation:[mapview.annotations objectatindex:i]]; } } the problem modifying annotation collection while iterating on it. @ every execution of loop, loop's termination condition [mapview.annotations count] changes value. lead unforeseen behavior. should either put annotations want remove empty mutable array inside loop call removeannotations: array parameter after exit loop, or count down annotation highest index 0.

c# - How to get the name of the select wallpaper -

how can name of current desktop wallpaper in windows, using c#? something this ? var wpreg = registry.currentuser.opensubkey( "control panel\\desktop", false ); var wallpaperpath = wpreg.getvalue( "wallpaper" ).tostring(); wpreg.close(); from path can extract filename ...

c++ - Double-Ended Queue Index -

so, have been banging head 3 days trying figure how work. my assignment write double-ended queue. have no issue part. the issue have run fact must have bracket operators work when given 1 index. so, if put in 6, want [2][2] , such. but, have no idea equation work. i have tried everything, have googled it, have asked people have been in class, has never been done before in class no there. no 1 discusses this, , seems use two-dimensions rather messing 1 index. i know equation simple, due date friday morning, , still have debug , run unit tests. here function used in: template<typename generic> generic& deque<generic>::operator[](unsigned int p) { return m_data[dq_index]->operator[](block_index); } class: #include<stdexcept> using std::out_of_range; #include "block.h" template<typename generic> class deque { public: deque(); deque(unsigned int n); deque(deque& d); ~deque(); void push_front(generic x); vo...