Search Results

Search found 2221 results on 89 pages for 'equal'.

Page 53/89 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • PHP - Using strcpsn() to protect against SQL injection?

    - by MichaelMitchell
    I am making a sort of form validation system and I need to check the SQL database to see if the username is already there. So, my question, is it effective to use a little if statement like this to protect against an attack? if (strcspn($string, "/\?!@#$%^&*()[]{}|:;<>,.\"\'-+=" == strlen($string)){ return true; } So essentially, if the string contains any of these characters, "/\?!@#$%^&*()[]{}|:;<>,.\"\'-+=", then the length will not equal that of the original $string. I am just wondering if this is sufficient to protect, or if there is more that I must do. Thanks.

    Read the article

  • array loop not working correctly? c++

    - by igor
    Trying to count how many elements within the array are not equal to 0, is something set up wrong? I'd like to check all values in the array (it's a sudoku board) and then when all elements are "full" I need to return true. Is something off? bool boardFull(const Square board[BOARD_SIZE][BOARD_SIZE]) { int totalCount=0; for (int index1 = 0; index1 < BOARD_SIZE; index1++) for (int index2 = 0; index2 < BOARD_SIZE; index2++){ if(board[index1][index2].number!=0) totalCount++; } if(totalCount=81) return true; else return false;

    Read the article

  • Extended maxima transform in Matlab

    - by garvin
    I use imtophat to apply a filter to an m x n array. I then find the local max using imextendedmax(). I get mostly 0's everywhere except for 1's in the general areas where I am expecting a local max. The weird thing is, though, that I don't get just one local max. Instead in these places I get MANY elements with 1's such as 00011100000 00111111000 00000110000 yet the values there are close but NOT equal so I would expect that there would be one that is higher than all of the rest. So I'm wondering a) if this is a bug and how I might fix it and b) how you would choose choose the element of these 1's with the highest value.

    Read the article

  • Facebook FB.api post how to specify a target

    - by Laurent Luce
    I am using FB.api OpenGraph to post a message on the user's wall. I would like the link target to be equal to '_blank' so it opens in a new tab. Is it possible ? The Facebook documentation doesn't give much details. var params = {}; params['message'] = 'message'; params['name'] = 'name'; params['link'] = 'http://link'; params['picture'] = 'http://picture'; params['description'] = 'description'; FB.api('/me/feed', 'post', params, function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Post ID: ' + response); } });

    Read the article

  • How to show a page after a specific time period?

    - by Mahfuz
    I want to build an online quiz test site. Suppose, exam will start at 10:00 am and a student login to give exam at 9:45 am. Whenever the student clicks 'Take Exam' button, he/she cannot not get access to the question paper because the exam time is 10:00 am and there are still 15 minutes before the exam start. Now I want to put some Javascript or PHP code that will prohibit the students to give exam earlier and if a students come early, it will show a stopwatch which display the remaining time before exam time and when the current time is equal to exam time then he/she will be directly redirected to the question paper page.

    Read the article

  • JQuery multiple-choice quiz script: how to ensure the correct answer is available?

    - by DavidR
    I have a function. I pass to it an object with a list of questions and answers. I generate a random number from a range equal to the number of questions in the object. The script check to see if that question has been asked, and if not, it asks it, the correct answer is then passed to a variable correct. I want to give 4 possible answers, each one randomly selected from the list of possible answers. I have this. I just want to know what is the best way to ensure that the correct answer is placed in the list. So far, this is what I have: it puts four answers into four targeted boxes. I want to ensure that the correct answer is in a randomly selected box. function getRandom(limit) { return Math.floor(Math.random() * limit ) } $("#answers > .answer").each(function(i){ r = getRandom(total_questions); $(this).text(answers[r]) });

    Read the article

  • hierarchical data from self referencing table in tree form

    - by Beta033
    It looks like this has been asked and answered in all the simple cases, excluding the one that I'm having trouble with. I've tried using a recursive CTE to generate this; however maybe a cursor would be better? Or maybe a set of recursive functions will do the trick? Can this be done in a cte? consider the following table PrimaryKey ParentKey 1 NULL 2 1 3 6 4 7 5 2 6 1 7 NULL should yield PK 1 -2 --5 -6 --3 7 -4 where the number of - marks equal the depth, my primary difficulty is the ordering.

    Read the article

  • creating a table based on fields from three different tables

    - by ozlem
    Hi, I am using MS-Access 2003. I have three tables containing values of w,Q and L. In the Q table I have three fields: country_name, ISIC_code, and Q value. In the L table, there are three fields, country_name, ISIC_code, and L value. And in the w table there are two fields; country_name and w value. Country_names, and ISIC_code might be different for each table. What I want to do is create a new table with the values b(j)=w(i)L(ij)/Q(ij), where i is the country and j is the ISIC_code. So first I will check if the country name and ISIC_code are the same in L and Q tables. If they are equal I will calculate L/Q and then multiply this with w value of the same country if it exists. I appreciate any help.

    Read the article

  • How to retrieve large data from oracle database using vbscript

    - by allenzzzxd
    Hi guys, I'm now working on vbscript to do some test. Actuelly, I want to retrieve a large amount of data from an oracle database, so I write the code like this: sql = "Select * from CORE_DB where MC = '" & mstr & "' " Set myrs = db_execute_query(curConnection, sql) Then I count the rows in myrs,there are 248 rows. So then I do a For loop to retrieve some fields of each row. For k = 0 To db_get_rows_count(myrs) But then I found that the content of the row k when k 133 was always equal to k = 133. So this makes an error. As I think, there may be a limit size of mrys ? Could anyone light me about this? Thanks a lot in advance

    Read the article

  • Direct3D Rotation Matrix from Vector and vice-versa

    - by Beta Carotin
    I need to compute a rotation matrix from a direction vector, and a direction vector from a rotation matrix. The up direction should correspond to the z-axis, forward is y and right is x; D3DXMATRIX m; // the rotation matrix D3DXVECTOR3 v; // this is the direction vector wich is given D3DXVECTOR3 r; // resulting direction vector float len = D3DXVec3Length(&v); // length of the initial direction vector // compute matrix D3DXMatrixLookAtLH(&m, &v, &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,0,1)); // use the matrix on a vector { 0, len, 0 } D3DXVec3TransformCoord(&r, &D3DXVECTOR3(0,len,0), &m); Now, the vector r should be equal to v, but it isnt. What exactly do I have to do to get the results I need?

    Read the article

  • VBA for filtering columns

    - by Ampi Severe
    I have a big database-like sheet, first row contains headers. I would like a subset of rows of this table based on column values. Two issues: 1) VBA-wise I would like to loop through the columns, when the values for all necessary columns all match, copy the entire row into a new sheet. 2) The subset of rows is based on a list. This should be the first column to be looped through. For example I want all rows where the value in column A is equal to one of the values in my list. Is there any possibility to autofilter strings based on a list (column) of strings? EDIT Thanks to @Doug Glancy the autofiltering works now, so I've removed my (horrible) code and issue 1 is solved.

    Read the article

  • How to check if string contains a string in string array

    - by Abu Hamzah
    edit: the order might change as you can see in the below example, both string have same name but different order.... How would you go after checking to see if the both string array match? the below code returns true but in a reality its should return false since I have extra string array in the _check what i am trying to achieve is to check to see if both string array have same number of strings. string _exists = "Adults,Men,Women,Boys"; string _check = "Men,Women,Boys,Adults,fail"; if (_exists.All(s => _check.Contains(s))) //tried Equal { return true; } else { return false; }

    Read the article

  • WPF/XAML - compare the "SelectedIndex" of two comboboxes (DataTrigger?)

    - by Luaca
    hello, i've got two comboboxes with the same content. the user should not be allowed to choose the same item twice. therefore the comboboxes' contents (= selectedindex?) should never be equal. my first attempt was to comapare the selectedindex with a datatrigger to show/hide a button: <DataTrigger Binding="{Binding ElementName=comboBox1, Path=SelectedIndex}" Value="{Binding ElementName=comboBox2, Path=SelectedIndex}"> <Setter Property="Visibility" Value="Hidden" /> </DataTrigger> it seems that it is not possible to use Value={Binding}. is there any other way (if possible without using a converter)? thanks in advance!

    Read the article

  • Twitter oauth php problems

    - by Patrick Gates
    I'm writing some backend script for a twitter app and heres how it's going On the app you click a button that sends you to login.php on my server which logs into my database connects to twitter with my consumer key and secret: $to = new TwitterOAuth($consumer_key, $consumer_secret); $tok = $to->getRequestToken(); $request_link = $to->getAuthorizeURL($tok); and then writes the token and secret to the database, sets a session equal to the id in the database of the token and secret and then redirects to the "$request_link" You then go through the process of logging in and such on twitter and it redirects you to callback.php on my server Callback.php consists of logging into the database again, getting the new token and secret, and then writing the new token and secret to the database and then prompts you to go back to the app Then on the app, all I'm trying to do is access the basic credentials$to->get('account/verify_credentials') and it keeps coming back "could not authenticate you" What am I doing wrong?? Thank you for all the help :)

    Read the article

  • Design guidelines for cache mechanism

    - by Delashmate
    Hi All, I got assignment to write design for cache mechanism (this is work assignment, not homework), This is my first time writing a design document, Our program display images for doctors, and we want to reduce the parsing time of the images So we want to save the parsed data in advance (in files or inside database) Currently I have several design key ideas: Handle locks - each shared data structure should be handled, also files Test - add test to verify the data from the cache is equal to the data from the files To decouple the connection to the database- not to call directly to the database Cleanup mechanisem- to delete old files if the cahce directory exceed configurable threshold Support config file Support performance tool in the feature I will also add class diagram, data flow charts, and workflow What do you think I should add to the key ideas? Do you know good link to atricales about design? Thanks in advance, Dan

    Read the article

  • C# Comparison shorthand

    - by TheAdamGaskins
    I have this code: if (y == a && y == b && y == c && y == d ...) { ... } Is there some form of shorthand so that I can rewrite it as something like this? if(y == (a && b && c && d ...)) { ... } The functionality should be exactly the same. I'm just looking for something that looks less confusing. EDIT Sorry for not clarifying, all the variables are integers. I'm looking for a shorter way to ensure that a, b, c, d, ... all equal y.

    Read the article

  • CodeIgniter URI segments captured as variables?

    - by Zen Savona
    well, i have a function within a controller called test, and i can access it by going to http://localhost/nwk/control/test this is my function. I want to use the data given in the next segment from the "test" as a php variable. so if i put function test() { $var $this->uri->segment(3); echo $var; } according to the user guide if I enter control/test/data, my variable should be equal to 'data'? doesn't seem to be working. Am I missing something here?

    Read the article

  • How to use PHP to POST to a web page then get the results back, locally

    - by Patrick Gates
    I have a page on my web server that is PHP that is set to do this if ($_POST['post'] == true) { echo: 'hello, world'; } I want to create a page that calls to that page, posts "post" equal to "true" and then returns the value "hello, world". I have a script that works, but only if the pages are on different servers. Unfortunately, both of these pages are on the same server, so, heres my code, and I'm hoping you guys can help me, Thank you :) function post($site, $post) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$site); curl_setopt($ch, CURLOPT_FAILONERROR,1); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $retValue = curl_exec($ch); curl_close($ch); return $retValue; } echo post('data.php', 'post=true');

    Read the article

  • SQL query: Number of comments posted in last 24 hours by people a user is following

    - by bflora
    I've got a site where users follow users they like and can read their latest updates. I'd like to show my users a simple count of how many comments the people they follow have posted in the last 24 hours. I'm having trouble figuring out the query. I have two tables. comment -cid (comment id) -timestamp -uid (id of person who posted the comment) -comment (content of the comment) user_relationships -requester_id (id of the user who followed the person) -requestee_id (id of the person who was followed) In plain english, I think the query is something like this: COUNT the cid.comment from the comments table where uid.comment is equal to requestee_id.user_relationships associated with requester_id.user_relationships value of X. I need to get all the UIDs of people being followed by a given UID from the user_relationship table. Then count up how many comments those people have posted in the last 24 hours and spit that number out. What would this query look like?

    Read the article

  • Get data from database with two conditions in one list

    - by Kreeki
    Hi coders out there, I'm new to this. I have a (sqlite3, but with ActiveRecord it doesn't matter) table called Messages and a model called Message. I want to find all messages in database that have user_id or reciever_id equal to the object user and his attribute id (for short user.id). I know it's probably just one simple line of code, but I wanna do it the right "rails" way and I don't have much experience with this. I'm using Rails 3. Thanks for any help. Cheers

    Read the article

  • prefix and postfix increments while comparing variables

    - by miatech
    could someone explain why this code output is not equals not equals 2 in the first if statement it seems that a = 0 b/c is a postfix increment; therefore a will not increase untile next line; however, the two a's are not equal why? and in the second if when I run the debugger the value of a is 2, but the test is false, why? public static void main (String[] args) { int a = 0; if (a++ == a++) { System.out.println("equals"); } else { System.out.println("not equals"); } if (++a == 2) { System.out.println("equals 2"); } else { System.out.println("not equals 2"); } }

    Read the article

  • Query for multiple joins

    - by Shailaja
    i have 3 tables named dataset,dataelem and transformdataelem with column names as below: main.Dataset ------------ datasetID (PK) applicationID main.Dataelem ------------- dataelemID(PK) datasetID(FK) dataelemname biztermID main.Transformdataelem ---------------------- OutputdataelemID InputdataelemID My requirement is: All tables are referenced. Extract all the dataelemId rows from dataelem table where applicationID of dataset table is equal to 1044 and biztermid shud be null. Then whatever resultant dataelemIDs from the above query should be matched with outputdataelemID of Transformdataelem table and we shud get the respective input dataelemId's. Again with these matched inputdataelemID's we shud get the dataelemname's from datelem table.

    Read the article

  • Compare a DateTime to the current date

    - by looloobs
    Hi I am trying to use a condition on events when the start_at DateTime is equal to or greater than Today's date. I want to list upcoming events, but clearly they are not upcoming if they have already passed. I have: @appointments = Event.find(:all, :conditions => ['move_id = ? AND start_at = ?', @move.id, Date.today]) I think I may be comparing apples and oranges here. It doesn't throw and error, just doesn't do what it is supposed to. Help! Thanks in advance.

    Read the article

  • Use CSS (and maybe JavaScript) to make an element be square (or maintain a specific aspect ratio)

    - by David Pfeffer
    I have a div that I want to have the following characteristics: Width = 50% of its parent element Height equal to whatever it needs to be in order to maintain a certain aspect ratio. I need to use percentages because the object will resize left-right when the browser is resized. I want the object to be resized top-bottom to ensure the object maintains the same aspect ratio. I don't think there's any way to use pure CSS to do this, but does anyone know of a way? Alternatively, is there an easy JavaScript way to do this? (JQuery is fine.)

    Read the article

  • SQL Server 2008 - Conditional Query

    - by Villager
    Hello, SQL is not one of my strong suits. I have a SQL Server 2008 database. This database has a stored procedure that takes in eight int parameters. For the sake of keeping this question focused, I will use one of these parameters for reference: @isActive int Each of these int parameters will be -1, 0, or 1. -1 means "Unknown" or "Don't Care". Basically, I need to query a table such that if the int parameter is NOT -1, I need to consider it in my WHERE clause. Because there are eight int parameters, an IF-ELSE statement does not seem like a good idea. At the same time, I do not know how else to do this? Is there an elegant way in SQL to add a WHERE conditional if a parameter does NOT equal a value? Thank you!

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >