Daily Archives

Articles indexed Friday February 18 2011

Page 4/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • [iOS] becomeFirstResponder: automatically scroll to the UIControl that becomes first responder

    - by Manni
    I have a grouped UITableViewController with one section and many rows. Each cell consists of two elements: a UILabel with a description and a UITextField for an input. A form, I would say. On the bottom is a button "Next" the go to the next view. But before that, I validate the UITextField's: if the user hasn't filled a field, this field should get the focus, so that the user sees that he needs to enter something. I tried with this: [inputField becomeFirstResponder]; Remember, the button I pressed is on the bottom of my view and imagine that the UITextField is on the top. In this situation, the field doesn't get the focus because it is too far away. Now when I scroll up slowly and the field gets visible, the field becomes first responder and gets the cursor :-) Conclusion: The becomeFirstResponder worked, but does not exactly do what I wanted to. I don't want to scroll up with my finger, the field should get the focus and visible automatically. Is there any way to "jump" directly to my field? Use an alternative to becomeFirstResponder? Scroll to my field automatically? Thanks for your help!

    Read the article

  • Android/ iOS how to determine small changes in distance using sensors?

    - by Tom
    I have been doing a bit of research, but I cannot seem to find a way to determine small distances (centimeters and meters) using the sensors in Android or iOS devices. Bluetooth appears too inaccurate and require more than one device, GPS only works over larger variations in distance, and small variations in rotation seem to make using the accelerometer nearly impossible. Is there a method that I am unaware of that would allow me to do such a thing? I am familiar with Calculus, so using Integrals to determine distance based on changes in time and velocity/ acceleration is not a problem for me, I just do not know how to determine those things. Thank you.

    Read the article

  • Annoying Bug in banner cycle

    - by Davemof
    I have created a rotating banner script for a new site I'm developing View banner here(it rotates every 10 seconds) Unfortunately to the transition seems to be a biut buggy, and the image will fade out, show the same image again and then fade in the new one. I think I have made a simple error somewhere, but can't figure out where it is. the code used to cycle the banners is: In document ready: if ($('.home').length > 0){ $('<img width="100%" />').attr('src', '/assets/img/backgrounds/home/hero'+homecount+'.jpg').load(function(){ $('.hero').append( $(this) ); $('.hero img').fadeIn('medium').delay(10000).fadeOut('slow', loopImages); setHeroHeight(); }); } Outside document ready: function loopImages(){ homecount = homecount+1; if (homecount > 5){ homecount = 1; } $('.hero img') .attr('src', '/assets/img/backgrounds/home/hero'+homecount+'.jpg') .load(function(){ $('.hero img').fadeIn('fast')}).delay(10000).fadeOut('slow', loopImages); } Any help would be greatly appreciated Thanks Dave

    Read the article

  • HTML Helper/Text Box validation

    - by slandau
    I have this input on the view: <%= Html.TextBoxCurrentDateWithoutPermission("EffectiveDate", Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString("dd-MMM-yyyy") : "", new string[] { PERMISSIONS.hasICAdvanced }, new { @class = "economicTextBox", propertyName = "EffectiveDate", onchange = "parseAndSetDt(this); ", dataType = "Date" })%> Here is the custom HTML Helper: public static MvcHtmlString TextBoxCurrentDateWithoutPermission( this HtmlHelper htmlHelper, string name, object value, string[] permissions, object htmlAttributes ) { foreach (string permission in permissions) { if (Chatham.Web.UI.Extranet.SessionManager.DisplayUser.IsInRole(permission)) { // the user has the permission => render the textbox return htmlHelper.TextBox(name, value, htmlAttributes); } } // the user has no permission => render a readonly checkbox var mergedHtmlAttributes = new RouteValueDictionary(htmlAttributes); mergedHtmlAttributes["disabled"] = "disabled"; return htmlHelper.TextBox(name, value == "" ? DateTime.Now : value, mergedHtmlAttributes); } The way this works now is, when a user does NOT have the permission passed in, the box is disabled. The way it needs to be -- if the user does NOT have the permission passed in, it needs to be enabled, however the only dates it can accept are todays date AND dates in the future. So I need JQuery validation (or just plain JS), for this textbox on the page for the following case: If the textbox is enabled AND the user does not have the permission, allow the user to input the current date or future dates ONLY.

    Read the article

  • convert a textview, including those contents off the screen, to bitmap

    - by user623318
    Hi, I want to save(export) contents of MyView, which extends TextView, into a bitmap. I followed the code: [this][1]. It works fine when the size of the text is small. But when there are lots of texts, and some of the content is out of the screen, what I got is only what showed in the screen. Then I add a "layout" in my code: private class MyView extends TextView{ public MyView(Context context) { super(context); // TODO Auto-generated constructor stub } public Bitmap export(){ Layout l = getLayout(); int width = l.getWidth() + getPaddingLeft() + getPaddingRight(); int height = l.getHeight() + getPaddingTop() + getPaddingBottom(); Bitmap viewBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(viewBitmap); setCursorVisible(false); layout(0, 0, width, height); draw(canvas); setCursorVisible(true); return viewBitmap; } } Now the strange thing happened: The first time I invoke "export"(I use an option key to do that), I got contents only on the screen. When I invoke "export" again, I got complete contents, including those out of the screen. Why? How to "export" a view, including contents cannot be showed on the screen? Thank you! [1]: http://www.techjini.com/blog/2010/02/10/quicktip-how-to-convert-a-view-to-an-image-android/ this

    Read the article

  • How to create digital signature that can not be used to reproduce the message twice

    - by freediver
    I am creating a client-server application and I'd like to send data from server to client securely. Using public/private key algorithms makes sense and in PHP we can use openssl_sign and openssl_verify functions to check that the data came by someone who has the private key. Now imagine that one of the actions sent by server to client is destructive in nature. If somebody uses an HTTP sniffer to catch this command (which will be signed properly) how can I further protect the communication to ensure that only commands coming from our server get processed by the client? I was thinking about using current UTC time as part of the encrypted data but client time might be off. Is there a simple solution to the problem?

    Read the article

  • How can I make a new CTP (CakePHP) file in NetBeans?

    - by John Isaacks
    I have found a lot of info about adding CTP file support for NetBeans, but this is usually talking about code highlighting and treating a ctp file like a php file. This can be done at: Tools - Options - Miscellaneous - Files I have done this. However, when I try to create a NEW ctp file. I do not have the option. I tried going to Tools -> Templates to add a ctp template. There is no "new" button just an "add" button that looks for a file. I created a file on my desktop called cake_template.ctp on my desktop. I added it to the PHP templates in the template manager. I called the template "PHP Cake Template". Still when I go to create a new file, the option is not there. I restarted NetBeans, still the same. I just want to create a new .ctp file, it shouldn't be this difficult. Does anyone know how? I am using version 6.9.1

    Read the article

  • Losing jQuery functionality after postback

    - by David Lozzi
    I have seen a TON of people reporting this issue online, but no actual solutions. I'm not using AJAX or updatepanels, just a dropdown that posts back on selected index change. My HTML is <div id="myList"> <table id="ctl00_PlaceHolderMain_dlFields" cellspacing="0" border="0" style="border-collapse:collapse;"> <tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl00_lblDestinationField">Body</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl00$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl00_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl00$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl00_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr><tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl01_lblDestinationField">Expires</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl01$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl01_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl01$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl01_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr><tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl02_lblDestinationField">Title</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl02$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl02_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl02$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl02_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr> </table></div> The above Div tag is static, and the table is generated from a DataList object. On postback the datalist reloads using a new dataset, for example <div id="myList"> <table id="ctl00_PlaceHolderMain_dlFields" cellspacing="0" border="0" style="border-collapse:collapse;"> <tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl00_lblDestinationField">Notes</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl00$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl00_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl00$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl00_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr><tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl01_lblDestinationField">URL</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl01$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl01_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl01$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl01_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr> </table></div> After the postback and the datalist is reloaded, my JQuery doesn't work anymore. No errors, nothing. I don't see any actual changes in the objects in the HTML that should cause this. How do I fix this? Any workarounds or bandaides I can apply? My JQuery is below <script type='text/javascript'> $(document).ready(function () { $('#myList a').live("click", function () { var $selectValue = $(this).siblings('select').val(); var $thatInput = $(this).siblings('input'); var val = $thatInput.val() + ' |[' + $selectValue + ']|'; $thatInput.val(jQuery.trim(val)); }) }); </script> Thanks!!

    Read the article

  • Is it possible to creating a Service without starting it?

    - by ThaMe90
    Hello all, I wonder, is it possible to create a Service, set some data, and then start it? I haven't come across a thread specific to this problem, so I would like to know if it is possible (if it is known of course). My problem is that I have a Service which listens to a DatagramSocket, but the socket in question needs to be set after creation, but before the start of the Service. The setting of the socket happens through the use of a Broadcast (I broadcast 2 Strings which hold the IP-Address & Port and the BroadcastReceiver then constructs a socket for me). When the Service is started, a Thread will start to run and listen to the supposedly created socket. This, sadly, doesn't happen. The socket will remain null and I can't set it when the Thread is running (This is another issue I hope to tackle in the future, if anybody got any ideas about this, please notify me). So, is what I want possible, or should I come up with another construct for achieving this goal?

    Read the article

  • Silverlight MVVM Confusion: Updating Image Based on State

    - by senfo
    I'm developing a Silverlight application and I'm trying to stick to the MVVM principals, but I'm running into some problems changing the source of an image based on the state of a property in the ViewModel. For all intents and purposes, you can think of the functionality I'm implementing as a play/pause button for an audio app. When in the "Play" mode, IsActive is true in the ViewModel and the "Pause.png" image on the button should be displayed. When paused, IsActive is false in the ViewModel and "Play.png" is displayed on the button. Naturally, there are two additional images to handle when the mouse hovers over the button. I thought I could use a Style Trigger, but apparently they're not supported in Silverlight. I've been reviewing a forum post with a question similar to mine where it's suggested to use the VisualStateManager. While this might help with changing the image for hover/normal states, the part missing (or I'm not understanding) is how this would work with a state set via the view model. The post seems to apply only to events rather than properties of the view model. Having said that, I also haven't successfully completed the normal/hover affects, either. Below is my Silverlight 4 XAML. It should also probably be noted I'm working with MVVM Light. <UserControl x:Class="Foo.Bar.MyUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" mc:Ignorable="d" d:DesignHeight="100" d:DesignWidth="200"> <UserControl.Resources> <Style x:Key="MyButtonStyle" TargetType="Button"> <Setter Property="IsEnabled" Value="true"/> <Setter Property="IsTabStop" Value="true"/> <Setter Property="Background" Value="#FFA9A9A9"/> <Setter Property="Foreground" Value="#FF000000"/> <Setter Property="MinWidth" Value="5"/> <Setter Property="MinHeight" Value="5"/> <Setter Property="Margin" Value="0"/> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Cursor" Value="Hand"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid> <Image Source="/Foo.Bar;component/Resources/Icons/Bar/Play.png"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="Active"> <VisualState x:Name="MouseOver"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Source" Storyboard.TargetName="/Foo.Bar;component/Resources/Icons/Bar/Play_Hover.png" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Image> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <Button Style="{StaticResource MyButtonStyle}" Command="{Binding ChangeStatus}" Height="30" Width="30" /> </Grid> </UserControl> What is the proper way to update images on buttons with the state determined by the view model? Update I changed my Button to a ToggleButton hoping I could use the Checked state to differentiate between play/pause. I practically have it, but I ran into one additional problem. I need to account for two states at the same time. For example, Checked Normal/Hover and Unchecked Normal/Hover. Following is my updated XAML: <UserControl x:Class="Foo.Bar.MyUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" mc:Ignorable="d" d:DesignHeight="100" d:DesignWidth="200"> <UserControl.Resources> <Style x:Key="MyButtonStyle" TargetType="ToggleButton"> <Setter Property="IsEnabled" Value="true"/> <Setter Property="IsTabStop" Value="true"/> <Setter Property="Background" Value="#FFA9A9A9"/> <Setter Property="Foreground" Value="#FF000000"/> <Setter Property="MinWidth" Value="5"/> <Setter Property="MinHeight" Value="5"/> <Setter Property="Margin" Value="0"/> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Cursor" Value="Hand"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ToggleButton"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Pause"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Collapsed</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="MouseOver"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PlayHover"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Play"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Collapsed</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="CheckStates"> <VisualState x:Name="Checked"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Pause"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Play"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Collapsed</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PlayHover"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Collapsed</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Unchecked" /> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Image x:Name="Play" Source="/Foo.Bar;component/Resources/Icons/Bar/Play.png" /> <Image x:Name="Pause" Source="/Foo.Bar;component/Resources/Icons/Bar/Pause.png" Visibility="Collapsed" /> <Image x:Name="PlayHover" Source="/Foo.Bar;component/Resources/Icons/Bar/Play_Hover.png" Visibility="Collapsed" /> <Image x:Name="PauseHover" Source="/Foo.Bar;component/Resources/Icons/Bar/Pause_Hover.png" Visibility="Collapsed" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <ToggleButton Style="{StaticResource MyButtonStyle}" IsChecked="{Binding IsPlaying}" Command="{Binding ChangeStatus}" Height="30" Width="30" /> </Grid> </UserControl>

    Read the article

  • How to run lengthy tasks from an ASP.NET page?

    - by Jimmy C
    I've got an ASP.NET page with a simple form. The user fills out the form with some details, uploads a document, and some processing of the file then needs to happens on the server side. My question is - what's the best approach to handling the server side processing of the files? The processing involves calling an exe. Should I use seperate threads for this? Ideally I want the user to submit the form without the web page just hanging there while the processing takes place. I've tried this code but my task never runs on the server: Action<object> action = (object obj) => { // Create a .xdu file for this job string xduFile = launcher.CreateSingleJobBatchFile(LanguagePair, SourceFileLocation); // Launch the job launcher.ProcessJob(xduFile); }; Task job = new Task(action, "test"); job.Start(); Any suggestions are appreciated.

    Read the article

  • Connect to Oracle 11g using VS2010.net Drivers/Cleints

    - by StealthRT
    Hey all i am trying to redistribute my app that uses Oracle 11g: Imports Oracle.DataAccess.Client The problem i am having is that it will not run on a machine that doesnt seem to have the correct drivers that its looking for. When i install ODAC 11.2 Release 3 (11.2.0.2.1) with Oracle Developer Tools for Visual Studio on the test VM it works just fine but thats a 230+mb file to download and install! Not to mention that if the user already has Oracle 10/11g on their machine that it may mess up their current connections/etc by installing that setup file. Is there another setup package that i can install that only has the Oracle Data Provider for .NET 2.0 11.2.0.2.0 or whatever its needing from that ODAC 11.2 Release 3 file. So any help about what i need to go about fixing this problem would be great! :) Thanks, David

    Read the article

  • (Django) Trim whitespaces from charField

    - by zardon
    How do I strip whitespaces (trim) from the end of a charField in Django? Here is my Model, as you can see I've tried putting in clean methods but these never get run. I've also tried doing name.strip(), models.charField().strip() but these do not work either. Is there a way to force the charField to trim automatically for me? Thanks. class Employee(models.Model): """(Workers, Staff, etc)""" name = models.CharField(blank=True, null=True, max_length=100) # This never gets run def clean_variable(self): data = self.cleaned_data['variable'].strip() return data def __unicode__(self): return self.name class Meta: verbose_name_plural = 'Employees' # This never gets run either class EmployeesForm(forms.ModelForm): class Meta: model = Employee def clean_description(self): #if not self.cleaned_data['description'].strip(): # raise forms.ValidationError('Your error message here') self.cleaned_data['name'].strip()

    Read the article

  • Parser Error Debugging VS2008

    - by maatthias
    When I create new VS2008 asp.net application it builds fine. But when I start debugging I get below error in browser. I've rebuilt the app. The Inherits clause of the markup page matches the class in the code-behind C#. Any clues? Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'WebApplication3._Default'. Source Error: Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication3._Default" % Line 2: Line 3: Source File: /Default.aspx Line: 1 Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4927

    Read the article

  • Serious Memory Clash: Variables clashing in C

    - by Soham
    int main(int argc, char*argv[]) { Message* newMessage; Asset* Check; //manipulation and initialization of Check, so that it holds proper values. newMessage = parser("N,2376,01/02/2011 09:15:01.342,JPASSOCIAT FUTSTK 24FEB2011,B,84.05,2000,0,0",newMessage); // MessageProcess(newMessage,AssetMap); printf("LAST TRADE ADDRESS %p LAST TRADE TIME %s\n",Check->TradeBook,Check->Time); } Message* parser(char *message,Message* new_Message) { char a[9][256]; char* tmp =message; bool inQuote=0; int counter=0; int counter2=0; new_Message = (Message*)malloc(sizeof(Message)); while(*tmp!='\0') { switch(*tmp) { case ',': if(!inQuote) { a[counter][counter2]='\0'; counter++; counter2=0; } break; case '"': inQuote=!inQuote; break; default: a[counter][counter2]=*tmp; counter2++; break; } tmp++; } a[counter][counter2]='\0'; new_Message->type = *a[0]; new_Message->Time = &a[2][11]; new_Message->asset = a[3]; if(*a[4]=='S') new_Message->BS = 0; else new_Message->BS = 1; new_Message->price1=atof(a[5]); new_Message->shares1=atol(a[6]); new_Message->price2=atof(a[7]); new_Message->shares2=atol(a[8]); new_Message->idNum = atoi(a[1]); return(new_Message); } Here there is a serious memory clash, in two variables of different scope. I have investigated using gdb and it seems the address of new_Message->Time is equalling to the address of Check->Time. They both are structures of different types I am trying to resolve this issue, because, when parser changes the value of new_Message->Time it manipulates the contents of Check-Time Please do suggest how to solve this problem. I have lost(spent) around 10 hours and counting to resolve this issue, and tons of hair. Soham

    Read the article

  • Reflector – The King is Dead. Long Live the King.

    - by Sean Feldman
    There was enough of responses for Red Gate announcement about free version of .NET Reflector. Neither there’s a need to explain how useful the tool is for almost any .NET developer. There were a lot of talks about the price – $35 is it something to make noise about or just accept it and move on. Honestly, I couldn’t make my mind and was sitting on a fence. Today I learned some really exciting news – two (not one), two different initiatives to replace Reflector. A completely free ILSpy from SharpDevelop Commercial later to be stand-alone free decompiler tool from JetBrains These are great news. First – ILSpy is already doing what I need – you can download it and start using. Having experience with a few projects from SharpDevelop I believe it will be a great tool to have. One of immediate things that I found is reflecting obfuscated assemblies. Reflector blows up and closes, where ILSpy takes it gracefully and just shows an exception with no additional popup windows. JetBrains – company I highly respect. This is the case where I would continue paying money for their product and get more productivity. I am heavily relying on R# to do my job, and having a reflecting option would only add oil into fire of convincing others to use the tool. Though what I was excited was the statement JetBrains boldly put out: …it’s going to be released this year, and it’s going to be free of charge. And by saying “free”, we actually mean “free”.

    Read the article

  • AppHarbor - Azure Done Right AKA Heroku for .NET

    - by Robz / Fervent Coder
    Easy and Instant deployments and instant scale for .NET? Awhile back a few of us were looking at Ruby Gems as the answer to package management for .NET. The gems platform supported the concept of DLLs as packages although some changes would have needed to happen to have long term use for the entire community. From that we formed a partnership with some folks at Microsoft to make v2 into something that would meet wider adoption across the community, which people now call NuGet. So now we have the concept of package management. What comes next? Heroku Instant deployments and instant scaling. Stupid simple API. This is Heroku. It doesn’t sound like much, but when you think of how fast you can go from an idea to having someone else tinker with it, you can start to see its power. In literally seconds you can be looking at your rails application deployed and online. Then when you are ready to scale, you can do that. This is power. Some may call this “cloud-computing” or PaaS (Platform as a Service). I first ran into Heroku back in July when I met Nick of RubyGems.org. At the time there was no alternative in the .NET-o-sphere. I don’t count Windows Azure, mostly because it is not simple and I don’t believe there is a free version. Heroku itself would not lend itself well to .NET due to the nature of platforms and each language’s specific needs (solution stack).  So I tucked the idea in the back of my head and moved on. AppHarbor Enters The Scene I’m not sure when I first heard about AppHarbor as a possible .NET version of Heroku. It may have been in November, but I didn’t actually try it until January. I was instantly hooked. AppHarbor is awesome! It still has a ways to go to be considered Heroku for .NET, but it already has a growing community. I created a video series (at the bottom of this post) that really highlights how fast you can get a product onto the web and really shows the power and simplicity of AppHarbor. Deploying is as simple as a git/hg push to appharbor. From there they build your code, run any unit tests you have and deploy it if everything succeeds. The screen on the right shows a simple and elegant UI to getting things done. The folks at AppHarbor graciously gave me a limited number of invites to hand out. If you are itching to try AppHarbor then navigate to: https://appharbor.com/account/new?inviteCode=ferventcoder  After playing with it, send feedback if you want more features. Go vote up two features I want that will make it more like Heroku. Disclaimer: I am in no way affiliated with AppHarbor and have not received any funds or favors from anyone at AppHarbor. I just think it is awesome and I want others to know about it. From Zero To Deployed in 15 Minutes (Or Less) Now I have a challenge for you. I created a video series showing how fast I could go from nothing to a deployed application. It could have been from Zero to Deployed in Less than 5 minutes, but I wanted to show you the tools a little more and give you an opportunity to beat my time. And that’s the challenge. Beat my time and show it in a video response. The video series is below (at least one of the videos has to be watched on YouTube). The person with the best time by March 15th @ 11:59PM CST will receive a prize. Ground rules: .NET Application with a valid database connection Start from Zero Deployed with AppHarbor or an alternative A timer displayed in the video that runs during the entire process Video response published on YouTube or acceptable alternative Video(s) must be published by March 15th at 11:59PM CST. Either post the link here as a comment or on YouTube as a response (also by 11:59PM CST March 15th) From Zero To Deployed In 15 Minutes (Or Less) Part 1 From Zero To Deployed In 15 Minutes (Or Less) Part 2 From Zero To Deployed In 15 Minutes (Or Less) Part 3

    Read the article

  • Is IE9 a modern browser?

    - by TATWORTH
    At http://people.mozilla.com/~prouget/ie9/ there is a very provocative article entitled "Is IE9 a modern browser?". There is a rebuttal by Tim Sneath at http://blogs.msdn.com/b/tims/archive/2011/02/15/a-modern-browser.aspx that is well worth a look. Certainly IE9 is already superior to its predecessors. My comment on the matter is that those that consider IE9 to be non-standards compliant, should submit tests to the W3C to demonstrate the non-compliance. Upon acceptance by the W3C, all the competing browsers can then be re-tested. I prefer objective tests to subjective opinion. I have used IE9 and on some sites such as Hotmail, it is noticeably faster. I have so far been unable to apply the promised IE9 lockout of spyware cookies. With Firefox, I just instal NoScript and never enable spyware sites.

    Read the article

  • Building on someone else's DefaultButton Silverlight work...

    - by KyleBurns
    This week I was handed a "simple" requirement - have a search screen execute its search when the user pressed the Enter key instead of having to move hands from keyboard to mouse and click Search.  That is a reasonable request that has been met for years both in Windows and Web apps.  I did a quick scan for code to pilfer and found Patrick Cauldwell's Blog posting "A 'Default Button' In Silverlight".  This posting was a great start and I'm glad that the basic work had been done for me, but I ran into one issue - when using bound textboxes (I'm a die-hard MVVM enthusiast when it comes to Silverlight development), the search was being executed before the textbox I was in when the Enter key was pressed updated its bindings.  With a little bit of reflection work, I think I have found a good generic solution that builds upon Patrick's to make it more binding-friendly.  Also, I wanted to set the DefaultButton at a higher level than on each TextBox (or other control for that matter), so the use of mine is intended to be set somewhere such as the LayoutRoot or other high level control and will apply to all controls beneath it in the control tree.  I haven't tested this on controls that treat the Enter key special themselves in the mix. The real change from Patrick's solution here is that in the KeyUp event, I grab the source of the KeyUp event (in my case the textbox containing search criteria) and loop through the static fields on the element's type looking for DependencyProperty instances.  When I find a DependencyProperty, I grab the value and query for bindings.  Each time I find a binding, UpdateSource is called to make sure anything bound to any property of the field has the opportunity to update before the action represented by the DefaultButton is executed. Here's the code: public class DefaultButtonService { public static DependencyProperty DefaultButtonProperty = DependencyProperty.RegisterAttached("DefaultButton", typeof (Button), typeof (DefaultButtonService), new PropertyMetadata (null, DefaultButtonChanged)); private static void DefaultButtonChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var uiElement = d as UIElement; var button = e.NewValue as Button; if (uiElement != null && button != null) { uiElement.KeyUp += (sender, arg) => { if (arg.Key == Key.Enter) { var element = arg.OriginalSource as FrameworkElement; if (element != null) { UpdateBindings(element); } if (button.IsEnabled) { button.Focus(); var peer = new ButtonAutomationPeer(button); var invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; if (invokeProv != null) invokeProv.Invoke(); arg.Handled = true; } } }; } } public static DefaultButtonService GetDefaultButton(UIElement obj) { return (DefaultButtonService) obj.GetValue(DefaultButtonProperty); } public static void SetDefaultButton(DependencyObject obj, DefaultButtonService button) { obj.SetValue(DefaultButtonProperty, button); } public static void UpdateBindings(FrameworkElement element) { element.GetType().GetFields(BindingFlags.Public | BindingFlags.Static).ForEach(field => { if (field.FieldType.IsAssignableFrom(typeof(DependencyProperty))) { try { var dp = field.GetValue(null) as DependencyProperty; if (dp != null) { var binding = element.GetBindingExpression(dp); if (binding != null) { binding.UpdateSource(); } } } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { // swallow exceptions } } }); } }

    Read the article

  • Share USB devices between 32 bit and 64 bit systems

    - by Sreejith S
    The latest version of USBDeviceShare, the USB over IP software, supports sharing USB devices between 32 bit and 64 bit editions of Windows. A USB device plugged in to a 64 bit PC running 64 bit version of Windows can be shared and remotely accessed from a 32 bit PC and vice versa. Download USBDeviceShare USB over Network software from http://www.sysnucleus.com/usbshare/usbshare_download.html Keywords : USB over Ethernet, USB Server, Remote USB Access, Share USB

    Read the article

  • Need advice in setting up server. fastCGI, suExec, speed, security, etc.

    - by lewisqic
    I am running my own dedicated server with centOS 5 and WHM/cPanel. I would like to configure my server to meet my needs but I need a little help. It will only be my own websites being run on this server. I'm still a little green when it comes to server administration so please forgive my ignorance. What I Would Like to Have: I need some public directories to be writable (for user image uploads and things like that) but I don't want those directories to have 777 permissions. I need individual accounts to have the ability to set custom php settings for their own account without affecting other accounts, whether through a php.ini file or through .htaccess or any other method. I would like things to run as fast as possible, whether that means using a php optimizer or cacher, such as eaccelerator or xcache or anything else. I need things to be as secure as possible. Here Are My Questions What should I use for my php handler? DSO? CGI? fastCGI? suPHP? Other? Should I be using suEXEC? What are the benefits or downfalls of this? What php optimizer/cacher is best to use? Are there any other security tips I need to know about all of this? I'd appreciate any advice or direction that can be offered. Thanks!

    Read the article

  • How can I connect to AS/400 through TN5250?

    - by Swati Sarkar
    How will I find out my iseries server name? I checked through "nslookup" it gives one ip address & I tried to connect TN5250 session to cconnect but could not connect. from dos command line c:\nslookup default server : unknown ip address : 192.168.50.119 Then I tried ping with this IP address - it's giving reply from the above IP address Then I have given this id in TN5250 session, but says can not create a connection to the AS/400.

    Read the article

  • Wyse Simple Imager. Unable to Create Product Directory

    - by Steve
    I am trying to submit a post on www.technicalhelp.de, but I receive an error: Invalid Session. Please resubmit the form. This happens if I delete temporary internet files and log out and back in, and if I use a different browser, and if I use a proxy browser. Perhaps someone on this forum can help I am trying to push a Wyse device image to a USB thumb drive. The image is on a remote server, and the thumb drive is connected to my desktop PC. I am using Wyse Simple Imager to do this. When I select the following: Product: V90 Image Version: 5.010627.512 Image File: \servername\folder\OLD_Rapport\V90-withusb\9V90.i2d Almost instantly, without attempting any action, I receive the message: WyseImager Unable to Create Product Directory. Add Image Failed I have completely formatted the USB drive with FAT32. It is new out of the fox, and I can create folders in it. How do I fix this?

    Read the article

  • Centos/MySQL Server Tweaking

    - by josephs8
    If I wanted a professional to like tweak my server where would I go about finding someone that does this? I have a web server that gets a lot of traffic and Im learning all about managing web servers, but before my traffic gets out of hand I want the server tweaked up. I already have some high load issues so I wanted to see if they could help with that. Then I would continue my learning on my own. Thank You

    Read the article

  • Do all domains on the same shared hosting server have the same IP or ID

    - by silow
    Here's what I've got: siteA.com and siteB.com are hosted on hostgator. They're hosted on the same account of a shared hosting server (not VPS or dedicated). script.php is an external site that each of these 2 sites are accessing. I noticed that when siteA.com or siteB.com access the outside script.php, the script identifies them both as 1a.12.12ab.static.theplanet.com (apparently because hostgator uses theplanet.com servers). The fact that they're identified as the same value isn't surprising because after all they're hosted on the same account /home/user123/public_html. What I'm wondering about is how about other websites that are hosted on the same shared hosting server, but under other accounts. Basically other websites that are under another developer's control, but just happen to share the same hardware (hosting server). Do they also have the exact same identifier 1a.12.12ab.static.theplanet.com or that changes by account?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >