Posts

Showing posts from June, 2015

android - How to get silver tinge like screen -

i want develop application made in android , work mirror . want make screen have silver tinge . thanks silver #c0c0c0 rgb(192,192,192) http://service.real.com/help/library/guides/realone/productionguide/html/htmfiles/colors.htm

java - Learning to use OOP documentation -

i'm learning android , java. i find i'm having difficulty in using documentation. gibberish. there tips , tricks on how use oop documentations? so far i've used following documentations without difficulty before: php, jquery, codeigniter i find difficulty in following documentations: yii, android are there techniques in reading oop documentations? this isn't specific object oriented programming, you've encountered difference between tutorial , reference. a tutorial shows how use product or application. reference shows of features of product or application. tutorial looks @ product or application outside. reference looks @ product or application inside. when you're first learning something, android or yii, need tutorial. later, after have experience product or application, reference more understandable. know more how pieces of product or application fit together. unfortunately, come across tutorial assumes product or applicatio

django - How can i store user preferences as a dictionary to a user profile? -

i have list of categories, each of has metacategory. create select multiple fields allow user filter objects wants see. gives me dictionary this: filter={'genres':[id1,id2...],'parts':[id9,id11...],...} now want store user profile, user gets last search results when returning page. i know m2m field, involve recreate filer dictionary, prefer store dictionary. bad idea? why? if not, way it? as mentioned pickling 1 option. choose jsonfield (you can find them google) format more readable can nicer debugging. it's worth pointing out it's hard query models based on data stored in dictionaries. looks won't issue though.

php - PayPal API Error - Error Processing Payment -

i know pretty specific question managed great before. have posted on paypal's developer site (www.x.com) have not yet had responce. i have been attempting create paynow button using bmcreatebutton api via nvp. receive success message , button code, whenever clicks button instantly displaying message: "error processing payment payment can't processed. please contact merchant directly code." the code using generate button follows: $senddata = array( "method" => "bmcreatebutton", "version" => "65.2", "user" => "[username]", "pwd" => "[password]", "signature" => "[signature]", "buttoncode" => "encrypted", "buttontype" => "payment", "buttonsubtype" => "services", "buttoncountry" => "gb", "buttonimage" =>

Rails: radio button selection for nested objects -

i'm stuck simple selection task. have models: # id :integer(4) not null, primary key # category :string(255) # content :text class question < activerecord::base has_many :choices, :dependent => :destroy accepts_nested_attributes_for :choices end # id :integer(4) not null, primary key # content :text # correct :boolean(1) # question_id :integer(4) class choice < activerecord::base belongs_to :question end when create new question, want specify in nested form not content of question , content of 3 answer objects, , select radio button 1 correct answer. in new action of controller, have this: def new @title = "new question" @question = question.new 3.times { @question.choices.build } respond_to |format| format.html # new.html.erb format.xml { render :xml => @question } end end this form code: <%= simple_form_for @question |question_form| %>

javascript - Fancy box not opening iFrame second time -

first post - hello! use fancybox ( fancybox homepage ) display modal windows. i'm trying display hidden div iframe inside of div. works great. second time click link, doesn't load iframe (not 404 error, there no content in iframe). can help? the important bits: <script type="text/javascript"> function openiframelink() { $.fancybox({ 'type' : 'inline', 'href' : '#data' }); }; </script> and html: <div id="hiddenelement"> <iframe id="data" src="frames/frame4.php" width="100%" height="300"></iframe> </div> it looks fancybox extracts iframe element dom , puts it's own container. then, when close fancybox, attempts insert - manages loose src attribute value. the fancybox guy's approved method of opening iframe seems following. <a id="mylink" class="iframe&q

asp.net - User permissions on certain views based on roles -

i using asp.net mvc 3. please excuse terminology. assign roles people @ work, use windows authentication determine roles user has. lets roles rolea, roleb , rolec. list of roles user. lets says usera belongs rolea , roleb. of views need authenticated not can view views. lets viewa can viewed users belong roles rolea , roleb. how this? need into? when user not belong these roles tries access views he/she should redirected error page. also, need sort of helper method check these roles used in views hide/display controls. best place use this? any sample code / articles appreciated. [authorize(roles = "rolea,roleb")] public actionresult foo() { return view(); } and if want check roles in view: @if (user.isinrole("rolea")) { <div>this visible users in rolea</div> }

ruby - How to enable colors with rspec when using JRuby or bundle exec? -

i'm trying run rspec's jruby: rake spec which results in: jruby -s bundle exec rspec --color spec/foo_spec.rb no colors show up, removed jruby equation: bundle exec rspec --color spec/foo_spec.rb no colors. how can "--color" option passed through rspec? i've got .rspec file in root directory of project doesn't seem in these cases. however, .rspec file picked-up or used when run: rspec spec/foo_spec.rb any ideas? adding --tty call fixes problem me: jruby -s bundle exec rspec --tty --color spec/foo_spec.rb the option tells rspec output not written file (in case wouldn't want colorized output), send process instead.

model view controller - Is the MVC-pattern a pure presentation-tier pattern? -

kind of special question today :) i had test @ technical university told wrong. so know folks(i believe more teachers): is mvc-pattern implemented @ presentation-layer only? or model-part of pattern in business/dataaccess-layer implemented. my teacher said, it's not possible pattern can span more 1 tier. think it's an enterprise-architecture-pattern , therefore can span multiple tiers. how wrong i? :) you're wrong... class. in class, teacher /book says goes. outside class, agree 100%.

oracle9i - Multiple "execute immediately" queries in Oracle -

i have sequence of queries: begin execute immediate 'drop table mytable1'; exception when others null; end; begin execute immediate 'drop table mytable2'; exception when others null; end; begin execute immediate 'drop table mytable3'; exception when others null; end; but when try execute in sql scratchpad says "encountered symbol begin" pointed me queries must in 1 begin... if remove begin end exept first begin , last end gives me "invalid sql statement" how perform multiple drop table or multiple create table upper pattern , check if tables exist? know style exception when others null; considered bad practice similar empty catch()'es in other languages thats easiest way me check if table exists/not exists in oracle begin execute immediate 'drop table mytable1'; execute immediate 'drop table mytable2'; execute immediate 'drop table mytable3'; exception when others null; end;

c# - the perfect way to connect to database? -

public class sqlhelper { public sqlhelper() { } public static sqlconnection getconnection() { sqlconnection conn = new sqlconnection(); conn.connectionstring = @"data source=.\sqlexpress;attachdbfilename=" + system.web.httpcontext.current.server.mappath(@"~\app_data\learn.mdf") + ";integrated security=true;user instance=true"; return conn; } public static sqldatareader executereader(string sql) { sqlconnection con = getconnection(); con.open(); sqlcommand cmd = new sqlcommand(sql, con); sqldatareader dr = null; try { dr = cmd.executereader(commandbehavior.closeconnection); } catch { con.close(); return null; } return dr; } public static object executescalar(string sql) { sqlconnection con = getconnection(); con.open(); sqlcommand cmd = new sqlcommand(sql, con); object val = null; try { val = cmd.executescalar(); } catch {

web services - how do i share mysite's videos & comments on facebook? -

hi have been looking @ http://netbeans.org/kb/docs/websvc/facebook.html i'm not shure way. thank best regards ignacio not found several answears @ www.facebook.com/developers

Overriding MacVim's default filetype.vim when assigning filetypes -

in default filetype.vim comes macvim , have following: au bufnewfile,bufread *.erb,*.rhtml setf eruby i installed macvim using homebrew , , i've installed janus . following instructions janus , i've created ~/.vimrc.local store local customizations. want set filetype *.html.erb files html.eruby.eruby-rails , added following line ~/.vimrc.local . autocmd bufnewfile,bufread *.html.erb setf html.eruby.eruby-rails however, appears filetype still being selected macvim 's default filetype.vim instead of picking change in ~/.vimrc.local . what need differently, have macvim designate *.html.erb files filetype html.eruby.eruby-rails without modifying default filetype.vim ? change setf in autocmd set ft= . if take @ :help setf says not set filetype if has been set elsewhere.

How to digitally sign an xml document through the client's browser? -

when visit site requires client-side certificate browser automatically opens popup asking me personal certificate use connect. is there similar provision sign xml document using html5 or flash? otherwise (installing application on client machine) java applet cross-browser way it? at moment need create client-side module somehow request document (or hash of document) site, sign , send server. problem (besides writing own module) guaranteeing user signs sees , not data mitm attacker has pushed client. we finalizing our solution distributed signing of various data set of reusable client-side module. solution available in may part of version 9 of our secureblackbox product. update: beta version of secureblackbox 9 available , includes distributed signing modules.

Visual Studio: How can I disable the blue blocks surrounding my blocks of SQL? -

recently had install visual studio on new machine , when open sql scripts editor placing these blue lines around blocks of code. when mouse hovers on these lines, text appears stating: this block of sql text. can modify block query builder choosing 'design sql block' shortcut menu. finding nuisance , can't seem find way disable it. in vs2005... tools -> options -> database tools -> general ... uncheck "enable dml markers". you'll need close , reopen sql scripts have open have dml markers

python - finding elements by attribute with lxml -

i need parse xml file extract data. need elements attributes, here's example of document: <root> <articles> <article type="news"> <content>some text</content> </article> <article type="info"> <content>some text</content> </article> <article type="news"> <content>some text</content> </article> </articles> </root> here article type "news". what's efficient , elegant way lxml? i tried find method it's not nice: from lxml import etree f = etree.parse("myfile") root = f.getroot() articles = root.getchildren()[0] article_list = articles.findall('article') article in article_list: if "type" in article.keys(): if article.attrib['type'] == 'news': content = article.find('co

google analytics - Counting visits and more in a mysql, any better practice or third party software? -

let's assume have website quora want count how many visitors saw particular page/question...("this question visited 345 times") i know create column store value increases every user visits it. using external service...that maybe can more robust , reliable (filtering unique/pageviews etc..) any suggestion? (what google analytics api?) thanks! google analytics? or of other analytics packages give lots of info. or run own , put on memcached layer make super fast.

spring - Spring3 MappingJacksonJsonView vs. MappingJacksonHttpMessageConverter -

spring 3 includes contentnegotiatingviewresolver can used decide on views based on aceept http header example. this 1 way render json view, way (which provides mapping incoming request bodies objects) setup mappingjacksonhttpmessageconverter. which 1 used best? there guidelines or hints? thanx! mappingjacksonhttpmessageconverter looks alike approach , in case want skip view resolution altogether. httpmessageconverter allow do more xml,etcimages,etc , can unit test them :)

How can I show a series of random images in a WordPress text widget using HTML/Javascript? -

i'm using wordpress 3.0.5 on dreamhost, trying create text widget in sidebar show random set of 9 (9) client logos. there total of 12 logos, located in /wp-content/clients folder, named logo1.jpg thru logo12.jpg. the idea choose first image randomly, next 8 images in sequential order avoid duplicates. update got working, tips everyone! here final, working version: <div id="client-logos"></div> <script type="text/javascript"> totallogos = 12; firstpart = '<img src="/wp-content/clients/logo'; lastpart = '.jpg" height="50" width="110" />'; var r = math.ceil(math.random() * totallogos); var content = document.getelementbyid('client-logos').innerhtml; document.getelementbyid('client-logos').innerhtml = firstpart + r + lastpart; var t=0; (t=0;t<8;t++) { if (r == totallogos) { r=0; } r++; var content = document.getelementbyid('client-

chromium - Extensions Issue - ContentScript & Premissions for an overlay -

i'm developing overlay google chrome (a toolbar if prefer), , have issues , can't understand reason why. so, i've created extension manifest.json : { "background_page" : "background.html", "browser_action" : { "default_icon" : "images/extension.png" }, "content_scripts": [ { "all_frames": true, "css": ["css/overlay.css"], "js": ["js/overlay.js"], "matches": ["http://*/*"], "run_at": "document_start" } ], "permissions" : ["tabs", "unlimitedstorage", "http://*/*"], "name" : "myoverlay", "version" : "1.1", "description" : "sindar overlay" } the concept background.html page call jquery.js , overlay.js. on initialization of overlay.js c

c# - Asp .Net Gridview paging -

trying paging of grid. <pagerstyle horizontalalign="right" cssclass="paging"/> <pagertemplate> <table width="100%"> <tr> <td style="text-align:left; width:50%"> <asp:linkbutton id="lnkprv" visible="false" commandname="page" commandargument="prev" runat="server">previous</asp:linkbutton> </td> <td style="text-align:right; width:50%;padding-left:50%;"> <asp:linkbutton id="lnknext" commandname="page" commandargument="next" runat="server">next</asp:linkbutton> </td> </tr> </table> </pagertemplate> code behind below protected

.net - C# code understanding and learning -

i learning c# diving it. , got stopped. have code below has menu item, acquire. runs acquire fine when select it. want run acquire application loaded / started. where make necessary change? using system; using system.drawing; using system.collections; using system.componentmodel; using system.windows.forms; using system.data; using system.io; using system.runtime.interopservices; using wialib; // namespace of imported wia scripting com component namespace wia { /// <summary> mainform wia sample </summary> public class mainform : system.windows.forms.form { private system.windows.forms.mainmenu mainmenu; private system.windows.forms.menuitem menutopfile; private system.windows.forms.menuitem menufileacquire; private system.windows.forms.menuitem menufilesaveas; private system.windows.forms.menuitem menufilesep1; private system.windows.forms.menuitem menufileexit; private system.windows.forms.pictur

How do I disable Django per-view caching when debug is on? -

i've written bunch of views in django use per-page caching. code looks this: from django.http import httpresponse django.views.decorators.cache import cache_page @cache_page(60 * 5) def view_page(request): return httpresponse('hello world') this works wonderfully, pain during testing. how caching debug off? check out django's dummy cache backend. development enviroment should set cache backend django.core.cache.backends.dummy.dummycache

iphone - Configuration Apple's HTTP Live Streaming with Apache + PHP on MAC machine -

i tried live video , vod streaming on iphone, have configured http live server apache + php on mac machine. ffmpeg command line tool on mac system. first tried video on demand (vod) below steps, i have encoded input video (.mp4) using ffmpeg tool mpef2 (.ts) using mediastreamsegmenter command line tool, create index file (.m3u8) , segmentation when above step 2, not working, can suggest me followed steps correct or correct me if wrong. second, live video stream recording video on iphone camera , receiving cfsampebufferref on delegate method. how should send above mentioned buffer (iphone) server (apache + php) in format , how should read in server , best communication method, whether socket or ftp or other methods? thanks in advance, sri could more specific error? not load video? crashes? little info programatic problem, encoding 1 or apache. start using mediastreamvalidator in mac , check if video part correct. if fine, try accessing m3u8 file browser.

c++ - how do I write to stdout from an MFC program? -

mfc programs can't write stdout. mfc weird stdout/stdin pipes during startup , write (for example doing printf("hello");) goes /dev/null. does know how write stdout mfc program? thanks reading. use allocconsole function create console writing into. following article explains how use print console. creating console mfc app's debug output dont forget freeconsole once you're done it.

In C#, how do I keep certain method calls out of the codebase entirely? -

Image
i'm trying rid of datetime.now method calls , replace them own getnow() method, may return fixed date testing purposes. how can enforce no 1 adds datetime.now call in future? can use ndepend or stylecop check on continuous integration server? with ndepend easy write rule : // <name>forbid datetime.now, use xxx.getnow() instead</name> warn if count > 0 in select methods isdirectlyusing "optional:system.datetime.get_now()" notice: the prefix warn if count > 0 in transforms cql query rule the way property referenced through string system.datetime.get_now() the prefix optional means "don't emit compilation error if property get_now not found". makes sense since if code doesn't use anymore get_now(), not anymore referenced ndepend analysis. also, generate original query... select methods isdirectlyusing "optional:system.datetime.get_now()" ...just right-click datetime.get_now() , choose se

iphone - Using xib object inside another xib -

i'm designing using ib specific button (with labels,and imageview , other stuff). i use xib object (the button) in xib, have 6 objects of button. i know can programmatically using class identifier, have position lables , image view, , set default values , else in code. i'm wondering if it's possible same thing using ib ? (of course still set values in code, want positions of lables/imageview , rest set in xib) thanks edit so, understand asked @ first not possible. i'm trying : i created buttontest.xib . inside xib have uiview , 3 subviews (2 lables , button). in inspector set uiview class buttontest . inside buttontest.m have 3 outlets each of subviews, connect in ib. next have buttontestviewcontroller.xib . inside put 1 view , set it's class in inspector buttontest . connect view mytextview outlet inside buttontestviewcontroller.m of class buttontest now, code inside buttontestviewcontroller.m viewdidload: - (void)viewdidload { [super

Mathematica "linked lists" and performance -

in mathematica, create singly linked lists so: tolinkedlist[x_list] := fold[pair[#2, #1] &, pair[], reverse[x]]; fromlinkedlist[ll_pair] := list @@ flatten[ll]; emptyq[pair[]] := true; emptyq[_pair] := false; using symbol pair cons cells has advantage of flatten working safely if lists contain mathematica-style list s, , allows define custom notation using makeexpression / makeboxes , makes more pleasant. in order avoid having muck around $iterationlimit , wrote functions work these lists using either while loops or nestwhile instead of using recursion. naturally, wanted see approach faster, wrote 2 candidates watch 'em fight: nestlength[ll_pair] := with[{step = {#[[1, -1]], #[[-1]] + 1} &}, last@nestwhile[step, {ll, 0}, ! emptyq@first@# &]]; whilelength[ll_pair] := module[{result = 0, current = ll}, while[! emptyq@current, current = current[[2]]; ++result]; result]; the results strange. tested functions on linked lists of length 1

java - Service s = new ServiceImpl() - Why you are doing that? -

i read article service s = new serviceimpl() - why doing that? would know views it.. wondering name other impl? impl suffixes naming anti-pattern . denotes lack of effort on developers part descriptively name class . flip side of iservice interface naming anti-pattern well. both practices reek of laziness or poor design choices or both. both code smells, should alert developer isn't right. the fact code says interface service , class myservice implements service should enough, else tautology . more today's advanced java ides. if have service interface, name implementations descriptively. service generic, interfaces good. httpservice , authenticationservice specific classes good. self documenting part in both cases. if can't give unique descriptive names interfaces , classes, doing wrong. in mocking argument, assuming real classes in com.company.app.service . mock implementations should in own com.company.app.service.mock package, in differe

What C++ library can I use to check disk quotas on linux? -

is there easy use library can use checking disk quotas? need modify piece of software have implement functionality. can't use quotactl ? int quotactl(int cmd, const char *special, int id, caddr_t addr);

cocoa - objective c++ accessing an NSSlider from c++ callback -

appcontroller.h @interface appcontroller : nsobject { } @property (retain) iboutlet nsslider * myslider; void setmyslider (nsslider *ns);// c function appcontroller.m @implementation appcontroller int myamount=0; @synthesize myslider; void setmyslider(nsslider *myslider){ [ns setintvalue:10]; //ok ns.intvalue =myamount;//ok } mycallbackfunction(double delta,std::vector<unsigned char>*mydata,void *userdata){ myamount=50; nslog(@"%i", myamount); // ok display value of myamount // should move slider value of amount calling following c function: changeslidervelocity(myslider);// error message myslider not declared in scope } no. in case, though mycallbackfunction() placed between @implementation , @end not within class scope of appcontroller . int myamount static class-ish member (i have no idea scope is. global??) because defined in implementation file, not part of object appcontroller . no guarantees work, give shot. assu

java - JSP: Get MIME Type on File Upload -

i'm doing file upload, , want mime type uploaded file. i trying use request.getcontenttype() , when call: string contenttype = req.getcontenttype(); it return: multipart/form-data; boundary=---------------------------310662768914663 how can correct value? thanks in advance it sounds if you're homegrowing multipart/form-data parser. wouldn't recommend that. rather use decent 1 apache commons fileupload . uploaded files, offers fileitem#getcontenttype() extract client-specified content type, if any. string contenttype = item.getcontenttype(); if returns null (just because client didn't specify it), can take benefit of servletcontext#getmimetype() based on file name. string filename = filenameutils.getname(item.getname()); string contenttype = getservletcontext().getmimetype(filename); this resolved based on <mime-mapping> entries in servletcontainer's default web.xml (in case of example tomcat, it's present in /conf

algorithm - Filter an array or list by consecutive pairs based on a matching rule -

this trivial, , have solution i'm not happy it. somehow, (much) simpler forms don't seem work , gets messy around corner cases (either first, or last matching pairs in row). to keep simple, let's define matching rule any 2 or more numbers have difference of two . example: > filtertwins [1; 2; 4; 6; 8; 10; 15; 17] val : int list = [2; 4; 6; 8; 10; 15; 17] the code use this, feels sloppy , overweight: let filtertwins list = let func item acc = let previtem, resultlist = acc match previtem, resultlist | 0, [] -> item, [] | var, [] when var - 2 = item -> item, item::var::resultlist | var, hd::tl when var - 2 = item && hd <> var -> item, item::var::resultlist | var, _ when var - 2 = item -> item, item::resultlist | _ -> item, resultlist list.foldback func list (0, []) |> snd i intended own original ex

Why is this line of Perl code throwing a numeric gt warning? -

i have following conditional: if ($self->path ne 'contact_us' && !grep { $status == $_ } 2, 3, 8) { and throwing warning: use of uninitialized value in numeric gt (>) of course, there's no numeric gt @ on surface. $self->path moose attribute accessor, under-the-hood magic coming that. can't see how making numeric gt comparison, since path defined follows: has 'path' => (is => 'rw', isa => 'str'); any ideas on how warning getting thrown? i'm using perl v5.8.8 built i386-linux-thread-multi, if matters in case. update : more mysteriously, i've rewritten conditional follows: my $cond1 = $self->path ne 'contact_us'; $cond2 = !grep { $status == $_ } 2, 3, 8; if ($cond1 && $cond2) { and it's third line throws warning. carp::always 's stack trace isn't sufficiently informative. further disclosure, i'm feeling utterly clueless now: base file fastcgi script bei

c++ - cv::VideoWriter being bipolar -

edit i think understand happening here, not quite how. libavcoded shipped opencv 2.1 not align stack variables, per message displayed time use ffmpeg (message below). depending on how local variables in code positioned before call ffmpeg made, variables or not in locations libavcodec expects them be. compiler did not align stack variables. libavcodec has been miscompiled , may slow or crash. not bug in libavcodec, in compiler. may try recompiling using gcc >= 4.2. not report crashes ffmpeg developers. to able explain , understand how happening requires better understanding of x86 assembly possess. perhaps on in forum shed more light on situation? here more succinct version of source code demonstrates issue: #include <opencv/highgui.h> #include <iostream> int main(int argc, char* argv[]) { if (argc < 3) { return -1; } cv::videocapture cap(argv[1]); std::string str = argv[2]; int fourcc = cv_fourcc('j', 'p',

c++ - Why does std::forward discard constexpr-ness? -

being not declared constexpr , std::forward discard constexpr-ness function forwards arguments to. why std::forward not declared constexpr can preserve constexpr-ness? example: (tested g++ snapshot-2011-02-19) #include <utility> template <typename t> constexpr int f(t x) { return -13;} template <typename t> constexpr int g(t&& x) { return f(std::forward<t>(x));} int main() { constexpr int j = f(3.5f); // next line not compile: // error: ‘constexpr int g(t&&) [with t = float]’ not constexpr function constexpr int j2 = g(3.5f); } note: technically, easy make std::forward constexpr, e.g., (note in g std::forward has been replaced fix::forward ): #include <utility> namespace fix { /// constexpr variant of forward, adapted <utility>: template<typename tp> inline constexpr tp&& forward(typename std::remove_reference<tp>::type& t) { return static_cast<tp&&>(t); }

listView color in android -

hai! in application want change listview text color in android. how can achieve this. solution appreciated... you'll need use custom adapter this. tutorial looks pretty good: custom list view

apache - .htaccess newb - RewriteRule not matching 2nd rule, why? -

i migrating isapi_rewrite .htaccess. i'm having difficulty , think it's basic, i'm not terribly familiar .htaccess. i have 2 rules so: rewriterule ^testing/ /test/index.html?test=1 [nc] rewriterule ^testing/foo-bar/ /test/index.html?test=2 [nc] yet second rule never matches. if go http://mydomain.com/testing/foo-bar/ see first rule. why that? , can fixed? i have many rules (outputted database write .htaccess file )and ordering them in particular order isn't possible. i'm pretty sure mistake not including dollar sign. i'm not think should this: rewriterule ^testing$ /test/index.html?test=1 [nc] rewriterule ^testing/foo-bar$ /test/index.html?test=2 [nc]

OpenLayers event.register not registering -

ok noob openlayers. problem have this... in javascript, after initializing map, adding base osm layer , centering, code ajax lookup of points markers add map, markers in groups, creates new layer every group , adds markers group layer. but, before adding marker layer event register of mousedown simple alert function. the problem here when go click on marker, cursor turns hand thinks want drag map. it's there's other layer on top that's preventing click. tried console logging instead of alert make sure never triggers event click. it's hard code sample display full picture of code, here's snippet: function createmarker(lat, lon) { var icon = new openlayers.icon('/mapicon/icon-b.png', new openlayers.size(12, 20), new openlayers.pixel(-6, -10)); // custom image lonlat = new openlayers.lonlat(lon, lat); var marker = new openlayers.marker(lonlat, icon.clone()); return marker; } marker = createmarker(lat,lon,'example title'); mark

php - $_SESSION unset issue -

i have bizzare case session variable being unset. seems being caused following line: if($_server['script_name'] != "/search.php") unset($_session["search"]); whereas if remove unset() in if clause works fine. curious thing echo arbitrary text in place of unset(), nothing comes out (indicating fine). can see possible issues above line might cause $_session still unset, bearing in mind $_session['search'] array (and multidimensional)?? edit: include server_root.'/classes/session.class.php'; $sess = new session(); session_start(); for example following echo out 'hallelujah': if($_server['script_name'] != "/search.php") ; if(isset($_session["search"])) echo 'hallelujah'; but not (and if statement evaluates false): if($_server['script_name'] != "/search.php") unset($_session["search"]); if(isset($_session["search"])) echo 'hallelujah';

WPF DataGrid validation errors not clearing -

so have wpf datagrid , bound observablecollection . collection has validation on members, through idataerrorinfo . if edit cell in way invalid, , tab away before hitting enter, come , make valid, cell stop showing invalid, however, "!" @ head of row still there, , tooltip reference previous, invalid value. not using mode=twoway datagridtextcolumns solves 1 version of problem, seems problem can appear out of other reasons well. (anyone has explanation of why not using mode=twoway solves in first place close solution problem) the same thing happened me datagridcomboboxcolumn tried dig little deeper. the problem isn't binding in control displays errortemplate inside datagridheaderborder . binding visibility validation.haserror ancestor datagridrow (exactly should doing) , part working. visibility="{binding (validation.haserror), converter={staticresource bool2visibilityconverter}, relativesource=

ruby on rails 3 - How do I render partial via ajax in rails3 and jQuery -

i sth in rails 2: def show_rec_horses rec_horses = horses.find(:all) page["allhorses"].replace_html :partial => "horses/recommended", :locals => {:rec_horses => rec_horses} end how do in rails3 jquery. how can replace html of div partial via ajax call(link_to :remote => true) in rails3. i tried sth (in show_rec_horses.js.erb): $("#interactioncontainer").update("<%= escape_javascript(render("horses/recommended"))%>"); and nothing happens. tried other variations none worked. doing wrong? should approached in other way? answer appreciated. okay, let's start controller. def show_rec_horses @rec_horses = horses.find(:all) respond_to |format| format.html # show_rec_horses.html.erb format.js # show_rec_horses.js.erb end end this make sure correct templates being rendered either html request or javascript request. if need respond javascript request, delete html part. now

android - How/when is a Handler garbage collected? -

inside class of mine have following code: mhandler = createhandler(); private handler createhandler() { return new handler() { public void handlemessage (message msg) { update(); if (!paused) { sendemptymessagedelayed(0, 300); } } }; } the documentation says: http://developer.android.com/reference/android/os/handler.html each handler instance associated single thread , thread's message queue so if understood correctly handler not garbage collected long application thread running, correct? in specific example since handler anonymous inner class has implicit reference enclosing object , whole hierarchy of objects pointed it. looks me recipe memory leaking. btw, can make handler stop sending messages(that's why have if (!paused) ) won't make gced, right? so there way remove handler message queue , gced? in specific example since handler anonymous inner class has imp