Posts

Showing posts from August, 2011

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - Linking to a file in the Zend Framework -

when link directly uploaded file in zend framework based project differing results depending on if i'm working in local environment or remote environment. in both cases want link uploaded photo. generated url looks like: http://whateverserverweareon/projectfiles/project18/photos/aphoto.jpg on local machine clicking link show me photo, in remote machine gives me warning "invalid controller..." (as, while not have "projectfiles" controller, uploaded photos in projectfiles directory on path specified in sample url). so how link these uploaded photos? create controller can link them? can bypass controller altogether , link directly? there sort of custom route need create? should doing in different manner? suggestions? the exception means on remote mashine file not exists in specified location. standard rewrite rules in .htaccess file written if file exists (i.e. /projectfiles/project18/photos/aphoto.jpg) index.php file of zf not executed. should

iphone - Setting Text Color on all items in IBOutletCollection -

i have several iboutlet , use them iboutletcollection : @interface iboutletcollectionviewcontroller : uiviewcontroller { iboutletcollection (uilabel) nsarray *multiplelabels; } @property (nonatomic , retain) iboutletcollection (uilabel) nsarray *multiplelabels; @end but when want use uilable properties compiler gives error : request member 'textcolor' in not structure or union i think it's because of nsarray ! there solution ? you can use key-value coding set property on each label instance in array: [multiplelabels setvalue:[uicolor redcolor] forkey:@"textcolor"]; "iboutletcollection(uilabel)" can omitted in ivar declaration long it's used in property declaration. another option call "makeobjectsperformselector:" on nsarray instance: [multiplelabels makeobjectsperformselector:@selector(settextcolor:) withobject:[uicolor redcolor]];

javascript - Insert iFrame and then have it load before all other content on FF -

i have browser plugins insert iframe webpage. iframe inserted possible (using domcontentloaded ) contents of iframe render page. in firefox doesn't happen however. though iframe seems inserted early, content of page/images/etc load prior iframe's content. is there way around firefox behavior iframe content can load or first? not sure if matters here 2 methods equivalent results: method 1. inserting iframe on domcontentloaded method 2: nsiwebprogresslistener() onstatechange: function (abrowser, awebprogress, arequest, astateflags, astatus) { const state_start = components.interfaces.nsiwebprogresslistener.state_start; const state_stop = components.interfaces.nsiwebprogresslistener.state_stop; if (astateflags & state_stop) { //document undefined @ state_start try { //create iframe } catch (e) {} } return true; }, the listener domcontentloaded fires later 1 think on ff. problem solved using firefox's on

user interface - Is there a GUI for creating GUIs in Scala? -

is there windowbuilder scala? i don't know of wysiwyg gui builder scala. don't need one. in fact, strictly speaking, scala doesn't have gui; uses underlying platform's gui (or guis). so, jvm port of scala uses awt, swing or swt , cli port of scala uses winforms or wpf. i've heard rumors of ports of scala ecmascript runtime , objective-c runtime, , presumable use html5 , quartz/cocoa, respectively. this means can use existing tools, expression blend wpf or matisse swing. note, however, @ least swing, there brilliant scala.swing library, contains embedded dsl building guis programmatically. not wysiwyg, it's not asking for, prefer it, because wymiwyg (what mean get), gui tools have used far, seems impossible achieve.

How to show Dependency Injection on a UML class diagram? -

Image
see subj. it nice if attach image (my google-fu isn't quite find 1 myself). thanks! martin fowler shows this:

jquery - How to get through with slider in mvc -

Image
hi folks i working in mvc 2.0.now got urgent requirement regarding slider in mvc..here have attached image file please see file..and how implement in mvc.how start is?is there jquery this?...please me how this.... there's nice jquery slider plugin may take at. , here's another one .

internet explorer 7 - Firebug for ie7 -

is there firebug ie7. in firefox firebug reduces lot of work while checking code. in same way ie supports firebug. firebug lite firebug non firefox browsers. if haven't already, can try ie developer toolbar .

javascript - Call Perl function in HTML using AJAX -

im having setback, im making html page javascript, , im using ajax call perl functions. thing when perl program doesn't need parameters calling trivial. have function open , read file need give location of file perl script, having passe trough paramenter in ajax calling. ex working call: function getoption(){ var selectmenu=document.getelementbyid("select1") selectmenu.onchange=function(){ //run code when "onchange" event fires var chosenoption=this.options[this.selectedindex] //this refers "selectmenu" if (chosenoption.value!="nothing"){ var s = chosenoption.text; openfile("c:\perltest\test.txt"); } } } ex. not working trying pass parameter: function openfile(name){ xmlhttp.open("get", "/cgi-bin/readfile.pl"+name, true); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4) { document.getelementbyid("txtarea").innerhtml = xmlhttp.re

visual c++ - How can I get two different binary trees of two different types? -

for array if want array of integers it's: int anarray[]; for array of strings is: string anarray[]; i have binary search tree template allows type chosen using typedef: typedef desiredtype treeitemtype; // desired type of tree items i.e. string, int, etc. how can 2 different trees of 2 different types? right way see possible write supporting code twice different file names , setting typedef's. there has way set typedef desiredtype in method or something. ideas? why not turn templated class , seeing using c++? allows number of permutations of types, , remove problems might occur typedef'd type(aliased type).

sql - Why do I get an open transaction when just selecting from a database View? -

if execute simple select statement in pl/sql developer against database table, standard set of results expect. recently, pasted query stored procedure happened select view, , noticed transaction seemingly left open. appraent rollback , commit options available in pl/sql developer. a poll of other developers revealed seems affect not others, lead me suspect pl/sql developer settings. why on earth case? view itelf has dblink database, wouldn't expect have effect. any thoughts? any sql statement starts transaction in oracle. from manual: a transaction begins first executable sql statement. transaction ends when committed or rolled back, either explicitly commit or rollback statement or implicitly when ddl statement issued. [...] executable sql statement sql statement generates calls instance, including dml , ddl statements most not seing running in auto-commit mode transaction started statement committed after statement has finished. others have clai

migration rollback in rails -

hey guys want undo 1 migration file, like rake db:rollback version=$timestamp this command doesn't work, suggestion? rake db:migrate:down version=$timestamp should trick.

Android animation sequence -

i facing problem in getting sequence of animation on particular view. used animationset in code , have set offset each animation , duration animation correctly. somebody pls this. thanks... to play animations sequentially, use set android:ordering property of <set> tag have value "sequentially" . then, set items animated in sequence of declaration.

actionscript 3 - Flex/AS3 - calling a function dynamically using a String? -

is possible call function in as3 using string value function name e.g. var functionname:string = "getdetails"; var instance1:myobject = new myobject(); instance1.functionname(); // know wrong, gets point accross:) update the answer @taskinoor on accessing function correct: instance1[functionname](); and access property use: instance1[propertyname] instance1[functionname](); check this details.

sorting - How to create an observableCollection Sortable and multithreading -

here problem , have created sortablecollection : observablecollection , added sort method (sort colors). when sort collection principal thread , works every thing fine , works when try sort customcollection using item in collection have expetion : (the calling thread cannot access object because different thread owns it). have looked in web , found several solution , one solution this type of solution put collection multithread insertion , removing moving operation. not custom sort. help, wpf classes have thread affinity. means changes objects must in same thread created. difficult create user interface api thread-safe, microsoft chose keep singlethreaded , force run-time checking make sure of it. that said, there few options have perform sort in background thread, , apply in ui thread. first option copy sortablecollection plain old list or array , perform sort in background. once background thread complete, use dispatcher execute code in ui thread. every ui elem

html - Upload picture directly to the server -

in following link http://www.tuttoaster.com/create-a-camera-application-in-flash-using-actionscript-3/ how make picture upload directly server after taking picture webcam package { import flash.display.sprite; import flash.media.camera; import flash.media.video; import flash.display.bitmapdata; import flash.display.bitmap; import flash.events.mouseevent; import flash.net.filereference; import flash.utils.bytearray; import com.adobe.images.jpgencoder; public class caml extends sprite { private var camera:camera = camera.getcamera(); private var video:video = new video(); private var bmd:bitmapdata = new bitmapdata(320,240); private var bmp:bitmap; private var filereference:filereference = new filereference(); private var bytearray:bytearray; private var jpg:jpgencoder = new jpgencoder(); public function caml() { savebutton.visible = false; discardbutton.visible = false; savebutton.addeventlistener(mouseevent.mouse_up,

Private constructor and inheritance (Java) -

i have first class constructor takes parameter. public class first { first(object o){ o.tostring(); } } i have second class extends first one. public class second extends first { second(object o) { super(o); } } what want keep constructor of second class private in order to have possibility instantiate 1 instance of class (using singleton pattern, instance), compiler doesn't allow me that. if can't set constructor private here, can allow 1 instance of class created? you can make constructor of second private no problems. can't make constructor of first private, unless use nested classes. as example, works fine: class first { first(object o) { o.tostring(); } } class second extends first { private final static second instance = new second(new object()); private second(object o) { super(o); } public static second getinstance() { return instance; } }

c# - Partial class spanning assemblies -

in framework project have class represents tabs in content management system. in framewrok implementations desirable extend class defintions of tabs specific implementation. had though changing cmstabs class partial, this: namespace framework { /// <summary> /// class containing common cms tab names /// </summary> public static partial class cmstab { /// <summary> /// information tab /// </summary> public const string information = "information"; and creating class same name , namespace in assembly implements framework. however, when build framework assembly, cmstabs class appears no longer partial - it's members hidden in implementing assembly when add partial class that. when disassembled in reflector, this: public class cmstab {... is there need make retain partial status, assuming possible trying do. thanks. you can't have partial class span assemblies: all partial-type definitions meant parts

asp.net - Multiple-target cross-browser drag& drop file upload -

we're investigating if it's possible have following: webpage multiple 'folders' user can drag & drop files. it's meant used interface upload scanned documents archive. for example, have page states: 'quotes', 'invoices' & 'misc'. depending on sort of document user drag & drop file local file system 1 of these 3 folders. should upload file correct folder on web server. is possible, , if is, existing solutions using asp.net? you can use modern browsers html5 functionalities so. detailed explanation here: http://www.useragentman.com/blog/2010/01/10/cross-browser-html5-drag-and-drop/ there jquery plugin: https://github.com/weixiyen/jquery-filedrop 1 bit bogus (truncates files accents in french, doesn't handle correctly several drop areas in same page, ...), easy fix (i sent fixed version author weeks ago, didn't feedback...) ajax , correct server-side solution, works charm. don't know .net solution, thou

Using Dynamic Code in C# with Events? -

i'm implementing script engine in game wrote using c# "dynamic" feature. how system should work when script called, should register events listens for, return control application. when event script listening fired script should execute. 1 thing i'd implement in script engine have methods names automatically bind events. example, onturnstart() listener should automatically bind turnstart event. the scripts need execute existing methods , change variable values in classes; stuff player.takedamage() , player.hp = somevalue. scripts need wait start of players' turn , end of players' turn before being unloaded. the complicated part these scripts need able changed without making code changes game. (security aside) current plan have script changes automatically download when game starts ensure players using same version of scripts. however have 3 questions: 1) how register , unregister script event listeners? 2) can dynamic code listen events? 3) (how)

I cannot find the name of a dynamically created javascript object (in jQuery) -

i have page uses javascript add textboxes page, , try work based on these later. what having lot of trouble though cannot return 'name' value saving js. full page source (albeit simplified version) below. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="scripts/jquery-1.4.1-vsdoc.js"></script> <script type="text/javascript"> $(document).ready(function () { //we use live because inputs havent been created yet. $('.myclass').live('blur', function () { //debugger; alert('textbox selected has id '+ $(this).attr('id') ); //this returns txtinput alert('textbox selected has name '+ $(this).attr('name') ); //this returns null (or empty string). }); addinputtextbox("my label: ", "txtinput", "mydiv", "myname&qu

Visual Studio 2010 Javascript Intellisense not working properly -

there's little problem visual studio 2010 , javascript intellisense. i've implemented class "properties" , want implement "static" function, returns new instance of class after ajax-request returns json-object. like so: /// <reference path="jquery/jquery-1.4.1-vsdoc.js" /> myclass = function (options) { /// <summary>myclass description</summary> /// <param name="options" type="array">foo1 (string), foo2(string)</param> /// <field name="foo1" type="string">foo1 description</field> /// <field name="foo2" type="string">foo2 description</field> // [...] code // properties this.foo1 = options.foo1; this.foo2 = options.foo2; } and function: intellisense not working: myclass.myfunction = function () { /// <summary>myfunction description</summary> /// <returns type="

html - Label is displayed below the input textbox -

this input code sample. whenever error generated, error label visible. coming below input element. want on right side of input. i able modify css bit using label.error code bit have. label being type , error class of label being generated. label.error { display:inline; float:right; } > <td><input > name="answer_engineeringjobs_1^11" > id="answer_engineeringjobs_1" > class="reqfield required zipus error" > type="text"><label class="error" > generated="true" > for="answer_engineeringjobs_1">this > field required.</label></td> floating element makes block, triggers new line before it. you need float input left too.

Dozer: Hibernate PersistentMap is not mapped to java.util.HashMap -

i have hibernate annotated entity field: @onetomany(mappedby="templateinstance", fetch = fetchtype.eager) @mapkey(name = "attributename") private map<string, component> components; hibernate makes persistentmap out of this. want dozer map object such field: private map<string, componentdto> components; after having lazyinitializationexceptions , debugging, found out, it´s not problem of closed hibernate session, dozer tries not map hashmap persistentmap! , therefore when dozer accesses target map persistentmap throws exception, because has no session of course. so, thought intented behaviour of dozer map hashmap. question: doing wrong or dozer , how can dozer map persistentmap normal java standard map? i had no problems when using list before. has else used dozer mapping hibernate persistentmap? regards, konsumierer i found solution myself. components field in dto has this: hashmap<string, component> components = n

iis - Configure ASP.NET application to use two authentication methods? -

i new asp.net development , extending existing application did not create. i have working asp.net application uses "forms authentication" throughout pages. have added new webservice in subfolder "webservices\dummy.asmx". webservice works fine because should called external application can't authenticate through form, need enable "integrated windows authentication (basic authentication or digest authentication)" subfolder "webservices". i tried configure in iis did not work. can set different authentication method have create folder "webservices" "application". if function stops working error "could not create type 'dummy'." is possible have 1 web application , authentication methods ? if yes how configured in iis ? or better way if need 1 page (webservice) use different authentication rest of application. thank in advance information. bye ps: use windows 2008 server , app runs on .net fr

How to simulate C++ friend in C# and VB.NET? -

because sometimes, need friend. i can think of following tricks: read wrapper - readonlycollection . friend keeps pointer modifiable object, while else can access wrapper. write delegate - friend gives constructor of object reference delegate 1 of parameters, constructor fills address private method can used modify object. reflection - bad idea. included completeness. multiple assemblies - put friends in separate assembly , set modifier methods internal . expose modifiable object, add comments modifier methods "this infrastructure method - don't call it!" nested classes. add system.componentmodel.editorbrowsable(system.componentmodel. editorbrowsablestate.never) attribute member want friend access hide intellisense. implicit interface implementation - see comments. is list exhaustive? can sort these in order of decreasing performance? order of decreasing neatness? suggestions when use which? you can use internalsvisibleto attribute. for giv

algorithm - Inferring member of a set given incomplete facts about the set -

given bunch of facts like: set contains @ least 1 of (a,b,c) set not contain of (d,e,f) about finite set each member can finite number of values(say integers 1...m), how can enumerate possible sets satisfy list of facts? i realize algorithm exponential in nature, i'd improve on current naive implementation list possible sets, , eliminate not satisfy every condition in facts list. thought perhaps use dynamic programming , iterate on finite values. i.e. first consider facts relating value 1, values 1,2, values 1,2,3 , on. your facts sound translatable sat (boolean satisfiability) instance. can use sat solver find possible solutions (get 1 solution, add clause eliminates solution, , repeat). there lot of sat solvers out there, e.g. zchaff .

svn - Step by Step guide on how to setup CruiseControl.Net + Subversion -

i'm looking step step guide (like dummies guide), setup cc.net + subversion. , i'm wondering if need unit testing use cc.net? google can friend in case. first result "subversion cruisecontrol.net" , things pretty thorough: continuous integrion + cruisecontrol.net + subversion + msbuild + .net 2.0

What is the maximum recommended number of rows that a SQL 2008 R2 standalone server should store in a single table? -

i'm designing db functionality , performance realtime ajax web applications, , don't have resources add db server redundancy or load-balancing. unfortunately, have table in db potentially end storing hundreds of millions of rows, , need read , write prevent lagging web-interface. most, if not all, of columns in table individually indexed, , i'd love know if there other ways ease burden on server when running querys on large tables. there cap size (in rows or gb) of table before single unclustered sql server starts choke? my db has dozen tables, maybe couple dozen foriegn key relationships. none of tables have more 8 or columns, , 1 or 2 of these tables end storing large number of rows. simplicity of db make massive amounts of data in these couple tables ... rows limited strictly amount of disk space have available. have sql servers hundreds of millions of rows of data in them. of course, servers rather large. in order keep web interface snappy need t

jquery - How to check a clicked button's second class? -

if have 2 button, 1 apple class , other apple , and orange class: <button class="apple"/> <button class="apple orange"/> in button click event apple button, how can tell if clicked button has orange class? $("button.apple").click(function(event) { var hasorange = // ??? } jquery provides .hasclass() purpose: $("button.apple").click(function(event) { var hasorange = $(this).hasclass('orange'); }

php - Table cells flushed white -

upon running below sql statement (which works perfectly) i've found tables in database flushed white. any idea why happening? // check database necessary updates $update = mysql_query("select * rent colour='3c0'"); while($row_update = mysql_fetch_array( $update )) { $datetime_lower = datetime::createfromformat('d/m/y', $min); $datetime_upper = datetime::createfromformat('d/m/y', $max); $datetime_compare = datetime::createfromformat('d/m/y g:i a', $row_update['pdate']); if ($datetime_lower < $datetime_compare && $datetime_upper > $datetime_compare) { // date between nothing mysql_close($update); } else { // date not between update echo "date not between"; $update_result = mysql_query("update rent set colour='f0f0f0' substr(pdate, 0, 10) not between $min , $max && colour='3c0'"); mysql_close($update_result); } } i

sms - How to intercept an outgoing Text Message on Android and notify user -

is possible on android intercept outgoing text message , show "prompt" user before goes out? for example, can @ message, spell check, prompt user change spelling of before message sent? or, example, if create game around text messaging, , format of text needed changed little before going receiver (like adding comma). is possible? if so, start learn how this? is possible on android intercept outgoing text message , show "prompt" user before goes out? afaik, no. smsmanager -- on device uses send sms messages -- sends them directly. there no broadcast intents or plug-ins or intercept these messages. in part, imagine privacy reasons.

Why don't Scala Lists have an Ordering? -

is there reason why there no implicit ordering lists in scala? val lists = list(list(2, 3, 1), list(2, 1, 3)) lists.sorted error: not find implicit value parameter ord: ordering[list[int]] edit yes, question why there no built-in ordering that's implicitly in scope. me, seems obvious second list should "less than" first list since items @ 0 equal , second list has lower item @ 1. wondering if maybe it's there's no answer when lists 2 different sizes. i think it's oversight. lexicographic ordering make sense on seqs. should add standard library.

How to add multi line comments in makefiles -

is there way comment out multiple lines in makefiles in c syntax /* */ ? no, there nothing c-style /* */ comments in makefiles. else suggested, can make multi-line comment using line continuations. example: # first line of comment \ , still part of comment \ this, since keep ending each line \ backslash character however, imagine looking temporarily comment out chunk of makefile debugging reasons, , adding backslash on every line not practical. if using gnu make, suggest use ifeq directive deliberately false expression. example: ifeq ("x","y") # here's 'commented' makefile content... endif hope helps.

objective c - How to open an UIView in fullscreen mode with a tabbar? -

problem. i have tabbar application. in first tab, have table. on click on table shows modal view. to go modal view first view, use [self presentmodalviewcontroller:nw animated:yes]; the problem if click on tabbar while opened modal view, opens second view, first view's table don't work because modal view still opened althoug appear closed. it's way open modal view in fullscreen covering tab bar? or check if modal view closed or not view? edit: tried of code: nw = [[newsviewcontroller alloc] initwithnibname:@"newsviewcontroller" bundle:nil]; nw.modalinpopover = yes; nw.wantsfullscreenlayout = yes; nw.hidesbottombarwhenpushed = yes; nw.contentsizeforviewinpopover = cgsizemake(320, 480); nw.modalpresentationstyle = uimodalpresentationfullscreen; nw.view.frame = [[uiscreen mainscreen] applicationframe]; [nw.view setneedslayout]; but nothing!!! wan't go in fullscreen!! idea please? thanks, alberto if view you're pr

reporting services - Data Driven Subscription times out on connection -

i have data driven subscription each time runs shows "pending" status in report manager. after little bit errors with error: timeout expired. timeout period elapsed prior completion of operation or server not responding. statement has been terminated. i not doing extraordinary here. sproc retrieving users returns 2 records (and executes instantly in management studio). data report isn't fancy either. it's pulling in 3 records 3 data sources - straightforward selects based on id passed in through parameters. when set report send in regular subscription, works fine. it's when make data driven times out. the timeout in config set default (120 seconds). here's logs saying. reportingservicesservice!dbpolling!4!12/20/2010-14:52:03:: eventpolling processing item 3c45f091-aab6-4354-bd1e-e5a8a8103391 reportingservicesservice!dbpolling!c!12/20/2010-14:52:03:: eventpolling processing 1 more items. 1 total items in internal queue. reportin

php - Echo arrays with regular text -

how write i'm using 1 echo? echo "<div class='post'>"; echo $row['title']; echo "</div>"; i'm using array echo out table's values lot easier on eyes if combine these 1 echo statement. however, when try page goes blank. enclose array reference in brackets: echo "<div class='post'{$row['title']}</div>";

javascript - Find an unused number in a bunch of numbers -

i have huge table filled numbers (1001001..1009999) , there bunch of unused numbers in area. so, have these numbers returned doing: select my_identifier my_table that return used numbers. how list of unused numbers table? work serverside (rhino/jaxer) javascript , database oracle 10g. thanks, the following query give need: select seq_num (select (lvl + &&v_from - 1) seq_num (select * ( select level lvl dual connect level <= (&&v_to - &&v_from) + 1))) seq_num not in (select my_identifier my_table); replace &&v_to , &&v_from boundary numbers. reference: http://oraqa.com/2006/01/20/how-to-generate-sequence-numbers-between-two-numbers/

php - Facebook login popup on page load? -

i wondering if possible automatically create popup login url instead of displaying button. currently have instead want have when page loads (it iframe) popups window user logins in , iframe refreshes. i need access_token. is possible? take @ page http://developers.facebook.com/docs/authentication/javascript you can access_token via javascript

sql - Python: How can I merge these 2 overloaded constructors into 1 constructor -

i have class called portfolio & right have 2 constructors (although discovered u cant overload functions in python) so have merge these 2 constructors . i experienced python programmer merging 2 constructors pretty contradictory doing head in! :p the first constructor: + purpose create .db file & initialise class variables - initialises class member variables - checks whether file path&name db_path exists: if exit coz dont want overwrite existing database return none - create database (sql database) & set necessary tables - import portfolio data (date created, etc) the 2nd constructor: + purpose import stock data existing sql database file & initialise variables - initialises class member variables - checks whether file path&name db_path exists: if not exit coz dont want overwrite existing database return none - call function import stocks database - import portfolio data (date created, etc) how can merge these 2 constructors, ugh, w

flex - localToGlobal not working - for reals though -

i know there bajillion threads on topic, , maybe retarded, isn't working , think missing key? lets have sprites _testtarget , _testparent nested this. _testparent = new sprite(); this.addchild(_testparent); _testtarget = new sprite() _testparent.addchild(_testparent); and lets want global cords of _testtarget. when localtoglobal 0,0 when know fact actual cords 200,100 var point:point = new point(_testtarget.x, _testtarget.y); point = _testtarget.localtoglobal(point); // returns 0,0 var point:point = new point(_testtarget.x, _testtarget.y); point = _testtarget.parent.localtoglobal(point); // returns 0,0 var point:point = new point(this.x, this.y); point = this.localtoglobal(point); // returns 0,0 var point:point = new point(this.x, this.y); point = this.parent.localtoglobal(point); // breaks, "parent" null if helps, class/sprite instantiated inside of sprite, inside of sprite, inside of sprite...etc , reason cords 200,100 because 1 of

ruby - Protected and private methods in Rails -

method visibility in ruby (public, protected, , private methods) has been explained in places this blog post . in ruby on rails seems different in regular ruby application because of way framework set up. so, in rails models, controllers, helpers, tests, etc., when is/isn't appropriate use protected or private methods? edit : answers far. understand concept of protected , private in ruby, i'm looking more explanation of typical way types of visibility used within context of various pieces of rails app (models, controllers, helpers, tests). example, public controller methods action methods, protected methods in application controller used "helper methods" need accessed multiple controllers, etc. for models, idea public methods public interface of class. public methods intended used other objects, while protected/private methods hidden outside. this same practice in other object-oriented languages. for controllers and tests, please. both controller a

scala - AbstractMethodError when running standalone jar built with SBT and ProGuard -

i've written simple scala application i'd distribute in form of standalone, executable jar servers without scala runtime. works fine when invoked through sbt run , not java -jar . when run jar through java, following unhandled exception: exception in thread "main" java.lang.abstractmethoderror: java.util.logging.handler.publish(ljava/util/logging/logrecord;)v @ java.util.logging.logger.log(logger.java:458) @ net.lag.logging.logger.log(logger.scala:108) @ net.lag.logging.logger.log(logger.scala:91) @ net.lag.logging.logger.info(logger.scala:121) @ com.rentawebgeek.sitewiki.sitewiki$.main(sitewiki.scala:29) @ com.rentawebgeek.sitewiki.sitewiki.main(sitewiki.scala) exception in thread "thread-0" java.lang.abstractmethoderror: java.util.logging.handler.close()v @ java.util.logging.logmanager.resetlogger(logmanager.java:682) @ java.util.logging.logmanager.reset(logmanager.java:665) @ java.util.logging.logmanager$cleane

c++ - Porting an iPhone game to Android - Textures and Buffers -

i have programmed game in c++. have managed compile using ndk, have notice couple of snags. how load textures ndk opengl(since code there)? did use bitmapfactory load image, copy pixels bytebuffer allocated @ size of width * height * 4. sent array of bytebuffer native code , pulled out pointer using get/releaseprimiativearraycritical. don't think works crashes when renders. also, can't notice garbage compiler moaning 5.37 mb of space being taking when image 16 kb. the other thing buffers, framebuffers , renderbuffers. notice isn't use of framebuffers , renderbuffers. glsurfaceview atuomatically this? , okay use own buffers? well have figured out. turns out bitmapfactory scaling images non power of 2 size not work. glsurfaceview supports opengl es 1.0 way of doing things, draw on-screen. can use framebuffers, have link them texture , draw texture screen. used example , ported across native excluding depth buffer. here's code: java: public class na

java - How do stateless servers work? -

i try understand this. each time user login system, server side create session, while user client side there cookie. when people talk stateless serverside, stateful client side, mean? server side no need use session keep track user? use cookies on client side check user? mean if change server, user not notice , still can resume using service? how configure spring-security to this? tracking user across servers tricky true stateless server side. of time things sorta stateless server logins exception. however, big deal stateless servers makes clustering simple can scale horizontally. in java can make stateless using either cookies store credentials, or using distributed hashes. generally, people accept using memcache , stateless because state stored outside webserver. allows user use webserver in farm , still safely authenticated. in java have plenty of distributed hash implementations can use spring don't have use memcache this. the other option use cookies s

Jerky animation with jquery accordion, don't understand why -

i'm using number of jqueryui accordions on single page inside of anythingslider. used pretty smooth, has gotten jerky. now, instead inserting bunch of code, how give link , can look. if works fine you, then, well, don't know. of course, if there's more you'd have, let me know. click here seems work fin, smooth , all.

one to many - Hibernate insert cascade not inserting foreign key -

i have 2 entities: @entity public class file ....... @id @generatedvalue(strategy=generationtype.auto) private int id; @onetomany(fetch=fetchtype.lazy, mappedby="file", cascade=cascadetype.all) private list<tag> tags; ....... other properties ....... @entity public class tag ....... @id @generatedvalue(strategy=generationtype.auto) private int id; @manytoone @joincolumn(name="file_id") private file file; @column private string tag; ....... other properties ....... i trying insert file (and subsequently tag) doing following: file file = new file(); tag tag = new tag(); tag.settag("tag1"); tag2 tag2 = new tag(); tag2.settag("tag2"); list<tag> tags = new arraylist<tag>(); tags.add(tag); tags.add(tag2); file.settags(tags); ---add other file attributes here--- i inserting file in dao using: sessionfactory.getcurrentsession().saveorupdate(file); in logs see insert "file" table , 2 inserts tag table, however

php - url or content as a variable in the header of the page -

i designing site external links form various being shown on page. using $url=$_get['url']; $website_data = file_get_contents($url); echo $website_data; so user click on hyperlink www.test.com/display_page.php?url=http://www.xyz.com/article/2.jpg my page, list_of_images.php, typically has list of images href each image above on page , when image clicked go display_page.php, show our banner on top of page, text , image beneath that. image website. i sending url directly , grabbing using get. understand users/hackers can coding , send commands url variable , break server or harmful , avoid method or sending url directly in header. alternate approach problem? i make sure url starts http:// or https:// : if(preg_match("`^https?://`i", $_get['url'])) // stuff you may want make sure isn't pointing anywhere internal: if(preg_match('`^https?://(?!localhost|127\.|192\.|10\.0\.)`i', $_get['url'])) // stuff rather big dirt

jQuery - hide link/"a" element's text in IE -

hi suppose have code that: <a style="background: url(button.jpg);" herf="#">test</a> this code display link button image, in chrome/ff, text "test" have not displayed, in ie, displayed. i try use text-indent: -999px hide text "test", , not work, provide idea problem? found solution: http://schleichermann.wordpress.com/2009/02/25/css-hide-link-text-let-your-images-shine-through/ thanks you using jquery: $("a").contents().hide();

iphone - CoreData application directory crashes on iOS3 -

i have finished application works on ios4, when loading 3.2 simulator crashes with.. 2010-12-21 07:54:32.052 app[14044:207] *** -[nspathstore2 urlbyappendingpathcomponent:]: unrecognized selector sent instance 0x4d2b640 2010-12-21 07:54:32.054 app[14044:207] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[nspathstore2 urlbyappendingpathcomponent:]: unrecognized selector sent instance 0x4d2b640' i getting application document directory with nsurl *storeurl = [[self applicationdocumentsdirectory] urlbyappendingpathcomponent:@"app.sqlite"]; - (nsurl *)applicationdocumentsdirectory { return [[[nsfilemanager defaultmanager] urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lastobject]; } any great, thanks. the documentation mentions urlbyappendingpathcomponent: available in ios 4 , later. can accomplish same thing using nsstrings stringbyappendingpathcomponent: , , converting url wh

php - overwrite in the middle of a File -

the problem in middle of file fseek next exists bytes of length m want replace bytes of length n . simple write keep m-n bytes still there. if m > n , if m < n bytes ( n-m ) not willing change overwritten. i want replace known startpos endpos byte stream variable length bytes. best solution. -- edit -- though can done taking backup. there exists direct solution ? messy ? , kind of poor coding. o = fopen(original, 'r') b = fopen(backup, 'w') while(fpos(o) <= startpos){ buffer += fgetc(o) } fwrite(b, buffer) fwrite(b, replacementbytes) buffer = "" fseek(o, endpos) while(!feof(o)){ buffer += fgetc(o) } fwrite(b, buffer) //now copy backup original the robust solution re-write whole file, scratch. operating systems let overwrite bytes, not insert or remove them, file, accomplish that, have copy file, replacing target bytes during copy.

Is there a way to make my background iPhone app to go foreground? -

is there way make background iphone app go foreground? tnx. a uilocalnotification bring app foreground if device locked , notification appears , , user unlocks device. a uilocalnotification alertaction display alert while device unlocked , , if user taps view button (or whatever set to), app brought front.

Design decisions / advice for a simple game on Android -

Image
i need advice on best way implement scrollable playing field in simple game. field consists of multiple rows, 9 cells in each row. rows can dynamically added , removed during course of game. each cell has digit in it, , optionally several overlayed images, selection, selector over, crossed out, etc. (see pic below). user should able click on individual cells of row select/deselect/cross touched cells. @ point in game there can 0 3000 cells (0 333 rows). field should scroll , down smoothly. i thinking having listview each row being row on field. way add/remove rows dynamically during game. however, how should implement row: have 1 bitmap representing row, , when user touches -- coordinates of touch area, , find out cell affected, , act upon that. possible touch coordinates of row in listview? if not, should place 9 dummy image placeholders in each row, , act on user touching those? performance? or should have 1 huge bitmap / canvas representing entire field, place inside scrol

WPF - Why doesn't Microsoft supply a decent set of most-used controls ? -

i've been playing wpf months now, , quite it. 1 of things don't why ms doesn't put little more effort in helping developers supplying basic controls, , need off chest :) for example, figure applications somewhere need let edit properties - configuration or whatever. used types in proprety-grid editor ? text numbers (byte, float/double, int, etc) colors ....etc. so why isn't there simple control edit numbers ? generic numericupdown control allows type in numbers (no text, no pasting invalid input) or spin them up/down according given rules (decimal, floating point, min/maxvalue) ? why isn't there generic colorpicker, people same user-experience in every application ? why isn't there standard implementation of searchtextbox, breadcrumb-control, or these other standard control types users have gotten accustomed last 10 years ? (..but @ least did have time implement a generic splashscreen - because knows greatly increases user-productivity....)

django - Automate the generation of natural keys -

i'm studying way serialize part of data in database , deserialize in database b (a sort of save/restore between different installations) , i've had django natural keys avoid problems due duplicated ids. the issue should add custom manager , new method models. there way make django automatically generate natural keys looking @ unique=true or unique_togheter fields? please note answer has nothing django, give alternative think about. you didn't mention database, however, in sql server there binary_checksum() keyword can use give unique value data held in row. think of hash against fields in row. checksum method can used update database checking if local row checksum <> remote row checksum. this sql below update local database remote database. won't insert new rows, use insert ... id > @maxlocalid select delivery_item_id, binary_checksum(*) bc #di [remote.network.local].yourdatabase.dbo.delivery_item di select delivery_item_id, b

Problem starting program (vcom) with multiple arguments in TCL -

i'm trying start program (vcom) tcl script options: set compilationargs "-quiet -93" vcom $compilationargs -work work polar2rect/sc_corproc.vhd but when run this, following error message: # model technology modelsim altera vcom 6.5e compiler 2010.02 feb 27 2010 # ** error: (vcom-1902) option "-quiet -93" either unknown, requires argument, or given bad argument. # use -help option complete vcom usage. # /opt/altera/10.0/modelsim_ase/linuxaloem/vcom failed. tcl seems pass 2 options (-quiet) , (-93) 1 option vcom. if use 1 of these 2 options works. , if run (vcom -93 -quiet -work work polar2rect/sc_corproc.vhd) works. how can fix this? thanks, hendrik. the “problem” tcl's being careful managing spaces. useful if you've got arguments spaces in (such many full filenames on windows machines) can frustrating if wanted list broken automatically. fix indicate tcl is want split multiple words. the best answer requires @ least tcl 8.5 (f

if there is any close button is available in android? -

"x" button available or not in android,if no instead of button used? please read multitasking android way - had close menu in apps , removed them after reading article. others pointed out: should not have close button or close menu in android.

multithreading - In Java should I copy a volatile reference locally before I foreach it -

if have following private volatile collection<integer> ints; private void mymethod() { ( integer : ints ) { ... } } the ints collection never changed entire collection maybe replaced thread (so it's immutable collection). should copying ints variable locally before iterate it? i'm not sure if accessed multiple times. ie iterating collection, thread replaces collection, code continues iterating new collection. edit : this question relevant additional info on how foreach works internally. you don't have to. implicitly, code ints.iterator() anyway, , point on use iterator, on old collection.

Apache Solr caching <-> stress test -

i want quick&dirt load testing - results cached. commented out solr caches - still cached. can caching come 'field collapsing cache'. -- although don't see element in config file. ( system jumps 1gb 7 gb of ram when load test lots of queries ). can lucence cache? +-----------------------------------------------------+ want lower caches cache 100 or 1000 documents. ( right - when 50 000 unique queries solr use 7 gb of ram , fits in cache! ) any suggestions how proper stress test solr - small number of queries (some 100 0000 - not in millions testers have)? this not recommended praxis. results won't realistic. important tune cache settings! try hit solr queries build log files. i'm using fastbench kind of testing can use jmeter, bash script or sth. similar can lucence cache? yes field collapsing cache no, you'll need patch + config that