Daily Archives

Articles indexed Friday April 23 2010

Page 30/115 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • How to validate the following

    - by user281180
    I have the following code <% using(Ajax.BeginForm("UpdatePassword", new AjaxOptions{UpdateTargetId="Password"})) { %> <div id="Password"> <table> <tr> <td>New password</td><td><%=Html.Password("newPassword") %></td> </tr> <tr> <td>Confirm new password</td> <td><%=Html.Password("confirmPassword")%><%= Html.ValidationMessage("confirmPassword") %> </td> </tr> </table> <% } % Can someone help me how to proceed to validating that the confirmPassword is equal the new password, and if not the message is displayed in the html.validationMessage()...

    Read the article

  • Background custom button animation using WPF

    - by ajtp
    Hi, I am using Resources dictionaries to customize my controls and apply them as themes to my WPF application so I have implemented one for the button control. A code snippet for my custom Button.xaml is (its namespace is MyWPFApp.Themes): <ResourceDictionary ...> ... <LinearGradientBrush x:Key="NormalBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="sc#1.000000, 0.250141, 0.333404, 0.884413" Offset="0"/> <GradientStop Color="#ccffffff" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="OverBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#da5e69" Offset="0"/> <GradientStop Color="#d12e27" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="ClickBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#d22828" Offset="1"/> <GradientStop Color="#b00000" Offset="0"/> </LinearGradientBrush> ... <Style TargetType="{x:Type Button}"> ... <Setter Property="Background" Value="{StaticResource NormalBackground}"/> ... </Style> </ResourceDictionary> and I apply it by doing the following from my main Application.xaml: <Application ...> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Themes/Button.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> What I try to do is to change background color, for example, from White to Lime for 6 seconds by doing this from one of my pages, MyPage1.xaml, using StoryBoard: <Page x:Class="MyWPFApp.Pages.MyPage1" ...> <Page.Resources> ... <Storyboard x:Key="sbBtnResetHC" Storyboard.TargetName="BtnResetHC" Storyboard.TargetProperty="(Background). (SolidColorBrush.Color)"> <ColorAnimation From="Pink" To="Green" By="Blue" Duration="0:0:6" RepeatBehavior="3x" AutoReverse="True" /> </Storyboard> ... </Page.Resources> ... <Button x:Name="BtnResetHC" Click="BtnResetHC_Click" Width="90" Visibility="Collapsed" /> ... </Page> and from code behind MyPage1.xaml.cs I start animation by doing this: Storyboard sb = (Storyboard)FindResource("sbBtnResetHC"); sb.Begin(); when the button is visible, but it doesn't work for me. Any ideas what's wrong? Maybe another possibility, as I want the animation starts on button visible is to do a trigger for the button over Visibility property, Is it a better solution? Thanks a lot!

    Read the article

  • Image depending on the text in Python/Django

    - by PyOut
    Hello, How can I find an image, depending on the text? I have image model with keywords: class Post(models.Model): image = ImageField(_('Image'), blank=True, upload_to='folder') keywords = models.CharField(_('Keywords'), max_length=80) And model which will serve as the search for a suitable image class TextSearch(models.Model): body = models.TextField(_('Text'))

    Read the article

  • Get textboxes in to a list! c#

    - by Chelsea_cole
    public class Account { public string Username { get { return Username; } set { Username = value; } } } public class ListAcc { static void Data() { List<Account> UserList = new List<Account>(); //example of adding user account Account acc = new Account(); acc.Username = textBox1.Text; //error UserList.Add(acc); } } there are a error from access to textBox1.Text? ( An object reference is required for the nonstatic field, method, or property)... Someone can help? but if the code is: private void textBox1_TextChanged(object sender, EventArgs e) { List<Account> UserList = new List<Account>(); //example of adding user account Account acc = new Account(); acc.Username = textBox1.Text; UserList.Add(acc); } it's work! someone can help me fix my error? Many thanks!

    Read the article

  • print_any for F# 2.0

    - by user79339
    Hi, I am upgrading an old version 1.0 F# project to 2.0 using visual studio 2010. So many changes. I can't seem to find the print_any command that was littered all over the place in the old books and samples. I have installed powerpack but can't find it there either. Any idea where i can find this command. PS: I know I can easily implement it myself but was curious where this is now.

    Read the article

  • CSS - Can't get the z-index to apply correctly in Internet Explorer

    - by peaki
    I've written a jQuery script to replace <select /> elements with some DIV's and UL's allowing my to simulate the original SELECT but also allow me to style it. So far, aside from a few minor bugs, it works rather nicely. However, in Internet Explorer, the 'options' div is getting rendered underneath the elements below the div. Here's the HTML: <div class="styledSelect-parent" style="display: inline-block; width: 59px;"> <div class="styledSelect-newSelect" style="position: relative;"> <input class="styledSelect-newSelect-selector" style="width: 59px;" readonly="readonly" name="hello" value="Test1" type="text"> <div class="styledSelect-newSelect-options" style="display: none; z-index: 20; width: 59px; position: absolute; left: 0px; top: 18px;"> <ul> <li>Test1</li> <li>Test2</li> <li>Test3</li> <li class="styledSelect-active">Test4</li> <li>Test1</li> <li>Test2</li> </ul> </div> </div> </div> <br /><br /> <div class="styledSelect-parent" style="display: inline-block; width: 59px;"> <div class="styledSelect-newSelect" style="position: relative;"> <input class="styledSelect-newSelect-selector" style="width: 59px;" readonly="readonly" name="hello" value="Test1" type="text"> <div class="styledSelect-newSelect-options" style="display: none; z-index: 20; width: 59px; position: absolute; left: 0px; top: 18px;"> <ul> <li class="styledSelect-active">Test1</li> <li>Test2</li> <li>Test3</li> </ul> </div> </div> </div> If I open the first select, the LI list sits underneath the second select box rather than above it. I can't get the z-indexes to work properly. What am I missing? :/

    Read the article

  • Are monads Writer m and Either e categorically dual?

    - by sdcvvc
    I noticed there is a dual relation between Writer m and Either e monads. If m is a monoid, then unit :: () -> m join :: (m,m) -> m can be used to form a monad: return is composition: a -> ((),a) -> (m,a) join is composition: (m,(m,a)) -> ((m,m),a) -> (m,a) The dual of () is Void (empty type), the dual of product is coproduct. Every type e can be given "comonoid" structure: unit :: Void -> e join :: Either e e -> e in the obvious way. Now, return is composition: a -> Either Void a -> Either e a join is composition: Either e (Either e a) -> Either (Either e e) a -> Either e a and this is the Either e monad. The arrows follow exactly the same pattern. Question: Is it possible to write a single generic code that will be able to perform both as Either e and as Writer m depending on the monoid given?

    Read the article

  • From AutoComplete textbox to database search and display?

    - by svebee
    Hello everyone, I have a small problem so I would be grateful if anyone could help me in any way. Thank you ;) I have this little "application", and I want when someone type in a AutoComplete textbox for example "New" it automatically displays "New York" as a option and that (AutoComplete function) works fine. But I want when user type in full location (or AutoComplete do it for him) - that text (location) input is forwarded to a database search which then searches through database and "collects" all rows with user-typed location. For example if user typed in "New York", database search would find all rows with "New York" in it. When it finds one/more row(s) it would display them below. In images... I have this when user is typing... http://www.imagesforme.com/show.php/1093305_SNAG0000.jpg I have this when user choose a AutoComplete location (h)ttp://www.imagesforme.com/show.php/1093306_SNAG0001.jpg (remove () on the beggining) But I wanna this when user choose a AutoComplete location (h)ttp://www.imagesforme.com/show.php/1093307_CopyofSNAG0001.jpg (remove () on the beggining) Complete Code package com.svebee.prijevoz; import android.app.Activity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.TextView; public class ZelimDoci extends Activity { TextView lista; static final String[] STANICE = new String[] { "New York", "Chicago", "Dallas", "Los Angeles" }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.zelimdoci); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_country); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, STANICE); textView.setAdapter(adapter); lista = (TextView)findViewById(R.id.lista); SQLiteDatabase myDB= null; String TableName = "Database"; String Data=""; /* Create a Database. */ try { myDB = this.openOrCreateDatabase("Database", MODE_PRIVATE, null); /* Create a Table in the Database. */ myDB.execSQL("CREATE TABLE IF NOT EXISTS " + TableName + " (Field1 INT(3) UNIQUE, Field2 INT(3) UNIQUE, Field3 VARCHAR UNIQUE, Field4 VARCHAR UNIQUE);"); Cursor a = myDB.rawQuery("SELECT * FROM Database where Field1 == 1", null); a.moveToFirst(); if (a == null) { /* Insert data to a Table*/ myDB.execSQL("INSERT INTO " + TableName + " (Field1, Field2, Field3, Field4)" + " VALUES (1, 119, 'New York', 'Dallas');"); myDB.execSQL("INSERT INTO " + TableName + " (Field1, Field2, Field3, Field4)" + " VALUES (9, 587, 'California', 'New York');"); } myDB.execSQL("INSERT INTO " + TableName + " (Field1, Field2, Field3, Field4)" + " VALUES (87, 57, 'Canada', 'London');"); } /*retrieve data from database */ Cursor c = myDB.rawQuery("SELECT * FROM " + TableName , null); int Column1 = c.getColumnIndex("Field1"); int Column2 = c.getColumnIndex("Field2"); int Column3 = c.getColumnIndex("Field3"); int Column4 = c.getColumnIndex("Field4"); // Check if our result was valid. c.moveToFirst(); if (c != null) { // Loop through all Results do { String LocationA = c.getString(Column3); String LocationB = c.getString(Column4); int Id = c.getInt(Column1); int Linija = c.getInt(Column2); Data =Data +Id+" | "+Linija+" | "+LocationA+"-"+LocationB+"\n"; }while(c.moveToNext()); } lista.setText(String.valueOf(Data)); } catch(Exception e) { Log.e("Error", "Error", e); } finally { if (myDB != null) myDB.close(); } } } .xml file <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20sp" android:gravity="center_horizontal" android:padding="10sp" android:text="Test AutoComplete"/> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="AutoComplete" /> <AutoCompleteTextView android:id="@+id/autocomplete_country" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp"/> </LinearLayout> </LinearLayout>

    Read the article

  • How to duplicate all data in a table except for a single column that should be changed.

    - by twiga
    I have a question regarding a unified insert query against tables with different data structures (Oracle). Let me elaborate with an example: tb_customers ( id NUMBER(3), name VARCHAR2(40), archive_id NUMBER(3) ) tb_suppliers ( id NUMBER(3), name VARCHAR2(40), contact VARCHAR2(40), xxx, xxx, archive_id NUMBER(3) ) The only column that is present in all tables is [archive_id]. The plan is to create a new archive of the dataset by copying (duplicating) all records to a different database partition and incrementing the archive_id for those records accordingly. [archive_id] is always part of the primary key. My problem is with select statements to do the actual duplication of the data. Because the columns are variable, I am struggling to come up with a unified select statement that will copy the data and update the archive_id. One solution (that works), is to iterate over all the tables in a stored procedure and do a: CREATE TABLE temp as (SELECT * from ORIGINAL_TABLE); UPDATE temp SET archive_id=something; INSERT INTO temp (select * from temp); DROP TABLE temp; I do not like this solution very much as the DDL commands muck up all restore points. Does anyone else have any solution?

    Read the article

  • I want a machine to learn to categorize short texts

    - by Jasie
    Hello, I have a ton of short stories about 500 words long and I want to categorize them into one of, let's say, 20 categories: Entertainment Food Music etc I can hand-classify a bunch of them, but I want to implement machine learning to guess the categories eventually. What's the best way to approach this? Is there a standard approach to machine learning I should be using? I don't think a decision tree would work well since it's text data...I'm completely new in this field. Any help would be appreciated, thanks!

    Read the article

  • FTP in DMZ, TCP Ports for LDAP Auth

    - by sam
    szenario: (outside)---(ASA5510)---(inside) -Windows2008 DC .....................(dmz) ..........-Win2008 FTP Server Which Ports do I need to open from DMZ-Inside that FTP Users can authentificated on the Inside DC? I have allready opend 389 (Ldap), 636 (secure Ldap) and 53 (dns). But the ftp Client stucks allways after processing the credentials and the FTP Server gives you an eventlog "logon error". the error messages indicates that there could be an issue with closed ports. if I turn the ACL to "IP", that means all ports are open, everything is working fine.

    Read the article

  • Windows 7 64bit keyboard issues

    - by Scott
    I have a Pavilion dv4 notebook running Windows 7 64bit Enterprise edition. This morning I started to notice some really strange behavior in how it handled its built-in keyboard. At random intervals there will be a long delay in key presses, to which some keys will never show and other keys will continue to repeat until you hit the backspace. Other keys get mapped incorrectly to other keys. If I hook up an external keyboard the problem does not appear. Before I reformat the machine and do a fresh install, I thought I would check here to see if anyone has experienced this same issue and if so, how did you fix it?

    Read the article

  • git noob : why does "git push origin master" fail to github ?

    - by anjanb
    hi there, Here are the steps I took. I created a repository on github and generated a rails project on my windows vista home premium (which has msys git 1.7.0.2). 3) I then committed the generated files 4) g it remote add origin [email protected]:anjanb/Jobs2Go.git git push origin master On the 5th step, I get the following error. "Permission denied (publickey). fatal: The remote end hung up unexpectedly" I vaguely remember following some sshgen steps I took when I created my 1st github repository but I have forgotten what it was. Can someone point me what I did wrong, what I need to do right. Thank you,

    Read the article

  • Google App Engine - How to implement the activity stream in a social network

    - by spidee
    I want some ideas on the best practice to implement an activity stream for a social network im building in app engine (PYTHON) I first want to keep a log for all activities of each user - so that we have a history. i.e. someone became a friend, added a picture, changed their address etc. This way we have a users history available should we need it. Also mean we can remove friendship joins, change user data but have a historical log. I also want to stream a users activity to their friends. for this only the last X activities need to be kept - that is in the scenario that messages are sent to friends when an activity occurs. Its pretty straight forward designing a history log - ie: when, what, where. The complication comes as to how we notify friends of a user as to their activity. In our app friendships are not mutual - ie they are based on the twitter following model. Some accounts could have thousands of followers. What is the best approach to model this. using a many to many join table and doing a costly query - using a feed class that fired a copy of the activity to all the subscribers - maybe into mcache? As their maybe a need to fire thousands of messages i would imagine a cron job would need to be used. Any help ideas thoughts on this Thx

    Read the article

  • mysql split value from one field to two

    - by tsiger
    Hello, I 've got a table field (membername) which contains both the last name and the first name of users. Is it possible to split those into 2 fields (memberfirst - memberlast)? All the records have this format "Firstname Lastname" (without quotes and a space in between).

    Read the article

  • When should I use Yield in c#?

    - by Steve
    I have a vage understanding of the Yield keyword in c#, but I haven't yet seen the need to use it in my code. This probably comes from a lack of understanding of it.. So; What are some typical good usages of Yield?

    Read the article

  • Server.Transfer - What could be the issue here?

    - by Younes
    We have implemented a website with the ability for the user to post his actioncode. This then will be checked by the code and when the user has a price the website will Server.Transfer him to another page. The strange thing here is that the user information will be submitted to the database and the actioncode can't be used again. Here we go... I have one user in this database that is inserted twice very fast after the first time he was added. This are the timestamps: 2010-04-23 07:54:41.133 2010-04-23 07:54:41.417 The insert statement is only called once from the code and the user gets Server.Transfered to the Price.aspx page where he sees what price he won. How can it be that this happened? I'm guessing the user hitted F5 but then he had to be very very fast... Thx!

    Read the article

  • Problem restoring a SQL Server backup

    - by Elmex
    I have a SQL Server 2008, which is part of a domain. Now I make a backup of a database of this server and restore it on a SQL Server, which is not part of a domain. I have an C# application, which uses this database. On the NON-Domain machine I get now exceptions like this: "Cannot execute as the database prinzipal because the principial "dbo" does not exist, this type of principal cannot be impersonatedm or you don not have the permission" I think, the problem is, that the database owner is a domain user and this user doesn't exist on the target machine (backup machine)!? How can I solve this ?

    Read the article

  • Do I want an embedded web-server, or what?

    - by mawg
    So, someone want me to hack some code for him. He has a 42" TFT display on which he will display some application/business related data. However, 75% of the screen real estate is unused, so he wants to fill it with "TV/adverts/flash/you know, that kind of thing... web based....". Any advice? Do I want an embedded web-server? If so, which? (he wants free & open source, or as cheap as possible) Do I display it in a browser? (duh! probably, dude) But I don't want/need a menu, address bar, toolbar, etc - it should be full screen (does that mean "kiosk mode"?). Sorry, folks, the requirements are not clear, but I hope that you can guess what he probably means (he is not very techie). How should I proceed with this? Thanks.

    Read the article

  • Calling a method on an unitialized object (null pointer)

    - by Florin
    What is the normal behavior in Objective-C if you call a method on an object (pointer) that is nil (maybe because someone forgot to initialize it)? Shouldn't it generate some kind of an error (segmentation fault, null pointer exception...)? If this is normal behavior, is there a way of changing this behavior (by configuring the compiler) so that the program raises some kind of error / exception at runtime? To make it more clear what I am talking about, here's an example. Having this class: @interface Person : NSObject { NSString *name; } @property (nonatomic, retain) NSString *name; - (void)sayHi; @end with this implementation: @implementation Person @synthesize name; - (void)dealloc { [name release]; [super dealloc]; } - (void)sayHi { NSLog(@"Hello"); NSLog(@"My name is %@.", name); } @end Somewhere in the program I do this: Person *person = nil; //person = [[Person alloc] init]; // let's say I comment this line person.name = @"Mike"; // shouldn't I get an error here? [person sayHi]; // and here [person release]; // and here

    Read the article

  • How to Open Local File in AS3?

    - by Sean
    Hi, i have some code that looks like this function main9Click(event:MouseEvent):void { var main9URL:URLRequest = new URLRequest("N:\ICT\Nationals\Unit 2\Pages\Cars"); navigateToURL(main9URL, "_self"); } mainBtn6.addEventListener(MouseEvent.CLICK, main9Click); I need to make it open so when you click on that button it opens the file Cheers Sean

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >