Posts

Showing posts from February, 2013

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.

android - The constructor Intent(new View.OnClickListener(){}, Class<DrinksTwitter>) is undefined -

i getting following error: the constructor intent(new view.onclicklistener(){}, class<drinkstwitter>) undefined in following code snippet: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // edittext , button references etusername = (edittext)findviewbyid(r.id.username); etpassword = (edittext)findviewbyid(r.id.password); btnlogin = (button)findviewbyid(r.id.login_button); btnsignup = (button)findviewbyid(r.id.signup_button); lblresult = (textview)findviewbyid(r.id.result); // set click listener btnlogin.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // check login string username = etusername.gettext().tostring(); string password = etpassword.gettext().tostring(); if(username.equals("test") && password.equals(

java - Achieve the xml hierarchy structure having an ordered list with level numbers -

i have list of numbers represents levels in xml tree. example have folowwing list: 0, 1, 2, 2, 1 and xml (with 'lev' elements) needs be: <lev> <lev> <lev> </lev> <lev> </lev> </lev> <lev> </lev> </lev> how can form xml having list? need recursive method, need xsl file, great having java code - parsing list. i'm not sure if possible, having list. great! thanks. later edit: for above list let's introduce position too: level position 0 0 1 1 2 2 2 3 1 4 if having in list number(level) x , after having number(level) y y<=x know @ point last element(s) (x, x-1, ..., y) needs closed when creating xml. ex.: when @ position 3 (level 2) know element @ position 2 (also level 2) needs closed when @ position 4 (level 1) know element @ position-s 3 (level 2) , 1 (level 1) needs closed recursion

multithreading - Is there a build in functionality in .NET to create thread bound variables? -

is there way (psedo code): getcurrentthread().items.add(new refobject); then later on retrive refobject[] refobjs = getcurrentthread().items; and enumerate objects. both calls occur on same thread during life span of it. the basic idea can easisly identify items current thread , in fact created in thread. it's same using page.request object asp.net request - know it's unique in worker process, doesn't mixed other requests being served @ same time. want treat thread page.request - comes , goes, while it's alive, can query @ without caring other threats exist in process. once did similar, more of simulation marshaling objects reference. , can think of couple of more ways it, don't want manually store mapping between thread , object myself. isn't there similar transactionscope threads in .net ? not intersted in dealing hardship of syncronization , avoiding race conditions. ps: if that's not available, can @ least application domain without

date_select in rails -

i have issue, when post date in date_select post today's date, although select future date keeps giving me current date. <%= form.date_select :starts_at %> does me out... in advance. check model. are attributes attr_accessible while isn't? attr_protected?

image polling through javascript -

i need poll image using javascript , need perform action once image found @ position. code have written task. /*----image handling script starts here----*/ var beacon = new image(); beacon.onload = function() { console.log('image found'); console.log(this.width,this.height); window.clearinterval(timer); }; beacon.onerror = function(){ console.log('image not found'); } var timer = window.setinterval(function(){ console.log('sending request again'); beacon.src = "http://www.google.co.in/logos/2010/lennon10-hp.gif"; },2000); /*----image handling script ends here----*/ problem that, after 1 request, response gets cached , request don't sent everytime set src. if examine net tab, sends request on first src set , caches response. i need send fresh request image every time code sets src. workarounds? request image different query string each time. browser treat unique url , won't have in cache. can away

unit testing - How to test private variables in NUNit? -

i have a static class has private variable. private static dictionary<strng, string> items = new dictionary<string, string>(); many public methods of class access dictionary object. want write nunit test class (in different library). how can test private variable? i know question nunit , don't want argue whether it's or bad practice test private members. fact it's necessary, when have deal legacy or poorly designed code can't refactor. so mention gallio/mbunit provides light api called mirror ease testing private type members. example: following test sample invokes private method named someprivatemethod on foo instance. [test] public void sampletest() { var foo = new foo(); int actual = mirror.forobject(foo)["someprivatemethod"].invoke(); assert.areequal(123, actual); }

php - Finding the first and last days of each month in the period of time -

i have task make website article stats based on database results. need calculate amount of articles added monthly , pass these results javascript stats function. the first i'm doing finding entire period in articles have been added: select min(date) startdate articles limit 1 select max(date) enddate articles limit 1 now have period starts $startdate , ends $enddate . these variables unix timestamps in database. column date in database unix timestamp. next, should find amount of articles have been added in each month doing query in foreach loop like: select count(id) total articles date > ".$startmonth." , date < ".$endmonth but make need find first , last days of each month in period. , stucked @ moment. please can please suggest me how find these first , last days array. think should make strtotime("+1 month",$date) in while loop until $startdate equals $enddate . in advance. upd. there total 46 articles in database. wi

couchdb - how do i declare a non .deb binary dependency on a .deb package? -

i'm creating .deb package , got point can express of dependencies. unfortunately, there dependencies left don't have .deb package (eg wdfs, or couchdb .deb file behind , 1 newer version doesn't exist yet) can determined @ runtime. what's best way express package dependency ? pos install scripts ? http://www.debian.org/doc/debian-policy/ch-relationships.html the proper solution create .deb packages missing components, perhaps in private repository of yours. there equivs allows build dummy packages e.g. satisfy problematic dependencies, i.e. "i know doing; assume package installed". one-off jobs, can invoke dpkg --force-depends achieve same result.

Drupal 6 - change Author of a node -

is there easy way change author of node user? can't seem find it. found workaround, setup "action" change author of node specific user, , temporarily setup "trigger" whenever update node, should run action. works, ugly. suppose attack db directly, these both seem rather inelegant solutions. i appreciate shouldn't common requirement. happened: setup site, including place-holder content, publisher users populated real content. not right way go it, it's situation find myself in... can't edit node, expand authoring information section near bottom of page, , change author name. you can change authored on date too. if need change authoring information of lots of pages, i'd recommend views bulk operations . changing author 1 of options.

caching - Joomla - delay on publishing new things -

if disable cache on joomla 1.5 , publish new menu item or other information on site new element don't appear after. if enable cache on joomla 1.5 , set 1 minute delay, , publish new menu item, wait minute, refresh, , see no menu item. i see new elements, after period of time, regardless joomla configuration options on cache page. what be? thanks lot, mem for else may have same issue: it seems related joomla 1.5.x only. not sure on configurations. way found solve to: if go extensions (or addons not sure since 1 not in english). click under "plugin management" , then, need find system-cache option, , disabled it.

visual c++ - Convert OLECHAR* to CString in VC++? -

how convert olechar* cstring in vc++ ? olechar* same bstr . can convert cstring (sorry formatting, have lost code icon now). olechar* value; bstr (bstrvalue(value)); _bstr_t tmp(bstr, false); //wrap bstr cstring cs(static_cast<const char*>(tmp)); //convert it

actionscript 3 - Can't resize content to fit a new NativeWindow in AIR -

i'm trying make popup window class content disaplyobject, , popup , display in itself, i'm cracking head matching size of content window or vise versa... think maybe window not display of stage or ?! the content way big..and goes out of bounds. here code : public class subwindow extends nativewindow{ public function subwindow() { var windowoptions:nativewindowinitoptions = new nativewindowinitoptions(); windowoptions.systemchrome = nativewindowsystemchrome.standard; windowoptions.type = nativewindowtype.utility; windowoptions.resizable = false; super(windowoptions); this.stage.align = stagealign.top_left; width = 400; height = 400; title = "are sure?"; alwaysinfront = true; activate(); visible = false; addeventlistener(event.closing, closewindow, false, 0, true); } public function closewindow(e:event) { e.stopimmediatepropagation(); e.stoppropagation(); e.preventdefault();

odbc - Btrieve (file) owner problems -

i've been tasked exporting bunch of tables btrieve (pervasive) database 1 of tables putting fight. i'm using pervasice control centre when run select * <troublesome table> error: odbc error: sqlstate = s1000, native error code = 0 unable open table: <troublesome table>. owner namme invalid(btrieve error 51) i've google'd , found out there can "owner" ddf file but, if understand correctly, tables in file. there's 1 table causing error have no idea what's going on. could please offer assistance. there can owner name on btrieve file ddf. in case, seems btrieve file has owner name required read file (an owner name can allow read access without owner name or no access). depending on version of psql using, can issue set owner= command before executing select statement. full documentation on set owner, take @ http://docs.pervasive.com/products/database/psqlv11/wwhelp/wwhimpl/js/html/wwhelp.htm#href=sqlref/syntaxref.3.76.html

c# - How to make a button not show up but still be used by javascript? -

i using button has invible , should used javascript function. <asp:button id ="btndummy1" runat="server" visible ="true" onclick="btnsubmit1_click" width="0px" height="0px"/ i cannot keep visible = false javascript not use invible content in poage. havetried give width=0 , height=0, still showws in chrome. guys think should do? thanks in advance :) a pretty clean approach in asp.net give "hidden" class: <asp:button id ="btndummy1" runat="server" cssclass="hidden" /> then in stylesheet: .hidden { display: none; }

c++ - How to use interfaces from IE9 Beta library? -

i asked similar question @ internet explorer extension development forum didn't answer. found not me has problem did used of these interfaces ie9 beta? i'm querying ihtmldocument7 using atl null pointer ccomqiptr<ihtmldocument7> document7 = document3; if(document7) { //do sth document7 } but document7 null. other interfaces (ihtmldocument1-6) works fine.

python - Django with PyPy -

are there reasons of using django pypy? read pypy increases perfomance. unlikely. django application i/o-bound, because of database connection. pypy wouldn't @ all, if purely compatible (which i'm not sure is).

Is a RESTful url valid without ids between objects? -

i have 2 restful api design questions. let's have fruitstand web app. want return information fruits carry , counts fruits, , with: http://myfruitstand.com/fruits question 1: if have 10 oranges, i'm thinking can information particular orange with: http://myfruitstand.com/fruits/oranges/3 but above url restful--don't need id between 'fruits' , 'oranges' conform rest standards? or url 'fruits' being followed subclass 'oranges' okay? question 2: similarly, if want have discussion forum oranges (not particular orange), can put here: http://myfruitstand.com/fruits/oranges/comments again, above url restful since there's no id between 'oranges' , 'comments' (an id here, of course, imply discussion particular orange , don't want that)? here, there's no subclass rational of 'oranges' being followed 'comments.' thanks in advance, chuck it more restful construct resource-coll

java - Why is cancelCellEditing() not called when pressing escape while editing a JTable cell? -

i have editable jtable , have set defaultcelleditor so: colmodel.getcolumn( 1 ).setcelleditor( new defaultcelleditor( txteditbox ) { // ... @override public void cancelcellediting() { super.cancelcellediting(); // handling event } // ... } however, when pressing escape while editing cell in column, though editing mode finished, method not called. ideas why? doing wrong? there way handle (other manually adding keylistener is)? the official way: can register celleditorlistener: abstractcelleditor.addcelleditorlistener(...). if editing canceled, editingcanceled(changeevent e) should called. due sun bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6788481 , editingcanceled not called :( as workaround can register own action escape key , handle yourself. not work resize events. another solution (quick , dirty;-)): overwrite methode jtable.removeeditor() , insert code after super call.

sharepoint - MOSS 2007 Version History Query -

i need generate report sums number of files uploaded document library, including individual versions. for example, if have document library contains 20 unique documents, 2 items having more 1 version (say 2 versions each), i'd able return report indicates there have been 22 uploads. is possible using built-in moss 2007 tools? have query database directly? thanks in advance you cannot query database directly. not supported. this possible using audit reports. enable auditing on library , can query auditing in sharepoint object model. code sample on item level auditing: http://www.microsoft.com/downloads/en/details.aspx?familyid=0e4dd1e7-4b1d-4cb1-b906-6d5d272c8e9d&displaylang=en enable auditing: http://www.shareesblog.com/?p=195

php - Merging two various MySQL tables, order and limit it for a combined result -

i need combine various mysql tables common result. needed , expected result list of last x comments on website tables individuals, like: news_comments, pages_comments, etc. individually, tables has joins users database. the structure of 3 of comments table are: news_comments, pages_comments, other_comments id int ai id_new/id_page/id_other int id_user int comment text created int (timestamp) the table users: id int ai login int password varchar ... i don't complete last because need id , login. the normal use of queries (individuals) are: select users.id, users.login, news_comments.*, news_comments.id id_comment users, news_comments users.id=news_comments.id_user , news_comments.id_new=$id order created desc limit $offset,$rows and works fine! but in backend want have list of comments on website moderate , control it. need combine comments tables, order created desc , limit result make pagination. i use mysql , php, if need use php there no problem that. h

forms - jQuery - check if all mandatory fields in a section have been answered -

i need run check on lightbox popup see if fields not optional have been input. html <div id="manualaddressentry01" class="container popup large hidden shadow02 rounded03"> <div class="popupheading"> <h4>please enter full address:</h4> </div> <div class="popupcontent rounded03"> <img class="closecontainer cursor" src="resource/nw/images/hires/helpclose.gif"/> <div class="fl"> <label for="form_popup1_housename">house number/name</label> <input class="jsvalid_required" id="form_popup1_housename" type="text" size="25"/> </div> <div class="fl" style="padding-left:10px"> <label for="form_popup1_street">street</label> <input class="jsvalid_re

java - Force "respond_do" format -

i using rjs prototype. in controller have code: def method_name respond_to |format| ... format.html format.js end en is possible force "respond_do" use 'format.html' whether or no request html or java? if so, how it? don't use respond_to. let controller action return or call render if want specify particular view.

facebook - iPhone - UIWebview doesn't save authentication to sites -

for these purposes, let have application contains single uiwebview. i'm loading request of these sites: facebook, gmail, twitter, etc., , receive login screen. the thing - if log in , relaunch app, have go through login screen again. in mobile safari/google app example retain login cookie/session details/whatnot , wouldn't need enter user credentials again. behavior want have. stuff tried: sending cookies nshttpcookiestorage via nsurlrequest. persisting cookies myself nsuserdefaults, no luck. how can achieve behavior mobile safari & google app has? the cookies should archived , persisted when app terminated , later reloaded when app becomes active. can achieve by: [[nshttpcookiestorage sharedhttpcookiestorage] setcookies:cookies forurl:url maindocumenturl:nil]; // cookies unarchived array of cookies

java - Using JDBC in setup for a Jmeter Junit test -

i trying use jdbc connect mysql database in setup , teardown methods of junit tests being run through jmeter. jmeter create multiple threads, each of run 1 instance of test. the issue run into, if instantiate datasource in setup of junit test, connection pool runs out of connections. there way design test not happen? i'm trying avoid increasing max mysql connections solve issue. yes, make sure each test closes connection , returns pool when it's done. sounds that's not happening, can't sure. if that's not case, i'd recommend tuning connection , thread pool sizes better don't run out.

mouseevent - Can I stop the mouse from interacting with the intelliJ IDEA switcher? -

i switch between editors in intellj ctrl - tab , @ same time accidentally move mouse (which on switcher), means end choosing random editor rather 1 wanted. is there way can prevent switcher reacting mouse input? what os , idea version use? i've tested idea 10 on windows , mouse events not affect ctrl+tab window @ all. if still happens in latest idea version, please file bug steps reproduce at: http://youtrack.jetbrains.net/issues/idea . it's known bug in idea versions before idea 10.

sql server - Fill a Column for Every Row in a Database -

i added new column table has on 1000 rows of data. wondering how can update new column piece of data of rows in database without having manually it. what easiest way accomplish this? i working ms sql 2005 server. thank in advance advice. try out. update table_name set column_name = value this given value want assign constant. correct?

sql - How to format datetime field from MySQL in a select statement? -

i have column set datetime , defined format of 0000-00-00 00:00:00, , trying query select statement format date after coming out. i tried date_format(date_field,'%m-%d-%y') , didn't work. want pull out month-day-year... is possible, or have after data has been pulled out , php function? you need alias date_format function return field php can recognize. without alias outputted field be: $date_format(date_field,'%m-%d-%y') with alias: $date_field

http - getString of HttpRequest Being Sent on Android -

is there way can take httpget object , see exact text sent on wire? i'm using threadsafeclientconnmanager when create httpclient. httpget doesn't override tostring() , default headers aren't there when call httpget.getallheaders() . have tried httpmethod 's headeriterator() method? returns headeriterator described follows: iterator returns header objects in sequence sent on connection. the method contained in same class getallheaders() (the superclass), it's worth shot. may want take @ using traffic monitor such fiddler verify you're correct in header assumptions.

ios - Drawing unicode-strings with CoreGraphics -

how can draw unicode respectively utf8 text using coregraphics functions? can't use uikit-functions, because i'm not drawing on main-thread. uikit can handle per-context drawing on thread, should simpler trying draw glyphs yourself. otherwise i'd core text.

Convert Ruby Date to Integer -

how can convert ruby date integer? t = time.now # => 2010-12-20 11:20:31 -0700 # seconds since epoch t.to_i #=> 1292869231 require 'date' d = date.today #=> #<date: 2010-12-20 (4911101/2,0,2299161)> epoch = date.new(1970,1,1) #=> #<date: 1970-01-01 (4881175/2,0,2299161)> d - epoch #=> (14963/1) # days since epoch (d - epoch).to_i #=> 14963 # seconds since epoch d.to_time.to_i #=> 1292828400

mysql - Does an additional "AND `columnname` LIKE '%'" hurt performance? -

simple question: adding query hurt performance in mysql or optimized away? and `name` '%' i've got no big database here test on. by way, want because want users able send parameters server-side script grabs prepared statement specified user , inserts parameters. want users able omit parameters when searching without hurting performance, , like relatively slow, right? like's can expensive indeed, depending on indexes have on name field. have tried measure query? explain [extended] select [...] , `name` '%' see http://dev.mysql.com/doc/refman/5.0/en/explain.html then mysql give indications whether has optimised unnecessary clause away or not.

java - BlazeDS and Flash Builder, Inheritance generation problem -

i have server simple java objects running. want build client flex , connect server data blazeds. problem flash builder not generating classes correctly. properties being generated, inheritance not being generates. is limitation or wrong in code? afaik inheritance not supported in flash builder / fiber. ran same problem on current project , ended writing custom code generator ourselves. if time permits, suggest same, you'll have complete control on generation process.

Selecting Parent's Child in jQuery -

i think need selector, can't find one. want select anchor tag, can select li using .parent() ... jquery: $("nav ul li > ul").parent().append('<span class="arrow">&darr;</span>'); html: <li><a href="#">the events</a> <ul> <li><a href="#">schedule</a></li> <li><a href="#">buy tickets</a></li> <li><a href="#">features</a></li> </ul> </li> the code above puts arrow on right li s, 1 level high. need target li 's a tag. you can use .siblings() , this: $("nav ul li > ul").siblings("a").append('<span class="arrow">&darr;</span>'); you can find full list of traversal functions here .

c++ - What message causes a button to send a WM_COMMAND message -

i know button, when clicked, sends wm_command message it's parent, message receive makes send message? overriding default wndproc of button , button not receive wm_command message, need know message causes button send wm_command message can replicate functionality. i found it's combination of wm_lbuttondown, wm_mouseleave, , few other things. example, wm_command fired if mouse depressed on button, , still on button when wm_lbuttonup fired. space, enter, etc, believe handles vk_enter message , stuff.

php - Check if user hits back button in browser -

i'm trying use javascript onbeforeunload event ask user if want exit page, don't want event fire (edit: "the event" being dialog box pops asking user click ok leave site or click cancel stay on current page) if user hits button since staying on site. so there way tell if user has hit button using javascript or php? i've gotten solution using hidden iframe works in ie, need can work firefox, chrome, , safari if possible. edit: ie solution works because when user hits button iframe sent parent page remains @ same spot. can tell user has indeed hit button, use history.back() . little hack doesn't work in other browser (to knowledge), i'm looking cross-browser solution. tl;dr i'm using window.onbeforeunload pop dialog asking users if want leave site or not. don't want pop when user hits button. how can tell user has hit button in browser? thanks, rick short answer: no. long answer: noooooooooooooooooooooooooooo. please

c# - nhibernate subclass mapping when both subclasses can be materialized -

i have following classes public class person { public virtual int id { get; set; } } public class employee : person { public virtual int employeeproperty { get; set; } } public class customer : person { public virtual int customerproperty { get; set; } } conceptually same person can both employee , customer. person can exist without either employee or customer record. using table per subclass how can work. as stands don't see way nhibernate work way. if create person, , try create employee using existing person id, nhibernate still tries insert person. there way nhibernate realize have person , want add employee record? i prefer not go table per class or table per hierarchy if possible. you model not correct. if person can both customer , employee, should not use inheritance (an employee is-a person), composition (an employee has-a [corresponding] person or person has-a employee [role])

iphone - How to load a view XIB as a subview into a view controller XIB -

i have custom view made ib file since it's quite complex: (rotatorview.xib/.h/.m). want add rotatorview subview view controller. can programmatically using: nsarray *array = [[nsbundle mainbundle] loadnibnamed:@"rotatorview" owner:self options:nil]; but i'd rather not that. better design if add rotatorview canvas of view controller in interface builder. way use ib manage properties of each instance of rotatorview instead of setting properties programmatically in each class. there way can add custom view xib parent view controller? have build ib plugin this? you can add uiview control canvas in ib , change class name match custom view class name. although save calling loadnibnamed method programmatically, you'll not able set custom properties directly ib. the solution doing build ib plugin , unfortunately seems can't make cocoa touch ib plugins because can't make cocoa touch frameworks

c++ cli - c++CLI event handler's not triggered -

i getting c++ cli , running problem event handlers called , not. here list of event handlers: private: system::void form1_load(system::object^ sender, system::eventargs^ e) { } private: system::void exittoolstripmenuitem_click(system::object^ sender, system::eventargs^ e) { application::exit(); } private: system::void abouttoolstripmenuitem_click(system::object^ sender, system::eventargs^ e) { messagebox::show("paul madsen\nlab 13", "about lab 13", messageboxbuttons::ok, messageboxicon::asterisk); } private: system::void textbox1_textchanged(system::object^ sender, system::eventargs^ e) { try { double tmp = double::parse(textbox1->text); } catch(...) { textbox1->resettext(); } } private: system::void textbox2_

wpmu - Wordpress 3.0.3. How To Change Main Site -

i have moved wpmu site new host, , upgraded wp 3.0.3. things going pretty easy, except previous website had different url main website installation. have moved install, don't need previous url main site need make new url main site. go changing this? i've changed entire database changing previous url new url, , wp-config set correctly new url , htaccess has no mention of it. i'm running out of places on change url. any advice/help appreciated. steps change site url in wordpress replace new site url old site url in exported database sql file (use notepad++ fast search , replace) change site url in wp-config file change database information (db name, host, username, password) in wp-config file change site url in .htaccess file

paperclip - Rails STI conditional sub-classing from base class -

i'm developing project have entity may have 2 kinds of assets: pictures , videos , basically. since want assets on same table , single upload form either pictures or videos , i'm using single table inheritance having both picture , video descending asset class. also, i'll running different validations/callbacks depending on whether video or picture. i'm using paperclip deal upload process, , idea when uploading file , creating asset it, application instantiate correct subclass ( picture or video ) depending on mime-type of uploaded file. this sketch of classes: class project < activerecord::base has_many :assets accepts_nested_attributes_for :assets end class asset < activerecord::base belongs_to :project has_uploaded_file :content, ... end class picture < asset validate :image_size ... end class video < asset after_save :convert_format ... end my idea implement before_save callback on asset class , try instantiate co

Android case statement help -

i'm trying make case statement open different class depending on button pressed. got working fine 1 button unsure how proceed 2 buttons. heres code far: public void onclick(view v) { switch (v.getid()) { case r.id.about_button: intent = new intent(this, about.class); startactivity(i); break; case r.id.reminderlist_button: intent = new intent (this, reminderlistactivity.class); startactivity(i); break; } } this gives error because i'm reusing local variable (i) - if let me know how appreciated. you declare variable i before switch statement. preferable "scoping" if plan use variable i after switch statement: public void onclick(view v) { intent = null; switch (v.getid()) { case r.id.about_button: = new intent(this, about.class); break; case r.id.reminderlist_button: = new intent (this, reminderlistactivity.class); break; } sta

validation - Validating TinyMCE HTML code using W3C -

i trying validate tinymce generated html code appears w3c accept url or files input. suggestion how validate tinymce code? if implement validation application, use own validator, example tidy . this should faster sending data across world, , easier too, because dont have parse response of w3c-validator.

iphone - How to parse an <img> that is deep within a div using Element Parser? -

i'm using parser called element parser , i'm trying parse img tag 4th img tag down under div id "group-e". can retrieve 2nd img not after 2nd img. img i'm wanting parse is: <img src="http://example.com/i_need_this_image_here.jpg" />. how can done? far i've used following code 1st img tag: element* needimg = [document selectelement: @"div.edgetop div#group-e img"]; html code trying parse <div class="edgetop"> <div id="group-e"> <img src="http://example.com/image.jpg" id="image" /> <img src="http://example.com/image2.png" border="5" /> <h4>group - section e</h4> <div class="efs" style="width:28px;">group:</div>e<br /> <div class="efs" style="width:28px;">link:</div><a href="group/e">group e</a><br /> &

c# - Find/parse server-side <?abc?>-like tags in html document -

i guess need regex help. want find tags <?abc?> can replace whatever results code ran inside. need regexing tag/code string, not parsing code inside :p. <b><?abc print 'test' ?></b> result in <b>test</b> edit: not in general, matching (<?[chars] (code group) ?>) this build new copy of string source , replacing <?abc code?> result of process(code) regex abctagregex = new regex(@"\<\?abc(?<code>.*?)\?>"); stringbuilder newsource = new stringbuilder(); int curpos = 0; foreach (match abctagmatch in abctagregex.matches(source)) { string code = abctagmatch.groups["code"].value; string result = process(code); newsource.append(source.substring(curpos, abctagmatch.index)); newsource.append(result); curpos = abctagmatch.index + abctagmatch.length; } newsource.append(source.substring(curpos)); source = newsource.tostring(); n.b. i've not been able test cod

emacs - Elisp: Asking yes-or-no in interactive commands -

i'm new emacs , trying write few emacs lisp functions. i'd write function takes 2 parameters , can handle being interactive. however, 1 of parameters boolean — it'd perfect if use (y-or-no-p) , (interactive) doesn't seem have character code that. any ideas? update: i'm using gnu emacs 23. also, here's function looks far: (defun foo (str bool) (interactive "ssome text: \nsdo thing?") (some-func str) (if bool (some-other-func str))) ah, found it. (defun foo (str bool) (interactive (list (read-string "some text: ") (y-or-n-p "do thing? "))) (some-func str) (if bool (some-other-func str)))

c# - Exposing different view of Class -

is possible give different view of class . example , have account class , want expose data using wcf. different method call want expose different property of account class.suppose particular call want expose username , password, call want expose email , address. should have write different class or can expose needed property client if one usage wcf , another usage internal app, can annotate class appropriately [datamember] such desired properties exposed. if have 2 different wcf scenarios, introduce new class (or classes) represent each set of return data, adding implicit conversion operator (from entity dto ), can do: public customerlite getcustomer(int id) { customer cust = sometier.getcustomer(id); return cust; // note cust customer returning customerlite }

Open source C# projects with both unit tests and mocks (not MVC projects) -

i know of prominent projects in codeplex, github etc c# asp.net or c# apis both functioning tests (nunit) , mocks (rhinomocks, nmock etc). the emphasis on both tests , mocks. look @ automapper project this not asp.net investigate unit tests

iphone - Combining OpenGL ES and View-Based Application -

how combine opengl es application view-based application iphone? you link 2 switching view in uiwindow. [window addsubview:yourview]; it easy. can't mix opengl es , uiview drawing within same view, unless stop opengl es animating of course.

windows authentication in ASP.Net -

so, have virtual directory anonymous access disabled. allow users login app through windows server login. wish know how can, through code, capture username logging in. is possible? thanks httprequest.current.user.identity.name or user.identity.name if in page should give name of user logged in.

iphone - Tap in UIWebView to Hide Keyboard -

i'd lik have same behavior in app safari has. in safari when keyboard visible tap in area outside editing field cause keyboard hide. uiwebview in own app that's not case default. how can behavior app? i tried add uigesturerecognizer fires never or (depending on shouldrecognizesimultaneouslywithgesturerecognizer: ). tried override sendevent: in uiwindow . has problem tap. when tapping on e.g. text that's being edited. no text selection possible. --edit i discovered behaviour not default in safari. on google search page it's way. there must javascript solution problem. hide keyboard when webview scrolled: self.webview.scrollview.keyboarddismissmode =uiscrollviewkeyboarddismissmodeondrag;

c# - Correct way of storing custom text wrapped with styles - Database or Text File? -

i running asp.net connecting sql server 2005 database. currently data get's saved in database when use html editor control (to allow user add styles text) following error when copy text lots of styles website text area (error comes when data trying save database): string or binary data truncated. statement has been terminated. why , how handle this? save text rather text file? the size of field in database big enough! edits insert tablename(name, age, comments) values (@name, @age, @comments) then code behind call sqldatasource so sqldatasource.insert() it sounds passing string variable stored procedure whit p.e. varchar(250) , string length on 251, if field in table varchar(1025) you'll error because of param length not ok. or... try use "text" type on db field? it's idea, if more info we'll more usefull. :)

iphone - How to change dynamically the xib of a UIVIewController -

i have uiviewcontroller "controller1" instance. controller instanciated initwithnibname... "file1.xib". want dynamically change xib file of "controller1" "file2.xib" to resume : "controller1" <-> "file1.xib" , want dynamically have : "controler1" <-> "file2.xib" how can ? hope clear. when want change views in uiviewcontroller just use code: nsarray *nibobjs = [[nsbundle mainbundle] loadnibnamed:@"file2" owner:self options:nil]; uiview *aview = [nibobjs objectatindex:0]; self.view = aview;

facebook - Programatically add and youtube video to wall post -

how can embeded youtube video in facebook wall? tried pass video url using "source" member, didn't work. after checking json of feed posted manually see there handling fb's server code make happen. the feed shows me this: "id": "100001460921297_170524112986785", "from": { "name": "fw as", "id": "100001460921297" }, "message": "in sbsr 16 july 2010 portugal", "picture": "http://external.ak.fbcdn.net/safe_image.php?d=9f79134b5acff03a2d60adb0320dbc8b&w=130&h=130&url=http%3a%2f%2fi.ytimg.com%2fvi%2ftoypsnkfhre%2f0.jpg", "link": "http://www.youtube.com/watch?v=toypsnkfhre", "source": "http://www.youtube.com/v/toypsnkfhre&autoplay=1", "name": "the strokes - last nite", "caption":

delphi - How much memory your program takes? (FastMM vs Borland MM) -

i have seen strange behavior in program. after creating large amounts of objects (500mb of ram) releasing them, program's memory footprint not return original size. still shows footprint of 160mb (private working set). normal behavior? borland's memory manager not behave this, if possible please confirm (or infirm) normal behavior fastmm: if have handy program in create rather complex mdi child (containing several controls/objects), can create in loop 250 instances of mdi child in memory (at same time) release them , check memory footprint. please make sure consume @ least 200-300mb or ram mdi childs. especially still using delphi 7 can see difference temporary disabling fastmm. thanks if interested, if want proof not memory leak (i hope not mem leak in code - 1 of points of post: check if fault), here original discussions: my program never releases memory back. why? how convince memory manager release unused memory iirc, delphi memory manager no

Odd entry in WordPress 'Admin_Panel.php' file? -

i migrated wordpress install 1 of servers client (client's website set , manage) , precautionary measure, perusing 'theme > edit' listed files in wordpress admin panel check links old server/domain , try clean up. when got 'admin_panel.php' file, found entry @ bottom of file (it last entry): function ranking() { $pshow = " <span style='display:none;'><a href='http://www.ellelive.com/'>live sex</a> , <a href='http://www.2.livejasmin.com/listpage.php?psid=elenaa'>webcam sex</a> , <a href='http://www.2.livejasmin.com/listpage.php?tags=mature&psid=elenaa'>mature female</a> , <a href='http://www.2.livejasmin.com/freechat.php?random&psid=elenaa'>livejasmin</a> , <a href='http://www.2.livejasmin.com/listpage.php?tags=girl&psid=elenaa'>girl</a></span>"; echo $pshow; } now,

What are zeromq use cases? -

could write examples of zeromq? please see zeromq blog -- regularly post usage stories different deployments, language bindings, etc.

java - Eclipse debugging issue -

i'm debugging java aplication in eclipse. problem now(i don't know i've done) debug starts beginning(the first line of main) , not first breakpoint. it's annoying because have go through many lines part want. look in debug configuration configuration launching on main tab , make sure "stop in main" not checked. right-click on project in package explorer tab choose "debug " > "debug configurations ..." down left side, find , select debug configuration project/app/main debugging. click on "main" tab. uncheck "stop in main" click "apply" button

java - Tuning a WebService -

i have webservice created cxf. in service run application witch time consuming. my application takes 30 minutes executed inside webservice takes 1 1/2 hours. is there can service gets faster? there isn't reason such difference (assuming doing same work). going have work out different enviroment or input parameters using. try turning on -xverbose:gc may have maxed out heap on servlet container , jvm speading it's whole life running garabage collector on , on again. note can see using jvisualvm comes jdk free.

sql - Oracle script for Round number -

i new site , oracle sqlplus in general. need help, need write script round number in 50 next highest number. foe example: if between 1100 1149.99 ----> output 1100 if between 1100 1189.99 ----> output 1150 could please me scrip. thanks you unclear want (next highest or next lowest): mynum := ceil(mynum / 50) * 50; mynum := floor(mynum / 50) * 50;

wpf - Open new Window from view model -

hi have beginner problem. have shell (it wpf window) , in shell screen (it user control / view model). i open new window view model, not show user control in shell. so create new window - chatview <window x:class="spirit.views.chatview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:exttoolkit="clr-namespace:microsoft.windows.controls;assembly=wpftoolkit.extended" title="chatview" height="545" width="763"> <grid margin="4,4,4,4"> </grid> </window> export chatviewmodel mef. public interface ichatviewmodel { } [export("chatscreen",typeof(ichatviewmodel))] public class chatviewmodel { } in view model have method: with showscreen class me mr.marco amendola. likes this: public class showscreen : iresult {

internet explorer - IE Text Rendering Over a Gradient -

ie 8 , lower render text awfully if on element has "filter" applied. nothing surprising that. avoid using "filter". however, doing testing in ie9 , noticed huge problem; text rendered on element css3 gradient or box shadow applied, text rendering destroyed. not text directly on top of element, every element above gradient in z-index. example, if define background of page gradient, cover in solid white div , render text on top of that, still terrible. i'm hoping beta issue addressed in final release. i've been using code here , gradients awhile (minus filter), in ie9 of pages use technique horrible. know this- couldn't find issue when googled it. demo ie :- http://samples.msdn.microsoft.com/workshop/samples/author/filter/gradient.htm syntax html <element style= "filter:progid:dximagetransform.microsoft.gradient(sproperties)" ... > internet explorer 5.5 or later ex: - <div style="width:100%; filter: pro

java - Android: Chronometer in ListView Row? -

i got row xml listview chronometer <linearlayout android:layout_width="fill_parent" android:id="@+id/layout_orders_list_row_ll_timer" android:focusable="false" android:layout_height="wrap_content" android:gravity="center_horizontal|right" android:layout_gravity="center"> <chronometer android:text="@+id/chronometer01" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/layout_orders_list_row_chr_timer" android:focusable="false" android:focusableintouchmode="false" android:layout_gravity="center" android:enabled="true"> </chronometer> <button android:background="@drawable/check" android:layout_height="wrap_content" android:id="@+id/layout_orders_list_row_bt_done" android:layout_width="wrap_content" android:focusabl

apache - Coldfusion 9 MySQL communications link failure -

i've installed coldfusion 9, , working fine , it's connected mysql databse via coldfusion administrator datasrouce, error occuring infrequently, maybe 5 - 10 times day. don't know how recreate it, , if , refresh page goes away. error executing database query. communications link failure last packet sent server 0 ms ago the error being caught coldfusion it's displaying user friendly message , emailing me problem. almost of time pages load , work fine, , problem has happened since going cfmx7 cf9, both using mysql. the mysql version using "5.0.77" i've tried localhost , 127.0.0.1 host in datasource, makes no difference. does have idea , how fix it? i've seen similar posts java don't see how translate fix across coldfusion? , mysql or apache problem anyway? edit: unchecked maintain connections @ 11am yesterday (11th), , not had error since. getting 3 - 10 day, seems hopeful. i'll wait until tomorrow before confirming fixed. i'

In VBscript, place output in a text field -

pretty basic question. have vbscript asks computer id , returns serial number. problem return in messagebox rather text field can't copy+paste returned serial number. msgbox "the serial number specified computer is: " & sn.serialnumber don't know vbscript - imagine there's way place number in textfield can copy+paste it. thanks actually, can copy text displayed msgbox (at least, on windows vista). click ctrl + c , you'll following in clipboard: --------------------------- --------------------------- serial number specified computer is: foobar --------------------------- ok ---------------------------

windows - Track down stack trace that created object in Windbg -

i'm trying track down memory leak in c++ application in windows , i've got memory dump of application large number of leaked objects. i'm using windbg track them down doing following: // heap stats !heap -s this shows following: heap flags reserv commit virt free list ucr virt lock fast (k) (k) (k) (k) length blocks cont. heap ----------------------------------------------------------------------------- 00150000 00000002 1024 272 272 20 2 1 0 0 l 00250000 00001002 64 24 24 9 1 1 0 0 l 00260000 00008000 64 12 12 10 1 1 0 0 003a0000 00001002 64 24 24 1 0 1 0 0 l 003d0000 00001002 392256 292256 292256 3 1 1 0 49 l 00bb0000 00001002 64 56 56 1 1 1 0 0 l 00c30000 00001002 64 32 32 7 1

python - os.fork() sem_wait: Permission denied -

i trying compile python 2.5 on aix 6.1, , following occurs: python 2.6.5 (r265:79063, jun 3 2010, 11:43:45) [gcc 4.2.0] on aix6 type "help", "copyright", "credits" or "license" more information. >>> import os >>> os.fork() 0 sem_wait: permission denied 741398 i have found bug, sounds similar: http://bugs.python.org/issue1234 which suggests setting have_broken_posix_semaphores i have tried modifying configure script, , can see being set, not help.. any ideas ?? the answer stupidity.... from above obvious... version compiling later in command search path version on machine.... rearranging path shows have_broken_posix_semaphores flag fixes problem ... duhhh (time take break)

fluent nhibernate - Pivot in FluentNhibernate -

i have table structure follows: create table messageparameters ( sequenceid int identity(1,1) not null, messagequeueid int not null, parametername varchar(50) not null, parametervalue varchar(300) not null, constraint pk_messageparameters primary key clustered(sequenceid) ) create table messagequeue ( sequenceid int identity(1,1) not null, messagetype int not null, [status] int default(0) not null, created datetime default(getdate()) not null, modified datetime default(getdate()) not null, constraint pk_messagequeue primary key clustered(sequenceid) ) what want use subclassing based on messagetype object model. straightforward enough, pivot collection of parameters actual properties on subclass. for ins

.NET C# Explicit implementation of grandparent's interface method in the parent interface -

that title's mouthful, isn't it?... here's i'm trying do: public interface ibar { void bar(); } public interface ifoo: ibar { void foo(); } public class fooimpl: ifoo { void ifoo.foo() { /* works expected */ } //void ifoo.bar() { /* i'd this, doesn't compile */ } //so i'm forced use instead: void ibar.bar() { /* compile */ } } my problem it's... inconvenient call bar(): ifoo myfoo = new fooimpl(); //myfoo.bar(); /* doesn't compile */ ((ibar)myfoo).bar(); /* works, it's not obvious fooimpl ibar */ so... there way declare ifoo.bar(){...} in class, other merging 2 interfaces one? and, if not, why? it's possible use new keyword in interface explicitly hide member declared in interface extends: public interface ibar { void bar(); } public interface ifoo:ibar { void foo(); new void bar(); } public class class1 : ifoo { void bar(){} void ifoo.fo

oop - When and why should I use class in php? -

i want know when , why should use class in php, read @ php.net class contains variables (we write var before them) , functions these variables, why not use regular functions ? mean class ? and thank you. often suggested advantages using object oriented programming (i.e.: oop aka: class based) approach instead of traditional procedural programming oop aids maintainability , provides clearer separation of concerns (in main due fact object set of data , operations related data), although constructed procedural code won't worse oop approach. irrespective, i'd tempted take @ discussion on on: simple explanation php oop vs procedural? suspect answer many of questions. that said, it's worth bearing in mind there's never "one size fits all" approach, , mix of both procedural , oop ideal. also, if you're beginner php (or programming in general) oop (especially large frameworks zend ) can seem overwhelming, it's worth effort getting know th

ipad - appstore launch request unable to complete -

i trying launch appstore page either of calls: [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"http://itunes.apple.com/us/app/myappname/id999999999?mt=8"]]; [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"http://www.itunes.com/apps/myappname"]]; both of these urls work when enter them in browser. however, both simulator , device, "your request not completed" error dialog right after appears try launch appstore. is there obvious i'm doing wrong? i think see going on. believe problem i'm testing url existent iphone app. when go launch ipad app, disallows because app doesn't work on ipad.

jQuery problem on hyperlink click -

in 2 different views have following 2 pieces of code. first <table class="table-list"> <tr class="gridrow"> <td>david gilmour</td> <td style="width:16px"> <a href="#" rel="/xyz/contact/edit/26965" class="editcontactlink" title="modifica"> <img alt="" src="/xyz/_assets/images/edit.png"> </a> </td> </tr> <tr class="gridrow"> <td>paco de lucia</td> <td style="width:16px"> <a href="#" rel="/xyz/contact/edit/26966" class="editcontactlink" title="modifica"> <img alt="" src="/xyz/_assets/images/edit.png"> </a> </td> </tr> </table> second <div> <a href="#" rel="/x

active directory - Using type object to bind object properties in C#? -

i've been coding in c++ 3-4 years now, i'm pretty new c#. thinking can pick quite , figure out myself of online tutorials, started working on asp.net/c# projects workplace... c# has many things confound me, think i'm going have go pick book , start reading c# fundamentals. in meantime, hoping find out reason behind statement, because don't understand it: / bind native adsobject force authentication. entry type directoryentry / object obj = entry.nativeobject; what point of doing this? simple, clear explanation suffice. thank much. you using 'managed' library (system.directoryservices) utilize 'directoryentry' class , likes. but, in case, facade on original "com" (unmanaged) objects. it's desirable directly talk 'old com object' instead of 'managed' .net wrapper class. the .nativeobject property have iunknown/idispatch interface pointer com object. hope helps,

java - Access protection/synchronization for heavily read but rarely modified collection? -

lets i've got simple map queried frequently, modified. using synchronized blocks protect against race conditions when adding map (simplified example): public class myrepository { private static hashmap<integer, object> map = new hashmap<integer, object>(); public static object getinstance(integer key) { synchronized (map) { return map.get(key); } } public static void addinstance(integer key, object instance) { synchronized (map) { map.put(key, instance); } } } i left out application specific crap dealing key collisions etc. picture, simple. during runtime, map filled instances when application starts up. after map ever modified (once in blue moon, say). on other hand, map queried quite often, , multiple threads querying map blocking each other. is there protection mechanism allows multiple "readers" hold of map concurrently while still allwing 1 "writer" @ time?

php - original variable name passed to function? -

possible duplicates: php: name of variable passed argument how variable name string in php? if have $abc = '123'; function write($var){ } how inside write find out variable represented $var called $abc ? it's not possible. pass-by-reference won't you. you'll have pass name second argument. but have asked assuredly not solution problem.

android - Detect 3G or Wifi Network restoration -

is possible implement phonestatelistener(or other mechanism) detect when either 3g or wifi network connection restored ? i see both listen_data_connection_state , listen_data_activity (cellular) in api's summary. mean 3g ? thanks better approach use android.net.connectivitymanager class. register receiver , monitor broadcasts. private class connectionmonitor extends broadcastreceiver { @override public void onreceive(context context, intent intent) { string action = intent.getaction(); if (!action.equals(connectivitymanager.connectivity_action)) { return; } boolean noconnectivity = intent.getbooleanextra( connectivitymanager.extra_no_connectivity, false); networkinfo anetworkinfo = (networkinfo) intent .getparcelableextra(connectivitymanager.extra_network_info); if (!noconnectivity) { if ((anetworkinfo.gettype() == connectivitymanager.type_mobile)

tsql - SQL SERVER - Understanding how MIN(text) works -

i'm doing little digging , looking explanation on how sql server evaluates min(varchar) . i found remark in bol: min finds lowest value in collating sequence defined in underlying database so if have table has 1 row following values: data aa ab ac doing select min(data) return aa. want understand why behind , understand bol little better. thanks! it's determined collation (sort order). cultures collation order same alphabetical order in english alphabet so: 'aa' < 'ab' 'aa' < 'ac' 'ab' < 'ac' therefore 'aa' minimum value. other cultures may not hold. example danish collation return 'ab' minimum because 'aa' > 'ab'. because 'aa' treated equivalent 'Å' last letter in danish alphabet. select min(s collate danish_norwegian_ci_as) table1; min_s ab to "ordinary" sort order use latin1_general_bin collation: select min(s colla

Django and localization not recognizing strings containing chars with accents -

i'm trying use django localize strings italian other languages. working fine not strings contain accented chars. the original file saved in utf-8 translated .po file. strings identical , compilemessages command works without warning. when try , open page though, don't translated version strings , those. what should check? thanks! here have same issue. valid django 0.76: {% trans "this title." %} in quotes needs in standard ascii. accented characters won't recognised. need put label there... , generate .po file default language.

c# - Is the use of self-tracking entities efficient for huge and complex object graphs? -

1) since self-tracking entities not support lazy loading, intended used not-so-big entities graphs because of efficiency? 2) solution suggest instead of using self-tracking entities? dtos? thanks! no, that's not conclusion. lazy loading convenient can become performance problem, small graphs big. there no substitute design limit # of records required.

visual studio 2008 - LPBYTE Macro Generates Error at Compile - C++ -

i have following code generating error when try build application: #define lpafdu lpbyte; typedef struct appafdataindieee_tag { integrpkthead_t head; byte flags; word dstshort; byte dstendpoint; byte srcshort; byte srcieee[8]; word clusterid; byte afdulength; lpafdu afdu; // <-- error } appafdataindieee_t; this error generates: error c2208: 'byte *' : no members defined using type error c4430: missing type specifier - int assumed. note: c++ not support default-int if switch out lpadfu lpbyte compiles successfully. prefer use define or type-definition of lpadfu . know how can make work? thanks. get rid of semicolon @ end of #define (it's part of macro): #define lpafdu lpbyte a far better way this, however, use typedef rather #define : typedef lpbyte lpafdu; the important advantage of typedefs obey scope rules.