Search Results

Search found 8286 results on 332 pages for 'defined'.

Page 176/332 | < Previous Page | 172 173 174 175 176 177 178 179 180 181 182 183  | Next Page >

  • Alignment of View Elements within a LinearLayout

    - by Adam
    I hate to ask this question; for some reason I can't figure it out on my own. I have a vertical LinearLayout that contains a custom View that I've defined in my app and and a TextView. I'd like my custom View to be aligned on the top of the screen and the TextView to be aligned at the bottom of the screen. Unfortunately, no matter what changes I make to the attributes of the XML file, my custom View always seems to be centered vertically when I run the emulator. The xml is like the following: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="top"> <CustomView android:id="@+id/customID" android:layout_width="wrap_content" android:layout_height="wrap_content" tileSize="24" android:focusableInTouchMode="true" android:layout_gravity="top"/> <TextView android:id="@+id/text" android:text="@string/droidtactoe_layout_text" android:visibility="visible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textSize="24sp" android:textColor="#00000000" android:layout_gravity="bottom"/> </LinearLayout>

    Read the article

  • Get class of caller's method (via inspect) in Python (alt: super() emulator)

    - by Slava Vishnyakov
    Is it possible to get reference to class B in this example? class A(object): pass class B(A): def test(self): test2() class C(B): pass import inspect def test2(): frame = inspect.currentframe().f_back cls = frame.[?something here?] # cls here should == B (class) c = C() c.test() Basically, C is child of B, B is child of A. Then we create c of type C. Then the call to c.test() actually calls B.test() (via inheritance), which calls to test2(). test2() can get the parent frame frame; code reference to method via frame.f_code; self via frame.f_locals['self']; but type(frame.f_locals['self']) is C (of course), but not B, where method is defined. Any way to get B?

    Read the article

  • Explorer right-click uploader for CMS?

    - by Pekka
    I'm looking for a "right-click upload" application like RightLoad - an application that can upload media files to a remote FTP server from the Windows Explorer's context menu. I want to customize the application to serve as a customized image uploading tool to a PHP-based CMS. The user would upload images and other media files to a defined FTP account (I'm also very open for other methods of transport, as long as they are supported by run-off-the-mill web hosting stacks) that they could then use in the CMS they log in to. For me to be able to do these customizations, the application would have to be Open Source - RightLoad is "only" Freeware. Alternatively, I'm open for closed-source and commercial suggestions as long as they allow "pre-packaged" server settings that can easily be deployed to the user. Does anybody know such a tool compatible with at least the most current versions of Windows (XP, Vista, 7)?

    Read the article

  • Trapping events within list box item templates in WPF

    - by AC
    I've got listbox that employs an item template. Within each item in the list, as defined in the template there is a button. When the user clicks the button I change a value in the data source that defines the sort order of the list. Changing the datasource is not a problem as this is working just fine within my application template. However my next step is to reload the listbox with the new sorted data source. I've tried doing this from the tempalte but it apparently doesn't have access (or I can't figure out how to get access) to the parent elements so I can reset the .ItemSource property with a newly sorted data source. Seems like this is possible but the solution is eluding me :(

    Read the article

  • Can I make pdb start debugging right away?

    - by hasen j
    I want to debug a python project The problem is, I don't know where to set a break point, what I want to do, is be able to call a method SomeClass( some_ctor_arguments ).some_method()` and have the debugger be fired right away How do I do that? I tried pdb.run( string_command ) but it doesn't seem to work right >>> import pdb >>> import <some-package> >>> pdb.run( .... ) > <string>(1)<module>() (Pdb) s NameError: "name '<some-package>' is not defined"

    Read the article

  • Win32: BitTest, BitTestAndComplement, ... <- How to disable this junk?

    - by Mordachai
    WinNT.h has the following lines in it, in the VS2008 SP1 install: #define BitTest _bittest #define BitTestAndComplement _bittestandcomplement #define BitTestAndSet _bittestandset #define BitTestAndReset _bittestandreset #define InterlockedBitTestAndSet _interlockedbittestandset #define InterlockedBitTestAndReset _interlockedbittestandreset I have a number of templates that are based on BitTest<() Does anyone know of a simple way to disable these #defines? Oftentimes MS does provide a #define XXX symbol which, if defined, will disable some offending portion of their header - e.g. NOMINMAX. I have been unable to find such a solution to the above problem. If you share frustration with Microsoft's many dubious choices, the read on. If not, stop here. ;) Editorializing: Why couldn't Microsoft just use the _bittest itself??? Or why couldn't they use BITTEST like every knows you should - always use all-caps for macros! Microsoft is still #defining things in 2010?! WTF?

    Read the article

  • Evaluation of jQuery function variable value during definition of that function

    - by thesnail
    I have a large number of rows in a table within which I wish to attach a unique colorpicker (jQuery plugin) to each cell in a particular column identified by unique ids. Given this, I want to automate the generation of instances of the colorpicker as follows: var myrows={"a","b","c",.....} var mycolours={"ffffff","fcdfcd","123123"...} for (var i=0;i<myrows.length;i++) { $("#"+myrows[i]+"colour").ColorPicker({flat: false, color: mycolours[i], onChange: function (hsb, hex, rgb) { $("#"+myrows[i]+"currentcolour").css('backgroundColor', '#' + hex); } }); Now this doesn't work because the evaluation of the $("#"+myrows[i]+"currentcolour") component occurs at the time the function is called, not when it is defined (which is want I need). Given that this plugin javascript appends its code to the level and not to the underlying DOM component that I am accessing above so can't derive what id this pertains to, how can I evaluate the variable during function declaration/definition? Thanks for any help/insight anyone can give. Brian.

    Read the article

  • Django: Geocoding an address on form submission?

    - by User
    Trying to wrap my head around django forms and the django way of doing things. I want to create a basic web form that allows a user to input an address and have that address geocoded and saved to a database. I created a Location model: class Location(models.Model): address = models.CharField(max_length=200) city = models.CharField(max_length=100) state = models.CharField(max_length=100, null=True) postal_code = models.CharField(max_length=100, null=True) country = models.CharField(max_length=100) latitude = models.DecimalField(max_digits=18, decimal_places=10, null=True) longitude = models.DecimalField(max_digits=18, decimal_places=10, null=True) And defined a form: class LocationForm(forms.ModelForm): class Meta: model = models.Location exclude = ('latitude','longitude') In my view I'm using form.save() to save the form. This works and saves an address to the database. I created a module to geocode an address. I'm not sure what the django way of doing things is, but I guess in my view, before I save the form, I need to geocode the address and set the lat and long. How do I set the latitude and longitude before saving?

    Read the article

  • "Circuit breaker" for net.msmq?

    - by Alex
    Hi, The Circuit Breaker pattern, from the book Release It!, protects a service from requests while it is failing (or recovering). The net.msmq binding used with transactions give us nice retry and poison message capabilities. But I am missing the implementation of such a "Circuit breaker" pattern. A service is put under even heavier load by retries while it is already in a failure condition (like DB connectivity issues causing loads of blocked threads etc.). Anyone knows about a behavior extension or similar that explicitly closes the service host when defined failure thresholds have been exceeded? Cheers, Alex

    Read the article

  • Is it appropriate to set a value to a "const char *" in the header file

    - by sud
    I have seen people using 2 methods to declare and define char * Medhod-1: The header file has the below const char* COUNTRY_NAME_USA = "USA"; Medhod-2: The header file has the below declaration const char* COUNTRY_NAME_USA; The cpp file has the below defintion : const char* COUNTRY_NAME_USA = "USA"; Is method-2 wrong in some way ? What is the difference between the two ? I understand the difference between "const char * const var" , and "const char * var". If in the above methods if a "const char * const var" is declared and defined in the header as in method 1 will it make sense ?

    Read the article

  • j2me PushRegistry.RegisterAlarm and code signing

    - by Mihir
    I am developing an app on Nokia C2-00 in which I am using push registry for auto start of app on some fixed time ex. PushRegistry.registerAlarm("ClassName", alarm.getTime()); this is working perfect and it starts app on that time. But this is asking me for permissions two times. 1) when I am registering alarm using PushRegistry.registerAlarm("ClassName", alarm.getTime()); 2) when app start on that defined time. in this and this link I found that if my application is signed then it will not ask for permission when app autostart. but I am not sure about the time when my code will register alarm. Will it ask for permission or not?

    Read the article

  • Find point which sum of distances to set of other points is minimal

    - by Pawel Markowski
    I have one set (X) of points (not very big let's say 1-20 points) and the second (Y), much larger set of points. I need to choose some point from Y which sum of distances to all points from X is minimal. I came up with an idea that I would treat X as a vertices of a polygon and find centroid of this polygon, and then I will choose a point from Y nearest to the centroid. But I'm not sure whether centroid minimizes sum of its distances to the vertices of polygon, so I'm not sure whether this is a good way? Is there any algorithm for solving this problem? Points are defined by geographical coordinates.

    Read the article

  • What are Android different screens dimensions in dp for different screens (e.g. xlarge = 960dp x 720dp)?

    - by Zizo
    in this link: Range of screens supported, Android team mentioned that: As you design your UI for different screen sizes, you'll discover that each design requires a minimum amount of space. So, each generalized screen size above has an associated minimum resolution that's defined by the system. These minimum sizes are in "dp" units—the same units you should use when defining your layouts—which allows the system to avoid worrying about changes in screen density. xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp So, If I want to support all Android screens, can I create images, for full screen view, in those dimensions and that will be sufficient condition to support all available screens? or they are just the minimum sizes, and I need other dimensions? If other dimensions are needed, Please list them as in the list above. Thanks in Advance.

    Read the article

  • Querying datatable to get rows with a certain value in the first column

    - by user1776590
    I am currently using the code below and am wondering if it would be possible to query based on an entry value. At the moment it returns the number of rows that have been defined. var q = sqlData.AsEnumerable().Take(2); This data comes in from a database and is imputed into the table but at the moment it only returns database data into the datatable and allows me to select the first two rows and I was wondering if I can query the data table so that I can get the rows that I require based on an index in the actual table itself (e.g. in the table I find five rows and query this information out).

    Read the article

  • Perl latin-9? Unicode - need to add support

    - by Phill Pafford
    I have an application that is being expanded to the UK and I will need to add support for Latin-9 Unicode. I have done some Googling but found nothing solid as to what is involved in the process. Any tips? Here is some code (Just the bits for Unicode stuff) use Unicode::String qw(utf8 latin1 utf16); # How to call $encoded_txt = $self->unicode_encode($item->{value}); # Function part sub unicode_encode { shift() if ref($_[0]); my $toencode = shift(); return undef unless defined($toencode); Unicode::String->stringify_as("utf8"); my $unicode_str = Unicode::String->new(); # encode Perl UTF-8 string into latin1 Unicode::String # - currently only Basic Latin and Latin 1 Supplement # are supported here due to issues with Unicode::String . $unicode_str->latin1( $toencode ); ... Any help would be great and thanks.

    Read the article

  • A follow up on type coercion in C++, as it may be construed by type conversion

    - by David
    This is a follow up to my previous question. Consider that I write a function with the following prototype: int a_function(Foo val); Where foo is believed to be a type defined unsigned int. This is unfortunately not verifiable for lack of documentation. So, someone comes along and uses a_function, but calls it with an unsigned int as an argument. Here the story takes a turn. Foo turns out to actually be a class, which can take an unsigned int as a single argument of unsigned int in an explicit constructor. Is it a standard and reliable behavior for the compiler to render the function call by doing a type conversion on the argument. I.e. is the compiler supposed to recognize the mismatch and insert the constructor? Or should I get a compile time error reporting the type mismatch.

    Read the article

  • QuestionOrAnswer model?

    - by Mark
    My site has Listings. Users can ask Questions about listings, and the author of the listing can respond with an Answer. However, the Answer might need clarification, so I've made them recursive (you can "answer" an answer). So how do I set up the database? The way I have it now looks like this (in Django-style models): class QuestionOrAnswer(Model): user = ForeignKey(User, related_name='questions') listing = ForeignKey(Listing, related_name='questions') parent = models.ForeignKey('self', null=True, blank=True, related_name='children') message = TextField() But what bugs me is that listing is now an attribute of the answers as well (it doesn't need to be). What happens if the database gets mangled and an answer belongs to a different listing than its parent question? That just doesn't make any sense. We can separate it with polymorphism: QuestionOrAnswer user message created updated Question(QuestionOrAnswer) shipment Answer(QuestionOrAnswer) parent = ForeignKey(QuestionOrAnswer) And that ought to work, but now ever question and answer is split into 2 tables. Is it worth this overhead for clearly defined models?

    Read the article

  • What is the advantage of using static methods in Python?

    - by Curious2learn
    I ran into unbound method error in python with the code class Sample(object): '''This class defines various methods related to the sample''' def drawSample(samplesize,List): sample=random.sample(List,samplesize) return sample Choices=range(100) print Sample.drawSample(5,Choices) After reading many helpful posts here, I figured how I could add @staticmethod above to get the code working. I am python newbie. Can someone please explain why one would want to define static methods? Or, why are not all methods defined as static methods. Thanks in advance.

    Read the article

  • Is SELECT INTO able to affect data from its original table during UPDATE

    - by driveby
    Whilst asking this question asp.net scheduling timed events user murph posted some insightful information: Point about this is that its very, very simple - you have an process for exchange that is performing a clearly defined task and you have a high frequency task that is not doing anything particularly complex, its a straightforward query (select from table where sent = false and send at < value) - probably into temporary table so that you can run a single query update after you've done the sends - that you can optimise the index for. You're not trying to queue up a huge pile of event triggers, just one that fires once a minute and processes things that are due. Is it possible to SELECT data from table X INTO table Y and have the UPDATES that are performed on table Y pushed into table X? I guess the alternative would be that the data gets updated in table Y then an update command can be run on table X based on the data in table Y. What would be the advantage of selecting into another table? Thank you,

    Read the article

  • Facing problem in VB6.0 Activex Controls design.

    - by Dharmaraju
    Hi, This is dharmaraju, I am facing some problem in Activex Controls design. Kindly help me to resolve the issue. Problem Description: I have created a property mentioned below for a textbox. Public Property Let DataControl_Value(ByVal Value As Variant) Public Property Get DataControl_Value() As Variant This property is editable at design time if i use it VB6.0 Applications. Same thing is read only in case if i use it in vc++ MFC applications. I have defined one more property like below. Public Property Let DataControl_DataItemDef(ByVal Value As DTMDATACONTROLLib.IXMLDOMNode) Public Property Get DataControl_DataItemDef() As DTMDATACONTROLLib.IXMLDOMNode In this case the "DataControl_DataItemDef" property will not be available at design time.[not displaying in control's property window.] Kindly help me to resolve the issue.

    Read the article

  • Recognition source of event in PyQT

    - by xTrol
    Hi, I`m starting with PyQt4 and right now I have a problem with events. I have one main class let say MainWindow. MainWindow has a list of buttons of type ButtonX (inherence form QPushButton). I would like to achieve one of 2 solutions (depends which is easier). 1) After click one of the button from the list I would like to run a one method of MainWindow. I would like to be able to read a source of event there (recognize clicked button) 2) Second solution is to run a method defined in ButtonX class. What I tried is: QtCore.QObject.connect(self.getButton(0, 0), QtCore.SIGNAL("clicked()"), self.getButton(0, 0).buttonMethod()) QtCore.QObject.connect(self.getButton(0, 0), QtCore.SIGNAL("clicked()"), self.getButton(0, 0), QtCore.SLOT("incrementValue()")) and even this line occure suspend Python interpreter QtCore.QObject.connect(self.getButton(0, 0), QtCore.SIGNAL("clicked()"), self.getButton(0, 0), QtCore.SLOT("incrementValue"))

    Read the article

  • MDX - how to filter on children of nextmember

    - by Raj
    I have a user defined hierarchy in SSAS as follows: Calendar Year Month Of Year I want to create following named set in BIDS. Set1 should include "Month of Year" values of 1-9 for current Calendar Year Set2 should include "Month of Year" values of 10-12 for current Calendar Year Set3 shoud include "Month of Year" values of 1-3 for next Calendar Year Set4 shoud include "Month of Year" values of 4-6 for next Calendar Year The "current calendar year" will come through a join with another dimension though a fact table. I would appreciate help with MDX. And, can I use CurrentMember in the named sets?

    Read the article

  • UIScrollView Does not Scroll

    - by paul simmons
    I have added a long info screen to my iPhone app. The info is a long UIImageView, and it is contained inside a UIScrollView. They are both defined in .xib file. At run-time, initially I set scrollview's position outside window, and when user clicks a button, set its position inside window. This part is OK. But scrollview displays the image but does not scroll. Isn't it enough to place in MainViewContoller.xib, set the contained content, and (at code) set its contentSize equal to the content's size? BTW: I try it at simulator currently.

    Read the article

  • super() in Python 2.x without args

    - by Slava Vishnyakov
    Trying to convert super(B, self).method() into a simple nice bubble() call. Did it, see below! Is it possible to get reference to class B in this example? class A(object): pass class B(A): def test(self): test2() class C(B): pass import inspect def test2(): frame = inspect.currentframe().f_back cls = frame.[?something here?] # cls here should == B (class) c = C() c.test() Basically, C is child of B, B is child of A. Then we create c of type C. Then the call to c.test() actually calls B.test() (via inheritance), which calls to test2(). test2() can get the parent frame frame; code reference to method via frame.f_code; self via frame.f_locals['self']; but type(frame.f_locals['self']) is C (of course), but not B, where method is defined. Any way to get B?

    Read the article

  • Detect LaTeX class name

    - by Matthew Leingang
    I'm working on a LaTeX package which might need to do some things differently depending on the class that's being used. I'm wondering if there's a way to auto-detect or test the document class. One could certainly look up the class files and test for the existence of a specific macro defined by that class, but is there a smarter way? I looked at the definition of the \ProvidesClass macro and can't see if it saves the class name anywhere except \@currname. I believe \@currname is just the name of the current package or class being read. Basically I want to execute \author{\longauthorname} in the article class but \author[\shortauthorname]{\longauthorname} in the beamer class.

    Read the article

< Previous Page | 172 173 174 175 176 177 178 179 180 181 182 183  | Next Page >