Posts

Showing posts from April, 2010

javascript - Strange behavior with "this" in Backbone.js when binding to "add"/"remove" in a collection -

i have following 2 views based on backbone.js pg.views.itemlist = backbone.view.extend({ tagname: "div", classname: "items", initialize: function() { _.bindall(this, 'addone', 'addselected') items.bind('add', this.addone); items.fetch(); }, // removed addone: function(item) { console.log($(this.el)); var view = new pg.views.item({model: item}); $(this.el).append(view.render().el); }, addselected: function(itemlist) { _.each(itemlist, this.addone); return this.el; }, // removed }); pg.views.section = backbone.view.extend({ tagname: "section", sectiontemplate: _.template($('#section-template').html()), events: { // removed }, initialize: function() { _.bindall(this, 'render', 'close', 'additemtosection', 'removeitemfromsection'); this.model.bind('change', this.render); this.model.view

app store - iPhone app: tap this button to update to the latest version -

i need url open end @ updates tab of appstore app. preferably @ update screen app. such thing possible? i know can open app itself, or reviews page app. when prompting users upgrade, "buy/free" button grayed out , says "installed". pretty unintuitive. have text instructs user do, far better go directly update page our app. can remotely update content in our old app, easy have button or link takes them update tab, assuming knew magic url was. there's no such url. can tell user check app store update , block them progressing further app until they've installed new version.

css - In a fixed width <select multiple> html box, is there a way to see text options that are to long? -

i have following code: <div id='div2' style='height: 430px; width: 350px; overflow:auto;'> <select multiple id="id" size="28" style="font-size: 12px; font-family: arial; width: 100%"> i cannot (due requirements) increase width of box, fixed @ 350px. of text strings in box larger 350px; right being truncated wondering if there way either make these options wrap onto second line, or add horizontal scrollbar box in order see full options. i'm developing ie7 , 8. you can use css word-wrap: break-word; click here cross browser functionality if it's text inside select list want wrapped it's not possible far know what use custom made selectbox example jquery selectmenu can customize fully

sqlite - Returning column indicating row existence in another table -

sqlite3 i have 2 tables, table1 , table2. both of these tables have column called name. i query table2 , return name column. in addition, return column containing values 1 or 0 depending on whether rows in table1 contain same value name. what efficient way this? i'm looking like: select name, if exists (select * table1 table1.name = table2.name) 1 else 0 table2 sorry, i'm not familiar sqlite, should work you. trick left outer join , comparison on joined table. select table2.name, case when table1.name not null 1 else 0 end table2 left outer join table1 on table1.name = table2.name i'm not sure case syntax best if more familiar conditionals in sqlite can clean part up.

java - How can one detect airplane mode on Android? -

i have code in application detects if wi-fi actively connected. code triggers runtimeexception if airplane mode enabled. display separate error message when in mode anyway. how can reliably detect if android device in airplane mode? /** * gets state of airplane mode. * * @param context * @return true if enabled. */ private static boolean isairplanemodeon(context context) { return settings.system.getint(context.getcontentresolver(), settings.system.airplane_mode_on, 0) != 0; }

regex - converting markdown lists to html lists in PHP -

i have been working on markdown converter today project of mine. got lost in , ran through code , noticed had huge amount converting lists. code below , have supplied code deals lists, suggestions on shortening code, cant see past have written , need fresh pair of eyes. <?php class markdown { private static $html = ''; private static $list_types = array( array( '>>', '<ul>', '</ul>' ), array( '>>>', '<ol>', '</ol>' ) ); private static $list_patterns = array( '/-[ ]+(.+)/' => ' >>\1', '/[0-9]{1}\. (.+)/' => ' >>>\1' ); public static function converttext($markdown = array()) { $markdown = explode("\n", strip_tags($markdown)); foreach ($markdown &$line) { $line = htmlentities($line, ent_quotes, 'utf-8'); foreach (self

unit testing - Python unittest - opposite of assertRaises? -

i want write test establish exception not raised in given circumstance. it's straightforward test if exception is raised ... sinvalidpath=alwayssuppliesaninvalidpath() self.assertraises(pathisnotavalidone, myobject, sinvalidpath) ... how can opposite . something i'm after ... svalidpath=alwayssuppliesavalidpath() self.assertnotraises(pathisnotavalidone, myobject, svalidpath) try: myfunc() except exceptiontype: self.fail("myfunc() raised exceptiontype unexpectedly!")

language agnostic - Preferred way of checking for errors -

if want say, check int between 2 numbers, better implement without exceptions so: int a; //example in c++, translate language of choice... cin >> a; if(a < 0 || > 5) cout << "you must enter in number between 0 , 5 inclusive!" << endl; or exception in try-catch block? try { int a; cin >> a; if(a < 0 || > 5) throw "you must enter in number between 0 , 5 inclusive!" << endl; } catch(string msg) { cout << msg << endl; } neither 'better'. how deal anomalous conditions, errors, etc. totally depends on exact circumstances , design of code. try-catch blocks great when error should cause following code skipped. on other hand, when want let user know problem continue anyways by, say, assuming default value, try-catch may not appropriate. additionally, programs designed custom error-handling code errors , anomalies can logged , recorded, , ensure program can fail gr

Change name and Bulk Update Joomla / Virtuemart Product Type Parameters -

i working joomla / virtuemart install , ran problem when trying update product type parameters. i have product type multiple values parameter type. have list of possible values so: type a;type b;type c . i need change names of of these values. example, let's want change type b type x . can change in possible values field, of products assigned type b not assigned type x upon change. newly renamed type x empty. is there way can bulk update or change of products assigned type b become type x ? you have 4 solutions: modify category name if products in category affected (e.g. change category name type b type x ). use virtuemart plugin bulk product type , product parameter manager . download mysql files involved database tables , alter them manually. do manually inside virtuemart (especially if items being changed not many).

CSS: background color for <li> troubles (with floated <img>) -

when <li> 's have background color , floating against image floated left. i background color of li left justified paragraph, not left edge of page. bulletproof ways of doing this? wish simple adding display: inline; <ul> . large left margin wider image not option, images varying widths. thanks input. 1 has been ongoing struggle in designs, , figure out perfect "fix" this. fiddle here: http://jsfiddle.net/3khky/3/ /// css ----> li { background-color: red; margin-left: 10px; color: white;} img { float: left; margin-right: 10px; } /// html ---> <p> <img src="http://i.ehow.com/images/a04/v1/cb/started-new-kitten-200x200.jpg" /> </p> <h2>title</h2> <ul> <li>lorem ipsum</li> <li>lorem ipsum</li> <li>lorem ipsum</li> </ul> <p>more content here.</p> did mean that ?

asp.net mvc 3 - getting 404 when trying to run MVC 3 RC basic app on IIS 7/5 -

i'm trying run mvc3 rc new application created simple vs 2010 , no changes project , iis 7.5 i'm getting 404 error. are there changes required in web.config or iis settings extensionless url i have mvc2 running on same iis , tried set same config guess i'm missing something. thanks my bad running .net 2.0 instead of 4.0

JavaScript Newline Character -

from this question , ... lines = foo.value.split(/\r\n|\r|\n/); is 1 way split string, how join newlines? also, wonder if linux uses whichever newline character, switch windows, won't web app break? newlines become not recognized? or maybe browser conversion? split on /\r?\n/, in case string includes carriage returns newlines. join '\n', in browser , os.

html - Absolute class is not working in IE -

i want put 1 picture in website absolute class in css. have css: .christmas-santa {background:url(../images/header/santa.jpg) left bottom no-repeat scroll; position:fixed; left:0px; top:0px; width:100%; height:100%; border:1px solid #000000;} this css works in mozila, it's not working in ie. what changes should make? which version of ie? there known issues ie6 , position:fixed here fix; http://divinentd.com/experiments/emulating-position-fixed.html ie7+ support position:fixed in standards compliant mode requires valid doctype. include @ top of page; <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "dtd/xhtml1-strict.dtd">

qt - C++ - Undefined reference to `vtable -

i wondering why getting error: undefined reference `vtable baserenderer' i tried searching around cannot seem figure out. i've tried getting rid of virtual function, removing constructor, etc. my baserenderer.h class baserenderer : public renderer { q_object public: baserenderer(); baserenderer(qwidget *parent); void paintgl(); virtual ~baserenderer(); public slots: void loaddialog(); signals: protected: mesh loadmesh(string filename); private: objparser objparser; mesh baseterrain; }; my baserenderer.cpp baserenderer::baserenderer() <------ error leads me here { } baserenderer::baserenderer(qwidget *parent) : renderer(parent) { } baserenderer::~baserenderer() { //dtor } how go getting rid of issue? hear may compiler...? :) since q_object in parent class, renderer, don't have include baserenderer. rid of q_object , should work :)

php - This query/database is not working well together -

here's query: select *, count(*) `numauth` `favorites` `f1` inner join `story` `s1` on `f1`.`story_id` = `s1`.`story_id` `f1`.`story_id` != '".addslashes($_request['storyid'])."' , `f1`.`story_id` != '".addslashes($_request['storyid2'])."' , exists ( select 1 `favorites` `f2` `story_id` = '".addslashes($_request['storyid'])."' , `f2`.`auth_id` = `f1`.`auth_id`) , exists ( select 1 `favorites` `f3` `story_id` = '".addslashes($_request['storyid2'])."' , `f3`.`auth_id` = `f1`.`auth_id`) , not exists ( select 1 `favorites` `f4` `story_id` = '"

Weird performance of a rails + sinatra app -

i have rails application , sinatra application. sinatra application written lookup timezone based on either zip or ip. sinatra application uses geoip_city gem lookup using ip , has own database zip lookup. rails app talks sinatra application timezone lookup. we worked on rails application's performance , have improved extent. tested using jmeter, 1000 threads running forever 60 ramp-up. performed well. tested sinatra app similar numbers , performing enough. however, when test piece rails app talks sinatra app timezone lookup, after ramp period, timeout errors. timezone lookup request made rails app sinatra app times out. if reduce number of threads in jmeter 100, application performs fine. i wonder why happens if rails app , sinatra application performing fine individually. reduces performance when rails , sinatra application chained together. how supposed be? as @troelskn has rightly pointed out in comment, both applications competing resources. moving 1 of them

c# - .net How can set the anonymous type for IEnumberable -

i need convert ienumerable dataset. need write common fnction convert ienumberable type dataset. need set anonymous type. here code public static datatable todatatable(object alist) { string assemblyname = "dataaccesslayer"; string classname = "sptblsystempreference_getlistresult"; type objtype = type.gettype(classname + "," + assemblyname); //below line working fine... how can implement objtype in ienumberable ienumerable<dataaccesslayer.sptblsystempreference_getlistresult> objlist1 = (ienumerable<dataaccesslayer.sptblsystempreference_getlistresult>)alist; list<dataaccesslayer.sptblsystempreference_getlistresult> objlist = objlist1.tolist(); datatable dt = new datatable(); if (objlist[0] != null) { dt.tablename = objlist[0].gettype().name; system.reflection.propertyinfo[] propinfo = objlist[0].

iOS simulator - How can I make default simulator as iPhone -

Image
i downloaded latest xcode ios 4.2 version. when i'm testing app in simulator, running in ipad simulator default. how can make simulator default iphone. solution#1 you can remove ipad organizer. haven't tried it, since use both iphone , ipad. solution#2 create keyboard shortcut switch to iphone simulator top menu > project > set active executable > targetname - iphone simulator see these screenshots

BizTalk WCF Service Publishing Wizard to expose schemas as WCF service issue? -

we expose schemas wcf service using biztalk wcf publishing wizard. have bunch of schemas in .dll file. however, when choose request-response operations , selects schema type few schemas select-able in dialog. the schemas not select-able have 2 possible root elements (i.e., both request , response element defined within schema). issue? we using biztalk 2006 r2, visual studio 2005 oops, never mind. when using biztalk wcf service publishing wizard expose shemas, make sure gac .dll containing shemas first..

java - How to convert a Date between Jackson and Gson? -

in our spring-configured rest-server use jackson convert object json. object contains several java.util.date objects. when attempt deserialize on android device using gson's fromjson method "java.text.parseexception: unparseable date". have tried serializing date timestamp corresponding milliseconds since 1970, same exception. can gson configured parse timestamp-formatted date such 1291158000000 java.util.date object? you need register own deserializer dates. i've created small example below, in json string "23-11-2010 10:00:00" deserialized date object: import java.lang.reflect.type; import java.text.parseexception; import java.text.simpledateformat; import java.util.date; import com.google.gson.gson; import com.google.gson.gsonbuilder; import com.google.gson.jsondeserializationcontext; import com.google.gson.jsondeserializer; import com.google.gson.jsonelement; import com.google.gson.jsonparseexception; public class dummy { priv

Accessing the SensorDump API - Android -

has worked on sensordump android app before? i'm trying accelerometer values phone , i've been able dump in csv file on computer. however, i'd add timestamp values , sensordump doesn't provide that. i can't find documentation online ,and wondering if had tried modify it, or if there's other app out there same (i.e. lets me write sensor values onto file, timestamp). thanks! i wrote own sensor dumper, in activity in oncreate: mstarttime = systemclock.uptimemillis() try { f = new filewriter("/sdcard/download/sensorlog.txt"); if (f != null) { f.append("time;value0;value1;value2\r\n"); } } catch (ioexception e1) { log.e(tag, "cannot open sensorlog file.."); } msensormanager = (sensormanager) this.getsystemservice(context.sensor_service); msteplistener = new sensoreventlistener() { @override

c++ - How to style in C? -

in internet there css, how working in c, , c++? for example how can create red box 200px width , height ? there nothing in iso standards these languages deliver sort of functionality. i/o model pretty basic text-only one. platforms such windows or x or gnome or kde provide sort of functionality part of libraries since that's they're meant for.

vba - Recordset close and set to nothing one-liner -

i remember there shorthand syntax commonly used close recordset , set nothing in 1 line used syntax like rst.close := nothing but cannot remember right syntax, out there better memory mine? google couldn't in case. could this? rst.close : set rst = nothing hth

awt - Java: How do I do a "onclick" for TextField? -

i want make text field clear text when clicks it. how can this? on java.awt.textfield can add mouselistener so textfield field = new textfield(); field.addmouselistener(new mouselistener() { public void mouseclicked(mouseevent e) { } public void mousepressed(mouseevent e) { } public void mousereleased(mouseevent e) { } public void mouseentered(mouseevent e) { } public void mouseexited(mouseevent e) { } }); the reason being java.awt.textfield subclass of java.awt.textcomponent (which, in turn, subclass of java.awt.component ). component class has addmouselistener() method. alternatively, can replace mouselistener java.awt.event.mouseadapter has encapsulates of mouselistener , mousewheellistener , mousemotionlistener methods. from javadoc (of mouseadapter ): an abstract adapter class receiving mouse events. methods in class empty. class exists convenience creating listener objects. mouse

.net - XPS Document with Print Ticket not printing correctly -

i trying print xps files, created in .net, several different makes of printer. i have written code create xps , print via printdialog along document level print ticket , works correctly. document want create needs laid out follows: page 1 , 2 printed in duplex page 3 , 4 printed in simplex the whole document needs stapling. at moment can create xps file contains pages. have duplex pages (blank pages after 3 , 4) printer ignores individual page level print tickets. what want create 2 separate documents each own print tickets specify duplexing , combine these xps document contains document level print ticket staples output. although can create document printer ignores document print tickets , prints pages out. the printers testing hp cm4730 mfp , kyocera fs-2020d. does have ideas/code examples solve this.

controlling R output -

i have code: x <- rnorm(10) print(x) is returning output: [1] -0.67604293 -0.49002147 1.50190943 0.48438935 -0.17091949 0.39868189 [7] -0.57922386 -0.08172699 -0.82327067 0.07005629 i suppose r having limit of characters per line or , why splitting result in 2 lines. building service based on output of r. what should in order in 1 line? than better tell r output things in way convenient wrapper; check out string functions paste() , sprintf() , push result output cat() ; instance putting numbers in column like: x<-rnorm(10) cat(paste(x,collapse="\n"),"\n") what outputs just: 0.889105851072202 0.86920550247321 0.817785758768382 -0.0194490361401052 1.13386492568134 0.0786139738004322 0.7431631392675 0.93881227070957 0.534225167458455 1.08265812080696

javascript - jQuery Serialize? -

original post: i have following script serializes nicely. jquery/ajax generated html <ul class="my_list"> <li class="list_item_1"><a href="link1.html">link1</a></li> <li class="list_item_2"><a href="link2.html">link2</a></li> <li class="list_item_3"><a href="link3.html">link3</a></li> <li class="list_item_4"><a href="link4.html">link4</a></li> <li class="list_item_5"><a href="link5.html">link5</a></li> </ul> jquery: $(".my_list").sortable( {update:function(){ alert($(this).sortable("serialize")); } }); is possible similar thing anchor tags url , text? i.e. along lines of: $(".my_list").sortable( {update:function(){ alert($(this).sortable("serial

Where does the code for a new slot created using QT designer go? -

i total newbie qt. i working qt 4.7.1 on visual studio 2008. i trying implement button covered image, , when pressed, image changes. (image-button) trying use qt designer put button in currect layout programmatically handle pressed event (..signal..) change icon on button. create new mainwindow. put tool button in it. switch slots&signals mode. created signal-slot button pressed() new slot1() on window. put code of slot1()? sry english. rly bad, i'll try you. you have use inheritance approach. so: • created form, added connection slot1() on form. • include form in project, compile it. file named ui_formname.h generated. @ bottom of file find code like: namespace ui { class mainwindow: public ui_mainwindow {}; } // namespace ui you have to: 1) create new class, inherit class qmainwindow. 2) in header include generated h-file, add member of type ui::mainwindow, declared in generated .h-file (e.g.: ui::mainwindow* m_puitmp; ). 3) add code: pub

php - Router_Route with optional parameters -

i have following route: $gridroute = new zend_controller_router_route( ':module/:controller/list/:order/:dir/:page', array ( 'module' => 'default', 'controller' => 'index', 'order' => '', 'dir' => 'asc', 'page' => 1, 'action' => 'list' ), array ( 'page' => '\d+' ) ); $router->addroute('grid', $mainroute->chain($gridroute)); i able add optional parameter 'filter' route. use following url: http://example.org/default/list/filter/all/lname/asc/1 or http://example.org/default/list/lname/asc/ or http://example.org/default/list/filter/all either 1 should work. tried place optional parameter in route did not work. ideas? typically, in zend's router, in php, optional parameter p

asp.net - Create dynamic images from WPF User Control inside an HTTP Handler -

i'm using microsoft's pivotviewer control in 1 of silverlight projects. i'm creating jit collection , hoping dynamically generate images based on rendered result of wpf usercontrol. in order generate images i'm using http handler serve images dynamically. can point me in right direction on how might best go this. it's quite mashup of technologies , bit difficult know best begin. thanks in advance. edit : have found guy that's done in asp.net mvc here - if want stream on http stream wpf visual, pseudo code this: rendertargetbitmap bmp = new rendertargetbitmap(width, height, 96, 96, pixelformats.pbgra32); bmp.render([your wpf visual or control instance]); // choose format if want other png pngbitmapencoder png = new pngbitmapencoder(); png.frames.add(bitmapframe.create(bmp)); // stream on web png.save([the web stream, response.outputstream]);

css - Table-layout: fixed - IE8 delay render problem with dynamic content -

i using table style table-layout:fixed solve wrap problems. table content dynamic produced php. when page rendered, many cells content doens't appear! the content appear if pass mouse cell. if resize window manually, cell content appear! what can do? accept solution! can javascript, css, php... thanks! simone it sounds need style headers in first row of table in order establish width each column. <table> <tr> <th style="width:100px;">header 1</th> <th style="width:100px;">header 2</th> </tr> <tr> <td>value 1</td> <td>value 2</td> </tr> </table>

c# - How i can close ChildWindow in silverlight from page? -

i have page.xaml , childwindow. how can close childwindow page.xaml. example click on button in page.xaml. how can childwindow code? name childwindow example x:name="mychildwindow" under page.xaml button click event in code behind put this mychildwindow.close();

ASP.NET Reusable Handlers and Session State -

can asp.net handler (.ashx) implements irequiressessionstate reusable or persist relationship first session used? yes, can reusable. callers pass session state inside httpcontext when invoke processrequest method. method parameters available within scope of each method invocation, not across multiple invocations on different threads. ultimately, depends on processrequest implementation, unless unusual (like store session in member variable , use later during method call), each request use correct session though they're sharing handler instance.

Mobile browsing proxy services. Are they needed today? -

greetings, i work large online e-commerce company. have taken on mobile strategy enterprise customers. solicited various companies have mobile web products. 1 of these products proxy service routes mobile browsers site has been "cleaned" of code unfriendly mobile devices. on 1 hand great service if need target large group of users might on flip phones or still run os symbian. on other hand service creates these generic looking mobile sites horrible on new smart devices. in research have found out services, scrape website, contain errors , missing pages. my company has spent deal of time making sure our ui friendly smaller devices. browsers on phones getting better well. of devices shipping have support flash, multiple media types, smart zoom etc. in world of phones today (particularly in / canada) cutting out huge group of "mobile shoppers" if site cant browsed older phones? imho wants use phone online shopping knowledgeable enough buy better p

regex - How to find a whole word in a string in PHP without accidental matches? -

parsing array of string commands, need know if string contains specific keyword. sounds simple know, problem comes when command keyword may part of word. ex: checksound sound check so need check if current line has checksound, sound, or check command. if use like: if(stristr($line,'sound') == true) then may find checksound before sound , not parse correctly. question : is there way find occurrence of whole word sound , ignore occurrence sound if found part of word checksound? i sure missing simple here. you can use regular expression achive goal. example #2 documentation of preg_match : /* \b in pattern indicates word boundary, distinct * word "web" matched, , not word partial "webbing" or "cobweb" */ if (preg_match("/\bweb\b/i", "php web scripting language of choice.")) { echo "a match found."; } else { echo "a match not found."; } note above example use

css - Using CSS3Pie htc for border-radius in IE8 -

i'm using css3pie htc file enable border-radius in ie8, i'm getting no effect. css is: button { border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; behavior: url(pie.htc); } i've put pie.htc in public root (as done on css3pie demo page), having tried in same folder, using relative uri , absolute uri. the demos working; not code! thanks, adam try adding position:relative; z-index: 0; as suggested here http://css3pie.com/forum/viewtopic.php?f=3&t=10 this question similar 1 posted here: css3 pie - giving ie border-radius support not working?

sql - Joins vs. other methods in mySQL -

i'm self-taught, there obvious gaps in knowledge. when needed able data more 1 table, learned how joins. example, if need voucher number, account number, , balance vouchers table , corresponding address table, i'd this: select v.vouchernbr, v.balanceinit, v.acctid, a.address, a.city vouchers v left join addresses on v.acctid = a.id which return voucher records, , addresses happen exist (in case want return voucher records if there's no corresponding address, hence left join.) i've inherited code appears trying same data (and in case, return correct records) this: select v.vouchernbr, v.balanceinit, v.acctid, a.address, a.city vouchers v, addresses v.acctid = a.id can explain me implications of doing instead of using join. said, in particular case return same data join does, always? it join, implicit one. poor coding practice , should replaced inner join. the problem outdated code is easy accidentally create cross join , code harder maintain (yo

java - BIRT: creating custom dataSetRow / using dataSetRow in js -

scenario have report groups mark && customer (string) price - decimal, id int | mark | [price] | {expresion} | //in price in group of mark | customer | [id] | | price has aggregateon mark , aggregatefunction sum in {expresion} need show rounded value of [price] next rule(script on render) : if( total.sum(birtmath.round(datasetrow["price"])) != birtmath.round(total.sum(datasetrow["price"])) ) { this.getstyle().color ='$color$' } datasetrow["price"] have price`s. need in group mark somtink grouped(datasetrow["price"],"mark") questions : 1: how in javascript function? 2: if not possible , how way ? thank you. i'd try write javascript function in initialize method of report design. passing parameter "price" // inizialize function myroundcheck(obj,price) { if( total.sum(birtmath.round(price)) != birtmath.round(total.sum(price)) ) { obj.getstyle().

python - How to index into a dictionary? -

i have dictionary below: colors = { "blue" : "5", "red" : "6", "yellow" : "8", } how index first entry in dictionary? colors[0] return keyerror obvious reasons. dictionaries unordered in python. if not care order of entries , want access keys or values index anyway, can use d.keys()[i] , d.values()[i] or d.items()[i] . (note these methods create list of keys, values or items, respectively. if need them more once, store list in variable improve performance.) if care order of entries, starting python 2.7 can use collections.ordereddict . or use list of pairs l = [("blue", "5"), ("red", "6"), ("yellow", "8")] if don't need access key. (why numbers strings way?)

Eclipse << Exception in thread "main" java.lang.UnsatisfiedLinkError: no BioCpp in java.library.path >> HELP! -

hi guys i've problems project compilation , run. my java project (called biotesi) tries load library called biocpp.dll, ma doesn't succeed. usin' eclipse. what be? sounds dll not on path if you're using windows. http://java.sun.com/developer/onlinetraining/programming/jdcbook/jni.html

ruby - A More elegant way of doing this? -

i keep saying myself there must better way can't see right now.. ideas? i = 0; lose = 0; win = 0 while < @array.size results = @array[i].results q = 0 while q < results.size if results[q].to_i == 0 lose += 1 elsif results[q].to_i == 1 win += 1 else puts results[q] puts "false" end q += 1 end i+=1 end if win == lose puts "true" else puts "false" end you can use array.each instead of while loops. you can use array.count instead of manually inspecting each array: lose = results.count { |r| r.to_i == 0 } win = results.count { |r| r.to_i == 1 } # or possibly if array can contain wins , losses win = results.count - lose

c# - Ninject.Web.MVC + MVC3 throws StackOverflowException -

i've got simple web application using asp.net mvc3 , ninject.web.mvc (the mvc3 version). the whole thing working fine, except when application ends. whenever ends, kernel disposed, seen in application_end() in ninjecthttpapplication: reflector tells me this: public void application_end() { lock (this) { if (kernel != null) { kernel.dispose(); kernel = null; } this.onapplicationstopped(); } } what happens webserver goes down stackoverflowexception (i tried both iis7 , built-in webserver in vs2010). can assume it's going wrong, haven't written code myself on application end. i figured out kernel knows how resolve ikernel (which returns kernel itself), might cause stack overflow? imagine happens: kernel.dispose() dispose instances in kernel hey! @ this, kernel in kernel. return step 1. in other words, kernel gets disposed, disposes references holds (which includes self-reference), causes

sql server - Quartz.NET : running PHP cmd line results in ACCESS DENIED on php_mssql.dll? -

i have windows service implementing quartz.net scheduling reads scheduled job information xml file, parses cmd line run, , creates scheduled job parsed parameters. i'm using php command line scripts test command line execution of scheduler, , seems kicking off jobs fine, , complete successfully, showing script output in eventlog... the problem every time runs, warning popup displays error: "php startup: unable load dynamic library 'c:\php5\php_mssql.dll' - access denied" if respond ok warning, script seems run fine, if remains on screen, further scheduled php scripts run completion, output empty (i assume held paused job running prior it.)... how can prevent access denied message programmatically? the quartz.net job execution script runs parsed cmd line follows: public void execute(jobexecutioncontext context) { eventlog eventlog = new eventlog(); eventlog.source = "schedulerservicesource"; eventlog.log = &q

Setting Environment variables for nmake through ANT for entire build -

how can set environment variables nmake through ant entire build ? ant can't set environment variables directly. can read them using property task. however, can use exec task execute operating system's environment variable-setting command. since you're using nmake assume you're on windows, offers setx command purpose. <exec executable="setx.exe"> <arg line="_car_park south"/> <arg line="/m"/> </exec> the /m flag sets _car_park variable south in machine's environment ( setx defaults user's environment).

ruby on rails - activerecord find all NOT included in an array -

i have array of team names part of code , want find teams not in array. i've tried following , doesn't work. @team_exclude_list = ['team 1', 'team 2', 'team 3'] @teams = team.where("name != ?", @team_exclude_list) this in rails 3 , googles aren't giving me love. i've never done string field, perhaps work: @teams = team.where("name not in (?)", @team_exclude_list)

linux - PhpMyAdmin install errors -

i've installed phpmyadmin on linux fedora 13 php 5.3.3. following 2 errors: first: on login screen: cannot load mcrypt extension. please check php configuration. -the solutions googled 1 yum install mcrypt , enable in /etc/php.ini extension=php_mcrypt.dll extension=php_mcrypt_filter.dll did that, no go. this second 1 shows when login: the mbstring php extension not found , seem using multibyte charset. without mbstring extension phpmyadmin unable split strings correctly , may result in unexpected results. wondering a) how can fix these , b) affect? thanks- look resource file being loaded examining $_server['phprc'] . value points directory php looks php.ini . doubt it's /etc . then install right package, php-mcrypt .

java - Problem with do while loop in JavaSE -

i'm new programming consider me great newbie. dilemma: want repeat code each time respond yes. use "do while loop" because statement comes first , boolean condition should evaluated @ last. the code: import java.util.scanner; class whysoserious { public static void main(string[] args) { scanner sc = new scanner(system.in); do{ string go = yes; int setone = 0; int settwo = 0; system.out.println("enter 2 numbers: "); setone = sc.nextint(); settwo = sc.nextint(); int set = setone + settwo; system.out.println("what " +setone+ " + " +settwo+ " ? "); int putone = 0; putone = sc.nextint(); if (putone == set) system.out.println("correct!"); else system.out.println("wrong answer - correct answer is: "+set+""); system.out.println("continue?&qu

c - Pointer assignment Problem -

when run above program in gcc complier(www.codepad.org) output disallowed system call: sys_socketcall please clear why error/output comes? int main() { int i=8; int *p=&i; printf("\n%d",*p); *++p=2; printf("\n%d",i); printf("\n%d",*p); printf("\n%d",*(&i+1)); return 0; } what have observed becomes inaccessible after execute *++p=2;why? when *p = &i , make p point single integer i . ++p increments p point "next" integer, since i not array, result undefined.

manifest - Scala: Problems with erasure on overriding equals function for parametrized classes -

i'm having troubles on understanding how use manifests. that's problem: i've creat new parametrized class c , tryed override equals this: override def equals(that:any)=that match{ case that:c[t] => true /*do smth else not relevant*/ case _ => false } of course recieve "warning: non variable type-argument t in type pattern c[t] unchecked since eliminated erasure". tryied using manifests using in many other functions: override def equals(that:any)(implicit manifest:manifest[t])=that match{ case that:c[t] => true case _ => false } but recieved "error: method equals overrides nothing" message. i don't know how fix this. please me? you can't fix it. welcome joys of smooth interoperation java. way improve equals def equals(x: any): boolean write different method. i'm trying convince martin should implement == desugaring differently, aiming @ "def decentequals[t](x: t)(implicit equiv: equiv[t])&quo

c# - string format for numbers or currency? -

i need give comma(,) every thousends. used dataformatstring="${0:#,#}" . working fine. when value 0 . showing $00 . want show $0 . how can that? format = "${0:#,0}";

c++ - Input line by line from an input file and tokenize using strtok() and the output into an output file -

what trying input file line line , tokenize , output output file.what have been able input first line in file problem unable input next line tokenize saved second line in output file,this far fro inputing first line in file. #include <iostream> #include<string> //string library #include<fstream> //i/o stream input , output library using namespace std; const int max=300; //intialization constant called max line length int main() { ifstream in; //delcraing instream ofstream out; //declaring outstream char oneline[max]; //declaring character called oneline length max in.open("infile.txt"); //open instream out.open("outfile.txt"); //opens outstream while(in) { in.getline(oneline,max); //get first line in instream char *ptr; //declaring character pointer ptr = strtok(oneline," ,"); //pointer scans first token in line , removes delimiters while(ptr!=null) { ou

iphone - iOS System Volume Control -

audioservicesplaysystemsound() playing sounds using ringer volume. i want them play according system volume instead. how to? you should use avfoundation framework play sounds. avaudioplayer class.

clone - Cloning subclasses in Java -

i need clone subclass in java, @ point in code happens, won't know subclass type, super class. what's best design pattern doing this? example: class foo { string myfoo; public foo(){} public foo(foo old) { this.myfoo = old.myfoo; } } class bar extends foo { string mybar; public bar(){} public bar(bar old) { super(old); // copies myfoo this.mybar = old.mybar; } } class copier { foo foo; public foo makecopy(foo oldfoo) { // doesn't work if oldfoo // instance of bar, because mybar not copied foo newfoo = new foo(oldfoo); return newfoo; // unfortunately, can't predict oldfoo's actual class // is, can't go: // if (oldfoo instanceof bar) { // copy bar here } } } if have control of classes trying copy, virtual method way forward: class foo { ... public foo copy() { return new foo(this); } } class bar ext

asp.net - building a server control that inherits button and giveing it other click capabilities -

my problem this: want create server control inherits system.web.ui.webcontrols.button gives special capability, mean? want button confiorm button work so: renders page button of lets cancel after user clicks want catch click event (within server control) , after click makeing button not visible , makeing kind of content placeholder (that render server control) visible. content place holder have 2 buttons inside of it: yes , cancel i want programmer adds control able register function click event of yes button. and second cancel confirmation button should make first button appear agian. (i know how in client side time need server events) my question this: how catch click event? want handled inside server control itself. programmer adds control wont have worry needs register click event of "yes" button thank you since want have multiple controls in server control you'll have inherit compositecontrol class , manually add each control , manage differe

C# Design Pattern for 2 classes with same implementation but different base class -

take 2 base classes , b similar preferred distinct. each has sub class (a' , b') add same functionality , members respective classes. there design pattern allow me not have duplicate code in a' , b'? i've looked @ bridge , decorator , can't see how these work. thanks, rob could use composition , refactor shared code class c?

what the best rails way to do the following -

i've rails 3 app displays records db table. want same method check if admin controller used , if add edit delete options table items. example: logged in none admin server/home/list_info some info name address more info name address logged in admin sever/admin/list_info some info name address edit delete more info name address edit delete i've got 2 controllers , 2 view methods, admin method copy edit delete links on end. doesn't seem dry me. people in situation ? many andy i think best way have 1 set of controllers/views , see if current user admin. if yes, show edit/delete links. typically, use devise authentication , cancan authorization. devise provides current_user object, if implement admin? method use like <%= link_to_if current_user.admin?, 'delete', ... %> note: above uses devise, not cancan.

html - Don't keep previously selected value in select box when page is reloaded -

deos know how prevent browser keeping last selected option when client reloads page? the problem when reload page, keeps last selected option, , when select url in address bar , hit enter reset. i want second result whicth means want browser reset select box. please simplest , safest way :) thanks. just set value in javascript. way when page loaded initialized same value. using <option selected="selected"> won't work. in javascript this: document.getelementbyid("selectboxtobereset").options[indextobeselected].selected = true; and jquery helps more: $("#selectboxtobereset").selectoptions("value selected", true); passing true second argument clears selected value. jquery select box tips.

@font-face and jQuery height() for ajax content -

i have situation similar question, need equalize element heights while using @font-face: jquery working out wrong height, due @font-face using $(window).load worked @ first, need load in content dynamically ajax call. there can do? event can tap determine when dynamically loaded content has been rendered, @font-face , all? this turns out non-issue. seems post-load event ajax content behaves window.load would, opposed document.ready.

jQuery Uploads a file, and then submits the form normally -

i hope can make sense of question. i using jquery form plugin + validation works great. but trying accomplish is, 1, upload temp-file manipulating in next step 2, once file has been uploaded, submit form go next step (a new file). so i'm 100% sure how accomplish that, use code. $("#fileupload").validate({ submithandler: function(form) { $(form).ajaxsubmit({ beforesubmit: function() { $('input').attr("disabled", true); $("#uploadresponse").show('slow'); $('#uploadresponse').append("<img src='images/icons/ajax-loader.gif' />"); }, success: function(responsetext, statustext, xhr, form) { $('input[type=submit]').attr("disabled", false); $('input[type=file]').attr("disabled", true);

ActionScript not showing up in Actions - Frame window in Flash CS5 -

Image
in existing fla file, i'm not able find strings within actionscript contained within frames (regardless of frame it's in). example in frame 1 there following code: stop(); but searching 'stop' (without quotes) doesn't turn results. if create new fla file, i'm able find actionscript in keyframes. furthermore, i've noticed "actions - frame" window shows me tree of actionscript in scene, organized frame. isn't happening in first .fla file - can open , edit actionscript frame, tree/index never gets built. has run situation this? first .fla corrupt in way, or there setting allow me find actionscript within frames? thanks! have checked settings in search box? maybe search document based , specific file having trouble has different settings default one. try compare working file "corrupt" file. actionsctipt should enabled.

url - No mapping found for HTTP request with URI in Jboss-Spring integration web project -

hi problem encountered related url mapping quite confusing me. the project "jboss-spring integration". project started without error, keep getting these msg: 8:53:58,959 warn [pagenotfound] no mapping found http request uri [/frontend/portal/afasfas/asdsad] in dispatcherservlet name 'nuslibraries' 18:54:08,992 warn [pagenotfound] no mapping found http request uri [/frontend/portal/afasfas] in dispatcherservlet name 'nuslibraries' web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5"> <display-name>frontend</display-name> <welcome-file-list>

FIFO, Mplayer and php -

how user fifo files in php? want control mplayer, know how pause file [using system("echo pause > /tmp/mplayer.fifo)] don`t know how send command , read output using pure php. see http://php.net/fopen , http://php.net/fprintf , http://php.net/fwrite , http://php.net/fclose .