Posts

Showing posts from March, 2012

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

python - Google App Engine, define a Preprocessing class -

trying define base request handling class webapp pages may inherit basic methods , variable otherwise required repeatedly defined each page of application. sort of similar functionality django preprocessors . base class other pages inherit: class basepage(webapp.requesthandler): def __init__(self): self.user = users.get_current_user() self.template_values = { 'user': self.user, 'environ': self, #i don't idea of passing whole environ object template ##the below 3 functions cannot executed during _init_ because of absence of self.request #'openid_providers': self.openid_providers(), #'logout_url': self.get_logout_url(), #'request': self.get_request(), } ##a sort of similar functionality render_to_response in django def render_template(self, template_name, values =

html - Is it possible to save changes in Firebug locally? -

what i'm trying save changes make css , html on different sites firebug. just clear, don't expect firebug upload changes server via ftp or anything. want save changes locally, able see them. for example i've seen few firefox/chrome extensions add download button under every video on youtube, know it's possible somehow. if have different way achieve i'm trying do, i'll glad hear it. (it doesn't have firebug.) thanks in advance! you try using greasemonkey . it has support adding custom scripts run whenever load page (linked pages should load on) , can make changes page dynamically. https://addons.mozilla.org/en-us/firefox/addon/greasemonkey/

wordpress - Redirect from subdir to subdom results in "website can't be found error" -

options -indexes +followsymlinks rewriteengine on rewritebase / rewritecond %{http_host} ^domain.be [nc] rewriterule ^(.*)$ http://domain.be$1 [l,r=301] redirectmatch 301 ^/alpha/(.*)$ http://alpha.domain.be/$1 redirectmatch 301 ^/beta/(.*)$ http://beta.domain.be/$1 i use above redirect wordpress subdirectory network installation subdomain structure prefer. redirect works, when type in xttp://domain.be/alpha, redirects me xttp://alpha.domain.be. unfortunately, i'm not seeing site longer, instead following error "network access message: website cannot found". ideas on how fix this?

c++ - Why is 'new' an operator, not a function? -

are there issues, compile time operator, sizeof associated new? new operator can overload (or all) of classes. edit: i'll try clarify address @sbi's comments below. consider 2 classes: class base { } class derived : public base { } let's assume new() function, , want specialize base class , descendants. have "basic" new() function: void *new(size_t size); overloaded functions cannot differ return types alone, can't do: base *new(size_t size); // illegal. we can't use member functions because need existing instance called. use static member functions: class base { static base *new(); } but resulting syntax when allocating instance of derived quite awkward: derived *derived = base::new(); // uh?

java - Lucene: Filtering for documents NOT containing a Term -

i have index documents have 2 fields (actually more 800 fields other fields won't concern here): the contents field contains analyzed/tokenized text of document. query string searched in field. the category field contains single category identifier of document. there 2500 different categories, , document may occur in several of them (i.e. document may have multiple category entries. results filtered field. the index contains 20 mio. documents , 5 gb in size. the index queried user-provided query string, plus optional set of few categories user not interested in. the question is : how can remove documents matching not query string unwanted categories. i use booleanquery must_not clause, i.e. this: booleanquery q = new booleanquery(); q.add(contentquery, booleanclause.must); (string unwanted: unwantedcategories) { q.add(new termsquery(new term("category", unwanted), booleanclause.must_not); } is there way lucene filters? performance issue here,

css - is it possible to calculate next z-index in javascript -

is possible highest z-index property in container if none of elements in have z-index set via styles? approach i've found googling returns "auto" z-index. there's jquery module can this.

synchronization - Distributed Lock Manager (DLM) for .NET? -

i've been examining several dlm's of them written in java or c++. can't seem find service implemented .net. idea or recommendations distributed synchronization in .net? have looked apache zookeeper? zookeeper centralized service maintaining configuration information, naming, providing distributed synchronization, , providing group services. there .net api at https://github.com/ewhauser/zookeeper/tree/trunk/src/dotnet

indexing - Mysql Index is not being used correctly -

i got strange problem simple mysql index. i got following table: create table `import` ( `import_id` int(11) not null auto_increment, `import_title` text, `import_url` text, `import_description` text, `import_completed` enum('y','n') not null default 'n', `import_user` int(11) default null, `import_added` timestamp not null default current_timestamp, primary key (`import_id`), key `import_added` (`import_added`) ) engine=myisam default charset=utf8; in table few thousand rows , want first 100 following select clause: select import_id, import_title, import_url, import_description, import_user, import_added import import_completed = 'n' order import_added asc limit 0,100 when use describe take closer @ query, local machine uses "added" index , returns 100 rows within few milliseconds expected. when use same database same structure , content on "production" server , use describe the

sql server 2005 - Select values out of XML column -

this structure of table create table [dbo].[tablea] ( [objectid] [int] identity(1,1) not null, [cgpracticecode] [varchar](5) null, [totalamt] [decimal](11, 2) null, [splitamt] [xml] null, ) the value in splitamt column in below format, no of rows may vary '<values> <row> <practicecode>be9</practicecode> <value>20</value> </row> <row> <practicecode>bea</practicecode> <value>3</value> </row> </values>' now how values this... (no problem in repeating 1st 3 columns) objectid, cgpracticecode, totalamt, practicecode, [value] have @ this article alex homer to return first row elements can use: select a.objectid, a.cgpracticecode, a.totalamt, a.splitamt.value('(/values/row/practicecode)[1]', 'nvarchar(50)') practicecode, a.splitamt.value('(/values/row/value)[1]', 'int') [val

.net - how to raise an event from another one -

i have 2 panels, , when first panel scrolled, want other 1 scrolled, how do that? thanks in advance :). you can listen scrollablecontrol.scroll find out when it's scrolling. unfortunately don't know of easy way make other 1 scroll correct location, think should able sending wm_vscroll or wm_hscroll using sendmessage api function. depending on contents of panels might able "cheat" setting autoscroll true , whenever first panel scrolled, set focus suitable control in second panel outside visible area , make scroll there. i'm not sure how work or if easier doing (if want scroll extreme sides of panel, might useful).

text to speech - How to launch Native App from Web app in iPhone? -

i want access tts (text-to-speech) , stt (speech-to-text) functionality of ios web app. since web app dont access ios device functions, possible launch native app web app? e.g. when user wants access tts (e.g. dragon dictation), web page launch native app, take recording , send recorded text web app again. or can access tts/stt functionality right web app? the native apps can access web apps custom url schemes set up, , built-in ones e.g. sms ( sms:// ), phone ( tel:// ), itunes ( itms:// ) , youtube ( http://youtube.com/watch?... ). if apps mention don't have own custom url schemes can use them, there's no other way can this.

asp.net - How do I interpret the results of the ANTS Memory Profiler? -

i've been profiling asp.net application ants memory profiler 6, , have seen indications of memory leaks. however, don't know whether or not growths i'm seeing supposed there or not (for instance, system.string grows lot each snapshot. should it?) i don't understand whole memory processso don't know if interpreting results correctly or not. how interpret results of ants memory profiler? i have kind of been able answer own question while solving memory issue. although string may on top of list of time, shouldn't see instance count keep growing , growing. turns out in applcation object thought being free'd wasn't held reference xml files of course held in strings. my test go home page of web site -> click page -> home page. doing should mean no new references should have been created (instance count should remain 0 (no growth)). hope can else.

listener - In Xul, how do I make a XPCOM component call a javascript function? -

i want implement listener/observer xpcom component, javascript code can register notified of events. possible? if understand correctly https://developer.mozilla.org/en/creating_javascript_callbacks_in_components might thing looking for.

c++ - Android binder in native code -

i have created class implements binder interface(service). able send data client. if want send asynchronous response client, need implement binder interface @ client well? yes, need implement binder interface on client well. way camera class , cameraservice work together. camera class implements icameraclient , passed server when connecting. in turn, server returns icamera instance client use. sp<camera> c = new camera(); const sp<icameraservice>& cs = getcameraservice(); if (cs != 0) { c->mcamera = cs->connect(c, cameraid); }

WebApp ignores patched perl pm file -

i never came in touch perl before, hope, real newbie question , can solve problem pretty quick... we've 1 perl based web application installed on windows 2003 server environment. installed version contains bug , know where apply patch. basically: have changed 2 lines in 1 of web apps pm files. to surprise, file change ignored , still same error messages references old version of file - identifiable line numbers. i've cleared browser caches, restarted web application (including apache) - no luck. now think/hope kind of perl feature, don't know enough of language ask google right questions. one tutorial said, perl interpreted language , changes source files effective immediately. isn't true site... are there more caches/files have touch or delete in order make changes effective? are sure perl using latest version of said pm file? there no other version somewhere else included getting used? take @ @inc step through programming using debugger

python - How to convert string to byte arrays? -

how can convert string byte value? have string "hello" , want change "/x68..." . python 2.6 , later have bytearray type may you're looking for. unlike strings, mutable, i.e., can change individual bytes "in place" rather having create whole new string. has nice mix of features of lists , strings. , makes intent clear, working arbitrary bytes rather text.

javascript - Unexpected token } -

i have script open model window.. chrome gives me "uncaught syntaxerror: unexpected token }" on line doesn't have closing curly brace. here portion of script has error: function showm(id1){ window.onscroll=function(){document.getelementbyid(id1).style.top=document.body.scrolltop;}; document.getelementbyid(id1).style.display="block"; document.getelementbyid(id1).style.top=document.body.scrolltop; } does have ideas on this? appreciated. try running entire script through jslint . may point @ cause of error. edit ok, it's not quite syntax of script that's problem. @ least not in way jslint can detect. having played live code @ http://ft2.hostei.com/ft.v1/ , looks there syntax errors in generated code script puts onclick attribute in dom. browsers don't job of reporting errors in javascript run via such things (what file , line number of piece of script in onclick attribute of dynamically inserted element?). why confusing

c# - How to make a 'struct' Nullable by definition? -

struct accountinfo { string username; string password; } now if want have nullable instance should write: nullable<accountinfo> myaccount = null; but want make struct nullable nature , can used (without use of nullable<t> ): accountinfo myaccount = null; you can't. struct considered value types, , definition can't null. easiest way make nullable make reference type. the answer need ask "why struct?" , unless can think of solid reason, don't, , make class. argument struct being "faster", overblown, structs aren't created on stack (you shouldn't rely on this), , speed "gained" varies on case case basis. see post eric lippert on class vs. struct debate , speed.

string - Upgrade from Delphi 7 to Delphi 2009 -

i have delphi 7 project in there record types containing strings loaded , stored files. after recompiling delphi 2009, when program loads records file, strings messed because compiler expects unicode while file has ansi strings. type similar this: type tpoint = record name: string[255]; x, y: integer; end; after substituting "string" "ansistring" project doesn't compile saying "e2029 ';' expected '[' found". suggestions? shortstring (which string[255] is) still interpreted same way before: an array of ansichar first byte length. ansistring can not defined array, therefore error message. how read file fill records? , how fill them? maybe error occurs there.

apache - Redirect URL using Query String parameter in URL -

i have bunch of urls old site updated ee2. these urls this: http://www.example.com/old/path.asp?dir=folder_name these urls need redirect to: http://www.example.com/new_path/folders/folder_name not folder_name strings match folder_name url segments, these need static redirects. i tried following rule particular folder called "example_one" maps page on new site called "example1": redirect 301 /old/path.asp?dir=example_one http://www.example.com/new_path/folders/example1 but doesn't work. instead of redirecting 404 error telling me http://www.example.com/old/path.asp?dir=example_one cannot found. edit: there's secondary problem here may or may not related: have catch-all rule looks this: redirect 301 /old/path.asp http://www.example.com/new_path using rule, requests first 1 above redirected to: http://www.example.com/new_path?dir=folder_name which triggers 404 error. just had scour google bit more find proper s

multithreading - Catching thread exceptions from Java ExecutorService -

i'm working on software development framework parallel computing javaseis.org . need robust mechanism reporting thread exceptions. during development, knowing exceptions came has high value, err on side of over-reporting. able handle junit4 testing in threads well. approach below reasonable or there better way ? import java.util.concurrent.callable; import java.util.concurrent.executorservice; import java.util.concurrent.executors; import java.util.concurrent.future; public class testthreadfailure { public static void main(string[] args) { int size = 1; executorservice exec = executors.newfixedthreadpool(size); threadfailtask worker = new threadfailtask(); future<integer> result = exec.submit(worker); try { integer value = result.get(); system.out.println("result: " + value); } catch (throwable t) { system.out.println("caught failure: " + t.tostring()); exec.shutdownnow(); system.out.println(&

rails helper to give a upload file a unique name? -

hey guys i'm working on project require upload lot of videos, rails have helper can handle this, address of youtube video : www.youtube.com/watch?v=kyuhtpv_lk4 thanks are using activerecord model files or flat files somewhere? if have model uploadedfile << activerecord::base each file can use id of model or if want string can hash string added salt. irb(main):021:0> file_id = 1 => 1 irb(main):022:0> digest::sha1.hexdigest('somerandomstring' + file_id.to_s) => "70f5eedc8d4f02fd8f5d4e09ca8925c2f8d6b942" if keeping them flat files on system, can hash path+filename create unique string. irb(main):016:0> digest::sha1.hexdigest '/home/bob/somefile.mp4' => "204a038eddff90637c529af7003e77d600428271" and can add in timestamp of current time , random number prevent dupes.

c# - Faking a ASP.NET Page -

i have situation web application sits , waits request sent specific web page designated source. example source1 makes request myapplication/source1.aspx , source 2 makes request myapplication/source2.aspx. wondering if possible have instead have having 10 different .aspx pages out sitting waiting requests, if somehow configure application "fake" pages exist , have single page process requests. so source1 post url of myapplication/source1.aspx application interprets , sends on main processing page. 1 catch main page needs know source came from. i cannot rely on source being able post myapplication/processpage?source=source1 figure out query string source sent what. i hope of made sense, please let me know if need further clarification. thank help. one idea create custom handler, map expected requests. here link more information on handlers. pay special attention configuration goes web.config each handler. path defined not have path exists. one nice tr

flex - How do I set my application's dock name? -

Image
i'm making flex app , i'd know how set name of app appears when user hovers on in dock. here's screenshot of now: i'd space between lowercase 'd' , uppercase y . part of app's xml file must edit change text in gray tooltip? this answer applies both flex builder 3 applications , flash builder 4 applications. every newly created project gets project-name.mxml (main application file) , project-name-app.xml (application descriptor) file. the application descriptor file xml file, pre-formatted xml nodes tell flex sdk different things app such initial width , height, copyright notice , more. there's xml node called <filename> sets name of application file (.app on mac, .exe on windows). value <filename> dictate name of app in mac dock , in windows taskbar. there's <name> node responsible indicating name of application. value here typically display in app if use native system chrome. outside of scenario <name> prop

sql - Dynamically generating buttons based on query results in ASP.NET? -

i trying add filters gridview working on, , i'm wondering if possible generate links or buttons above gridview based on years returned in dataset. example, if dataset contains dates 2001, 2009, , 2031 in date column, able take data sql query (getting distinct list of years not issue), , generate buttons. there, filter data in gridview based on user clicking buttons. is dynamic generation of buttons possible in asp.net? have other ideas of how accomplish same functionality, prefer way. thanks, badpanda you can use databound control e.g. repeater has button or linkbutton in it's itemtemplate. bind control years list. set text property of button display year.

sql server - SQL data returned in a comma-delimited list -

here tables: ----------------------------------------- hotels ----------------------------------------- hotelid | hotelname ----------------------------------------- ----------------------------------------- hotelimages ----------------------------------------- hotelimageid | hotelid | filename ----------------------------------------- i'd create select statement return data so: hotelid | hotelname | images ----------------------------------------- 1 | hotel1 | image1,image2,image3 2 | hotel2 | image4,image5,image6 how can modify query this? have: select h.hotelid, h.hotelname, '' images hotels h i know can use coalesce create comma-delimited list: declare @images varchar(500) select @images = coalesce(@images + ',', '') + cast(filename varchar(100)) hotelimages hotelid = 1 select @images but don't know how integrate current query list can returned rest of hotel data. i should mention i'm using sql server 2000. since

How can I get the absolute path to the Eclipse install directory? -

i writing eclipse product, composed of plugins. in 1 of plugins, need absolute path directory eclipse installed. (i.e. /applications/eclipse on mac or c:\program files\eclipse on win). can't find api this. ideas? codejammer suggests: the following gives installed location platform.getinstalllocation().geturl() see org.eclipse.core.runtime.platform api /** * returns location of base installation running platform * <code>null</code> returned if platform running without configuration location. * <p> * method equivalent acquiring <code>org.eclipse.osgi.service.datalocation.location</code> * service property "type" equal {@link location#install_filter}. *</p> * @return location of platform's installation area or <code>null</code> if none * @since 3.0 * @see location#install_filter */

iphone - Set switch to On, reload table then insert a new row -

i've got uitableviewcontroller use create settings of application. there section 1 row put uiswitch. how can insert new row inside same section of row switch if switch in set yes? , how can delete row if switch set no? can me? thanks! i tried use insertrowsatindexpaths:withrowanimation: method doesn't work... settings table code: - (void)viewdidload { [super viewdidload]; self.title = nslocalizedstring(@"impostazioni", @""); } - (void)viewwillappear:(bool)animated { [self.tableview reloaddata]; } -(void)addcelltosetcode:(id)sender { if ([codeswitch ison]) { nsindexpath *updatedindexpath = [nsindexpath indexpathforrow:1 insection:2]; [self.tableview beginupdates]; [self.tableview insertrowsatindexpaths:[nsarray arraywithobject:updatedindexpath] withrowanimation:uitableviewrowanimationtop]; [self.tableview endupdates]; [[nsuserdefaults standarduserdefaults] setbool:codeswitch.on fo

jquery ui - How do I know when HTML has fully rendered -

case 1: i load large html page includes lot of complex layout , fonts. page take unknown time render. case 2: i use jquery .html() function make significant changes dom. modified dom take unknown time render. in both cases, want able cover whole screen spinner until page has completely finished rendering . in searching answers question, have found similar questions asked answers not relevant. clear: i don't want know when dom ready. i don't want know when http data has been fetched. i want know when in dom has been completely drawn screen . setting worst-case timeout not acceptable solution. i need solution webkit based browsers. just small point; browsers won't animate spinner whilst they're processing javascript. particularly ies behave single-threaded. it's worth using different, non-animated, design 'spinner'. hourglass. thought when's rendered challenge: why not put after initialisation code call in $(docum

MPI error due to Timeout in making connection to a remote process -

i'm trying run nas-upc benchmark study it's profile. upc uses mpi communicate remote processes . when run benchmark 64 processes , following error upcrun -n 64 bt.c.64 "timeout in making connection remote process on <<machine name>>" can tell me why error occurs ? this means you're failing spawn remote processes - upcrun delegates per-conduit mechanism, may involve scheduler (if any). guess you're depending on ssh-type remote access, , that's failing, because don't have keys, agent or host-based trust set up. can ssh remote nodes without password? sane environment on remote nodes (paths, etc)? "upcrun -v" may illuminate problem, without resorting man page ;)

web services - What is the simplest way for an app to communicate with a website in asp.net? -

i have desktop application. users register use it. when register, need make sure email address unique. need send request website keeps list of email addresses , returns results. what simplest, quickest way asp.net? i this: send webrequest: http://www.site.com/validate.aspx?email=a@a.a and aspx returns xml: <response>valid</response> there few other simple tasks this. there no need heavy security or need make system particularly robust due high demand. i have used web services before seems overhead simple task. is there elegant api wraps communication system must common. http has covered. check response code server. http://en.wikipedia.org/wiki/list_of_http_status_codes i suggest use 409 conflict indicates request not processed because of conflict in request but http 418 favorite since opengl.

java - Is it worth pooling byte[] and char[] arrays or is it beter to just create -

my code lot of input/output , involves creation of temporary arrays hold bytes or chars of size - use 4096. im starting wonder - without actual tests - verify if better pool these arrays. code change this take array pool try { read 1 inputstream write outputstream using array } { return array pool } it quicker take or create byte 4096 means work required alloc mem on heap, clear 4096 bytes etc. a pool seems simpler after checking list taking list , returning array. update wrote small program did 2 things, created arrays , used apache commons pool. both looped lot of times (100*100*100) , created/took, filled array, released. added few goes in beginning warm jit , ignored results of those. each run ran create , pool forms dozen times, alternating between two. there little difference between pool , create forms. if added clear array callback fired apache commons pool when instance returned pool, pool became slower thanthe created form. i not implement poo

mysql - Ideal mysqldump options for backups -

i'm creating backup script our database servers, , thought i'd ask if there preferred options include mysqldump . script called cron every 6-24 hours. we use innodb exclusively. our databases rather large, , i'll dump clusters of tables individually, opposed entire database in 1 go. for now, i'm thinking of including: --opt # enabled default --quote-names # enabled default --single-transaction --skip-comments any other suggestions or pointers creating good, reliable dump files? i propose set 1 more server (slave) mysql , replicate data there (from main, master one). if you'll need plain text dump - can slave without hurting master.

c++ - is there a function in dlg class as getdocument()? -

i want doc* in dlg class, , know in view class can doc* doc* pdc=getdocument(); but how can in dlg class? mfc's cdialog class not have built-in cdocument's. can implement cformview derived cview (which part of document/view architecture of mfc), cformview not dialog. however, cformview's can hold controls dialog - can assign dialog template cformview.

permissions - Insecure world writable dir /usr/local in PATH when trying to install Rails 3.0.3 -

i trying install rails 3.0.3 , following error every time: insecure world writable dir /usr/local in path, mode 040777 when check see if installed error: /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': not find rubygem rails (>= 0) (gem::loaderror) /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate' /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem' /usr/bin/rails:18 any idea doing wrong? sorry, i'm newb! you need secure directory before install. use: chmod o-w /usr/local to this. if doesn't work, need root (or otherwise suitably empowered) can try: sudo chmod o-w /usr/local and enter password. i've seen sort of thing before on software wants things set in way ensure assumptions met. in case, it's bad idea have world writable directories except when know secur

.net - How to write NUNit test cases when data is read from some database? -

i want test functionality includes call web service data database. methods operate on data. now want write nunit test cases methods. how can assert results or values when cannot know (at time of writing cases) data fetched @ run time? an excellent way of doing inserting data (do in negative index range (assuming negatives not in use production data)) run tests dataset, , roll transaction once done. another option test datalayer better down road, make wrapping interface database layer. can mock interface when running tests need it. normally might have idatareader object , call idatareader.getmedata , return result set db. in case mock (i use rhino mocks) , tell return set of test data when getmedata called. p.s. don't forget use dependency injection pass in mock database access object.

Best Practices for Integrating Hibernate 3.6 and Spring Framework 3? -

let me try again since first post got mangled... i've seen few different methods integrating spring , hibernate... best practices integrating latest versions of hibernate , spring? pros , cons using spring hibernate template? examples cool. thx! are looking more documentation 1 provided here spring reference ? here pros , cons of using hibernate template: spring hibernate template when use , why? here can more examples explanations.

java - How to add tasks in the Queue dynamically in google app engine? -

for e.g. can thing ---- list of namespaces; iterate on each namespace queue queue = queuefactory.getqueue("updatereservation-queue"); for(string name : namespaces){ queue.add(taskoptions.builder.withurl("/checkexpirydatetask").param("name", namespace)); } yes, of course can - there in particular you're having trouble with?

javascript - select all checkboxes of a form -

in rails application, displaying records. using pagination records.. have javascript function select checkboxes associated record..but selects checkboxes of current page. want have feature can select checboxes of current page , move next page selec there , submit of them together. i'd hopping between pages , selecting way tedious , extremely error prone. have "check all" function submit yourform[check_all]=true parameter controller (via ajax or plain http post) , have controller handle requested action on relevant records.

Programming World -

in programming world of ours see c sharp , java on top. these have rich library of thousand classes , function become more richer new editions. can have programming language can give more creativity , innovation inspite of ever increasing library based languages ? there plenty of such languages: ruby, python, javascript, erlang , plenty of others. need stop trolling , homework.

asp.net 2.0 - This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory -

can body suggest me how remove app_offline.htm file application root directory in asp.net web application.when run page doesnt show design of html source go visual studio 05/08 , open solution explorer. in root folder there should folder named "app_offline.html". right click on , delete it. re-open visual studio , should able browse page.

php oop, class structure with many class -

how in 1 class use class? code correct? <?php class country{ function countrybyid($id) { echo $id; } } class validate{ function text($id) { return true; } } class register{ function write($name, $url, $country){ $val = new validate(); $c_id = new country(); if(!$val->text($name)) return false; $country_id = $c_id->countrybyid($country); } } $r = new register(); $r->write('test', 'www.google.com', 'france'); ?> almost. except $val = new validate; right syntax $val = new validate(); , include function expects string literal or variable (include ('class/myclass.php'))

Eclipse plugin dependency on SWT classes not being resolved -

i have eclipse plugin project uses swt objects, eg - import org.eclipse.swt.widgets.composite; when try compile 'target platform' set 'running platform (active)', compiles fine , dont need import swt specific plugins. however, created target platform eclipse 3.6.0 , if set active platform project has compile errors wherever swt classes used , cannot resolve them. which plugin should add dependency to, resolve these errors? i tried adding 'org.eclipse.swt' not seem help. i had same problem. in case, had missing dependency , asked eclipse locate plugin me. after plugin found on p2 site, saw "resetting target platform" in progress view. after that, lot of plugins broken. checking target platform (window -> preferences -> plug-in development -> target platform -> edit), field "architecture" had changed x86_64 x86 . changing value , clicking on "finish" did reset tp once more , errors went away.

LinQ Substring Function From the Right -

im new linq , i've got problem question: if have string example "mystring"and need characters @ positions 5 , 6 counting right of string, ie: "st" here's query dim result = everyval in allvals everyval.substring(5,2)='st' select everyval.name now wont return correct values database because default consideration of positions in substring function left right. 1 solution maybe reverse string , apply substring function it. how should doing this? can tell me..??? this rather strange requirement, indexof/contains enough this. however, try (conceptually) truncating value , testing end using endswith . something perhaps (untested , doesn't work): dim result = everyval in allvals everyval.remove(4).endswidth("st") msdn nicely lists string functions can safely translated sql linq: http://msdn.microsoft.com/en-us/vbasic/bb688085

php - What is the point of nulling private variables in destructor? -

i have spot following pattern in code i'm working with: in classes in destructor have found private variable being nulled, in example: public function __destruct() { foreach($this->observers $observer) { $observer = null; } $this->db_build = null; } is there point in doing when php has gc? somehow improve performance of script? it could because php's garbage collection based on reference countring , , older versions not handle cyclical dependencies. then, in cases have been necessary manually set references null enable gc work, , there may still special cases cycle detection algorithm not catch. more though, it's example of cargo cult programming (the wikipedia entry explicitly lists example).

tsql - How to implement bulk insert feature in Sql Server 2005 -

i have table in database called user has following entries. userid firstname lastname 1 fa la 2 fb lb 3 fc lc and table userform userformid userid form code modifieddate isclosed isform 1 1 ff cc somedate 0 0 2 1 gg rr somedate 0 0 3 1 bb bb somedate 0 0 4 2 ss aa somedate 0 0 5 2 qq sa somedate 0 0 6 3 ws xc somedate 0 0 now have insert new record every userid in userform table , form , code column should copied in inserted row userform table latest modifieddate ( like:- order modifieddate desc.) output should in userform table : userformid userid form code modifieddate isclosed isform 1 1 ff cc somedate 0 0 2 1 gg rr s

is it possible to add images in between the text view in iphone -

im developing application. consists of notes , images also. im unable find best way of coding add images , text together. want is,i want add images in between textview , after text has continue.is possible this. please me in this. please reply me soon. thanks in advance.... you better use webview , load in static html application unless particularly need textviews, in case @ holding things in uitableview

Having the maven parent project in Eclipse for a flat project layout -

i'm trying "mavenize" existing ear application. i've read guidelines create multi-module project wtp , created "flat project layout". my problem when typing command mvn eclipse:eclipse , i've got .projects, .classpath , .settings created ear, ejb , war projects, not parent project, <packaging>pom</packaging> . do know how ? actually, goal commit scm (svn) changes directly eclipse, that's why must have parent-project in handled projects. what did create simple .project in project-parent dir : <projectdescription> <name>project-parent</name> </projectdescription> eclipse recognizes , not system dependent, wanted.

Python/Django excel to html -

okay, want upload excel sheet , display on website, in html. options here ? i've found xlrd module allows read data spreadsheets, don't need right now. why don't need xlrd? sounds need. create django model filefield holds spreadsheet. view uses xlrd loop on rows , columns , put them html table. job done. possible complications: multiple sheets in 1 excel file; formulas; styles.

php - Code example of the fleury or hierholzer algorithm? -

i'm looking code example of fleury or hierholzer algorithm. couldn't find in language? here decent code in pascal http://linhtruong.com/blog/index.php?page=fleury-algorithm---find-euler-circuit wonder how works? php code else.

jquery - Partial rendering after page loaded -

i have page contains usercontrols. load these usercontrols after postback ajax rendering. each usercontrols display list database , dont want user wait while server code builds response think useful if page displayed user , after usercontrols loaded through ajax request. is there exist solution in asp.net mvc? there exist solution problem? thanks advance: l. just use jquery bind html returned action method (which should return partial view result - e.g output of user control/partial): controller: [httpget] public partialviewresult getsomedata() { var data = somewhere.getsomething(); return partialview(data); // partial view should typed data. } jquery: $(document).ready(function() { $.get('/home/getsomedata/', function(data) { $('#target').html(data); }); });

antlr3 - ANTLR Tree Grammar and StringTemplate Code Translation -

i working on code translation project sample antlr tree grammar as: start: ^(program declaration+) -> program_decl_tmpl(); declaration: class_decl | interface_decl; class_decl: ^(class ^(id class_identifier)) -> class_decl_tmpl(cid={$class_identifier.text}); the group template file looks like: group my; program_decl_tmpl() ::= << *what?* >> class_decl_tmpl(cid) ::= << public class <cid> {} >> based on this, have these questions: everything works fine apart should express in what? program list of class declarations final generated output? is approach averagely suitable not high-level language? i have studied antlr code translation string templates , seems approach takes advantage of interleaving code in tree grammar. possible as possible just in string templates? solution , add solution based on terence proposed: start: ^(program d+=declaration+) -> pr

iphone - how to display table view cells whenever we need to click on one cell -

i writing 1 app in app have display tableview 2 cells.while first cell touched user have show other cells within view (i cant use navigation here) , second cell visible..can 1 tell me suggestion this. thank all. if want insert table view cells when clicking on cell, try following code. lets consider going insert 3 rows in position 1, 2 , 3 in section 0. in didselectrowatindexpath method, following. here rows inserted in section 0, if select row 0(first row) in section 0(first section). - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if (indexpath.row == 0 && indexpath.section == 0) { // create indexpaths rows going insert nsindexpath *indexpath1 = [nsindexpath indexpathforrow:1 insection:0]]; nsindexpath *indexpath2 = [nsindexpath indexpathforrow:2 insection:0]]; nsindexpath *indexpath3 = [nsindexpath indexpathforrow:3 insection:0]]; // increase number of rows in section 0

Convert string to array in Java? -

i have string has values (format same): name:xxx occupation:yyy phone:zzz i want convert array , occupation value using indexes. any suggestions? basically use java's split() function: string str = "name:glenn occupation:code_monkey"; string[] temp = str.split(" "); string[] name = temp[0].split(":"); string[] occupation = temp[1].split(":"); the resultant values be: name[0] - name name[1] - glenn occupation[0] - occupation occupation[1] - code_monkey

.net - Compile-time and runtime casting c# -

i wondering why casts in c# checked @ compile-time whereas in other cases responsibility dumped on clr. above both incorrect handled in different way. class base { } class derived : base { } class other { } static void main(string[] args) { derived d = (derived)new base(); //runtime invalidcastexception derived d = (derived)new other(); //compile-time cannot convert type... } while reading "c# in depth" i've found information on topic autor says: "if compiler spots it’s impossible cast work, it’ll trigger compilation error—and if it’s theoretically allowed incorrect @ execution time, clr throw exception." does 'theoretically' mean connected inheritance hierarchy (some affinity between objects ?) or compiler's internal business? upcasts can checked @ compile time - type system guarantees cast succeeds. downcasts cannot (in general) checked @ compile time, checked @ runtime. unrelated types cannot cast e

CakePHP Bypass Auth component -

is possible bypass auth component , logged in administrator? want test plugin downloaded , requires logged in using auth component admin don't want setup users table etc. you can bypass authentication using following code in beforefilter() of controller: function beforefilter() { parent::beforefilter(); $this->auth->allow('*'); } if want toggle specific actions: function beforefilter() { parent::beforefilter(); $this->auth->allow('admin_index', 'admin_view'); } now, won't have log in access these pages. :)

css - Javascript center div on the page include scrolling -

in javascript need show div content on center of browser window; content of window high therefore has scroll. how can set div element on center of screen independently of scroll ? thanks! you can use css (you don't need javascript that): #divid{ width:500px; /* adjust */ height:500px; /* adjust */ top:50%; left:50%; margin-left: -250px; /* half of width */ margin-top: -250px; /* half of height */ position:fixed; } you can check out demo here including scrolling you can make div pretty additional css. check out demo

oracle - how to create field alias -

i've heared possible create alias field using oracle views, possible? can show simple example ? p.s. need alias each field in table reason regarding application. thank in advance. you requirement alias each "cell" (row/column intersection) in table - the answer no , not possible. perhaps if explain more trying achieve there alternative. example, in application can assign unique id each field.

java - Build failure due to missing libraries -

[error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project spring-intergation: compilation failure: compilation failure: [error] \spring-intergation\src\main\java\uk\co\dd\spring\domain\user.java:[3,24] package javax.persistence not exist [error] \spring-intergation\src\main\java\uk\co\dd\spring\domain\user.java:[4,24] package javax.persistence not exist [error] \spring-intergation\src\main\java\uk\co\dd\spring\domain\user.java:[5,24] package javax.persistence not exist [error] \spring-intergation\src\main\java\uk\co\dd\spring\domain\user.java:[6,24] package javax.persistence not exist [error] \spring-intergation\src\main\java\uk\co\dd\spring\domain\user.java:[7,24] package javax.persistence not exist [error] \spring-intergation\src\main\java\uk\co\dd\spring\domain\user.java:[9,1] cannot find symbol but have added libraries in eclipse right clicking project , adding external jars. when try run mvn compile these errors l

user interface - WiX Compile Error Creating Custom Dialog -

i've been trying insert custom dialog wixui_installdir ui sequence. have "main" file named product.wxs , custom dialog in file named installtypedlg.wxs - both of present in installer.wixproj . within installtypedlg.wxs , have following: <?xml version="1.0" encoding="utf-8"?> <wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <fragment> <ui> <dialog id="installtypedlg" width="370" height="270" title="select install type"> <control id="installtypeselection" type="radiobuttongroup" x="20" y="55" width="330" height="120" property="installtype"> <radiobuttongroup property="installtype"> <radiobutton text="type 01" value="1" x="5" y="0" width="250" height="15&qu

jboss - Hibernate SQLQuery bypasses hibernate session cache -

i'm "transactionalizing" extensive database manipulation , came across issue if run sql queries through hibernate not using mql approach, view of database doesn't appear correct. code uses hibernate in more appropriate manner in cases there places decided execute sql. don't did @ point "it is". i found explanation seems explain examples wrt getting , managing transaction in code. using @transactionattribute annotation on entire class change code , finding lot of places behavior happens i'm not entirely convinced explanation applies code wrapped in annotation--i assuming using hibernate manager rely on object cache in session. apologies in advance if referring concepts in hibernate incorrect terminology, etc. your question confusing, assume saying hibernate not looking entities in session cache when performing native queries. sql query, or native query, query hibernate relays database. hibernate won't parse query, , won't p

network protocols - Stop update the Arp table -

i have trouble in network. in our network runs sniffer. gets data packets. friend of mine. want stop update arp table. when sniffing, arp tables of machines update. know stop this? thank you. actually " arp vulnerability " problem. person in network uses mechanism on mitm (man in middle) attack create route packets u receive/send intercepted him, enabling sniff packets. far know this vulnerability has not been resolved because arp protocol "trusting" , means not validate ip-mac pair. only way stop him off lan :)

asp.net - IIS: Connecting to .mdf database - web config problem -

locally connect northwind.mdf when upload application remote server following error: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified) these few options tried: <connectionstrings> <add name="connectionstring" connectionstring="data source=.\sqlexpress;attachdbfilename=|datadirectory|\northwind.mdf;integrated security=true;user instance=true" providername="system.data.sqlclient"/> </connectionstrings> the above 1 work locally. <connectionstrings> <add name="connectionstring" connectionstring="data source=.\sqlexpress;attachdbfilename=d:\asp\testsite\app_data\northwind.mdf; integrated security=true;connect timeou

Non Ruby dependent HAML and SASS alternative -

forgive ignorance these 2 technologies, learned of them morning. read them , use, not ruby developer. is there non-ruby equivalent sass and/or haml ? or maybe i'm asking wrong question entirely, use these in c# project. since large part of haml lies in allowing focus on actual code in templates , less on markup, it's tied specific language. fortunately, there versions popular languages, including nhaml .net . sass language of own , output independent of ruby — need ruby run compiler.

.net - App pool created as v2 starts as v4 and changes to v2 when recycled -

i creating iis7.5 app pool in build script use .net2. when created reports version 2.0.50727 expected. however when try attach visual studio 2010's debugger w3p process running in app pool, states running .net 4 , unable hit of breakpoints. if recycle app pool , attempt attach once more, running .net2 , can debug successfully. any ideas why runs .net 4 when first started welcomed. thanks

redirect - C# - Realtime console output redirection -

i'm developing c# application , need start external console program perform tasks (extract files). need redirect output of console program. code this one not work, because raises events when new line writen in console program, 1 use "updates" what's shown in console window, without writting new lines. how can raise event every time text in console updated? or output of console program every x seconds? in advance! i have had similar (possibly exact) problem describe: i needed console updates delivered me asynchronously. i needed updates detected regardless of whether newline input. what ended doing goes this: start "endless" loop of calling standardoutput.basestream.beginread . in callback beginread , check if return value of endread 0 ; means console process has closed output stream (i.e. never write standard output again). since beginread forces use constant-length buffer, check if return value of endread equal buffer size. mea

java - “if” statement vs OO Design - 2 -

i encountered similar problem “if” statement vs oo design - 1 different. here problem open popup (different objects/popups) onvaluechange of listbox popup1 p1; // different objects popup2 p2; // different objects popup3 p3; ... listbox.add("p1"); listbox.add("p2"); listbox.add("p3"); ... listbox.addchangehandler() { if(getselecteditem().equals("p1")){ p1 = new popup1(); p1.show(); } else if() {...} .... } i don't want write "if" if p1 p1 = new popup1(); p1.center(); how can handle situation? design-pattern? here solution costly map() { map.put("p1", new popup1()); map.put("p2", new popup2()); map.put("p3", new popup3()); } onvaluechange() { map.get(selecteditem).show(); } one drawback initialization popups. require when valuechange i agree leveraging common base class when can, can't add method base class every usage might

What search tools are available for ASP.NET site? -

is there search tools asp.net can buy carry out search indexes on data have in database? what require carry out general site search of articles faceted search well. faceted search quite important feature. thanks. i agree mauricio scheffer, using solr.net achieve want. implemented basic asp.net web form example around year back. found link useful me started: http://crazorsharp.blogspot.co.uk/2010/01/full-text-search-using-solr-lucene-and.html using example (above), managed create (disclaimer: personal site): http://surinder.computing-studio.com/post/2011/01/14/at-last!-created-my-own-ebay-style-search-using-solrnet.aspx

c++ - Accessing to mm1 register parts -

is possible access single byte in mmx register, array? i've code: movq mm1,vector1 movq mm2,vector2 psubw mm1,mm2 i want put mm1[1],mm1[2],mm1[3]....into c++ vars, like: int a,b=0; mov a,mm1[1] mov b,mm1[2] thanks. yes, possible. i can show code sse2 c++, similar mmx : __m128i a; unsigned char *p = (unsigned char*) &a; // access bytes pointed pointer p

winapi - Win32API How can my window follow to existing window -

to win32 professionals. let's have completed existing application window. task write application (my) window. window must align left edge existing window right edge while user moves existing window across screen (my window not allowed move user). precondition: a) existing window can not subclassed b) windows hooks not case. yes, looks right. i'd not asked question if not become problem. forgot os vista 2, application ie. try make application follows ie main window, align edge. subclassing of ie not allowed, , setwindowshook not works correctly under regular user (when user have admin privileges application works normally). such way of talking works under windows prior vista. and looks there no trivial way solve task. thank all. i think can't without hook. setwindowlong allows set wndproc, won't work if window belongs different application.