Posts

css - Why does styling TDs in jquery make the markup insane? -

i'm trying add simple border table cells in table. it's important markup remains simple other functionality have in place work. let's style tds this: $('td').css('border', '1px solid #000'); this ends result: <td style=​"border-top-width:​ 1px;​ border-right-width:​ 1px;​ border-bottom-width:​ 1px;​ border-left-width:​ 1px;​ border-top-style:​ solid;​ border-right-style:​ solid;​ border-bottom-style:​ solid;​ border-left-style:​ solid;​ border-top-color:​ rgb(0, 0, 0)​;​ border-right-color:​ rgb(0, 0, 0)​;​ border-bottom-color:​ rgb(0, 0, 0)​;​ border-left-color:​ rgb(0, 0, 0)​;​ ">​…​/td> classes wouldn't appropriate i'm trying do. why cells being formatted in ridiculous way? this how browsers handle shorthand css properties; browsers may implement human-readable representation differently internal representation, in reality, border: 1px solid #000 is shorthand for ...

android - ImageButton and NullPointerException -

could nullpointerexception because button referencing nested inside several layouts? time reference browseeditbtn exception. it's simple button! come'on. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:stretchcolumns="*"> <!-- <include layout="@layout/mydesctextview" /> --> <tablerow android:id="@+id/tablerow1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <textview android:text="textview" android:layout_width="wrap_content" android:layout...

css3 - Plugin for CSS Transitions via jQuery addClass? -

i'm looking library allow me use css transitions via jquery's addclass / removeclass / toggleclass functions. i.e. want these functions nothing (other adding css class) in webkit, use jquery animations in ie. jqueryui replaces these 3 functions , comes close need, works on exact element (e.g $('#myid').addclass('foo'); doesn't animate #myid.foo .someclass ) i've looked around , can't find this, knows of 1 :) if not, solution requires: parsing stylesheets on page css transition properties matching stylesheets transitions (e.g. -webkit-transition ) storing these stylesheets on addclass , etc match current , down tree (e.g. .addedclass .someotherclass ) apply animations matched elements (or style rule) so if knows of existing solutions parse stylesheets (the text of them) or animate rule (instead of individual nodes), helpful well. looks want jquery++ jquery.animate overwrites $.fn.animate use css 3 animations if p...

floating point - Assign double constant to float variable without warning in C? -

in c programming language, floating point constant double type default 3.1415 double type, unless use 'f' or 'f' suffix indicate float type. i assume const float pi = 3.1415 cause warning, not. when try these under gcc -wall: float f = 3.1415926; double d = 3.1415926; printf("f: %f\n", f); printf("d: %f\n", d); f = 3.1415926f; printf("f: %f\n", f); int = 3.1415926; printf("i: %d\n", i); the result is: f: 3.141593 d: 3.141593 f: 3.141593 i: 3 the result (including double variable) lose precision, compile without warning. did compiler this? or did misunderstand something? -wall not enable warnings loss of precision, truncation of values, etc. because these warnings annoying noise , "fixing" them requires cluttering correct code heaps of ugly casts. if want warnings of nature need enable them explicitly. also, use of printf has nothing precision of actual variables, ...

MySQL Count multiple distinct records with condition -

i have table records user cross-profile visits , need count of distinct visits , count of new visits specified profile (:user_id) since specified unix timestamp (:time). id | user_id | visitor_id | time (unix) ====+==========+============+============= 1 | 1 | 5 | 1300000000 2 | 1 | 5 | 1300000010 3 | 1 | 8 | 1300000015 4 | 1 | 9 | 1300000020 5 | 1 | 9 | 1300000025 6 | 1 | 9 | 1300000030 so far able count of total visits, unable new ones. select count(distinct v.visitor_id) total, sum(v.time > 1300000012) new profile_visits v v.user_id = 1 returns total | new ============ 3 | 4 but required result is total | new ============ 3 | 2 you want sum(v.time > 1300000012) new . the expression either 0 or 1. count() count 0 happily 1. sum() "count" 1's. re comment: select count(t.visitor_id) total, sum(t.subto...

C# nested class/struct visibility -

i'm trying figure out proper syntax achieve api goal, struggling visibility. i want able access messenger instance's member msgr.title.forsuccesses . however, not want able instantiate messenger.titles outside messenger class. i'm open making messenger.titles struct. i'm guessing need sort of factory pattern or something, have no idea how i'd go doing that. see below: class program { static void main(string[] args) { var m = new messenger { title = { forerrors = "an unexpected error occurred ..." } }; // should allowed var t = new messenger.titles(); // should not allowed } } public class messenger { // i've tried making private/protected/internal... public class titles { public string forsuccesses { get; set; } public string fornotifications { get; set; } public string forwarnings { get; set; } public string forerrors { get; set; } // i've tried making pri...

java - Spring mvc Joda Datetime converter fail if invalid date -

i have domain object want have mapped jsp contains joda datetime: public beanclass{ private long id; @datetimeformat private datetime start; getters , setters... } i have following converter registered spring: final class stringtojodadatetimeconverter<s, t> implements converter<string, datetime> { private static final datetimeformatter fmt = datetimeformat.forpattern("mm/dd/yyyy"); public datetime convert(string in) { try{ return fmt.parsedatetime(in); }catch(exception e){ throw new illegalargumentexception("invalid date"); } } } spring hits converter before validator class , populate error messages full error failed convert property value of type java.lang.string required type org.joda.time.datetime property sampledate; nested exception org.springframework.core.convert.conversionfailedexception: unable convert value "asdf" type java.lang.string type org.joda.time.dat...