Search Results

Search found 21356 results on 855 pages for 'check digit'.

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

  • ASP.Net - How do I allow users to enter html tags in textbox without runtime errors?

    - by Coder
    I have an input textbox on an asp.net page and when a user inputs any tags like break tags or bold an error occurs. I currently am using the following to encode the input: Server.HtmlEncode(mytextbox.Text) However this only encodes characters when they aren't phrased as an html tag, like if the input is "<<<" is there a way for me to allow the user to put the tags in without it leading to a runtime error? Thanks.

    Read the article

  • How to check volume is mounted or not using python with a dynamic volume name

    - by SR query
    import subprocess def volumeCheck(volume_name): """This function will check volume name is mounted or not. """ volume_name = raw_input('Enter volume name:') volumeCheck(volume_name) print 'volume_name=',volume_name p = subprocess.Popen(['df', '-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) p1, err = p.communicate() pattern = p1 if pattern.find(volume_name): print 'volume found' else: print 'volume not found' While running i always got wrong result "volume found". root@sr-query:/# df -h Filesystem Size Used Avail Use% Mounted on rootfs 938M 473M 418M 54% / /dev/md0 938M 473M 418M 54% / none 250M 4.9M 245M 2% /dev /dev/md2 9.7M 1.2M 8.0M 13% /usr/config /dev/md7 961M 18M 895M 2% /downloads tmpfs 250M 7.9M 242M 4% /var/volatile tmpfs 250M 0 250M 0% /dev/shm tmpfs 250M 0 250M 0% /media/ram **/dev/mapper/vg9-lv9 1016M 65M 901M 7% /VolumeData/sp /dev/mapper/vg10-lv10 1016M 65M 901M 7% /VolumeData/cp** root@sr-query:/# root@sr-query:/# root@sr-query:/# python volume_check.py Enter volume name:raid_10volume volume_name= raid_10volume **volume found** root@sr-query:/# I enterd raid_10volume its not listed here please check the df -h command out put(only 2 volume there sp and cp) , then how it reached else part. what is wrong in my code? Thanks in advance. is there any other way to do this work ! ?

    Read the article

  • Calling a network State check from other activities

    - by Laurent
    I realize this question has been answered before but couldn't find an answer that deals with my specific case. I want to create a class called "InternetConnectionChecks" that will handle checking a network state and http timeouts. I'll call the methods twice in the app (once at the beginning to get data from a server, and once at the end to send user orders to the server). For good form I'd like to put all these methods in a single class rather than copy/paste at different points in my code. To check the network state, I'm using ConnectivityManager; thing is, getSystemService requires a class that extends Activity. package arbuckle.app; import android.app.Activity; import android.app.Service; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class InternetConnectionChecks extends Activity { public boolean isNetworkAvailable(){ ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); if ((activeNetworkInfo != null)&&(activeNetworkInfo.isConnected())){ return true; }else{ return false; } } } QUESTION: if I call the method isNetworkAvailable from another activity, am I: - going to hit up serious errors. - violating good coding form? *If this isn't the right way to do things, can you point me in the right direction to set up a separate class I can call on to check internet connection? Thanks everyone!

    Read the article

  • Relating text fields to check boxes in Java

    - by Finzz
    This program requires the user to login and request a database to access. The program then gets a connection object, searches through the database storing the column names into a vector for later use. The problem comes with implementing text fields to allow the user to search for specific values within the database. I can get the check boxes and text fields to appear using a gridlayout and add them to a panel. How do I relate the text fields to their appropriate check box? I've tried adding them to a vector, but then they can't also be added to the panel as well. I've searched for a way to name the text fields as the loop cycles through the column names, but it seems impossible to do without having them declared ahead of time. This can't be done either, as it's impossible to determine the attributes that the user will request. I just need to be able to know the names of the text fields so I can test to see if the user entered information and perform the necessary logic. Let me know if you have to see the rest of the code to give an answer, but hopefully you get the general idea of what I'm trying to accomplish. Picture of UI: try { ResultSet r2 = con.getMetaData().getColumns("", "", rb.getText(), ""); colNames1 = new Vector<String>(); columns1 = new Vector<JCheckBox>(); while (r2.next()) { colNames1.add(r2.getString(4)); JCheckBox cb = new JCheckBox(r2.getString(4)); JTextField tf = new JTextField(10); columns1.add(cb); p3.add(cb); p3.add(tf); } }

    Read the article

  • Cant get JavaScipt to check for null objects

    - by CountMurphy
    I really don't know what the issue is here. Far as I can see, the code is simple and should work fine. var Prices=""; for (var PriceCount = 1; PriceCount <= 120; PriceCount++) { var CurrentPrice = "Price" + PriceCount; if (prevDoc.getElementById(CurrentPrice).value != null) { if (Prices == "") { Prices = prevDoc.getElementById(CurrentPrice).value; } else { Prices += "," + prevDoc.getElementById(CurrentPrice).value; } } else { break; } } There could be up to 120 hidden inputs on the form. The moment we check for an input that doesn't exist the loop should break. My test page has two input elements that get pulled. On the third (the null) I get this error in firebug: prevDoc.getElementById(CurrentPrice) is null if (prevDoc.getElementById(CurrentPrice).value != null) { Yes it is null...that's what the check is for ?_? Does any one know what I'm doing wrong? This seems like it should be really straight forward. EDIT: for clarity's sake, prevDoc=window.opener.document

    Read the article

  • Prolog, check if term is power of 2

    - by Riku
    i have written following code, which should work with my logic, but it does not. I should check if given term is power of two. For example s(s(s(nul))) should return false, s(s(s(s(nul))) should return true. substractWhileY(X,0,rezult). substractWhileY(s(X),Y,rezult):- Y > 0, number is 1, substractWhileY(X,Y - number, rezult). degreeOftwo(X):- substractWhileY(X,2,rezult), pagalba(X, 2, rezult). calculateAnswer(X, currentCounter, currentValue):- currentCounter is currentCounter * 2, substractWhileY(currentValue, currentCounter , rezult), rezult\= null, calculateAnswer(X, currentCounter , rezult). My idea was to check if given therm is degree of any two and if it is not than it is not the degree of two. With numbers it should work like this. For example i give number 8. First time it checks if 8 - 2 = 0. second time if 8 - 4 = 0. third time if 8 - 8 = 0. so the 8 id power of two. Maybe other solution would work better, so thanks for any help.

    Read the article

  • zend form check record no exists in database

    - by Yafa Su
    I have a form that check if email exists in the database within 2 tables. I'm using Zend_Validate_Db_NoRecordExists for both validate, but it only check the second one. Any idea why it's not working? class Application_Form_ReferUser extends Zend_Form { public $email, $freeDownload, $buyNow; public function init() { $this->setName('referUser'); $EmailExists = new Zend_Validate_Db_NoRecordExists( array( 'table' => 'referrals', 'field' => 'email' ) ); $EmailExists2 = new Zend_Validate_Db_NoRecordExists( array( 'table' => 'users', 'field' => 'email' ) ); $EmailExists->setMessage('This e-mail is already taken'); $EmailExists2->setMessage('This e-mail is already taken'); $this->email = $this->createElement('text', 'email') ->setLabel('Email') ->addValidator($EmailExists) ->addValidator($EmailExists2) ->addValidator('EmailAddress') ->setRequired(true); $this->freeDownload = $this->createElement('button', 'btn_free_download') ->setLabel('Free Download') ->setAttrib('type', 'submit'); $this->buyNow = $this->createElement('button', 'btn_buy_now') ->setLabel('Buy Now') ->setAttrib('type', 'submit'); $this->addElements(array($this->email, $this->freeDownload, $this->buyNow)); $elementDecorators = array( 'ViewHelper' ); $this->setElementDecorators($elementDecorators); } }

    Read the article

  • comparing int values in android

    - by user1183066
    I am making an android game that is checking the players health value when this method is being runned. But however, it's not reacting. It doesn't do anything, when the value is less than 3, it shouldn't do anything, but when it is equal to 3, it should run a method. Please help me and thanks SO much in advance! This is the code that i am using: private void checkLivesLeftValue() { if (livesLeftValue == 3) { //Message to display: "You lost! onMethod(); } else { livesLeftValue = livesLeftValue + 1; } }

    Read the article

  • Check for existing mapping when writing a custom applier in ConfORM

    - by Philip Fourie
    I am writing my first custom column name applier for ConfORM. How do I check if another column has already been map with same mapping name? This is what I have so far: public class MyColumnNameApplier : IPatternApplier<PropertyPath, IPropertyMapper> { public bool Match(PropertyPath subject) { return (subject.LocalMember != null); } public void Apply(PropertyPath subject, IPropertyMapper applyTo) { string shortColumnName = ToOracleName(subject); // How do I check if the short columnName already exist? applyTo.Column(cm => cm.Name(shortColumnName)); } private string ToOracleName(PropertyPath subject) { ... } } } I need to shorten my class property names to less than 30 characters to fit in with Oracle's 30 character limit. Because I am shortening the column names it is possible that I generate the same name for two different properties. I would like to know when a duplicate mapping occurs. If I don't handle this scenario ConfORM/NHibernate allows two different properties to 'share' the same column name - this is obviously creates a problem for me.

    Read the article

  • refresh a <ui:composition when j_security_check connection interrupted (http 408)

    - by José Osuna Barrios
    I have a "j_security_check connection interrupted (http code 408)" and proposed solution is <meta http-equiv="refresh" content="#{session.maxInactiveInterval}"/> by http://stackoverflow.com/a/2141274/1852036 but my page structure is a composition using a template.xhtml and a view.xhtml like a <ui:composition: my template.xhtml: <html ... <f:view ... <h:body ... <ui:insert name="content"> ... my view.xhtml to refresh when session.maxInactiveInterval <ui:composition ... <ui:define name="content"> ... may anyone help me to do this? I want to refresh this <ui:composition view, I can't use <meta http-equiv="refresh" content="#{session.maxInactiveInterval}"/> on template.xhtml because it's used by several views

    Read the article

  • AD Password About to Expire check problem with ASP.Net

    - by Vince
    Hello everyone, I am trying to write some code to check the AD password age during a user login and notify them of the 15 remaining days. I am using the ASP.Net code that I found on the Microsoft MSDN site and I managed to add a function that checks the if the account is set to change password at next login. The login and the change password at next login works great but I am having some problems with the check for the password age. This is the VB.Net code for the DLL file: Imports System Imports System.Text Imports System.Collections Imports System.DirectoryServices Imports System.DirectoryServices.AccountManagement Imports System.Reflection 'Needed by the Password Expiration Class Only -Vince Namespace FormsAuth Public Class LdapAuthentication Dim _path As String Dim _filterAttribute As String 'Code added for the password expiration added by Vince Private _domain As DirectoryEntry Private _passwordAge As TimeSpan = TimeSpan.MinValue Const UF_DONT_EXPIRE_PASSWD As Integer = &H10000 'Function added by Vince Public Sub New() Dim root As New DirectoryEntry("LDAP://rootDSE") root.AuthenticationType = AuthenticationTypes.Secure _domain = New DirectoryEntry("LDAP://" & root.Properties("defaultNamingContext")(0).ToString()) _domain.AuthenticationType = AuthenticationTypes.Secure End Sub 'Function added by Vince Public ReadOnly Property PasswordAge() As TimeSpan Get If _passwordAge = TimeSpan.MinValue Then Dim ldate As Long = LongFromLargeInteger(_domain.Properties("maxPwdAge")(0)) _passwordAge = TimeSpan.FromTicks(ldate) End If Return _passwordAge End Get End Property Public Sub New(ByVal path As String) _path = path End Sub 'Function added by Vince Public Function DoesUserHaveToChangePassword(ByVal userName As String) As Boolean Dim ctx As PrincipalContext = New PrincipalContext(System.DirectoryServices.AccountManagement.ContextType.Domain) Dim up = UserPrincipal.FindByIdentity(ctx, userName) Return (Not up.LastPasswordSet.HasValue) 'returns true if last password set has no value. End Function Public Function IsAuthenticated(ByVal domain As String, ByVal username As String, ByVal pwd As String) As Boolean Dim domainAndUsername As String = domain & "\" & username Dim entry As DirectoryEntry = New DirectoryEntry(_path, domainAndUsername, pwd) Try 'Bind to the native AdsObject to force authentication. Dim obj As Object = entry.NativeObject Dim search As DirectorySearcher = New DirectorySearcher(entry) search.Filter = "(SAMAccountName=" & username & ")" search.PropertiesToLoad.Add("cn") Dim result As SearchResult = search.FindOne() If (result Is Nothing) Then Return False End If 'Update the new path to the user in the directory. _path = result.Path _filterAttribute = CType(result.Properties("cn")(0), String) Catch ex As Exception Throw New Exception("Error authenticating user. " & ex.Message) End Try Return True End Function Public Function GetGroups() As String Dim search As DirectorySearcher = New DirectorySearcher(_path) search.Filter = "(cn=" & _filterAttribute & ")" search.PropertiesToLoad.Add("memberOf") Dim groupNames As StringBuilder = New StringBuilder() Try Dim result As SearchResult = search.FindOne() Dim propertyCount As Integer = result.Properties("memberOf").Count Dim dn As String Dim equalsIndex, commaIndex Dim propertyCounter As Integer For propertyCounter = 0 To propertyCount - 1 dn = CType(result.Properties("memberOf")(propertyCounter), String) equalsIndex = dn.IndexOf("=", 1) commaIndex = dn.IndexOf(",", 1) If (equalsIndex = -1) Then Return Nothing End If groupNames.Append(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1)) groupNames.Append("|") Next Catch ex As Exception Throw New Exception("Error obtaining group names. " & ex.Message) End Try Return groupNames.ToString() End Function 'Function added by Vince Public Function WhenExpires(ByVal username As String) As TimeSpan Dim ds As New DirectorySearcher(_domain) ds.Filter = [String].Format("(&(objectClass=user)(objectCategory=person)(sAMAccountName={0}))", username) Dim sr As SearchResult = FindOne(ds) Dim user As DirectoryEntry = sr.GetDirectoryEntry() Dim flags As Integer = CInt(user.Properties("userAccountControl").Value) If Convert.ToBoolean(flags And UF_DONT_EXPIRE_PASSWD) Then 'password never expires Return TimeSpan.MaxValue End If 'get when they last set their password Dim pwdLastSet As DateTime = DateTime.FromFileTime(LongFromLargeInteger(user.Properties("pwdLastSet").Value)) ' return pwdLastSet.Add(PasswordAge).Subtract(DateTime.Now); If pwdLastSet.Subtract(PasswordAge).CompareTo(DateTime.Now) > 0 Then Return pwdLastSet.Subtract(PasswordAge).Subtract(DateTime.Now) Else Return TimeSpan.MinValue 'already expired End If End Function 'Function added by Vince Private Function LongFromLargeInteger(ByVal largeInteger As Object) As Long Dim type As System.Type = largeInteger.[GetType]() Dim highPart As Integer = CInt(type.InvokeMember("HighPart", BindingFlags.GetProperty, Nothing, largeInteger, Nothing)) Dim lowPart As Integer = CInt(type.InvokeMember("LowPart", BindingFlags.GetProperty, Nothing, largeInteger, Nothing)) Return CLng(highPart) << 32 Or CUInt(lowPart) End Function 'Function added by Vince Private Function FindOne(ByVal searcher As DirectorySearcher) As SearchResult Dim sr As SearchResult = Nothing Dim src As SearchResultCollection = searcher.FindAll() If src.Count > 0 Then sr = src(0) End If src.Dispose() Return sr End Function End Class End Namespace And this is the Login.aspx page: sub Login_Click(sender as object,e as EventArgs) Dim adPath As String = "LDAP://DC=xxx,DC=com" 'Path to your LDAP directory server Dim adAuth As LdapAuthentication = New LdapAuthentication(adPath) Try If (True = adAuth.DoesUserHaveToChangePassword(txtUsername.Text)) Then Response.Redirect("passchange.htm") ElseIf (True = adAuth.IsAuthenticated(txtDomain.Text, txtUsername.Text, txtPassword.Text)) Then Dim groups As String = adAuth.GetGroups() 'Create the ticket, and add the groups. Dim isCookiePersistent As Boolean = chkPersist.Checked Dim authTicket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _ txtUsername.Text, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups) 'Encrypt the ticket. Dim encryptedTicket As String = FormsAuthentication.Encrypt(authTicket) 'Create a cookie, and then add the encrypted ticket to the cookie as data. Dim authCookie As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) If (isCookiePersistent = True) Then authCookie.Expires = authTicket.Expiration End If 'Add the cookie to the outgoing cookies collection. Response.Cookies.Add(authCookie) 'Retrieve the password life Dim t As TimeSpan = adAuth.WhenExpires(txtUsername.Text) 'You can redirect now. If (passAge.Days = 90) Then errorLabel.Text = "Your password will expire in " & DateTime.Now.Subtract(t) 'errorLabel.Text = "This is" 'System.Threading.Thread.Sleep(5000) Response.Redirect("http://somepage.aspx") Else Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUsername.Text, False)) End If Else errorLabel.Text = "Authentication did not succeed. Check user name and password." End If Catch ex As Exception errorLabel.Text = "Error authenticating. " & ex.Message End Try End Sub ` Every time I have this Dim t As TimeSpan = adAuth.WhenExpires(txtUsername.Text) enabled, I receive "Arithmetic operation resulted in an overflow." during the login and won't continue. What am I doing wrong? How can I correct this? Please help!! Thank you very much for any help in advance. Vince

    Read the article

  • How could I represent 1.625 by 0 or a 1 (binary digit)?

    - by pepito
    This is an excerpt from wikipedia about 'full rate' speech coding standard. Full Rate or FR or GSM-FR or GSM 06.10 was the first digital speech coding standard used in the GSM digital mobile phone system. The bit rate of the codec is 13 kbit/s, or 1.625 bits/audio sample. And this one is an excerpt from wikipedia about bit. In computing parlance, bit is the abbreviation for a single binary digit, represented by a 0 or a 1. How could I represent 1.625 by 0 or a 1? Actually, that's my lecturer's question that I could not answer. Some links to papers are more than welcome. Thanks in advance.

    Read the article

  • Word Spell Check pops up hidden and "freezes" my App

    - by Refracted Paladin
    I am using Word's Spell Check in my in house WinForm app. My clients are all XP machines with Office 2007 and randomly the spell check suggestion box pops up behind the App and makes everything "appear" frozen as you cannot get at it. Suggestions? What do other people do to work around this or stop it altogether? Thanks Below is my code, for reference, though I am doubtful that this has anything to do with my code but I'll take anything. public class SpellCheckers { public string CheckSpelling(string text) { Word.Application app = new Word.Application(); object nullobj = Missing.Value; object template = Missing.Value; object newTemplate = Missing.Value; object documentType = Missing.Value; object visible = false; object optional = Missing.Value; object savechanges = false; app.ShowMe(); Word._Document doc = app.Documents.Add(ref template, ref newTemplate, ref documentType, ref visible); doc.Words.First.InsertBefore(text); Word.ProofreadingErrors errors = doc.SpellingErrors; var ecount = errors.Count; doc.CheckSpelling(ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional); object first = 0; object last = doc.Characters.Count - 1; var results = doc.Range(ref first, ref last).Text; doc.Close(ref savechanges, ref nullobj, ref nullobj); app.Quit(ref savechanges, ref nullobj, ref nullobj); Marshal.ReleaseComObject(doc); Marshal.ReleaseComObject(app); Marshal.ReleaseComObject(errors); return results; } } And I call it from my WinForm app like so -- public static void SpellCheckControl(Control control) { if (IsWord2007Available()) { if (control.HasChildren) { foreach (Control ctrl in control.Controls) { SpellCheckControl(ctrl); } } if (IsValidSpellCheckControl(control)) { if (control.Text != String.Empty) { control.BackColor = Color.FromArgb(180, 215, 195); control.Text = Spelling.CheckSpelling(control.Text); control.Text = control.Text.Replace("\r", "\r\n"); control.ResetBackColor(); } } } }

    Read the article

  • How to check if variable is a CFString?

    - by Sheehan Alam
    I am trying to set some text on a label descriptionLabel.text = [NSString stringWithFormat:mySTUser.bio]; The bio property of mySTUser is an NSString. Sometimes it is not an NSString when I set it. How can I check if mySTUser.bio is an NSString so I can prevent it from being assigned to my label text?

    Read the article

  • Google API to check number of indexed pages?

    - by Probocop
    Is there a Google API similar to Yahoo and Bing's API's to check for the number of indexed pages on a specified domain? For example, for Yahoo if I type in the following URL: http://search.yahooapis.com/SiteExplorerService/V1/pageData?appid=MTSlade&query=http://www.dave-sellers.co.uk&domain_only=1&results=1 Then it will return some XML detailing the number of pages indexed as 'totalResultsAvailable' Any idea? Thanks

    Read the article

  • Check if a Mail folder exists using Zend Mail

    - by Ali
    How can I check if an email folder exists using Zend_Mail_Storage_Imap, theres a createFOlder, renameFOlder and removeFolder and also a getFOlders but not exactly any fixed method to query if a certain mail folder exists? The GetFOlders returns a humonogous tree of folders to start with.

    Read the article

  • Check for updates periodically

    - by jstawski
    I have a SL 4.0 app running out of browser with full priviliges. How can I check for updates (CheckAndDownloadUpdateAsync()) every 10 minutes without affecting UI thread. I've tried using the Timer, but the CheckAndDownloadUpdateCompleted doesn't get executed. I think it is erroring out silently. Thanks in advace...

    Read the article

  • WM6.5 - C# - Check if Start Menu is Visible

    - by Nullstr1ng
    Hi guys, I'm developing an Windows Mobile 6.5 start menu replacement called JWMD Stuick. Currently, I'm able to detect if the Start Menu is created or destroyed by checking GetWindowLong() API.. Though this does not guarantee if Start Menu is visible or not because other cooked ROM was even if the Start Menu is closed or an app was executed from Start Menu -- the Start Menu GWL still has value. Do guys have better ways or ideas how to check if Start Menu is Visible? Thanks.

    Read the article

  • How to check if a checkbox in a checkbox array is checked with jquery

    - by eddy
    Hello everyone. I have a html table with a column of text boxes (mileage), all of them are disabled when the page loads, and I need that when user clicks on a check box, the text box for that column should be enabled and become a required field, and then if the user unchecks the checkbox, the textbox on that row must be disabled and the required class removed. I already have the function to enable and disable the text boxes (column mileage) when the user clicks on the corresponding checkbox, but it is written in javascript.However, for some reason it only works in IE). Here is the html code <tbody> <c:forEach items="${list}" var="item"> <tr> <td align="center"> <input type="checkbox" name="selectItems" value="<c:out value="${item.numberPlate}"/>" onchange="enableTextField(this)" /> </td> <td align="left"><c:out value="${item.numberPlate}"/></td> <td align="left"><c:out value="${item.driver.fullName}"/></td> <td align="left"><input type="text" name="mileage_<c:out value="${item.numberPlate}"/>" value="" disabled="true"/></td> </tr> </c:forEach> </tbody> And the javascript code: function enableTextField(r) { var node = r.parentNode; while( node && node.tagName !== 'TR' ) { node = node.parentNode; } var i=node.rowIndex; if(document.form1.selectItems[i-1].checked) { document.getElementById('mileage_' + document.form1.selectItems[i-1].value).disabled=false; } else { document.getElementById('mileage_' + document.form1.selectItems[i-1].value).value=""; document.getElementById('mileage_' + document.form1.selectItems[i-1].value).disabled=true; } } Now, I know that in order to add or remove dynamically validation rules I have to use: addClass('required'); o removeClass('required') ,but I don't know how to detect whether a check box is selected or not, and based on that ,enable or disable the text box for that row. I really hope you can help me out with this.

    Read the article

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