Posts

Showing posts from April, 2014

mysql - Some sort of join statement? -

how put these 2 queries single query? select count(id) cnt {$site_id}.proofingv2_packages active='1' select count(id) cnt {$site_id}.proofingv2_package_options active='1' , parent={$row["id"]} order sort $row['id'] id field first query. trying determine if there valid packages. valid package must active , have @ least 1 active option. running 2 queries doesn't seem right. can help? select count(id) cnt {$site_id}.proofingv2_packages pp inner join {$site_id}.proofingv2_package_options pt on pp.active = pt.active , pp.active = 1 if id pk or fk on same on both tables use query select count(id) cnt {$site_id}.proofingv2_packages pp inner join {$site_id}.proofingv2_package_options pt on pp.id= pt.id , pp.active = 1

razor - ASP.NET MVC 3: Using Enumerable extension methods in the view -

given following razor partial view , understanding product nhibernate mapped object calls ienumerable here fire database queries (when not cached). is bad practice? should providing flatter view of data view can make these calls in controller/business logic? @model ienumerable<myproject.data.models.product> <table> <tr> <th></th> <th>total orders</th> <th>fulfilled</th> <th>returned</th> <th>in stock</th> </tr> @foreach (var product in model) { <tr> <td> @html.actionlink(product .name, "detail", "product", new { id = product.id }, null) </td> <td> @product.orders.count </td> <td> @product.orders.where(x=>x.fulfilled).count() </td> <td>

java - tomcat with jsp -

how can compile , run jsp pages using tomcat. should place jsp page. in folder have placed it. a simple example of jsp can <html> <head> <title>hello world jsp</title> </head> <body> <% out.println("hello world"); %> </body> </html> to run jsp page save file in c:\program files\tomcat\tomcat-5.5.9\jsp-examples\ helloworld.jsp start tomcat server. type following url in address bar of web browser. http://localhost:8080/jsp-examples/helloworld.jsp jsp page displayed in web browser. a jsp page converted servlet internally jsp engine.and source file servlet can found @ \work directory in tomcat. for more information on how jsp works , how different servlet take @ what difference between jsf, servlet , jsp? also take at hidden features of jsp/servlet

python - plotting with matplotlib from a module -

it's first time i'm using python plot , guess don't quite understand interactions between objects in matplotlib. i'm having following module: import numpy np import matplotlib.pyplot plt def plotsomething(x,y): fig = plt.figure() ax = fig.add_subplot(111) ax.set_xscale("log", nonposx='clip') ax.set_yscale("log", nonposy='clip') ax.scatter(x,y) #(1) plt.scatter(x,y) #(2) and plots fine when function called (given x , y). a) if comment out (1) or (2) axis' plotted not scatter itself. b) however, if both (1) , (2) uncommented , add vars s=5, marker='+' either (1) xor (2) the figure show both markers (one on top of other) - default 'o' , '+', meaning plot scatter twice. but - if having both (1) , (2) uncommented i'm plotting twice, why need have both (1) , (2) in order see scatter? why in case (a) no scat

design patterns - Singleton class -

we have application, access the config file, have singleton class , object of used. i understand singleton class , provide 1 instance of object. question why can't have opening , closing of config file whenever required. ofcourse, method may expensive since windows need allot handle , dispose off when not in use. are there specific reason using singleton class. thank you, harsha singleton class can pure evil. is. you'll see if ever decide apply loose-coupling code. my advice reconsider design. think of reading config file @ application start , persisting object configuration parameters in memory. can pass object classes/interfaces require config parameters. you may redesign application in way doesn't require numerous writes config file without using singleton (anti)pattern.

java - How to avoid stacktrace HTTP Status 500 page with MaxUploadSizeExceededException -

i have code (like in spring's reference): <bean id="multipartresolver" class="org.springframework.web.multipart.commons.commonsmultipartresolver"> <!-- 1 of properties available; maximum file size in bytes --> <property name="maxuploadsize" value="100000"/> </bean> when user tries upload file on 100 kb server error page http status 500 , stacktrace displayed. how avoid in simplest way? redirect form page , show own error message. assuming it's org.springframework.web.multipart.maxuploadsizeexceededexception , define error-page in web.xml follows: <error-page> <exception-type>org.springframework.web.multipart.maxuploadsizeexceededexception</exception-type> <location>/upload-error.jsp</location> </error-page> note works when don't have <error-page> covers servletexception or 1 of superclasses. otherwise you've brin

javascript assign() -

as far i've tested, 2 methods works, don't know wich 1 best, neither differences between them, , that's i'd know. here's 2 methods : window.location = 'http://www.google.com'; window.location.assign = 'http://www.google.com'; thougths? these 2 methods equivalent. first 1 clearer me. syntax assign be: window.location.assign('http://www.google.com');

ruby - Testing gems within a Rails App -

i'm attempting test service calling anemone.crawl correctly. have following code: spider_service.rb class spiderservice < baseservice require 'anemone' attr_accessor :url def initialize(url) self.url = url end def crawl_site anemone.crawl(url) |anemone| end end end spider_service_spec.rb require 'spec_helper' require 'anemone' describe spiderservice describe "initialize" let(:url) { mock("url") } subject { spiderservice.new(url) } "should store url in instance variable" subject.url.should == url end end describe "#crawl_site" let(:spider_service) { mock("spider service") } let(:url) { mock("url") } before spiderservice.stub(:new).and_return(spider_service) spider_service.stub(:crawl_site) anemone.stub(:crawl).with(url) end subject { spider_service.crawl_site } "should call anemone

Is there any native app for Android FAX? -

i want develop fax application.i searched on google , found links ,applications developing fax apps on android.but want develop application using native app android.in sites read free web services available sending/receiving fax using android mobile application.but don't want use third party services due security reasons.was android provided native app?otherwise please give me advise way better develope application? the fax communication option embedded in gsm protocol since beginning, it's natural design. uses optional gsm data tranfer protocol fax transmission, lame gsm audio quality isn't enough. there's no analogue demodulation when fax goes on gsm network, converts digital on entering provider's pbx. get old nokia 9500 had implemented symbian-based fax application default, worked perfect on gsm-provider. on providers, needed enable additional phone number receiving facsimile messages, on phones siemens m55 receive fax clicking menu option on in

java - EntityManager can't see mapped classes in jar file -

i have set of annotated entity classes live in common.jar file. i'm able build .war file references common.jar, , generate ddl via hbm2ddl. when deploy resulting .war file, though, entitymanager isn't able find mappings of classes resulting in errors 1 below. i have tried including .jar within .war, placing .jar server/default/lib directory, referencing common location, , many variations along way without success. any pointers very, welcome. had thought home free when build succeeded i'm still missing piece somewhere. note: if move source these classes .war project, works perfectly, i'd keep these separate various reasons. 2011-02-22 04:36:26,939 error [org.jboss.seam.exception.exceptions] (http-0.0.0.0-8080-11) handled , logged exception javax.servlet.servletexception: org.jboss.resteasy.spi.unhandledexception: java.lang.illegalargumentexception: unknown entity: com.techma.aoio.model.message @ org.jboss.seam.servlet.contextualhttpservletrequest.run(cont

iphone - Will weak linking the UIKit framework lead to rejection from the App Store? -

i getting issues because of universal app 3.1 4.2 iphone / ipad devices. problem because of uipopoverviewcontroller not being present on older os versions. can weak link uikit framework? apple reject app if use weak linking? as of ios 4.2, manual weak-linking no longer required. have switch llvm compiler. see marco arment's post supporting older versions of ios while using new apis details.

windows - Java FTP Connection Problem with FileZilla -

i have weird problem local testing-setup of simple java url ftp connection. following code fragments (removed try/catches): url url = new url("ftp://127.0.0.1/subone/subtwo/subthree/subfour"); urlconnection conn = url.openconnection(); conn.setconnecttimeout(30000); conn.setreadtimeout(30000); inputstream = conn.getinputstream(); /// , here flies ioexception! ... actual ioexception-cause "subone/subtwo/subthree/subfour", funny things happen on server side: (000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> connected, sending welcome message... (000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> 220 blabla (000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> user anonymous (000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> 331 password required anonymous (000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> pass ************* (000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 230 logged on (000012)23.02

extjs - custom getCellEditor -

i use custom celleditor in grid: getcelleditor: function(colindex, rowindex) { var field = this.getdataindex(colindex); if (field == 'value') { if ( type == 3 ) { return this.editors['number']; } else if ( type == 1 ) { return this.editors['select']; } else if ( type == 4 ) { return this.editors['checkbox']; } } return ext.grid.columnmodel.prototype.getcelleditor.call(this, colindex, rowindex); } },this); type - record.get('type') grid.store. how know type in getcelleditor ? (i don't want use global variable :) ) you can use rowindex parameter, access 'type' current row in grid: grid.store.getat(rowindex).data.type

java - Increase string value -

java question here: if have string "a", how can "add" value string, "b" , on? "a++" string str = "abcde"; system.out.println(getincrementedstring(str)); output bcdef //this code give next char in unicode sequence public static string getincrementedstring(string str){ stringbuilder sb = new stringbuilder(); for(char c:str.tochararray()){ sb.append(++c); } return sb.tostring(); }

java - Session state using guice -

i've session scoped state. first idea hold session scoped servlets. bind servlet this bind(foo.class).in(servletscopes.session); but exception javax.servlet.servletexception: servlets must bound singletons. key[type=foo, annotation=[none]] not bound in singleton scope. so servlets can't have scope servletscopes? whats right way deal session state (yeah, of course it's better write state less servlets/classes/applications)? from understanding can bind whatever want session scope, problem in example foo seems subclass of servlet , , servlets must bound in singleton scope. to resolve this, bind state (called bar ) in session scope , give foo constructor provider<bar> argument (which filled in guice) can access session-scoped state singleton-scoped foo servlet.

css - jQuery menu styling -

Image
i've seen nice jquery-like menu on force.com (after log-in). , can't find tutorial/example on how create using jquery. it looks this: before hover: on hover: on click: anyone knows can find example on how create 1 of these? thanks. this basic 1 :) u need css style how ever u wish :) <ul> <li class="header">header</li> <li class="menu" style="display:none;"> <ul> <li>me</li> </ul> </li> </ul> $('.header').click(function (){ $('.menu').toggle(); });

c# - ASP.Net/SQL: After cancelling query the memory isn't decreasing (DataBoundControl.PerformSelect) -

in asp.net 2.0 production environment have aspx queries kind of query's sql2005 database. queries take while added cancel button. in code opening connection , after call command.executereader(). bind gridview. in cancel button click call command.cancel(), dispose command, connection , datareader. , close connection. after code executed see in sql profiler query cancelled. w3wp.exe still using lot of memory. to test wrote query returns lot of data. in 2 seconds cancell , see memory increased 250mb 2gb. after while memory isn't decreased. i've used jetbrains dottrace memory 3.5 see what's going on memory. see 66,6% of memory in use databoundcontrol.performselect. microsoft says "the performdatabinding method called after data retrieved bind data elements of data-bound control." not data retrieved, call cancelled. happens , why memory not released? anyone idea going on or/and how solve this? just because dispose resource doesnt mean frame

c# - What is the purpose of self tracking entities? -

i've been reading self-tracking entities in .net , how can generated *.edmx file. thing i'm struggling understand generating these entities gives on basic ef entities? also, people have mentioned self tracking entities , silverlight, why use these rather client side or shared classes generated ria services? what point of self-tracking entities , why use them? self tracking entities (ste) implementation of change set (previous .net implementation of change set dataset ). difference between ste , other entity types (poco, entityobject) common entity types can track changes when connected living objectcontext . once common entity detached loose change tracking ability. ste solves. ste able track changes if detach objectcontext . the common usage of ste in disconnected scenarios .net .net communication on web services. first request web service create , return ste (entity detached when serialized , objectcontext lives serve single call). client make changes in ste

embed Flex components into Java Swing -

i'm going embed flex components java app, embedding swf jframe. know how use ez jcom ? don't know flash com or flash activex. please me im working on swing app same, have firefox instance embebbed on swing app. iam using following library, check out the dj project

c# - system.outofmemoryexception When filling DataAdapter? -

i have pull 150k records db. using da.fill(ds,"query") , throwing system.outofmemoryexception . dim dagrid new sqldataadapter(sqlcmd_q) dagrid.fill(dsgrid, "query") dagrid.dispose() i need datatable only. cannot use xml. because need assign mschartcontrol display scotterplot. any suggestions? the first thing i'd check how many columns returning, , data types are. although 150k records lot, shouldn't give oom exception unless each record 13k in length (on 32-bit machine). suggests me either returning way more fields need, or perhaps of fields large strings or binary data. try cutting down select statement return fields absolutely needed display. if doesn't work, may need move datatable list of custom data type (a class appropriate fields).

objective c - iphone - Problem adding subview to app window -

so have done several apps have done in appdidfinishlaunching: method [self.window addsubview:someview.view]; [self.window makekeyandvisible]; this has worked in past, reason in recent endeavor, when add subview, there space @ bottom, until rotate device. space looks size of info bar @ top. guess frame not updating based on device orientation , location of info bar. not manipulating view in other way other adding subview. have idea might going on?? thanks..! check out screenshot of in action... perhaps give go: my view displaying y=-20 dispite frame set y=0. after rotation snaps y=0

html - How can i make two spans be in the same line with 'display:block' on -

i've got following column header , want displayed following known allergies peanut ace... ie line shortned ellipses. my code works puts 1 span underneathe other when add display:block style. it displays this known allergies peanut ace... how can display in same line <th border="0" > <span width="100%" onclick="dropdownresize()" style="padding-top:2px; white-space: nowrap; font-weight:normal;">&nbsp; <i>known allergies </i>&nbsp;</span> <span id="allergiesspan" style="white-space: nowrap; display: block ; overflow: hidden; text-overflow: ellipsis; width:50%;"> <b>peanut, aceti test test test tes test</b>&nbsp;</i></span> </th> you float: left; part has display: block; <th border="0" > <span width="100%" onclick="dropdownresize()"

ejb - Implementing CORBA interface in JBoss -

i'm looking tutorial or additional information on how make ejb (or underlying mbean) accessible via corba. this i've found: http://www.jboss.org/jbossiiop i have existing corba server (java-based, non-standard) , want allow call jboss mbean. mbean exposed via rmi using ejb (v2.1). the current appserver target version jboss-eap-4.3. edit: i'm hoping question vague answered here's update: i want ejb running in jboss register corba orb running on remote separate server. @ least think do. existing corba client connects services via defined idl/interface i'm trying implement via jboss ejb. @ point, said client connects several instances of same interface pull information , manage local (same process) services via interface. want jboss ejb dropped in implementation of corba idl. my understanding of corba rusty , weak begin i'm not getting far. can run orb in jboss enough, it's not clear me how set binding "legacy" corba orb can

delphi - Using C++ DLL in D10 -

i use c++ dll in app. type tcl_bla = function(filename: pchar): integer; cdecl; var cl_bla: tcl_bla; function calllibraryproc(proc: string): pointer; begin result := getprocaddress(handle, pchar(proc)); if not assigned(result) loaded := false; if not loaded messagebox(0, pchar('error => ' + proc), 'alert', mb_ok or mb_topmost); end; ... handle := safeloadlibrary( pchar(currentpath + dll), sem_failcriticalerrors or sem_nogpfaulterrorbox or sem_noopenfileerrorbox ); if (handle < hinstance_error) raise exception.create( dll + ' library can not loaded or not found.' + syserrormessage(getlasterror) ); if handle <> 0 begin // blabla cl_bla := calllibraryproc('cl_bla'); end; ... freelibrary(handle); the codes aboves works fine d6. i'm trying port code can run in delphi unicode support have trouble. i've read documentation embarcadero getprocaddress procedure calllibraryproc(const libr

c# - ObjectPool implementation deadlocks -

i have implemented generic objectpool class have experienced sometime deadlocks (happens @ monitor.wait(poollock)) can spot error? public class objectpool<t> t : new() { private readonly object poollock = new object(); stack<t> stack = null; public objectpool(int count) { stack = new stack<t>(count); (int i=0; i<count; i++) stack.push(new t()); } public t get() { lock (poollock) { //if no more left wait 1 pushed while (stack.count < 1) monitor.wait(poollock); return stack.pop(); } } public void put(t item) { lock (poollock) { stack.push(item); //if adding first send signal if (stack.count == 1) monitor.pulse(poollock); } } usage try { service = mypool.get(); } {

c# - Using user controls having his name on a string -

i have problem, functionality i'm looking is: i have grid , datagrid, according line select datagrid there introduce user control or other user controls different pictures i've made polylinesegments, bezier cuadratic ... introduce call name, build on string, have no way call correctly. this , works putting full name: d48.children.add(new tratspintados.end148()); but put string, tells me not find path in project, want find path inside string. d48.children.add(new thestring()); any ideas? if need instantiate class based on name (without real reference), need use reflection . maybe can lookup name class need, , use activator.createinstance call default constructor. hope want, question text quite confusing me.

Jquery Ui Combobox and onchange on all and setval -

i have web project many selects programmed chained selects. want turn them comboboxes , have 2 main issues. how make onchange of select transfered automatically onchange of combobox , when have set value operation given select transfered combobox , operations wark without extrea recoding... you can see this may adding change event http://jsfiddle.net/mhameen/jbqkp/

Portlets or Sharepoint Web parts OR Pageflakes -

we have new requirement driven user interface team go portal solution our user interface portlets igoogle. our enterprise architecture team recommending portal technology (jsr 168) , think on kill. after reviewing pageflakes architecture wondering whether can come lightweight ui framework accommodate instead of going portal technology. appreciate kind advice. additional information: it java shop heavy investment in websphere suite. of course depends on requirements. in general think portals if want use features provide out-of-the-box (like login, user/role management, cms, etc) , prepared spend time in configuring/maintaining system. anyway jsr-168 quite old , limited, , should use jsr-286 basis instead. you might consider building custom "portal". done javascript framework jquery , or if more comfortable using java-only, component framework vaadin . rely on framework's apis define ui fragments , use modularization mechanisms provide. cannot pageflake

Biztalk Flat File Transform multiple unbound records causing Unexpected Data Error -

Image
i trying import flat file sql database via biztalk 2006 r2. input file has layout follows each line separated cr/lf trailing cr/lf @ end: 00(29characters after) <=== header 07(997characters after) <=== record type 07 (unbounded, 0-?? possible records) 08(86characters after) <=== record type 08 (unbounded, 0-?? possible records) 09(89characters after) <=== record type 09 (unbounded, 0-?? possible records) 10(94characters after) <=== record type 10 (unbounded, 0-?? possible records) 16(35characters after) <=== group footer 17(30characters after) <=== file footer anyway, ran flat file wizard, , created xml, "repeating records" selected, set min , max occurrences of 07,08,09 , 10. changed min 0 , max unbounded. now, no matter do, unexpected data found while looking for:'\r\n' error when validating. i've tried setting default child order postfix , child order of root infix , postfix both. nothing seems help. creating sch

java - Parsing XML file using Xpath in jdk1.4 -

i found following easy solution extracting values xml file. import java.io.ioexception; import org.w3c.dom.*; import org.xml.sax.saxexception; import javax.xml.parsers.*; import javax.xml.xpath.*; public class xpathexample { public static void main(string[] args) throws parserconfigurationexception, saxexception, ioexception, xpathexpressionexception { documentbuilderfactory domfactory = documentbuilderfactory.newinstance(); domfactory.setnamespaceaware(true); // never forget this! documentbuilder builder = domfactory.newdocumentbuilder(); document doc = builder.parse("c:/temp/books.xml"); xpathfactory factory = xpathfactory.newinstance(); xpath xpath = factory.newxpath(); xpathexpression expr = xpath.compile("//book[author='neal stephenson']/title/text()"); object result = expr.evaluate(doc, xpathconstants.nodeset); nodelist nodes = (nodelist) result; (int = 0; < nodes.getlength();

serialization - How to extract data from Mysql column stored in serialized JSON column? -

i have column in mysql db contains serialized data (used php json encode serialize them). here example: {"name":"group ltd","email":"support@domain.org","auth":"andrey ucholnik"} is there built in function in mysql extract these values without php ? mean build query unserialize data. of course possible use combination of locate , substr function prefer built in if possible. there no build in function in mysql using small code in php can under: <?php $json = '{{"generated": "2010-02-26t22:26:03.156866 blahblahblah ": null, "thumbnail_url": "http://thumbs.mochiads.com/c/g/tetword-pro/_thumb_100x100.jpg", "screen4_url": "http://thumbs.mochiads.com/c/g/tetword-pro/screen4.png", "leaderboard_enabled": true, "resolution": "600x550", "width": 600}]}}'; $out = json_decode($json, true);

View permissions change in Git -

before commit files, how can see file permission changes files? have files git status says had changed , should added commit git diff doesn't show anything. thanks well, since question has been edited ask different, here's different answer: git status -v list node changes diffs. can filter down mode changes running through grep context filter: git status -v | grep '^old mode' -c 1 (sample result below) diff --git a/matrix.cc b/matrix.cc old mode 100644 new mode 100755

How to make force build with interval with CCNet -

on our ccnet, there build (called release) build full package of application , copy msi on ftp server client. there no trigger on project , should manually launched via cctray or dashboard. is possible manually force project project start on fixed time (like 01:00:00) ? thx, simply use scheduletrigger tag. <scheduletrigger time="01:00" buildcondition="forcebuild" name="scheduled"> <weekdays> <weekday>monday</weekday> </weekdays> </scheduletrigger> you can specify day in week weekdays tag.

Android: textView-set y-coordinate dynamically -

Image
i tried using textview.settranslationy(float) change y-coordinate of textview not seem work. textview.settop() seems same function documentation says method meant called layout system , should not called otherwise, because property may changed @ time layout. use textview.gettranslationy() y-coordinate. how can set y-coordinate of textview? if doing above wrong, kindly suggest alternative way. maybe there method set y-coordinate have not found yet! my situation: have textview height should change based on value received. if use textview.setheight(int), height increases top bottom. want increase bottom top. change y-coordinate of textview every time set it's height. cheers, madhu screen shot of layout: what if change height of textview only? said... the height increases top bottom so... in case can align textview @ bottom. instance, if using relativelayout container of textview , can use android:layout_alignparentbottom="true" .

Borland Delphi 7 - Windows 7 Problems -

several borland delphi 7 applications having problems when executed on windows 7 pc. one process working on xp pc not working on 7 pc deletes file , moves file. the process uses these commands: sysutils.deletefile(filename) or idglobal.copyfileto(filepathandnamecurrent, filepathandnamenew) here error message: [dbnetlib][connectionwrite (send()).]general network error. check network documentation the copyfileto function moves file user pc network folder. user has access folder. i thinking these functions not compatible 7. can confirm? without re-writing these applications in c#, running xp mode on 7 pc solution? the error message provide has nothing copying or deleting file, suspect issue isn't functions mention. dbnetlib is, if recall correctly, means connecting sql server or other databases. apparently application cannot reach sql server (or other database) instance. perhaps connection string incorrect, or network connection interrupted,

Last login time of Windows Domain user who used Cached Credentials? -

the following snippet queries domain controller last login time of domain user account: private static datetime lastlogontimeofdomainuser(string username, string domain) { datetime latestlogon = datetime.minvalue; directorycontext context = new directorycontext(directorycontexttype.domain, domain); string servername = null; domaincontrollercollection dcc = domaincontroller.findall(context); foreach (domaincontroller dc in dcc) { directorysearcher ds; using (dc) using (ds = dc.getdirectorysearcher()) { ds.filter = string.format("(samaccountname={0})", username); ds.propertiestoload.add("lastlogon"); ds.sizelimit = 1; searchresult sr = ds.findone(); if (sr != null) { datetime lastlogon = datetime.minvalue; if (sr.properties.contains("lastlogon")) { last

ruby on rails - Heroku rake db:migrate -

when run heroku rake db:migrate keep getting: migrating createusers (20110216103237) == createusers: migrating ==================================================== -- create_table(:users) even though users table has been created before. know why might occurring? thanks i think may have changed database name in database.yml file or may have accidently deleted last entry in schema_migrations table. or maybe did rake db:rollback .

css - Box Shadow in Firefox -

i have problem box-shadow in firefox - "lags": this css: -moz-box-shadow : 0 0 5px #333; -webkit-box-shadow : 0 0 5px #333; box-shadow : 0 0 5px #333; in chrome, works (without "lag"), in firefox it's slow. how can fix this? this has been known bug in firefox years. box-shadow can cause slow scrolling or, when animating element box-shadow assigned, firefox can crawl. fix eiher restrict blur radius 10px or filter out box-shadow firefox: .fubar { box-shadow: 10px 10px 30px #000; -moz-box-shadow:none !important; } @-moz-document url-prefix() { .fubar { box-shadow:none; } }

css selectors - Overwriting holder behavior with CSS when clicking on a link inside holder -

i have gallery, , each item has .item class. inside .item there link remove it: <div class="item">title of item <a href="#" class="remove">remove</a></div> when press on .item, displays red border div.item:active { border: 1px solid red; } now, problem not want .item display red border if press on .remove link inside. how can solve issue? feasible? div.item:active a.remove:active { ??? } thanks! jquery solves problem. use $('a.remove').click(function(){ $('div').removeclass("classname"); }); read this reference

c# - .NET GDI+ Invert Text -

what best method of inverting text using .net , gdi+. invert, mean draw different background/foreground colors. term best subjective, define mean speed, lines of code, easiest (i.e. there 1 function call can make?). c# or vb.net fine. you can fillrectangle brushes.black , drawstring brushes.white . depending on scenario, can size of rectangle calling measurestring .

logback - How to enable response time logging in Jetty 7 -

apache , tomcat both make easy log response times out server access log (with %d pattern), i've been unable find equivalent support in jetty, either default ncsarequestlog or using logback-access (my preferred logging setup). is there way of getting jetty log these times? see being possible use custom handler of kind gather information , make available logging handler, hopeful statisticshandler me it's tracking information generate aggregate stats. call setloglatency(true) on ncsarequestlog

c# - threading problem (reading and writing to one excel file) -

i have application, something. generaly main task analise , drawing charts after getting data excel file. application can @ same time max. 10 analise , each of them execute in separate thread in separate tabpage control. great moment when appearing 3 problems. i can't reading data 1 excel file few analises. if i'm using 1 file 1 analise , want use same file it's not possible beacuse there massage file acctually using process. read data excel file i'm using oledbconnection schema. how solve problem. i have same problem write data 1 file. how force application write same message different threads 1 file. if want close application (when 1 of analise working) there show me message communication: "interruption lasted thread (or that)". don't know why. support please me solve problems beacuse i'm trying solve sice monday , there no effect :( possible example string fullexcelfilepath = "c:\excelfile.xls"; excel.application

How is the ternary operator evaluated in JavaScript? -

regarding ternary ( ? : ) operator in javascript, know how evaluated typical browser's javascript interpreter: alternative a: evaluate first operand. if result of first operand true, evaluate , return second operand. else, evaluate , return third operand. alternative b: all 3 operands evaluated. if result of first operand true, return result of second operand. else, return result of third operand. alternative c: of course, if neither alternative nor alternative b accurately describe how ternary operator works, please explain me how works. the "alternative a": (1)? functionone(): functiontwo() if put simple alert message on both functions, functionone display message. function functionone(){ alert("one"); } function functiontwo(){ alert("two"); }

objective c - iphone MediaPlayerController does not show the media player -

hi, i developing app contains 3 tab view control. 1 each audio, video , images. when select video tab, have items displayed in table view format on selection of cell, video shown. example. (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { mpmovieplayercontroller *movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:[nsurl urlwithstring:url]] ; [movieplayer play]; } the problem though able play video unable see video , can hear audio. in addition, if close app while video playing, , start app, application crashes. can please let me know how should go ahead ? after spending more time, have found out version above 3.2 1 has use mpmovieplayerviewcontroller. the use of same resolved issue. if ([[[uidevice currentdevice] systemversion ] doublevalue] >= 3.2) { mpmovieplayerviewcontroller *mediaplayer = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:[nsurl urlwithstring:urladdress]]; if (

Java - Count number of symbols in string -

let's have string: string helloworld = "one,two,three,four!"; how can make counts number of commas in string helloworld ? the simplest way iterate through string , count them. int commas = 0; for(int = 0; < helloworld.length(); i++) { if(helloworld.charat(i) == ',') commas++; } system.out.println(helloworld + " has " + commas + " commas!");

optimization - How to compress CSS -

i've looked @ half dozen css optimisers out there. i'm looking 1 turn: background-image: url(../images/background.png); background-repeat: repeat-x; background-color: #c0c0c0; into single background property: background: #c0c0c0 url(../images/background.png) repeat-x; how can this? have hand? try http://www.cssoptimiser.com/ input: body { background-image: url(../images/background.png); background-repeat: repeat-x; background-color: #c0c0c0; } (i ticked "do not remove line breaks") output: body { background:#c0c0c0 url(../images/background.png) repeat-x } note optimised away space - asked background:<space>#... :) there may other/better tools can this, site fulfill wish.

ruby - Rewrite shared example groups in rspec2 -

in rspec 1 describe "something", :shared => true include somemodule # has :a_method method def a_method(options) super(options.merge(:option => @attr) end "foofoofoo" end end describe "something else" before(:each) @attr = :s_else end it_should_behave_like "something" "barbarbar" a_method(:name => "something else") something.find("something else").name.should == "something else" end ... end that is, use :shared => true not refactor examples share method definitions , attributes. realize example contrived, how 1 write in rspec >= 2 without touching somemodule module or something class? you can shared_examples_for shared_examples_for "something" include somemodule # has :a_method method def a_method(options) super(options.merge(:option => @attr)) end "foofoofoo" end end and call it_behaves_like :

c# - SharePoint memory leak -

does contain memory leak? i've been trying better understand memory leaks, can't tell if have corrected this? if not, how correctly dispose of spweb object , spsite object? using (spweb owebsite = new spsite(weburl).openweb()) //open sp web { splistcollection colllist = owebsite.lists; //open lists foreach (splist olist in colllist) //for each list execute { if (!olist.hidden) //if list hidden else nothing { listsitesdropdownbox.items.add(new listitem(spencode.htmlencode(olist.title), spencode.htmlencode(olist.title))); viewstate["item" + counter] = spencode.htmlencode(olist.title); counter++; } } } yep, does. dispose of spweb forget disposing of spsite . right way this: using (var site = new spsite(weburl)) using (var web = site.openweb()) { // ... } note equivalent to: using (var site = new spsite(weburl)) { using (var web = site.openweb()) {

Getting a random object from an array, then remove it from array. iphone -

i having problem arrays, want object picked randomly array, , remove , remove other objects specified in "if" statement. what did.. in .h nsmutablearray *squares; int s; nsstring *randomn; next, in .m create new array: -(void) array{ squares = [[nsmutablearray alloc] arraywithobjects: @"a", @"b", @"c", nil]; } and choose random object, if properties of "if" met, remove object array, while loop again. -(void) start{ s=5; while (s > 0){ //i tried without next line.. randomn = nil; //also tried next line without ' % [squares count' randomn = [squares objectatindex:arc4random() % [squares count]]; if (randomn == @"a"){ [squares removeobject: @"a"]; [squares removeobject: @"b"]; s = s - 1; } if (randomn == @"b"){ [squares removeobject: @"b"]; [squares removeobject:

android - Galaxy Tab and marker-based Augmented Reality -

well, bought samsung galaxy tab ar since decent android tablet rear camera , i'm trying marker-based ar on , well.. it's fruitless :( i tried following: andar project : getting errors 3 projects checked out svn nyartoolkit android : runs can see camera feed, no augmentations occur. qualcomm sdk : looking forward one, until found out galaxy tab not in supported devices' list! :'( has ever managed have marker-based ar on galaxy tab ? if so, how did manage ? thank you! f. i have not tried it... u can try flartoolkit... it's written using flex... u can write flex program , run on android air... working using flartoolkit.

javascript - How to set cookies in a rails 3 app -

i've added application.js doesn't create cookie. in fact breaks other javascript functions below it. function gettimezone() { var current_time = new date(); var offset = -(current_time.gettimezoneoffset() / 60); cookie.set({timezone: offset}); } gettimezone(); what doing wrong? cookie isn't build in javascript class , don't think it's part of prototype or jquery either. unless you've included javascript defines cookie , i'd that's problem. cookie's bit of pain work in raw javascript i'd recommend using 1 of 2 plugins below make life easier. for prototype: http://jason.pureconcepts.net/articles/javascript_cookie_object for jquery: http://www.electrictoolbox.com/jquery-cookies/

javascript - Recursive issues -

when have 2 text fields listen change event 1 another, causes me error saying too recursion . has solution? thanks well can hold flag holds identity of true event dispatcher. , break event triggering if matches.

jquery - Get innertext of a <td> and append new row with results -

i have data formatted table. want setup onclick button url of link inside 1 of td's in row , load results in row below. here's example of row. assume there no id's in table. <tr> <td>title of something</td> <td><a href="link_to_something.html">link</></td> <td><button onclick="load_file(this.??);">show page</button></td> </tr> the javascript need to: function load_file( , ) { // url in second <td> // urlencode url // append new <tr><td colspan="3"></td></tr> below // load some_file.php , pass variable (file_url) , value (urlencoded) using .load method in jquery , load results newly appended <td> } i have read on .load method in jquery. possible load results if td has no id? i guess set id table elements if proves difficult without id's, trying keep php script simple , "as nee

c# - There was an error generating the XML document -

hi have following code perform xml serialization: private void savebutton_click(object sender, routedeventargs e) { string savepath; savefiledialog dialogsave = new savefiledialog(); // default file extension dialogsave.defaultext = "txt"; // available file extensions dialogsave.filter = "xml file (*.xml)|*.xml|all files (*.*)|*.*"; // adds extension if user not dialogsave.addextension = true; // restores selected directory, next time dialogsave.restoredirectory = true; // dialog title dialogsave.title = "where want save file?"; // startup directory dialogsave.initialdirectory = @"c:/"; dialogsave.showdialog(); savepath = dialogsave.filename; dialogsave.dispose(); dialogsave = null; formsaving abc = new form

ios4 - UITableviewCell with RemoveButton -

i have 1 tableview in added uibutton each tableviewcell named remove when click remove button appropriate cell data remove tableview and added uibutton programmatically now want perform remove option. thanks in advance.... try one: - (uitableviewcell *)tableview:(uitableview *)atableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *s = @"cell"; uitableviewcell *cell = (uitableviewcell *)[tableview dequeuereusablecellwithidentifier:s]; asyncimageview *asyncimage; uibutton *button = nil; if ( cell == nil ) { cell = [[[uitableviewcell alloc]initwithreuseidentifier:s] autorelease]; uibutton *removebtn = [uibutton buttonwithtype:uibuttontypecustom]; [button addtarget:self action:@selector(remove:) forcontrolevents:uicontroleventtouchupinside]; …. [cell addsubview:button]; } …..

unix - How does shell execute piped commands? -

i want understand how shell executes piped commands ? e.g. cat | more. aware executing normal command shell fork, execute , child returns. how shell internally handle execution of piped commands ? considering example cat | grep , shell first forks start cat , , forks once more start grep . before calling 1 of exec* family of functions in 2 newly created processes start 2 programs, tricky part setting pipe , redirecting descriptors. pipe(2) system call used in shell process before forking return pair of descriptors both children inherit - reading end , writing end. the reading end closed in first process ( cat ), , stdout redirected writing end using dup2(2) system call. similarly, writing end in second process ( grep ) closed , stdin redirected reading end again using dup2(2) . this way both programs unaware of pipe because work standard input/output.

Error/Warning parsing RSS XML :( -

i did <blink> $xml = file_get_contents(http://weather.yahooapis.com/forecastrss?w=12797541); $yahoo_response = new simplexmlelement($xml , 0, true); </blink> and got xml parse warning this: php warning: simplexmlelement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: i/o warning : failed load external entity &quot;&lt;?xml version=&quot;1.0&quot; ..... with important part of message being this: i/o warning : failed load external entity and not parse line: echo (string) $yahoo_response->rss->channel->item->title; does know how fix or around it? thanks, alex 3rd argument of simplexmlelement() specifies if $data url. should either $xml = file_get_contents('http://weather.yahooapis.com/forecastrss?w=12797541'); $yahoo_response = new simplexmlelement($xml , 0, false); // false, not true or $xml = 'http://weather.yahooapis.com/forecastr

java - what is the reason for the existence of the JAVA_HOME environment variable? -

many java based application requires set java_home env variable. what's purpose of variable? environment variables strings contain information such drive, path, or file name. the java_home environment variable points directory java runtime environment (jre) installed on computer.

serialization - serialize Ext.data.JsonStore content -

how serialize jsonstore content? tried ext.encode(store.data.items), throws exception "too many recursions". here's quick function should work function(store) { if(typeof(store) != 'object') { return ''; } var dataarray = []; var encodeddata = ''; var data = store.data.items; ext.each(data, function(item, index, array) { dataarray.push(item.data); }); return ext.encode(dataarray); },

android textView not whole appear -

i have textview,its height fixed,and text characters sum not uncertain, <textview android:id="@+id/item_content" android:layout_width="wrap_content" android:layout_height="30dip" android:layout_marginbottom="5dip" android:ellipsize="end" android:textcolor="#000000" /> but when text height > height of textview,in last line lower part oftext characters cutted as http://i.stack.imgur.com/qca9c.jpg , http://i.6.cn/cvbnm/5e/b7/41/f929ffab5b4e007e6e643ef5340325eb.jpg use red pen mark pls tru setting height wrap_content rather fill_parent. <textview android:id="@+id/item_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="5dip" android:ellipsize="end" android:textcolor="#000000" />

android - Does using the ActionBar in Honeycomb really mean i have to create an extra App? -

last week began honeycomb update app , since documentation has become available. 1 of big things change in app use of actionbar. little disappointed following sentence doumentation: however, if want use action bar apis, such add tabs or modify action bar styles, need set android:minsdkversion "11", can access actionbar class. does mean have create app if want take advantage of actionbar or there way around this? no, bit of documentation incorrect. need android:targetsdkversion="11" , plus proper settings in options menu xml resource, use action bar. if wish use features of action bar require access methods exist on api level 11 , higher, need take care not execute portion of code on older devices. here sample project put custom view action bar, try configure view on honeycomb or higher. same code works fine on older versions of android, 1.6.

Generating statistics using PHP and Zend Framework -

i want build statistics generator should able use intervals such hour, day, week, month etc , group on different levels such customer, campaign, project. first built standard action function in controller feel might want break out , make class , make reusable. there standards building these type of statistics generators in general way? add data collections, set interval , set grouping , start , end date feels usage needing. check out http://www.phpclasses.org/ built classes if using zend framework thin mean word model not class if using mvc building model o , statics use views , use google analytics pointless trying build 1 better

unix - Shell script traversing the all subdirectories and modifying the content of files -

i need modify number of files inside directory. need modify files contain particular text , have replace new text. so thought of writing shell script traverse through subdirectories , modify content i'm having problem while traversing possible directories. you can use find traverse through subdirectories looking files , pass them on sed search , replace text. e.g. find /some/directory -type f -name "*.txt" -print -exec sed -i 's/foo/bar/g' {} \; will find txt files , replace foo bar in them. the -i makes sed change files in-place. can supply backup-suffix sed if want files backed before being changed.

html - Scrolling of whole page instead of inner div only -

Image
i'm fiddling css again again... http://www.kebax.dk/test.php as see, container called map scrolling independently of rest of container . how can make whole page scroll when more content placed in content ? i have tried using overflow attribute, without luck... edit future references: body { background:#000000; margin:0; padding:0; overflow:scroll; overflow-x:hidden; } #container{ position: relative; height: 100%; width: 950px;; background: yellow; margin-left:auto; margin-right:auto; overflow:auto; } #map { position:absolute; top:80px; bottom:0; left:0; right:0; background:#fff; overflow:auto; overflow-x:hidden; } #header { height:80px; width:900px;