Posts

Showing posts from September, 2012

css - What Are Other Ways to Do 2-Column Layouts? -

i've been stuck approach 2-column site quite while now wrap elements in "wrapper" div float main div left float sidebar left apply clearfix on wrapper div the problem having whenever non-floated element in main div alongside floated one, have clears or clearfixes. do have other approaches 2-column layouts. way, use said approach in my blog : i use grid: http://www.1kbgrid.com/ it's more 2-column layout, idea of being flexible. instance, it's handy when have fancy layouts on front page , fall default 2-column on subpages. saves lot of time.

ruby - Rails 2.x app on RubyMine 3.1 -

i've upgraded rubymine 3.1 , rubymine take project rails 3 project, mine not. of face problem. ruby mine fires message, when try run application run configuration error: rails 2.x launcher found instead of rails 3.x one. need '/script/rails' script launch rails server. please update server launcher according rails 3.x documentation my final state can run rails 2.x app server rubymine do know how achieve that? i had problem using rails 2.3 , rubymine 3.1 -- solution @ project settings (file -> settings) , select ruby sdk , gems. through attached rails gems. had both rails 2.x , rails 3.x gems attached project.

javascript - Alternating background color in HTML UL -

i'd alternate background color in html un-ordered list without using jquery. best option css3 :nth-child selector: #myul li:nth-child(odd) { background-color: red; } #myul li:nth-child(even) { background-color: green; } or if reason need javascript solution: <style> li.even { background-color: red; } li.odd { background-color: blue; } </style> var ul = document.getelementbyid('myul'); var items = ul.getelementsbytagname('li'); (var = 0; < items.length; i++) { var class = % 2 == 0 ? 'even' : 'odd'; items[i].classname = class; } or mentioned generate classes server-side.

android - Having fun with Threads -

i having troubles threading ;) i have done script class follow: class test{ texttospeech mtts = new texttospeech(); boolean volatile mvarglobal = false; class t1 extends thread{ public void run(){ dosomething(){ mvarglobal = false; // network working...take while mtts.speak(...) //speech information received network mvarglobal = true; } } t1 t = new t1(); t.start(); class checkvarglobal extends thread{ public void run(){ if(!mvarglobal) { text2speech.speak("something"); } postattime(this, 3000); } } checkvarglobal c = new checkvarglobal (); c.start(); } as can see have 2 threads running, 1 getting network information , second 1 cheking if information network has been received. boolean variable mvarglobal true, , thread checking "checkvarglobal" stop condition (!mvarglobal) false. the problem once information in 1st thread networ

HTML Scrollable table vertically and horizontally -

i thought had achieved this, method used wasnt correct. separated table head , table data 2 separate tables, each closed within div. put overflow on outside div of each table-segment. however, doesnt work because when have large number of columns, begins squeeze columns together, whereas still want them fix width. can help? ive omitted event listeners in code below. <div id='headertable' style='overflow:auto;overflow-x:hidden;overflow-y:scroll;width:900px;'> <table border='1' style='width:1900px;float:left;'> <thead style='text-align:left;'> <tr style='display:block;'> <th width='100' style='width:100px;'>test1</th> <th width='100' style='width:100px;'>test2</th> <th width='100' style='width:100px;'>test3</th> <th width='100' sty

sql server - Delete two tables from a variable table in SQL -

i want able use varable table delete records 2 different tables. i have far declare @deleted table (card int) insert @deleted select card table1 recordstatus = 4 delete table2 @deleted d table2.actionstring d.card , select convert(varchar(8),today,112) from(select dateadd(year,-1,getdate())as today)aa sorry if confusing, using sql managment 2005 want able card number table one, check see if date in table 2 greater year if delete record in table 1. in table 2 not have field card number need statement. i have error in second part reads,- @deleted d thank in advance your second part of statement quite confusing indeed.... you're mixing delete select in clause..... what trying achieve here?? declare @deleted table (card int) insert @deleted select card table1 recordstatus = 4 delete table2 @deleted d table2.actionstring '%' + cast(d.card varchar(20)) + '%' , convert(datetime, table2.date, 112) <= dateadd(year, -1, getdate()) d

select - PostgreSQL: update tabA with a selection from tabB and tabC -

i've selection in tabc. i've applied selection tabb. i've update taba values these 2 selections. select on tabc , tabb: select * tabc id_field in (select id_field tabb date_in = '2011-02-22') order id_field update taba: update taba set field_1 = tabc.field_1, field_2 = tabc.field_2, field_2 = tabc.field_2 tabc taba.id_field in (select tabc.id_field tabc tabc.id_field in (select id_field tabb date_in = '2011-02-22')) the update statement runs without error result not i'd expeted: 3 fields have same values rows. what's wrong? use inner join instead update taba set field_1 = tabc.field_1, field_2 = tabc.field_2, field_3 = tabc.field_3 tabc inner join tabb on tabc.id_field = tabb.id_field , tabb.date_in = '2011-02-22' taba.id_field = tabc.id_field;

c++ - Remove compiler-specific code from boost headers -

it seems lot of code in boost compiler-specific workarounds or different paths different compilers (especially in components mpl). build time increases lot when use boost, when try hide big parts behind compiler-firewalls (pimpl) or use precompiled headers. is there way pre-process boost headers 1 compiler i'm using? suspect makes headers (significantly?) smaller have impact. has ever tested whether give speed improvements? no idea whether matters actual answer, i'm using visual studio 2010 primarily. if use precompiled headers, preprocessing headers on steroids. if pch won't make difference, there nothing can will. the compile time comes excessive including or complex template instantiations, not size or complexity of preprocessor.

ASP.NET Web Service + Module + Public variable = thread safe? -

in asp.net web service i've included module in public declared variables. thread-safe? mixed upon simultaneous calls? those variables datsset, datatable , sqldataadapter.. partial code of module: imports system.data.oledb imports system.diagnostics module modcommon public bdolog boolean public scurrentodbc string public cn sqlconnection public query1ds dataset public query1 datatable public query1adapter sqldataadapter @scripni thanks, i'm not familiary suggestions, move locally. additionally, following variables thread-safe?: [toolboxitem(false)]_ public class service1 inherits system.web.services.webservice dim sname string dim scurrentpath string [webmethod()]_ public function capture(byval spath string) string sname = "joe" end function end class if you're using web services yes, have concurency problems when multiple services try access same resource, , s

javascript - Is there any Mac text editor with tail or watch files change feature? -

Image
ideally wanted use in textmate didn't find feature besides show web preview nice fact can set interval update page, doesn't work watching file , apply syntax highlighting or format. one neat example of wanted achieve simulate same behavior coffescript try now feature can type in 1 side , see file in javascript. so ideally open .coffee file , run coffee --watch on terminal track file change specific file, pop window inside text editor keep updating coffeescript .js generated file. like this , window on left shows current file , window on right shows file being watched specific interval. i not sure if clear enought, if not, please let me know.. want see in real time happens files after run specific script syntax highlighting , else possible. i testing kaleidoscope app, nice way visualization works, no editing possible neither syntax highlighting features though good, makes me think nice: cheers emacs can both of these things (and you're bet

Google Maps API JavaScript error when GBrowserIsCompatible() is called -

i error on following line: if (gbrowseriscompatible()) { this code still not working <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=<?php echo $google_api['value'];?>" type="text/javascript"></script> <script type="text/javascript"> var map = null; var geocoder = null; function initialize(address) { if (gbrowseriscompatible()) { map = new gmap2(document.getelementbyid("map_canvas")); map.setcenter(new glatlng(37.4419, -122.1419), 13); geocoder = new gclientgeocoder(); /* start */ if (geocoder) { geocoder.getlatlng( address, function (point) { if (!point) { alert(address + " not found"); } else { map.setcenter(point, 13); var marker = new gmarker(point);

c# - Should I add Locks or TransactionScope when using .Net Cache? -

i’m using httpcontext.current.cache cache data db (.net 4 web application). i want make sure don’t run threading synchronization problem. scenario: 3 users pointing same company object: user a: profile.company.name = “compx”; profile.company.desc = “compxdesc”; profile.company.update(); //update db user b: string name = profile.company.name; user c: profile.company.name = “compy”; profile.company.update(); //update db questions: does cache provide type of locking? should add locks readerwriterlockslim (how exactly)? existing code: profilebll: public companybll company { { return companybll.getbyid(this.company_id); } } // httpcontext.current.cache public static companybll getbyid(int company_id) { string key = "getbyid_" + company_id.tostring(); companybll ret = null; if (cache[key] != null) { ret = (companybll)cache[key]; } else {

asp.net mvc 2 - Error during redirect to MVC Mobile Area using 51Degrees.mobi -

Image
i'm relative newbie mvc. app i've written works , continually fine tune learn. recently, i've been toying mobile web site tools. i've never needed did searching/reading/tinkering could. started microsoft web app toolkit ended being bit outdated kept on reading , switched using 51degrees.mobi library. i've set based on several different posts: steve sanderson - http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application 51degrees user guide - http://51degrees.codeplex.com/wikipage?title=user%20guide ...and bunch of other sites , descriptions centering around same basic points. so here's have described mr. sanderson. created mvc area mobile controllers/views in turn created mobilearearegistration.cs file modified mobilearearegistration.cs under area specify default controller , action. included 51degrees components in config file. namely sectiongroup references, fiftyone section include redirect , htt

c# - JavaScriptSerializer and ValueTypes (struct) -

for project i've created several struct in c#. probject asp.net mvc 2 project. snip: struct tdummy { private char _value; public tdummy(char value) { this._value = value; // restrictions } } i created because needed restrict char-variable specific number of values. (i have created enum, these values used in database, , still need convert them) now need create jsonresult, like return json(new { value = new tdummy('x') }); but when this, result of: {"value":{}} i expected result of {"value":"x"} i've tried several things, typeconverter (canconvertto(string)), custom type serializer (javascriptserializer.registerconverters()), either don't work or must return 'complex' json-object. {"value":{"name":"value"}} any thoughts on this? want serialize value-type value... if interested, i've create small demo (console app) illustrate this:

jquery - Hide "save successful" message when user starts updating a page again -

i have page few textboxes , dropdowns. when hit submit information on page saved , "save successful" message sent client. if user starts updating page again message should go away. don't want add on focus event inputs since can killer. need on pages in app. regarding highly appreciated. thanks! since you're working jquery...this still adding in on focus event, doing global listener normal inputs (including checkboxes, hidden, radio, etc), instead of event on each , every item. $(':input').focus(function(){ $('#successfullysavedid').hide(); });

How to make validation optional for a complex type in asp.net mvc? -

i want display editor type user. user contains field address of type address. made editor template type address reusable. i don't want field address required creating user. fields required address, example country, state etc. i want validate address if receive data it, if don't receive anything, don't want return validation error ui address. return validation errors user then. what best way this? thanks, you might want custom model binder user type. way can choose override validation of address item inside user.

silverlight, using Observables on WCF calls, casting IEvent<T> where T : AsyncCompletedEventArgs -

i have question using observables in silverlight 4 make wcf calls. consider simple webservice call below. var adminclient = serviceproxy.withfactory<authenticationclient>(); var results= observable.fromevent<authorizeadministratorcompletedeventargs>( s => adminclient.authorizeadministratorcompleted += s, s => adminclient.authorizeadministratorcompleted -= s).observeondispatcher(); adminclient.authorizeadministratorasync(); results.subscribe(e => { //enable ui button }); i have implemented extension method, wraps subscribe method, error validation on return. on return results.subscribe(e => e system.collections.generic.event<authorizeadministratorcompletedeventargs> almost every query have different return type such as: e system.collections.generic.event<asynccompletedeventargs> if had wrapper looked this, how can cast every type of xxxcompletedeventargs base type asynccompletedeventargs can access e.eventargs , inspec

java - Get instanced object by String -

is possible object instanced in code string @ runtime? somthing that: public string xyz = "aaaa_bbb"; getobject("xyz").some function of string (e.g.: .split("_")) thanks here's example if it's class field, can name this. import java.lang.reflect.method; public class test { public string stringinstance = "first;second"; public void foo() { try { object instance = getclass().getdeclaredfield("stringinstance").get(this); method m = instance.getclass().getmethod("split", string.class); object returnvalue = m.invoke(instance, ";"); if(returnvalue instanceof string[]) { for(string s : (string[])returnvalue ) { system.out.println(s); } } } catch (exception e) { // todo auto-generated catch block e.p

c# - Best way to constantly draw large numbers of bitmaps in WPF? -

i stumped simple problem. making tile-based game engine , need able allow user edit map using wpf user interface. naively, had assumed update old fashioned "buffered" system.drawing.graphics.bitmap using graphics.fromimage. draw onto bitmap tiles make map, , blit buffer bitmap screen. however, thorough research believe isn't easy @ all. rather bore i've found out far (that either doesn't work, or incredibly slow), may ask simply, best way continuously drawing large numbers of bitmaps efficiently via wpf ui? i accept such suggestions "go windows forms". if that's case, going dissapointed wpf! the writeablebitmap class high-performance wpf-compatible bitmap allows direct access bits. this msdn documentation page contains thorough example of using it.

ruby on rails - Why does it take Radiant CMS so long to update after changes are saved? -

i've been looking sort of cachine mechanism can't find one. know why takes long see changes after saved in cms ? radiantcms caches content 5 minutes.

module - xcopy python deployment -

i'm new python , i'm writing first program. after finish able run program source code on windows or mac machine. program has dependencies on 3rd party modules. i read virtualenv don't think helps me because says it's not relocatable , it's not cross-platform (see making environments relocatable http://pypi.python.org/pypi/virtualenv ). the best scenario install 3rd party modules locally in project, aka xcopy installation. i surprised if python doesn't support since promotes simplicity , frictionless programming. you can want, have make sure directory containing third-party modules on python path. there's no requirement install modules system-wide.

concurrency - ASP.NET background worker thread -

a have asp.net 2.0 web application should allow sending emails. have windows service sends emails immediately. web application composes email message according template , put in msmq , service there. the problem composing message template can take time , don't want user wait while message composed , passed service. i think background process listen internal queue of notifications requests. if queue empty process nothing, message appeared begins process message. want have single process not create lot of threads. currently idea write task scheduler, contain queue of notifications requests. when new item added queue scheduler checks whether process of sending notifications running. if yes, add request queue. otherwise creates new thread read queue until empty , perform notification requests. my concern need sure thread not die after asp.net finish response client because parent thread thread. , question best way (or possible it)? p.s. ok thread dies if iis recycles asp.

sql - mysql select query - to match one field with the other field -

i trying find records has following scenario. id | name | email 1 robert robert@gmail.com 2 william bill@gmail.com 3 michael michael@gmail.com 4 micahel mike@gmail.com based on above table, want find records "name" contained in "email field", here record 1 , 3 should output , not 2 , 4. there way can comparison? i tried reading regex couldn't find anything. if it's comparison of same value, straightforward, not having clue one. thought of like looks cannot have field names. the exact syntax depend on how want define relationship. are looking name anywhere in email address? (this slow) select id,name,email your_table email concat('%',name,'%') just @ beginning of email address? select id,name,email your_table email concat(name,'%') just before @ sign? select id,name,email your_table email concat(name,'@%')

php - xpath and self closing <br/> -

can tell me how can access text after < br / > in following? <li> <span class="title">size</span> <p>ladies<br />case diameter: 27.0 mm</p> </li> for reason, cannot past it... however, can whats in front of (ladies) thanks! use : /*/p/br/following-sibling::text()[1] do note problem expression : /li/p/br/following-sibling::text() depending on xml document may select more 1 (actually all) text-node following siblings of br , want text node follows br .

oracle - Sql query for Top N rows using a group by -

hi tried many ways solve missing thing.. have 2 tables student , score sid cid score 6 1 90 1 1 80 4 1 80 3 1 70 2 1 60 6 2 80 1 2 70 2 2 60 4 2 60 5 2 50 4 3 80 7 3 80 6 3 70 8 3 60 2 3 50 sid sname sbday ssex 1 1980 female 2 al 1986 male 3 1989 male 4 ja 1986 male 5 ma 1983 female 6 phi 1986 male 7 geo 1993 male 8 lil 1990 female 9 cha 1993 male i need return sid , sname of students have top 2 highest score each course. if existed, return sid , sname of student has highest score among male students each course. here top 2 highest score not top 2 records in group ex : top 2 highest score in 1st group 90, 80 ,80 . i need out put sid cid score 6 1 90 1 1 80 4 1 80 6 2 80 1 2 70 2 2 60 4 2 60 4 3 80 7 3 80 6 3 70 i tried following code : select a.sid , s.sname, score,cid score a,students s 2 >(sele

java - Android/PHP/MySQL project assistance - keeping server & phone app synced -

i'm working on solo project, using aforementioned technologies. aim create quiz game android. questions created "quiz master" online beforehand , submitted mysql database. retrieved android application. have set link between phone & server using php, data sent on in json format. i want each question have pre-allocated time user has answer , once has elapsed, android app prevent question being answered. time chosen quiz master , submitted database along rest of quiz information. as not might retrieve quiz server onto phone @ same time, there problems regards making sure doesn't longer answer question other. far possible, want keep in sync. it'll difficult make sure has exactly same time, i'd settle having people not being able delay retrieving quiz , getting full 30 seconds (or whatever). fair, countdown needs start once quiz has been started quiz master. i'm struggling think of way overcome problem. have basic client-server system set , can&

c# - Cannot access a file in multi-thread -

using (filestream fs = new filestream(path, filemode.append, fileaccess.write, fileshare.none)) { using (streamwriter sw = new streamwriter(fs)) { sw.writeline(datetime.now.tostring()); // multiple sw.writeline } } in spite of fact fileshare set "none", exception launched "the process cannot access file because being used process. i'm in multi-thread context , file not written/read somewhere else. why ? you trying write file multiple threads - not possible without sort of synchronization ensure file closed before attempting write thread. as fileshare set none - means multiple threads not allowed share file, of course sharing violation exception. none - declines sharing of current file. request open file (by process or process) fail until file closed.

java - How to use Google CodePro Coverage on Google Appengine code? -

i'm trying use google's codepro coverage tool measure coverage of unit tests on google appengine project. i'm getting various classformaterror exceptions on running tests. have others got google codepro coverage working google appengine project? here lines of enquiry i'm pursuing: a) multiple levels of byte code engineering not working together. i.e. codepro fighting gae jpa implementation (datanucleus instruments persistent classes). b) rtfm error on part here exception: java.lang.classformaterror: invalid length 65525 in localvariabletable in class file @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclasscond(classloader.java:632) @ java.lang.classloader.defineclass(classloader.java:616) @ java.security.secureclassloader.defineclass(secureclassloader.java:141) @ java.net.urlclassloader.defineclass(urlclassloader.java:283) @ java.net.urlclassloader.access$000(urlclassloader.java:58) @ java.ne

iphone - NSMutableArray of ClLocationCoordinate2D -

i'm trying create retrieve array of cllocationcoordinate2d objects, reason array empty. i have: nsmutablearray *currentlydisplayedtowers; cllocationcoordinate2d new_coordinate = { currenttowerlocation.latitude, currenttowerlocation.longitude }; [currentlydisplayedtowers addobject:[nsdata datawithbytes:&new_coordinate length:sizeof(new_coordinate)] ]; i've tried adding data: [currentlydisplayedtowers addobject:[nsvalue value:&new_coordinate withobjctype:@encode(struct cllocationcoordinate2d)] ]; and either way, [currentlydisplayedtowers count] returns zero. ideas might going wrong? thanks! to stay in object land, create instances of cllocation , add mutable array. cllocation *towerlocation = [[cllocation alloc] initwithlatitude:lat longitude:lon]; [currentdisplayedtowers addobject:towerlocation]; to cllocationcoordinate struct cllocation , call coordinate on object. cllocationcoordinate2d coord = [[currentdisplayedtowers lastobject] coor

java - insertion sort...tweaks to improve? -

i know insertion sort isn't great...but still...what 2 more simple improvements made sort below? public static void insertion_sort_with_moves(int[] arr){ (int = 1; <= arr.length; i++){ int v = arr[i-1]; int j = i-1; (/*declared j outside loop*/; j > 0; j--) { //compswap(a[j-1], a[j]); if (v < arr[j-1]) arr[j] = arr[j-1]; else break; } arr[j] = v; } } a few micro-optimizations are: 1,2,3) int len = arr.length; ... (int = 0; < len; ++i){ int v = arr[i]; int j = i; saves computing i-1 2 times , ++i faster i++. not sure length thing (could save offset addition when accessing class member). 4,5) for (/*declared j outside loop*/; j != 0; --j) { j!=0 should faster j>0 (really don't expect much) , --j faster j--. well of them may platform dependent , may make no difference @ all.

c - malloc problem? -

hello use malloc() generate buffer buffer char* buffer = (char*)malloc(chunksize+1); (k = 0; k < chunksize; k++) { buffer[k] = (char) (j+k); } however, in debugger can see buffer[3] example char wrote in, buffer buffer empty(a lot of spaces). second time write stuff in buffer after free(buffer), shows the content wrote first time, , overwrite it. can tell me why? thank you!! one problem might try print char buffer printf or equivalent? missing assign buffer[chunksize] = 0; so buffer not terminated. may have behind that, e.g '\r' . if on other hand buffer doesn't represent string you, better use different base type, unsigned char .

ruby - Saving a file with a Cyrillic name -

how correctly save file cyrillic name? now file name looks this: "Максим Р—РёРЅСЏРєРѕРІ feat. indigo - , me only". correct name "Максим Зиняков feat. indigo - , me only". i file http url: agent = mechanize.new agent.get(url).save_as("#{mp3_dir}/#{title}.mp3") as mentioned, need convert title string utf-8 using iconv : require 'rubygems' require 'mechanize' require 'iconv' agent = mechanize.new # if source encoding indeed windows-1251, 'from' cp1251 title = iconv.conv('utf8', 'cp1251', title) agent.get(url).save_as("#{mp3_dir}/#{title}.mp3")

c++ - Floating point operations resulting in a number that is essentially zero -

i'm doing calculations result in value {-0.707107, 9.61481e-017, 0.707107} when i'm expecting {-0.707107, 0, 0.707107}. second component, while zero, cause problems down road? should it? using c++ doubles. that depends on intend down road. :-) however, getting results close to, not equal, "mathematical" result should be, 1 must live when using floating point numbers. common solution define "epsilon" value (say, 1e-10 ) , accept error of epsilon in comparisons - x == y become fabs(x - y) < epsilon .

javascript - php output display on a greybox -

i have form calls php script on submit insert data mysql database. output of php script return greybox. haven't been able make work appreciate guys can provide. i have greybox call on form definition see below not doing trick. here subset of code: <script type="text/javascript" src="greybox/ajs.js"></script> <script type="text/javascript" src="greybox/ajx_fx.js"></script> <script type="text/javascript" src="greybox/gb_scripts.js"></script> <div id="content"> <form id="contact_us" name="contact_us" action="contact-greybox.php" method="post" onsubmit="return gb_showcenter('testing', this.action, 500, 500)"> <fieldset> <label for="employee_id">employee id:</label> <input id="employee_id" name="employee_id" type="number" size="10"

asp.net mvc - partial view rendering -

i have partial view in foo folder. want show on home/index view. using partial render , trying locate in temp folder. how write renderpartial render foo\partial view ? regards, asif hameed to render specify path in renderpartial this: <%html.renderpartial("~/areas/fooarea/views/foo.ascx");%> obviously replace example path path actual foo partial view.

c# - response.redirect not redirecting to full domain name -

i'm having issue redirecting same domain. for example, redirection takes place on servera.domain.com/folder/application.aspx . however, program redirects me servera/folder/application.aspx . the application works fine on domain, i'm forced relogin. what can force redirection same domain?? i using asp.net 3.5 added redirect looks follows: response.redirect("/folder/application.aspx?"); what if add tilde (~) character , call resolveclienturl redirect? response.redirect(this.resolveclienturl("~/folder/application.aspx?")); does take care of problem?

.net - Enter key triggers wrong submit button -

i working on mvc application. 2 tables each have individual submit button. table1 has default submit on enter key. how change submit button based on textbox focus? <table> ...<td align="left"><%= html.textbox("name")%></td> ...<input id="namesubmit" name="namesubmit" type="submit" value="search"/> </table> <table> ...<td align="left"><%= html.textbox("idnum")%></td> ...<input id="idsubmit" name="idsubmit" type="submit" value="search"/> </table> i tried using panel, "the defaultbutton of 'panel1' must id of control of type ibuttoncontrol". any ideas? if wrap each of submits in <form> tags should determine submit clicked such: <table> <form id="form1"> <td align="left"><input id="name" /&g

java - Apache Solr search is not displaying indexed result -

Image
although data mysql indexed using dataimport handler while searching through solr admin shows 0 result, please suggest whats problem be right side display indexing have been done completely, not displaying in search results. and when used search "programing" display i suggest using luke examine index contents , verify have indexed data correctly. http://www.getopt.org/luke/ there's debugging tab in solr queries determine whether or not query match given way have setup tokenizers.

java - Easy way of populating Javabeans based on request parameters -

i have simple person class: package simpleapp.entities; public class person { private string name; private string secondname; public void setsecondname(string cognome) { this.secondname = cognome; } public string getsecondname() { return secondname; } public void setname(string nome) { this.name = nome; } public string getname() { return name; } } and simple html page: <html> <body> <form action="/simpleapp/person/" method="post"> name: <input type="text" name="name"><br> second name: <input type="text" name="secondname"><br> <input type="submit"> </form> </body> </html> and simple servlet: public class person extends httpservlet { private static final long serialversionuid = 1l; public person() { } protected void

javascript - How to override Backbone.sync? -

i'm trying out backbone.js, , 1 of things i'm trying make call remote api, need able override backbone.sync, understand the documentation . there isn't example of how in documentation itself, , there doesn't appear google group backbone... can point out example doing this? take @ annotated source example overwrite backbone.sync localstorage alternative backbone-localstorage basically backbone.sync should function takes 4 arguments: backbone.sync = function(method, model, options) { }; you need fire either options.success or options.error depending on whether method succeeded. methods in format: "create" : expected create model on server "read" : expected read model server , return it "update" : expected update model on server argument "delete" : expected delete model server. you need implement 4 methods , define whatever want "server" of course these things backbone.sync must i

wcf data services - WCF + Entity Framework CodeFirst = DynamicProxies exception? -

i'm trying out ef codefirst ctp 5, , using wcf data services. i'm getting error internal server error. type 'system.data.entity.dynamicproxies.person_c321d7a37002a1b42c3cbaecc27983d77f6b7fcc3f837175b2cbb55cca66af55' not complex type or entity type. if use edmx-generated person off db created cf, have no issue. in reading up, seems lazy loading screwing things up, , previous ef versions have let me turn off proxy generation option flag that's not present in dbcontext. there way set lazyloading false, doesn't apparently turn off proxy generation. thanks. here's can in ef code first ctp5: ((iobjectcontextadapter)context).objectcontext.contextoptions.proxycreationenabled = false; alternatively, bug in wcf data services in vs 2010 rtm. can used ctp1 of wcf data services has this issue fixed. hope helps. thanks pratik

Proper way to get possibly through Cocoa Bindings the last element of a relationship in Core Data -

i have managed-object x relationship list of [1:n) y objects. (x , y objects stored using core data) i find proper (and more convenient) way obtain latest inserted y object. "name" attribute of y object should shown in graphic possibly through cocoa bindings. i know ys inserted nsset, there no defined order. however, each y has "timestamp" attribute, when "the latest inserted y object" mean "the y latest timestamp". any appreciated: searched documentation have not found me. in kvc programming guide's collection operators section, description @max says the @max operator compares values of property specified key path right of operator , returns maximum value found. maximum value determined using compare: method of objects @ specified key path. compared property objects must support comparison each other. if value of right side of key path nil, ignored. the following example returns maximum value of date values (da

java - Does Spring's JdbcTemplate close the connection if an exception is thrown? -

when spring catches sqlexception, close prepared statement, result set, and/or connection before throwing it's own dataaccessexception (runtime) exception? i have developer wants create aop aspect catch these exceptions , log and/or close connection. @afterthrowing(pointcut="dataaccessoperation()", throwing="exception") public void dorecoveryactions(joinpoint thisjoinpoint, dataaccessexception exception) { // log and/or close connection } yes. that's whole point of jdbctemplate - handles kinds of boilerplate actions including release of resources. see 12. data access jdbc .

android - Spinner onClick items -

i have created spinner.could place spinner items in table java file , call (maybe position) in 1 onclick method? code: spinner spinner = (spinner) findviewbyid(r.id.spinner); arrayadapter<charsequence> adapter = arrayadapter.createfromresource( this, r.array.epilogis, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner.setadapter(adapter); here m getting spinner items string.xml.. i think looking for: array_spinner=new string[5]; array_spinner[0]="1"; array_spinner[1]="2"; array_spinner[2]="3"; array_spinner[3]="4"; array_spinner[4]="5"; spinner s = (spinner) findviewbyid(r.id.spinner); arrayadapter adapter = new arrayadapter(this,android.r.layout.simple_spinner_item, array_spinner); s.setadapter(adapter);

Is there any way to force Java to recognize the unnamed package from a named package? -

in order complete project, need alter class file in named package. i cannot put unnamed package; imported other classes. i cannot put dependencies named packages, relied upon other classes. my goal force javac through whatever means necessary allow imports unnamed package. it's bad practice, have no other choice. alternatively, how go putting of imported classes package without recompiling them, reference package in order compile target class, , remove references after compile? i solved problem. compiled program making barebones definitions of classes , methods imported inside named package, , used program called classeditor edit out package names/path after compiling.

javascript - Splash Page Video (jQuery Hide) Reveal Index Underneath Issue -

i need have splash page, don't want make index, using solution. i using technique: http://jsfiddle.net/jjvzt/ on page: http://www.kineticoriginsofrhythm.com/ but cant "enter" button reveal index page below. suggestions? flickers , jumps video splash page. also whats js cookie code makes appear once per day? thank much. also, if can save "anti-splash" debates time great. client "must have" splash page. not idea. change href attribute "enter" anchor "#" . right redirecting them same page after hiding splash, forcing them load page in initial state again. edit: cookie, jquery(function(){ if(document.cookie.indexof("firstvisit") != -1){ $("#splash").hide(); $("#container-index").show(); } else{ $("#splash span").click(function() { $("#splash").hide(); $("#container-index").show();

apache - Using .htaccess mod_rewrite to pass all URLs in a given directory to a single redirect script -

im trying use mod_rewrite redirect call /real-estate/* rewrite.php...i know can redirect rewrite.php this: rewriterule ^(.*)$ rewrite.php?url=$1 [l] i have urls formatted /real-estate/12345/123-anywhere-st ....where 123-anywhere-st ignored, , have /real-estate/12345 sent rewrite.php...id rewrite rule used on /real-estate...all other areas of site should function is...ive searched on tutorial or cheat sheet, none can find explain how format mod_rewrite rules, give 1 or 2 examples , thats it...can help, maybe provide link somewhere can learn thanks! rewriterule ^/real-estate/(.*)$ rewrite.php?url=$1 [l]

spring - StackOverflowError while reading then deleting object with hibernate -

i reading objects , deleting , throws java.lang.stackoverflowerror! public class testdummy extends testcase { @autowired private applicationcontext context; @autowired private accountdao accountdao; public void testdeleteaccount(){ account acc = accountdao.get("9be4bfa718ea4b4ee044000077b05a84"); system.out.println("account name "+acc.getaccountname()); accountdao.delete(a); } } accountdao , context instantiating good. here get() , delete() methods public account get(string id) { account acc = gethibernatetemplate().get(account.class, id); return acc; } public void delete(account account) { delete(account); } i wonder can recursively happening here! please advice. public void delete(account account) { delete(account); } no wonder so.

Retrieve KEYWORDS from META tag in a HTML WebPage using JAVA -

i want retrieve content words html webpage , keywords contained in meta tag of same html webpage using java. example, consider html source code: <html> <head> <meta name = "keywords" content = "deception, intricacy, treachery"> </head> <body> short html document. <br> has 2 'lines'. </body> </html> the content words here are: my , very , short , html , document , it , has , just , lines note: punctuation , number '2' ruled out. the keywords here are: deception , intricacy , treachery i have created class purpose called webdoc, far have been able get. import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.net.url; import java.util.set; import java.util.treeset; public class webdoc { protected url _url; protected set<string> _contentwords; protected set<string> _keywords public webdoc(url paramurl) {

c++ - OO design, table design -

design table wood or steel meterial. have following designed, better , why? or better suggestion design? design 1 : class meterial{ public: void virtual info()=0; }; class wood:public meterial{ public: void info(); }; void wood::info(){ cout<<"wood"<< " "; } class steel:public meterial{ public: void info(); }; void steel::info(){ cout<<"steel"<< " "; } class furniture{ void virtual info()=0; }; class table:public furniture{ private: meterial * _meterial; public: table(meterial * m); void info(); }; table::table(meterial * m){ _meterial= m; } void table::info(){ _meterial->info(); cout<< " table " << endl; } int main(){ table * wood_table=new table(new wood()); table * steel_table=new table(new steel()); wood_table->info(); steel_table->info(); } design 2: class meterial{ public: virtual void info()=0; }; class wood:public meterial{ p

optimization - Java dead code elimination... is this code at risk of being optimized out? -

so, i'm using api little unfriendly in ways. basically, api creates resource can fetched later. resource may or may not still exist when go fetch later. to fetch created resource, have use result guid so: string resultkey = "12345"; persistedresult r = mfactory.getpersistedresult(resultkey); now, tricky thing here getpersistedresult not throw exception when called invalid guid... persistedresult lazy loader , fail when 1 of methods called (causing object load itself). so, try , determine whether or not resource valid, i'm doing following: persistedresult r = null; if (!stringutils.isempty(resultkey)) { try { r = mfactory.getpersistedresult(resultkey); r.getresultcount(); // triggers exception if result key invalid. } catch (exception e) { // handle exception } } is call getresultcount @ risk of being optimized out because i'm not using value? calling method on persistedresult goes external database, in

makefile - Could someone explain this make file? -

i found makefile on site . don't explain example, wondering if new going on. cc=g++ cflags=-c -wall ldflags= sources=main.cpp hello.cpp factorial.cpp objects=$(sources:.cpp=.o) executable=hello all: $(sources) $(executable) $(executable): $(objects) $(cc) $(ldflags) $(objects) -o $@ .cpp.o: $(cc) $(cflags) $< -o $@ cc=g++ cflags=-c -wall ldflags= sources=main.cpp hello.cpp factorial.cpp sets 4 variables constant strings. rest of makefile, wherever $(cc) appears (for example), replaced g++ objects=$(sources:.cpp=.o) sets variable objects same sources, except wherever pattern .cpp appears in words of sources, replaced .o executable=hello sets constant string var all: $(sources) $(executable) the first actual rule in makefile, tells make build all must first build in $(sources) , $(executable) , , nothing. since first, becomes default target, running make equivalent make all $(executable): $(objects) $(cc) $(ldflags) $(obj

javascript - jQuery - How to restrict input values for text box -

i want restrict input in textbox either 'y' or 'n' (any case). how can done in jquery. i'm pretty sure if keydown returns false, input not allowed. can grabbing key code event object. doesn't prevent doing things copy/pasting value text box, though. better option select or radio button if want restrict user's input. $("#some-selector").bind("keydown", function (e) { return e.keycode == 89 || e.keycode == 78 });

mysql - Selecting last version of entry in different language from sql database -

is there way in 1 sql query? newest (version) of same entry in every language available. my table , example data is: id | index | version | language | ... ------------------------------------------------ 1 1 1 1 test1 2 1 2 1 test2 3 2 1 1 test3 4 2 1 2 test4 5 2 1 3 test5 6 2 2 3 test6 7 3 1 1 test7 8 3 1 2 test8 id unique identifer index unique entry in database means time versions , language version of same article/entry share same index. version version number. 1 first version , greater number newer. language number of language version of entry/article. i can't think of way in 1 query. maybe it's feasible? i this: id | index | version | language | ... ------------

c++ - Check directory's sharing mode in windows -

my question seems simple, google silent. i'm banned may be?:) so question can check there blocked deleting file in directory or it's subdirectories before delete it? there simple way it? no, there isn't. and if there was, wouldn't work. consider sequence of events: you perform check , succeeds (there no blocked files). another process receives cpu quantum , opens file without file_share_delete flag. your process gains cpu , proceeds delete directory -- discover can't, because there is blocked file.

XSLT RSS FEED - Combine substring-before and substring-after -

my apologies in advance if question simple, can’t seem find way around issue. i need way combine substring-before , substring-after function in xsl have start , end point within description element of rss feed. in each description tag want extract ‘primary title’ onwards, stop reaches first <b> tag. i tried following xsl without success <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="channel"> <xsl:for-each select="item"> <xsl:value-of select=substring-after(description, 'primary title:' /> <xsl:value-of select=substring-before(description, '&ltb&gt' /> </xsl:for-each> </xsl:template> </xsl:stylesheet> below xml working with. <rss version="2.0"> <channel> <item> <title>article_110224_081057</title>

merge - Why is mercurial dumb when merging? How can I make pulling/merging changes simpler? -

i started use mercurial , think i'm trying simple, should quite typical, i'm stumped on why it's complicated, , why doesn't work way should (imo). i share repository friend, makes changes , checks in several files , pushes them. in svn i'm used updating working copy , getting changes, no hassle. mercurial apparently have merge. don't is: shouldn't mercurial smart enough figure out if friend made recent changes, , haven't touched files, should use version of file?? apparently can't figure out, , instead tries merge files utterly fails (actually have installed beyond compare automatically opened, can't blame mercurial entirely bad merge). at rate, don't know why has "merge" files when it's obvious (to me) should have taken remote (i.e. recent) changes. doing wrong in how i'm using tool, or there can make work in simpler way (the way i'm used working in subversion)... there configuration settings, tips on comm

An error running my application in the Android emulator -

i developing android application. there no error in application but, while running application in android emulator showing: the application has stopped unexpectedlly please try again. i tried number of times showing same error. application running in same emulator. how know there no error in application? if application being "stopped unexpectedly" means there bug in application. depending on environment using, should able connect debugger android emulator , see application crashes, can work out why crashes.

iis - multiple users accessing wcf, stalls service -

we have setup: 1) web site fronts functionality user, 1 of modules connect separate web service (wcf) reference. 2) internal web service visible within network provides separate functionality public website. render , return data , rdlc reports byte array. when tried running web service's application pool under network system, website failed access it. when set web service local system works. the issue left whenever more users try access web service website, somehow, web service stalls , pool refresh required make running again. i've checked settings of iis web service , connections set unlimited. help! as said in comment, serious work typically recommend against using iis application host. has several drawbacks (it dictates service address, has deal app pools , recycling etc.) instead, production services in self-hosting manner, e.g. inside windows nt service. gives me lot more flexibility: i'm in full control of aspects, including addresses, , can

android - How do I call a local method in my class by an intent in alarmManager? -

for example: public class calls extends service { public void oncreate() { //call mymethod here alarmmanager } mymethod() { } } i'm not sure if missing something, why this? public class calls extends service { public void oncreate() { mymethod(); } mymethod() { } }

iphone - MultipleControllers in one view -

i trying add 2 view controllers 1 controller. i created view based application called "multipleviews". after add 2 controller classes "redview.h" , "blueview.h" own xibs. able add views of both controllers "mutipleviewsviewcontroller" method [self.view addsubview:red.view] . both views displayed properly. problem when add button red , blue controllers. whenever click button says unrecognized selector sent instance though linked buttons functions properly. missing here? here code: multipleviewsviewcontroller.h #import <uikit/uikit.h> @interface mutipleviewsviewcontroller : uiviewcontroller { } @end mutipleviewsviewcontroller.m - (void)viewdidload { [super viewdidload]; redview *red = [[redview alloc]init]; red.view.frame = cgrectmake(0, 0, 320, 240); [self.view addsubview:red.view]; blueview *blue = [[blueview alloc]init]; blue.view.frame = cgrectmake(0, 240, 320, 240); [self.view adds