Posts

Showing posts from April, 2011

php - SilverStripe: How do I insert a tab before another tab? -

i trying insert new admin tab before root.content.main without luck. i've tried: $fields->insertbefore(new tab('root.content.overview', 'overview'), 'root.content.main'); and $fields->addfieldtotab('root.content', new tab('overviewtab', 'root.content.overview'), 'root.content.main'); without luck. anyone have ideas? i've hunted through api there isn't explanation how tab naming system works. figured out... $fields->insertbefore(new tab('overview', 'project overview'), 'main');

java - Non-static method getText() can not be referenced from a static context -

i have written following code, continually 'non-static method gettext() can not referenced static context' error. could me on right track here? public class isbntext extends jtextfield { protected static string booknum; protected jtextfield booktext; public isbntext() { super(20); booktext = new jtextfield(); } public string getisbn() { string booknum = isbntext.gettext(); return booknum; } private string validateisbn(string booknum) } this line: string booknum = isbntext.gettext(); should be: string booknum = gettext(); which implicitly: string booknum = this.gettext(); the call isbntext.gettext() trying call if it's static method - i.e. associated type rather specific instance of type. doesn't make sense, text is associated instance of type. 2 alternatives i've shown equivalent, finding text of isbntext getisbn has been called on.

wpf - Caliburn Micro: how to set binding UpdateSourceTrigger? -

i've been exploring caliburn micro mvvm framework feel it, i've run bit of problem. have textbox bound string property on viewmodel , property updated when textbox loses focus. normally achieve setting updatesourcetrigger lostfocus on binding, don't see way within caliburn, has setup property binding me automatically. property updated every time content of textbox changes. my code simple, instance here vm: public class shellviewmodel : propertychangebase { private string _name; public string name { { return _name; } set { _name = value; notifyofpropertychange(() => name); } } } and inside view have simple textbox. <textbox x:name="name" /> how change name property updated when textbox loses focus, instead of each time property changes? just set binding explictly instance of textbox , caliburn.micro won't touch it: <textbox text="{binding nam...

xml - Mailchimp listing only one RSS-Item -

i have problem extending page rss-feed able start rss-to-email campaign mailchimp. according w3c-validator feed fine, mailchimp accquires first item in feed instead of four. the feed: http://odessa.duschko.de/de/ticketshop-v2/rss any suggestions? in advance! try adding pubdate -- publication date -- items. optional item rss, it's valid without, mailchimp requires it, believe. if you're coding feed in php, bear in mind php's date formatting constants helpfully include date_rss / datetime::rss . mailchimp has an example rss feed shown in 1 of support articles -- if you're still having problems, compare feed example. also, note (from here ): when first set rss campaign show last post example if haven't added article in few days. if first send, we'll send posts 24 hours before campaign activated daily, last 7 days weekly, , past 30 days monthly. so i'm sure that's why 1 of posts showing -- because there...

iphone - Resize drawing animation from given CGPoints? -

i have iphone version of app draws lines on screen cgpoints stored in core data. of drawings line based without fill, draws line given point next point etc. now making ipad version , want use same points (the points collected function build tracking screen , lot of work wish reuse same points have). does body has idea, algorithm or function drawing same lines' same points x2 size ? that draw method:(took glpaint example of apple) - (void) playback:(nsnumber*)index { if (p==0) { pointscount=[[localpoints objectatindex:[index intvalue]] count]-1; } isplaybackon = yes; letterpoint *point1 = (letterpoint*)[[localpoints objectatindex:[index intvalue]] objectatindex:p]; cgpoint p1 = cgpointfromstring(point1.float_point); letterpoint *point2 = (letterpoint*)[[localpoints objectatindex:[index intvalue]] objectatindex:p+1]; cgpoint p2 = cgpointfromstring(point2.float_point); [self renderlinefrompoint:p1 topoint:p2]; p++; ...

objective c - Transfer/Copy files from one iPad app to another iPad app for Editing -

i wondering if there way in objective c have ipad app copy file in it's documents folder app's documents folder , have app open file editing , copy file documents folder. or better yet, can have app open file documents folder, edit file, , save documents folder? so far know can have app open file in documents folder app i'm handing document off seems making local copy , editing copy. know each app's document folder shared folder users can drag , drop stuff itunes i'm not sure if same can done in code. i pretty sure trying impossible. ios applications "sandboxed" means each app has own documents directory. no application has access file system outside own "sandbox" i.e. outside own local documents directory. for more on ios application sandbox, read here.

model view controller - PHP: Including files for template -

i trying build own simple template handler able nest , combine files variables , call these variables when neccessary, shown below: $partial['header'] = 'header.php'; foreach($partial $part => $view ) { $output[$name] = file_get_contents( apppath .'views/' . $view . '.php' ); } extract($output, extr_prefix_all, 'template' ); include 'mytemplate.php'; the mytemplate.php template file: <?php echo $template_header; // shows header. the question: obviously, loading php file file_get_contents isn't going call php code inside loaded file , sure there's better options available using eval . what should change able use php inside template files? more ugly possible doing you're wanting : function custom_get_content($filename){ if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; }...

Advantages of sqlite3 vs CouchDB for an application like a personal feed reader? -

say wanted build feed reader downloads rss , atom feeds local computer , lets view them locally. respective advantages , disadvantages of using couchdb or sqlite3 datastore such application? good summary rsp. without knowing more requirements, it's hard 1 better suited use case. 1 clear advantage sqlite provides is has simpler installation , administration. library, it's linked application , installed along application. no separate database install , configure. 1 of features makes database libraries, sqlite , berkeley db attractive, , possibly preferable database servers. just add list of considerations, berkeley db , berkeley db java edition database libraries may want consider. berkeley db (written in c) offers choice of using schema-free key-value pair api, pojo-like java api or sqlite-compatible sql api. berkeley db java edition (100% java) offers java apis key-value pairs, java collections or pojo-like object persistence. berkeley db , sqlite tend products...

cocoa touch - fetching data from tableview cell? -

god evening :-d i have a tableview,(using core data) pub cell "todo" like: "5 mile run" , set detailed text @"points value @", x x number set slider, , same time u set name todo. i have put in button in cell, , called add, , want able add number in detailed text "totalpoints" attribute in core data model. i can make fetchrequest entity,but how make sure number, , how use simple math when "pointvalue" stored in nsnumber object. update : fixed :-d if u add button cell, u can indexpath : - (ibaction)buttontapped:(id)sender { if (![sender iskindofclass: [uibutton class]]) return; uitableviewcell *cell = (uitableviewcell *)[sender superview]; if (![cell iskindofclass: [uitableviewcell class]]) return; nsindexpath *indexpath = [self.tableview indexpathforcell: cell]; // indexpath.row and/or indexpath.section. this fixed app, , it´s in beta testing :-p thanks skov in sample code, there couple i...

iphone - Custom actions for UIGestureRecognizers (with custom parameters) -

short version of problem: i cannot figure out how make "action" uitapgesturerecognizer take additional parameters, , use them. here's rundown of problem: i trying make ipad app records (with nslog) coordinates of uitouch occurs whenever press 1 of app's uibuttons. location of touch needs relative button touched. what i've done: i have implemented uitapgesturerecognizer , added each of buttons. problem action use, since needs dynamic each , every button. i have code: uitapgesturerecognizer *iconclickrecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(logicon:withtag:)]; [iconclickrecognizer setnumberoftapsrequired:1]; [iconclickrecognizer setnumberoftouchesrequired:1]; [iconclickrecognizer setdelegate:self]; [[self.view viewwithtag:1] addgesturerecognizer:iconclickrecognizer]; [iconclickrecognizer release]; when know works, use for-loop add iconclickrecognizer of buttons tag. the logicon:(int)withtag metho...

wcf client - Exposing meta data for a WCF 4.0 Rest Template Service -

probably missing basic. created wcf 4.0 rest service. works no problems when i'm hitting url browser , i'm getting want. but want use service client mvc application (it used other non .net platforms why it's rest service in first place). problem how service reference can start use in c# code? new minimal wcf .net 4 config approach , no interface service contract, don't know how specify mex endpoint. don't want mex endpoint in production, during development. love able specify services (around 10 in 1 application) have endpoints 1 tiny piece of config vs2010 .config transformations rips out when publish. stop . rest service doesn't use metadata. metadata (mex endpoint) soap services because wsdl 1.1 (the version supported wcf) able describe soap service. wadl or wsdl 2.0 able describe rest service non of them supported wcf. rest service consumed using webrequest directly or building channelfactory on top of shared contracts. both methods des...

c# - .NET Tools: Extract Interface and Implement Wrapper Class -

is there tool can generate extract , generate interfaces existing classes? i know visual studio extract interface existing class. however, generate wrapper class implements functionality. i believe tremendously unit testing. example existing class: public class thirdpartyclass { public void method1(){} public void method2(){} } this can generated visual studio (extract interface): public interface ithirdpartyclass { void method1(); void method2(); } i go 1 step further: public class thirdpartyclasswrapper : ithirdpartyclass { private tpc = new thirdpartyclass(); public void method1() { tpc.method1(); } public void method2() { tpc.method2(); } } update: this useful static classes. morten points out can use stub, however, break coupling if possible. found way around non-sealed classes. 1 - inherit external class class mywrapper : externalclass 2 - extract interface public methods class mywrapper : ex...

using Linux instead of UNIX to compile c code for CS course -

a cs course i'm taking online suggests students compile source code , run tools valgrind on os unix. i'm new unix, linux, tools, , coding in c. i've made attempts @ installing freebsd 8.1 on vmware player 3.1.3, , managed vmware tools running. freebsd documentation has led me down many dead-ends in accomplishing common tasks i.e. mounting nfs or usb device. turns out packages need make happen aren't installed or configured, , don't see straight answer on how install them. so, if i'm using unix tool run gcc, g++, valgrind cs course, , these can run on linux instead, seems can job done faster using ubuntu linux. can linux used compile , run c code identically on unix, if compiled on linux? or if not, differences for? thanks for novice-level c programmer such op, difference of environment negligible. go ahead linux.

java - Passing a model to an included JSP? -

is there way me pass model jsp include <script/> tag? i'm trying create dynamic javascript, , need model access object has set of properties need. i'm using liferay automagically include jsp, , i'm using spring controller. controller: @requestmapping public string showform( modelmap model ){ model.addattribute( "mykey", object ); return "myview"; } accessing ${mykey} myview.jsp works, how @ model included jsp? a jsp include <script> tag? jsp represents dynamically populated text/javascript response? no, that's not possible. loaded separate http request won't contain same attributes request returned parent html page. not confused server-side includes using <jsp:include> take place within same http request. apart putting in session scope (which can have more caveats want), best print necessary data global js variable. <script>var foo = '${model.foo}';</script> <script src=...

java - JSP cant find bean Class using "" modifiers -

hey i'm using netbeans ide , i'm getting error when try run ejb program. error when declare , give path of class in jsp bean. <jsp:usebean id="book" class="bookbean.book" scope="application" /> <jsp:setproperty name="book" property="*" /> when run program error javax.servlet.servletexception: java.lang.instantiationexception: class bookbean.book : java.lang.illegalaccessexception: class java.beans.beans can not access member of class bookbean.book modifiers "" and java.lang.instantiationexception: class bookbean.book : java.lang.illegalaccessexception: class java.beans.beans can not access member of class bookbean.book modifiers "" i removed "" , put in '' see if works, doesn't. idea? put breakpoint there , def. root of problem. thanks. i figured out. constructor not public....

internet explorer 7 - Standards mode in IE7 with HTML5? -

is there way trigger standards mode in ie7 when using html5 doctype? my document starts this: <!doctype html> <html> <head> ... f12 opens developer tools in ie 9. alt+7, alt+8, & alt 9 allow toggle between browser versions. there menus allow change both document , standards modes. a couple things: if trying view dom tree using developer tools , switching between different versions in compatibility mode, should know need refresh each time switch modes. otherwise won't able see tree. also, these emulations not original browsers. impossible see "the way browser render" page unless on other browser. i recommend using browsershots.org . it's free, , requires no download. if want sophisticated, there other options. recommend browsershots. beware takes few minutes couple images back, , there maximum limit per day. can raise bit registering account.

.net - VB.NET : "Statement lambdas cannot be converted to expression trees" compile time error -

why can following : dim qnodes iqueryable(of xmlnode) = xdoc.childnodes.asqueryable() dim test = qnodes.where(function(node) true) although following gives error stated in title : dim qnodes iqueryable(of xmlnode) = xdoc.childnodes.asqueryable() dim test = qnodes.where(function(node) return true end function) ? i don't it. this stated in section 11.1 of vb.net 10 language specification: the exact translation between lambda methods , expression trees may not fixed between versions of compiler , beyond scope of specification. microsoft visual basic 10.0, lambda expressions may converted expression trees subject following restrictions: only single-line lambda expressions without byref parameters may converted expression trees. of single-line sub lambdas, invocation statements may converted expression trees. anonymous type expressions cannot converted expression tre...

winforms - Visual Studio 2010 Designer Error on Run -

i using using vs2010 , if have form open in designer mode , run application designer tab no longer show form designer instead error displayed (and fixed restarting ide) saying: "to prevent possible data loss before loading designer, following errors must resolved:" 1 error: "the designer not shown file because none of classes within can designed. designer inspected following classes in file: ##### --- base class ##### not loaded. ensure assembly has been referenced , projects have been built" i shows following call stack: at system.componentmodel.design.serialization.codedomdesignerloader.ensuredocument(idesignerserializationmanager manager) @ system.componentmodel.design.serialization.codedomdesignerloader.performload(idesignerserializationmanager manager) @ microsoft.visualstudio.design.serialization.codedom.vscodedomdesignerloader.performload(idesignerserializationmanager serializationmanager) @ system.com...

How to throttle login attempts - PHP & MySQL & CodeIgniter -

i'd able throttle login attempts based on failed attempts got questions. should use mysql? (read strain db) should throttle per user , system-wide or system-wide? (so stop normal people guessing passwords) how should calculate threshold? (so automatically adapts changes/growth) how should retrieve threshold? query/calculate on every fail or store on cache? should use throttle? (read response sleep() end straining server) does have sample code? i'm quite new @ appreciate help! thanks i implemented poor-man's throttling mechanism in phunction using apc alone, how use it: // allow 60 requests every 30 seconds // each request counts 1 (expensive operations can use higher values) // keep track of ips remote_addr (ignore others) $throttle = ph()->throttle($ttl = 30, $exit = 60, $count = 1, $proxy = false); if ($throttle === true) { // ip exceded 30 requests in last 60 seconds, die() here } else { // $throttle float // number of request...

xaml - Maintain Control.Opacity with animation according to it's "Disabled" visual state? -

i have custom button. i want when goes "disabled" state, it's opacity property should swap 65% or so, on time frame of around second, when leaves "disabled" state, should turn opacity 100% (animated). how done? how done? this short video answered question in minutes! here needed: <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstategroup.transitions> <visualtransition generatedduration="0:0:0.3" to="disabled"/> <visualtransition from="disabled" generatedduration="0:0:0.3"/> </visualstategroup.transitions> <visualstate x:name="normal"/> <visualstate x:name="mouseover"/> <visualstate x:name="pressed" /> <visualstate x:name="disabled"> <storyboard> <doubleanimationusingkeyframes stor...

javascript - toString method in jquery? or something similar -

answer found! i'm reading xml document , sending function $(data).find('colleges').attr('next') that returns discipline , javascript thinking it's variable, can how attribute in tag , have return string 'discipline' is there tostring()-type method add onto selection? $(data).find('colleges').attr('next').tostring() the issue having sending function createselect( $(data).find('colleges').attr('next') ) but firebug giving me error saying value, discipline, undefined? why javascript reading discipline var , not string? if this... $(data).find('colleges') ...doesn't find matches ( <colleges>...</colleges> ), this... .attr('next') ...will return undefined . the first thing should test see if .find() found anything. alert( $(data).find('colleges').length ); if alert gives 0 , there no matches, , you'll have inspect data see if contains ex...

algorithm - How can I manipulate an array to make the largest number? -

say have array of positive integers, manipulate them concatenation of integers of resultant array largest number possible. ex: {9,1,95,17,5}, result: 9955171 homework police: google phone interview question , no ndas signed ;). as others have pointed out, lexicographic sort , concatenation close, not quite correct. example, numbers 5 , 54 , , 56 lexicographic sort produce {5, 54, 56} (in increasing order) or {56, 54, 5} (in decreasing order), want {56, 5, 54} , since produces largest number possible. so want comparator 2 numbers somehow puts biggest digits first. we can comparing individual digits of 2 numbers, have careful when step off end of 1 number if other number still has remaining digits. there lots of counters, arithmetic, , edge cases have right. a cuter solution (also mentioned @sarp centel) achieves same result (1) lot less code. idea compare concatenation of 2 numbers reverse concatenation of numbers . of cruft have explicitly handle in (1) hand...

postgresql - How to conserve the integrity of the string from a database response using Python -

i using py-postgresql driver database, when make select string non-ascii characters, response replace character "�" can make change correct character? this code: class decodify: def __init__(self): db = pgdriver.connect(user = 'demo', password='demo' database='hidura_karinapp', host='localhost', port='5432') d = db.prepare("""select modules_reg.code modules_reg, domain_reg, sbdomain_reg, sbdomdl_asc where(modules_reg.id = sbdomdl_asc.module , modules_reg.mdname = 'police' , sbdomain_reg.id = sbdomdl_asc.domain , sbdomain_reg.domain = domain_reg.id , domain_reg.dname = 'bmsuite.com' , sbdomain_reg.sbname = 'www')""") s = d() print(s) if __name__ == '__main__': decodify() are setting client_encoding ? in theory py-postgresql should use correct client_encoding automatically. either setting wrong, or there wrong on how ...

c - Can't run opengl program in other computers.. compiled by Visual Studio 2010 -

ok, want run simple opengl program i've written, on other computers. can run on machine. doesn't give errors. when run on other computer says "cannot start application because msvcr100.dll not found" what's problem? or maybe i'm doing wrong? i tried both compilations on visual studio 2010, debug , release. executable have been shipped glut32.dll in same directory msvcr100.dll c runtime associated visual studio 2010. in order run successfully, other computer needs copy of runtime dll. can either installing visual studio 2010 on (not recommended), or installing microsoft visual c++ 2010 redistributable package (recommended) . note must compile program in release mode, not debug mode—a debug build links against debug version of c runtime, microsoft make redistributable package. illegal redistribute debug runtime dlls, if want distribute software , able run anywhere, need link against release runtime libraries.

xsd - xml with same element with different value need a schema -

for following xml need schema. <?xml version="1.0" encoding="utf-8"?> <overall_operation> <operation type="list_products"> <ops_description>listing products of company</ops_description> <module>powesystem</module> <comp_name>apc</comp_name> <prod_price>50k$</prod_price> <manf_date>2001</manf_date> <pool_name>electrical</pool_name> <fail_retry>2</fail_retry> <storage_type>avialble</storage_type> <storage_check>false</storage_check> <api_type>sync</api_type> <product_name>transformer</product_name> </operation> <operation type="search_product"> <ops_description>search products of company repository</ops_description> <module>high-voltage</module> ...

jquery - use first-Child with $(this) -

$(this):first-child wrong syntax i didn't know how use first-child $(this) in .each loop. you can .find() . html <div id='mydiv'> <p>hello</p> <p>world</p> </div> javascript $('#mydiv').each(function() { alert($(this).find(':first-child').text()); }); jquery :first-child in .each() loop - jsfiddle

networking - What do I use to send data from iPhone to iPhone in my app? -

in app, want design way 1 iphone send data second iphone. however, i'm having trouble figuring out classes use. don't know if use nsstreams or ftp class. in all, i'm pretty confused now. i've been searching google forever , reading apple's developer guides, still haven't got clear answer. possible networking merely phone phone, without dedicated server or using xml?

c# - How to deserialize a different interface implementation with wcf -

following situation: our software works business objects, @ moment sent wcf server client. [serializable] public class somevaluebo { public datetime timestamp{ get; set; } } they packed in request/response messages. [datacontract] public class response { [datamember] public list<somevaluebo> values { get; set; } } the problem: we send dto's client instead of business object's. heard, possible retrieve @ client instance of different type sent on server. example: public interface isomevalue { datetime timestamp { get; set; } } [serializable] public class somevaluebo : isomevalue { public datetime timestamp { get; set; } } [datacontract] public class somevaluedto : isomevalue { [datamember] public datetime timestamp { get; set; } } the response this: [datacontract] public class response { [datamember] public list<isomevalue> values { get; set; } } on server: public class serviceclass : iservice { public response...

git - Shorthand for getting the diff from the last N commits? -

i know can do: git diff head^..head but there shorthand that's easier remember, like: git diff foo n where n can number of commits cumulative diff of? from specifying revisions of git rev-parse man page : a suffix ~<n> revision parameter means commit object <n> th generation grand-parent of named commit object, following first parent. i.e. rev~3 equivalent rev^^^ equivalent rev^1^1^1 . consider examples in git diff man page : git diff head^..head git diff head^.. git diff head^ head are equivalent forms (thanks chrisk head^.. form, mentioned in comments). (they not equivalent git diff head^ , mark longair comments, since diff working directory, not last commit) so: git diff head~15 # diff working tree 15th previous commit git diff head~15 head # diff last commit 15th previous commit should need (as khmarbaise mentions in comment).

c++ - Constructor called on an already created object -

if call constructor on constructed object or struct, allocate new space, or use existing space? first object allocation more resource intensive? this: struct f { int a,b,c,d; f(int _a, int _b) {a = _a; b = _b}; void a(int _a, int _b) {a = _a; b = _b}; }; //first constructor call f f = f(5, 6); //second constructor call on constructed object f = f(7, 8); //third constructor call on constructed object f(7, 8); //is constructor call more res. intesive, call function same? f.a(9, 0) is constructor call more resource intesive, call function same ( void a(...) )? does destructor gets called, when call constructor on created object? first off, [c] tag inappropriate since constructors c++-only feature. i'll assume code snippet provided in fact c++ , not weird dialect of c. c++ , c different languages ; not tag questions both since different answers each. second, constructor definition wrong. constructors must have exact same name class itself. f()...

c# - Create project folder Buildengine -

when creating 1 project file code using buidengine, know.. how add project folders? how add 1 builditem created folder? . var project = new project(); project.load(projectfile.fullname, projectloadsettings.ignoremissingimports); //create project folder var builditem = project.addnewitem(itemname, filename); //add file folder thanks in advance what mean project folder? won't specifying filename folder\file1 trick?

php - How to write an SQL query that counts the number of rows per month and year? -

had idea how query vbulletin database generate report on number of registrations per month/year achive results like.. mm/yyyy count 01/2001 : 10 02/2001 : 12 ... ... thanks answers below.. final version works follows: select count(*) 'registrations', year(from_unixtime(joindate)) 'year', month(from_unixtime(joindate)) 'month' vbfuser group year,month i not familiar vbulletin's database structure, should something this , assuming user table has date/datetime/timestamp created_date or reg_timestamp column or similiar, using mysql's year() , month() functions . select count(*) count, year(reg_timestamp) year month(reg_timestamp) month users group year, month; this result in similiar this: +-------+-------+------+ | count | month | year | +-------+-------+------+ | 4 | 11 | 2008 | | 1 | 12 | 2008 | | 196 | 12 | 2009 | | 651 | 1 | 2010 | +-------+-------+------+ edi...

windows - What's the difference between TYPE_E_BUFFERTOOSMALL and DISP_E_BUFFERTOOSMALL HRESULT values? -

reviewing winerror.h noticed there're 2 hresult values: #define disp_e_buffertoosmall _hresult_typedef_(0x80020013l) #define type_e_buffertoosmall _hresult_typedef_(0x80028016l) both claimed resolve "buffer small" text , both have same "facility" part , differ in "code" part. what's difference between these 2 values? disp_e_buffertoosmall intended general use in idispatch interfaces. i believe type_e_* errors intended type conversion error. type_e_buffertoosmall appears problems converting variant s or propvariant s. looked around , found used in context of "property bags" (which serializable collection); example, see this . in context of other question , disp_e_buffertoosmall better fit.

Checking if all the array items are empty PHP -

i'm adding array of items form , if of them empty, want perform validation , add error string. have: $array = array( 'requestid' => '$_post["requestid"]', 'clientname' => '$_post["clientname"]', 'username' => '$_post["username"]', 'requestassignee' => '$_post["requestassignee"]', 'status' => '$_post["status"]', 'priority' => '$_post["priority"]' ); and if of array elements empty perform: $error_str .= '<li>please enter value @ least 1 of fields regarding request searching for.</li>'; you can use built in array_filter if no callback supplied, entries of input equal false (see converting boolean) removed. so can in 1 simple line. if(!array_filter($array)) { echo '<li>please enter value @ least ...

error handling - Joomla - swallow a JError::raiseError-Message silently -

hey guys, possible catch , ignore jerror::raiseerror? use jdatabase , if user acts 'stupid' duplicate entry can occur. that's not problem , can ignored silently. unfortunatelly error printed on hole page. dont want drop new query check if primary key exists. to disable throwing of joomla exceptions in execution path call: jerror::seterrorhandling(e_all, "ignore"); alternative can set own custom handler: jerror::seterrorhandling(e_all, 'callback', array('myclass', 'myerrorhandlerfunction'));

c# - List/Collection blocked until its filled -

i trying achieve easy describe, cannot find how. i want blocked until list has @ least 1 element. let's have 2 workers. collection c; worker 1: while(true) { var element = c.waitoneelement(); // stuff element } worker 2: // slow stuff c.add(element); this done using semaphores, i'm wondering if there built-in class allows kind of stuff. thanks edit: alternatively, map callback "element added" event, don't think exists. you can read such collections here http://www.albahari.com/threading/part5.aspx#_concurrent_collections and heres code snippet page might public class pcqueue : idisposable { blockingcollection<action> _taskq = new blockingcollection<action>(); public pcqueue (int workercount) { // create , start separate task each consumer: (int = 0; < workercount; i++) task.factory.startnew (consume); } public void dispose() { _taskq.completeaddin...

display data in grid using php -

i trying display retrieved data in grid. i used while loop , retrieved every thing.i applied css rows getting displayed in same color. i trying row0 blue color row1 green color row2 blue color row3 green color.how do it? use (of course, adapt loop) : echo '<table>'; $i = 0; foreach($myrows $row) { echo '<tr class="row'.(++$i % 2).'"><td>'; echo $row; echo '</td></tr>'; } echo '</table>'; with following css code : tr.row0 > td { background-color: blue; } tr.row1 > td { background-color: green; }

sql - O/R mapping: Single complex query vs. multiple simple queries -

i'm qurious on how result set of sql query transported server client. most o/r mappers support both eager , lazy load, both have pros , cons. e.g. entity framework4 (.net) has wonderful eager load support. however, lets assume have model this: blogpost { public string body {get;set;} icollection<comment> comments {get;set;} } ... and query this: var posts = context .posts .include(post => post.comments) .where(post => post.id == 1) .first(); this result in single sql query, data "post" repeated on each row every "comment" lets have 100 comments on specific post , post.body massive peice of text. can't good? or data somehow compressed when sent client, minimizing overhead of repeating data on each row? what best way determine if 1 such query more efficient 2 simple queries (one getting post , 1 getting comments)? benchmarking on dev environment pretty pointless, there multiple...

javascript - Adding cash register support to ASP application. Starting an exe from client side -

what want print cash register asp application, means call exe file operates directly cash reigister txt file printed. more correct formulation of problem can found on this link . the solution given there following three: using link pointing exe file - exe file downloaded , operates driver. using resident program on client computer listening on port - server connects , operates driver. using activex object - driver operated client script internet browser. i want not using resident program, directly browser. in respect found solution in java using applets, fine, have asp.net, , way can using activex object, , problem work on internet explorer, not option. after thoroughly searching internet problems ca concentrated in following question: how ca run exe client side on browser without using activex objects? i know questions was posed thousands of times, there plug-in, loophole, form of java applet asp page :), can me solve problem? update: thanks comment , an...

Best way to programmatically create/maintain SharePoint Quick Launch menu -

we have solution deploys number of lists , pages. wan't create links them on quick launch menu automatically when feature activated. the structure this. customers active inactive sales quotes orders and on. site collection admin might add link between "active" , "inactive" links. when feature deactivated don't want remove items, if feature activated again don't want navigation added again :) is there built in api can use? know spweb.navigation.quicklaunch , spnavigationnode(collection) structure etc. there way? hope can :) what kind of other way looking for? public override void featureactivated(spfeaturereceiverproperties properties) { spweb web = (spweb)properties.feature.parent; // check existing link list. spnavigationnode listnode = web.navigation.getnodebyurl(list.defaultviewurl); // no link, create one. if (listnode == null) { // create node. ...

How can I add an "ex" LocalParams to a Facet Field Query in SolrNet? -

if use solrfacetfieldquery build facet query, can't add localparams in constructor because when parses other facet parameters such limit , sort, add localparams name of field, generates invalid query example: var fq = new solrfacetfieldquery(new localparams{{"ex", "c"}} + "category") { limit = 10 }; i generate: facet.field={!ex=c}category&facet.category.limit=10&fq={!tag=c}category:1 this fixed couple of weeks ago .

path - How can a batch file call another batch file? -

i have 2 different batch files @ 2 different path. when call a.bat b.bat, batch file called(a.bat) doesn't work. when double click a.bat works fine. think problem the path . however, use full paths. why doesn't work? want extract file. b.batch call "c:\documents , settings\a.bat" a.batch set earfile="e:\bee\deployments\sny1\snyeartest.ear" set winrar_exe="c:\.....\winrar.exe" set war_file="c:\...." %winrar_exe% e -o+ %earfile% %war_file% when extract war_file path a.bat exist war_file extracted path b. there solution solve problem? it should work. add pause end of b.bat can see error messages before window closes. add cd /d path @ top of b.bat specify folder in ear file decompressed.

java - How can I modify the behavior of the tab key in a JTextArea? -

i'm creating form in java swing, , 1 of fields jtextarea . when use tab key on other fields, gives focus next widget, in jtextarea , inserts tab character (horizontal space) in text. how can modify behavior? /* understanding of how tabbing works. focus manager recognizes following default keystrokes tabbing: forwards: tab or ctrl-tab backwards: shift-tab or ctrl-shift-tab in case of jtextarea, tab , shift-tab have been removed defaults means keystroke passed text area. tab keystroke inserts tab document. shift-tab seems ignored. example shows different approaches tabbing out of jtextarea also, text area typically added scroll pane. when tabbing forward vertical scroll bar focus default. each approach shows how prevent scrollbar getting focus. */ import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.*; public class textareatab extends jframe { public textareatab() { con...

html - JavaScript. Absolute position of <li> element relative to browser bounds? -

how know absolute position of <li> element relative browser bounds? <html> <body style="overflow: hidden"> <div id="ticker" style="position:absolute; white-space: nowrap;"> <ol style="list-style-type:decimal; "> <li style="float: left; width: 100px; padding: 2px 0px;">test</li> <li style="float: left; width: 100px; padding: 2px 0px;">test</li> <li id="targetelem" style="float: left; width: 100px; padding: 2px 0px;">test</li> <li style="float: left; width: 100px; padding: 2px 0px;">test</li> <li style="float: left; width: 100px; padding: 2px 0px;">test</li> <li style="float: left; width: 100px; padding: 2px 0px;">test</li> <li style=...

python - Retrieving information stored in other sessions with gae-sessions -

i made simple login system gae-sessions , , want show logged in user how many users logged in , are. to count number of people logged in, when log user in save session datastore save(persist_even_if_using_cookie=true). use sessionmodel.all().count() retrieve number of logged in accounts. i'm having trouble retrieving information on other sessions though. i'm not sure how it. tried this: logged_in = [] activesession in sessionmodel.all(): logged_in.append(activesession['user']) but i'm getting error: typeerror: 'sessionmodel' object unsubscriptable i tried activesession.get('user'), results in error: badkeyerror: invalid string key user. how can this? the session object , sessionmodel separate each other. sessionmodel stores contents of session, can't read session object. i have feeling bad idea, , should find way store/retrieve list of logged in users. method may return expired sessions haven't been deleted...

visual studio - Common Lisp IDE for C# Developer? -

update i've decided go clojure now. lispdev isn't ready, , eclipse/cusp wasn't stable enough me feel comfortable. as clojure, after long, frustrating, annoying process trying eclipse/ccw, netbeans/enclojure , intellij/la clojure working, finally got eclipse/ccw working. rest still in mostly-broken states. (if around it, i'll document took me eclipse/ccw working.) so now, i'm going use that. may dip cl, , check out lispworks , allegrolisp's free versions, clojure feels more natural step me working within microsoft clr environment. thanks help. original question i'm c# developer familiar visual studio (with resharper). i'm new lisps. i've taken interest in both common lisp , clojure recently, , found plenty of material on both of them. i've tried emacs + slime, feels backwards, dated solution. have no doubts power, it's usability nothing i'm used to. don't want struggle ide in addition language. the...

website - Site redirects when loaded by mobile device -

i want user directed mobile implementation when tries load webpage using mobile device. there script can use iphone, android , maybe samsung? found scripts in internet cannot figure out 1 working , 1 not if wanting javascript redirect, can examine user agent of browser , act accordingly. can prove inaccurate because user agents can modified (often times case). below example checks if device ipad , routes browser location. need find out user agents dealing iphone, android, or other device , implement logic. hope helps. window.onload = page_onload; function page_onload() { if (navigator.useragent.match(/ipad/) != null) { window.location = "http://[some mobile url]"; } }

lisp - Scheme Function to reverse elements of list of 2-list -

this exercise eopl. procedure (invert lst) takes lst list of 2-lists , returns list each 2-list reversed. (define invert (lambda (lst) (cond((null? lst ) '()) ((= 2 (rtn-len (car lst))) ( cons(swap-elem (car lst)) (invert (cdr lst)))) ("list not 2-list")))) ;; auxiliry procedure swap-elements of 2 element list (define swap-elem (lambda (lst) (cons (car (cdr lst)) (car lst)))) ;; returns lengh of list calling (define rtn-len (lambda (lst) (calc-len lst 0))) ;; calculate length of list (define calc-len (lambda (lst n) (if (null? lst) n (calc-len (cdr lst) (+ n 1))))) this seems work looks verbose. can shortened or written in more elegant way ? how can halt processing in of individual element not 2-list? @ moment execution proceed next member , replacing current member "list not 2-list" if current member not 2-list. the eopl language provide...

Why am I not getting any index defintions in my Rails schema.db - "# unrecognized index ..." -

rails 2.3.5, postgres backend, read-only access external oracle database. my schema.db file not getting index definitions. instead, getting lines in schema.db say: # unrecognized index "auditable_index" type activerecord::connectionadapters::indexdefinition rails 2.3.5 not support oracle out of box. using sql schema format instead of schema.rb should work around issue. config.active_record.schema_format = :sql i think oracle-enhanced gem supports proper generation of oracle indexes i've never used it. might worth shot if don't want change schema format. https://github.com/rsim/oracle-enhanced

android - Creating a new APK -

consider having apk, requirement add source code along apk , create new apk. possible ? if plz advise me ! note: have apk not source code. thanks in advance. you might want take @ similar question how convert .apk files java

database - DB Fk/Pk keys performance -

in our db have single centric table millions of rows being inserted , updated. table has single column acting unique identifier , used link content of table mutliple tables 1 many relation. this means wehn inserting entry to, say, users table, in same transaction users_pets , users_parents (and 10 more) populated, multiple rows, based on same unique identifier main table. since application using db inserting new entries , updating existing ones relation between these tables kept @ application level (i.e. logical erd instead of handling via fk/pk decelrations). questions: is correct assume pure performnces point of view, best approach? is there way set these keys (so db more self descriptive) without impacting performaces? no, same reason use seatbelts in cars when in hurry. difference negligeble , totally not worth it. some specific dbms vendors may offer way of declaring constraints while not enforcing them. in oracle example, can specify integrity constraint...

java - Cuneiform library crashes when is called via JNI bridge -

i writing java application, call (via library) functions cuneiform ocr library. unfortunately, have crash in strange place, , need advice of community. the program crashes on first code line of rverline_marklines() , called rsl_setimportdata() , in first code position (initialization of variable lti ). have checked passed variables in gdb : make sense , seem valid. looks stack corrupted, tried reshuffle source lines in rverline_marklines() without success. the same code same input data works ok when invoked c++ code (cpp cli → library → cuneiform library), breaks when invoked jvm (jvm → library → cuneiform library). as newbie gdb , perhaps can give me hint, how can find out reason of crash ? @ , pay attention to? many in advance. stack trace: program received signal sigsegv, segmentation fault. [switching thread 0xb7564b70 (lwp 416)] rverline_marklines (hccomp=0xb28a2708, hcpage=0xb28a28d0) @ cuneiform-1.0.0.orig/cuneiform_src/kern/rverline/src/root/vl_kern.cpp:12...

asp.net - "File not found exception" trying to extract zip archive with DotNetZip -

public void zipextract(string zipfilename, string outputdirectory) { using (zipfile zip = zipfile.read(zipfilename))//file not found exception { directory.createdirectory(outputdirectory); zip.extractselectedentries("name=*.jpg,*.jpeg,*.png,*.gif,*.bmp", " ", outputdirectory, extractexistingfileaction.overwritesilently); } } [httppost] public contentresult uploadify(httppostedfilebase filedata) { var path = server.mappath(@"~/files"); var filepath = path.combine(path, filedata.filename); if (filedata.filename.endswith(".zip")) { zipextract(filedata.filename,path); } filedata.saveas(filepath); // createthumbnail(filepath); _db.photos.add(new photo { filename = filedata.filename }); _db.savechanges(); return new contentresult{content = "1"}; } i try extract uploaded zip archive , save extracted files in fol...

php - Sending additional field data with uploadify -

i want send additional field uploadify, cant field value on backend php file following code. can see if html, , js code correct? thanks <script type="text/javascript"> $(document).ready(function() { $("#fileupload").fileupload({ 'uploader': 'uploadify/uploader.swf', 'cancelimg': 'uploadify/cancel.png', 'script': 'uploadify/upload.php', 'folder': 'files', 'multi': false, 'displaydata': 'speed', 'scriptdata': {'name':'', 'location':''}, 'onselectonce' : function(event,data) { $("#fileupload").uploadifysettings('scriptdata', {'name' : $('#name').val()}); } }); }); </script> html: <h2>single file upload</h2> <p>display speed</p> name: <input name=...

cookies - Loosin session id over SSL -

im trying send session of data on shared ssl. to load session have following @ top of core file: print_r($_cookie); if ( isset( $_post["phpsessid"] ) ) { session_id( $_post["phpsessid"] ); }elseif( isset( $_cookie['phpsessid'] ) ) { session_id( $_cookie["phpsessid"] ); } session_start(); on non ssl view prints differrent id 1 on ssl. whene go , forth ids not changing 2 seperate ones shared ssl , non ssl. how can change script have 1 on both? use function session_set_cookie_params() , set $secure = false reference: http://www.php.net/manual/en/function.session-set-cookie-params.php

Rails - Comment Threading using Nested Sets? But Which Gem? -

i'm interested in adding comment threading app. seems nested set gem way go. can't tell gem way go, popular, etc... of nested_set, awesome_nested_set, appear not have been updated in time. given want comment threading. suggestions? check out railscasts 196 , 197 . imo, reason gems tend go unmaintained because it's ridiculously easy 2 helpers , 2 javascript methods. don't want encourage build wheel yourself, keep in mind isn't difficult wheel. don't idea? fork the repo , use own. shouldn't blindly using open source without little bit of exploration of how works anyway.

javascript - Set cookie wih JS, read with PHP problem -

i'm trying set cookie javascript , read in other page php. able write cookie doing document.cookie = cookiename+"="+cookievalue; and partially works. - cookie written, , able read $_cookie[cookiename] in same web page. which not quite usefull really. need read in page. develop in asp.net , c#, i'm preety new php. doing wrong? thank time! edit1: both pages in same domain.. eg. site.com/index.php -> site.com/index2.php edit2: cookie set in 1 page through: function setcookie(cookiename,cookievalue,ndays) { var today = new date(); var expire = new date(); if (ndays==null || ndays==0) ndays=1; expire.settime(today.gettime() + 3600000*24*ndays); document.cookie = cookiename+"="+escape(cookievalue) + ";expires="+expire.togmtstring(); } and in page can not accessed, in same page can... edit3: tried setting domain , added path=<?php echo $_server['http_host']; ?> javascript code... still nothing...