function

Reading files using Python

I have a file of the following format. "08-10-2010 13:29:31 1 APs were seen " "08-10-2010 13:29:31 MAC Address SSID RSSI" "08-10-2010 13:29:31 00:1e:79:d7:d5:b0 -80" "08-10-2010 13:30:32 2 APs were seen " "08-10-2010 13:30:32 MAC Address S...

Newly Created Function Is Not Available?

I am working on a scalar value function in MSSQL 2008. I created it and It is shown in object Explorer But when I use this function in MS Query Analyzer It gave me error **Msg 208, Level 16, State 3, Line 1 Invalid object name 'calculatecptcodeprice'.** For Me this type of error after creating Function is new. What went wrong. Please ...

PHP: Modifying prices to look presentable?

Hi everybody, We've all seen that stores have nice-looking pricing on their products; "1.99", "209.90" and so on. That's easily done as well if you enter prices manually, but l et's say that we would have a database which stores prices, that are daily updated according to currency changes. Prices are therefore automatically calculated...

php array pass by reference - assigning a duplicate value for the key gets discarded

Hi, I am sending a reference of an array variable which is initially empty. In the called function the array gets populated. function one() { $ret = array(); two($ret); pri nt_r($ret); } function two(&$res) { foreach($a as $b) { $id = $b->getid(); $txt = $b->gettxt(); $res[$id] = $txt; ...

Macros as default param for function argument

Hello, I'm writing logger file. I'd prefer to use macros _FUNCTION_ there. I don't like the way like: Logger.write("Message", __FUNCTION__); Maybe, it's possible to make something like: void write(const string &message, string functionName = __FUNCTION__) { // ... } If not, are there any ways to do that stuff not by hands (I mea...

C++ How to replace a function but still use the original function in it?

I want to modify the glBindTexture() function to keep track of the previously binded texture ID's. At the moment i just created new function for it, but then i realised that if i use other codes that use glBindTexture: then my whole system might go down to toilet. So how do i do it? Edit: Now when i thought it, checking if i should bin...

How to create a reusable toggle button in AS3?

I'm trying to make the code below reusable. I need multiple toggle buttons in my flash project. Right now the code below works on one button. If I continue and create more buttons, and follow the format below, I would need to create separate functions for each button. I would like to put the reusable code in a separate ActionScript file...

Is it Possible to Call a Function When Building an Array?

Hi, Can I call a function when building an array in Flex 3? public function gridBuilder(myArray:Array):void { var i:uint; for (i=0; i<myArray.length; i++){ dGArray = [ {Name: myArray[i].name, Type: 'A:', Score: myArray[i].score, Rank: myArray[i].rank, Grade:(myFunction(myArray[i].ra...

assignment operator (=) within a function's parameter list?

I'm using the following code from PHPBuilder.com to handle user privileges on my site: /** * Correct the variables stored in array. * @param integer $mask Integer of the bit * @return array */ function bitMask($mask = 0) { if(!is_numeric($mask)) { return array(); } $return = array(); while ($mask > 0...

Python - Writing to a text file using functions ??

i wrote a simple function to write into a text file. like this, def write_func(var): var = str(var) myfile.write(var) a= 5 b= 5 c= a + b write_func(c) this will write the output to a desired file. now, i want the output in another format. say, write_func("Output is :"+c) so that the output will have a meaningful nam...

PHP in PHP, Problem with dynamic forms

hi there, I'm a newbee I've got a little problem with my php-script. I try to generate dynamic formulars with php. which works very good. the problem is, I want my data to be send to another funcion in another php-script. I gues its a problem with the syntax: <?php .... <form action=\"<?php myfunction() ?>\" ... > ... ?> When I used ...

How do I add a callback function to .submit() in Javascript?

I am submitting a page onclick of a form element and need a function to run after the submit refreshes the page. I'm trying to add an animated scroll back to the clicked element that caused the submission. I've got the scroll part covered but I can seem to figure out how to cause the function I wrote for the scroll to run after the page ...

SubSonic 2.2 and ASP.NET gridview

Hi all, I'm trying to show a custom column in my gridview which displays a content type based on a couple of boolean fields in my database. Everything works fine but it's causing a lot of overhead the way I do it now.. like this: <ItemTemplate> <asp:Label ID="lblType" runat="server" Text='<%# GetType((int)DataBinder.Eval(Container.D...

Merge two JavaScript scripts

I have two JavaScript code snippets. These perform specific task when an 'Update' button is clicked. I would like to merge them. Any help is appreciated. JavaScript 1: When the button is clicked, it checks if at least one checkbox is selected: function doUpdate(){ var c = document.getElementsByTagName('input'); for (var i = 0...

SQL Error 1630: Function SUBSTRING does not exist.. huh??

Right. So I've created a stored procedure in a MySQL DB which happens to use SUBSTRING. Running the procedure via a query gives me: SQL Error 1630: Function mydatabase.SUBSTRING does not exist Beg your pardon? ...

Add one to a function call in python

What does the last line, return 1 + .... do ? How can you return 1 plus a function call? Below is the assignments text: These functions recursively count the number of instances of the key in the target string def countSubStringMatchRecursive(target, key): currentPosition = find(target, key) if find(target, key) == -1: ...

Callback function after blur effect is triggered in jquery

I have a form that is validated once the user "blur"s out of an input field. So: $("#field1").blur(function() { if($(this).val().length>0) { $(this).attr('class', 'completed'); } }); When the user first visits the form, and up until all fields are "completed", the submit button is hidden: $(".submit").hide(); I want the submit...

Help to understand magic_quotes_gpc()

i was learning this PHP code from a tutorial to upload files <form method="post" enctype="multipart/form-data"> <input name="userfile" type="file" id="userfile"> </form> <?php if (isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_nam...

Why only one object gets constructed but multiple objects are destroyed when using functor?

The following example, beats me. I've been so far thinking, that when functor is being used, the object gets constructed once and the same object is used multiple times, when used with for_each algorithm and that seems to be correct. However, even though, only one object gets constructed, but multiple objects are destroyed. Now, this b...

PHP how to call included file functions

lets say i make a file Services.php <?php $myGlobalVar='ranSTR'; function serv1($num) { //some processing... return $num; } function serv2($num) { //some processing... return $num; } ?> and i include it in some other file lets say myFile.php by include "Services.php"; OR require "Services.php"; How can i call it...