I have a varchar @a='a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p' , wich have | delimitted values. I want to split this variable in a array or a table.
Do anyone have any idea about this.
Does Scala have iterators with 'set' and 'remove' methods for
iterating (and modifying) mutable collections like array?
If there is no such iterator then is there a good reason for that?
Basically I want to get bezier control points from a ttf font and then draw them. I was basically wondering 2 things.
Does it return an array of points or is it more complex?
How can you tell the points of 1 contour from another ex: the letter O which has 2 contours?
Thanks
$sql = "SELECT * FROM table ORDER BY :sort :dir LIMIT :start, :results";
$stmt = $dbh->prepare($sql);
$stmt->execute(array(
'sort' => $_GET['sort'],
'dir' => $_GET['dir'],
'start' => $_GET['start'],
'results' => $_GET['results'],
)
);
I tried to use prepare to do the job,but $stmt->fetchAll(PDO::FETCH_ASSOC); returns nothing.
I've got a method:
public native void doSomething(ByteBuffer in, ByteBuffer out);
Generated by javah C/C++ header of this method is:
JNIEXPORT void JNICALL Java__MyClass_doSomething (JNIEnv *, jobject, jobject, jobject, jint, jint);
How can I get a data array from jobject (that is a ByteBuffer instance) ?
Is there any way by which I can add keys to superglobals in php without defining the corresponding values to those key?
For example:
$_SESSION['key']='set';//key` automatically gets defined.
But I want to do something like this
add_key($_SESSION,'key')//key is added to $_SESSION array.
Is it possible?
i have a textbox array using that i create 20 text boxes in runtime,
i need to get the focus if a particular text box(if i press downarrow
in keyboard how to get the key down of a particular text box it can be
3rd text box).
I'm basically trying to save all current css properties of an element in a local var/array.
I tried :
el.css();
and
el.css("*");
With no luck.
Is there any quick tip do to so ?
Hi all
I have a resources file called string.xml in res/valus directory
the file has many string resources
how can I obtain these items in an array from code ?
I tried
Field[] x=R.string.class.getFields();
but it does not work.
thanks
I ve connected my mobile phone to my PC and used this,
string[] lPorts = System.IO.Ports.SerialPort.GetPortNames();
and the result was an array of port names
"COM4"
"COM3"
"COM1"
"COM7"
"COM6"
Now,How to find which serial port is currently used/to which port my mobile phone is connected in c#?
I've got a function that requires const some_type** as an argument (some_type is a struct, and the function needs a pointer to an array of this type). I declared a local variable of type some_type*, and initialized it. Then I call the function as f(&some_array), and the compiler (gcc) says:
error: invalid conversion from ‘some_type**’ to ‘const some_type**’
What's the problem here? Why can't I convert a variable to const?
I have a base class that declares a grouping of objects. That grouping can be an array, List, Collection, that's up to me.
The derived classes of this base class are the ones that actually set the values of this multi-element field. What is the best way to expose this field to the derived classes?
I try out CakePHP. I follow this Tutorial and can't find out why this code doesn't work. The code from the tutorial works fine.
echo $html -> link('Löschen', array('action' => 'delete', 'id' => $post['Post']['id']), null, 'Sind Sie sicher?' );
I have a problem with Hibernate Native Query. I have one SELECT that selects array slice (PostgreSQL database).
The problem is that hibernate recognizes the following part: ":300" from "SELECT my_array[1:300]..." as named parameter and I get the following exception: Not all named parameters have been set.
I tried to escape the colon (:) with '\:' , '::' but with no success.
The Hibernate version is 3.2
// tmpClientList is List<Client> type
if (txtboxClientName.Text != "")
foreach (Client cli in tmpClientList)
if (cli.Name != txtboxClientName.Text)
tmpClientList.Remove(cli);
Error: "Collection was modified; enumeration operation may not execute."
How can i remove items from the list, in some simple way, without saving indexes of these items in another list or array, and removing them in another place in the code. Tried also RemoveAt(index) but it's exactly the same situation, modifying when loop runs.
I have a PHP form. The form works but I'm trying to test to see if a value other than the first item has been selected. I can't figure out how to write the If statement.
$products = array(
'' => 1,
'Item 2' => 2,
'Item 3' => 3,
'Item 4' => 4,
'Item 5' => 5,
'Item 6' => 6
);
$html = generateSelect('products', $products);
function generateSelect($name = '', $options = array()) {
$html = '<select name="'.$name.'">';
foreach ($options as $option => $value) {
$html .= '<option value='.$value.'>'.$option.'</option>';
}
$html .= '</select>';
return $html;
}
In my table, the drop down box is displayed:
<tr>
<td style="width:{$left_col_width}; text-align:left; vertical-align:center; padding:{$cell_padding}; font-weight:bold; {$product[3]}">{$product[0]}</td>
<td style="text-align:left; vertical-align:top; padding:{$cell_padding};"><select name="{$product[1]}">
<option value="1"></option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
<option value="5">Item 5</option>
<option value="6">Item 6</option>
</select></td>
</tr>
I use the following if statement to check to see if someone has entered a phone number. if they have not entered a phone number, then the "Phone:" text turns red. How do I do an if statement similar to this to verify that someone has selected a product option from the drop down box?
if(!empty($_POST['phone'])) {
$phone[2] = clean_var($_POST['phone']);
if (function_exists('htmlspecialchars')) $phone[2] = htmlspecialchars($phone[2], ENT_QUOTES);
}
else {
$error = 1;
$phone[3] = 'color:#d20128;';
}
it seems simple but I can't figure it out.
Hey,
I'm working on some old(ish) software in PHP that maintains a $cache array to reduce the number of SQL queries. I was thinking of just putting memcached in its place and I'm wondering whether or not to get rid of the internal caching. Would there still be a worthwihle performance increase if I keep the internal caching, or would memcached suffice?
I have a UTF-8 encoded char*.
Is there a standard function to calculate the number of visible characters represented by the byte array?
I'm on Red Hat (RHEL 5).
I would like to have a quick script listing all active hosts in a LAN, and I am a bit lost. From other posts I figured that this can be done most effectively by polling the DHCP server (in my case a Lancom router) using SNMP.
However, I am not familiar with the SNMP commands in PHP. Is snmpwalk() the correct function? Can I get snmpwalk() or any other php function to return an array that contains a list of all live hosts?
When I try to initialize a 3D array of size 300*300*4 in a C program, my program stops running and reports stack overflow error. The system I am using has 3GB RAM, which should be sufficeint. Is there any way to increase memory allocated to a program? I am using Dev C++ on Windows Vista.
question: how can i bind the same vector, lets say o=c(1,2,3,4) mutiple times to get a matrix like
o=array(c(1,2,3,4,1,2,3,4,1,2,3,4), dim(c(4,3))
o
[,1] [,2] [,3]
[1,] 1 1 1
[2,] 2 2 2
[3,] 3 3 3
[4,] 4 4 4
in a nicer way then: o=cbind(o,o,o) and maybe more generalized (dublicate()??
I need this to specifiy colors for elements in textplot()
thx a lot
I have a function foo(i) that takes an integer and takes a significant amount of time to execute. Will there be a significant performance difference between any of the following ways of initializing a:
a = [foo(i) for i in xrange(100)]
a = map(foo, range(100))
vfoo = numpy.vectorize(foo)
a = vfoo(range(100))
(I don't care whether the output is a list or a numpy array.)
Is there a better way?
Hi,
anyone has tried to create a symfony form filter from a class which has a field of type "date" ?
When i do it, i get this error:
500 | Internal Server Error |
Doctrine_Connection_Mysql_Exception
SQLSTATE[HY093]: Invalid parameter
number: number of bound variables does
not match number of tokens stack trace
I think the error dependens on this command:
'SELECT b.id AS b_id, b.day AS b_day FROM birthday b WHERE b.day = ? AND
b.day <= ?', array('month' = '1','day' = '2', 'year' = '2014')
but i dont know how can i solve it..
Any idea?
Javi
I got a problem regrading with my apps which is once I go to my apps, it sure will show me a login page instead of allow page?
it always display the login page 1st then only display allow page, I had tried other apps, if I am 1st time user, It sure will appear the allow page only, it did not show me the login page.
my question is how to I avoid my login page direct go to allow page?
here is my login page picture
here is my apps link
https://apps.facebook.com/christmas_testing/
here is my facebook php jdk api coding
<?php
$fbconfig['appid' ] = "XXXXXXXXXXXXX";
$fbconfig['secret'] = "XXXXXXXXXXXXX";
$fbconfig['baseUrl'] = "myserverlink";
$fbconfig['appBaseUrl'] = "http://apps.facebook.com/christmas_testing/";
if (isset($_GET['code'])){
header("Location: " . $fbconfig['appBaseUrl']);
exit;
}
if (isset($_GET['request_ids'])){
//user comes from invitation
//track them if you need
header("Location: " . $fbconfig['appBaseUrl']);
}
$user = null; //facebook user uid
try{
include_once "facebook.php";
}
catch(Exception $o){
echo '<pre>';
print_r($o);
echo '</pre>';
}
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => $fbconfig['appid'],
'secret' => $fbconfig['secret'],
'cookie' => true,
));
//Facebook Authentication part
$user = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(
array(
'scope' => 'email,publish_stream,user_birthday,user_location,user_work_history,user_about_me,user_hometown'
)
);
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
//you should use error_log($e); instead of printing the info on browser
d($e); // d is a debug function defined at the end of this file
$user = null;
}
}
if (!$user) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
//get user basic description
$userInfo = $facebook->api("/$user");
function d($d){
echo '<pre>';
print_r($d);
echo '</pre>';
}
?
How can I find the dimensions of a matrix in Python. Len(A) returns only one variable.
Edit:
Hi Thanks.
close = dataobj.get_data(timestamps, symbols, closefield)
Is (I assume) generating a matrix of integers (less likely strings). I need to find the size of that matrix, so I can run some tests without having to iterate through all of the elements. As far as the data type goes, I assume it's an array of arrays (or list of lists).