Search Results

Search found 13815 results on 553 pages for 'custom'.

Page 16/553 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • F# Silverlight 3.0 Custom Control Property throws: NullReferenceException

    - by akaphenom
    A new issue since my previous post. I am having some issues with the properties of the control in my Control Class I havse defined: static member ItemsProperty : DependencyProperty = DependencyProperty.Register( "Items", typeof<MyMenuItemCollection>, typeof<MyMenu>, null); member this.Items with get () : MyMenuItemCollection = this.GetValue(MyMenu.ItemsProperty) :?> MyMenuItemCollection and set (value: MyMenuItemCollection) = this.SetValue(MyMenu.ItemsProperty, value); The problem occurs on access: for menuItem in this.Items do let contentElement: FrameworkElement = menuItem.Content where I get a null referce exception on this.Items; 'Items' threw an exception of type 'System.NullReferenceException' Immediately after I initialized in the constructor: do this.Items <- new CoolMenuItemCollection()

    Read the article

  • Weird y offset when using custom frag shader (Cocos2d-x)

    - by Mister Guacamole
    I'm trying to mask a sprite so I wrote a simple fragment shader that renders only the pixels that are not hidden under another texture (the mask). The problem is that it seems my texture has its y-coordinate offset after passing through the shader. This is the init method of the sprite (GroundZone) I want to mask: bool GroundZone::initWithSize(Size size) { // [...] // Setup the mask of the sprite m_mask = RenderTexture::create(textureWidth, textureHeight); m_mask->retain(); m_mask->setKeepMatrix(true); Texture2D *maskTexture = m_mask->getSprite()->getTexture(); maskTexture->setAliasTexParameters(); // Disable linear interpolation on the mask // Load the custom frag shader with a default vert shader as the sprite’s program FileUtils *fileUtils = FileUtils::getInstance(); string vertexSource = ccPositionTextureA8Color_vert; string fragmentSource = fileUtils->getStringFromFile( fileUtils->fullPathForFilename("CustomShader_AlphaMask_frag.fsh")); GLProgram *shader = new GLProgram; shader->initWithByteArrays(vertexSource.c_str(), fragmentSource.c_str()); shader->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::VERTEX_ATTRIB_POSITION); shader->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORDS); shader->link(); CHECK_GL_ERROR_DEBUG(); shader->updateUniforms(); CHECK_GL_ERROR_DEBUG(); int maskTexUniformLoc = shader->getUniformLocationForName("u_alphaMaskTexture"); shader->setUniformLocationWith1i(maskTexUniformLoc, 1); this->setShaderProgram(shader); shader->release(); // [...] } These are the custom drawing methods for actually drawing the mask over the sprite: You need to know that m_mask is modified externally by another class, the onDraw() method only render it. void GroundZone::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) { m_renderCommand.init(_globalZOrder); m_renderCommand.func = CC_CALLBACK_0(GroundZone::onDraw, this, transform, transformUpdated); renderer->addCommand(&m_renderCommand); Sprite::draw(renderer, transform, transformUpdated); } void GroundZone::onDraw(const kmMat4 &transform, bool transformUpdated) { GLProgram *shader = this->getShaderProgram(); shader->use(); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, m_mask->getSprite()->getTexture()->getName()); glActiveTexture(GL_TEXTURE0); } Below is the method (located in another class, GroundLayer) that modify the mask by drawing a line from point start to point end. Both points are in Cocos2d coordinates (Point (0,0) is down-left). void GroundLayer::drawTunnel(Point start, Point end) { // To dig a line, we need first to get the texture of the zone we will be digging into. Then we get the // relative position of the start and end point in the zone's node space. Finally we use the custom shader to // draw a mask over the existing texture. for (auto it = _children.begin(); it != _children.end(); it++) { GroundZone *zone = static_cast<GroundZone *>(*it); Point nodeStart = zone->convertToNodeSpace(start); Point nodeEnd = zone->convertToNodeSpace(end); // Now that we have our two points converted to node space, it's easy to draw a mask that contains a line // going from the start point to the end point and that is then applied over the current texture. Size groundZoneSize = zone->getContentSize(); RenderTexture *rt = zone->getMask(); rt->begin(); { // Draw a line going from start and going to end in the texture, the line will act as a mask over the // existing texture DrawNode *line = DrawNode::create(); line->retain(); line->drawSegment(nodeStart, nodeEnd, 20, Color4F::RED); line->visit(); } rt->end(); } } Finally, here's the custom shader I wrote. #ifdef GL_ES precision mediump float; #endif varying vec2 v_texCoord; uniform sampler2D u_texture; uniform sampler2D u_alphaMaskTexture; void main() { float maskAlpha = texture2D(u_alphaMaskTexture, v_texCoord).a; float texAlpha = texture2D(u_texture, v_texCoord).a; float blendAlpha = (1.0 - maskAlpha) * texAlpha; // Show only where mask is invisible vec3 texColor = texture2D(u_texture, v_texCoord).rgb; gl_FragColor = vec4(texColor, blendAlpha); return; } I got a problem with the y coordinates. Indeed, it seems that once it has passed through my custom shader, the sprite's texture is not at the right place: Without custom shader (the sprite is the brown thing): With custom shader: What's going on here? Thanks :) EDIT It looks like after passing through the shader when I set the position of the sprite I set it in points, with (0,0) being in the top-right. Indeed, when I do sprite->setPosition(320, 480), the sprite is perfectly placed at the top of the screen.

    Read the article

  • Java: custom-exception-error

    - by HH
    $ javac TestExceptions.java TestExceptions.java:11: cannot find symbol symbol : class test location: class TestExceptions throw new TestExceptions.test("If you see me, exceptions work!"); ^ 1 error Code import java.util.*; import java.io.*; public class TestExceptions { static void test(String message) throws java.lang.Error{ System.out.println(message); } public static void main(String[] args){ try { // Why does it not access TestExceptions.test-method in the class? throw new TestExceptions.test("If you see me, exceptions work!"); }catch(java.lang.Error a){ System.out.println("Working Status: " + a.getMessage() ); } } }

    Read the article

  • Exception design: Custom exceptions reading data from file?

    - by User
    I have a method that reads data from a comma separated text file and constructs a list of entity objects, let's say customers. So it reads for example, Name Age Weight Then I take these data objects and pass them to a business layer that saves them to a database. Now the data in this file might be invalid, so I'm trying to figure out the best error handling design. For example, the text file might have character data in the Age field. Now my question is, should I throw an exception such as InvalidAgeException from the method reading the file data? And suppose there is length restriction on the Name field, so if the length is greater than max characters do I throw a NameTooLongException or just an InvalidNameException, or do I just accept it and wait until the business layer gets a hold of it and throw exceptions from there? (If you can point me to a good resource that would be good too)

    Read the article

  • Custom pyGTK button

    - by Wallter
    I would like to create a button that I can control the look of the button using pyGTK. How would I go about doing this? I would like to be able to point to a new image for each 'state' the button is in (i.e. Pressed, mouse over, normal...etc.)

    Read the article

  • Response.Redirect not working inside an custom ActionFilter

    - by mitch
    My code is the following public class SessionCheckAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { if (/*condition*/) { filterContext.HttpContext.Response.Redirect("http://www.someurl.com",true); } base.OnActionExecuting(filterContext); } } Now, the question is WHY does the action that is has [SessionCheck] applied to it STILL executes. Any ideas? Thanks.

    Read the article

  • How to call wordpress functions in custom php script

    - by sid.sri
    I have a Php script I want to use for creating a new blog in WPMU. I am having trouble calling wordpress functions like "wpmu_create_user" and "wpmu_create_blog". My hope is to get this script running as a cron job from command line and pick up new blog creation requests from an external db, create a new blog using the wordpress functions and update the db with new blog info. Any help/suggestions are highly appreciated. Sid.

    Read the article

  • HTML custom tags: pros & cons

    - by o_O Tync
    I'd like to use some semantic HTML tags instead of <div>s: <article>, <product>, <footer> etc. Some of them are already presented in the upcoming HTML5, however, it's not fully supported. Which are the possible cons I might face when Rendering? Using CSS, JS? The one I remember is: IE6 can't clone tags it doesn't know.

    Read the article

  • Custom routes/paths/roads on Google Maps

    - by Douglas
    Hey guys. I need to know, and as quickly as possible, if what I need is achievable. I need to be able to, using either V2 OR V3 (preferably 3), create paths which ignore buildings in a sense. I was trying to create even a kml file to draw out all of the paths myself, and then find some way to turn them on/off as needed. For example. The user wants to go from point A to point B. Between these points is a number of buildings. The user physically CAN walk through these buildings(it's a campus). I want to show them that on the map. This way you don't have to do a loop-de-loop around, say, a parking lot, just to get to the other end of it. If there is ANY way AT ALL to do this, I'd love to know. An example of what I require can be found here: http://www.uottawa.ca/maps/ It's all pre-determined paths based on the two inputs from the user into the dropdown menu. I can plainly see this. But I have no clue if a) this can be done in v3, and b) how on earth they did it themselves. Assistance required, and greatly appreciated!

    Read the article

  • WiX: Extracting Binary-string in Custom Action yields string like "???good data"

    - by leiflundgren
    I just found a weird behaviour when attempting to extract a string from the Binary-table in the MSI. I have a file containing "Hello world", the data I get is "???Hello world". (Literary question mark.) Is this as intended? Will it always be exactly 3 characters in the beginning? Regards Leif Sample code: [CustomAction] public static ActionResult CustomAction2(Session session) { View v = session.Database.OpenView("SELECT `Name`,`Data` FROM `Binary`"); v.Execute(); Record r = v.Fetch(); int datalen = r.GetDataSize("Data"); System.IO.Stream strm = r.GetStream("Data"); byte[] rawData = new byte[datalen]; int res = strm.Read(rawData, 0, datalen); strm.Close(); String s = System.Text.Encoding.ASCII.GetString(rawData); // s == "???Hello World" return ActionResult.Success; }

    Read the article

  • ASP.Net partially ignoring my Custom error section in web.config

    - by weevie
    Here's my web.config customErrors section (you'll notice I've switched the mode to 'On' so I can see the redirect on my localhost): <customErrors defaultRedirect="~/Application/ServerError.aspx" mode="On" redirectMode="ResponseRewrite"> <error statusCode="403" redirect="~/Secure/AccessDenied.aspx" /> </customErrors> and here's the code that throws: Catch adEx As AccessDeniedException Throw New HttpException(DirectCast(HttpStatusCode.Forbidden, Integer), adEx.Message) End Try and here's what I end up with: Which is not my pretty AccessDenied.aspx page but it is a forbidden error page so at least I know my throw is working. I've removed the entry for 403 in IIS (7.0) as a desperate last attempt and unsuprisingly that made no difference. I've run out of ideas now so any suggestions will be gratefully appreciated!

    Read the article

  • How to create custom exception handler for custom controls or extension methods.

    - by Shantanu Gupta
    I am creating an extension method in C# to retrieve some value from datagridview. Here if a user gives column name that doesnot exists then i want this function to throw an exception that can be handled at the place where this function will be called. How can i achieve this. public static T Value<T>(this DataGridView dgv, int RowNo, string ColName) { if (!dgv.Columns.Contains(ColName)) throw new ArgumentException("Column Name " + ColName + " doesnot exists in DataGridView."); return (T)Convert.ChangeType(dgv.Rows[RowNo].Cells[ColName].Value, typeof(T)); }

    Read the article

  • BizTalk 2009 - Custom Functoid Wizard

    - by StuartBrierley
    When creating BizTalk maps you may find that there are times when you need perform tasks that the standard functoids do not cover.  At other times you may find yourself reapeating a pattern of standard functoids over and over again, adding visual complexity to an otherwise simple process.  In these cases you may find it preferable to create your own custom functoids.  In the past I have created a number of custom functoids from scratch, but recently I decided to try out the Custom Functoid Wizard for BizTalk 2009. After downloading and installing the wizard you should start Visual Studio and select to create a new BizTalk Server Functoid Project. Following the splash screen you will be presented with the General Properties screen, where you can set the classname, namespace, assembly name and strong name key file. The next screen is the first set of properties for the functoid.  First of all is the fuctoid ID; this must be a value above 6000. You should also then set the name, tooltip and description of the functoid.  The name will appear in the visual studio toolbox and the tooltip on hover over in the toolbox.  The descrition will be shown when you configure the functoid inputs when using it in a map; as such it should provide a decent level of information to allow the functoid to be used. Next you must set the category, exception mesage, icon and implementation language.  The category will affect the positioning of the functoid within the toolbox and also some of the behaviours of the functoid. We must then define the parameters and connections for our new functoid.  Here you can define the names and types of your input parameters along with the minimum and maximum number of input connections.  You will also need to define the types of connections accepted and the output type of the functoid. Finally you can click finish and your custom functoid project will be created. The results of this process can be seen in the solution explorer, where you will see that a project, functoid class file and a resource file have been created for you. If you open the class file you will see that the following code has been created for you: The "base" function sets all the properties that you previsouly detailed in the custom functoid wizard.  public TestFunctoids():base()  {    int functoidID;    // This has to be a number greater than 6000    functoidID = System.Convert.ToInt32(resmgr.GetString("FunctoidId"));    this.ID = functoidID;    // Set Resource strings, bitmaps    SetupResourceAssembly(ResourceName, Assembly.GetExecutingAssembly());    SetName("FunctoidName");                     SetTooltip("FunctoidToolTip");    SetDescription("FunctoidDescription");    SetBitmap("FunctoidBitmap");    // Minimum and maximum parameters that the functoid accepts    this.SetMinParams(2);    this.SetMaxParams(2);    /// Function name that needs to be called when this Functoid is invoked.    /// Put this in GAC.    SetExternalFunctionName(GetType().Assembly.FullName,     "MyCompany.BizTalk.Functoids.TestFuntoids.TestFunctoids", "Execute");    // Category for this functoid.    this.Category = FunctoidCategory.String;    // Input and output Connection type    this.OutputConnectionType = ConnectionType.AllExceptRecord;    AddInputConnectionType(ConnectionType.AllExceptRecord);   } The "Execute" function provides a skeleton function that contains the code to be executed by your new functoid.  The inputs and outputs should match those you defined in the Custom Functoid Wizard.   public System.Int32 Execute(System.Int32 Cool)   {    ResourceManager resmgr = new ResourceManager(ResourceName, Assembly.GetExecutingAssembly());    try    {     // TODO: Implement Functoid Logic    }    catch (Exception e)    {     throw new Exception(resmgr.GetString("FunctoidException"), e);    }   } Opening the resource file you will see some of the various string values that you defined in the Custom Functoid Wizard - Name, Tooltip, Description and Exception. You can also select to look at the image resources.  This will display the embedded icon image for the functoid.  To change this right click the icon and select "Import from File". Once you have completed the skeleton code you can then look at trying out your functoid. To do this you will need to build the project, copy the compiled DLL to C:\Program Files\Microsoft BizTalk Server 2009\Developer Tools\Mapper Extensions and then refresh the toolbox in visual studio.

    Read the article

  • Newbie question: Creating a custom control

    - by Wild Thing
    Hi, I have an ASP.Net site, in which I am using a ListView with a Datapager. Apparently there is a bug with the Datapager, where it crashes if there is an empty ampersand (&) in the querystring. This is a known issue: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=357344&wa=wsignin1.0#tabs I see that there is a workaround given, but did not understand how to implement it. Can somebody point me in the right direction? Also, I see that this issue is marked as resolved. Any idea where I can find the updated version of this control? Wild Thing

    Read the article

  • iphone tabbar with custom buttons and scrollvie

    - by chunjai
    i'm trying to get a tab bar effect not unlike russel quinn's 'creative review' app. the tabbar swipes across, which i have figured out, but the tabbar style itself is unlike anything i've seen on the iphone (though it looks so simple!). it has square buttons with a space between, and each button has a select/active/inactive state. i'm having a hard time seeing how this can be tabbar, but i don't know any other way. can someone explain this? here's the example :: http://bit.ly/c8CeBC. any help is appreciated.

    Read the article

  • J2EE: Default values for custom tag attributes

    - by Nick
    So according to Sun's J2EE documentation (http://docs.sun.com/app/docs/doc/819-3669/bnani?l=en&a=view), "If a tag attribute is not required, a tag handler should provide a default value." My question is how in the hell do I define a default value as per the documentation's description. Here's the code: <%@ attribute name="visible" required="false" type="java.lang.Boolean" %> <c:if test="${visible}"> My Tag Contents Here </c:if> Obviously, this tag won't compile because it's lacking the tag directive and the core library import. My point is that I want the "visible" property to default to TRUE. The "tag attribute is not required," so the "tag handler should provide a default value." I want to provide a default value, so what am I missing? Any help is greatly appreciated.

    Read the article

  • Custom Message Box in WPF - What project type?

    - by Tony
    I have a WPF Composite application and I want to create a customized messagebox, I wondered what project type I should use to create it? A usercontrol A WPF Application A Class Library I have to then be able to use this MessageBox in other places in my application.

    Read the article

  • custom grid style in silverlight 4

    - by Archie
    Hello, I want to set background of a grid using a style. I style I'm setting the Background Property of the grid. But I have a border filled with LinearGradientFill and a Path which also has LinearGradientFill in it. But I'm not able to combine both. Below is sample code. I want to create it as a style. <Grid> <Border BorderBrush="Black" BorderThickness="2"> <Border.Background> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="Black" Offset="0.953" /> <GradientStop Color="White" Offset="0" /> </LinearGradientBrush> </Border.Background> </Border> <Path Data="M 0,0 C 0,620 10,10 560,0" Height="60" VerticalAlignment="Top"> <Path.Fill> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="White" Offset="0.779" /> </LinearGradientBrush> </Path.Fill> </Path> </Grid> It gives me an error as The Property 'Value' is set more than once. Can anyone help me with it? Thanks.

    Read the article

  • AutoRestart Custom Shell App

    - by MattH
    We have a .Net application that runs as a shell for certain users. We'd like the application to automatically restart when it crashes. The application is set as the shell here: HKEY_USERS*User*\Software\Microsoft\Windows NT\WinLogon\Shell I've tried adding an "AutoRestartShell" key with a value of "1", like what exists in: HKLM\Software\Microsoft\Windows NT\WinLogon. When I kill the application's process for the user (via RDP) the application exits, but never restarts. Ideas?

    Read the article

  • Drupal : Custom views filter

    - by Joseph
    Hi, First thing I would say is that I am a Drupal newbie. So, I would appreciate your answer in a detailed step by step process. I am using Drupal 6 and location module. There are two main content types - user profile (using content profile module) and event content type. Both have one field for location. Now, lets suppose in his profile, user is selecting city as Toronto and province as Ontario. And some events have been added for Toronto city. I need one Views, which will display events from user city. So, if user is from Vancouver, and they click on "my city events", they will see list of events from their city. Someone told me that I can achieve this using arguments/ relationships, but I don't know how to do that. Can someone please help me out? I am not good at PHP either :(

    Read the article

  • [X]HTML custom tags: pros & cons

    - by o_O Tync
    I'd like to use some semantic [X]HTML tags instead of <div>s: <article>, <product>, <footer> etc. Some of them are already presented in the upcoming HTML5, however, it's not fully supported. Which are the possible cons I might face when Rendering? Using CSS, JS? The one I remember is: IE6 can't clone tags it doesn't know.

    Read the article

  • Adding custom validator without using Zend_Form's addElementPrefixPath

    - by nush
    The problem is that I don't use Zend_Form, so I can't use the built in capabilities. I usually look for three things when setting a validator: - its path (usually in library/path/validators/MyValidator.php) - its class name (tried Validators_MyValidator) and - in application.ini, the autoloaderNamespaces[] = "Validators" I've tried different settings/namings/layouts to no avail. When using a validator in my Zend_Validate_Input, an exception occurs, saying that it couldn't find my plugin/validator, the classes being searched only in Zend/Validate with the Zend_Validate prefix (I didn't try this prefix, though). Wasn't there a setting in app.ini that added a prefix and a path?

    Read the article

  • Magento and unsetting a custom boolean attribute

    - by Spongeboy
    Hi, I've added an attribute to a customer address entity. Attribute setup code is as follows- 'entity_type_id'=>$customer_address_type_id, 'attribute_code'=>'signature_required', 'backend_type'=>'int', 'frontend_input'=>'boolean', 'frontend_label' => 'Signature required', 'is_global' => '1', 'is_visible' => '1', 'is_required' => '0', 'is_user_defined' => '0', I have then - added attribute to model\entity\setup.php added a HTML field on the edit form I am now getting the attribute saved to the database when the checkbox is checked. However, it is not being unset when checkbox is unchecked (I'm guessing due to checkbox input not being 'post'-ed if unchecked. What is the best way to uncheck this? Should I add a default value of 0? Or unset/delete the attribute before save in the controller? Should I add get/set methods to the model?

    Read the article

  • Blackberry - custom logic for checkboxes group

    - by SWATI
    if i click on any checkbox all previous checkboxes must get checked "my logic works" if i uncheck a checkbox then all checkboxes after it must get unchecked "how to do that" MyLogic works for storm but not for other models what to do //well what i want to do is i have 5 checkboxes class myscreen { chk_service = new CheckboxField[5]; chk_service[0]= new CheckboxField("1",true) chk_service[1]= new CheckboxField("2",false) chk_service[2]= new CheckboxField("3",false) chk_service[3]= new CheckboxField("4",false) chk_service[4]= new CheckboxField("5",false) CheckboxFieldChangeListener obj = new CheckboxFieldChangeListener(chk_service); chk_service[0].setChangeListener(obj); chk_service[1].setChangeListener(obj); chk_service[2].setChangeListener(obj); chk_service[3].setChangeListener(obj); chk_service[4].setChangeListener(obj); hm4 = new HorizontalFieldManager(); hm4.add(chk_service[0]); hm4.add(chk_service[1]); hm4.add(chk_service[2]); hm4.add(chk_service[3]); hm4.add(chk_service[4]); add(hm4); } public CheckboxFieldChangeListener (CheckboxField[] arrFields) { m_arrFields = arrFields; } public void fieldChanged(Field field, int context) { if(true == ((CheckboxField) field).getChecked()) { for(int i = 0; i < m_arrFields.length; i++) { if(m_arrFields[i]==field) { //a[j]=i; j++; break; } else { CheckboxField oField = m_arrFields[i]; oField.setChecked(true); } } } a[k] = j; if(false == ((CheckboxField) field).getChecked()) { for(int i =field.getIndex(); i < m_arrFields.length; i++) { if(m_arrFields[i]==field) { //a[j]=i; j++; break; } else { CheckboxField oField = m_arrFields[i]; oField.setChecked(false); } } } } }

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >