Posts

Showing posts from September, 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.

php - Add strings with ajax from server using phpMyAdmin, jquery -

right now, i'm trying add couple of <li> , using ajax. problem i'd these <li> use data database have on server. i'd know how that! also, possible use jquery? let's have <div id="listholder"> , have <ul> , <li> . <li> ones want change via ajax. use phpmyadmin, have database called t_menumaterials , , want retrieve strings inside m_nom . i'd want able change menu, on click of button, change t_menumaterials t_menutextures . have been able populate menu, @ load of page that! $requetemenumaterials = "select * t_menumaterials order m_id limit 10"; $ressourcesliste = mysql_query($requetemenumaterials); $targetmenu = "select r_categorie t_ressources order m_id limit 10"; $ressourcesliste2 = mysql_query($targetmenu); $menu2 =''; while($tbl_ressources1 = mysql_fetch_assoc($ressourcesliste)){ $menu2 .='<li class="secondarymenu"><a href="#" onclick="t

groupNoAdjacency Recursion Problem in Core Java Programming -

i have below question time have done r&d , arrived @ solution there glitch in solution (one scenario)as well. q: groupnoadjacent recursion problem :: given array of ints, possible choose group of of ints, such group sums given target additional constraint: if value in array chosen in group, value following in array must not chosen. (no loops needed.) groupnoadj(0, {2, 5, 10, 4}, 12) => true --> true coz of 2+10 =12,noadjacency groupnoadj(0, {2, 5, 10, 4}, 14) => false -> 10+4=14,numbers adjacent,its false groupnoadj(0, {2, 5, 10, 4}, 7) => false --> 2+5=7,numbers adjacent,its false my solution below.it works below given scenarios except 1 scenario. code: public boolean groupnoadj(int start, int[] numbers, int target) { start=0; boolean[] reached = new boolean[target+1]; reached[0] = true; (int i=0;i<numbers.length;i++){ (int j = + 2; j<numbers.length;

validation - JavaScript - how to validate field to allow certain character and certain length -

i need validate textbox, it's value consist of 10 characters (not more, not less). below code it, allowing me set restricted length each field separately. function charlength(elem, min, max){ var uinput = elem.value; if(uinput.length >= min && uinput.length <= max){ alert("invalid number of characters"); elem.focus(); return false; }else{ return true; } } and how i'm calling it: onblur="charlength(document.getelementbyid('tf1'),1,9)" but field validate must not 10 characters long, has start letter z. how such validation? possible in first place? try also: function charz10(elem, min, max){ var uinput = elem.value; if(uinput.length >= min && uinput.length <= max && uinput.substr(0, 1) == "z"){ alert("material number has consist of 10 characters begining z"); elem.focus(); return false; } else return tr

How to remove/replace following inline css style from html code in Java -

i have html page in following master reset css included. i'll getting html code string in java, have remove/replace/comment following css code using java. have exclude other inline css styles while removing/replacing below css. tried using stringutils class, not working. how can in java? <style type="text/css"> @charset "utf-8"; /* css document */ /* ver 1.0 author*/ /* master reset */ a,abbr,acronym,address,applet,b,big,blockquote,body,button,caption,center,cite,code,dd,del,dfn, dir,div,dl,dt,em,embed,fieldset,font,form,frame,h1,h2,h3,h4,h5,h6,hr,html,i,iframe,img,input, ins,kbd,label,legend,li,menu,object,ol,option,p,pre,q,s,samp,select,small,span,strike,strong, sub,sup,table,tbody,td,textarea,tfoot,th,thead,tr,tt,u,ul,var {background:transparent;border:0;font-family:inherit;font-size:100%;font-style:inherit; font-weight:inherit;margin:0;outline:0;padding:0;vertical-align:baseline;} html {font-size:1em;

Are there any standards for Claims-Based security over HTTP? -

i've been looking federated security , claims-based authentication/authorization , i'm seeing. i'm big fan of restful services , prefer avoid using soap , ws-* specifications unless it's necessary. are there standards handling claims-based authentication on basic http? openid . attribute exchange specification allows transmission of arbitrary attributes of subject. uses http, , works browser. in similar fashion, oauth allows users delegate access rights selected services. oauth2 extends set of use cases further.

javascript - How can I update the content of a tab in an ExtJS TabPanel? -

i have tab panel this: var tab1 = { id: 'section1', title: 'first section', padding: 10, html: '(this content replaced ajax load)' } var tab2 = { id: 'section2', title: 'second section', padding: 10, html: '(this content replaced ajax load)' } var tab3 = { id: 'section3', title: 'third section', padding: 10, html: '(this content replaced ajax load)' } var modules_info_panel = new ext.tabpanel({ region: 'center', activetab: 0, border: false, defaults:{autoscroll:true}, items:[tab1, tab2, tab3] }); then after creating tabpanel, dynamically change content of tabs, none of these work: tab1.html = 'new html'; // no effect tab1.title = 'new title'; // no effect tab1.update('new text'); // error: tab1.update not function viewport.dolayout(); // no effect since want load contents of each of tabs via ajax , don

Node.js vs Java for Comet application -

we build high-performance, scalable comet server, , thought first using java grizzly glassfish. but after research, see node.js taking rapidly preferred choice due extreme simplicity, , claimed performance: http://news.ycombinator.com/item?id=1088699 http://amix.dk/blog/post/19484 i happy hear real-life experience of using both, , can best choice down road. thanks! if further read blog posts same author, namely post, is node.js best comet , explains why again went java based solution (netty) , happy it. guess interesting read.

how to echo the database contents in codeigniter while editing -

how form field contents while editing (updating) entries in database ? my controler //edit sidebar contents function edit_lsidebar(){ if(isset($_post['heading'])){ //adding text fields $heading = $this->input->post('heading'); $content_text = $this->input->post('content_text'); $url = $this->input->post('url'); $link_text = $this->input->post('link_text'); $this->lside_bar_model->edit_lsidebar($heading, $content_text, $url, $link_text); redirect('welcome'); } else $this->load->view('edit_lside_bar', $data); } my model is function edit_lsidebar($heading, $content_text, $url, $link_text){ $data = array( 'heading'=>$heading, 'content_text'=>$content_text, 'url'=> $url, 'link_text' => $link_text ); $this->db->where('id'

java - Does RMI support P2P -

i want create p2p application there no central server , clients communicate directly each other. rmi support p2p or not ... please comment , tell me how project in rmi if possible.. in advance "p2p" architectural term. rmi protocol. 2 entirely independent of 1 another. so yes, can use rmi p2p applications. can use protocol p2p communications. rmi neither knows nor cares whether it's p2p or client-server, sees 2 ends of network connection. if have more specific question, might want ask that.

Does C have a standard ABI? -

from discussion somewhere else : c++ has no standard abi but neither c, right? on given platform pretty does. wouldn't useful lingua franca inter-language communication if lacked one. what's take on this? c defines no abi. in fact, bends on backwards avoid defining abi. people, me, have spent of programming lives programming in c on 16/32/64 bit architectures 8 bit bytes, 2's complement arithmetic , flat address spaces, quite surprised on reading convoluted language of current c standard. for example, read stuff pointers. standard doesn't simple "a pointer address" making assumption abi. in particular, allows pointers being in different address spaces , having varying width. an abi mapping execution model of language particular machine/operating system/compiler combination. makes no sense define 1 in language specification because runs risk of excluding c implementations on architectures.

iphone - How to Custom Tab bar item text -

i using 5 tab bar items in tab bar,i want custom text displayed on that.is possible.please me in this.thanks in advance thanks ask you can use ib this.click ones on tab bar item , go property command+1 , again click ones on same tab bar item , property window in can change text of tab bar item...

jquery - dynamic variables attached to specific divs -

i have several divs 1 class on page. <div class="main"/> <div class="main"/> <div class="main"/> ... i need attach variable each div boolean true or false, depending on click on div. these variables should have default false value, , if click on div value of variable attached div should become true. don't know how divs there appear dynamically on page, variables should attached according number of these divs on page, , must have global scope modify them in future. appreciate ideas. thanks! you can use data() method purpose: $(document).ready(function() { $("div").data("yourkey", false).click(function() { $(this).data("yourkey", true); }); });

JSF - Pagination implementation using Tomahawk -

i trying implement pagination in jsf using tomahawk. when page loaded, table in first page populated data. but, when click on next or prev table empty. don't see javascript error in browser. following code jsp. please let me know if missing something: <t:datatable id="tableid" value="#{sitesearchcriteria.sitelist}" var="item" border="1" rows="5" rowindexvar="rowindex" rowclasses="trobg1,trobg2"> <h:column> <f:facet name="header"> <h:outputtext value="sitename"></h:outputtext> </f:facet> <h:outputlabel value="#{item.sitename}"></h:outputlabel> </h:column> <h:column> <f:facet name="header"> <h:outputtext value="siteclli"></h:outputtext> </f:facet>

html - syntax error while specifying DOCTYPE -

Image
i getting syntax error while using doctype ... have base page , loading 2 iframes in , , doctype specifyed in 1 of these iframes .. have php codes before starting html code ... the firebug error shown below thanks in advance last time saw this, caused attempt load javascript url pointing html document. check script srcs.

email - Sending Hebrew subject in php mail goes Klingon...? -

i'm trying send email hebrew content/subject so: $to = 'email@email.com'; $subject = "איזה יום יפה היום"; $message = 'ממש יום יפה'; $headers = 'from: email@email.com' . "\r\n"; $headers .= 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $subject, $message, $headers); but in subject more klingon modern hebrew. message comes out fine, it's subject that's messed up. what can do? (i'm open hacks got) the content-type describe message content not header. need apply encoded-word encoding on subject value. see my answer on php email header subject encoding problem further information.

books to recommend to study WPF -

possible duplicate: what wpf books recommend? is there book recommend learning wpf? i recommend wpf in action visual studio 2008 introduction (it covers .net 3.5 sp1), me best wpf book out there matthew macdonald's 'pro wpf in c# 2010: windows presentation foundation in .net 4' ( http://apress.com/book/view/9781430272052 ), more advanced.

javascript - IE6/7 Google Maps tile transparency - I can't see the map -

i building site utilises google maps v3 api. works expected on firefox/chrome/safari/opera/ie8 - in ie6 , 7 map tiles transparent. overlay appears map tiles appear hidden. 'appear be' because, if drag map tiles there disappear - must javascript hiding it? here's image of problem: http://dl.dropbox.com/u/10007971/mm/mm_google_map_error.jpg i using opacity in css may root of problem. if code needed happy post it. thanks, ollie i've had similar problem. setting opacity of 1 of map's parent elements using jquery. in ie6 & 7 uses filter: alpha(opacity=x) property. removing seemed resolve issue invisible map tiles. hope helps.

javascript - sharepoint breadcrum trail editing on the fly -

i have been searching hours , have found code claims able want however...it doesn't. i trying remove pages , .aspx off end of page name in breadcrumb trail in sharepoint. like.... mysite > myarea > pages >mypage.aspx i have tried changing sitemapprovider , takes away pages link current page. looked like.. mysite > myarea. i have mysite > myarea >mypage have tried using snippet of code...i not claim own or have developed code. var breadcrumbs = document.getelementbyid('ctl00_placeholdertitlebreadcrumb_contentmap') if (breadcrumbs != null) { if (breadcrumbs.childnodes.length >= 3) { if (breadcrumbs.childnodes[2].innerhtml.indexof('pages') > 0) { breadcrumbs.childnodes[1].innerhtml = ""; breadcrumbs.childnodes[2].innerhtml = ""; } } } i put document.writes in see code getting , breadcrums variable seems null therefore code never gets juicy part :p any ideas hint

javascript : how can i get array in different ways? -

hi have little problem javascript can make simple way execute content of array different character of word? example : var word = new array(); word [0] = "is"; word [1] = "am"; . . . . word [100] = "when"; var word should access 3 ways,in order reduce process execute arrays.. first : " "+ word +" "; second : " "+ word; third : word +" "; -thank helping- i'm not sure chasing (fill me in , i'll update), i'd point out far better way of filling in array literal... var word = [ 'is', 'am' ]; you can see index calculated automatically, , not required repeat var name each member definition. update maybe want can call , next array member each time. should it... function getnextmember(array, startindex) { startindex = startindex || 0; return function() { startindex++; return array[startindex]; }; }; var getnextword = getnextmember(word);

javascript - downloading file from silverlight application -

i'm trying open downloaded files in new window silverlight application. have legacy application written html/js works fine filetype. however, in sl application, file type not .txt or .html, window briefly pops , closes. follow along in fiddler , requests identical both apps. further explain i'm doing, use system.windows.browser.htmlpage.window.invoke invoke js function calls window.open. have idea might going on here? here headers... request: get https://foofoo.com/portal/filedownload?supportinguploadedfileid=8147&ideaid=110391 http/1.1 accept: */* accept-language: en-us user-agent: mozilla/4.0 (compatible; msie 8.0; windows nt 6.1; trident/4.0; slcc2; .net clr 2.0.50727; .net clr 3.5.30729; .net clr 3.0.30729; media center pc 6.0; infopath.2; .net4.0c; .net4.0e) accept-encoding: gzip, deflate host: foofoo.com connection: keep-alive cookie: __utma=42251826.1339254382.1292255942.1292255942.1292255942.1; __utmz=42251826.1292255942.1.1.utmcsr=(direct)|utmccn=(direct)

sql - Problem in creating two identity columns in a single table -

i having problem in creating 2 identity columns in single table. part of job... need 2 identity columns in single table @ cost. there way this. please provide syntax creating 2 identity columns in single table @ time or later also. thanks in advance, shashra in sql server, can have computed column holds same value identity (or other) column: create table [dbo].[test]( [id] [int] identity(1,1) not null, [idcopy] ([id]), [whatever] [nvarchar](max) not null )

c# - Where best to throw exception in this example? -

in library writing, have methods executed , on fly. modelling vehicle, 1 of (exceptional) methods cracked engine, rare. should throw exception in method? stop vehicle being usable. i read .net design framework guidelines book , states exception should occur when method cannot complete execution. actual engine cracked method complete, if 1 of methods, such start engine (this method store amount of engine starts means of accruing stress engine), called , results in call cracked engine, (if anywhere) should throw exception? think exception should thrown highlight code or runtime issues. normal system logic (in sense cracked engine model state, not code problem), shouldn't throw. instead, there should feedback mechanism makes sense in context of system you're modelling.

windows - Drag and drop on Win7 machine to my app -

i have user running winforms app on win7. app allows users select rows open excel spreadsheet , drag-n-drop them onto app. however, user cannot drag-n-drop. cursor changes "no" cursor (little circle line through it) , operation won't complete. i researching drag-n-drop , win7 , found points uac and/or uipi. looking solutions , not sure if of below work: if user logs in admin (and result runs app admin) allow drag-n-drop work? does user need turn off or change settings of uac/uipi in order able drag-n-drop? i not sure issue is. app runs c:/documents , settings/... (c:/users/... on win7). running matter? drag-n-drop not work because user not running app enough permissions? excel , app on different permission levels? if so, can done that? note though app allows users drag file directly, doesn't work either. also, there way can have user reproduce issue other apps? there apps come win7 can see same problem with. example, can reproduced using note

Why does a C++ friend class need a forward declaration only in other namespaces? -

suppose have class f should friend classes g (in global namespace) , c (in namespace a ). to friend a::c , f must forward declared. to friend g , no forward declaration of f necessary. likewise, class a::bf can friend a::c without forward declaration the following code illustrates , compiles gcc 4.5, vc++ 10 , @ least 1 other compiler. class g { friend class f; int g; }; // without forward declaration, f can't friend a::c class f; namespace { class c { friend class ::f; friend class bf; int c; }; class bf { public: bf() { c.c = 2; } private: c c; }; } // namespace class f { public: f() { g.g = 3; c.c = 2; } private: g g; a::c c; }; int main() { f f; } to me seems inconsistent. there reason or design decision of standard? c++ standard iso/iec 14882:2003(e) 7.3.1.2 namespace member definitions paragraph 3 every name first declared in namespace a member of namespace . if friend declarati

iphone - UIView's are not positioning correctly -

i have nib 2 uiviews , 2 uilabels iboutlet's in controller. i increasing , decreasing height of these uiviews bar indicate when 100% or less - bar chart almost. i using following method both bars (reuse) first uiview (bar) positions correctly second low down - y axis wrong. height of both correct. anyone have ideas? have positioned them in interface builder doing in method changing height (basically) //position point, size , label of rating bar - (void)configureratingbar:(uiview *)vratingbar andratinglabel:(uilabel *)lratinglabel usingrating:(nsdecimalnumber *)rating { //nsdecimalnumber *foodrating = [self calculaterating:self.currenthotel.foodandbeveragerating]; nsstring *formattedrating = [self formatrating:rating]; lratinglabel.text = formattedrating; float newheight = [rating floatvalue]; //the height based on rating 100 max cgrect currentframe = vratingbar.frame; //current frame of rating view //cgpoint current

c++ - CRT 9.0 vsprintf_s Parameter Validation on a long format string -

from here : the versions of these functions _s , _p suffixes more secure versions. these versions validate format strings , generate exception if format string not formed (for example, if invalid formatting characters used). i discovered format string considered not formed if larger output buffer size. know of documentation confirms *_s print functions? thanks looks default behavior throw crt error if output buffer size exceeded, regardless of source. expected output silently truncated if output buffer size exceeded. thus, there no point in attempting fill in format string if long already.

xna 4.0 - Design patterns for lighting in XNA 4.0 for Xbox 360? -

i wondering if has patterns handling lighting in xna xbox 360. trying implement spotlight component. have read deferred shading means of reducing complexity. have heard not idea xbox 360 , more difficult in xna 4.0 in xna 3.0. goal make reusable component encapsulates spotlight effect can used through game. thanks, -john deferred rendering allows apply lighting after world has been rendered. it reduce complexity in sense not forced choose lights affect model before drawing (usually closest/most significant ones). it can make translucency handling , anti-aliasing more complex. it allows many lights applied, , move around scene, impractical forward lighting. it requires several buffers present - geometry buffer minimum, normal , specular buffers helpful also. techniques exist pack such buffers, require more memory, , use bandwidth write to. means deferred rendering has greater front cost forward rendering does, provides more flexibility in relation amount of li

profiler - Increasing the depth of cProfiler in Python to report more functions? -

i'm trying profile function calls other functions. call profiler follows: from mymodule import foo def start(): # ... foo() import cprofile profile profile.run('start()', output_file) p = pstats.stats(output_file) print "name: " print p.sort_stats('name') print "all stats: " p.print_stats() print "cumulative (top 10): " p.sort_stats('cumulative').print_stats(10) i find profiler says time spend in function "foo()" of mymodule, instead of brekaing down subfunctions foo() calls, want see. how can make profiler report performance of these functions? thanks. you need p.print_callees() hierarchical breakdown of method calls. output quite self explanatory: on left column can find function of interest e.g. foo() , going right side column shows called sub-functions , scoped total , cumulative times. breakdowns these sub-calls included etc.

asp.net - jQuery disable/re-enable validators on a page -

when need disable/re-enable validator use jquery code so: validatorenable($('[id*=duedaterequiredvalidator]')[0], false); and re-enable back: validatorenable($('[id*=duedaterequiredvalidator]')[0], true); var validator = $('[id*=duedaterequiredvalidator]')[0]; validator.isvalid = true; validatorupdatedisplay(validator); and works. need disable/re-enable large number of validators, subset of validators, not entire set on page. there's many of them refer each validator "id". i tried didn't work, don't know why: $.each(page_validators, function(index, validator) { if ( validator.cssclass == "noinjuries" ) { validatorenable(validator, false); } }); what's best way this, if any? yeah, try first if ($(validator).hasclass('noinjuries')) { /* disable validator */ }

svn - Easy way to integrate branches into trunk -

i'm running subversion version 1.4.3 (r23084) + tortoise, , problem integrating branch trunk. tortoise's merge didnt work, got console. its hard work because of many issues, i've been thinking changes. subversion update (its on 1.6 now) resolve problem? or better change , start on again git ? tnx! merge tracking added svn in 1.5, yes upgrading solve of merging issues. if complaint svn merging, should upgrade before doing drastic switching git. that said, git better svn lots of reasons, , highly recommend it.

javascript - First Addon help - Cycling through windows with for loop -

i making first firefox extension today. far have done little...but count number of firefox windows user has open (for example 3) can count tabs, easy far...but can't seem find how cycle through windows , count them (windows != tabs, tabs within windows, sorry, hope makes sense, mozilla confuses in coding) think basically, lost method name... so think like: var tomato = here mystery difficult!!!!; (var = 0; < tomato; i++) { window counter here (easy) } any idea how this? you're looking nsiwindowmediator - snippet mdc: var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); var enumerator = wm.getenumerator(type); while(enumerator.hasmoreelements()) { var win = enumerator.getnext(); // win [object chromewindow] (just window), }

asp.net - How to unit test for turning off request validation? -

i'm new @ tdd thing making serious effort, i'm hoping feedback here. i created little web service minify javascript, , nice, tests passing. noticed bug: if tried minify alert('<script>'); , throw httprequestvalidationexception . so that's easy enough fix. i'll add [allowhtml] controller. way unit test doesn't happen in future? the following first thought: [testmethod] public void minify_doesntchokeonhtml() { try { using (var controller = servicelocator.current.getinstance<minifycontroller>()) { return controller.minify("alert('<script></script>');"); } } catch (httprequestvalidationexception) { assert.fail("request validation prevented html existing inside javascript."); } } however, doesn't work since getting controller instance , running methods on it, instead of firing whole asp.net pipeline. what unit test this? may

MySQL to PostgreSQL: How to modify this SQL query? -

i have mysql query makes use of month() , year() : select month(created_at) month, year(created_at) year users group month(created_at), year(created_at) order year(created_at), month(created_at) how modify query work postgresql? select extract(month created_at) month, extract(year created_at) year users group extract(month created_at), extract(year created_at) order extract(month created_at), extract(year created_at) here up-to-date manual http://www.postgresql.org/docs/current/static/functions-datetime.html#functions-datetime-extract btw: standard (ansi) sql works on mysql well.

c# - Exposing properties of an object contained by a control -

i have simple object, struct even, 3 properties want expose designer. basically, want property size or padding properties of average control, arrow collapse or expand properties sub-list of control's properties. however, cannot find reference how can done. since there several types of properties collapse/extend , feel imagine there's built-in can use. if have implement own designer or editor, forget it; it's not worth it. doubt that's case; there's gotta simple attribute can stick on property or class tells designer expose browsable sub-properties. what you're looking called attributes. or more design-time attributes [category("hello world")] [description("indicates if button enabled or not")] [browsable(true)] public int blah { get; set; }

c# - Change scrollbar position in TextBox? -

if want change position of textbox 's scrollbar, need besides this: setscrollpos(intptr hwnd, int nbar, int npos, bool bredraw); this function changes scrollbar position, doesn't update actual textbox (so scrollbar "scrolls", text doesn't). suggestions? i'm using windows forms , .net 4, visual studio 2008. i do: textbox1.select(textbox1.text.length, 0); textbox1.scrolltocaret(); where selecting 0 characters moves cursor desired location (in example code: @ end of text).

validation - Validate email address in PHP -

possible duplicate: how validate emailaddress in php i wondering doing in regards validating email addresses , how extensive validation needs be. for example, of methods, 1 preferred , why? extensive check: http://www.linuxjournal.com/article/9585?page=0,3 php filter: http://php.net/manual/en/filter.filters.validate.php eregi: http://www.totallyphp.co.uk/code/validate_an_email_address_using_regular_expressions.htm preg match dns check: http://www.soaptray.com/blog/2008/04/validate-email-addresses-using-php/ my goal find , solid solution average project, when time comes validate email address, know i'm going use. any feedback appreciated! -ryan http://www.regular-expressions.info/email.html has rfc2822 recommended reg ex.

php - Include functions -

edit due overwhelming amount of advice have received, have fixed problem. (after realizing horrible php code had written.) :d thanks all! is there reason function inside included php file won't work on parent page? have 2 functions inside php file included @ top of page. however, when try call function, doesn't anything. here's basic layout: main page: <?php include 'includes/header.php'; ?> <?php getposts();?> <div>some html code</div> <?php endposts(); ?> header.php function getposts() { $result = mysql_query("select * posts order id desc") or die(mysql_error()); while($row = mysql_fetch_array($result)) { }; function endposts() { } /*end while statement */ }; any idea why won't work? i'm getting blank white screen right now. that code so not valid. why declaring function inside of function? , there aren't supposed semicolons on end of function declarations/loops. first thing

graph - R: gplots, barplots: how to fix bar width independent of paper setting? -

i use gplots package output barplots. use inside for-loop, rest of code omitted make more clear: library("gplots") pdf(file = "/users/tim/desktop/pgax.pdf", onefile = true, paper = "special") par(mfrow = c(4,2)) #figures arranged in 2 rows , 2 columns par(las=2) #perpendicular labels on x-axis barplot2(expression,ylab = expression(expression),main = graph.header, cex.names =0.85, beside = true, offset = 0, xpd = false,axis.lty = 0, cex.axis = 0.85, plot.ci = true,ci.l = expression - sd.value, ci.u = expression + sd.value, col = colors,width = 1,names.arg = c(etc)) now when specify papersize @ a4, , print out in 2 columns bars made fill full space assigned. if have few bars in each graws, width big compared height. know should using xlimit , width = amongst , perhaps aspect ratio?, can't results wanted. , unconvenient way specify height , width output of paper, , manually adjust number of bars in plots each time. doesnt seem appropiate. know c

c# - PayPal API with ASP.NET MVC -

is paypal api compatible asp.net mvc? know of expamples of how implement it? thank you. yes compatible. have @ mvc storefront starter kit videos. episode 22 dedicated paypal

java - Android - how to inflate a view with multiple EditText fields and read their values? -

for android application, want have view allows user click plus button add edittext fields, , next edittext fields, want have minus buttons remove them view. in essence, similar adding multiple phone numbers/email addresses in edit contact interface on android. i imagine need inflating main view separate 1 contains edittext , button want add each time. however, have no idea how manage identifying each edittext , button unique id, , thus, have no idea how manage grab values of each edittext saving database. can advise me on need do? thank you. if have inflated sub-layout, should have view object. you can call findviewbyid(r.id.edit_text_1) on view — assuming supplied ids in sub-layout xml. so long keep track of each of parent view s, can use findviewbyid() on them. or after inflation, if want can set new, globally-unique id on each edittext using setid() .

How to write a WordPress plugin to include default text inside every new blog post? -

i writing wordpress plugin include default text (i.e. text template) every new blog post user creates. is there action need call in order this? can't see relevant 1 here http://codex.wordpress.org/plugin_api/action_reference what have create new function along new filter each post submitted run through new function, include , append template text, processed new filter, ie: function my_templte_post($data) { $data = array( 'post_content' => 'this template text.' ); return $data; } add_filter( 'wp_insert_post_data' , 'my_templte_post' , '99' ); this untested, basicly thats along lines want.. think!

c# - WCF multiple named pipe endpoints -

i have 2 services want interact through named pipes. tried 2 ways, both creating 2 separate servicehosts, , creating multiple endpoints on single service. first service works whether have second service or not. second service in both cases, either endpoint not found error due not finding named pipe (separate services) or address filter problem (which setting not fix). i've checked , double checked settings, i'm stumped. both server , client both use same assembly has contract: [servicecontract(callbackcontract = typeof(iservicecallback1), sessionmode = sessionmode.required)] public interface iservice1 { .... } [servicecontract] public interface iservice2 { ... } here's server side: [servicebehavior(instancecontextmode = instancecontextmode.persession, concurrencymode = concurrencymode.reentrant, includeexceptiondetailinfaults = true)] class service1impl : iservice1 { ... } [servicebehavior(instancecontextmode = instancecontextmode.persession, includ

php - GZip Compression For JQuery Without Server Access -

all. required build website each page under 130kb. know jquery 1.4.4 ~28kb when it's g-zipped, it's 77kb minified, particular assignment. have built entire site using jquery in 1 implementation or on each page, scrapping mean days of wasted time. with in mind, 1) can add content headers javascript file add "content-encoding: gzip" without modifying config files on server end? i'm uploading them university server, don't have access configuration. response header, server is: apache/1.3.26 (unitedlinux) mod_ssl/2.8.10 openssl/0.9.6g php/4.2.2 mod_perl/1.27 2) phpinfo file, know zlib compression enabled, "zlib.output_compression" not. 3) realize can done using .htaccess. however, i'd other way, if possible, since don't want school thinking i'm trying modify server configuration. 4) xhr's setrequestheader method work here, or asynchronous files? i know short notice , all, final presentation tomorrow, , i'll lose ton of

Why are "smoke tests" called "smoke tests"? -

possible duplicate: what smoke testing , me? why "smoke tests" called "smoke tests"? don't @ all. smoke have it? see answer what smoke testing , me? : the term originates in hardware repair , has been applied software. it's intended quick test see if application "catches on fire" when run first time. stated above it's make sure don't waste bunch of folks time setting them loose on that's broken.

c# - Interesting EF4 Code First Many-To-Many Relationship Question -

i have 2 models, report: public class report { public int id { get; set; } public string name { get; set; } public virtual chargetype chargetypes { get; set; } } public class reportconfiguration : entityconfiguration<report> { public reportconfiguration() { mapsingletype(r => new { r.id, r.name }).totable("report"); hasmany(r => r.chargetypes) .withmany(c => c.reports) .map("report_chargetype", (r,c) => new { reportid = r.id, chargetypeid = c.id }); } } and chargetype: public class chargetype { public int id { get; set; } public string name { get; set; } public int sortorder { get; set; } public virtual report reports { get; set; } } public class chargetypeconfiguration : entityconfiguration<chargetype> { public reportconfiguration() { mapsingletype(c => new { c.id, c.name }).totable(

android - View taking up whole screen when not desired -

when call setcontentview view, takes whole screen. thought wrap_content , wrap_content mean view big enough show 2 strings only. show small dialog. ideas? how alert dialog use size needs? thanks <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="80dp" > <textview android:id="@+id/dialog_title" android:textsize="15sp" android:gravity="center_horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="string 1" /> <textview android:id="@+id/dialog_text1" android:textsize="10sp" android:gravity="cen

android - Strange ArrayAdapter behaviour -

i'm writing application android-based tablets. while have come far in development, there 1 bug don't understand , can't rid of. have gridview custom arrayadapter, contains downloadable items in it. each item in grid clickable relative layout, looks this: <relativelayout> <framelayout /> <textview /> <textview /> <progressbar /> </relativelayout> when item clicked, app try find on sd-card , show it. if fails, start downloading in it's own thread. file-downloading method standard, except 2 things things - has, said, it's own thread , updates progress-bar after downloading each data-chunk (which, @ moment, 2048 bytes): while ((n = in.read(b,0,chunksize)) >= 0) { out.write(b,0,n); if (handler != null && progressbar != null) { /* update progressbar:*/ currentbytes += n; final int nbytes = currentbytes; handler.post(new runnable() { public void run() {

windows - Create a directory and get the handle by issuing one IRP -

when create file createfile, file created , handle. createdirectory doesn't return directory's handle. i'd handle when create directory. want handle issuing 1 i/o request packet. so, 'do createdirectory, createfile file_flag_backup_semantics.' won't answer. issue 2 irps file system. is there api can use in usermode(win32 api)? nt can this, win32 doesn't expose it. need use nt apis this. ntcreatefile , specifically. should follow same parameters of zwcreatefile . here's illustrative example (hacked in hurry inside web form -- ymmv): handle createdirectoryandgethandle(pwstr pszfilename) { ntstatus status; unicode_string filename; handle directoryhandle; io_status_block iostatus; object_attributes objectattributes; rtlinitunicodestring(&filename, pszfilename); initializeobjectattributes(&objectatributes, &filename, 0, null, null); status = ntcreatefile(&directoryhandle,

c# - Fluent NHibernate: How to have a one-to-many reference in both directions? -

we have users on our system , persons . there many persons each user. when user logs on, need primary person record fill in name, address, phone, etc. public class person { /// <summary>every person belongs user.</summary> public virtual user user { get; set; } public virtual string firstname { get; set; } public virtual string lastname { get; set; } public virtual string address { get; set; } public virtual string phone { get; set; } // more methods & properties } public class user : entity { public virtual string username { get; set; } public virtual string password { get; set; } /// <summary>every user has primary person record.</summary> public virtual person primaryperson { get; set; } // more methods & properties } how class map without circular reference? try this: public class personmap : classmap<person> { public personmap() { table("persons"); id(

How to use Jquery to check checkbox states and do something based on conditions? -

here setup. <input type="checkbox" name="item1" value="100" class="100" /> <input type="checkbox" name="item2" value="200" class="200" /> <input type="checkbox" name="item3" value="300" class="300" /> <p>$0.00</p> the criteria need is: change p tag amount selected in checkbox if more 1 checkbox checked, add amount , display in p tag if 1 or more checkbox unchecked, subtract amount , display in p tag if none selected or of them unchecked, display 0 in p tag. i have far displays price of selected box , doesn't add nor remove when uncheck box. $("input[type=checkbox]").click(function() { var amount = $(this).attr("class"); $("p").html("$"+amount); }); any appreciated! simple try... $("input[type=checkbox]").change(function() { var amount = 0; $("inpu

wpftoolkit - WPF Chart Control -

i'm using wpf chart. in want remove legend control. can suggest me how can achive this? thanks, himaja if you're talking wpf toolkit's chart, see answer similar question.

css - jQuery draggable + toggleClass problem -

the problem here toggleclass position top:0px; left:0px not trigger.. width , height , background-color activate.. work if not drag div(draggable).. if start drag element, toggled class positioning not effect.. dont know if there's such function in jquery this.. <html> <head> <title></title> <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="jquery.ui.core.js"></script> <script type="text/javascript" src="jquery.ui.widget.js"></script> <script type="text/javascript" src="jquery.ui.mouse.js"></script> <script type="text/javascript" src="jquery.ui.resizable.js"></script> <script type="text/javascript" src="jquery.ui.draggable.js"></script> <script type="text/javascript">

php - Make text hyperlink in <textarea> -

i have textarea post plane text mysql db table. want add hyper references in text. how can this? , don't want use editor. not possible, textarea plain text input control. need allow rich-text/mark-up interpreted correctly using wysiwyg editor textarea the textarea element creates multi-line text input control. user agents should use contents of element initial value of control , should render text initially.

api - Programmatically pushing data to Quickbooks Online? -

our company uses quickbooks online track our books. when our application bills customer, nice have information recorded automatically in qb rather logging in qb online fill in info. is there way accomplish using quickbook's apis? intuit developer information confusing; oriented towards extending desktop version of quickbooks or developing apps publish in intuit's app store. have created web or other service-side app able pull data or qb online? if you're building one-off application, quickbooks online qbxml gateway way go. it's pretty simple post-your-xml-requests-over-http sort of interface gives access large chunk (but not all) of functionality within quickbooks online. if you're building saas application, should looking @ intuit partner platform instead. sounds you're building one-off app company, we'll focus on that: if on my quickbooks integration wiki there example qbxml requests show how sign on, , how post qbxml requests quickb

C++ : Avoid lot of boolean variable for multiple verification conditions in trading app -

i junior dev in trading app... have order refresh verification unit. has verify order confirmation exchange. send bunch of different request in bulk ( new, modify, cancel ) exchange... verification has happen max n times each t intervals orders. if verification successful order before n retry fine.. otherwise need indicate verification unsuccessfull. hv done basic coding done in urgent below for( n times ) { for_each ( sent_request_order ) // sent { 1) refreshed order db or shared mem i.e refreshed 2) find current sent order in refreshed if( not_found ) not refreshed exchange, continue next order if( found ) case new : //check new status, mark verification done case modify : //check modified status.. //if not mark pending, go next order, //revisit same after t time case cancel : //check cancelled status.. //if not mark pending, go next ord

python - Algorithm to sum/stack values from a time series graph where data points don't match on time -

i have graphing/analysis problem can't quite head around. can brute force, slow, maybe has better idea, or knows or speedy library python? i have 2+ time series data sets (x,y) want aggregate (and subsequently plot). issue x values across series don't match up, , don't want resort duplicating values time bins. so, given these 2 series: s1: (1;100) (5;100) (10;100) s2: (4;150) (5;100) (18;150) when added together, should result in: st: (1;100) (4;250) (5;200) (10;200) (18;250) logic: x=1 s1=100, s2=none, sum=100 x=4 s1=100, s2=150, sum=250 (note s1 value previous value) x=5 s1=100, s2=100, sum=200 x=10 s1=100, s2=100, sum=200 x=18 s1=100, s2=150, sum=250 my current thinking iterate sorted list of keys(x), keep previous value each series, , query each set if has new y x. any ideas appreciated! here's way it, putting more of behaviour on individual data streams: class datastream(object): def __init__(self, iterable): self.iterab

unix - What happens inside machine when i send a signal -

i mean, have request operating system, kill sig_number pid, happens next. actions taken operating system , on. thanks much depends on os of course - assuming have sufficient privileges deliver signal process concerned - os alter process state proc. concerned within kernel. result in "life cycle" state change process - i.e. terminated, terminating, dead, suspended .. etc. the actual call kernel (depending on os) via system call or maybe 'ioctl' call via appropriate device. when it's process's turn cpu time proc scheduler take process state account determine next. deliberately brief here quite involved. i'd suggest looking @ sample source - @ linux distro or opensolaris maybe (although that's quite complicated). example here - warning complicated. opensolaris signal handling in kernel

jquery UI draggable with live -

this draggable sortable example on jqueryui website, need use live() (i think) because elements created through ajax, know how apply live event following? <script> $(function() { $( "#sortable" ).sortable({ revert: true }); $( "#draggable" ).draggable({ connecttosortable: "#sortable", helper: "clone", revert: "invalid" }); $( "ul, li" ).disableselection(); }); </script> i don't think possible live event want it. best option have use callback function when add new element list , reenable new object draggable each time there new element. something this: // call add new element $.ajax({ url: 'addelem', success: function(data) { $( "#newdraggableobject" ).draggable({ connecttosortable: "#sortable", helper: "clone", revert: "

plugins - jQuery dynamically add script getting body is null -

i writing jquery plugin references plugin, dynamically add reference plugin when mine called: var headid = document.getelementsbytagname('head')[0]; var script = document.createelement('script'); script.type = 'text/javascript'; script.src = 'js/jquery.genericplugin.js'; document.body.appendchild(script); to call plugin use following in head tags: <script type="text/javascript" src="path/to/myplugin.js" /> <script type="text/javascript"> $(document).ready(function() { $('#object').myplugin({ option1: 1, option2: 2 }); }); </script> i have tested on 1 page, i'm trying update page using code , keep getting document body null error. i'm assuming because body hasn't loaded before plugin trying add script it. changed page code reference plugin in document ready event. <script type="text/javascript"> $(document)

r - pushViewport -> layout.pos.col possible with doubles? -

i wondering if possible specify grid viewports double this: pushviewport(viewport(layout.pos.row=1, layout.pos.col=1.5)) popviewport() when i'm trying row 1 , col 1. but want have half of col 1 , half of col 2. has hint me? probably cannot layout.pos.row , layout.pos.col. simple workaround specify position , size: grid.newpage() pushviewport(viewport(layout=grid.layout(2, 2))) grid.rect(gp=gpar(fill=1),vp=viewport(layout.pos.col=1,layout.pos.row=1)) grid.rect(gp=gpar(fill=2),vp=viewport(layout.pos.col=1,layout.pos.row=2)) grid.rect(gp=gpar(fill=3),vp=viewport(layout.pos.col=2,layout.pos.row=1)) grid.rect(gp=gpar(fill=4),vp=viewport(layout.pos.col=2,layout.pos.row=2)) pushviewport(viewport(x=unit(0.5, "npc"), width=unit(0.5, "npc"), y=unit(0.75, "npc"), height=unit(0.5, "npc"))) grid.rect(gp=gpar(fill="white")) also, think can write wrapper function specifying pos.col , pos.row in double, this: vpvp &l

How to find URLs in a string with PHP? -

i know there filter_var() don't want validate url, want spot them in whole text ( e.g. tweet). got idea? see here: http://saturnboy.com/2010/02/parsing-twitter-with-regexp/

jQuery: Get value of url in load() function -

i'm using library has defined onclick event handler on hyperlink eg: &lt;a onclick="$('#mydiv').load('/?__=634285190817664832&amp;sort=id&amp;sortdir=asc&amp;page=1 #mydiv');" href="#">1&lt;/a> how can value of 'url' parameter? updated answer ...after tobyodavies pointed out (in nicest of ways) being thick. if explicitly retrieve attribute , rather reflected property, we'll string dom, not function, , don't have worry function decompilation (see notes below). remainder of below bit paranoid (because working function decompilation), still: jquery(function($) { var link, onclick, url, index; link = $('#thelink')[0]; // important: getting *attribute* here, not reflected property. // jquery's `attr` function give property, go direct. onclick = link.getattribute("onclick"); display("onclick = " + onclick); index = onclick.indexof("load(&

iPhone: how twitter API help to make app -

possible duplicate: is there iphone sdk api twitter? hi start develop twitter app on iphone , how twitter api make app , how have use twitter api developing application on iphone r platform look @ sharekit covers everything, including twitter.

python - Transparent 3D bar graphs -

i generate 3d bar graphs transparent surfaces can see going on behind tall bars. the mplot3d api docs keywords allowed bar3d function. pass required parameters can output graphs solid surfaces. these , these bar graphs show semi-transparent surfaces. i tried keyword alpha (as used elsewhere similar purpose) not recognized: exception value: bar3d() got unexpected keyword argument 'alpha' and zsort parameter doesn't seem working either although used in 1 of examples above: exception value: bar3d() got unexpected keyword argument 'zsort' how can generate transparent bar graphs? my best guess might find bar3d() order of coloring , matlibplot colors of use. that say, understanding transparency should handled in alpha value of given color used (as rgba argument used in manner described in first link). having said that, can't explain why example source code linked works @ (maybe doesn't?)!

Java Data Structure -

i'm looking data structure act queue can hava first in first out behaviour, ideally able see if element exists in queue in constant time can hashmap, rather linear time linkedlist. i thought linkedhashmap might job, although make iterator , take , remove first element of iteration produce sort of poll() method, i'm wondering if there better way. many in advance often when want behaviour of 2 collections need maintain 2 collections. simple approach have queue , hashset, , perform add both , remove hashmap when remove queue. an alternative use linkedhashset. retains order elements added , can remove first/oldest element each time. a third option use queue. while might o(1) lookup time, may find fast enough meet requirements searching every element. might faster expect. i.e. 1000 elements should less 10 micro-seconds. edit: agree 2 collections best when don't know length. however show brute force search can fast too. slowest object 1 not there. (as ha

Partially completed text boxes and tombstoning in Windows Phone 7 -

when use twoway data binding view model on page, have observed, view model updated when focus leaves field (eg. textbox). behaviour matches description in updating data source . if application tombstoned, examples i've seen persist view model in page state, , reload them if activated again. from can see, means if user hadn't caused focus lost text box editing, current value isn't copied view model, , isn't saved. is user (and microsoft's application certification process) expect wp7 application? saving partially entered text across tombstoning isn't requirement marketplace acceptance testing. however, should persist data if makes sense in context of application , give best user experience. do not base application experience on way framework synchronises data view model. what's best user. if made sense application save information, user, want , woudn't care whatever technical reason gave not doing this.