Posts

Python's equivalent for Ruby's define_method? -

What is a Python equivalent for Ruby's define_method , which is the dynamic generation of class methods will allow? (As can be seen in Wikipedia) Functions are first-class objects in Python and assign them The properties of a class or an example can be a way of doing the same thing as a Wikipedia example: colors = {"black": "000", "red": "F00", "green": "0f0", "yellow": "ff0", "blue": "00f", "magenta": "fff", "cyan": "0ff", "white": " FFF "} Class MyStream (ARR): Pass for Name, Code in colors.iteritems (): def _in_colour ( W code = code): return '& lt; Span style = "color:% s" & gt;% s & lt; / Span & gt; ' % (Code, self) setter (histrive, "in_" + name, _in_ color)

ArrayList objects in Java -

जब एक अर्रेलिस्ट ArrayList & lt; item & gt; सूची = नया ArrayList & lt; item & gt; (); मद एक = नया आइटम (1, "पुस्तक"); आइटम बी = नया आइटम (2, "जूते"); List.add (क); List.add (ख); आइटम सी = नया आइटम (1, "पुस्तक"); यदि (List.equals (c)) // क्या यह कोड सही होगा? यदि नहीं, तो कोई भी यह बता सकता है कि किस मामले में List.equals (c) सच हो जाएगी। क्योंकि किसी आइटम में कई विशेषताएं, आईडी, नाम, मूल्य हो सकता है। क्या यह संदर्भ नाम की जांच करता है? या गुणों की तुलना करें। सबसे पहले, आपको में पद्धति का उपयोग करना चाहिए बराबर नहीं इसमें शामिल है चेक अगर कोई आइटम सूची में है लेकिन बराबर चेक यदि कोई सूची दूसरी सूची के बराबर है अब आपके प्रश्न के लिए- इसमें बराबर विधि के कार्यान्वयन ( ऑब्जेक्ट से विरासत में मिली एक) देखेंगे। डिफ़ॉल्ट रूप से यह संदर्भों की तुलना करता है यदि आप विशेषताओं की तुलना करना चाहते हैं, तो कस्टम तुलना तर्क का उपयोग करने के लिए इसे ओवरराइड करें।

android - Scrolling a GridView with only Buttons -

I have a GridView button with just the button Button (to work) But if I want to scroll Gridview with many items, then it is not working on my HTC Desire but it is possible in the emulator. My Gridview: & lt; Android: layout_width = "fill_parent" android: numColumns = "auto_fit" Android: verticalSpacing = "10dp" Android: horizontalSpacing: GridView Android: id = "@ + id / gv_control_group" Android: layout_height = "wrap_content" Android: isScrollContainer = "true" = "10dp" Android: stretchMode = "columnWidth" Android: gravity = "center" Android: scrollingCache = "true" /> GridViewItem: & lt; Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: Orientation = "vertical" Android: gravity = "center_horseontal"> gt; Android: Android: Android: drawableTop = "@ drawable / green" /...

java - How to implement the abstract method in interface? -

I am thinking how to implement an abstract method in an interface. Looking at this interface: public interface analysis {public double getAverage (); } In order to implement an abstract method, do I declare the method as intangible? public abstract double getAverage (); ?? Or declare the interface as an abstract? Public abstract interface analysis {public double getAverage (); } Or need other things? I have a class that implements the interface called sign : marks of public squares apply (some other code) Manufacturer mutator public double getAverage ();} So, my main problem is how to implement the abstract method in the interface? To create an intangible class implementing the interface: Public abstract class AbstractAnalysis Applies analysis {public abstract double getAverage ();} to create a solid square to implement the interface: public class mine Analysis applies {public double getAverage () {// TODO}} Or, it increases the intangibl...

iphone - http authentication in devise and rails 3 -

I have an application which is planning on Rail 3. I would like to enable HTTP Authentication so that I can authenticate my web app from an iPhone app Is it safe or should I have a different authenticity? From the design point view you get 3 options: 1) Basic Use HTTP authentication: Your iPhone app is a secret key - cooked in your iPhone app code - which uses the web app to authenticate each request Google Search: "Prepare Basic HTTP Authentication" 2) You have a public certificate in your iPhone app and a private server on your web app. You can use the https through Ifikets. It's a lot of work to configure properly, because your iPhone app and the rail server are exchanging messages on an encrypted channel, it's very safe. Authentication is done at the transport level, hence the security is also transparent for your railway code. 3) The iPhone app connects to the web app using https, receives an authentication token that it regularly uses to call th...

don't not showing up properly html (Fix with php?) -

Hey, for no reason instead of being displayed as this don & amp; Amp;; T is showing as to how I can change & amp; Amp; #; By using > You can get a simple str_replace ("& amp; ##;", "'$ $ string) However, it would be better to find out why this strange issue is happening in the first place.

html - Why wont this work in Internet Explorer? -

I & lt; Ul & gt; Trying this nav bar using and & lt; Li & gt; and some CSS so that it creates a horizontal navigation but the way I have it does not work in IE, why not just firefox and chrome anyone know? Here's the CSS: .navbar1 ul {list-style-type: none; Margin: 0; Padding: 0; Hidden flurry; } .navbar1 li {float: left; } .navbar1 a {font-size: 24px; Color: # fc 0; Background color: # 900; float right; Text align: center; Height: 30px; Width: 120px; Border-width: 5px; Border Bottom Width: 5px; Border-top-style: solid; Border style: solid; Border-top-color: # fc0; Border-right-color: #FC0; Border-down-color: #FC0; Border-left-color: #FC0; Font-family: "Britannic bold"; }. Navbar1 a: Hover, A: Active {background-color: # 500} Here's HTML: & lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "index.html" & gt; Home & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = ...