Posts

Showing posts from May, 2015

vb.net - combobox displays System.Data.DataRowView when trying to select the data from sql database -

i got system.data.datarowview when tried select data sql database. these code: ...... mycommand = new sqlcommand("select firstname +' '+ lastname tblvisitor", myconnection) myadapter = new sqldataadapter(mycommand) myadapter.fill(mydataset, "tblvisitor") cboname.datasource = mydataset.tables(0) cboname.displaymember = "firstname" cboname.displaymember = "lastname" cboname.valuemember = "firstname" cboname.valuemember = "lastname" .............. and got above error. please help. your selectcommand neither return column lastname nor firstname . returning 1 column(a concatenation of both columns). so should work: mycommand = new sqlcommand("select visitorid, lastname, firstname, (firstname +' '+ lastname)as fullname tblvisitor", myconnection) myadapter = new sqldataadapter(mycommand) myadapter.fill(mydataset, "tblvisitor") cboname.datasource = mydataset.tables(0) cboname....

opengl - Unexplainable behavior when using uniform sampler2d[] -

i'm sorry require little bit of explanation. i'm trying make simple possible. what want do: i'm visualizing height fields. height field may have multiple patches . patch smaller texture alters height field. i'm using opengl 4.0, tesselation shaders. problem should irrelevant. what working allready. have visualisation height field (without patches) working. interessing parts in regard problem tesselation evaluation shader , fragment shader. the tesselation evaluation shader fetches each vertex height height field sampler. layout(quads, fractional_odd_spacing, ccw) in; out float onedge; out float tedistancetominheight; out vec4 tcposition; void main() { // bilinear interpolate: position vec4 pos_a = mix(gl_in[0].gl_position, gl_in[1].gl_position, gl_tesscoord.x); vec4 pos_b = mix(gl_in[3].gl_position, gl_in[2].gl_position, gl_tesscoord.x); vec4 position = mix(pos_a, pos_b, gl_tesscoord.y); // bilinear interpolate: hf texture ...

c# - Efficient way to select records with children? -

i have linq sql query following... return parent in context.parents ( (parent.someproperty != null && parent.someproperty != "") || (context.childs.count(c => c.parentid == parent.id && c.type == "sometype") > 0) ) select parent the idea want find parent records have either got value "someproperty" or have child records of type "sometype". the problem query timing out. there quicker (but still easy read) way of doing same thing? thanks reading. use any() instead of count() : return parent in context.parents ( (parent.someproperty != null && parent.someproperty != "") || context.childs.any(c => c.parentid == parent.id && c.type == "sometype") ) select parent; in linq sql count(<some condition>) translate...

f# - FsLex - Differ between 2 strings -

i've couple of tokens: pname , ename - both strings. now want setup 2 rules in lexer, in order match tokens. the first rule ( pname ) should match when string consist of characters a-z, , optional special characters @/(). the second rule ( ename ) should match when string consist of characters a-z, , optional prefix (#/.). now how make rule in lexer file match ename - when theres no prefix? if makes difference, ename have { after it's string like: (prefix)ename { - bracket shouldn't passed parser... any suggestions? if question related your previous question (about parsing css) files, should use different approach. the lexer should identify simple tokens such # , . (token names hash , dot ), curly braces (tokens lcurly , rcurly { , } respectively) , identifier ident using regular expression takes sequence of characters a-za-z . the rest of processing (such identifying css rules .foo { ... } ) should done in parser. in previou...

c# - Putting a connection string in the web config -

so i'm using c# , i've got following sql connection string: private static string _conn = properties.settings.default.dbizconnectionstring; and i'd know if , how can put in web config , app config? help! here's blog post scott forsyth explaining everything: using connection strings web.config

string - Working with the rep() function -

i'm using rep() function repeat each element in string number of times. each character have contains information state, , need first 3 elements of character vector repeated 3 times, , fourth element repeated 5 times. so lets have following character vectors. al <- c("alabamacity", "alabamacityst", "alabamacitystate", "alabamazipcode") ak <- c("alaskacity", "alaskacityst", "alaskacitystate", "alaskazipcode") az <- c("arizonacity", "arizonacityst", "arizonacitystate", "arizonazipcode") ar <- c("arkansascity", "arkansascityst", "arkansascitystate", "arkansaszipcode") i want end having following output. alabamacity alabamacity alabamacity alabamacityst alabamacityst alabamacityst alabamacitystate alabamacitystate alabamacitystate alabamazipcode alabamazipcode alabamazipcode alabamazipcode alabamazipcode...

javascript - How to import JSON object with functions inside? -

good day, i playing js.class right , i'm making text-based game. now, executed in browser eventually, executed in node.js environment managing sockets , ansi colors supports players using telnet-like client. i have created few classes , 1 of them define characters (which either real player or in-game character). for real player, code create new 1 looks this: new character( "userid", { /* player's options/settings/parameters here*/ }, socket ); example: new character( "000001", { "name" : "cybrix", "zone" : "000001-000003", "stealth" : false, "fighting" : false, "blind" : false, "sleeping" : false }, socket ); more often, in-game characters should have differents , uniques methods use simulate event-like behavior. example: new character( "000001", { "name" : "large dragon boss", "zone" : ...

c++ - Unusual behaviour with std::list<myclass*>::iterator comparison -

i'm seeing unusual behavior when compare 2 iterators. vector<list<myclass*>> vlwatchers(10); list<myclass*>::iterator itcurrent, itend; (int i(0); <= 9; ++i) { itcurrent = vlwatchers[i].begin(); itend = vlwatchers[i].end(); while (itcurrent != itend) { //code } } will cause liste iterators incompatible error on while() line, , appears happen when = 0, although of time. upon further investigation after error called, itend , itcurrent both equal 0xcdcdcdcd. weird part when step != compare operator, "this" pointer becomes 0xcdcdcdcd. shouldn't 0xcdcdcdcd value that's stored in iterators, not address of iterators themselves? or there sort of iterator black magic iterator both stores value , value? part of larger project, error repeatable. thank in advance help! let's follow logic chain (assuming first few lines of for loop described): itcurrent->this == 0xcdcdcdcd , therefore ... ...

Performance testing on JMeter -

i want performance testing on jmeter uploading 20000 images files approx 40-50 concurrent login users. , after 1000000 images files approx 450-500 concurrent login users. size of each image around 900kb. can 1 suggest me possible through jmeter or other open source tool? if jmeter fine then: 1. how can pick these images ftp location , store in db after login user , number of users have mentioned above? 2. how users login one-by-one in application? 3. best way test kind of scenario i.e. on distributed machines or single machine? if 1 have best way, kindly share me. in advance! this can done jmeter. for 450-500 concurrent logins, you'll either want run jmeter on server, or on cluster of machines keep input/output choking itself.

multithreading - What is the difference between +[NSThread detachNewThreadSelector:toTarget:withObject:] and -[NSObject performSelectorInBackground:withObject:]? -

they seem perform reasonably similar task: launching new thread performs selector , easily. there differences? maybe regards memory management? both identical. in ios , mac os x v10.5 , later, objects have ability spawn new thread , use execute 1 of methods. performselectorinbackground:withobject: method creates new detached thread , uses specified method entry point new thread. example, if have object (represented variable myobj) , object has method called dosomething want run in background thread, could use following code that: [myobj performselectorinbackground:@selector(dosomething) withobject:nil]; the effect of calling method same if called detachnewthreadselector:totarget:withobject: method of nsthread current object, selector, , parameter object parameters. new thread spawned using default configuration , begins running. inside selector, must configure thread thread. example, need set autorelease pool (if not using garbage collection) , configure thread’s ru...

java - How to query data base on Date, but your DB store date as date + time. -

since want store date , time each data in table x , use @temporal(temporaltype.timestamp) private date dateprocess; //java.util.date and work great. want create query return data in same date. try select c x c c.dateprocess = : dateprocess then pass in java.util.date parameter dateprocess , returned result list empty. guess must time comes place here. if 2 dates not have exact date , time, not equal, explain why returned result list empty. how return list of data base on date (dont care time) in scenario? just use date range, specify start , end time. > starttime , < endtime

sql - In TSQL for MSSMS 2000, how does one change a nonnullable column to be nullable? -

i know column doing reverse process (nullable nonnullable) is alter table [course_enrollment] alter column [enrollment_date] datetime not null but going nonnullable nullable? (i don't want mess things up, removing not above sql , therefore might risk changing default value null.) this correct assumed: alter table [course_enrollment] alter column [enrollment_date] datetime null; in nullable column default in fact null unless specify otherwise.

groovy - Most efficient way to store big hexadecimal number (md5) in java object -

what efficient way (optimal performance , storage space) store md5 sum of file in java (or groovy) object considering following use-cases: i need compare thousands of other md5 sums. i may need store in hsqldb, records can pulled/ group by based on md5 may stored in map 's keys i trying avoid storing string string comparisons more costly , take more space. biginteger(string,radix) more efficient? also, datatype should selected if persisting in database? create class wraps byte[] , provides no mutation. if want use key in map, needs either comparable, or have hash code. byte[] you'll have easier time computing simple hashcode first 32 bits.

javascript - Location.href and urlrewriting -

hi have urlrewriting in application. this; www.mydomain.com/pmillio i using location.href url in 1 of functions, location.href gives me www.mydomain.com/pmillio however need change url looks instead; www.mydomain.com/user-profile.aspx?username=pmillio how go doing this? this should it... location = 'user-profile.aspx?username=' + (location.pathname).replace('/','');

xcode - How to specify working directory for sqlite3_open -

working in xcode works ok if execute double-clicking project down in working directory not xcode doing build , run. database isn't being found correctly. how modify... sqlite3_open("airports.sqlite", &db); so can find airports.sqlite in current working directory? copy database applications directory , after can use database :) nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory , nsuserdomainmask, yes); nsstring *dbpath = [[paths objectatindex:0] stringbyappendingpathcomponent:@"airports.sqlite"]; bool success = [filemanager fileexistsatpath:dbpath]; if (!succes){ nsstring *defaultdbpath = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"airports.sqlite"]; bool success = [filemanager copyitematpath:defaultdbpath topath:dbpath error:&error]; if (!success) nsassert1(0, @"failed create writable database fil...

php - building REST API - long header -

i'm building api.. think server sends quite long header compared other "apis".. http/1.1 200 ok date: thu, 30 jun 2011 19:51:22 gmt server: apache/2.2.16 (debian) x-powered-by: php/5.3.3-7+squeeze1 set-cookie: phpsessid=dv1nrjrd47qurff4u9tn8afa84; path=/ expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache vary: accept-encoding content-length: 0 connection: close content-type: text/html just want know if there disadvantage of regarding safety? edit yay..! i'm down this http/1.1 200 ok date: thu, 30 jun 2011 20:51:18 gmt server: apache content-length: 0 connection: close content-type: application/json there no appreciable disadvantage in term of permormance send these header client. client should never cache response returned web service call since client not browser. you start session (see phpsessid cookie) , if not useful client, simple don't start session ...

Django testing of multi-db with automatic routing -

simple problem - i'm using multi-db automatic routing setup documented on legacy db (which unmanaged). want test it. i've set testrunner around managed problem , can confirm creating databases , expected. my problem database routing still trying @ non-test database. how can setup routers.py file @ test_ database when in test mode , non-test database other time. should simple i'm beating head on wall on one.. fwiw: class pmcatalogrouter(object): """a router control database operations on models in pmcatalog application""" def db_for_read(self, model, **hints): "point operations on pmcatalog models 'catalog'" if model._meta.app_label == 'pmcatalog': return 'catalog' return none def db_for_write(self, model, **hints): "point operations on pmcatalog models 'catalog'" if model._meta.app_label == 'pmcatalog...

modulus - Using Python Modulo Operator to Sort List -

i've been working on project euler problems try , learn python , wrote solution second problem (find sum of even-valued terms in fibonacci sequence not exceed 4 million). code gives me correct solution, requires me use modulus division twice in order remove odd-numbered values list of fibonacci numbers generated. here solution wrote: term_1 = 1 term_2 = 2 fibonacci_list = [1] while term_2 < 4000000: fibonacci_list.append(term_2) term_1, term_2 = term_2, term_1 + term_2 num in fibonacci_list: if num % 2 != 0 fibonacci_list.remove(num) num in fibonacci_list: if num % 2 != 0 fibonacci_list.remove(num) return sum(fibonacci_list) if put in 1 for-loop, list fibonacci_list becomes following: [2, 5, 8, 21, 34, 89, 144, 377, 610, 1597, 2584, 6765, 10946, 28657, 46368, 121393, 196418, 514229, 832040, 2178309, 3524578] shouldn't odd numbered terms fail modulus division test , removed? why need run loop twice remove odd numbered terms? ...

excel - Loop through list to copy batches of like values -

i'm trying copy batches of rows, based upon 1 column's values. the worksheet looks (sorted first column): 5 blue 6 yellow b 3 red b 2 blue the loop has 3 primary steps: copy rows beginning value, e.g. rows 1-2, both begin "a" paste rows email (i know how this) move value, b, , copy rows starting b i won't know values of column a, change each time. there way can still write loop? 2 possible approaches: 1: rather thinking of copying "a" rows @ once, have build string add each row, , when hit new value first column, flush build string email. way single loop condition check in there. 2: maintain startpos. set 1. loop through first col till value changes. copy startrow - currentrow - 1 email. set startpos = currentrow. repeat.

android - SQL cursor error -

i have been using notepad sqlhelper (notesdbadapter) model, of works, doesn't. can cursor 'fetchallrecords() crashes if try call passing argument , using 'where'. argument passed cursor fails. code in activity; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.listselectedfile); //button id clicked in previous activity bundle bundle = getintent().getextras(); int btnid = bundle.getint("buttonid"); toast.maketext(this, "buttonid selected in main:= " + btnid, toast.length_long) .show(); mdbhelper = new sectionsdbadapter(this); mdbhelper.open(); filldata(); } private void filldata() { // of notes database , create item list //cursor c = mdbhelper.fetchallrecords(); <=== works fine cursor c = mdbhelper.fetchrecordsbysource("uk"); <=== fails in dbhelper startmanagingcursor(c); ...

When using Spring MVC for REST, how do you enable Jackson to pretty-print rendered JSON? -

while developing rest services using spring mvc, render json 'pretty printed' in development normal (reduced whitespace) in production. if using spring boot 1.2 or later simple solution add spring.jackson.serialization.indent_output=true to application.properties file. assumes using jackson serialization. if using earlier version of spring boot can add http.mappers.json-pretty-print=true this solution still works spring boot 1.2 deprecated , removed entirely. deprecation warning in log @ startup time. (tested using spring-boot-starter-web )

Rich text formatting (RTF) editor plugins for Rails 3 and jQuery website? -

which rtf editor use? we're on rails 3 , jquery , looking implement low-maintenance rtf editor. prefer use third-party plugin rather build scratch. which 1 use today, , pros/cons? i've used ckeditor , customizable easily.

php - Finding Content from Javascript using Simple HTML DOM Parser -

how find content "please enter valid key again" using simple html dom parser? example: <script language="javascript"> function enable() { alert('please enter valid key again'); } </script> this don't seem work: <?php include_once("simple_html_dom.php"); $html = file_get_html("incorrect.html"); $ret = $html->find("please enter valid key again", 0); if ($ret) { echo "found"; } else { echo "not found"; } ?> you can in simpler way: <?php include_once("simple_html_dom.php"); $html = file_get_html('incorrect.html'); (strstr($html,'please enter valid key again')) ? print("found") : print("not found"); ?>

MongoDB Geospatial Query Count Issue (Always 100) -

it appears there issue count operation on geospatial query contains more 100 results. if run following query still count of 100 no matter what. db.locations.find({"loc":{$nearsphere:[50, 50]}}).limit(1000).count() i understand default size limit on query uses "near" syntax 100 appears cannot return more that. doing wrong or there workaround this? try "within" instead of "near". works me, center = [50, 50]; radius = 1/111.12; //convert km. db.places.count({"loc" : {"$within" : {"$center" : [center, radius]}}}) i found @ https://jira.mongodb.org/browse/server-856

java - Simple Captcha and make different colors -

i've watched link http://simplecaptcha.sourceforge.net/ , gives demo of images showing captcha can designed colored 1 can not black , white one. reason couldn't find tutorials of how control simplecaptcha colors :( if know snippets or tutorials share them please. all useful comments appreciated :) which part want in color? can, example, control color of text via wordrenderer . examples of how use captcha.builder can found on website . can add things following of these examples: list<java.awt.color> textcolors = arrays.aslist( color.black, color.blue, color.red); list<java.awt.font> textfonts = arrays.aslist( new font("arial", font.bold, 40), new font("courier", font.bold, 40)); java.awt.color backgroundcolor = color.orange; captcha captcha = new captcha.builder(200, 50) .addtext( new defaulttextproducer(), new defaultwordrenderer(textcolors, textfonts)) .addbackground(new flatcolorback...

objective c - Is it possible to erase drawing made by NSRectFill? -

i have been using nsrectfill draw rectangles on screen. erase these rectangles. can't paint on them, ground behind them textured , can't replicated solid color. possible? i don't know objective-c, or cocoa, can't give details, here's how windows oriented mind thinks: simply request redrawing of window, , don't paint rectangles.

OpenGL problem on Android -

i'm quite new animations in android. 3d animations have use opengl make more fluid. is possible convert drawable draw rectangle or circle on canvas , want convert view using opengl. possible , if how? can please let me know first point in features in url http://developer.android.com/reference/android/opengl/glsurfaceview.html well, can try convert drawable bitmap , map bitmap on 3d surface in opengl texture.

mysql - How to update value for all rows in table A should update all corresponding column values in table b and c -

i need update column x different value each record in table of 60 records, , when update column in table ,the column value particular column x must updated in table b , table c column x value. here column x primary key in table b , c not in table a. this triggers for. an example taken documentation: mysql> create table account (acct_num int, amount decimal(10,2)); query ok, 0 rows affected (0.03 sec) mysql> create trigger ins_sum before insert on account -> each row set @sum = @sum + new.amount; query ok, 0 rows affected (0.06 sec) this example not modify second table, can done triggers well--possibly using stored procedure.

multithreading - Must read articles on Java Threads -

i reading article on java threads: http://java.sun.com/docs/books/jls/second_edition/html/memory.doc.html , think must read java developer. other must read articles java threads or threads in general? i found book java concurrency in practice resource. teaches need know threads , concurrency in java. highly recommend it.

xcode4 input sizes manually in interface builder -

so how can make button of 42px x 42px ? is there panel input numbers manually? you need set size in size inspector (an option in inspector window @ right hand side). set height = 42; , width=42;

c# - How extension methods are implemented internally -

how extension methods implemented internally? mean happens when compiler sees declaration extension method , happens @ runtime when there call extension method. is reflection involved? or when have extension method code injected in target class type metadata additional flags noting extension method , clr knows how handle that? so in general, happens under hood? as have said other colleagues static method. compiler can clr have no idea extension methods. can try check il code .. here example static class extendedstring { public static string testmethod(this string str, string someparam) { return someparam; } } static void main(string[] args) { string str = string.empty; console.writeline(str.testmethod("hello world!!")); ........ } and here il code. il_0001: ldsfld string [mscorlib]system.string::empty il_0006: stloc.0 il_0007: ldloc.0 il_0008: ldstr "hello world!!" il_000d: call ...

testing - testability of a design -

much has been written testing of code. how ensure our design functionally correct in first place? have junit testing java code, there tools can used, say, test uml based design, tests expressed in form of functional requirements? these vague thoughts, wanted know if there's methodical, automatable approach testing design first. in other words, can have 'test driven design'? interesting topic! firstly, no software architects in personal network use uml way design systems, , know of no software architects create uml @ level of detail required execute mechanical test. secondly, have deep dislike of uml modeling tools. if such formal verification method implemented, it's in rational rose - swore long ago i'd never go anywhere near again. however, having said - in formal software shops, it's common have requirements tracability, typically implemented matrix shows business requirements on 1 axis, , design artifacts on other. way, can see whether r...

ruby on rails - Devise Not Validating Password/Password Confirmation -

i have custom controller handles editing of user passwords based off of code here . user model attr_accessible :password, :password_confirmation, :username, :login ... devise :database_authenticatable, :lockable, :registerable, :recoverable, :rememberable, :trackable passwordscontroller expose(:user) { current_user } def update if user.update_with_password(params[:user]) sign_in(user, :bypass => true) flash[:notice] = "success" else render :edit end end my edit password form located here . the problem no matter enter (or don't enter matter) edit password form, "success" flash method displayed. if want devise validations, need add :validatable module model. easy do, add :validatable list of module in devise call, model says: devise :database_authenticatable, :lockable, :registerable, :recoverable, :rememberable, :trackable, :validatable this mak...

payment gateway - Paypal payement failure in test account in java -

i trying develop application in paypal dodirectpayment method creating testing sandbox account , use following code own api credentials acknowledgement failure ... if 1 know how rid out issue share me., thanks in advance. public class dodirectpayment { private nvpcallerservices caller = null; public string dodirectpaymentcode(string paymentaction,string amount,string cardtype, string acct,string expdate,string cvv2, string firstname, string lastname, string street, string city, string state, string zip, string countrycode) { nvpencoder encoder = new nvpencoder(); nvpdecoder decoder = new nvpdecoder(); try { caller = new nvpcallerservices(); apiprofile profile = profilefactory.createsignatureapiprofile(); /* warning: not embed plaintext credentials in application code. doing insecure , against best practices. api credentials ...

php - How the communities like facebook,orkut can able to track down our mail contact list -

how few social communities can able track down contact lists our mail id alone.is there mou or open all. can explain this. thanks lokesh. this question deals facebook , gmx specifically: importing facebook friends api they shouldn't able track down contact information e-mail address alone, though. services know ask user name , password log in actual service. if you're seeing contact suggestions without giving network e-mail credentials, happens cross-reference address against other people's contact lists.

objective c - Hide navigation bar -

i have 3 views. (say 1st,2nd,3rd). have pushed 2nd view (which has load view method) on 1st. in 2nd view have created 3rd using initwithframe (which inherited uiwebview). in 2nd view wrote self.view=3rd view. now want hide 2nd view's navigation bar in 3rd view (i.e., when user touch 3rd view screen i.e. uiwebview). got touch recognition using gesture, can't hide navigation bar. 3rd view don't support self.navigationcontroller . , if create 2nd view's object in 3rd, not hide navigation bar. can me? ok. need set navigation bar hidden right after create navigation controller tab. cannot adjust after push view controller (as far know). if want first view not have navigation bar @ top, use in appdelegate declare navigation controllers: localnavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:theviewcontroller]; [localnavigationcontroller setnavigationbarhidden:yes animated:yes]; if want views after hidden, need viewcontro...

python - Erratic problem with App Engine when writing files directly to the blobstore -

i'm using app engine python. in order store images of users, write them directly blobstore indicated in google documentation . my code below: # image insertion in blobstore file_name = files.blobstore.create(mime_type='image/jpeg') files.open(file_name, 'a') f: f.write(self.imagecontent) files.finalize(file_name) self.blobkey = files.blobstore.get_blob_key(file_name) logging.info("blobkey: "+str(self.blobkey)) the problem erratic. don't change , since yesterday works doesn't work. why? print blobkey (last line of code), can see whether image has been saved blobstore or not. when works, have following line displayed: blobkey: amifv94p1cfdqkza3ahzuf2tf76szvewpggwopn... when doesn't work, have in logs: blobkey: none last detail: images (self.imagecontent) preprocessed , converted .jpeg before each write. edit: everytime, images stored in blobstore (i can see them in blobviewer in administration console). that's get_b...

.net - Does anyone still use [goto] in C# and if so why? -

i wondering whether still uses "goto" keyword syntax in c# , possible reasons there doing so. i tend view statements cause reader jump around code bad practice wondered whether there credible scenarios using such syntax? goto keyword definition there (rare) cases goto can improve readability. in fact, documentation linked lists 2 examples: a common use of goto transfer control specific switch-case label or default label in switch statement. the goto statement useful out of nested loops. here's example latter one: for (...) { (...) { ... if (something) goto end_of_loop; } } end_of_loop: of course, there other ways around problem well, such refactoring code function, using dummy block around it, etc. (see this question details). side note, java language designers decided ban goto , introduce labeled break statement instead.

c# 4.0 - Relevance the search result in Lucene -

what want : in search method add parameter relevance param of type float setup cuttoff relevance. lets if cutoff 60% want items higher 60% relevance. here current code of search : say search text , in lucene file system have following description: 1) abcdef 2)abc 3)abcd for fetch above 3 docuements , want fetch are higher 60% relevance. //for not using relevanceparam anywhere in method : public static string[] search(string searchtext,float relevanceparam) { //list of id list<string> searchresultid = new list<string>(); indexsearcher searcher = new indexsearcher(reader); term searchterm = new term("text", searchtext); query query = new termquery(searchterm); hits hits = searcher.search(query); (int = 0; < hits.length(); i++) { float r = hits.score(i); document doc = hits.doc(i); searchresultid...

jquery map - assign the return value as a key of the receiving object -

i have: <img class="images" src="src1"> <img class="images" src="src2"> <img class="images" src="src3"> <img class="images" src="src4"> var pictures = $(".images").map(function(){ return $(this).attr("src"); }) the code above creates new pictures array. can think of efficient way create new pictures object using jquery map function. like: var pictures[key] = $(".images").map(function(){ var key = $(this).attr("src"); return key; }) ... directly assign return value key pictures object. there way? can't iterate collection? var picobj = {}; $(".images").each(function() { picobj[$(this).attr("src")] = '...'; }); ( demo - print console )

asp.net - Master Page code behind not compiling into assembly -

i stumped problem. have asp.net web application contains master pages. morning added new master page , wired aspx. however, keep getting y.s.o.d error: parser error message: not load type 'blah.ui.web.webforms.master.loggedin'. source error: line 1: <%@ master language="c#" masterpagefile="~/webforms/master/iframecontent.master" autoeventwireup="true" codebehind="loggedin.master.cs" inherits="blah.ui.web.webforms.master.loggedin" %> at first thought i'd spelled wrong in master page directive, i've checked , double checked , doesn't seem it. since said "could not load type" used dotpeak check code behind class had been compiled assembly , wasn't there. original master pages there, 1 added morning not. so, figured i'd built wrong somehow (i'd attempted full rebuild already... might try again). still missing. i checked csproj file aga...

c++ - Why is 'this' not volatile? -

having spent last few days debugging multi-threading 1 thread deleting object still in use realised issue have been far easier , quicker diagnose if have made 'this' volatile. have changed crash dump on system (symbian os) far more informative. so, there reason why cannot be, or shouldn't be? edit: there no safe way prevent or check scenario. correct 1 solution accessing of stale class pointers have global variable holds pointer, , functions called should statics use global variable replacement 'this'? static tany* gglobalpointer = null; #define harness static_cast<csomeclass*>(gglobalpointer); class csomeclass : public cbase { public: static void dosomething(); private: int imember; }; void csomeclass::dosomething() { if (!harness) { return; } harness->imember = 0; } so if thread deleted , nulled global pointer caught immediately. one issue think if compiler cached value of harness...

python - Drawing my own object on a layout: problem with subclassing gtk.drawable -

i want draw own object on layout, i'm trying subclass gdk.drawable, class link(gtk.gdk.drawable): def __init__(self,comp1,comp2,layout): super(link, self).__init__() self.x1=comp1.xpos self.y1=comp1.ypos self.x2=comp2.xpos self.y2=comp2.ypos self.layout=layout error: cannot create instance of abstract (non-instantiable) type `gdkdrawable' i can without subclassing drawable using layout.bin_window.draw_line() in method drawlink() of link object, i'm not able create custom graphic context gdk.gc each object , have use layout.get_style() same links! def drawlink(self): gc = self.layout.get_style().fg_gc[gtk.state_normal] gc.line_style=gtk.gdk.line_on_off_dash gc.line_width=6 self.layout.bin_window.draw_line(gc,self.x1, self.y1, self.x2, self.y2) this reason want subclass drawable. if can use custom gc without subclassing drawable or(window, pixmap) great. thanks any alternative? if un...

php - Basic concept/principle of ECommerce Site -

is there short tutorial explain basic principles/concept , database design of ecommerce website? are looking technical solution building ecommerce website ? i'd advise use builtin solution designed purpose, here best-of : http://woork.blogspot.com/2009/01/8-interesting-cms-for-e-commerce.html http://www.ilovecolors.com.ar/ecommerce-cms-open-source-commercial/ (if choose use joomla!) http://www.web3mantra.com/2011/01/24/20-joomla-ecommerce-templates/ were looking tips ? http://uxdesign.smashingmagazine.com/2009/10/08/15-common-mistakes-in-e-commerce-design-and-how-to-avoid-them/ regards, max

multithreading - android thread worker queue -

i have threads runs in app, want if threads called @ same time not execute concurrent. , want wait 1 second delay between run next thread. how can that? maybe right way implement worker queue of runnables object have use , how? threadpoolexecutor choice? http://developer.android.com/reference/java/util/concurrent/threadpoolexecutor.html you use intentservice. implements background thread, , automatically queues start requests. start other service, startservice(intent). documentation: http://developer.android.com/reference/android/app/intentservice.html way ensure background threads allowed finish, when ui-thread sent system or user.

sql server 2008 - Invalid Object Name for Table which is successfully updated in the same Stored Procedure -

we seeing 'interesting behavior our sql sever database. have merge statement selects table x. in match clauses there subselect table x. when execute stored procedure sql server tools works fine. when executed ipc (an etl tool) exception invalid object name 'x'. so far nothing special understand there can lots of things wrong permissions , stuff. the strange thing: merge statement in try block , in catch block error message gets written table x via update statement! how possible when sql server complains can't find table x? also works fine stored procedure constructed in same way (via code generation) on different set of tables. the code looks this merge ... using (select ... dbo.x ... when not matched target , not exists (select 1 dbo.x q2 ...) insert (... ) values (... ) when matched , q.action='d' delete when matched , not exists (select 1 dbo.x q3 ...) update set ... o...

Is there an enum or class in .NET containing the WebDAV http status codes -

i have been using httpstatuscode enumeration (msdn) return errors in web requests, want return 422, "unprocessable entity" (webdav.org) , see not among enum's members. i not able find in .net framework, , avoid custom solutions (devio.wordpress.org) if can (i.e. if indeed exist). the scenario this: client posts request, , validation occurs in server. after quick search on decided 422 perhaps most appropriate , or maybe 400 . so, know if there enum or class in .net 4.0 containing webdav http status codes? thank you! no, no such file defined -- had same requirements api i'm building , decided typecast (which possible int enums) this: try { if (!repository.cancel(idhelper.decrypt(id))) { return request.createresponse(httpstatuscode.notfound, "booking not found"); } } catch (exception x) { // typecast 422 enum because it's not defined in httpstatuscode return request.createresponse((httpstatuscode)422, x.me...

Aspose, append Pdf's without extra space -

i've got list of pdf objects (or streams) , append them there wont white space between them. aspose 'pdffileeditor.concatenate' adds next pdf starting next page i'd add after previous finishes. is possible? i don't know if possible (there wasn't time) had refactor code 1 stream created correct layout.

EditText in Google Android -

i want create edittext allow numeric values , comma , delete , other values ignore. so how can achieve programming code ? thanks. i achieved same thing using follwing code, hope find it. edittext.addtextchangedlistener(controller); @override public void aftertextchanged(editable s) { if(s.trim.length() > 0) { int start = s.tostring().length() - 1; int = (int) s.charat(start); if (!(a >= 48 && <= 57 || == 44)) s = s.delete(start, start + 1); } } @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { }

ruby on rails - Refactoring validation methods and callbacks -

i using ruby on rails 3.0.7 , have tree classes behavior same (and code in them model files). have name , description attribute, run same validation methods , both there before_save callback maintains data consistent providing same functions. i refactor validation methods , callbacks in separated class\model (i think have locate them related files in \lib folder of application). what have make that? code have add in classes , in refactoring class\model? well, make super class 3 models inherit. tend put abstract base class in app/models alongside models themselves. # app/models/thing.rb class thing < activerecord::base # common code goes here, such before_save ... validates_length_of :foo end # app/models/red_thing.rb class redthing < thing # methods specific redthing go here end # app/models/blue_thing.rb class bluething < thing # methods specific bluething go here end if things have many differences such doesn't make sense g...

c# - I have a problem with TabContainer control -

it doesnt appear on screen when run it..but appear in visual studio 2010 in design view. want set tabs left right right left: <asp:tabcontainer id="tabcontainer1" runat="server" activetabindex="2" height="584px" width="739px" autopostback="true" backcolor="#666699" bordercolor="#666699"> <asp:tabpanel id="questions" runat="server" headertext="שאלות"> <contenttemplate> <asp:gridview runat="server" height="547px" style="margin-left: 2px; margin-top: 15px" width="667px"> </asp:gridview> </contenttemplate> </asp:tabpanel> <asp:tabpanel id="answers" runat="server" headertext="תשובות"> <content...

winforms - C#: click (where applicable) versus validating event -

i working on windows forms visual c# , have bunch of radio buttons grouped together. i needed call methods if radio button clicked , validation. so have 2 methods, public void dosomestuff() public bool valradiobutton1() i can call dosomestuff() in click event , latter in validating event of radiobutton call both in either click event or validating event. my question there advantages , disadvantages event use call these? or there particular way more efficient. right seems both events exact same thing why use 1 or or both. radio buttons kind of strange in combination conventional validation. validating event seems designed allow validate value once when user done entering value instead of every time value changes user entering it. makes sense textbox want @ completed text instead of after each character user types. it's little more obscure radio buttons. in fact think should avoid validating event of radio buttons , instead use validating event of containe...