Search Results

Search found 17342 results on 694 pages for 'custom draw'.

Page 66/694 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • ListView item background via custom selector

    - by Gil
    Is it possible to apply a custom background to each Listview item via the list selector? The default selector specifies @android:color/transparent for the state_focused="false" case, but changing this to some custom drawable doesn't affect items that aren't selected. Romain Guy seems to suggest in this answer that this is possible. I'm currently achieving the same affect by using a custom background on each view and hiding it when the item is selected/focused/whatever so the selector is shown, but it'd be more elegant to have this all defined in one place. For reference, this is the selector I'm using to try and get this working: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="false" android:drawable="@drawable/list_item_gradient" /> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_disabled" /> <item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_background_disabled" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="true" android:drawable="@drawable/list_selector_background_focus" /> </selector> And this is how I'm setting the selector: <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:listSelector="@drawable/list_selector_background" /> Thanks in advance for any help!

    Read the article

  • Try to use Window.FEATURU_CUSTOM_TITLE but got Exception:You cannot combine custom titles with other

    - by xueru
    I am trying to use a custom title to include an image button to the title bar. I got a lot of help form this post: http://stackoverflow.com/questions/2569753/android-adding-button-to-the-title-of-the-app, but could not get it work for my ListActivity. In a nutshell, following is what I have: I hide the titlebar in the AndroidManifest.xml The specify a relative layout for the custom title (workorder_list_titlebar.xml) My Activity Class looks like the following: public class WorkOrderListActivity extends ListActivity { String[] orders={"WO-12022009", "WO-12302009", "WO-02122010", "02152010"}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.workorder_list_titlebar); setContentView(R.layout.workorder_list); setListAdapter(new ArrayAdapter(this,R.layout.workorder_list, R.id.label,orders)); } } When I ran the app, I got AndroidRuntimeException: You cannot combine custom titles with other title features. Base on the stack trace, the exception was thrown by com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:183), that was triggered by setlistAdapter call. Does anyone have the same problem with ListActivity? Also once I manage to get this work, how do I attach listeners to the image button for it to do something? Thanks in advance.

    Read the article

  • Crawler do not create custom crawled properties

    - by user173739
    These days i have faced with very strange problem. I have development environment with MOSS 2007 SP 2 and WS 2008, i have search configured and everything works great. I have started to configuring staging environment (MOSS 2007 SP2 with June CU) and create new farm and new SSP. I have deployed my changes with package (wsp) and manually create site collections, sub webs, pages and so on. When fill crawl finishes, i see in Crawl log that all my pages have been successfully crawled and when i use some test tools to query search, my pages have been found. In crawl log there is few errors like http://mysite/sites/de/pages "The crawler could not communicate with the server. Check that the server is available and that the firewall access is configured correctly..", but all pages in this Page library were indexed. The problem is that i use custom managed properties (mapped to custom crawled properties) in search queries, but crawler didn't create crawled properties for all my new site columns. For example for site column IsAccent the crawler didn't create cralwed property ows_isAccesnt. I'm sure that i have created pages for specific content type and all my crawl categories have checked "Automatically discover new properties when a crawl takes place ". In site settings - Searchable columns i haven't got any column selected as Nocrowl. I tried to export my managed and crawled properties from dev environment to stage evironment but all my managed properties were empty, after that i recreated SSP...the result was the same... I checked specific page with tools like Sharepoint Manager 2007 and U2U Caml Query Builder 2007 that content type is correct, and i can see values of my custom site collumns.... Using U2U Caml Query Builder 2007 agains some Page library in Result tab i can see ows_IsAccent (my site collumn is IsAccent) and others site columns, but i can't find them in Crawled properties. Any idias?

    Read the article

  • Creating a Custom Design-Time Environment

    - by Charlie
    Hello all, My question is related to the design-time support of WPF. From MSDN I read, The WPF Designer provides a framework and a public API which you can use to implement custom adorners, tools, property editors, and designers. But the vast majority of the examples I have found are trivial, and do not illustrate much concerning the creation of a customized designer in an existing WPF application. We have migrated our application from Windows Forms to WPF over the past year, and the next step will be to take an existing WinForms Panel designer, and rewrite it in WPF. Suffice it to say that this will be a huge project. But I don't even know where to begin. I am wondering if any of you have had similar experiences writing a customized designer for a WPF application, and what it was like. Even better, if you could compare and contrast the functionality between the WinForms designer and the WPF designer, or explain the transition from the former to the latter, that would be helpful. If you know of any simple examples that demonstrate a customized design environment (with custom controls, etc.) that would be extremely beneficial. All in all, I am just wondering if many people have undertaken this yet, and what their results have been. EDIT: To clarify, yes, I am talking about hosting a WPF designer. It appears that this may not even be possible, which is a huge setback. Here is a screenshot of our current WinForms designer. As you can see, it is used to create customized user interfaces. You can drag custom controls onto it and design them, then put the panel into a "run mode" in which all of the controls become functional. Short of spending months writing our designer, would this be possible in WPF? What about .NET 4.0 and VS2010? Will those add any designer functionality?

    Read the article

  • Android - Views in Custom Compound Component are not inflated (findByView returns null)

    - by Julian Arz
    I have made a Custom Component in XML, consisting of a button with an imageview stacked on top of it: <myapp.widget.ClearableCaptionedButton xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/ccbutton_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical|left" android:textAppearance="?android:attr/textAppearanceMedium" android:background="@android:drawable/edit_text"/> <ImageView android:id="@+id/ccbutton_clear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dip" android:layout_alignRight="@id/ccbutton_button" android:layout_alignTop="@id/ccbutton_button" android:layout_alignBottom="@id/ccbutton_button"/> </myapp.widget.ClearableCaptionedButton> extract of java source code: public class ClearableCaptionedButton extends RelativeLayout implements OnClickListener { ... public ClearableCaptionedButton(Context context, AttributeSet attrs) { super(context, attrs); // some stuff that works fine } .. protected void onFinishInflate() { super.onFinishInflate(); mButton = (Button) findViewById(R.id.ccbutton_button); mClear = (ImageView) findViewById(R.id.ccbutton_clear); mButton.setText(""); // error here: mButton == null } My problem is similar to this one. When i try to find the views inside the custom compound, findViewById returns null. But, as you can see, i already added super(context, attrs); to the constructor. i am using the custom component directly in xml layout, like this: <LinearLayout> <!-- some stuff --> <de.pockettaxi.widget.ClearableCaptionedButton android:layout_width="fill_parent" android:layout_height="wrap_content" app:caption="to"/> </LinearLayout> can anybody spot something? thanks.

    Read the article

  • Implementation review for a MVC.NET app with custom membership

    - by mrjoltcola
    I'd like to hear if anyone sees any problems with how I implemented the security in this Oracle based MVC.NET app, either security issues, concurrency issues or scalability issues. First, I implemented a CustomOracleMembershipProvider to handle the database interface to the membership store. I implemented a custom Principal named User which implements IPrincipal, and it has a hashtable of Roles. I also created a separate class named AuthCache which has a simple cache for User objects. Its purpose is simple to avoid return trips to the database, while decoupling the caching from either the web layer or the data layer. (So I can share the cache between MVC.NET, WCF, etc.) The MVC.NET stock MembershipService uses the CustomOracleMembershipProvider (configured in web.config), and both MembershipService and FormsService share access to the singleton AuthCache. My AccountController.LogOn() method: 1) Validates the user via the MembershipService.Validate() method, also loads the roles into the User.Roles container and then caches the User in AuthCache. 2) Signs the user into the Web context via FormsService.SignIn() which accesses the AuthCache (not the database) to get the User, sets HttpContext.Current.User to the cached User Principal. In global.asax.cs, Application_AuthenticateRequest() is implemented. It decrypts the FormsAuthenticationTicket, accesses the AuthCache by the ticket.Name (Username) and sets the Principal by setting Context.User = user from the AuthCache. So in short, all these classes share the AuthCache, and I have, for thread synchronization, a lock() in the cache store method. No lock in the read method. The custom membership provider doesn't know about the cache, the MembershipService doesn't know about any HttpContext (so could be used outside of a web app), and the FormsService doesn't use any custom methods besides accessing the AuthCache to set the Context.User for the initial login, so it isn't dependent on a specific membership provider. The main thing I see now is that the AuthCache will be sharing a User object if a user logs in from multiple sessions. So I may have to change the key from just UserId to something else (maybe using something in the FormsAuthenticationTicket for the key?).

    Read the article

  • iis7 compress dynamic content from custom handler

    - by Malloc
    I am having trouble getting dynamic content coming from a custom handler to be compressed by IIS 7. Our handler spits out json data (Content-Type: application/json; charset=utf-8) and responds to url that looks like: domain.com/example.mal/OperationName?Param1=Val1&Param2=Val2 In IIS 6, all we had to do was put the edit the MetaBase.xml and in the IIsCompressionScheme element make sure that the HcScriptFileExtensions attribute had the custom extension 'mal' included in it. Static and Dynamic compression is turned out at the server and website level. I can confirm that normal .aspx pages are compressed correctly. The only content I cannot have compressed is the content coming from the custom handler. I have tried the following configs with no success: <handlers> <add name="MyJsonService" verb="GET,POST" path="*.mal" type="Library.Web.HttpHandlers.MyJsonServiceHandlerFactory, Library.Web" /> </handlers> <httpCompression> <dynamicTypes> <add mimeType="application/json" enabled="true" /> </dynamicTypes> </httpCompression> _ <httpCompression> <dynamicTypes> <add mimeType="application/*" enabled="true" /> </dynamicTypes> </httpCompression> _ <staticContent> <mimeMap fileExtension=".mal" mimeType="application/json" /> </staticContent> <httpCompression> <dynamicTypes> <add mimeType="application/*" enabled="true" /> </dynamicTypes> </httpCompression> Thanks in advance for the help.

    Read the article

  • deserialize Json using JavaScriptSerializer Custom Types

    - by Dave
    I have a RESTFUL WCF service returning a .NET custom type as json string. I am using .NET 3.5 framework and I am using JavaScriptSerializer for deserializing it in to my custom type. Serialization to json is handled by WCF. using (WebResponse resp = req.GetResponse()) { using (System.IO.StreamReader sreader = new System.IO.StreamReader(resp.GetResponseStream())) { string jsonString = sreader.ReadToEnd(); CustomType myType = new CustomType(); System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); myType = serializer.Deserialize<CustomType>(jsonString); return myType; } } The problem is that, I have a property (or element) of the CustomType which is generic list of another custom type ChildObject. They are in different namespaces. When I deserialize using the code above, I get all the properties of the CustomType myType including a list of ChildObject. But all the properties of the ChildObject is null. The string returned from the stream reader has all the values for the ChildObject. the values are lost when deserializing. Can anyone help me with this please?

    Read the article

  • Using HAML with custom filters

    - by Guard
    Hi everybody. I feel quite excited about HAML and CoffeeScript and am working on tutorial showing how to use them in non-Rails environment. So, haml has easy to use command-line utility haml input.haml output.html. And, what is great, there exist a project (one of many forks: https://github.com/aussiegeek/coffee-haml-filter) aimed at providing custom filter that converts CoffeeScript into JS inside of HAML files. Unfortunately (or am I missing something?) haml doesn't allow specifying custom filters on the command line or with some configuration file. I (not being a Ruby fan or even knowing it enough) managed to solve it (based on some clever suggestion somewhere on SO) with this helper script: haml.rb require 'rubygems' require 'active_support/core_ext/object/blank' require 'haml' require 'haml/filters/coffee' template = ARGV.length > 0 ? File.read(ARGV.shift) : STDIN.read haml_engine = Haml::Engine.new(template) file = ARGV.length > 0 ? File.open(ARGV.shift, 'w') : STDOUT file.write(haml_engine.render) file.close Which is quite straightforward, except of requires in the beginning. Now, the questions are: 1) should I really use it, or is there another way to have on-demand HAML to HTML compilation with custom filters? 2) What about HAML watch mode? It's great and convenient. I can, of course, create a polling script in python that will watch the directory changes and call this .rb script, but it looks like a dirty solution.

    Read the article

  • IPhone custom UITableViewCell Reloading

    - by Steblo
    Hi, currently I'm struggling with this problem: I got a UITableViewController that displays a tableView with different custom cells. One custom cell displays a number (by a label). If you click on this cell, the navigationController moves to a UIPicker where the user can select the number to be displayes. If the user moves back, the cell should display the updated value. Problem: I managed to reload the cells by calling - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.tableView reloadData]; } in the UITableViewController. This works only, if I don't use dequeueReusableCellWithIdentifier for the cell (tables won't show updates otherwise). But in this case, memory usage grows and grows... In addition, the program crashes after about 15 movements to pickerView and back - I think because the cell that should be reloaded is already released. How can I update a reusable custom cell every time the view appears ? What is the best solution ? I think retaining cells should not be used ?

    Read the article

  • cakephp: Custom Authentication Object authenticate not called

    - by Kristoffer Darj
    The method authenticate in a Custom Authentication Object is never called. Is this a glicth or am I missing something? I don't get anything in the log, I'm just redirected to users/login (or the one I specified) CakeVersion: 2.4.1 <?php //My custom Auth Class //Path: app/Controller/Component/Auth/HashAuthenticate.php App::uses('BaseAuthenticate', 'Controller/Component/Auth'); class HashAuthenticate extends BaseAuthenticate { public function authenticate(CakeRequest $request, CakeResponse $response) { //Seems to not be called CakeLog::write('authenticate'); debug($this); die('gaah'); } } If I add the method getUser() (or unauthenticated() ), those gets called however so at least I know that cake finds the class and so on. It just skips the authenticate-method. The AppController looks like this class AppController extends Controller { public $helpers = array('Html', 'Form', 'Session'); public $components = array('Auth' => array( 'authenticate' => array('Hash'), 'authorize' => array('Controller'), ) ); } I found a similar question here: CakePHP 2.x custom "Authentication adapter &quot;LdapAuthorize&quot; was not found but there the issue was typos.

    Read the article

  • osCommerce custom PHP page

    - by Afrosimon
    Hello! One of my client has an old osCommerce website and while working on it I have to implement what I would call "custom php page", i.e. a page which query a MySQL table, not related to osCommerce, and list the result. I'm not sure of the version, this trick I have seen a lot didn't gave me any result : http://www.clubosc.com/how-to-know-what-version-of-oscommerce-you-are-using.html . And I'm having a hard time doing this seemingly simple task, since osCommerce doesn't allow any php code in the page creation, and I didn't find any module giving me this possibility (not that it is easy to search in this mess : http://addons.oscommerce.com/). At this point I figured it would be easier to just hack'n slash through the code and come up with a custom page : I copied the index.php (the entry point in the application) : <?php require('includes/application_top.php'); if(!$smarty->is_cached($sContentPage, $sCachingGroup)) { //we switch on the content recognition require('includes/pages/' . $sContentClass . '.php'); } $smarty->display($sContentPage, $sCachingGroup); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Here I gave a specific value to $sContentClass (with or without the if makes no difference) and customize the corresponding PHP file so it show my custom content but also initialize the same variable than those other PHP file in the pages/ folder. But alas, all of this curious and dubious code simply return me the home page. So here I am, is there an osCommerce Guru around here, or would anyone has a better idea (oh and I also posted on the osCommerce forum, but I'm still waiting for a response...)? Thanks a lot in advance.

    Read the article

  • Ruby: add custom properties to built-in classes

    - by dreftymac
    Question: Using Ruby it is simple to add custom methods to existing classes, but how do you add custom properties? Here is an example of what I am trying to do: myarray = Array.new(); myarray.concat([1,2,3]); myarray._meta_ = Hash.new(); # obviously, this wont work myarray._meta_['createdby'] = 'dreftymac'; myarray._meta_['lastupdate'] = '1993-12-12'; ## desired result puts myarray._meta_['createdby']; #=> 'dreftymac' puts myarray.inspect() #=> [1,2,3] The goal is to construct the class definition in such a way that the stuff that does not work in the example above will work as expected. Update: (clarify question) One aspect that was left out of the original question: it is also a goal to add "default values" that would ordinarily be set-up in the initialize method of the class. Update: (why do this) Normally, it is very simple to just create a custom class that inherits from Array (or whatever built-in class you want to emulate). This question derives from some "testing-only" code and is not an attempt to ignore this generally acceptable approach.

    Read the article

  • Ruby: add custom properties to built-in classes

    - by dreftymac
    Question: Using Ruby it is simple to add custom methods to existing classes, but how do you add custom properties? Here is an example of what I am trying to do: myarray = Array.new(); myarray.concat([1,2,3]); myarray._meta_ = Hash.new(); # obviously, this wont work myarray._meta_['createdby'] = 'dreftymac'; myarray._meta_['lastupdate'] = '1993-12-12'; ## desired result puts myarray._meta_['createdby']; #=> 'dreftymac' puts myarray.inspect() #=> [1,2,3] The goal is to construct the class definition in such a way that the stuff that does not work in the example above will work as expected. Update: (clarify question) One aspect that was left out of the original question: it is also a goal to add "default values" that would ordinarily be set-up in the initialize method of the class. Update: (why do this) Normally, it is very simple to just create a custom class that inherits from Array (or whatever built-in class you want to emulate). This question derives from some "testing-only" code and is not an attempt to ignore this generally acceptable approach.

    Read the article

  • PageMethod with Custom Handler

    - by Mister Cook
    I have a page based web method which works fine, using [WebMethod], i.e [WebMethod] public static void DoSomethingOnTheServer() { } I also have a custom page handler to make SEO friendly URLs possible, e.g http://localhost/MySite/A_nice_url.ext = http://localhost/MySite/page.aspx?id=1 I am using Server.Transfer in my ProcessRequest handler to achieve this. This all works fine. Also, my page method works fine when the user requests the URL such as: http://localhost/MySite/page.aspx?id=1 However, when the user requests the custom handled URL, i.e. http://localhost/MySite/A_nice_url.ext The client reports that the PageMethod has been successfully completed, but it has not been called at all. I'm guessing it has something to do with my custom handler, so I have modified it to include PathInfo: public void ProcessRequest(HttpContext context) { // ... (code to determine id) ... // Transfer to the required page string actualPath = "~/page.aspx" + context.Request.PathInfo + "?id=" + determinedId; context.Server.Transfer(actualPath); } So now if a PageMethod is called, it will result in: http://localhost/MySite/page.aspx/DoSomethingOnTheServer?id=1 I'm wondering if this is the correct syntax for calling a PageMethod. When I try Server.Transfer reports: Error executing child request for /MySite/page.aspx/DoSomethingOnTheServer I've experimented with HttpContext.RewritePath but not sure how to actually make it perform the request. This does not seem to work, any ideas?

    Read the article

  • Auto-resize custom horizontal scrollbar/slider?

    I'm working on a site that scrolls horizontally. I know very little about jQuery and prototype and I got this slider script working as the page scrollbar. When the window is resized smaller, the custom horizontal slider/scrollbar won't resize to the viewport's width. I have the page and js files here http://keanetix.co.cc/scrollpage/ Try to resize the browser and you'll notice the custom scrollbar extending to the right. The custom scrollbar wont fit on the viewport, unless you refresh the page when it's been resized. Can somebody help me with this? Thanks. This is the code in the HTML page: <script type="text/javascript" language="javascript"> // <![CDATA[ // horizontal slider control var slider2 = new Control.Slider('handle', 'track', { onSlide: function(v) { scrollHorizontal(v, $('scrollable'), slider2); }, onChange: function(v) { scrollHorizontal(v, $('scrollable'), slider2); } }); // scroll the element horizontally based on its width and the slider maximum value function scrollHorizontal(value, element, slider) { element.scrollLeft = Math.round(value/slider.maximum*(element.scrollWidth-element.offsetWidth)); } // disable horizontal scrolling if text doesn't overflow the div if ($('scrollable').scrollWidth <= $('scrollable').offsetWidth) { slider2.setDisabled(); $('track').hide(); } // ]]> </script>

    Read the article

  • Zend_Validate_Abstract custom validator not displaying correct error messages.

    - by Jeremy Dowell
    I have two text fields in a form that I need to make sure neither have empty values nor contain the same string. The custom validator that I wrote extends Zend_Validate_Abstract and works correctly in that it passes back the correct error messages. In this case either: isEmpty or isMatch. However, the documentation says to use addErrorMessages to define the correct error messages to be displayed. in this case, i have attached ->addErrorMessages(array("isEmpty"=>"foo", "isMatch"=>"bar")); to the form field. According to everything I've read, if I return "isEmpty" from isValid(), my error message should read "foo" and if i return "isMatch" then it should read "bar". This is not the case I'm running into though. If I return false from is valid, no matter what i set $this-_error() to be, my error message displays "foo", or whatever I have at index[0] of the error messages array. If I don't define errorMessages, then I just get the error code I passed back for the display and I get the proper one, depending on what I passed back. How do I catch the error code and display the correct error message in my form? The fix I have implemented, until I figure it out properly, is to pass back the full message as the errorcode from the custom validator. This will work in this instance, but the error message is specific to this page and doesn't really allow for re-use of code. Things I have already tried: I have already tried validator chaining so that my custom validator only checks for matches: ->setRequired("true") ->addValidator("NotEmpty") ->addErrorMessage("URL May Not Be Empty") ->addValidator([*customValidator]*) ->addErrorMessage("X and Y urls may not be the same") But again, if either throws an error, the last error message to be set displays, regardless of what the error truly is. I'm not entirely sure where to go from here. Any suggestions?

    Read the article

  • custom cells uitableview - cannot display all the rows

    - by Matt Facer
    Hi guys, I'm creating a uitableview with custom cells which I created in Interface Builder. There are currently three cells (UITableViewCell). I have a UITableView which is on the view. The code I have is fairly standard, but I cannot work out how to actually SHOW the three custom cells. I am using the cellForRowAtIndexPath method. My aim is to get a grouped uitableview which shows like the following Item - Name Settings - alert - time So the above indented view should be my grouped uitableview. The problem is, I cannot get it to show using code. The uitableview will ALWAYS be this. I am trying to replicate the settings style screen... so I do not have any arrays to display the uitableview cells. How do I actually display my three cells? I have the following code - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) return 1; else return 2; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if(section == 0) return @"Item"; else return @"Settings"; } So all I need to know is how to actually display my custom cells inside the tableview! Thanks for any information. I've searched for AGES in google .. all the tutorials use arrays to display data!

    Read the article

  • Receiving generic typed <T> custom objects through remote object in Flex

    - by Aaron
    Is it possible to receive custom generic typed objects through AMF? I'm trying to integrate a flex app with an existing C# service but flex is choking on custom generic typed objects. As far as I can tell Flex doesn't even support generics, but I'd like to be able to even just read in the object and cast its members as necessary. I basically just want flex to ignore the <T>. I'm hopeful that there's a way to do this, since flex doesn't complain about typed collections (a server call returning List works fine and flex converts it to an ArrayCollection just like an un-typed List). Here's a trimmed down example of what's going on for me: The custom C# typed class public class TypeTest<T> { public T value { get; set; } public TypeTest () { } } The server method returning the typeTest public TypeTest<String> doTypeTest() { TypeTest<String> theTester = new TypeTest<String>("grrrr"); return theTester; } The corresponding flex value object: [RemoteClass(alias="API.Model.TypeTest")] public class TypeTest { private var _value:Object; public function get value():Object { return _value; } public function set value(theValue:Object):void { _value = value; } public function TypeTest() { } } and the result handler code: public function doTypeTest(result:TypeTest):void { var theString:String = result.value as String; trace(theString); } When the result handler is called I get the runtime error: TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy@11a98041 to com.model.vos.TypeTest. Irritatingly if I change the result handler to take parameter of type Object it works fine. Anyone know how to make this work with the value object? I feel like i'm missing something really obvious.

    Read the article

  • Correct way of setting a custom FileInfo class to an Iterator

    - by Gordon
    I am trying to set a custom class to an Iterator through the setInfoClass method: Use this method to set a custom class which will be used when getFileInfo and getPathInfo are called. The class name passed to this method must be derived from SplFileInfo. My class is like this (simplified example): class MyFileInfo extends SplFileInfo { public $props = array( 'foo' => '1', 'bar' => '2' ); } The iterator code is this: $rit = new RecursiveIteratorIterator( new RecursiveDirectoryIterator('/some/file/path/'), RecursiveIteratorIterator::SELF_FIRST); Since RecursiveDirectoryIterator is by inheritance through DirectoryIterator also an SplFileInfo object, it provides the setInfoClass method (it's not listed in the manual, but reflection shows it's there). Thus I can do: $rit->getInnerIterator()->setInfoClass('MyFileInfo'); All good up to here, but when iterating over the directory with foreach($rit as $file) { var_dump( $file ); } I get the following weird result object(MyFileInfo)#4 (3) { ["props"]=>UNKNOWN:0 ["pathName":"SplFileInfo":private]=>string(49) "/some/file/path/someFile.txt" ["fileName":"SplFileInfo":private]=>string(25) "someFile.txt" } So while MyFileInfo is picked up, I cannot access it's properties. If I add custom methods, I can invoke them fine, but any properties are UNKNOWN. If I don't set the info class to the iterator, but to the SplFileInfo object (like shown in the example in the manual), it will give the same UNKNOWN result: foreach($rit as $file) { // $file is a SplFileInfo instance $file->setInfoClass('MyFileInfo'); var_dump( $file->getFileInfo() ); } However, it will work when I do foreach($rit as $file) { $file = new MyFileInfo($file); var_dump( $file ); } Unfortunately, the code I a want to use this in is somewhat more complicated and stacks some more iterators. Creating the MyFileInfo class like this is not an option. So, does anyone know how to get this working or why PHP behaves this weird? Thanks.

    Read the article

  • How to make a WPF ComboBox editable with custom values

    - by Liam
    I would like to have a combobox that allows selection from a list of values and also allow a custom value from the typed in text. For display reasons the items are a complex type (lets say the combobox item template displays a patch of color and a flag indicating if it is a custom color). public class ColorLevel { public decimal Intensity { get; set; } public bool IsCustom { get; set; } public Color BaseColor { get; set; } public override ToString() { return string.Format("{0}", Intensity*100); } } Example items var items = new [] { new ColorLevel { Intensity = 0.9m, IsCustom = false, BaseColor = Color.Red }, new ColorLevel { Intensity = 0.7m, IsCustom = false, BaseColor = Color.Red } } XAML <ComboBox SelectedItem="{Binding Path=SelectedColorLevel}" IsEditable="true" IsTextSearchEnabled="true"> </ComboBox> So the above markup works when an item is selected from the item list. And as you type with the text search the matching items are selected. If the typed text doesn't match an item then the SelectedColorLevel is set to null. The question is at what point (and how) is it best to create a new custom item that can be set to the SelectedColorLevel when the typed text doesn't match an item. For example I would want to assign a new item to the selected value such as new ColorLevel { Intensity = decimal.Parse(textvalue), IsCustom = true } or using an appropriate converter and databinding to the Text property.

    Read the article

  • How to parse a custom XML-style error code response from a website

    - by user1870127
    I'm developing a program that queries and prints out open data from the local transit authority, which is returned in the form of an XML response. Normally, when there are buses scheduled to run in the next few hours (and in other typical situations), the XML response generated by the page is handled correctly by the java.net.URLConnection.getInputStream() function, and I am able to print the individual results afterwards. The problem is when the buses are NOT running, or when some other problem with my queries develops after it is sent to the transit authority's web server. When the authority developed their service, they came up with their own unique error response codes, which are also sent as XMLs. For example, one of these error messages might look like this: <Error xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Code>3005</Code> <Message>Sorry, no stop estimates found for given values.</Message> </Error> (This code and similar is all that I receive from the transit authority in such situations.) However, it appears that URLConnection.getInputStream() and some of its siblings are unable to interpret this custom code as a "valid" response that I can handle and print out as an error message. Instead, they give me a more generic HTTP/1.1 404 Not Found error. This problem cascades into my program which then prints out a java.io.FileNotFoundException error pointing to the offending input stream. My question is therefore two-fold: 1. Is there a way to retrieve, parse, and print a custom XML-formatted error code sent by a web service using the plugins that are available in Java? 2. If the above is not possible, what other tools should I use or develop to handle such custom codes as described?

    Read the article

  • ReportServer 2005 Custom Assembly Error

    - by user752083
    We have a reportserver on sql server 2005, it has previously been working on computer X which we are replacing with a computer Y. Computer X only had one default sql instance as our test environment, machine Y is a new machine with 2 sql instances, Y\TEST and Y\DEV. Both machines run Windows Server 2003 and Both have Sql Server 2005 installed together with Report Server We have not currently done any work on the DEV instance, just on the TEST instance. The reportserver is installed for TEST. SSRS previously worked as intended on X machine, and on Y\TEST its working for reports not using any custom code. However for some of the reports we are loading a custom assembly Localization. This assembly currently exists in following folders on server: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\bin Also in rssrvpolicy.config, the entry for Report_Expressions_Default_Permissions has been changed from Execution to FullTrust (Although this was not necessary on the machine X). When attempting to upload the rdl files through the web interface, we get the following errors: Error while loading code module: ‘Localization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e302ddd55ecd694a’. Details: Could not load file or assembly 'Localization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e302ddd55ecd694a' or one of its dependencies. The system cannot find the file specified. (rsErrorLoadingCodeModule) Get Online Help There is an error on line 14 of custom code: [BC30451] Name 'Localization' is not declared. (rsCompilerErrorInCode) Get Online Help Does anyone know any other places with potential errors?

    Read the article

  • Passing variables to a Custom Zend Form Element

    - by user322003
    Hi, I'm trying to create a custom form element which extends Zend_Form_Element_Text with a validator (so I don't have to keep setting up the validator when I use certain elements). Anyway, I'm having trouble passing $maxChars variable to it when I instantiate it in my Main form. I've provided my shortened code below This is my custom element below class My_Form_Custom_Element extends Zend_Form_Element_Text { public $maxChars public function init() { $this->addValidator('StringLength', true, array(0, $this->maxChars)) } public function setProperties($maxChars) { $this->maxChars= $maxChars; } } This is where I instantiate my custom form element. class My_Form_Abc extends Zend_Form { public function __construct($options = null) { parent::__construct($options); $this->setName('abc'); $customElement = new My_Form_Custom_Element('myCustomElement'); $customElement->setProperties(100); //**<----This is where i set the $maxChars** $submit = new Zend_Form_Element_Submit('submit'); $submit -> setAttrib('id', 'submitbutton'); $this->addElements(array($customElement ,$submit)); } } When I try to pass '100' using $customElement-setProperties(100) in my Form, it doesnt get passed properly to my StringLength validator. I assume it's because the validator is getting called in Init? How can I fix this?

    Read the article

  • Raphael.js: Adding a new custom element

    - by Claudia
    I would like to create a custom Raphael element, with custom properties and functions. This object must also contain predefined Raphael objects. For example, I would have a node class, that would contain a circle with text and some other elements inside it. The problem is to add this new object to a set. These demands are needed because non-Raphael objects cannot be added to sets. As a result, custom objects that can contain Raphael objects cannot be used. The code would look like this: var Node = function (paper) { // Coordinates & Dimensions this.x = 0, this.y = 0, this.radius = 0, this.draw = function () { this.entireSet = paper.set(); var circle = paper.circle(this.x, this.y, this.radius); this.circleObj = circle; this.entireSet.push(circle); var text = paper.text(this.x, this.y, this.text); this.entireSet.push(text); } // other functions } var NodeList = function(paper){ this.nodes = paper.set(), this.populateList = function(){ // in order to add a node to the set // the object must be of type Raphael object // otherwise the set will have no elements this.nodes.push(// new node) } this.nextNode = function(){ // ... } this.previousNode = function(){ // ... } }

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >