How can I modify this script to return only certain rows of my mySQL table?
Hi there,
I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
$subscriberID = $_POST['subscriberID'];
Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
Any help is appreciated.
<?php
require_once(dirname(__FILE__) . "/2257safeDBconn.php");
require_once(dirname(__FILE__) . "/functions.inc.php");
require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
* This is the main PHP file that process the HTTP parameters,
* performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
* and then serialize the response in an XML format.
* XmlSerializer uses a PEAR xml parser to generate an xml response.
* this takes a php array and generates an xml according to the following rules:
* - the root tag name is called "response"
* - if the current value is a hash, generate a tagname with the key value, recurse inside
* - if the current value is an array, generated tags with the default value "row"
* for example, we have the following array:
* $arr = array(
* "data" => array(
* array("id_pol" => 1, "name_pol" => "name 1"),
* array("id_pol" => 2, "name_pol" => "name 2")
* "metadata" => array(
* "pageNum" => 1,
* "totalRows" => 345
* we will get an xml of the following form
* <?xml version="1.0" encoding="ISO-8859-1"?>
* <response>
* <data>
* <row>
* <id_pol>1</id_pol>
* <name_pol>name 1</name_pol>
* </row>
* <row>
* <id_pol>2</id_pol>
* <name_pol>name 2</name_pol>
* </row>
* </data>
* <metadata>
* <totalRows>345</totalRows>
* <pageNum>1</pageNum>
* </metadata>
* </response>
* Please notice that the generated server side code does not have any
* specific authentication mechanism in place.
* The filter field. This is the only field that we will do filtering after.
$filter_field = "subscriber_id";
* we need to escape the value, so we need to know what it is
* possible values: text, long, int, double, date, defined
$filter_type = "text";
* constructs and executes a sql select query against the selected database
* can take the following parameters:
* $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
* $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
* $_REQUEST["filter"] - the filter value
* $_REQUEST["pageNum"] - the page index
* $_REQUEST["pageSize"] - the page size (number of rows to return)
* if neither pageNum and pageSize appear, we do a full select, no limit
* returns : an array of the form
* array (
* data => array(
* array('field1' => "value1", "field2" => "value2")
* metadata => array(
* "pageNum" => page_index,
* "totalRows" => number_of_rows
function findAll() {
global $conn, $filter_field, $filter_type;
* the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
$fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
$order = "";
if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
$order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//get the page number, and the page size
$pageNum = (int)@$_REQUEST["pageNum"];
$pageSize = (int)@$_REQUEST["pageSize"];
//calculate the start row for the limit clause
$start = $pageNum * $pageSize;
//construct the query, using the where and order condition
$query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
//if we use pagination, add the limit clause
if ($pageNum >= 0 && $pageSize > 0) {
$query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
$recordset = mysql_query($query_recordset, $conn);
//if we have rows in the table, loop through them and fill the array
$toret = array();
while ($row_recordset = mysql_fetch_assoc($recordset)) {
array_push($toret, $row_recordset);
//create the standard response structure
$toret = array(
"data" => $toret,
"metadata" => array (
"totalRows" => $totalrows,
"pageNum" => $pageNum
return $toret;
* constructs and executes a sql count query against the selected database
* can take the following parameters:
* $_REQUEST["filter"] - the filter value
* returns : an array of the form
* array (
* data => number_of_rows,
* metadata => array()
function rowCount() {
global $conn, $filter_field, $filter_type;
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//create the standard response structure
$toret = array(
"data" => $totalrows,
"metadata" => array()
return $toret;
Hi there,
I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
$subscriberID = $_POST['subscriberID'];
Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
Any help is appreciated.
<?php
require_once(dirname(__FILE__) . "/2257safeDBconn.php");
require_once(dirname(__FILE__) . "/functions.inc.php");
require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
* This is the main PHP file that process the HTTP parameters,
* performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
* and then serialize the response in an XML format.
* XmlSerializer uses a PEAR xml parser to generate an xml response.
* this takes a php array and generates an xml according to the following rules:
* - the root tag name is called "response"
* - if the current value is a hash, generate a tagname with the key value, recurse inside
* - if the current value is an array, generated tags with the default value "row"
* for example, we have the following array:
* $arr = array(
* "data" => array(
* array("id_pol" => 1, "name_pol" => "name 1"),
* array("id_pol" => 2, "name_pol" => "name 2")
* "metadata" => array(
* "pageNum" => 1,
* "totalRows" => 345
* we will get an xml of the following form
* <?xml version="1.0" encoding="ISO-8859-1"?>
* <response>
* <data>
* <row>
* <id_pol>1</id_pol>
* <name_pol>name 1</name_pol>
* </row>
* <row>
* <id_pol>2</id_pol>
* <name_pol>name 2</name_pol>
* </row>
* </data>
* <metadata>
* <totalRows>345</totalRows>
* <pageNum>1</pageNum>
* </metadata>
* </response>
* Please notice that the generated server side code does not have any
* specific authentication mechanism in place.
* The filter field. This is the only field that we will do filtering after.
$filter_field = "subscriber_id";
* we need to escape the value, so we need to know what it is
* possible values: text, long, int, double, date, defined
$filter_type = "text";
* constructs and executes a sql select query against the selected database
* can take the following parameters:
* $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
* $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
* $_REQUEST["filter"] - the filter value
* $_REQUEST["pageNum"] - the page index
* $_REQUEST["pageSize"] - the page size (number of rows to return)
* if neither pageNum and pageSize appear, we do a full select, no limit
* returns : an array of the form
* array (
* data => array(
* array('field1' => "value1", "field2" => "value2")
* metadata => array(
* "pageNum" => page_index,
* "totalRows" => number_of_rows
function findAll() {
global $conn, $filter_field, $filter_type;
* the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
$fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
$order = "";
if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
$order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//get the page number, and the page size
$pageNum = (int)@$_REQUEST["pageNum"];
$pageSize = (int)@$_REQUEST["pageSize"];
//calculate the start row for the limit clause
$start = $pageNum * $pageSize;
//construct the query, using the where and order condition
$query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
//if we use pagination, add the limit clause
if ($pageNum >= 0 && $pageSize > 0) {
$query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
$recordset = mysql_query($query_recordset, $conn);
//if we have rows in the table, loop through them and fill the array
$toret = array();
while ($row_recordset = mysql_fetch_assoc($recordset)) {
array_push($toret, $row_recordset);
//create the standard response structure
$toret = array(
"data" => $toret,
"metadata" => array (
"totalRows" => $totalrows,
"pageNum" => $pageNum
return $toret;
* constructs and executes a sql count query against the selected database
* can take the following parameters:
* $_REQUEST["filter"] - the filter value
* returns : an array of the form
* array (
* data => number_of_rows,
* metadata => array()
function rowCount() {
global $conn, $filter_field, $filter_type;
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//create the standard response structure
$toret = array(
"data" => $totalrows,
"metadata" => array()
return $toret;
Similar Messages
-
How can I change this script so it doesn't load into a new window?
I have this script on an invisible button on a banner ad, but the client doesn't want the linked page to open in a new window, but rather load over the page in same window. How can I change the script to accomplish this, thanks!
link_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.sdesignsstore.com/store.html"));Try...
navigateToURL(new URLRequest("http://www.sdesignsstore.com/store.html"), "_self"); -
How can I modify this makefile to create proper ARMV7 dylibs?
I need to modify this makefile in order to create proper dylibs for inclusion in my IOS projects. If I just using the dylibs generated without changing this file, I get this error trying to use the dylibs:
ld: warning: ld: warning: ignoring file Undefined symbols for architecture armv7s:
"_mongo_connect", referenced from:
-[ViewController viewDidLoad] in ViewController.o
libbson.dylib, file was built for unsupported file format
( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7s):
Undefined symbols for architecture armv7s:
"_mongo_connect", referenced from:
-[ViewController viewDidLoad] in ViewController.o
libbson.dylibignoring file
Undefined symbols for architecture armv7s:
"_mongo_connect", referenced from:
-[ViewController viewDidLoad] in ViewController.o
libmongoc.dylib, file was built for unsupported file format
( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7s):
Undefined symbols for architecture armv7s:
"_mongo_connect", referenced from:
-[ViewController viewDidLoad] in ViewController.o
libmongoc.dylib
Undefined symbols for architecture armv7s:
"_mongo_connect", referenced from:
-[ViewController viewDidLoad] in ViewController.o
The makefile:
# MongoDB C Driver Makefile
# Copyright 2009, 2010 10gen Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Version
MONGO_MAJOR=0
MONGO_MINOR=6
MONGO_PATCH=0
BSON_MAJOR=$(MONGO_MAJOR)
BSON_MINOR=$(MONGO_MINOR)
BSON_PATCH=$(MONGO_PATCH)
# Library names
MONGO_LIBNAME=libmongoc
BSON_LIBNAME=libbson
# Standard or posix env.
ENV?=posix
# TODO: add replica set test, cpp test, platform tests, json_test
TESTS=test_auth test_bcon test_bson test_bson_subobject test_count_delete \
test_cursors test_endian_swap test_errors test_examples \
test_functions test_gridfs test_helpers \
test_oid test_resize test_simple test_sizes test_update \
test_validate test_write_concern test_commands
MONGO_OBJECTS=src/bcon.o src/bson.o src/encoding.o src/gridfs.o src/md5.o src/mongo.o \
src/numbers.o
BSON_OBJECTS=src/bcon.o src/bson.o src/numbers.o src/encoding.o
ifeq ($(ENV),posix)
TESTS+=test_env_posix test_unix_socket
MONGO_OBJECTS+=src/env_posix.o
else
MONGO_OBJECTS+=src/env_standard.o
endif
DYN_MONGO_OBJECTS=$(foreach i,$(MONGO_OBJECTS),$(patsubst %.o,%.os,$(i)))
DYN_BSON_OBJECTS=$(foreach i,$(BSON_OBJECTS),$(patsubst %.o,%.os,$(i)))
# Compile flags
ALL_DEFINES=$(DEFINES)
ALL_DEFINES+=-D_POSIX_SOURCE
CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
DYN_FLAGS:=-fPIC -DMONGO_DLL_BUILD
# Endianness check
endian := $(shell sh -c 'echo "ab" | od -x | grep "6261" >/dev/null && echo little || echo big')
ifeq ($(endian),big)
ALL_DEFINES+=-DMONGO_BIG_ENDIAN
endif
# Int64 type check
int64:=$(shell ./check_int64.sh $(CC) stdint.h && echo stdint)
ifeq ($(int64),stdint)
ALL_DEFINES+=-DMONGO_HAVE_STDINT
else
int64:=$(shell ./check_int64.sh $(CC) unistd.h && echo unistd)
ifeq ($(int64),unistd)
ALL_DEFINES+=-DMONGO_HAVE_UNISTD
endif
endif
$(shell rm header_check.tmp tmp.c)
TEST_DEFINES=$(ALL_DEFINES)
TEST_DEFINES+=-DTEST_SERVER="\"127.0.0.1\""
OPTIMIZATION?=-O3
WARNINGS?=-Wall
DEBUG?=-ggdb
STD?=c99
PEDANTIC?=-pedantic
ALL_CFLAGS=-std=$(STD) $(PEDANTIC) $(CFLAGS) $(OPTIMIZATION) $(WARNINGS) $(DEBUG) $(ALL_DEFINES)
ALL_LDFLAGS=$(LDFLAGS)
# Shared libraries
DYLIBSUFFIX=so
STLIBSUFFIX=a
MONGO_DYLIBNAME=$(MONGO_LIBNAME).$(DYLIBSUFFIX)
MONGO_DYLIB_MAJOR_NAME=$(MONGO_DYLIBNAME).$(MONGO_MAJOR)
MONGO_DYLIB_MINOR_NAME=$(MONGO_DYLIB_MAJOR_NAME).$(MONGO_MINOR)
MONGO_DYLIB_PATCH_NAME=$(MONGO_DYLIB_MINOR_NAME).$(MONGO_PATCH)
MONGO_DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(MONGO_DYLIB_MINOR_NAME) -o $(MONGO_DYLIBNAME) $(ALL_LDFLAGS) $(DYN_MONGO_OBJECTS)
BSON_DYLIBNAME=$(BSON_LIBNAME).$(DYLIBSUFFIX)
BSON_DYLIB_MAJOR_NAME=$(BSON_DYLIBNAME).$(BSON_MAJOR)
BSON_DYLIB_MINOR_NAME=$(BSON_DYLIB_MAJOR_NAME).$(BSON_MINOR)
BSON_DYLIB_PATCH_NAME=$(BSON_DYLIB_MINOR_NAME).$(BSON_PATCH)
BSON_DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(BSON_DYLIB_MINOR_NAME) -o $(BSON_DYLIBNAME) $(ALL_LDFLAGS) $(DYN_BSON_OBJECTS)
# Static libraries
MONGO_STLIBNAME=$(MONGO_LIBNAME).$(STLIBSUFFIX)
BSON_STLIBNAME=$(BSON_LIBNAME).$(STLIBSUFFIX)
# Overrides
kernel_name := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifeq ($(kernel_name),SunOS)
ALL_LDFLAGS+=-ldl -lnsl -lsocket
INSTALL_CMD=cp -r
MONGO_DYLIB_MAKE_CMD=$(CC) -G -o $(MONGO_DYLIBNAME) -h $(MONGO_DYLIB_MINOR_NAME) $(ALL_LDFLAGS)
BSON_DYLIB_MAKE_CMD=$(CC) -G -o $(BSON_DYLIBNAME) -h $(BSON_DYLIB_MINOR_NAME) $(ALL_LDFLAGS)
endif
ifeq ($(kernel_name),Darwin)
ALL_CFLAGS+=-std=$(STD) $(CFLAGS) $(OPTIMIZATION) $(WARNINGS) $(DEBUG) $(ALL_DEFINES)
DYLIBSUFFIX=dylib
MONGO_DYLIB_MINOR_NAME=$(MONGO_LIBNAME).$(DYLIBSUFFIX).$(MONGO_MAJOR).$(MONGO_M INOR)
MONGO_DYLIB_MAJOR_NAME=$(MONGO_LIBNAME).$(DYLIBSUFFIX).$(MONGO_MAJOR)
MONGO_DYLIB_MAKE_CMD=$(CC) -shared -Wl,-install_name,$(MONGO_DYLIB_MINOR_NAME) -o $(MONGO_DYLIBNAME) $(ALL_LDFLAGS) $(DYN_MONGO_OBJECTS)
BSON_DYLIB_MINOR_NAME=$(BSON_LIBNAME).$(DYLIBSUFFIX).$(BSON_MAJOR).$(BSON_MINOR )
BSON_DYLIB_MAJOR_NAME=$(BSON_LIBNAME).$(DYLIBSUFFIX).$(BSON_MAJOR)
BSON_DYLIB_MAKE_CMD=$(CC) -shared -Wl,-install_name,$(BSON_DYLIB_MINOR_NAME) -o $(BSON_DYLIBNAME) $(ALL_LDFLAGS) $(DYN_BSON_OBJECTS)
endif
# Installation
ifeq ($(kernel_name),SunOS)
INSTALL?=cp -r
endif
INSTALL?= cp -a
INSTALL_INCLUDE_PATH?=/usr/local/include
INSTALL_LIBRARY_PATH?=/usr/local/lib
# TARGETS
all: $(MONGO_DYLIBNAME) $(BSON_DYLIBNAME) $(MONGO_STLIBNAME) $(BSON_STLIBNAME)
# Dependency targets. Run 'make deps' to generate these.
bcon.o: src/bcon.c src/bcon.h src/bson.h
bson.o: src/bson.c src/bson.h src/encoding.h
encoding.o: src/encoding.c src/bson.h src/encoding.h
env_standard.o: src/env_standard.c src/env.h src/mongo.h src/bson.h
env_posix.o: src/env_posix.c src/env.h src/mongo.h src/bson.h
gridfs.o: src/gridfs.c src/gridfs.h src/mongo.h src/bson.h
md5.o: src/md5.c src/md5.h
mongo.o: src/mongo.c src/mongo.h src/bson.h src/md5.h src/env.h
numbers.o: src/numbers.c
$(MONGO_DYLIBNAME): $(DYN_MONGO_OBJECTS)
$(MONGO_DYLIB_MAKE_CMD)
$(MONGO_STLIBNAME): $(MONGO_OBJECTS)
$(AR) -rs $@ $(MONGO_OBJECTS)
$(BSON_DYLIBNAME): $(DYN_BSON_OBJECTS)
$(BSON_DYLIB_MAKE_CMD)
$(BSON_STLIBNAME): $(BSON_OBJECTS)
$(AR) -rs $@ $(BSON_OBJECTS)
install:
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
$(INSTALL) src/mongo.h src/bson.h $(INSTALL_INCLUDE_PATH)
$(INSTALL) $(MONGO_DYLIBNAME) $(INSTALL_LIBRARY_PATH)/$(MONGO_DYLIB_PATCH_NAME)
$(INSTALL) $(BSON_DYLIBNAME) $(INSTALL_LIBRARY_PATH)/$(BSON_DYLIB_PATCH_NAME)
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(MONGO_DYLIB_PATCH_NAME) $(MONGO_DYLIB_MINOR_NAME)
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(BSON_DYLIB_PATCH_NAME) $(BSON_DYLIB_MINOR_NAME)
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(MONGO_DYLIB_MINOR_NAME) $(MONGO_DYLIBNAME)
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(BSON_DYLIB_MINOR_NAME) $(BSON_DYLIBNAME)
$(INSTALL) $(MONGO_STLIBNAME) $(INSTALL_LIBRARY_PATH)
$(INSTALL) $(BSON_STLIBNAME) $(INSTALL_LIBRARY_PATH)
scan-build: clean
scan-build -V -v make
test: $(TESTS)
sh runtests.sh
valgrind: $(TESTS)
sh runtests.sh -v
docs:
python docs/buildscripts/docs.py
clean:
rm -rf src/*.o src/*.os test/*.o test/*.os test_* .scon* config.log
clobber: clean
rm -rf $(MONGO_DYLIBNAME) $(MONGO_STLIBNAME) $(BSON_DYLIBNAME) $(BSON_STLIBNAME) docs/html docs/source/doxygen
deps:
$(CC) -MM -DMONGO_HAVE_STDINT src/*.c
32bit:
$(MAKE) CFLAGS="-m32" LDFLAGS="-pg"
test_%: test/%_test.c test/test.h $(MONGO_STLIBNAME)
$(CC) -o $@ -L. -Isrc $(TEST_DEFINES) $(ALL_LDFLAGS) $< $(MONGO_STLIBNAME)
%.o: %.c
$(CC) -o $@ -c $(ALL_CFLAGS) $<
%.os: %.c
$(CC) -o $@ -c $(ALL_CFLAGS) $(DYN_FLAGS) $<
.PHONY: 32bit all clean clobber deps docs install test valgrindHi Petar,
Thanks for your answer. No doubt that we could solve the issue using on of the way you suggested.
However, even though I had the evdre issue right after applying time dimension modifications, it occurs that the evdre issue was not due to time dimension modifications. I tested it better and I can tell that using "total" as a level works.
Best regards,
Ludovic -
I can still load it with the script running or attempting to run in the background but it makes firefox tremendously slow. After I click on stop running the script then everything seems to be ok.
how do I get the script not to run in the first place.In Firefox the use of the term chrome refers to the user interface and other elements that are not part of the web pages.
See https://developer.mozilla.org/en/Chrome
Your problems seems to be caused by the GreaseMonkey extension.<br />
See [[Troubleshooting extensions and themes]] -
How can I optimize this script?
What I don't like about this script:
1) It has to be run multiple times to process multiple staff. I'd prefer if I could input multiple employee numbers at once
2) It takes so long to search for the user. If I use the script, it can currently take 30s to find the employee. When I use ADUC to run the "(&(objectCategory=user)(objectClass=user)(employeeID=17688))" search, the results are immediate.
3) I'd like it to look through all the chosen employee numbers before replicating the domain.
4) The end of the powershell script calls a batch file because the syntax in the batch file didn't work in powershell. Can the batch file commands be included directly in the powershells script?
5) The batch file references all of our DC's to minimize replication latency. Can it be simplified while ensuring all DC's are hit ASAP?
Here is the powershell script:
#Disable User# Add the Quest ActiveRoles Management Shell snap-in to recognize extended commands
Add-PSSnapin Quest.ActiveRoles.ADManagement
# Take first commandline argument which is the employeeID and assign it to the $empID variable
$empID=$Args[0]
# Search for the EmployeeID and find the matching NTAccountName (NBDomain\*) [This takes about 30 seconds for 1400 users]
Write-Host "Searching for the User which matches Employee ID $EmpID, you have about 30 seconds to press Ctrl-C to cancel..."
$user = get-qaduser -includedproperties employeeID,samaccountname -sizelimit 0 | where {$_.employeeID -eq $empID}
# Find the matching SAMAccountname
$samaccountname = $user.samaccountname
# Find the matching DN
$SourceDN = $user.dn
# Set where the disabled account will be moved
$DestDN = "OU=Disabled Accounts,DC=domain,DC=Com"
# Set recipient limits to 0
set-mailbox -identity $samaccountname -recipientlimits 0
Write-host $User Recipient Limit set to 0.
# Disable all mailbox features except archive
set-casmailbox -identity $samaccountname -owaenabled $false -ewsenabled $false -ecpenabled $false -mapienabled $false -mapiblockoutlookrpchttp $true -ewsallowmacoutlook $false -ewsallowoutlook $false
set-casmailbox -identity $samaccountname -activesyncenabled $false -popenabled $false -imapenabled $false
Write-host $User Exchange features disabled.
# Block all devices associated with the mailbox:
$DeviceIDs = (Get-ActiveSyncDeviceStatistics -Mailbox $SourceDN | foreach { $_.DeviceID } )
Set-CASMailbox -Identity $SourceDN -ActiveSyncBlockedDeviceIDs $DeviceIDs
Write-Host $User All approved devices have been blocked.
# Remove all devices associated with the mailbox:
Set-casmailbox -identity $samaccountname -ActiveSyncAllowedDeviceIDs $null
Write-Host $User All ActiveSync devices removed from mailbox.
#Disable the user
Disable-QADUser $user
Write-Host $user account disabled.
# Move the user to the Disabled OU
Dsmove $SourceDN -newparent $DestDN
Write-Host $User account moved to Disabled OU.
Write-host Finished processing user $User
Write-host ""
Write-host "Replicating the enterprise domain across sites..."
cd "C:\Users\username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Admin Tools"
.\"Force DC replication.cmd"
cd "c:\scripts"
pauseHere's the script I'm happy with. It's just .\scriptname.ps1 xxxx xxxy xxxz, where the args are employee numbers.
#Disable User
import-module activedirectory
cls
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes",""
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No",""
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
foreach ($empID in $args)
# Search for the EmployeeID and find the matching NTAccountName (domain\*)
$user=get-aduser -properties employeeID,samaccountname -resultsetsize $null -LDAPFilter "(employeeID=$empID)"
$samaccountname = $user.samaccountname
$DN=$user.distinguishedname
$name=$user.name
$caption = "Warning!"
$message = "Do you want to disable " + $name + "?"
$result = $Host.UI.PromptForChoice($caption,$message,$choices,0)
if($result -eq 1) { Write-Host "Skipping to the next name (if available)" }
if($result -eq 1) { continue}
if($result -eq 0) { Write-Host "----------"}
if($result -eq 0) { Write-Host "Processing $name"}
# Set recipient limits to 0
set-mailbox -identity $samAccountName -recipientlimits 0
Write-host "$name Recipient Limit set to 0."
# Disable all mailbox features except archive
set-casmailbox -identity $samaccountname -owaenabled $false -ewsenabled $false -ecpenabled $false -mapienabled $false -mapiblockoutlookrpchttp $true -ewsallowmacoutlook $false -ewsallowoutlook $false
set-casmailbox -identity $samaccountname -activesyncenabled $false -popenabled $false -imapenabled $false
Write-host "$name Exchange features disabled."
# Block all devices associated with the mailbox:
$DeviceIDs = (Get-ActiveSyncDeviceStatistics -Mailbox $dn | foreach { $empID.DeviceID } )
Set-CASMailbox -Identity $DN -ActiveSyncBlockedDeviceIDs $DeviceIDs
Write-Host "$name All approved devices have been blocked."
# Remove all devices associated with the mailbox:
Set-casmailbox -identity $samAccountName -ActiveSyncAllowedDeviceIDs $null
Write-Host "$name All ActiveSync devices removed from mailbox."
#Disable the user
set-aduser $samAccountname -Enabled $false
Write-Host "$name account disabled."
# Move the user to the Disabled OU
Move-ADObject -TargetPath "OU=Disabled Accounts,DC=domain,DC=Com" -Identity $dn
Write-Host "$name account moved to Disabled OU."
Write-host "Finished processing user $name."
Write-host "----------"
# Recycle the IIS Application Pools to clear the token cache
Write-Host "Recycling IIS Application pools to clear the token cache..."
$pools=Get-WMIObject IISApplicationPool -Namespace root\MicrosoftIISv2 -authentication Packetprivacy -computername cas001
$pools | %{$_.Recycle()}
$pools=Get-WMIObject IISApplicationPool -Namespace root\MicrosoftIISv2 -authentication Packetprivacy -computername cas002
$pools | %{$_.Recycle()}
Write-Host "Client Access IIS Application pools have been recycled."
Write-host ""
Write-host "Replicating the enterprise domain across sites..."
repadmin /syncall dc003.domain.com /APed
repadmin /kcc dc004.domain
repadmin /kcc dc003.domain
repadmin /kcc dc002.domain
repadmin /kcc dc01.domain
Write-Host "Replication requested, script complete." -
How can i modify this code in BI?
hi friends,
suppose i have data in infosource with deffirent customers.
like from usa,germany,uk.
i created 3 cubes and uploaded records corresponding countries.
i have written code like this in 3.5
loop at data_package.
if data_package-/bic/zcustomer <> 'usa'.
delete data_package.
endif.
endloop.
same logic i need to write in BI 7.0 now where can i write this logic, what modifications i need to change for BI 7.0
regards
suneel.Hi,
Check this link:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
I guess, you just need to change the DATA_PACKAGE to the new naming convention.
Hope this helps.
PB -
So I've been trying recently to get my MacBook Pro connected to my home network. There are two other desktop computers in the household, and I'd like to be able to connect to their shared folders, as well as allow them to access shared items on my MacBook Pro. I think I've read all the documentation regarding this issue on the Apple Support site. I do have administrator privileges on my Windows 7 computer.
Issues connecting from PC to Mac
A couple of days ago, I enabled SMB File Sharing on my MacBook Pro, and in addition to the already shared Public folder, I added another that resides within Movies. Then I went to my Windows 7 PC, and under Network, my MacBook Pro appeared. I double-clicked on it (I cannot remember if I was asked to enter my Mac user credentials; I think I was), and I saw the two shared folders: Public, and the Movies folder.
However, today I went back to my Windows 7 PC, accessed my MacBook Pro, entered username and password, and in addition to the two shared folders, both my Macintosh HD and Boot Camp HD appeared as shared folders, both fully writable. However, under File Sharing on my MacBook Pro, only the two shared folders (Public and Movies) appear in the Shared Folders list.
How can I prevent my Mac from sharing my entire partitions? How can I configure it so thatonly the folders I select to share are actually broadcasted across my home network? Also, it would be ideal if I can access these shared folders from my Windows 7 PC without having to enter my Mac user credentials.
Issues connecting from Mac to PC
I have a user account on my Windows 7 PC with the same name as my Mac, but with no password. When I try to connect to my PC from my Mac, the enter credentials dialogue pops up and asks me to either log-in as a Guest, or enter my User credentials.
The Guest account is disabled on Windows 7, and I assume that's I'm not able to log in as Guest (if it is possible to connect as a Guest without having to enable the Guest account on Windows 7, please let me know). Leaving the password field blank on the enter credentials dialogue tells me that it's incorrect (even though I don't have a password on my Windows 7 account).
Is it possible to access shared files and folders on my Windows 7 PC from my Mac without having to create a password protected account? If not, is it possible to create a password for the sake of accessing shared files, while not requiring it to log in to the account? I'm sorry, I know this last bit more falls under the category of Windows Help.Sharing files from a Mac to a PC is a different animal. I've never done it myself so you may want to repost a separate question on this topic.
From what I understand, in order to access files from a Mac on a PC, you must log in using your Mac username and password (no anonymous file sharing). Since this is not very desirable from a security standpoint, Apple recommends creating a separate user account on the Mac that is dedicated to file sharing. Give that account access only to the files/folders you want to share. You can then give that user account name and password to your Windows users. -
How can I modify this to process 80,000 records at a time until finish.
Hello it's me again -
Without using a rownum limit in my cursor declare my record-set is around 10 million records. This causes problems within our environment. Is there a way I can loop the following code and only do 80,000 at a time.
1 process 80,000
2. process next 80,000.
How would I redeclare the cursor in a loop and grab the next 80,000?
Thanks again
Steve
SET SERVEROUTPUT ON
DECLARE
CURSOR vt_mlr_cursor IS Select master_key, tn, user2 from vt_mlr Where user2 is not null and rownum < 80001;
USERFIELD VARCHAR2(100);
R_count NUMBER := 0;
Field1 VARCHAR2(20);
Field2 VARCHAR2(20);
key VARCHAR2(10);
phone VARCHAR2(11);
BEGIN
FOR vt_mlr_record IN vt_mlr_cursor
LOOP
BEGIN
key := vt_mlr_record.master_key;
phone := vt_mlr_record.tn;
USERFIELD := vt_mlr_record.user2;
Field1 := SUBSTR(vt_mlr_record.user2,12,4);
Field2 := SUBSTR(vt_mlr_record.user2,28,4);
UPDATE vt_mlr
SET
line_medr = Field1,
line_aidr = Field2
WHERE
master_key = vt_mlr_record.master_key;
R_count := R_count + 1;
EXCEPTION
when others then
Insert into temp_reject (REJECT_KEY, REJECT_TN, REJECT_VALUE) VALUES
(key, phone, 'USER2 ' || USERFIELD );
R_count := R_count - 1;
END;
END LOOP;
commit;
EXCEPTION
when others then
DBMS_OUTPUT.PUT_LINE('Error code ' || sqlcode || ' Error desc' || SUBSTR(sqlerrm,1,200));
END;Add a "last_update" or "modified" column to your table.
Then do this:
declare
CURSOR vt_mlr_cursor IS
select master_key, tn, user2
from vt_mlr
where user2 is not null and rownum < 80001
and modified != 'Y'
(or)
and last_update < begin_date ;
begin_date constant date := sysdate ;
begin
update vt_mlr
set line_medr = Field1,
line_aidr = Field2,
modified = 'Y'
(or)
last_update = sysdate -
How can I modify this code to display an image in an applet?
Sorry, I'm almost positive this is absolutely incorrect, but here is what I have so far:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
public class Blackberry extends JApplet implements ActionListener
Image image;
public void init()
//image = getImage(getDocumentBase(), "bluespace.png");
try { image = ImageIO.read(new File("bluespace.png")); }
catch (IOException e) { }
public void paint(Graphics g)
g.drawImage(image, 0, 0, this);
}There are no errors given when run as an applet in Eclipse, it just displays a blank window.Here's a small example of a JPanel that draws an image:
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
public class ShowImageJPanel extends JPanel
private Image image;
public ShowImageJPanel(Image image)
this.image = image;
Dimension size = new Dimension(
image.getWidth(this),
image.getHeight(this));
setPreferredSize(size);
@Override
protected void paintComponent(Graphics g)
super.paintComponent(g);
if (image != null)
g.drawImage(image, 0, 0, this);
}and a JApplet that adds this JPanel into its contentPane:
import java.awt.Image;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JApplet;
public class ShowImageApplet extends JApplet
private static final String IMAGE_PATH = "images/SunSteinSmall.png";
public void init()
try
javax.swing.SwingUtilities.invokeAndWait(new Runnable()
public void run()
createGUI();
catch (Exception e)
System.err.println("createGUI didn't successfully complete");
private void createGUI()
try
Image image = ImageIO.read(getClass().getResourceAsStream(IMAGE_PATH));
getContentPane().add(new ShowImageJPanel(image));
catch (IOException e)
e.printStackTrace();
}Here I have a subpackage off of the applet's package called image, and it's filled with Duke images which you can download from here:
[https://duke.dev.java.net/images/index.html] -
While downloading files Firefox 4 freezes (started with 3.5) and sometimes I get a window that says Script: chrome://mozapps/content/downloads/download.xml:68 has stopped responding or is busy and asks if I want to stop script or ignore. I have looked through about:config and don't see a way to disable the script and keep it disabled.
That is a problem with an AVG extension (Tools > Add-ons > Extensions)
See:
* [[Troubleshooting extensions and themes]] -
How can I get this script to produce a log of what is updated?
spool h:\sql\Projects\BINLOOKP\BINLOOKP.log
SET SERVEROUTPUT ON size 500000
DECLARE
v_schema Varchar2(50);
v_statement Varchar2(500);
CURSOR get_schemas IS
SELECT DISTINCT t.owner
FROM sys.dba_tables t
WHERE t.table_name = 'BINLOOKUP'
ORDER BY t.owner;
BEGIN
OPEN get_schemas;
LOOP
FETCH get_schemas INTO v_schema;
EXIT WHEN get_schemas%NOTFOUND;
v_statement := 'INSERT INTO '||v_schema||'.BINLOOKUP(BIN,HIERMAINTFLAG,CARDTYPE) SELECT T.BIN,T.HIERMAINTFLAG,T.CARDTYPE FROM TJELSMA.BINLOOKUP T WHERE T.BIN NOT IN (SELECT A.BIN FROM '||v_schema||'.BINLOOKUP A)';
execute immediate v_statement;
END LOOP;
CLOSE get_schemas;
END;
/Did you want to know what you are inserting ?
Try :
SQL> set serveroutput on
SQL> declare
2 v_empno number;
3 v_stmt varchar2(4000);
4 begin
5 for i in (select empno from empb) loop
6 v_stmt:='insert into empa values (:b1) returning empno into :b2';
7 execute immediate v_stmt using i.empno returning into v_empno;
8 dbms_output.put_line('Insert empno : '||v_empno);
9 end loop;
10 end;
11 /
Insert empno : 7369
Insert empno : 7566
Insert empno : 7788
Insert empno : 7876
Insert empno : 7902
PL/SQL procedure successfully completed.Nicolas. -
every other email client I have used lets me mark a message as read only when I actually double click and read it. and not just when I preview it.
I will, thanks. It looks like I am keener to use your product than you are for me to use it.
-
How can I modify the text of the automatically created emails of WAS 6.40.
Hi community,
I have a question. How can I change the text of then email which ist automatically send by the EP6/WAS6.40 when I create a new user. The email displays the message "Dear Sir or Madam, your user xzy was created with the following password xxx."
How can I modify this text. Where is it located in the Enterprise Portal / WEBAS 6.40 .
Thank you.
Best Regards,
Olaf ReissNot easily or readily available as of now. It WILL be part of the new features in the NetWeaver 04 release. (*This same question was asked in my EP6 certification class one week ago and this is the answer I got.)
Found this guide in another post...it should help doing what you need manually...
http://help.sap.com/saphelp_nw04/helpdata/en/33/d494c86203ea40b7b44ddd471baab1/frameset.htm
Hope this helps!
CS -
How can I modify the email who is send when I create a new user in EP6
Hi community,
I have a question. How can I change the text of the email which is automatically send by the EP6/WAS6.40 when I create a new user. The email displays the message "Dear Sir or Madam, your user xzy was created with the following password xxx."
How can I modify this text. Where is it located in the Enterprise Portal / WEBAS 6.40 .
Thank you.
Best Regards,
Olaf ReissHi,
Here you can find the required steps on how to change the texts of notification emails:
http://help.sap.com/saphelp_nw04/helpdata/en/33/d494c86203ea40b7b44ddd471baab1/frameset.htm
Good luck,
René -
When I tap on the to line to add an address sometimes people's names come up that I don't have as contacts. How can I change this setting?
The only way that I know currently know of to remove old or incorrect email addresses from the Mail app is to reset the iPad back to factory defaults, which I assume that you don't want to to. You could try leaving feedback for Apple and maybe one day we'll day be able to edit them : http://www.apple.com/feedback/ipad.html#ipad
Maybe you are looking for
-
Lack of Customer Service and Faulty Phone Line
Over the last 2 and a half weeks we have suffered variously from lack of broadband/ TV services and land line usage. During that period the help line has been distinctly unhelpful with either the provision of no information or being told that I would
-
How to build a form chain?
Hello, I want to create a form wizard with 4 forms. On the first form I have divisions in a select list. I will pass the choosen list to the second form. On the second form is another select list with locations (WHERE divisions=choosen division). Aft
-
Connecting Mini iPad to HP Envoy 5533
I have Broadband connection but do not have a PC Mac or any form of computer other than the mini iPad. Can I print from a recently purchased HP Envoy 5533 Thank you for your help. Nortyjamie This question was solved. View Solution.
-
IWeb 1.1 - no slideshows
By following the information in this forum, I was finally able to publish my site. (The thing that seems to work is to allow it to continue to publish after you receive an error message that would suggest it has stopped, and then try republishing.) B
-
I config the system to have the import tab for all the PO (means domestic and international) and assign the declaration form when the material has commodity code. But now even though material has not a commodity code system is assigning a declaration