Posts

Showing posts from February, 2015

Testing Rail's route's :constraints lambda with RSpec 2 -

question : how setup/mock rspec routing test more production rack environment? bonus points being able call controller's authentication function first (eg applicationcontroller.authenticate_user set session[:current_user_id] details : i using route :constraints have www.example.com/ route 2 different controllers & views depending on if user logged in or not. root :to => 'intentions#latest', :constraints => lambda {|r| r.env['rack.session'].has_key?(:current_user_id) } root :to => 'welcome#index' i wanted make sure bit of fragile routing has proper test around it. cukes testing wanted bit deeper of testing, messed :current_user_id , cukes did not catch that. example fat fingered :current_user_id in applicationcontroller's authenticate_user() method. love call in before(:each) , make sure setting correct session key. so created file called /spec/routing/auth_routing_spec.rb , tried follow guide @ http://relishapp.com/rspec/rs

javascript - Replacing string in innerHTML -

so, simple thing i'm trying accomplish (javascript), it's taking me ages , still not work. i'm trying replace words (that within pre tag). example, word "static" should replaced "<span class="keyword">static</span>" . i'm using xhtml strict. my approach this: for (var j = 0; j < keywords.length; j++) { codeblock.innerhtml = codeblock.innerhtml.replace(new regexp(keywords[j], "g"), "<span class=\"keyword\">" + keywords[j] + "</span>"); } codeblock pre element, keywords array contains words replace. i've tried many ways, i'm stuck error messages these. firefox: [exception... "an invalid or illegal string specified" code: "12" nsresult: "0x8053000c (ns_error_dom_syntax_err)" location: "file:///c:/.../scripts.js line: 33"] chrome: error: invalid_state_err: dom exception 11 i'm g

database - Django, is manual caching a bad idea? -

some of reports taking far long. i've implemented "cache" fields solve problem. example student's gpa involved calculation. i've add non normalized gpa field student. on each grade update, gpa recalculated , can assumed gpa field current. i know there number of caching mechanisms in django. correct wouldn't able this? you work around problem using django's cache framework, you'd go things differently. can cache want it, it's not designed save results on object. if want avoid calculating gpa , still able access off each model instance way going simple , best way it.

c# - search my list help with linq -

i have list<fruitobj> fruit fruitname, fruitcolor banana, yellow orange, orange cherry, red list<fruitobj> test = new list<fruitobj>(); is there inline way of searching list starts ban , return true if contain string? bool hasban = test.any( x => x.fruitname.startswith("ban")); note case sensitive, match "banana" do: bool hasban = test.any( x => x.fruitname.startswith("ban", stringcomparison.invariantcultureignorecase));

r - RODBC returning 0 values -

i accessing commercial db. via prompt: select personcode, persondate codb.mastertable personcode=42 personcode persondate ----------- ------------ 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 42 jan 3 2011 in r: library(rodbc) query <- "select personcode, persondate codb.mastertable personcode=42" connection1 <- odbcconnect("resdb", uid="userid", pwd="pwdaccess", believenrows=false) sqlquery(connection1,query) sqlquery(connection1,query) personcode persondate 1 42 01/03/2011 00:00:00.000 utc 2 42 01/03/2011 00:00:00.000 utc 3 42 01/03/2011 00:00:00.000 utc 4 42 01/03/2011 00:00:00.000 utc 5 42 01/03/2011 00:00:00.000 utc 6 0 01/03/2011 00:00:00.000 utc 7 0 01/03/2011 00:00:00.000

android - I am trying to update a textview from a different activity and it keeps crashing -

on button click reading information file , need display in textview, code works while in activity layout if in different screen same code doesn't work. string sdcard = environment.getexternalstoragedirectory().getabsolutepath(); file file = new file(sdcard + "/mult/","boardname.cfg"); //read text file try { bufferedreader br = new bufferedreader(new filereader(file)); string line; while ((line = br.readline()) != null) { global.defaultboard = line; } textview defaultboard = (textview) findviewbyid(r.id.currentboard); defaultboard.settext(global.defaultboard); } catch (ioexception e) { //you'll need add proper error handling here } finish(); can see whats wrong? if remove lines aor comment lines of textview doesn't crash. thanks mrc ok my solution - value stored in global variable use onresume() refresh textview. public void onresume() { super.onresume(); textview defaultboard = (tex

javascript - Cached content for image element kept in browser after being removed and added again -

we developing web app interface uses ajax/javascript entirely. there dynamic images cache expiration times of access + 15 minutes. so, when images accessed cached 15 minutes , after time browser fetch new version, caching again 15 minutes , on. the issue in ajax setup, when image elements removed , added, newly added image element (which on 15 minutes later, when browser fetch new image version) not contain new content. i.e. once image loaded in once, after element removed, if element re-added @ other stage without page being changed, loaded version display. so far issue chrome, i've not tested other browsers yet. image appears sort of held in "memory" when image element removed, image shows under "resources" in chrome developer tools - again, long after image element specifying image source has been removed. what can this? solution far change image filename on subsequent loads (the old query string trick perhaps). issue here these images stack in &q

c# - Threading - make sure the thread finishes -

solved: http://msdn.microsoft.com/en-us/library/ff431782(v=vs.92).aspx i have following class give me current location in wp7: public class position { private geocoordinatewatcher watcher = null; public geocoordinate currentlocation { get; set; } public position() { obtaincurrentlocation(); } private void obtaincurrentlocation() { watcher = new geocoordinatewatcher(geopositionaccuracy.default); watcher.positionchanged += new eventhandler<geopositionchangedeventargs<geocoordinate>>(watcher_positionchanged); watcher.start(); } void watcher_positionchanged(object sender, geopositionchangedeventargs<geocoordinate> e) { //stop & clean up, don't need anymore watcher.stop(); watcher.dispose(); watcher = null; currentlocation = e.position.location; } } i want use location. instantiate it. how can make sure that, when call currentlocation p

tsql - Dynamic SQL with variables inside a view (SQL Server) -

hello i'm trying inside new view window in sql server 2008: declare @var = (select db databases); exec ('select name ' + @var ' + .dbo.names); this view runs in sql server cannot save (it gives me error), potentially create table returning function, of same stuff in , return table , create view takes table unsure of performance hits occur doing this. suggestions appreciated! thanks. solution: ended having drop old view , recreate new view (using dynamic sql) in stored procedure. when value changed call sp update views point correct databases. guys, knowing can't done stopped me trying methods. view's cannot accept parameters. table valued function solution. have @ least know table , result set going come out other end. if passing table queried parameter how know structure of resulting data set?

Facebook Graph Api subscription to posts/notes -

i need updates on posts users of facebook app. interested in comments , likes on posts , way notified app database can populated. i have seen subscription api limmited user/permission/pages. interested in connections. work arounds guys suggest updates , reaching interactions. understand cron job calling posts individually using graph api not practical. i've been looking solve similar problem, found real-time updates feature bit lacking in data returns (hopefully changes). eneded using batch request instead http://developers.facebook.com/docs/reference/api/batch/ allows 20 graph api calls in 1 http request. i'm bit unsure on api usage. @ moment i'm assuming each api call in batch still counts, cant find says otherwise.

html - Using jQuery to filter a table from multiple select elements -

i want filter table using jquery hide/show based on user selects multiple select elements. i want user able select multiple values 1, 2 or 3 of select elements. maybe they'll select 2 trainers, 1 recruit , 1 status, or maybe 1 trainer. planning on creating function run when user clicks of options. the way see it, each select element have array of values user has selected. i'll need loop through each array , compare text in specific column. easy enough if options 1 select element. since 1, 2 or 3, i'm having trouble getting head around it. any appreciated. table: <table id="reportstable"> <thead> <th>report number</th> <th>date</th> <th>name</th> <th>trainer</th> <th>status</th> </thead> <tbody> <tr> <td>12345-1</td> <td>05/01/2011</td> <td>first recruit</td> <td>first

models - Django ManyToManyField options -

it possible give blank=true, null=true manytomanyfield without having problems? or maybe doing wrong code.. you don't need null=true . blank=true make field optional.

specflow - Testing with 3rd party services -

i developing asp.net mvc site depends on 3rd party web service. i know best approach develop site since web service not ready yet , can't wait ready start developing. i using specflow , selenium drive development. what forgot if 3rd party web service written or collegues, or if it's external. anyway, it's still possible work in parallel. need arrange reunions people designing web service, , obtain/negotiate specifications, , design interfaces service. these interfaces should not subject enormous changes afterwards, during service development. once have them, can job in parallel. if can't have them, forget it: can't work.

javascript - Firefox 4 isn't firing dragleave or dragexit when a drag leaves the window -

i can't dragleave or dragexit events fire when drag leaves window (ff4). in chrome , safari, works expected.... dragleave event when drag leaves window. is expected behavior? know workaround? thanks! so, sum comments: browser bug , still present apparently, , there jquery-based workaround .

html - Display up to 3 rows of a text field -

goal : i'd display 3 lines of long text field in <div> of defined width. current flawed approach : <style> div{ width:50%; height:100px; padding:10px; white-space:normal; overflow:hidden; text-overflow:ellipsis; -o-text-overflow:ellipsis; } </style> <div> <%= @company.description %> </div> problem : above cuts off bottom line if not lined arbitrary 100px+20px height. so, end line of text halfway cut off horizontally. how can instead display 3 whole lines of text instead of cutting off? use em , not px height . 3em or 3.12em right (cater padding well).

Excel APp in VB.net VS2008 -

i creating excel application in vb.net using visualstudio 2008. while adding reference microsoft.office.interop.excel have both managed ( on .net tab) , unmanaged (on com tab). currently referencing com tab not showing errors properly. can use excel interop on .net tab? which 1 better way reference , difference between two? yes, use .net interop library create namespace 'microsoft.office.interop.excel' then define application object private app microsoft.office.interop.excel.application and either a) connect running excel application with app = ctype(getobject([class]:="excel.application"), microsoft.office.interop.excel.application) or b) create new excel application with app = ctype(createobject(progid:="excel.application"), microsoft.office.interop.excel.application) good luck!

android - How to use checkbox in listview (which have multilines in each list) and extends Listactivity? -

this program extends listactivity , in each list have multilines, picture , checkbox try this public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); list<map<string, object>> resourcenames =new arraylist<map<string, object>>(); map<string, object> data1,data2; data1 = new hashmap<string, object>(); data2 = new hashmap<string, object>(); data1.put("line1", "adidas chelsea tee-womens" ); data1.put("line2", "$ 129.0" ); data1.put("img", r.drawable.q1 ); resourcenames.add(data1); data2.put("line1", "chelsea track top-womens" ); data2.put("line2", "$ 399.0" ); data2.put("img", r.drawable.q2 ); resourcenames.add(data2); simpleadapter notes = new simpleadapter( this, resourcenames, r.layout.ro

php - How to submit a form with AJAX and return a summary of the input values -

i have multipart form , using jquery form plugin. when user completes section of form , clicks "continue," send information server , provide summary of submitted information on same page. current code, error unless of fields completed before submission. guess php wrong , information have entered after "data:" incorrect. any suggestions on how make work properly? php: $return['message'] = array(); if ($_post['markname1']) { $return['message'][]='text' . $_post['markname1']; } if ($_post['markdescription1']) { $return['message'][]='more text' . $_post['markdescription1']; } if ($_post['yesno1']) { $return['message'][]='' . $_post['yesno1']; } echo json_encode($return); jquery: $(form).ajaxsubmit({ type: "post", data: { "markname1" : $('#markname1').val(), "markdescriptio

asp.net - how to create JSON webservice, can Anyone refer any tutorial for this -

i cant able find out correct soltion . our client android , iphone. need create webservice these 2 client. dont know single step this. please 1 refer tutorial website or guide me.i using .asmx form.and use c# at high level, simple. instead of returning html code in response http or post, return json string. real question how create json string object want send. there several libraries can take object , return json string. in python can use return simplejson.dumps(<<object name>>) in php, echo json_encode(<<object name>>); which language using?

ruby - How to install AuthLogic plugin for rails 2.3.5? -

i following ruby on rails tutorial in book uses acts authenticated, seems no longer supported. searching , came across so post recommends couple of different alternatives doing user authentication in rails applications. think authlogic looks choice. using rails 2.3.5 , ruby 1.8.7. the authlogic readme section states following: ** please note latest version compatible rails 3 only. rails 2 should use version 2.x.x ** however, when scrolling down section installing gem or plugin, gives following examples: rails 3: $ sudo gem install authlogic rails 2: $ sudo gem install authlogic --version=2.1.6 or install plugin: script/plugin install git://github.com/binarylogic/authlogic.git i want install plugin, rather gem, need 2.3.5, not 3. can install plugin version in same way shows how install gem version? example: script/plugin install git://github.com/binarylogic/authlogic.git --version=2.3.5 if not how done, please explain m

ruby on rails - Error parsing JSON: undefined method 'gsub' -

i'm trying parse json in javascript, i'm getting error in rails: undefined method `gsub' #<array:0x000001054a2440> my code follows: <script type="text/javascript"> var stuff = <%= escape_javascript(@json) %> var json = stuff.parsejson(); alert("text"); </script> where @json defined in controller @nodes.to_json can please me this? getting json javascript shouldn't hard, it's taking me forever. the code escape_javascript is: def escape_javascript(javascript) if javascript javascript.gsub(/(\\|<\/|\r\n|[\n\r"'])/) { js_escape_map[$1] } else '' end end thus, conclude @json array.

RVM Ruby on Snow Leopard -

i installed rvm , recent version of ruby it. when try generate new rails app following error message. note: gem::specification#default_executable= deprecated no replacement. removed on or after 2011-10-01. gem::specification#default_executable= called /users/local/.rvm/gems/ruby-1.9.2-p180@global/specifications/rake-0.8.7.gemspec:10. note: gem::specification#default_executable= deprecated no replacement. removed on or after 2011-10-01. gem::specification#default_executable= called /users/local/.rvm/gems/ruby-1.9.2-p180/specifications/rake-0.8.7.gemspec:10. note: gem::specification#default_executable= deprecated no replacement. removed on or after 2011-10-01. gem::specification#default_executable= called /users/local/.rvm/gems/ruby-1.9.2-p180/specifications/rubygems-update-1.8.1.gemspec:11. /library/ruby/site/1.8/rubygems/dependency.rb:247:in `to_specs': not find rails (>= 0) amongst [rake-0.8.7, rake-0.8.7, rubygems-update-1.8.1] (gem::loaderror

c++ - Deleting array of class objects? -

it's common knowledge code below correctly frees memory of 100 integers. int* ip = new int[100]; delete [] ip; and think user defined classes works: node* ip = new node[100]; delete [] ip; in first case, size of memory freed (400 bytes), determined @ compile time? basically, goes on internally? in second case, destructor of node called on each of 100 objects? essentially, have been using syntax, never understood goes on internally , curious. no. memory allocator invisibly keeps track of size. size cannot determined @ compile time, because allocation not dynamic , following not work: size_t n; std::cin >> n; = new int[n]; // interesting delete[] a; yes. convince of fact, try struct foo { ~foo() { std::cout << "goodbye, cruel world.\n"; } }; // in main size_t n; std::cin >> n; foo *a = new foo[n]; delete[] a;

Are arrays in C++ same as C? -

does c++ compiler treat arrays same way in c? e.g in c, an array access using subscript operator interpreted pointer. in function argument, array declarations treated pointer start of element. yes , no. arrays work same in both languages part (c99 supports variable-length arrays, while c++ doesn't, , there may few other subtle differnces well). however, you're saying isn't exactly true either. compiler doesn't treat array access pointer, not in c. array access can more efficient in cases, because compiler has better information on aliasing available in array case. in both c , c++, plain pointer access means compiler has assume may alias other compatible type. if compiler treated pointer dereference, optimization opportunity lost. edit pointed out in comment, language standard does define array subscripting in terms of pointer arithmetics/dereferencing. of course, actual compilers make use of additional information pointer array, they're

sql - Not able to left join two tables using a non numeric column? ora-01722 -

i check, possible left join 2 tables using non numeric column? i.e. descriptions_cd varchar(10) , table_cd varchar(10) : select * descriptions d left join tables t on t.table_cd = d.descriptions_cd; this sql seems giving ora-01722 error. in oracle 9i. can check values of 1 of these column contain numeric data (even if volumn type varchar) ?

postgresql - query optimization -

i have 50964218 records in table. going fetch data table , insert same table. takes more time manipulate. how optimize query. the query insert contacts_lists (contact_id, list_id, is_excluded, added_by_search) select contact_id, 68114 , true, added_by_search contacts_lists cl1 list_id = 67579 , is_excluded = true , not exists (select 1 contacts_lists cl2 cl1.contact_id = cl2.contact_id , cl2.list_id = 68114 ) index: list_id,contact_id you better results left join: select t1.[field], ... t1 left join t2 on [conditions] t2.[any pkey field] null;

asp.net mvc 3 - handling sub-domains in IIS for a web application -

i have web application on local iis (mylocalsite.com) settings need, can handle subdomains of local site, user1.mylocalsite.com user2.mylocalsite.com anything.mylocalsite.com all urls point same index page can seperate subdomain , load page accordingly. since description not clear, initial thought can setup different bindings in iis cater subdomains. in iis 7, right click website -> edit bindings -> add.. but guess may need code, since users added system (assuming user/sub-domain model). refer create binding in in iis (iis.net) cool new iis7 features , apis - scottgu microsoft.web.administration

ruby on rails - Installing cucumber in windows XP -

i using rails 2.3.5, ruby version 1.8.7, rubygems version 1.3.6 , windows operating system. trying install cucumber installation fails make error , searched , found solution website http://mikewagg.blogspot.com/2009/06/installing-cucumber-on-windows.html but failed. error log: building native extensions. take while... error: error installing cucumber: error: failed build gem native extension. c:/ruby/bin/ruby.exe extconf.rb checking re.h... no creating makefile make 'make' not recognized internal or external command, operable program or batch file. gem files remain installed in c:/ruby/lib/ruby/gems/1.8/gems/json-1.5.1 inspection. results logged c:/ruby/lib/ruby/gems/1.8/gems/json-1.5.1/ext/json/ext/generator/gem_make.out installed win32console-1.3.0-x86-mingw32 1 gem installed installing ri documentation win32console-1.3.0-x86-mingw32... installing rdoc documentation win32console-1.3.0-x86-mingw32... can direct me install? lot in advance.

javascript - how to get Previous Day? -

i have date object: dateobj = new date(year, month, date[, hours, minutes, seconds, ms] ) how dateobj - 1 day ? dateobj.setdate(dateobj.getdate()-1);

android - Removing space from Edit Text String -

in android app, getting string edit text , using parameter call web service , fetch json data. now, method use getting string value edit text : final edittext edittext = (edittext) findviewbyid(r.id.search); string k = edittext.gettext().tostring(); now works fine, if text in edit text contains space app crashes. for eg. - if types "food" in edit text box, it's ok if types "indian food" crashes. how remove spaces , string ? isn't java? string k = edittext.gettext().tostring().replace(' ', '');

Delphi Embedded Chrome -

is experience on using delphi embedded chrome? delphichromiumembedded . how make accessed html documents? assign value editbox see demos\guiclient directory example. update: example set text of input field on igoogle page: procedure tmainform.actdomexecute(sender: tobject); var q: icefdomnode; begin crm.browser.mainframe.visitdomproc( procedure (const doc: icefdomdocument) var q: icefdomnode; begin // "q" id of text input element q := doc.getelementbyid('q'); if assigned(q) q.setelementattribute('value', 'hello, world'); end ); end;

What is the best way to create an Html Table out of a sharepoint list in a Web Part? -

i want create deployable .wsp web part , want fetch custom list , show in html table inside web part. i know how create .wsp web part, , can create table overriding rendercontents or createchildcontrols methods of webpart class. but want know easy , best method outputting html table in webpart. should use usercontrol that, can add asp.net controls inside , load in web part ?? please tell me solutions ? puneet recommend using data view webparts uses xslt customize view in list data rendered. can take of sharepoint desginer add data view web part. http://www.lcbridge.nl/vision/2009/dvwp.htm

.net - Parallel Foreach Memory Issue -

i have file collection (3000 files) in fileinfocollection. want process files applying logic independent (can executed in parallel). fileinfo[] fileinfocollection = directory.getfiles(); parallel.foreach(fileinfocollection, processworkeritem); but after processing 700 files getting out of memory error. used thread-pool before giving same error. if try execute without threading (parallel processing) works fine. in "processworkeritem" running algorithm based on string data of file. additionally use log4net logging , there lot of communications sql server in method. here info, files size : 1-2 kb xml files. read files , process dependent on content of file. identifying keywords in string , generating xml format. keywords in sql server database (nearly 2000 words). well, processworkeritem do? may able change use less memory (e.g. stream data instead of loading in @ once) or may want explicitly limit degree of parallelism using this overload , parallelopti

c - Python: How to pack different types of data into a string buffer using struct.pack_into -

i'm trying pack unsigned int data string buffer created using ctypes.create_string_buffer . here following code segment, , running example showing error on codepad : import struct import ctypes import binascii buf = ctypes.create_string_buffer(16) struct.pack_into("=i=i=i", buf, 0, 1, 2, 3) print binascii.hexlify(buf) this yields following error: ... struct.error: bad char in struct format the documentation doesn't allude whether can pack data of different types if underlying buffer of specific c type. in case, trying pack unsigned int data string buffer underlying c_char type. know of solution this, or there specific way create buffer can pack type of data? you're not supposed prefix every output specifier '=' code. once: struct.pack_into("=iii", buf, 0, 1, 2, 3) this yields: 01000000020000000300000000000000

c# - How can I get the selected item of a dropdownlist, the first time my page loads? -

i'm looking solution first selected item in dropdownlist. , want when page loads first time. thank in advance. edit: call method @ load-event ddlniveau2 remains empty. think ddlniveau1.selectedvalue isn't accessed. public void filllistniveau2() { ddlniveau2.items.clear(); foreach (var item in dbal.getlistniveau2(ddlniveau1.selectedvalue)) { ddlniveau2.items.add(item.tostring()); } removeduplicateitems(ddlniveau2); } there databound event , fires after data bound dropdown. assigning datasource dropdown need selected item after rows binded dropdown protected void dropdownlist1_databound(object sender, eventargs e) { dropdownlist1.selectedvalue // store in variable }

Entity Framework 4.1 Code-First approach to realize many-to-many relation over Domain-Services -

i had problems while creating database model using newest entity framework , code-first (see entity framework 4.1 code first approach create many-to-many relation details). meanwhile i've figured out problem isn't entity framework more, using along wcf ria domainservices. for sake of completeness - that's relevant code-first code: // // models // public class author { public author() { this.books = new collection<book>(); } [databasegenerated(databasegeneratedoption.identity)] [key] public int id { get; set; } [maxlength(32)] [required] public string name { get; set; } [include] [association("author_book", "id", "id")] public collection<book> books { get; set; } } public class book { public book() { // this.authors = new collection<author>(); } [databasegenerated(databasegeneratedoption.identity)] [key] public int id { get;

match - need help with regex -

in string mssql://text1:text2@text3/text4?applicationname=adfdgfshg i need match text1:text2@text3 and text4 i wrote: string connectionurl = "mssql://faerg:aassd@4235453tgr/he657i7u8kui?applicationname=adfdgfshg"; match m = regex.match(connectionurl, "mssql\\s*:\\s*//\\s*([\\d\\w\\s]*)/([\\d\\w\\s]*)\\?"); but didn't match anything. appreciated :) . ^mssql://([^/]+)/([^?]+)\? tested , tru on rubular (needs escaping on / ). unfortunately, not able create permalink :(

Find the definition of PHP Constant -

i wish know (as in php file) constant being defined. know of trick of getting done fast? let's i'm not familiar whole system, need quick fix on constant. browsing through each includes files boring. update i'm using notepad++ , accessing files through ftp client (filezilla). i grep way mordor: grep -l 'define..constant' * (note: run unix-like operating systems. don't know windows, editors should support similar).

Defining header response not working in hiawatha and php -

i have local server , remote server. on local server i'm trying works, remote server hiawatha doesn't. i'm trying set not found header , respond login page. i'm using following code that if($e === "errorsessionexpired") { header("http/1.0 404 not found"); $output = $this->smarty->fetch("login.tpl"); echo $output; exit(); } as said works fine on developing machine, uses embedded server of phped try: header("status: 404 not found");

asp.net - MSBuild _CopyWebApplication not copying <link> from vbproj -

we have cmd file loads msbuild xml file , builds , publishes our vb .net web app. noticed today 1 of user controls we're using not being copied usercontrols folder in output directory. when build , publish project within visual studio 2008 file there. i believe reason happening because file in usercontrols folder in project shortcut file in different solution within same project. itemgroup xml in myproject.vbproj file looks this: <content include="..\othersolution\usercontrolfile.ascx"> <link>usercontrols\usercontrolfile.ascx</link> </content> in msbuild.xml file have, following being run after solution has been built: <msbuild projects="$(projectrootpath)\myproject.vbproj" targets="_copywebapplication;_builtweboutputgroupoutput" properties="outdir=$(buildfilespath)\" /> does have idea why shortcut not being copied outdir ? i've checked bunch of questions on here, ,

Can constructors throw exceptions in Java? -

are constructors allowed throw exceptions? yes, constructors can throw exceptions. means new object eligible garbage collection (although may not collected time, of course). it's possible "half-constructed" object stick around though, if it's made visible earlier in constructor (e.g. assigning static field, or adding collection). one thing careful of throwing exceptions in constructor: because caller (usually) have no way of using new object, constructor ought careful avoid acquiring unmanaged resources (file handles etc) , throwing exception without releasing them. example, if constructor tries open fileinputstream , fileoutputstream , , first succeeds second fails, should try close first stream. becomes harder if it's subclass constructor throws exception, of course... becomes bit tricky. it's not problem often, it's worth considering.

How can I make a copy of an iterator in Java? -

we have list of elements , have simplistic collision detection check every object against every other object. the check commutative, avoid repeating twice, in c++: for (list<object>::iterator it0 = list.begin(); it0 != list.end(); ++it0) { (list<object>::iterator it1 = it0; it1 != list.end(); ++it1) { test(*it0, *it1); } } the key bit here copy it1 = it0 how write in java? you cannot copy java iterators, you'll have without them: for(int i=0; i<list.size(); i++){ for(int j=i; j<list.size(); j++){ test(list.get(i), list.get(j)); } }

android - Textviews inside tabs -

i have 3 tabs. i'd know if tab can have more 1 textview.everytime try add new textview, if in different positions on screen, appear overlapped. the details alligned on left , data alligned on right. can't write way want in here because don't how put tabs. but idea like: on left perfect column name, login, address, etc... , on right side perfect column name, login, address, etc... what i'd like, example: |personal| -> tab inside tab: information name: zoe shnoeder login: zoe-shnd address: ulisses street, london, uk date of birth: 13/11/1990 contacts telephone: 2134212 e-mail: zoeshn@hotmail.com and if possible square around information , details , square around contacts , details, like -contacts--------------------------- | telephone: 2134212 | | e-mail: zoeshn@hotmail.com | thanks in advance, rita you need layout contain textview s. i'

c# - onclick delegate is triggered only once -

i writing outlook add-in adds menu outlook. although set delegate action menu seems being removed after 1 call delegate - 1 click on menu item . next time user clicks not getting delegate. code example: menucommand = (office.commandbarbutton)cmdbarcontrol.controls.add( office.msocontroltype.msocontrolbutton, missing, missing, missing, true); menucommand.caption = "&generate weekly..."; menucommand.tag = "generate"; menucommand.faceid = 65; menucommand.click += new microsoft.office.core._commandbarbuttonevents_clickeventhandler( menucommand_generate_click); menucommand = (office.commandbarbutton)cmdbarcontrol.controls.add( office.msocontroltype.msocontrolbutton, missing, missing, missing, true); menucommand.caption = "&about"; menucommand.tag = "about"; menucommand.faceid = 65; menucommand.click += new microsoft.office.core._commandbarbuttonevents_clickeventhandler( menucommand_about_click); menucommand.begingroup = true;

android - Cannot type anythig into the editText field that is inside listview(that is edittext field is the cell of the listview) -

hii have listview , each cell of listview contain edittext field.but problem can't type edittext field.i there solution ? edittext fields may disabled due layout_width , layout_height done edittexts , listview.

http - Firefox not using cached copy of file after 304 -

i'm seeing behaviour in firefox seems me unexpected. not particularly repeatable (unfortunately) crop time time. once starts, repeatable on refreshing page until full refresh (ctrl-f5) done. last time, managed trace. basically, ff4.0.1 requesting resource (from asp.net mvc 3 application running under iis7): get http://www.notarealdomain.com/versionedcontent/scripts/1.0.40.5653/jquery.all.js http/1.1 host: www.notarealdomain.com user-agent: mozilla/5.0 (windows nt 6.1; wow64; rv:2.0.1) gecko/20100101 firefox/4.0.1 accept: */* accept-language: en-gb,en;q=0.5 accept-encoding: gzip, deflate accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 keep-alive: 115 proxy-connection: keep-alive referer: http://www.notarealdomain.com/gf if-modified-since: sat, 01 jan 2000 00:00:00 gmt it gets following response server (via proxy, can see in iis server logs request made way server): http/1.1 304 not modified date: mon, 09 may 2011 14:00:47 gmt cache-control: public via: 1.1 corp-proxy (ne

iphone - importance of Bundle Seed ID during Create App ID? (Apple Provisioning Portal) -

i unsure importance of bundle seed id when creating new app id in apple provisioning portal. what should consider when selecting seed id? when need use existing seed id? on ios provisioning portal found when creating new app id can select existing bundle seed id new app. i’m wondering if should use same appid prefix between free , paid versions , if so, why? i’d know advantages , disadvantages. thanks in advance... example app id: abcde12345.com.foocompany.* abcde12345 bundle seed id (generated apple). com.foocompany.* bundle identifier of app id , bundle identifier in xcode project must start ‘com.foocompany.’ , asterisk can replaced string of choosing, so, answer: bundle seed id generated apple, don't have worry that. gets created automatically. take on information wildcard app id's. makes possible more apps on same license!

Java rounding issues -

i using following code round float value given input. cant right. if give $80 should $80.00 , if give $40.009889 should $40.01. how do ? public class round { public static float round_this(float num) { //float num = 2.954165f; float round = round(num,2); return round; } private static float round(float rval, int rpl) { float p = (float)math.pow(10,rpl); rval = rval * p; float tmp = math.round(rval); return (float)tmp/p; } } use bigdecimal class instead of float. and use java code this: bigdecimal bd = new bigdecimal(floatval); bd = bd.setscale(2, bigdecimal.round_half_up);

c# - Is it possible to supply a type converter for a static resource in Silverlight? -

i'm trying style lineseries chart has datetime objects on independent axis , integer values in dependent axis. want show tooltip text whenever user overs mouse on datapoint , showing both independent , dependent values, need format datetime object in order display formatation like. i found this example uses property contentstringformat of contentcontrol , after digging learnt that property not available in silverlight, on wpf. found another example uses converter, can't place converter definition on resoursedictionary can on usercontrol , because resourcedictionary doesn't have property resources .. :( i don't know if explained myself right, question is.. possible supply type converter static resource in silverlight? edit - xaml take @ thread: pass value of field silverlight converterparameter it has tons of different approaches getting around converter limitations!

objective c - Generating NSManagedObjectSubclass Automatically -

i see xcode add these methods on business.m - (void)adddistrictsobjectdistrict *)value { nsset *changedobjects = [[nsset alloc] initwithobjects:&value count:1]; [self willchangevalueforkey:@"districts" withsetmutation:nskeyvalueunionsetmutation usingobjects:changedobjects]; [[self primitivevalueforkey:@"districts"] addobject:value]; [self didchangevalueforkey:@"districts" withsetmutation:nskeyvalueunionsetmutation usingobjects:changedobjects]; [changedobjects release]; } unfortunately xcode not add (void)adddistrictsobjectdistrict *)value; on business.h in other words method not advertised others. why? i got compilerwarning when tried use function adddistrictsobject also not want change either business.h or business.m xdatamodel still change lot. so should do? any way avoid compiler warning? how should use addobject without compiler warning using generated code? category solution? if data model going change lot, might w

c - Realizing an outputMixObject in the Android NDK with OpenSL ES causes crash of application -

i trying implement opensl es project of mine, while doing so, crash of application. error occurs when try realize outputmixobject calling it's realize method: // create outputmixer. result = (*engineinstance)->createoutputmix(engineinstance, &outputmixobject, 1, null, null); assert(result == sl_result_success); // realize outputmixer. result = (*outputmixobject)->realize(outputmixobject, sl_boolean_false); assert(result == sl_result_success); when run application test, following log entries: 05-11 13:20:19.736: info/debug(31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 05-11 13:20:19.736: info/debug(31): build fingerprint: 'generic/sdk/generic:2.3.1/gsi11/93351:eng/test-keys' 05-11 13:20:19.736: info/debug(31): pid: 631, tid: 631 >>> org.test.opensl <<< 05-11 13:20:19.746: info/debug(31): signal 11 (sigsegv), code 1 (segv_maperr), fault addr 00000000 05-11 13:20:19.746: info/debug(31): r0 00000000 r1 00000000 r2

codeigniter - JQuery ui autocomplete not working with code igniter -

what want simple. want user able put in name , while inserting code igniter , jquery ui looks database , starts posting recommendations .. got far bit of here on stackoverflow .. still not working @ all. the jquery ui command $("#update-text").autocomplete({source:"<?php echo site_url('userprofile/autocomplete');?>",datatype:"json", type:'post'}); the form containing text field in php file <div> <form method="post" action="#" name="updateplanform"> <div class="ui-widget"> <label for="update-text"></label> <input type="text" id="update-text" name="updatetext" value="what gonna today?" onclick="removetext()"/> </div> <input type="button" class="small green button" value="update plan" name="updateplanbutton"/> <!-- once clicked jquery sen

Haskell - sortBy function -

i have list of vectors. want sort list of vectors length, using sortby function. have is: import data.list vectorlength::(int,int)->float vectorlength(x,y) = sqrt(fromintegral ((x^2)+(y^2))) sortvectors::[(int, int)]->[(int, int)] sortvectors list = sortby(map vectorlength list) list main = print(map vectorlength [(1,4), (2,6), (-2, -8), (3, -4)]) print(sortvectors[(1,4), (2,6), (-2,-8), (3, -4)]) the vectorlength function work. map vectorlength [(1,4), (2,6), (-2,-8),(3,-4)] output: [4.1231055, 6.3245554, 8.246211, 5.0] i want when calling following function sortvectors [(1,4), (2,6), (-2,-8), (3,-4)] output: [(-2,-8), (2,6), (3,-4), (1,4)] but following error: couldn't match expected type `(int, int)' actual type `[a0]' expected type: (int, int) -> (int, int) -> ordering actual type: [a0] -> [b0] in return type of call of `map' in first argument of `sortby', namely `(map vectorlength list)

How to save a MS Access filtered table as a query in VBA -

i need able save results of filtered table in microsoft access(2010) query. reports in access dynamic if based off of query. if based reports off of table itself, wouldn't save of search terms/filter results. in access macro builder, docmd.save saves current table, need able "save as" in vba can save filtered table query. thanks you need build sql statement based on filter , orderby settings of form. dim ssql string ssql = "select ... mytable" if len(me.filter) > 0 ssql = ssql & " " & me.filter end if if len(me.orderby) > 0 ssql = ssql & " order " & me.orderby end if call dbengine.workspaces(0).databases(0).createquerydef("myqueryname", ssql)

GIT Bash asking for my user credentials when performing a push using SSH -

i have created , implemented git project on codaset website. using ssh communicate between codaset , local repository. when push git bash, git bash asks me user name credentials. although, git bash performs push successfully, tedious having enter user credentials every time perform push. i have checked out many blogs , suggestions fix problem, no avail. also, have tried use putty. questions are: has 1 come across problem , fixed it? or, can turn on debugging @ least identify precise reason(s) why git bash asking user credentials? in terminal type: git config -l this bring repo's config information. @ row remote.origin.url . you're describing should be: https://github.com/username/project.git . mean's it's using http protocol instead of ssh! had problem :) easy fix though! just execute in terminal: git config remote.origin.url git@github.com:username/project.git should take care of things!