Search Results

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

Page 56/89 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • How do stop form posting to mysql if database contains a specific ID?

    - by user342391
    I have a form that I am using to post data to mysql. Before submitting the form I want to check the database and see if there are any fields in the column 'customerid' that equal 'userid' and if so not to post the form. Basically, I am trying to limit my users from posting more than once. Users will be able to login to my system and make ONE post. They will be able to delete and modify their post but are only limited to one post. How would I do this??? Code so far: <?php include '../login/dbc.php'; page_protect(); $userid = $_SESSION['user_id']; $sql="INSERT INTO content (customerid, weburl, title, description) VALUES ('$_POST[userid]','$_POST[webaddress]','$_POST[pagetitle]','$_POST[pagedescription]')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 record added"; ?>

    Read the article

  • Permutations with extra restrictions

    - by Full Decent
    I have a set of items, for example: {1,1,1,2,2,3,3,3}, and a restricting set of sets, for example {{3},{1,2},{1,2,3},{1,2,3},{1,2,3},{1,2,3},{2,3},{2,3}. I am looking for permutations of items, but the first element must be 3, and the second must be 1 or 2, etc. One such permutation that fits is: {3,1,1,1,2,2,3} Is there an algorithm to count all permutations for this problem in general? Is there a name for this type of problem? For illustration, I know how to solve this problem for certain types of "restricting sets". Set of items: {1,1,2,2,3}, Restrictions {{1,2},{1,2,3},{1,2,3},{1,2},{1,2}}. This is equal to 2!/(2-1)!/1! * 4!/2!/2!. Effectively permuting the 3 first, since it is the most restrictive and then permuting the remaining items where there is room.

    Read the article

  • What is wrong with my version of strchr?

    - by Eduard Saakashvili
    My assignment is to write my own version of strchr, yet it doesn't seem to work. Any advice would be much appreciated. Here it is: char *strchr (const char *s, int c) //we are looking for c on the string s { int dog; //This is the index on the string, initialized as 0 dog = 0; int point; //this is the pointer to the location given by the index point = &s[dog]; while ((s[dog] != c) && (s[dog] != '\0')) { //it keeps adding to dog until it stumbles upon either c or '\0' dog++; } if (s[dog]==c) { return point; //at this point, if this value is equal to c it returns the pointer to that location } else { return NULL; //if not, this means that c is not on the string } }

    Read the article

  • Disabled Select drop down checking through PHP

    - by user541597
    I have a couple of drop down boxes I access through POST with PHP. When the boxes are disabled and not equal to zero I have the program do something. However when they are disabled I do not want them to do anything. The way I check if the boxes are active is by using an if statement if ($_POST['box'] != "blank"){ //do something } So basically I check if the box is not in the default blank position run the if statement. However when it is disabled I am not sure how to check or what kind of value it returns if any. What can I add to the if statement so it will not go into the loop when the boxes are disabled? I tried: if ($_POST['box'] != "blank" || $_POST['box'] != ""){ //do something } But that did not work. Any ideas?

    Read the article

  • Calculating a parabola: What am I doing wrong? [closed]

    - by Nils
    I was following this thread and copied the code in my project. Playing around with it turns out that it seems not to be very precise. Recall the formula: y = ax^2 + bx +c Since the first given point I have is at x1 = 0, we already have c=y1 . We just need to find a and b. Using: y2 = ax2^2 + bx2 +c y3 = ax3^2 + bx3 +c Solving the equations for b yields: b = y/x - ax - cx Now setting both equations equal to each other so b falls out y2/x2 - ax2 - cx2 = y3/x3 - ax3 - cx3 Now solving for a gives me: a = ( x3*(y2 - c) + x2*(y3 - c) ) / ( x2*x3*(x2 - x3) ) (is that correct?!) And then using again b = y2/x2 - ax2 - cx2 to find b. However so far I haven't found the correct a and b coeffs. What am I doing wrong?

    Read the article

  • data loading - app launching on tableview

    - by wallou
    hi, i encounter an issue with my application. On one hand when my app launches, the first view displayed is a tableview within a tableviewcontroller. On the other hand my app calls a web service to collect data. These methods are in MyAppDelegate\applicationDidFinishLaunching. The thing is that my tableview is made of custom cells that need data from the web service. I noticed that the view (with the tableview) is launched first and then MyAppDelegate\applicationDidFinishLaunchin is executed. As a result the labels of my custom cells are all equal to null as my arrays aren't filled yet by the web service. I would like to know the proper way to make it. If anyone has an idea please tell me. Wallou

    Read the article

  • How to check if the sum of some records equals the difference between two other records in t-sql?

    - by Dan Appleyard
    I have a view that contains bank account activity. ACCOUNT BALANCE_ROW AMOUNT SORT_ORDER 111 1 0.00 1 111 0 10.00 2 111 0 -2.50 3 111 1 7.50 4 222 1 100.00 5 222 0 25.00 6 222 1 125.00 7 ACCOUNT = account number BALANCE_ROW = either starting or ending balance would be 1, otherwise 0 AMOUNT = the amount SORT_ORDER = simple order to return the records in the order of start balance, activity, and end balance I need to figure out a way to see if the sum of the non balance_row rows equal the difference between the ending balance and the starting balance. The result for each account (1 for yes, 0 for no) would be simply added to the resulting result set. Example: Account 111 had a starting balance of 0.00. There were two account activity records of 10.00 and -2.5. That resulted in the ending balance of 7.50. I've been playing around with temp tables, but I was not sure if there is a more efficient way of accomplishing this. Thanks for any input you may have!

    Read the article

  • compare two characters based on subset

    - by schultem
    I have a simple dataframe with two columns: df <- data.frame(x = c(1,1,2,2,3), y = c(rep(1:2,2),1), target = c('a','a','a','b','a')) I would like to compare the strings in the target column (find out whether they are equal or not, i.e., TRUE or FALSE) within every level of x (same number for x). First I would like to compare lines 1 and 2, then 3 and 4 ... My problem is that I am missing some comparisons, for example, line 5 has only one case instead of two - so it should turn out to be FALSE. Variable y indicates the first and second case within x. I played around with ddply doing something like: ddply(df, .(x), summarise, ifelse(as.character(df[df$y == '1',]$target), as.character(df[df$y == '2',]$target),0,1)) which is ugly ... and does not work ... Any insights how I could achieve this comparison? Thanks

    Read the article

  • Calling function from an object with event listener

    - by Mirat Can Bayrak
    i have a view model something like this: CANVAS = getElementById... RemixView = function(attrs) { this.model = attrs.model; this.dragging = false; this.init(); }; RemixView.prototype = { init: function() { CANVAS.addEventListener("click", this.handleClick); }, handleClick: function(ev) { var obj = this.getHoveredObject(ev); }, getHoveredObject: function(ev) {} ... ... } rv = new RemixView() the problem is my when clickHandler event fired, this object is being equal to CANVAS object, not RemixView. So i get error that says: this.getHoveredObject is not a function What is correct approach at that stuation?

    Read the article

  • .NET Garbage Collection behavior (with DataTable)

    - by gmac
    I am wonder why after creating a very simple DataTable and then setting it to null why Garbage Collection does not clear out all the memory used by that DataTable. Here is an example. The variable Before should be equal to Removed but it is not. { long Before = 0, After = 0, Removed = 0, Collected = 0; Before = GC.GetTotalMemory(true); DataTable dt = GetSomeDataTableFromSql(); After = GC.GetTotalMemory(true); dt = null; Removed = GC.GetTotalMemory(true); GC.Collect(); Collected = GC.GetTotalMemory(true); } Gives the following results. Before = 388116 After = 731248 Removed = 530176 Collected = 530176

    Read the article

  • Label field problem in the treenode Tag. (Struts2/Ajax)

    - by ryan
    I'm using struts as a framework for a web-app. The following code runs inside a loop where I access the database to retrieve values to be used as nodes for a tree. <s:set name="categoryValue" value= "%{'<%=rs.getString("category")%>'}"> </s:set> <sx:treenode id="child1" label ="%{#categoryValue}"/> The error I get is "/jsp/tree.jsp(249,65) equal symbol expected" However if i give <s:set name="categoryValue" value= "%{'Test'}"> the value Test is obtained. Can anyone tell me how to set the value of the 'label' with strings?

    Read the article

  • How do I create a timed ban on an account? (PHP/mysql)

    - by ggfan
    I want to create a function that allows me to ban an account for 10days. In the dbc, I have a field called "ban" and Boolean of 1=notban, 0=ban. I also have a field called "date_banned" which is just the timestamp of when the user got banned. My question is how do I create a time frame of 10days from the date the user was banned? ex: James was banned on "2010-05-03 20:43:48". So how can I go about adding 10days to the timestamp? And after 10days, it would set the "ban" equal to 1(which is not banned).

    Read the article

  • Problem decrementing in Java with '-='

    - by hanesjw
    I'm making a scrolling game on Android and am having a hard time figuring out why the code below does not decrement past 0. Objects start at the end of the screen (so the x position is equal to the width of the screen) the objects move accross the screen by decrementing their x positions. I want them to scroll off of the screen, but when the x position hits 0, the objects just stay at 0, they do not move into the negatives. Here is my code to move objects on the screen private void incrementPositions(long delta) { float incrementor = (delta / 1000F) * Globals.MAP_SECTION_SPEED; for(Map.Entry<Integer, HashMap<Integer, MapSection>> column : scrollingMap.entrySet()) { for(Map.Entry<Integer, MapSection> row : column.getValue().entrySet()) { MapSection section = row.getValue(); section.x -= incrementor; } } } It works ok if I change section.x -= incrementor; to section.x = section.x - (int)incrementor; but if i do that the scrolling doesn't appear as smooth.

    Read the article

  • Javascript function not working with an array

    - by Ryan Harvie
    Hi, i have this function which loops through an array of check boxes checking if the boxes value is equal to something in a text box, i dont know whats wrong. function checkValue(contain) { var boxes = document.getElementsByTagName("input"); for (var i = 0; i < boxes.length; i++) { if (boxes[i].name == "vote[]") { if (boxes[i].value.indexOf(contain.value) != -1) { boxes[i].checked = true; } } } } and this is how i call it OnClick="uncheckAll(); checkValue(document.getElementsByName("countrylist"));" this code is in side a echo in php which is like this echo ' ';

    Read the article

  • How to get it working in O(n)?

    - by evermean
    I came across an interview task/question that really got me thinking ... so here it goes: You have an array A[N] of N numbers. You have to compose an array Output[N] such that Output[i] will be equal to multiplication of all the elements of A[N] except A[i]. For example Output[0] will be multiplication of A[1] to A[N-1] and Output[1] will be multiplication of A[0] and from A[2] to A[N-1]. Solve it without division operator and in O(n). I really tried to come up with a solution but I always end up with a complexity of O(n^2). Perhaps the is anyone smarter than me who can tell me an algorithm that works in O(n) or at least give me a hint...

    Read the article

  • Button height rendering inconsistency in Firefox - why are input elements taller?

    - by George Edison
    Consider the following two elements: <button type="submit" class="button">Test</button> <a href="#" class="button">Test 2</a> ...which use the following style definition: .button { background-color: yellow; color: white; border: 1px solid orange; display: inline-block; font-size: 24pt; padding: 2px 16px; text-decoration: none; } This produces two buttons beside each other with an equal height in Chrome. However, Firefox renders the button on the left with a height 1px greater than the button on the right (the <a>): (I've enlarged the image above by 2x.) What do I need to do to get the two buttons to have the same height? It seems like the font-size is causing the problem - but I need that attribute. Fiddle: http://jsfiddle.net/FfRPY/

    Read the article

  • About Attributes member of LUID_AND_ATTRIBUTES used in TOKEN_PRIVILEGES structure

    - by Astaroth
    MSDN article, Enabling and Disabling Privileges in C++, provided the a code example to show how to enable or disable a privilege in an access token. I quote the part in questioned: tp.PrivilegeCount = 1; tp.Privileges[0].Luid = luid; if (bEnablePrivilege) tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; else tp.Privileges[0].Attributes = 0; What is the meaning of zero value for Attributes member? According to the documentation of TOKEN_PRIVILEGES structure, the attributes of a privilege can be a combination of the following values: SE_PRIVILEGE_ENABLED  (it is 0x00000002L in WinNT.h) SE_PRIVILEGE_ENABLED_BY_DEFAULT  (it is 0x00000001L in WinNT.h) SE_PRIVILEGE_REMOVED  (it is 0x00000004L in WinNT.h) SE_PRIVILEGE_USED_FOR_ACCESS  (it is 0x80000000L in WinNT.h) So, we don't see any valid constant with a value of zero. I guess, the zero is equal to SE_PRIVILEGE_REMOVED. Anybody here could explain what the zero value really does?

    Read the article

  • Number 0 is not saving to database as a prefix in SQL Server of CHAR data type column

    - by gmhk
    I am trying to insert an value as '019393' into a table with a CHAR(10) column. It is inserting only '19393' into the database I am implementing this feature in a stored procedure, doing some manipulation like incrementing that number by 15 and saving it back with '0' as the prefix I am using SQL Server database Note: I tried CASTING that value as VARCHAR before saving to the database, but even that did not get the solution Code SELECT @fromBSB = fromBSB, @toBSB = toBSB, @type = Type FROM [dbo].[tbl_REF_SpecialBSBRanges] WHERE CAST(@inputFromBSB AS INT) BETWEEN fromBSB AND toBSB SET @RETURNVALUE = @fromBSB IF(@fromBSB = @inputFromBSB) BEGIN PRINT 'Starting Number is Equal'; DELETE FROM tbl_REF_SpecialBSBRanges WHERE Type = @type AND fromBSB = @fromBSB AND toBSB = @toBSB INSERT INTO [tbl_REF_SpecialBSBRanges] ([Type], [fromBSB], [toBSB]) VALUES(@type, CAST('0' + @fromBSB + 1 AS CHAR), @toBSB) INSERT INTO [tbl_REF_SpecialBSBRanges] ([Type], [fromBSB], [toBSB]) VALUES(@inputBSBName, @inputFromBSB, @inputToBSB) END

    Read the article

  • Print number in engineering format

    - by jmurrayufo
    I am trying to print a number into engineering format with python, but I cannot seem to get it to work. The syntax SEEMS simple enough, but it just doesn't work. >>> import decimal >>> x = decimal.Decimal(1000000) >>> print x 1000000 >>>> print x.to_eng_string() 1000000 I cannot figure out why this is. The two values are not equal (one is a string, the other is an int). Setting various contexts in decimal doesn't seem to help either. Any clues or ideas?

    Read the article

  • Dynamic web widget

    - by user1824996
    My vendor offers a widget creation service where I can login to their page, set initial values of a search form, after the save button is clicked, I can copy & paste the script code on my website to display a product search result widget. I am thinking to change this static widget to a dynamic one. Since my programming knowledge is limited, can experts tell me if it's possible to login https remotely (using cURL) and set search form values equal to values on my page (every time my page content changes, it will change the form value), then save the form. So the widget script I pasted on my page will always be refreshed to new search result. So the issue will involve cross domain, form submission & server/browser communication. I know a little jQuery, PHP, Ajax, cURL but so far I stuck with just having an idea but not really sure how to implement it.

    Read the article

  • What is the memoy size of a Java object array after it has been created?

    - by brenns10
    This probably doesn't even need asking, but I want to make sure I'm right on this. When you create an array of any object in Java like so: Object[] objArr = new Object[10]; The variable objArr is located in stack memory, and it points to a location in the heap where the array object is located. The size of that array in the heap is equal to a 12 byte object header + 4 (or 8, depending on the reference size) bytes * the number of entries in the array. Is this accurate? My question, then, is as follows. Since the array above is empty, does it take up 12 + 4*10 = 52 bytes of memory in the heap immediately after the execution of that line of code? Or does the JVM wait until you start putting things into the array before it instantiates it? Do the null references in the array take up space?

    Read the article

  • Calling variables to run scripts

    - by user1416419
    I have a script that lists all files in a directory, lists them in alphabetical order, and places the number of the file before the filename. #!/bin/bash x=1 cd ~/bin for f in * do if [ -f $f ]; then echo "$x: $f" declare a$x=$f x=$(expr $x + 1) fi done read -p "What would you like to execute?: " num $num Output would be 1: file0 2: file1 3: file2 etc Running $num will execute the command a1 which is not a command. What I want to do is run what $a1 is equal to (ie file0). How can I do this?

    Read the article

  • R statistics, change ranked tables to paired

    - by cousin_pete
    I have data for many tables like: event_id player finish 1 a 1 1 b 2 1 c 3 1 d 4 2 b 1 2 e 2 2 f 3 2 a 3 2 g 5 Many event_id's, each from 5 to 20 players, finish may be tied. In order to use conditional logistic regression in R I would like to reformat the tables to be like: event_id player1 player2 result 1 a b 1 1 a c 1 1 a d 1 1 b c 1 1 b d 1 1 c d 1 2 b e 1 2 b f 1 2 b a 1 2 b g 1 2 e f 1 2 e a 1 2 e g 1 2 f a 0.5 2 f g 1 2 a g 1 An event_id of 4 players will have 4*3/2 = 6 records in the new table, 5 players will have 5*4/2 = 10 records and so on. If player "a" has "finish" less than player "b" the "result" is 1. If "finish" is equal the "result" is 0.5. If player "a" has finish greater than player "b" then the "result" would be 0. Any help appreciated!

    Read the article

  • Add periods in a string [closed]

    - by Garling Beard
    I'm unable to determine why I don't get my expected output, given this code: int periods = (location.Length / 2) - 1; for (int index = 2, i = 0; i < periods; index += 3, ++i ) { location = location.Insert(index, "."); } And a location of "C5032AC", I expect that location will equal "C.50.32.A.C" after my loop terminates; it is instead "C5.03.2AC". Can anyone explain what I'm missing here?

    Read the article

  • mod_rewrite replace all instances of ampersand with %26 for later

    - by Supernovah
    Hey there! I want to simply not use ampersand in my URL so I can pass ampersands further down into my system when a file is requested. The problem is Apache deals with it differently. I don't know how I already rewrite the requested file to index.php?url=$1 so I can see what it was, but if it has an ampersand in there, it can't continue past it! how can I escape the ampersand or turn it into it's hex equal (%26)? <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] </IfModule>`

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >