Posts

Showing posts from August, 2010

c# - Difference between wiring events with and without "new" -

in c#, difference (if any) between these 2 lines of code? tmrmain.elapsed += new elapsedeventhandler(tmrmain_tick); and tmrmain.elapsed += tmrmain_tick; both appear work same. c# assume mean former when type latter? i did this static void hook1() { someevent += new eventhandler( program_someevent ); } static void hook2() { someevent += program_someevent; } and ran ildasm on code. generated msil same. so answer question, yes same thing. compiler inferring want someevent += new eventhandler( program_someevent ); -- can see creating new eventhandler object in both cases in msil

Excel with C# connection -

i have code exapplication = new excel.application(); excel.workbook wb = exapplication.thisworkbook; wb.connections.addfromfile("c:\test.odc"); and when trying compile it, gives me following exception: exception hresult: 0x800a03ec you should replace wb.connections.addfromfile("c:\test.odc"); by wb.connections.addfromfile(@"c:\test.odc"); although don't think exception because of this.

templates - C++ type registration at compile time trick -

i have following situation: suppose have bunch of types (functors) want register/compile in during compilation, preferably boost::mpl::vector. know trick nicely? my desire have hpp file implements functor type , registration file, macro brings in type compilation. for example // registered.hpp register("functor1.hpp") // implementation register("functor2.hpp") ... boost::mpl::vector<...> types; // full registration vector hopefully makes sense. thank you there way register types 1 one , retrieve of them in form of mpl::vector or similar. i've learned trick on boost mailing lists (perhaps dave abrahams, although can't recall sure). edit: learned slide 28 on https://github.com/boostcon/2011_presentations/raw/master/thu/boost.generic.pdf . i won't use mpl in code make self contained. // maximum number of types can registered same tag. enum { kmaxregisteredtypes = 10 }; template <int n> struct rank : rank<n - 1> ...

java - Error: Path Must Include project and resource name:/<jar file name> in eclipse IDE -

i adding external jar file web server application based on java servlets in eclipse ide. when tried add jar file error occured "an internal error occurred during updating tag library index . path must include project , resource name:/<jar file name>". please let me know path application asks or there specific directory have put jar file or file have update location of jar file. steps add external jar 1.right click on project 2.click on properties 3.click on java build path 4.go libraries tab , click on add external jar button 5.select jar file local directory 6.press ok button

sql server - How to make MSSQL query in PHP case-sensitive? -

in script on our web server, display users online in-game looking @ mssql database specific values displaying members based on such data. lets user login 'blargh' has 3 characters: master, master, , blargh lets has logged in 'master' the below script value of '1' in 'connectstat' field grab username along other pertinent data, display it. the problem lies when has 2 similar in-game names on single account. with above example, script show master, , master both online, though 1 in-game. believe case sensitivity issue when identifies 'master' online, it's ignoring case , believes 'master' online well. anyone have ideas on how isolate making case-sensitive? $query = 'select gameidc, resets, class, mapnumber, mapposx, mapposy, servername, onlinehours, clevel memb_stat, accountcharacter, character memb_stat.connectstat=1 , accountcharacter.id=memb_stat.memb___id , accountcharacter.gameidc=character.name collate chine...

Doxygen and Objective-C Protocols -

i'm using doxygen wizard on mac (gui doxygen 1.7.3). i found out if, in header class, #import header file in protocol defined, first member of class appears in docs pre-appended path class' header file, this: (doxygen html output) protected attributes: users [username] desktop directoryname classname h nsstring* mystringmember (further attributes display ok) if remove #import, problem goes away (but need protocol). i read somewhere doxygen used 'choke' on obj-c protocols in past, bug should fixed now. else experiencing similar? you may want consider appledoc , targeted @ cocoa developers , produces output.

c# - RegisteredTfsConnections.GetProjectCollection returns null on test server, but not on dev server -

see topic. works fine on devmachine vstudio2010 installed. not on clean test server (the setup project includes used tfs assemblies). the docs http://msdn.microsoft.com/en-us/library/ff735997.aspx not helpful return value: null if no match found. should use method tfs connection? i'm trying list , download files specific project. update i reverted this: var uri = new uri("http://myserver/"); var tfs = new teamfoundationserver(uri); var versioncontrol = tfs.getservice<versioncontrolserver>(); which works. teamfoundationserver obsolete. know how in new way. i use: var uri = new uri("http://myserver/"); var server = tfsteamprojectcollectionfactory.getteamprojectcollection(uri);

Rails 3 form_for ajax call -

i have method in controller: def work_here @company = company.find(params[:id]) current_user.work_apply(current_user, @company) redirect_to company_path end on view: <%= render 'companies/work_form' if signed_in? %> _work_form.html.erb: <%= form_for company, :remote => true, :url => { :controller => "companies", :action => "work_here" } |f| %> <%= f.hidden_field :id, :value => company.id %> <%= f.submit "i working here" %> <% end %> and have work_here.js.erb file: $("#work_at_form").html("<%= escape_javascript("render('companies/works')") %>") but form works without ajax request(in other pages ajax forks fine), js.erb file never use. can give me advise? thanks. the work_here.js.erb can't read because never call it. redirect allways do. render when request js format. def work_here @company = company.find(params[:id]) cur...

java - Struts 2 parameter coding problem during redirect to another action -

i try redirect action , transmit string parameter. works without problems, have coding problem if using german umlauts. here code: first action has field message getter , setter. in action set string. private string message; public string action1() { message = "ö"; return success; } second action has field message getter , setter too. private string message; struts.xml definition of both actions <action name="action" method="action1" class="de.samba.control.actions.action1"> <result name="success" type="redirectaction"> <param name="actionname">action2</param> <param name="message">${message}</param> <action name="action2" class="de.samba.control.actions.action2"> <result name="success">/pages/showmessage.jsp</result> if don´t using redirection , show message on jsp, works fine. coding co...

iphone - Crash with CALayer, memory problem -

my hotpaw2 solution incremental drawing problem. alas, discovered issue solution implemented it. reveals memory-induced crash when press botton @ bottom of iphone suspend app , restart it. (i can run app indefinitely long don't this). crash occurs @ indicated line below, occurs in foobar, subclass of uiview: - (void)drawrect:(cgrect)rect { cgcontextref ctx = uigraphicsgetcurrentcontext(); // @@crash here: program received signal exc_bad_access [backinglayer renderincontext:ctx]; // render backing layer current context [self randomrectangle: ctx]; } in interface of foobar have declared backing layer instance variable: @private nstimer* timer; calayer *backinglayer; in implementation of foobar, backinglayer occurs once more, in initwithframe , in following paragraph: backinglayer = self.layer; // [backinglayer retain]; // set color space , background color cgcolorspaceref colorspace = cgcolorspacecreatedevicergb(); cgfloat components[4] ...

linux - If I installed Mongo through apt-get, how do I update it? -

it seems gave me 1.4.4 not latest. is normal? want 1.6. i'm afraid if apt-get uninstall, bad things happen. i'd recommend using official ubuntu , debian packages ... http://www.mongodb.org/display/docs/ubuntu+and+debian+packages that'll make sure you'll latest stable version. if use on ubuntu (for example) mongodb install /var/lib/mongodb/ (instead of /data/db/ ) so, if data in /var/lib/mongodb/ should fine doing uninstall , reinstall offical packages ... shouldn't remove dir unless horible port in first place! simply making backup copy of dir should trick if worried, practice anyhow. you can move db files into dir after install , mongodb pick them (normally.) before however, make sure clean shutdown first! way won't end mongod.lock file won't let restart w/o repair. $ ./mongo > use admin > db.shutdownserver()

c# - Windows service exception not handled -

i have regular c# service based on class servicebase. service loads on startup c++ dynamic link library. times happens service crash in unmanaged code. unfortunately event viewer gives brief description of this. how looks 1 if messages: application: streammapservice.exe framework version: v4.0.30319 description: process terminated due unhandled exception. exception info: exception code c0000005, exception address 00000012". with 99% certainty problem in unmanaged code. problem happen (typically once day) , when runned service. under debugger ok. find out problematic code edited main method in following manner: static void main() { try { if (!environment.userinteractive) { servicebase[] servicestorun; servicestorun = new servicebase[] { new service1() }; servicebase.run(servicestorun); } el...

php - Which Editor/IDE is used at Facebook -

i'm wondering editor/ide used @ facebook, because of reasons: when i'm looking @ videos on facebook site, see developers using macbook there work facebook has big code base (i guess :) ) i mean, @ 2 screen workspace i'm using eclipse php/js/etc. stuff. on 13" macbook pro, eclipse needs space. i'm rolling "big" projects , in opinion vim has not anoth features (like intelligent code assist) those. i guess developers @ facebook use different ides , editors, know ones used most. thanks in advance!!

.htaccess - How to redirect a webpage with .htacess -

rewriteengine on rewritebase / rewriterule viewtopic\.php?t=([^/]+)$ http://newdomain.com/viewtopic.php?t=$1 i have code in htaccess not working, idea? well, can see want redirect page of viewtopic.php?t=1 viewtopic.php?t=2000 new domain. please provide me solution. thanks. in addition daniel gehriger's solution, add [l,r=301] @ end of line. make apache send 301 page moved code client, informing page has indeed moved permanently. cause search engines, rss readers etc update links (if clever enough).

asp.net - CSS Problems: Advertise over 2 divs, layout problem -

i have div-layout on asp.net page. left div menu, middle div content , right div online user list. divs float:left , height/width on place , works problemless. now must have advertise on left , middle div together. my first try have in middle , set margin-left:-270px;. the advertise-div on menu , cant click anymore. my second try have in left div , overflow easyly on middle div, of course don't work, because left menu div has width: 300px; , exacly there end banner. here see: http://s3.imgimg.de/uploads/4b247298bjpg.jpg how do? it's hard tell without seeing html/css, perhaps easiest way to put advert in it's own <div> under of left, middle, right divs, , use margin-top: -110px shift up. it's not clean solution. if can't work, or plain don't it, post code.

c# - Can parameters be generically accessed? -

i have lot of functions this. each has n arguments , each creates sqlparamater array each paramater being of similar form. [webmethod] public static string accessserver(string datafield1, string datafield2, string datafield3) { string value; sqlparamater[] param = new sqlparameter[len] // len amount of arguments param[0] = new sqlparameter("@datafield1", datafield1); param[1] = new sqlparameter("@datafield2", datafield2); param[2] = new sqlparameter("@datafield3", datafield3); ... // param return value; } this looks can done generically using combination of reflection , accessing paramaters in generic way. ideally method of form public static sqlparamater[] getparams(sometype paramaters) and sqlparamater[] param = getparams(...) i'm not sure how pass on paramaters generically. [edit] note names of these datafields important . it's not array of strings rather set of key/value pairs. [/edit] ...

c# - How to use custom sections in app.config from a t4 template -

i trying access custom section in app.config file t4 template in vs2010, assembly defines custom section cannot loaded. i'm using configurationaccessor section (ref http://skysanders.net/subtext/archive/2010/01/23/accessing-app.configweb.config-from-t4-template.aspx ). app.config: <configsections> <section name="myproviders" type="system.web.security.mysection, myassembly" /> </configsections> <myproviders default="sqlmyprovider"> <providers> <add name="sqlmyprovider" ... connectionstringname="myconnectionstring" /> </providers> </myproviders> calling line in .tt file: mysection section = (mysection)config.configuration.getsection("myproviders"); gives error: running transformation: system.configuration.configurationerrorsexception: error occurred creating configuration section handler myproviders: not load file or assembly 'mya...

uitableview - How can we horizontally scroll tableview in iPhone SDK? -

i want scrolltableview horizontally vertically. how can it? i'd suggest making uiscrollview same size screen , making uitableview bigger screen.drop tableview scrollview. set scrollview high contensize.width , tweak work desire.

javascript - How do I bind to the click event from within the click event when I need to do it repeatedly? -

i've got code when click on word, replaced word. <script> $(document).ready(function() { $('.note_text').click(function(){ $(this).remove(); $('#note_div').append('<span class="note_text">new</span>'); // re-applying behaviour code here }); }); </script> <div id="note_div"> <span class="note_text">preparing</span> </div> i need appended word have same click behaviour. best way this? change $('.note_text').click(function(){ to $('.note_text').live('click',function(){ this cause on page ever gets class 'note_text' have behaviour set .live

SQL questions - Medium difficulty -

i working through link , stuck on q7 , q8 on website: http://sqlzoo.net/a3m.htm my attempt q7 is: select tprod.dscr, sum(qnty), max(tpurcd.recv) tprod, tpurcd tprod.code = tpurcd.prod group tprod.dscr, tpurcd.recv q8 attempt: select tpurcd.cust, tpurcd.recv, qnty tpurcd, tprod tprod.code = tpurcd.prod , tpurcd.qnty * tprod.pric table info listed here: http://sqlzoo.net/a3.htm any appreciated! using mysql 7 select tprod.dscr description, sum(tpurcd.qnty) quantity, max(tpurcd.recv) 'most recent order' tprod inner join tpurcd on tprod.code = tpurcd.prod group tprod.dscr 8 select tpurcd.cust 'customer code', tpurcd.recv 'received date', sum(tpurcd.qnty * tprod.pric) 'total value' tprod inner join tpurcd on tprod.code = tpurcd.prod group tpurcd.cust, tpurcd.recv having sum(tpurcd.qnty * tprod.pric) > 475

PHP - how to detect broken session end datetime? -

usercase: need track user's duration on site. calculated (end datetime - start datetime). works fine if user clicks signout. system can record end datetime. issue in edge cases: user's session ends due - loss of internet connection @ user's end, browser closed, system went down, etc. in these cases how system know end datetime can calculate duration.need end datetime calculated close possible real datetime. if not possible upto 5 mins of accurate fine. one possible way see keep pinging client system , check if active or not. dont want adds unwanted bandwidth. other way info edge cases? why not check time of last pageview? checking browser window open-time won't people me leave tabs open... not mention quite hard cover of edge-cases (browsers don't support js, people behind proxies, etc). last pageview should accurate few minutes, , have least overhead/complexity while still maintaining decent level of accuracy...

get file path & file name value from right click windows, c# -

i have own application , want add right click menu on windows defining command on key registry such c://myapp.exe "%1" my problem want file name , path file choosed clicking right click menu , passing value visual studio c#: static void main(string[] args) { string c = "thefilepath&filename" } how value fill string? pardon me english.. tq the value should in args array of main method.

UTF-16 Encoding in Java versus C# -

i trying read string in utf-16 encoding scheme , perform md5 hashing on it. strangely, java , c# returning different results when try it. the following piece of code in java : public static void main(string[] args) { string str = "preparar mantecado con coca cola"; try { messagedigest digest = messagedigest.getinstance("md5"); digest.update(str.getbytes("utf-16")); byte[] hash = digest.digest(); string output = ""; for(byte b: hash){ output += integer.tostring( ( b & 0xff ) + 0x100, 16).substring( 1 ); } system.out.println(output); } catch (exception e) { } } the output is: 249ece65145dca34ed310445758e5504 the following piece of code in c# : public static string getmd5hash() { string input = "preparar mantecado con coca cola"; system.security.cryptography.md5cryptoserviceprovider x = new system.securi...

c# - Intermittent errors while de-serializing object from XML -

i have program takes objects stored xml in database (basicly message queue) , de-serializes them. intermittently, 1 of following errors: system.runtime.interopservices.externalexception: cannot execute program. command being executed "c:\windows\microsoft.net\framework\v2.0.50727\csc.exe" /noconfig /fullpaths @"c:\documents , settings\useraccount\local settings\temp\lh21vp3m.cmdline". @ system.codedom.compiler.executor.execwaitwithcaptureunimpersonated(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline) @ system.codedom.compiler.executor.execwaitwithcapture(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline) @ microsoft.csharp.csharpcodegenerator.compile(compilerparameters options, string compilerdirectory, string compilerexe, string argume...

How to change Data Tier(Sql Instance) in TFS -

i have installed tfs server 2010 during installation selected sqlexpress data tier. both tfs application server , database exists on same box. have full enterprise sql server edition on samebox , want use same rather sqlexpress. in tfs administration console, found no way change data tier. haven't created project such on tfs there no data migrate. want use default instance now. how go ? at point, might uninstall , reinstall. that's easiest method.

asp.net - Why does the following styling not work in firefox? (it works in all other browsers) -

edit: copyright message not appear on screen, there in html source of firefox window! asp.net page: <%@ page language="vb" autoeventwireup="false" codebehind="default.aspx.vb" inherits="learnvb1._default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>welcome to</title> <link href="stylesheet1.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <div id="main_holder"> <center> <asp:label id="label1" runat="server" text="copyright &copy 2011 blah blah. rights reserved."></asp:label> </c...

JSF Scope problem -

first of sorry english. put question in various german forums didnt answer :-( maybe can me. i work jsf 2.0. have create webapplication connects backend server informations stored - no problem. my problem one: have e.g. 2 users. user 1 logs system -> mesage sent backend server -> message received user informations -> user id set 1 user 2 logs system -> ... -> user id set 2. id of user 1 set 1. means both users share 1 instance of user class? thought each user gets own instance of java classes informations stored. here bit code: login.xhtml <h:body> <f:view> <h:inputtext id="name" value="#{user.name}" /> <h:inputsecret id="passwort" value="#{user.password}" /> .... <h:commandbutton id="login" action="#{communicator.validate}" /> you enter user , passwort the communicator sends message backend , receives this. communicator.java @managedbean(name = "communicato...

code analysis - Rule CA1709 and two letter-words -

i have library lot of functions use 2 letter-non english-words this: findedia esprimo enpreparacion ... anyway, activated code analysys project, , i'm getting ca1709 warning: ca1709 : microsoft.naming : corrija el uso de mayúsculas y minúsculas en 'de' en el nombre del miembro '...' cambiándolo 'de'. i added code analysis dictionary stated here doesn't ignore warnings. here structure of dictionary. <?xml version="1.0" encoding="utf-8" ?> <dictionary> <words> <recognized> <word>de</word> <word>el</word> <word>en</word> <word>es</word> <word>si</word> ... </recognized> </words> </dictionary> what else should handling warning without supressing message?. thanks in advance you need add them casingexceptions aswell: <acronyms> <casingexcepti...

text - Android Java newline not working -

i'm having 1 of apps output text file saves. i'm using code i've used before--a filewriter outputs string + "|" + string + "\n". everything works fine except newline char, "\n"--it's skip , program moves on next string without starting new lin. i've tried doing html ( <br /> ) instead, prints out <br /> . missing? ok, problem solved. "\r\n". strange, "\n" works fine on own other programs, i'm guessing has environment. sam!

c# - Publish MVC app on IIS, now has error - no default document? -

mvc newbie here... put first ever mvc web site, , works in development. publish local iis 7.5 using "web deploy", "localhost", "default web site/mysite". "mark iis application on destination" , "leave files..." checkboxes unchecked. publish succeeds. open browser , go http://localhost/mysite , , error "http error 403.14 - forbidden - web server configured not list contents of directory." huh? thought whole idea of controller don't have specify default page; works out page want? or have misunderstood something? checked this , this ?

sql server - SQL Multiple Joins -

given following 2 tables: create table [dbo].[mtcorrelations] ( [correlationid] [int] identity(1,1) not null, [stocka] [nvarchar](5) not null, [stockb] [nvarchar](5) not null, [correlation] [float] not null, [lengthstr] [nvarchar](5) not null, [date] [datetime] not null ) create table [dbo].[industries] ( [industryid] [int] identity(1,1) not null, [symbol] [nvarchar](5) not null, [sector] [nvarchar](50) null, [industry] [nvarchar](50) null ) i trying industries of stocka , stockb industries table. don't know how multiple joins. best can come with: select top 1000 [correlationid] ,[stocka] ,[stockb] ,[correlation] ,b.industry ,c.industry [markettopology].[dbo].[mtcorrelations] join [markettopology].[dbo].[industries] b on a.stocka = b.symbol , join [markettopology].[dbo].[industries] c on a.stockb = c.symbol i error on and. what's correct way of doing this? remove and a , have next...

Java: is it good practice to define beans in XML? -

in project i'm working on, using spring, see boggles mind. apparently there unit tests need beans work , beans created xml files, containing things like: <bean class="...listdto"> <constructor-arg> <map> <entry key="use1key"> <value>use1value</value> </entry> <entry key="use2key"> <value>use2value</value> </entry> </map> </constructor-arg> <constructor-arg> <map> <entry key="nature1key"> <value>nature1value</value> </entry> <entry key="nature2key"> <value>nature2value</value> </entry> </map> </constructor-arg> <constructor-arg> <value>false</value> </constructor-arg> </bean> and did happen? constructor of class ...listdto changed , hence bean apparently cannot created anymore (very verbose im...

ruby on rails - Fixnums as Symbols Warning from collection_select -

rails 2.3.5, ruby 1.86 i'm not understanding warning. i'm getting 1 warning each record containted in @directories when using @directories in collection_select . i've tried playing around :id instances using them differently no luck. i'm sure it's simple (i'm still pretty new). thanks in advance! error: c:/ruby186/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/form_options_helper.rb:328: warning: not use fixnums symbols the offending code: <% if !params[:directory].nil? %> <%= collection_select :directory, :id, @directories, (:id).to_i, :name, {:selected => params[:directory][:id].map{|id|id.to_i}}, {:size => 7, :multiple => true} %> <% else %> <%= collection_select :directory, :id, @directories, (:id).to_i, :name, {:selected => @directory_ids}, {:size => 7, :multiple => true} %> <% end %> you're passin...

gorm - Grails: how to set a meta-constraint on domain class property? -

i have contact class belongs subscription , want set hypothetic readonly constraint on subscription property, consumed in scaffold templates. the class looks like class contact { static belongsto = [subscription: subscription] static constraints = { subscription(nullable: false, readonly: true) // hypothetic *readonly* constraint name(blank: false) email(blank: false, email: true) } integer id string name string email string description } i found constrainedproperty.addmetaconstraint method "adds meta constraints non-validating informational constraint". how call within domain class? and how meta-constraint? in scaffolding templates there property domainclass type org.codehaus.groovy.grails.commons.defaultgrailsdomainclass. these object has property constrainedproperties. have excess 'readonly' have this: your domain class: class contact { static belongsto = [subscription: subscription] static c...

javascript - Examples of Combo box controls for the Web -

i looking examples of combo box controls relying on jquery, or javascript , css. control allow user slect drop down list, or type custom value. http://www.asp.net/ajax/ajaxcontroltoolkit/samples/combobox/combobox.aspx http://plugins.jquery.com/project/jec sample: http://stuff.rajchel.pl/jec/demos/

c# - How do I implement multiple login/logout-domains, single main domain in ASP.NET and forms authentication? -

i want have several domains a, b, c user can enter username , password login common main domain d. so user goes a, b or c, enters username , password, clicks "login" button, , on main domain d in logged in/authenticated state. user things wants do, , clicks logout-button , returned original domain came from, a, b or c. what best way this? i use forms authentication in asp.net 4.0 (c#). thanks, the feature need called single sign-on . look on , find how it. take @ http://aspalliance.com/1545_understanding_single_signon_in_aspnet_20.all

C# winforms: move text from one textbox to another -

i have winform application 2 textboxes. textboxes multilined , has 5 rows. when user enters more 5 lines of text in first textbox want text continue in second textbox. , if he/she deletes text first textbox want text move second first one... i have tried solve in code checking how many rows first textbox has , moved text between 2 textboxes. doesnt work wonder if got better solution?? you accomplish registering textchanged events on textbox controls. in event handler, manually inspect text property , set focus appropriate control. however, describing sounds may lead inconsistent user experience. from ux standpoint suggest changing approach. first of need split text in ui, or split afterward in business layer? if need split in ui, have single textbox allows user enter full text, , below have 2 read-only textbox's display 2 split segments type (you use textchanged event logic type). i hope helps.

Android - I set a custom background for a listView, and the highlight has gone -

Image
ok, simpleadapter's getview function: @override public view getview(int position, view convertview, viewgroup parent) { view view = super.getview(position, convertview, parent); view.setbackgroundcolor(r.drawable.color1); return view; } } and color1.xml file, in res/drawable-lpi folder: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:color="#ffff00ff"/> <!-- pressed --> <item android:state_selected="true" android:color="#ff0000ff"/> <!-- selected --> <item android:state_focused="true" android:color="#ff0000ff"/> <!-- focused --> <item android:color="#ffffffff"/> <!-- default --> </selector> why still this? first...

parsing - parse attachment from multipart mail content string in java -

i'm testing application sending mail attachment in integration environment. i'm setting fake smtp mail server (http://quintanasoft.com/dumbster/) , configure application use it. @ end of test want check if application has sent email via fake mail server , want know, if content (at least attached file) i'm expecting. dumpster wrapping these mails own objects containing header key-value pairs , body plain text. question how can part mail body , evaluate attached file content it. attach file of mime-types in javamail. sending email on smtp allows make use of fact there string of data inside body of email before bytes of file. bytes of file base64 , included in main chunk of characters of email. private static final string your_attacmetn_data = "content-type: image/jpeg; name=invoice.jpgcontent-transfer-encoding: base64content-disposition: attachment; filename=image.jpg"; @before public final void setup() throws userexception{ server = simple...

iphone - UITabBarController customization -

in our native ipad app, need few customizations done tab bar namely: we want height of tab bar 54px, the highlight color of tab bar icons when selected needs yellow there has slight shadow @ top edge of tab bar. apple's documentation states uitabbarcontroller not meant subclassed. please advise best way achieve above customization if cannot subclass uitabbarcontroller. thanks. you can subclass it, apple discourages because bound screw up/change functionality drastically. if you're theming , doesn't ugly, things should fine. if reject it, can go default uitabbar , ship that. you may want @ three20

appending HTML to a variable using jQuery -

i having trouble appending html onto end of table, here code: $('[data-custom="view_financiers"]').live('click', function(){ var product_id = $(this).closest('tr').attr('data-pid'); var supplier_id = $(this).closest('table').attr('data-custom'); var parent = $(this).closest('tr'); $(this).hide(); $.getjson("get.php", {pid:product_id, sid:supplier_id}, function(data){ var size = $(data).size(); if(data == null){ $(parent).after("<table width='70%' align='center'><tr><td colspan='14'><center><h3>sorry, supplier not have financiers.</h3></center></td></tr></table>"); }else{ var replacinghtml = "<tr colspan='15'><table width='100%' height='350' data-replaced='true' data-rep='"+product_i...

Requesting Custom Fields from MySQL -

i think there better name trying do. i have this. select * user_bans user_id='{$user->id}' what want this. select *, active = (date(expire) > now() ? 1 : 0) user_bans user_id='{$user->id}' the expire field datetime field. want see if ban has expired , set active value accordingly. what syntax need use this? this might need! select *, if(date(expire) > curdate() , 1 , 0) `active` user_bans user_id={$user->id}

javascript - Help with a regex -

i've got following sequence i'm attempting detect... #hl=b&xhr=a b equal , equal anything. i've got following.. doesn't appear working... (#hl=.+&xhr=) know why? i'm using javascript , values , b letters of alphabet. (#hl=.+&xhr=.+) , missed second .+ . depending on regex engine, should see escaping rules, braces or + have escaped. if want match whole string, braces not needed anyway, btw.

dom - Jquery wont work on plugin generated html tags -

i developing simple rss aggregator site parses bunch of rss feeds , displays them in series of boxes. using rss plugin, zrssfeed . you can see live version of site here: http://vitaminjdesign.com/adrian the problem having using jquery select dom objects generated plugin. more specific, trying display social icons next anchor link when hover on link on page using following jquery: $(document).ready(function(){ $('a').hover(function(){ $('<a href="#"><img src="images/facebook.gif" class="facebook" alt="facebook"></a>').appendto(this).fadein(500); $('<a href="#"><img src="images/twitter.gif" class="twitter" alt="twitter"></a>').appendto(this).fadein(500); }, function(){ $('a').find('.facebook,.twitter').stop().fadeout(500); }); }); for reason, jquery not work...

css - How to hide any element from page only from Screenreader but not from page for normal users? -

how hide element page screenreader not page normal users? i know these snippets want hide screen redaer not page visually. sscreen reader should skip hidden part. /* hide both screenreaders , browsers css-discuss.incutio.com/wiki/screenreader_visibility */ .hidden { display: none; visibility: hidden; } /* hide visually, have available screenreaders www.webaim.org/techniques/css/invisiblecontent/ ; & j.mp/visuallyhidden ; */ .visuallyhidden { position: absolute !important; clip: rect(1px 1px 1px 1px); /* ie6, ie7 */ clip: rect(1px, 1px, 1px, 1px); } /* hide visually , screenreaders, maintain layout */ .invisible { visibility: hidden; } use on element: aria-hidden="true" this displays element normal sighted users, doesn't read aloud screen reader.

asp.net - jquery datepicker not focussed after date is chosen, after postback datepicker doesn't work -

everytime user selects date datepicker reason instead of staying focused on date picker in scrolls top of page. heres function located @ bottom of asp.net page under <script> $(function() { $( "#<%= pissued1.clientid %>" ).datepicker(); }); </script> this code. <td align="left" colspan="2"> <strong> <asp:label id="labdi1" runat="server" text="*date issued:"></asp:label> <asp:requiredfieldvalidator id="p1divalidate" runat="server" controltovalidate="pissued1" errormessage="you forgot the">*</asp:requiredfieldvalidator><br /> </strong> <asp:textbox id="pissued1" runat="server" width="45%"></asp:textbox> </td> and on postback datepickers stop working. example have dropdownlist causes postback , if user us...

XSLT matching PAGEID to an element ID -

how match 2 separate numbers in xml document? there multiple <pgindexelementinfo> elements in xml document, each representing different navigation element, each unique <id> . later in document <pageid> specifies number matches <id> used above. how go matching <pageid> <id> specified above? <element> <content> <pgindexelementinfo> <elementdata> <items> <pgindexelementitem> <id>1455917</id> </pgindexelementitem> </items> </elementdata> </pgindexelementinfo> </content> </element> <element> <content> <customelementinfo> <pageid>1455917</pageid> </customelementinfo> </content> </element> edit: i added solution below code. xsl:apply-te...

ruby on rails - how do I return model parent values when I make a query from the database -

so have model called image belongs_to :user. each user has first , last name. i have flash app returning json object of images. the service calling on images controller this def getimages @images = image.all render :json => @images end my json this [{"image":{"created_at":"2011-01-22t19:04:30z","img_path":"assets/img/bowl_93847566_3_0.png","updated_at":"2011-01-22t19:04:30z","id":9,"user_id":3}}] what include users first , last name in image object gets passed back. once have image object able image.user.first_name not clear how return array of image objects , include user along it. what great if array of images following. [{"image":{"created_at":"2011-01-22t19:04:30z","img_path":"assets/img/bowl_93847566_3_0.png","updated_at":"2011-01-22t19:04:30z","id":9,"user_id":3, ...

chroot using busybox -

i facing problem performing chroot using busybox. descriptio: create sparse file of 1gb , formatted ext3 filesystem. mounted directory loop device on /mnt/busybox, created bin directory , copied busybox under bin , under /mnt/busybox executed ln -s bin/busybox bin/ls. when tried running chroot /mnt/busybox bin/busybox ls chroot: cannot run command `bin/busybox': permission denied even though m in root, , when checked stack trace, found chroot("/mnt/busybox") returned 0 execve("bin/busybox", ["bin/busybox", "ls"], [/* 24 vars */]) = -1 eacces (permission denied) failed. prob , how solve it? thanks

css - How can I output errors when using .less programmatically? -

i've written asp.net mvc action method receives .less file name, processes via less.parse(<filename>) , outputs processed css file. this works fine long .less code valid, if there error, dotless returns empty string. if there error processing file, action method returns empty css file. how can output error message closer description of syntax error instead? the dotless parser traps exceptions , outputs them logger. snippet dotless's source performs lessengine.transformtocss : public string transformtocss(string source, string filename) { try { ruleset ruleset = this.parser.parse(source, filename); env env = new env(); env.compress = this.compress; env env2 = env; return ruleset.tocss(env2); } catch (parserexception exception) { this.logger.error(exception.message); } return ""; } less.parse has overload takes dotlessconfiguration object, provides several properti...

javascript - windows.location.href doesn't work -

i have little trouble javascript. this search box : <input id="lala" onkeypress="lala(event)" /> this script : <script type="text/javascript"> function lala(e){ tecla = (document.all) ? e.keycode : e.which; if(tecla==13) windows.location.href = 'http://server:100/theme/resumeninstrumento.aspx?nemo=lan'; } </script> when javascript alert, appears well, cant go url. it should window , not windows : window.location.href = ....

Rails: Iterate dynamically over params hash to verify they exist -

i've got form quite bit of params being passed controller processing. different 'sets' of params named in similar fashion: setname1_paramname setname1_paramname2 now, need check 1 of these 'sets' verify of fields submitted. right now, i'm doing manual if or style statement: if setname1_paramname.blank? || setname1_paramname2.blank? || ...etc @object.errors.add_to_base("all setname1 fields required."). render :action => 'new' return false end is there way programmatically loop on these params, , add them @object errors? thanks! since sounds have ton of params , seems need able checks on groups of params, maybe useful? basically, iterate on params hash, , use regular expressions target sets of params. then, inside loop, can sort of validations: params.each |key, value| # target groups using regular expressions if (key.to_s[/setname1.*/]) # whatever logic need params start 'setname1' if ...

Help with NHibernate query -

i have 2 tables, plan , ticket. want records in travelplan not in ticket. template.criteria.createcriteria("plan") .add(subqueries.propertynotin("userid", detachedcriteria.for(typeof(ticket)) .setprojection(projections.property("uid")))); the above query doesnt return records.. i can't guess searchtemplate does, applying projection outer criteria instead of detached one. also, "root" criteria should travelplan, not ticket. in other words: criteria = detachedcriteria.for<travelplan>() .add(subqueries.propertynotin( "userid", detachedcriteria.for<ticket>() .setprojection(projections.property("uid")))) this assumes travelplan has userid property matches uid property in ticket.

c# - N2 Customize Login Logic -

we have need customize logic of our n2 authentication add couple of options. i need add radiobuttonlist contains options , set session var based on selection of radiobutton on login - otherwise user cannot see site in preview pane of n2. thought add radiobuttonlist n2/login.aspx , create custom login class extended n2.edit.login , override login1_authenticate method custom logic before calling base.login1_authenticate. seems not designed extensible , cannot override method. make change have custom compile of n2 these changes, want avoid (should closed modification open extension) don't have redo our changes every time update n2. another route tried create n2/customlogin.aspx , add of logic in custom class , set web.config point customlogin.aspx instead of login.aspx - sent me correct login page failed login redirected me login.aspx (assuming hard coded) did not have our radio button options. we using n2 cms 2.0.0.0 on .net 4.0 (mvc app) n2 uses standard forms aut...

What could cause a python module to be imported twice? -

as far understand, python module never imported twice, i.e. code in module gets executed first time imported. subsequent import statements add module scope of import. i have module called "tiledconvc3d.py" seems imported multiple times though. use pdb print stack @ top of code module. here end of stack trace first time module executed: file "<anonymized>/python_modules/theano/theano/gof/cmodule.py", line 328, in refresh key = cpickle.load(open(key_pkl, 'rb')) file "<anonymized>/ops/tiledconvg3d.py", line 565, in <module> import tiledconvc3d file "<anonymized>/ops/tiledconvc3d.py", line 18, in <module> pdb.traceback.print_stack() it goes on executed several more times. however, complete stack trace second time called not show calls reload , these executions should not occurring: file "sup_train_conj_grad.py", line 103, in <module> dataset = config.get_dataset(dataset_node)...

JSTL tags return null/empty in Javascript calls and HTML elements -

this confusing error, crops in of webpages i'm creating, not in others, although syntactically elements identical. for example, doesn't show up: <main:uiinputbox ondarkbg="${hasdarkbg}" name="questiontitle1" onblur="pollupdatequestion(false, false, true, this);" defaultvalue="&lt;${field['poll_field_enter_question']}&gt;" stylewidth="280px"> </main:uiinputbox> where tag ${field['poll_field_enter_question']} should return string "enter question". don't understand tag returns string in jsp file, when it's in html descriptor. another error in javascript if have function this: it prints out literal string "${field['poll_field_choice']}" , , not element it's representing. ex: template.find('h2').text('${field["poll_field_ch...

java - sun.security.ssl.allowUnsafeRenegotiation -

does option "-dsun.security.ssl.allowunsaferenegotiation=true" work in ibm's jvm ships websphere 7 no. work com.ibm.jsse2.renegotiate=none but option works after install actualy fixes renegotiating vulnerabilities . level required fixes sr6.

android - Setting the size and position of a Surface View -

i'm working on interface 1 half of screen has edit text boxes user enter data into, , other half has canvas can drawn , reads user touches. right i'm extending surface view , adding layout(layout xml) @ runtime view.addview. my problem setting size , position of view. want square , take half of screen (landscape). want aligned right side , either centered vertically, or aligned top. i can set size overriding onmeasure method, don't know how display size don't know set to. i don't have ideas how align view, i've been trying adding various layouts without luck... thanks help! have same question. did find answer? i figured out. modify onlayout(), set like: view child=getchildat(0); child.layout(100,100,300,300); and not touch onmeasure().

php - How to collate string for mysql query -

i have query filters based on content website. works fine, except when finds content doesn't agree (default) collation have on table. there way, on php's side, adjust collation? you can use mysql convert() , cast() http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html

registration - CSS Left property -

when set left: 50px; in css, registration in top left corner, or center? each 1 sets registration point whatever rule you're using. if supply left or right default registration point top-left or top-right respectively. so, various style rules: left/left , top = top-left corner right/right , top = top-right corner left/left , bot = bottom left corner right/right , bot = bottom right corner

c# - How do you regex this pattern? -

here pattern: word [column] %anything goes% basically, need extract "word", "column" , value between 2 "%" characters. the following regular expression extracts each value named group. (?<word>(.*))(\s*)\[(?<column>(.*))\]\s*%(?<anything>(.*))% using on sample string should give following captures: word = "word" column = "column" = "anything goes" to run regular expression , values, can following (don't take best practise, it's illustrate basic concepts). regex regex = new regex(@"(?<word>(.*))(\s*)\[(?<column>(.*))\]\s*%(?<anything>(.*))%"); match match = regex.match("word [column] %anything goes%"); console.writeline(match.groups["word"].value); console.writeline(match.groups["column"].value); console.writeline(match.groups["anything"].value); this should output group captures console. more information...