Posts

Showing posts from April, 2013

coordinate systems - How can I calculate the distance between two points in Cartesian space while respecting Asteroids style wrap around? -

i have 2 points (x 1 , y 1 ) , (x 2 ,y 2 ) represent location of 2 entities in space. calculate euclidian distance between them using pythagoras' theorem , wonderful. however, if space becomes finite, want define new shortest distance between points "wraps around" seams of map. example, if have point (10, 10) , point b (90,10) , , map 100 units wide, i'd calculate distance between , b 20 (out right edge of map , left edge), instead of 80, normal euclidian distance. i think issue i'm using coordinate system isn't quite right i'm trying do, , flat square map more of seamless doughnut shape. suggestions how implement system of nature , convert , forth cartesian coordinates appreciated too! toroidal plane? okay, i'll bite. var raw_dx = math.abs(x2 - x1); var raw_dy = math.abs(y2 - y1); var dx = (raw_dx < (xmax / 2)) ? raw_dx : xmax - raw_dx; var dy = (raw_dy < (ymax / 2)) ? raw_dy : ymax - raw_dy; var l2dist = math.sqrt((dx * dx)

sql server - FIltering on the join? -

is there argument, performance wise, filtering in join, opposed clause? for example, select blah tablea inner join tableb b on b.id = a.id , b.deleted = 0 a.field = 5 as opposed to select blah tablea inner join tableb b on b.id = a.id a.field = 5 , b.deleted = 0 i prefer latter, because feel filtering should done in filtering section (where), there performance or other reasons either method? if query optimizer job, there no difference @ (except clarity others) in 2 forms inner joins. that said, left joins condition in join means filter rows out of second table before joining. condition in means filter rows out of final result after joining. mean different things.

ruby - Spit out a list of the last 10 days in Rails 3 -

i feel should qualify of questions saying brand new rails 3, forgive me newbiness. i've been reading actionview date helpers, cannot figure out how complete simple function. in rails 3, want spit out html list last 10 days. so, instance, today: <li>tuesday, february 8</li> <li>monday, february 7</li> <li>sunday, february 6</li> <li>saturday, february 5</li> <li>friday, february 4</li> <li>thursday, february 3</li> <li>wednesday, february 2</li> <li>tuesday, february 1</li> <li>monday, january 31</li> <li>sunday, january 30</li> it seems simple, cannot figure out. care give shot? <%- date.today.downto(date.today - 9.days) |date| %> <li><%= date %></li> <%- end %>

java - Will other instances of a class be able to access a static variable in another? -

i have class know loaded urlclassloader each instance of it, if have static variable in one, other instances able access it? for example, class myclass loaded classloader , classloader b, , want know if myclass loaded have same static fields myclass loaded b. so basically, following statement true: a.loadclass("myclass").getfield("myfield").get(null).equals(b.loadclass("myclass").getfield("myfield").get(null)); unfortunately @dinesh/@daj's answer incorrect. (@romain's maybe too, wording hard parse.) suppose have class a.b.c , arrange same class gets loaded 2 different classloaders. according specifications, end 2 distinct class objects qualified name a.b.c , , type system perspective 2 distinct types. each of types have different set of static variables. the primary reference jls 4.3.4 - paragraphs 2 , 3. you can infer each reference type distinct (at runtime) have distinct set of statics jls 4.12.3 , jls 8.3

ruby on rails - dynamic nested form always creates an extra blank entry - using formtastic_coocoon -

i'm using formtastic & formtastic_cocoon created nested form. all seems working dynamically adding nested form existing form, 1 exception. i have users , users have entries. when create user, , add entry, end -user - entry (empty) - entry test 1 i should have -user - entry test 1 i'm not sure why blank entry showing up. my models are class user < activerecord::base validates :name, :presence => true has_attached_file :photo has_many :tasks, :dependent => :destroy accepts_nested_attributes_for :tasks, :allow_destroy => true end class task < activerecord::base attr_accessible :entry belongs_to :user end my create controller (i think right controller) def create @user = user.new(params[:user]) if @user.save flash[:notice] = "successfully created user." redirect_to @user else render :action => 'new' end end def create @task = task.new(p

haskell - Override -Werror when installing from Cabal -

i'm trying install nano-hmac-0.2.0 package (a dependency of package want) hackage using cabal , ghc 6.12.1, fails following error: data/digest/openssl/hmac.hsc:1:0: warning: module `prelude' deprecated: using old package `base' version 3.x. future ghc versions not support base version 3.x. should update code use new base version 4.x. <no location info>: failing due -werror. sure enough, package's .cabal file has following line in it: ghc-options: -wall -werror -o2 -fvia-c i'd able override -werror option can install package without manually modifying .cabal file, can't find way work. in particular, tried passing --ghc-options cabal stick -wwarn in ghc's argument list, this: $ cabal install nano-hmac-0.2.0 -v2 --ghc-options='-wwarn' this doesn't want, though; verbose output verifies -wwarn getting added beginning of ghc's argument list, -werror .cabal fil

how to put dynamic button in android useing its position -

how put dynamic button using xml. want fetch position of button xml , place them in screen. what mean dynamic? create xml file called filename.xml, put in. change drawables necessary. bt_return , bt_returnpress <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/bt_return" android:state_pressed="false" /> <item android:drawable="@drawable/bt_returnpress" android:state_pressed="true" /> <item android:drawable="@drawable/bt_return" android:state_focused="false" /> <item android:drawable="@drawable/bt_returnpress" android:state_focused="true" /> </selector> then assign filename.xml background of dynamic button u want.

html5 - How do you achieve this "scrolling and changing multiple background picture" effect? -

i looking @ html5 website, http://www.danhigbie.com , , found "background image's scrolling" fascinating. looked through javascript found no code changing background image. save webpage disk , play around files better.js , better.cs . background scrolling being done in better.js file changing css classes (which defined in better.css )

How to add .Net control in MSAccess 2003 form? -

i have requirement add cardfile control msaccess 2003 form (tab page of tab control). what best method writing in .net??? any suggestions me started?? malcolm you have compile activex control since access 2003 com client , can't run managed code directly. it's little bit involved, here decent tutorial on how that: writing activex control in .net however, if end goal add "cardfile control" assuming talking tab control access form, better off not using .net @ all. use built-in access tab control instead.

how can i get gmail tasks on android -

how can gmail tasks on android? i need gmail tasks please me in browser, go http://gmail.com/tasks . press < menu > , select bookmarks. go ahead , add bookmark tasks site. press < home > return home screen. press < menu > , select add. select shortcut > bookmark. choose bookmark tasks site. new icon instantly appears on home screen, offering quick access tasks. courtesy of http://www.google.com/support/forum/p/google%20mobile/thread?tid=5c70246ca3884f20&hl=en

asp.net - jquery datepicker getting dateText out of onSelect event -

want datetext datepicker out of onselect event, in other function: example: when in onselect event: datetext equal 08.02.2011 $('#datetime').datepicker("getdate") returns: tue feb 08 2011 00:00:00 gmt+0300 (russia standard time) so can not enter controller properly datepicker getdate method return date object ( date object reference ) need convert it function convert(date) { return date.getdate() + "."+ (date.getmonth()+1) + "." + date.getfullyear(); } you can try overwrite tostring method of date object, don't know how work datepicker plugin. date.prototype.tostring = function() { return this.getdate() + "."+ (this.getmonth()+1) + "." + this.getfullyear(); }

javascript - How to subtract 2 hours from user's local time? -

can give me simple javascript code block allow me display local time minus 2 hours? subtract date object var d = new date(); d.sethours(d.gethours() - 2); complete reference list date object

javascript - Submit button onClick firing on form load -

i creating javascript form on webpage on fly. when form created triggers onclick event submit button (and result triggers validation function have created form). how prevent onclick event firing when form created? here relevant code snippets: var myform = document.createelement('form'); myform.action = 'http://www.urlhere.com'; myform.method = 'post'; var mysubmit = document.createelement('input'); mysubmit.id = 'submitbutton'; mysubmit.type = 'submit'; mysubmit.value = 'book now'; myform.appendchild(mysubmit); mylayer.appendchild(myform); mysubmit.onclick = validatenow(); this validation function: function validatenow() { alert('validating form'); } this problem: mysubmit.onclick = validatenow(); above not assign function reference, runs validate function. try this: mysubmit.onclick = validatenow; or this: mysubmit.onclick = function () { validatenow(); };

netbeans - Java Ui panel added at run time but it takes lot of time -

hello, in software application used netbeans ui panel added @ run time not geeting satisfactory loading speed of panel,how can increase loading of panel @ runtime method or way of coading might imporve loading speed thanks in advance isolate issue removing items (commenting code out), until speed looking , find problem. surprising panel, imagine root cause sort of database access or file loading issue. next time build gui hand instead of using netbeans.

pygtk - How to draw any GTK widget on top of Cairo surface -

i save looks of gtk window, , buttons , other widgets contains png or pdf file. cairo supports drawing on such surfaces. somehow ask gtk widget draw on cairo surface? code sample appreciated, since newcomer both gtk , cairo. python language of choice. in c, can put buttons , widgets in gtkoffscreenwindow using gtk_widget_reparent() , use gtk_offscreen_window_get_pixbuf() render onto gdkpixbuf , can save file. sorry don't have python code, don't think offscreen window available in pygtk yet.

php - How to perform Subversion's switch in PHPStorm -

is possible make switch subversion command interface of phpstrom? i'm searching , searching , can't find it. unsure of version of php storm you're using but... right click project, subversion > update directory... you must hold shift if don't see ellipses because unchecked "display options dialog when these commands invoked" option (see comments below).

Bash/sed: Concat multiple line plus eat up leading spaces for sublines -

i want parse makefiles containing lines these: files=file1.c \ file2.c \ file3.c \ now want parse beast result this: files=file1.c file2.c file3.c means should concat line 1 line , eat leading spaces. managed concat lines using sed call: sed -e ':loop;/\\$/n;s/\\\n/ /;t loop' which results in files=file1.c file2.c file3.c but yet did not manage eat leading spaces line 2 , line 3 of example. thanks help, roland btw: using gnu sed version 4.1.5 here. this seems work me: sed -e ':loop;/\\$/n;s/\\\n/ /;t loop' -e 's/ \+/ /g' < makefile thanks dennis williamson pointing out don't need -r if escape + \ . notes doesn't work when last character before end of file \ . however, that's unlikely in real example, since there's no point in doing line continuation if there's nothing afterwards. e.g. works fine with: files=file1.c \ file2.c \ file3.c ... instead. i'v

c++ - Stop calling overloaded new and delete operator by stl containers -

i developing memoryleak tool. in overloading new , delete operator. working fine. code creating tool around 15000 lines. cannot change existing code can invoke memoryleak tool function existing code. existing code having stl containers (like list, map, stack etc). stl container call new , delete operator allocate or deallocate memory. want stl container should call new , delete operator in not overloaded new , delete. ex: int *iptr = new int[10] ----> should call overloaded new[] delete [] iptr -------------> should call overloaded delete[] map.insert(10) -------------> should call default new[] ( in new.h) map.erase() ---------------> should call default delete[] ( in new.h) how can it? aprreciated. sorry forgot mention replacing new , delete following macros: #define new debug_new #define debug_new trackmemory(__file__, __line__) ->* new #define delete trackdelete(__file__, __line__); delete here trackmemory used track memory , new used allocate memory

c++ - Lua garbage collection and C userdata -

in game engine expose vector , color objects lua, using userdata. now, every locally created vector , color within lua scripts, luas memory usage goes bit, doesn't fall until garbage collector runs. the garbage collector causes small lagspike in game. shouldn't vector , color objects deleted if used arguments? example like: myobject:setposition( vector( 123,456 ) ) they aren't right - memory usage of lua rises 1,5 mb each second, lag spike occurs , goes 50kb. how can solve problem, solvable? in lua, way object userdata can deleted garbage collector. can call garbage collector directly, b mitch wrote (use lua_gc(l, lua_cgstep, ...) ), there no warranty temporary object freed. the best way solve avoid creation of temporary objects. if need pass fixed parameters methods setposition , try modify api accepts numeric arguments, avoiding creation of temporary object, so: myobject:setposition(123, 456)

objective c - Deep Trouble with values not inserting to sqlite database -iPhone -

i have multiple view controllers, registrationviewcontroller , contactsviewcontroller , addnewcontactsviewcontroller, etc. i have below code in registrationviewcontroller databasecrud *database = [[databasecrud alloc] init]; nsmutablestring *registrationquery=[nsmutablestring stringwithformat:@"insert barvalues values ('%@','%@','%@','%@','%@','%@')",[name text],[emailaddress text],[mobilenumber text],[password text],[country text],@"0"]; nslog(@"registrationquery %@",registrationquery); [database updatenewregistration:registrationquery]; [database release]; databasecrud *database1 = [[databasecrud alloc] init]; nsmutablestring *registrationquery1=[nsmutablestring stringwithformat:@"insert contacts values ('1234','1234')"]; nslog(@"registrationquery %@",registrationquery1); [dat

android - PhoneGap - Is online video streaming possible? -

i have referred phonegap documentation media , stated: "the media object provides ability record , play audio files on device." i wonder whether video streaming (rtsp) possible or not phonegap framework? trying out on android. any suggestions highly appreciated. yes, streaming device possible. normal website/webapplication. i don't know if it's done yet, audio stream script: http://www.joeldare.com/wiki/play_an_mp3_audio_stream_in_phonegap i hope started. edit: maby started: http://groups.google.com/group/phonegap/browse_thread/thread/584028fe07b0c869/47a1af617c94540a?#47a1af617c94540a

css - Change cursor over HTML5 Canvas when dragging the mouse -

i have made paint brush type of application using canvas tag . wanted when mouse on canvas cursor changes , <canvas id="draw" style="cursor: url(image/pencil.cur)"> i have accomplished cant figure out how shall change cursor while drag mouse drawing image use :active css pseudo-class change cursor when mouse button down on element: #draw:active { cursor: url(image/pencil.cur); } working example: http://jsfiddle.net/nxv63/

flex - xml nodes will not delete despite calling "delete" -

i'm trying use delete keyword remove nodes xml file , plain won't work. here's stripped down example of i'm working with. every node has child named "deleteme". if value equal 1 want remove xml file. if else want leave be. delete method deffinately gettig call it's having no effect. <?xml version="1.0" encoding="utf-8"?> <stuff> <i> <deleteme> 0 </deleteme> </i> <i> <deleteme> 1 </deleteme> </i> <i> <deleteme> 0 </deleteme> </i> </stuff> actionscript var xmllist:xmllist=_sourcexml.i; (var j:int=0; j < _xmllist.length(); j++) { if (xmllist[j].deleteme== 1) { delete xmllist[j]

junit - Recompiling sources with a test specific jar -

i have multimodule project dependent on rather large thirdparty library/apis. not possible run automated junit tests actual library, since apis interact system external management of dev environment. workaround, created classes mocked interfaces/apis junits. use eclipse our ide development, run junits, move jar higher in classpath, recompile, run our junits, , works great. looking similar solution moving maven. basically, after building our code, need rebuild of again using mock jar run junit tests. goes across modules of application. tried adding jar in test scope, used compiling test classes; sources classes still compiled real jar. however, fails @ runtime since our mock jar not match signatures of real jar (so hot swap of jar doesn't work; making signatures match large undertaking). source needs recompiled jar. so appears there 2 options: 1) make standalone test module somehow pulls in source modules code , recompiles using mock jar , runs tests or 2) each modul

c# - Filtering Sql table Data in Linq -

i m new linq, m searching articles using dbsearchdatacontext db = new dbsearchdatacontext(); object q = b in db.articles b.tags.contains(val) | b.newstitle.contains(val) | b.englishcontent.contains(val) select b; i can not exclude results category = video or photos please me exclude category value "videos" or "photographs" dbsearchdatacontext db = new dbsearchdatacontext(); object q = b in db.articles (b.tags.contains(val) || b.newstitle.contains(val) || b.englishcontent.contains(val)) && !( b.somecategorylist.containts("videos") || b.somecategorylist.contains("photos") ) select b;

ipad - how to dismiss a modal view controller presented as "Form Sheet" when a touch occur outside the form sheet? -

i have view controller (with uiwebview) present in form sheet style. have put "done" button in uitoolbar of view in view controller have dismissed. but, since presenting in "form sheet" style leaves plenty of unused space outside view controller's view... wandering.. there way detect touch outside view? in "grayed out" area? in advance on ios 4.2, view hierarchy of navigation controller based app modal form sheet follows during viewwillappear: . once modal view appears, uitransitionview has been replaced uidropshadowview contains modal view hierarchy. uiwindow uilayoutcontainerview (regular hierarchy) uidimmingview uitransitionview apple warn against relying on subviews of built in views, these considered private , may change in future releases. potentially break app. approach 1 can insert transparent view between last 2 subviews of window, , have respond touch events dismissing modal form. this implementation checks

c++ - use file or class for documenting classes in doxygen? -

this surely noob question, can't find answer in doxygen documentation. i'm not sure whether using: @file or @class when documenting header files. the reason if put file, comments appear in files tab only, not in classes tab (per each). for cpp it's ok, use file , it's good, if use both file , class in header (file @ beginning , class right before start of class declaration) duplicated entries class in generated documentation... what i'm doing wrong? suggestions? ideas? regards, alex edit: run new problem now. in order avoid circular dependecies declare class twice in header file (probably not best way avoid circular dependencies works me), instance: #ifndef eu_sofia_kpi_common_abstractthread_decl #define eu_sofia_kpi_common_abstractthread_decl namespace eu_sofia_kpi_common { class kpi_cpp_api abstractthread; } #define eu_sofia_kpi_common_abstractthread_decl_end #endif eu_sofia_kpi_common_abstractthread_decl #ifdef eu_sofia_kpi_common_a

r - How do I add a row to a data frame with totals? -

i have data frame add additional row totals values columns. example, let's have data: x <- data.frame(language=c("c++", "java", "python"), files=c(4009, 210, 35), loc=c(15328,876, 200), stringsasfactors=false) data looks this: language files loc 1 c++ 4009 15328 2 java 210 876 3 python 35 200 my instinct this: y <- rbind(x, c("total", colsums(x[,2:3]))) and works, computes totals: > y language files loc 1 c++ 4009 15328 2 java 210 876 3 python 35 200 4 total 4254 16404 the problem files , loc columns have been converted strings: > y$loc [1] "15328" "876" "200" "16404" i understand happening because created vector c("total", colsums(x[,2:3]) inputs both numbers , strings, , it's converting elements common type of vector elements same. same thi

system requirements - permission level on a machine to develop sp 2010 using visual studio and SP 2010 designer -

here scenario: moving development environment servers our local machines. our local machines have sql server, sp 2010 server, sp 2010 designer, , visual studio 2010 on them. need technical specs stating administrator permissions required perform development , debug tasks, exists? have been trying find on have come short. granted assuming admin permissions required perform these tasks, don't see how wouldn't. yes, need administrative permissions on local machine. instance need run visual studio 2010 using elevated privilegies able debug solution , need admin privs able deploy farm solutions. for sandboxed solutions, there no need admin privs though.

video processing - Which colour space should I apply Image sharpening filter? -

i trying apply image sharpening 2d filter kernel(laplacian) on image in proprietary image/video processing pipeline(from camera raw final jpeg/mpeg). plan perform 2d convolution of laplacian kernel 2d image array sharpen image. questions :- what suitable colour space apply image sharpening filter best output image quality a) should apply filter on each component(r,g, & b) in rgb space? or b)should apply in yuv space , on y component (or should applied on u , v components)? any pointers useful. edit: asked here, since plan programatically, myself. no external tool. thank you. -ad. probably y in yuv. in rgb have careful not introduce color fringing.

jquery - Click on <option> doesn't fire the click event when using ":input" Selector in FX and Opera -

i got this test case script checks wether input element has been clicked or not. if click on select field script fires true in browsers. if click on options script fires false in firefox , opera, true in chrome, ie , safari. why? i came solution seems solve problem: var isinput = $(e.target).is(':input') || $(e.target).is('option'); would correct solution or have better suggestion? thanks in advance!

authentication - CakePHP Auth Component Blanks out Password -

i have following code login view: <?php echo $session->flash('auth'); echo $this->form->create('user', array('action' => 'login')); echo $this->form->input('email'); echo $this->form->input('password'); echo $this->form->end('login'); ?> this generates following html: <div id="authmessage" class="message">login failed. invalid username or password.</div> <form id="userloginform" method="post" action="/control/users/login" accept-charset="utf-8"> <div style="display: none;"><input name="_method" value="post" type="hidden"></div> <div class="input text required"> <label for="useremail">email</label> <input name="data[user][email]" maxlength="2

Multiple jQuery events in $(function () { ... only the first one works -

i have multiple .click() events page, first 1 executes expected. $(function () { $("#delete").click(function () { $(this).hide(); $("span.hconf").show(); }) $("#div_conf_true").live("click", function () { $.post("/u:" + $("span.username").text() + "/delete/"), { url_id: $("#div_conf_true").attr("u"), uname: $("span.username").text(), complete: window.location.reload(true) } }) $("#div_conf_false").live("click", function () { $("span.hconf").hide(); $("#delete").show(); }) }) originally #div_conf_* events .click(function (){ events, read dom changes unbind these handlers, tried .live, still didn't work. need in script make 3 click events accessible through dom changes? i new jquery pardon if has obvious answer. edit: neither

C++: is malloc equivalent to new? -

possible duplicate: what difference between new/delete , malloc/free? hi guys noob in c++, want know whether memblock = (char *)malloc( currentbytelength); is equivalent memblock = new char[currentbytelength] in c++. memblock = (char *)malloc( currentbytelength); memblock = new char[currentbytelength]; no difference now. if replace char int , yes, there difference, because in case, malloc allocate memory of size currentbytelength , while new allocate memory of size size(int) * currentbytelength . very careful. also, if type mention in new expression, user-defined type, default constructor called currentbytelength number of times, construct objects! for built-in types, there no constructor!

configuration - Eclipse OSGI config: relative paths and/or @config.dir-like substitutions? -

in rcp app, point property ( osgi.java.profile ) file, , prefer using paths relative installation , config dir. is there definitive spec on kind of variables supported in config.ini? @config.dir seems supported, there references in builtin, , it's mentioned typical example (e.g this answer ) however, looking @ docs eclipse help/ runtime options , mentions few "symbolic locations" @user.home; seems limited , doesn't include @config.dir. have dug org.eclipse.osgi sources well, , found no references (i did find locationmanager , hard coded variable substitutions @user.dir & co). can refer arbitrary system properties there in way? is @config.dir special case, handled p2? update: seems case.. looking @ eclipse sdk, .. configuration dialog shows @config.dir unresolved, taken literally equinox.. thanks hints. i'm late party, others in future. starting eclipse 3.8/4.2 (june 2012), can substitute java properties , environment variables co

jsp - Get URL of page requested that caused a 404 -

how url of page requested caused 404 error? for example, type go http://example.com/path/does/not/exist/index.jsp have custom 404 page how go retrieving url mentioned above can display message similar "the url http://example.com/path/does/not/exist/index.jsp not exist"? if forward used go error page, can obtain original request url request.getattribute("javax.servlet.forward.request_uri") or el ${requestscope['javax.servlet.forward.request_uri']}

jquery - Calling webservice with JqueryMobile won't work -

can tell me problem in code: $('#callajax').live('click', function (event) { // $("#resultlog").html("working...."); $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "hello.asmx/helloworld", data: "{}", datatype: "json", success: function (msg) { alert(msg); //$("#resultlog").html(msg); } }); // end of ajax $("#resultlog").ajaxerror(function (event, request, settings, exception) { $("#resultlog").html("error calling: " + settings.url + "<br />htpp code: " + request.status); }); }); // end of click some code in in html file <input id="callajax" type="button" value="call ajax" /> <div id="resultlog"></div> here web-service: using

iphone - Interface Builder: Is there a way to show the on-screen keyboard? -

i want check iphone interfaces designed in interface builder ok when on-screen keyboard shown. know how set 'simulated user interface elements' such top , bottom tab bars on or off. is there similar on-screen keyboard? thanks! you start horizontal guide (editor > add horizontal guide) 216 px botton. that's how high keyboard is.

Jquery .post() method problem -

i have following jquery function should post memberid variable.and want catch in add_comment.php file $memberid = $_request['memberid'] returns null. $('a.comment').die("click").live("click", function(e){ var getpid = $(this).parent().attr('id').replace('commentbox-',''); var comment_text = $("#commentmark-"+getpid).val(); if(comment_text != "write comment...") { $.post("lib/actions/add_comment.php?comment_text=" +comment_text+"&post_id="+getpid,{ memberid : 5 }, function(response){ $('#commentposted'+getpid).append($(response).fadein('slow')); $("#commentmark-"+getpid).val("write comment..."); }); } }); you need url-encode (with encodeuricomponent ) comment_text

What are all these DLLs in the Castle ActiveRecord 3.0 beta? -

this list of dlls in castle activerecord 3.0 beta. know these do? ones required new project, , ones optional? antlr3.runtime.dll castle.activerecord.dll castle.activerecord.web.dll castle.components.validator.dll castle.core.dll iesi.collections.dll log4net.dll nhibernate.bytecode.castle.dll nhibernate.dll nhibernate.search.dll remotion.data.linq.dll antlr3.runtime.dll : used hql parsing in nhibernate remotion.data.linq.dll : used base nhibernate linq implementation. iesi.collections.dll implements iset always log4net.dll : logging always nhibernate.search.dll : integrates nhibernate lucene.net castle.components.validator.dll : underlying validation implementation of activerecord castle.core.dll : common stuff , dynamicproxy castle.activerecord.web.dll : implements web session scopes. decoupled castle.activerecord.dll allow framework client profiles. nhibernate.bytecode.castle.dll : nhibernate proxy implementation uses dynamicproxy.

How do I use jquery to total fields in rows for a variable number of rows -

i trying add option fields on row total field on row, using jquery. can't use ids because there variable number of rows, created clone user needs them. <tr> <td><input name="option_1[]" type="text" class="integer add_to_total" /></td> <td><input name="option_2[]" type="text" class="numeric add_to_total"/> </td> <td><input name="option_3[]" type="text" class="numeric add_to_total"/> </td> <td><input name="total[]" type="text" class="numeric is_total" /> </td> </tr> i thought of attaching change event input fields 'add_to_total' class , using sibling function add 'is_total' class. can't syntax right: $(".add_to_total").change(function() { var line_total = 0; line_total += $(this + " .add_to_total").siblings().val(); $

c++ - What is this odd thing after the colon in a C++constructor definition? -

possible duplicate: what weird colon-member syntax in constructor? i need know code means: cman::cman() : m_pthread (null) //m_pthread pointer other class { } i don't understand code. null mean ? can use regular constructor ? it says initialize m_pthread null before code inside constructor executed.

restructuredText, docstring and python interactive shell -

i using restructuredtext document code, nice offline html pages means of epydoc. results brilliant. drawback when use python interactive shell, help() function not parse rest metadata in documentation strings, , instead displays whole thing is. is there way have help() minimal parsing of docstrings? i don't expect rendering of italic fonts or hyperlinks, @ least minimal cleanup increase readbility. the help() function gets added builtin namespace site module, can customize creating sitecustomize.py module somewhere on path (apparently it's kept in site-packages). then in sitecustomize.py file add whatever customizations want. you handle couple of ways: if want change (apparent) behavior of help() function itself, wrap function in decorator, like: def help_wrapper(func): def inner(*args): results = func(*args) return your_cleanup_function_here(results) = help_wrapper(help) i prefer different solution, because there's no t

How can I convert VB6 code to C#? -

does know way convert vb6 code c#? is there tool can me? visualstudio offers (or @ least offered) wizard conversion vb6 vb.net (which converted c# bit of work, possibly helped #develop's vb.net <-> c# converter), when last used it, non-trivial there lot of manual work needing done suspect you're better rewriting or porting hand if large and/or important application.

ASP.NET Multiple Themes in One Site -

i have app_themes directory, , master pages asp.net website. can use 2 different themes based on master page? msdn has article asp.net master pages , themes you cannot directly apply asp.net theme master page. if add theme attribute @ master directive, page raise error when runs. however, themes applied master pages under these circumstances: if theme defined in content page. master pages resolved in context of content pages, content page's theme applied master page well. if site whole configured use theme including theme definition in pages element (asp.net settings schema) element. in addition above can see section themes , skins . can change theme programmatically example msdn protected void page_preinit(object sender, eventargs e) { switch (request.querystring["theme"]) { case "blue": page.theme = "bluetheme"; break; case "pi

java - Disable popup menu on a JTable -

i creating table popop menu jtable table = new table() table.addmouselistener( new mouseadapter() { public void mousereleased(mouseevent e) { if (e.ispopuptrigger()) { jtable source = (jtable)e.getsource(); int row = source.rowatpoint( e.getpoint() ); int column = source.columnatpoint( e.getpoint() ); if (! source.isrowselected(row)) source.changeselection(row, column, false, false); popup.show(e.getcomponent(), e.getx(), e.gety()); } } }); i want able enable/disable menu call, tried this: table.setenabled(false) but menu still pops up.. call should do? you have boolean inside of class creating table called tablemenuenabled. should able set tablemenuenabled true or false planning on calling table.setenabled(false). there code change to: table.addmouselistener( new mouseadapter() { public void mousereleased(mouseevent e) { if (tablemen

c - How can I make a user provide its own function in my library? -

i writing static library avr mcu. using avr-gcc , avr libc. of library functions use spi communicate device. however, spi communication not done same way on avr mcus (not of them have same registers concerned). can done big-banging. thus, want user provide own spi routine, specific application. how can this? should library functions take callback function additional argument? should have global variable within library acting spi handler? should make function external (using extern )? thank you, the simple , straightforward solution declare appropriately named extern function. lets compile library without extern function yet existing. neither or users able link complete executable without providing appropriate function. i've used approach myself , recommend it. avoids unnecessary complications, uses nothing isn't absolutely fundamental c programming environments, , importantly obvious errors flagged @ build time not @ run time (you won't runtime crashes un

cultureinfo - Culture sensitive ParseFloat Function in JavaScript? -

do have suggestion writing culture sensitive parsefloat function in javascript, when have string 100,000.22 in culture format parse float function returns 100000.22 whereas if enter 100.000,22 in swedish culture returns 100000.22 in float? i've improved mwilcox' function handle values withous separators. function parsefloatopts (str) { if(typeof str === "number"){ return str; } var ar = str.split(/\.|,/); var value = ''; (var in ar) { if (i>0 && i==ar.length-1) { value += "."; } value +=ar[i]; } return number(value); }

c++ - Tool or script to set the align rules for my code or vim editor -

i want align declarations of variables, object doesnt matter in code. eg. int i; for(...){...} short j; instead of me going , aligning declarations of , j, can restrict variable declaration should start @ particular column number in vim. if planning declare variable, should go , start respective column. it sounds you're looking correctly indent code, not move variable declarations particular column. can done natively = command, indent given lines (unless equalprg option set). example, indent lines in file, use: gg=g which move top of file, indent lines until bottom of file. indentation in vim more complex this, supports autoindent, tabstops, shiftwidth, different indenting rules different file types, etc. details, see vim wiki .

.htaccess - RewriteRule to redirect with url that got parameters -

i trying use rewriterule inorder redirect form x page y page. x page got 2 parameters > products.php?product=$1&page=$2 (myweb.com/products.php?prod...) y should $1/$2/ (myweb.com/$1/$2/) i tried 1 > options +followsymlinks rewriteengine on rewritebase / rewriterule ^products.php?product=(.*) $1/ [r=301,l] just testing, , similiar codes > /$1/ instead $1/ , $1 tried use rewritecond query_string nothing worked.... ofc there's continue htaccess > rewriterule ^(.*)/$ $1.php [l] and more rules not relevant (i think) can me please? thanks. edit: after massive searches found answer! answer: rewritecond %{query_string} ^product=(.*)$ rewriterule ^test.php$ %1/? [r=301,l] now explanation: first of all, added rewritecondition match query string. second remove query string rewrite rule , $ = continue (the query string). needed add ? (question mark) @ second part of rewriterule > %1/? question mark mean dont want preserve query string in new u

java - Event listener on view in tabs when not extending TabActivity -

i have android app extends mapactivity, can't extend tabactivity. inflating content of tabs dynamically, , looks good. the problem i'm running in nullpointerexception when trying bind event listeners views inflated tab past first tab. example: mybuttonintab2 = (button)this.findviewbyid(r.id.mybuttonintab2); mybuttonintab2.setonclicklistener(new onclicklistener(){ public void(view v){ ///blah blah blah } }); if "inflating content of tabs dynamically", should calling findviewbyid() on result of inflate() call, widgets in tab.

c# - Getting substring for string -

i have string of format [00:26:19] completed 80000 out of 500000 steps (16%) from want 16 part. should search ( , % , portion in between, or wiser set regex query? it depends on how variable expect input string (the "haystack") be, , how variable expect target pattern (the "needle") be. regexes extremely useful describing whole class of needles in largely unknown haystack, they're not right tool input that's in static format. if know string like: "[a:b:c] completed d out of e steps (f%)" where 1) a-f variable portions, , 2) a-f numeric, need little string manipulation: int getpercentage(string str) { return int.parse( str.substring( str.indexof('(') + 1, str.indexof('%') - str.indexof('(') ) ); } the key question here is: "are presence of ( , % sufficient indicate substring i'm trying capture?" is, occur in 1 position? if rest

Share using Facebook C# SDK -

i new facebook c# sdk. hope able give me guidance. i able share content on site on facebook. here's do: on site, when user clicks 'share on facebook', send few pieces of information -- thumbnail image, title row, , content facebook wall. i have seen other sites seemlessly. hoping sdk can to. i using facebook 4.2.1 sdk. thanks in advance help. steve you can find example on how , many other things here: http://facebooksdk.codeplex.com/wikipage?title=code%20examples&referringtitle=documentation here code: var client = new facebookclient("my_access_token"); dynamic parameters = new expandoobject(); parameters.message = "check out funny article"; parameters.link = "http://www.example.com/article.html"; parameters.picture = "http://www.example.com/article-thumbnail.jpg"; parameters.name = "article title"; parameters.caption = "caption link"; parameters.description = "longer descrip

Problem with <a> tags in HTML + CSS styling -

when use <a> tag defaults linked text underline, naturally thought used font-style:normal; doesn't seem working me anymore, maybe it's version of firefox or firebug??? here's current source code, simplest test case: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>test dummy</title> </head> <body> <a style="font-style:normal;" href="login_page/login.html">login</a> </body> </html> unfortunately code not work either, login appears underlined. edit: original author meant underline wrote italics if mean underline, correct way take underline off be: <a style="text-decoration: n

clojure - What is causing this NullPointerException? -

i'm using project euler questions me learn clojure, , i've run exception can't figure out. nillify , change-all defined @ bottom reference. (loop [the-vector (vec (range 100)) queue (list 2 3 5 7)] (if queue (recur (nillify the-vector (first queue)) (next queue)) the-vector)) this throws nullpointerexception, , can't figure out why. part of code can see could throw such exception call nillify, doesn't seem queue ever gets down 1 element before exception thrown---and if queue become empty, that's if statement for. any ideas? "given vector, value, , list of indices, return vector w/everthing @ indice=value" (defn change-all [the-vector indices val] (apply assoc the-vector (interleave indices (repeat (count indices) val)))) "given vector , val, return vector in entries indices equal multiples of val nilled, leave original untouched" (defn nillify [coll val] (change-all coll (r

c++ - Why can't Visual Studio find my DLL? -

this question has answer here: how set path dll file in visual studio? 5 answers in visual studio 2010, under vc++ directories > executable directories , have specified path glew32d.dll . however, when run executable, still complains. on other hand, if copy dll local folder , run executable then, doesn't complain. can please tell me how fix this? also, why visual studio not recognizing path? update scenario: use template project use starter code lot of projects. template depends on glew32d.dll. store dependent dlls in common bin folder. hoping reference folder , visual studio read dlls there, instead of me having copy dlls everytime. way handle this? specifying path dll file in project's settings not ensure application will find dll @ run-time. told visual studio how find files needs. has nothing how program finds needs, once built. pla

google maps - Geocoding - the should I use API or database? -

i need users able regularly geocode addresses, not onto map - need able translate address set of lat/long coordinates site can react accordingly. it seems google doesn't want use geocoding service unless plotting on map. on other hand, want make sure service reliable , last long time. i'd consider downloading kind of address database , running requests myself if knew find it. any ideas? a alternative google geocoding api simplegeo (no affiliation). more liberal when comes terms of service, meaning have fewer restrictions of can data. on other hand, remember quote founder saying non-us data not on same level (or better) than, example, data google.

Agile language for 2d game prototypes? -

occasionally ( read: when fiancé allows ) prototype different game or game-like ideas have. use java or c# (not xna yet) because languages have practice with. learn more suited agile development; language in easier knock out quick prototypes. at job have been working looser (weak/dynamically typed) languages, python , groovy, , think similar fit looking for. so, question is: what languages (and framework/engine) rapidly developing prototypes of 2d game concepts? a few notes: i don't need blazing fast bitcrunching performance. in case prefer ease of development on performance. i'd use language healthy community, me means fair amount of maintained 3rd party, libraries. i'd language cross-platform friendly, work on variety of different operating systems , portable minimum effort. i can't imagine myself using language out decent options debugging , editor syntax highlighting support. note: if aware of java or c# library/framework think streamlines produci

javascript - Rewriting a URL if it 404's -

first timer here nice :3. i attempting write jquery function rewrites amazon url's include affiliate tags, similar stackexchange twist. the main differences attempting user closest amazon store - e.g. amazon.de - german visitors. due amazon's asin's differing in countries first want check new link, if 404's don't want direct visitor there [1] here code selects links amazon.com, grabs asin number , writes shortlink product including affiliate tag. var tld_table = {'gb' : ".co.uk",'de' : ".de",'cn' : ".cn",'au' : ".ca",'it' : ".it",'fr' : ".fr",'ca' : ".ca",'jp' : ".jp",}; var country = $.cookie("countrycode"); //$.cookie http://plugins.jquery.com/files/jquery.cookie.js.txt var tld = tld_table[country] || '.com'; var regex = regexp("http://www.amazon.com/([\\w-]+/)?(dp|gp/product)/(\\w+/)?(\

java - flex : redirect from jsp page -

i calling page.jsp flex application using http, checking authentication on jsp page.now if user valid should redirect page2.jsp, , if user invalid user should redirect page3.jsp, want redirect jsp page not mxml page. how should this? forget page.jsp , use javax.servlet.filter mapped on url-pattern of /page2.jsp , following job in dofilter() method: if (user valid) { chain.dofilter(request, response); // continue request. } else { response.sendredirect("page3.jsp"); // redirect page3.jsp. } then let flex app call page2.jsp .

regex - PHP regular expressions exact data inside brackets -

i have string western australia 223/5 (59.3 ov) i split string , extract following informations regular expressions $team = 'western australia' $runs = 223/5 $overs = 59.3 issue is, format of text varying, may of follwing western australia 223/5 (59.3 ov) australia 223/5 (59.3 ov) kwazulu-natal inland sri lanka v west indies any (like possible have in single regexp) appreciated.. if (preg_match( '%^ # start of string (?p<team>.*?) # number of characters, few possible (--> team) (?:\s+ # try match following group: whitespace plus... (?p<runs>\d+ # string of form number... (?:/\d+)? # optionally followed /number ) # (--> runs) )? # optionally (?:\s+ # try match following group: whitespace plus... \( # ( (?p<overs>[\d.]+) # number (optionally decimal) (--> overs)

Getting Error Invalid Binding Path in SIlverlight -

i have class class : [datacontract] public class { [datamember] public string name{ get; set; } } i inheriting class in class b : [datacontract] public class b : { public b() { name = "me" } } and in ui section bind object of class b control , set binding of control below : //this code throws error :invalid error binding = new binding{path = new propertypath(objectb.name),mode = bindingmode.twoway} edit : value of property guid . "-" in guid causing error ? new propertypath(objectb.name) should be new propertypath("name") and set source = objectb so, should be: binding = new binding { source = objectb, path = new propertypath("name"), mode = bindingmode.twoway }

Options for offscreen rendering on Android with OpenGL ES 1.0? -

i'm working on implementing picking opengl game i'm writing android. it's using "unique color" method of drawing each touchable object solid color unique each object. user input reads glreadpixels() @ location of touch. i've gotten coloring working, , glreadpixels working, have been unable separate "color" rendering main actual rendering, complicated use of glreadpixels. supposedly trick working render second scene (for input) offscreen buffer, seems bit problematic. i've investigated using opengl es1.1 fbo's act offscreen buffer, seems handset (samsung galaxy s vibrant (2.2)) not support fbo's. i'm @ loss how correctly render scene (and run glreadpixels on it) without user witnessing it. any ideas how offscreen rendering of sort can done? if fbo not supported, can resort rendering normal back-buffer. typical usage be: clear back-buffer draw "color-as-id" objects clear back-buffer draw normal swapbu

syntax highlighting - Converting pygments theme to gvim colorscheme -

are there tools convert pygments style definition gvim colorscheme? i found vim2pygments , converts vim colorschemes pygments themes, haven't found doing inverse . specifically, i'm using macvim, though imagine colorscheme format same gvim-derivative (please, correct me if i'm wrong). i haven't come across automate process, should easy hand. grab existing colour scheme, stick in ~/.vim/colors/ directory , put colours defined in pygments scheme appropriate places. for example, if use my colour scheme (which uses non-standard format make more editable) , make uses pygments autumn scheme , take line looks this: let colourassignment['function'] = {"guifg": '#007777', "ctermfg": 'cyan'} and change this: let colourassignment['function'] = {"guifg": '#00aa00'} (i've removed colour terminal assignment you've said you're using gui , largely irrelevant). it shouldn'

user interface - iphone app UI design for add to favorites? -

after right '+' button pressed item in view added favorites , uialertview shown on screen saying "added favorites". after added favorites make '+' button disappear same item doesn't added again favorites. not sure if ok apple's human interface guidelines instead should '+' remain there , if pressed again "this item in favorites"? any appreciated! thanks i wouldn't use alertview this. showing alert, force user confirm reading confirmation message , taking action (by pressing ok button). idea provide feedback favorite added, should not intrusive alert. perhaps can use other design patterns favorites, such star lights when pressed indicate item listed favorite, or perhaps animation effect 'moves' selected item visible 'favorites' category. the human interface guidelines have this alert view (in relation question): avoid creating unnecessary alerts. these alerts unnecessary if they:

video - My QTKit is crashing while popping down a menu. JVT - Lib (H.264) encoding is responsible for this issue. What can I do? -

i use h.264 encoding using qtkit in application. this application crashing " segmentation fault " or " exec_bad_access ". my debugger shows crash @ place: 0x7fff801fea94: je 0x7fff801feba6 ; jvtlib_101906(jvtlib_100990*, jvtlib_101383 const*, jvtlib_101895*) + 3886 ( ... ) 0x7fff801feaba: movl $1, 24(%r13) the last " movl " line causes crash. 1 can see in comment, jvt module h.264 encoder (i assume). what don't understand is: code worked long time. since yesterday it's unstable. if use "instruments" code running fine. there must issue popping menu. uncommenting videoroutines works fine (that means menu has no memory issue) understanding "magic" behind qtkit exciting. edit: can see object names now: crash happens in ' qtbackgroundqueuerun ' thread, , object is: 'pbremoveobjectinternal(fsrefparam*, unsigned char) ' solution: hi everyone. found problem! long , hard searc

java - Email validator regex -

possible duplicate: regexp recognition of email address hard? hi, i implement validator local part of email address. any suggestions please welcome. from email address article @ wikipedia (syntax section) : the local-part of email address may use of these ascii characters: uppercase , lowercase english letters (a–z, a–z) digits 0 9 characters ! # $ % & ' * + - / = ? ^ _ ` { | } ~ character . (dot, period, full stop) provided not first or last character, , provided not appear 2 or more times consecutively (e.g. john..doe@example.com). the syntax formally defined in rfc 5322 section 3.4.1 , rfc 5321. defined grammar in local part starts this: local-part = dot-atom / quoted-string / obs-local-part atext = alpha / digit / ; printable us-ascii "!" / "#" / ; characters not including "$" / "%" / ; specials.