When creating a flex Chart, the list of colors is always the same, something like (orange, green, blue, ... ) I imagine that the Flex Charts use any array of default colors, Is there a way to get this array ?
It seems that I can sort an std::vector<std::pair<int, std::string>>, and it will sort based on the int value. Is this a well defined thing to do? Does std::pair have a default ordering based on it's elements?
I have added three methods with parameters:
public static void doSomething(Object obj) {
System.out.println("Object called");
}
public static void doSomething(char[] obj) {
System.out.println("Array called");
}
public static void doSomething(Integer obj) {
System.out.println("Array called");
}
When I am calling doSomething(null) , then compiler throws error as ambiguous methods. So Is the issue because Integer and char[] methods or Integer and Object methods?
Here is an example bit from the xml file:
<array>
<dict>
<key>Name</key>
<string>Joe Smith</string>
<key>Type</key>
<string>Profile</string>
<key>Role</key>
<string>User</string>
<key>Some Number</key>
<integer>1</integer>
<key>Some Boolean</key>
<true/>
</dict>
</array>
I have two separate goals. The first is to extract an array from the dictnode that would look like:
[Name] => Joe Smith
[Type] => Profile
[Role] => User
[Some Number] => 1
[Some Boolean] => true
It's not crucial that the boolean be included, so if that adds too much complexity, I'd rather just know how to deal with the others for now.
The second goal is to be able to select the value node (<string>, <integer>,etc) so that I can change the value. I would need to select it based on the text value of the preceding key element.
I think the following XPath should work:
//key[.=$keyname]/following-sibling[1]
But I'm not sure.
Basically, this whole system that Apple uses seems logical, but totally contrary to the XML is supposed to work. If I ran the world, the original XML would look more like:
<dict type="array">
<value key="Name" type="string">Joe Smith</value>
<value key="Type" type="string">Profile</value>
<value key="Role type="string">User</value>
<value key="Some Number" type="integer">1</value>
<value key="Some Boolean" type="boolean">true</value>
</dict>
But since it is fairly logical, I am wondering if I'm missing some obvious way of handling it.
Instead of using an external web-based Mercurial host, I want to set one up on my company's intranet. Is there a web-based tool for Mercurial that lets you have an interface like Bitbucket's but let's you host Mercurial locally?
What would be best practice to localize your ASP .Net MVC application ?
I would like to cover two situations:
one application deployment in IIS which would handle multiple languages
one language / application deployment.
In first situation should you go with somekind of view based thing like, ~/View/EN, ~/View/FI, ~/View/SWE or something different ?
What about second case, just application based config via Web.config and point these different languages to different urls ?
Hi
I am designing a remote CD/DVD burner to address hardware constraint on my Machine.
My design work like that :(Analogous to network paper printer)
Unix Based Machine (acts as server) hosts a burner.
Windows based machine acts as client.
Client prepare data to be burn and transfer it to server.
Server burn the data on CD/DVD.
My Question is :
.
Which is the best protocol to transfer data over network (Keeping same Directory hierarchy) between different OS
Hi All,
I need to create a cross tab using datatable in C#.
Something like this fucntionname(Array datarows,Array datacolumns)
The function should return the cross tabed table, more parameters for missing values would be great
The source datatable can have multiple columns ranging from 1 - N.
In my code, I am using an array xyz of 10 objects. When I am trying to access an element of the array using an unsigned int index like this: xyz[level], I get 'Buffer overrun' warning. Logically, I am pretty sure that level won't exceed 10. How to avoid this warning?
I'm looking for a way to compress an ascii-based string, any help?
I need also need to decompress it. I tried zlib but with no help.
What can I do to compress the string into lesser length?
code:
def compress(request):
if request.POST:
data = request.POST.get('input')
if is_ascii(data):
result = zlib.compress(data)
return render_to_response('index.html', {'result': result, 'input':data}, context_instance = RequestContext(request))
else:
result = "Error, the string is not ascii-based"
return render_to_response('index.html', {'result':result}, context_instance = RequestContext(request))
else:
return render_to_response('index.html', {}, context_instance = RequestContext(request))
I know this is somewhat of a newb question but I am running into a deadline and 3 days of Drupal experience will just not cut it...
$form['gender'] = array('#type' = 'select', '#title' = t('Gender: *'), '#options' = array(t('Male'), t('Female')), '#required' = TRUE, '#weight' = 2, );
How do I assign values to select values ? For example Male - 'm' and Female- 'f'. Also how do I give the select box a default caption "please select gender..."
Thanks guys
Hi,
I am using jasperreport and trying to pass an alternate report runner.
• net.sf.jasperreports.engine.fill.JRThreadSubreportRunner: The initial thread-based
implementation
• net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner: A Javaflow-based
implementation
I am using the second one (for the reason, it runs on tomcat server, and creating threads wouldn't be good while writing subreports). The second one depends on commons-javaflow which is a sandbox version.
Not sure if I should use it, Could somebody suggest a better way.
Thanks
I'm curious if their is some python magic I may not know to accomplish a bit of frivolity
given the line:
csvData.append(','.join([line.split(":").strip() for x in L]))
I'm attempting to split a line on :, trim whitespace around it, and join on ,
problem is, since the array is returned from line.split(":"), the
for x in L #<== L doesn't exist!
causes issues since I have no name for the array returned by line.split(":")
So I'm curious if there is a sexy piece of syntax I could use to accomplish this in one shot?
Cheers!
I want simple C++ string based template library to replace strings at runtime.
For example, I will use
string template = "My name is {{name}}";
At runtime, I want the name to be changed based on actual one.
I found one example, www.stringtemplate.org but I little scared when its talks about antlr etc.
What are your most useful, most practical methods that extends built-in JavaScript objects like String, Array, Date, Boolean, Math, etc.?
String
format
trim
padding
replaceAll & replaceAll
Array
indexOf
Date
toMidnight
Note : Please post one extended method per answer.
I have BYTE pointer. For example the length of this BYTE array is 10.
How can I read 4 bytes from 3 position BYTE array?
Now I doing it so
BYTE *source = "1234567890\0";
BYTE* tmp = new BYTE[4+1]();
for(int i=0; i<4; i++)
{
tmp[i] = source[i+3];
}
I have an UIImage that I want to edit (say, make every second row of pixels black). Now I am aware of the functions that extract PNG or JPEG data from the image, but that's raw data and I have no idea how the png/jpeg files work. Is there a way I can extract the colour data from each pixel into an array? And then make a new UIImage using the data from the array?
hi Frnz,
i want to delete multiple rows from a table view based on users selection.obviously i cant use didSelectRowAtIndexPath method coz it will be called for every row selected. i want to allow user to select multiple rows for deletion and then delete them in one go...Is it possible if yes then how to go about it.Also i am using a single view based project and i want the header of table view changed to "Delete" on the same view when the user want to delete the rows from the view.
Thx
I have a .NET application running on windows. I want clicking on some page element (button link flash app etc) to lunch my app with some special parameters. (It should run not just in IE but on WebKit based windows browsers too) During App install we suppose that user is Admin and is running Vista or Windows 7 or Later.
So my question is - Where to get examples of such interaction (WITH source of course)?
So how to make WebKit based Browser or IE call your .Net application?
We want to make an audio based web based app that will have many sound snippets. We want to cache these files so that performance is good and not dependent on network speed. Can HTML5 cache audio for offline mode?
Hello,
I am using Netbeans 6.8. I can see an option to create a web service in my independent ejb module but i can't seem to find an option to create a RESTful based web service in my ejb module. Is there any kind of restriction in ejb module that i can only create SOAP based web service and not RESTful? or is it the bug of Netbeans 6.8?
Obviously ||= won't work
def x?
@x_query ||= expensive_way_to_calculate_x
end
because if it turns out to be false, then expensive_way_to_calculate_x will get run over and over.
Currently the best way I know is to put the memoized true or false into an Array:
def x?
return @x_query.first if @x_query.is_a?(Array)
@x_query = [expensive_way_to_calculate_x]
@x_query.first
end
Is there a more conventional or efficient way of doing this?
This is ARRAY1
var array_1 = ["51b59c162de88", [
["parties", 0.0, 0.011]
]]
["51b59c1b4f52f", [
["star-speak", 0.0, 0.006],
["parties", 0.0, 0.011]
]]
This is ARRAY2
var array_2 = [{
key: "51b59c162de88",
values: ["parties", 0.0, 0.011]]
},
{
key: "51b59c162de94",
values: [
["star-speak", 0.0, 0.006],
["parties", 0.0, 0.011]
]
}, ];
What is the exact difference between array 1 and array 2.
How do I access their data?
I am new to json!!!!
Just about to extend the Array class with the following extension:
class Array
def shuffle!
size.downto(1) { |n| push delete_at(rand(n)) }
self
end
end
However, I was wondering where a good place to keep these sort of extensions. I was thinking environment.rb or putting in its own file in the initializers directory.
Hi
Atomic Number
Latin
English
Abbreviation
* check the variables for content */
/*** a list of filters ***/
$filters = array(
'searchtext' => array( 'filter' => FILTER_CALLBACK, 'options' => 'mysql_real_escape_string'),
'fieldname' => array( 'filter' => FILTER_CALLBACK, 'options' => 'mysql_real_escape_string')
);
/*** escape all POST variables ***/
$input = filter_input_array(INPUT_POST, $filters);
/*** check the values are not empty ***/
if(empty($input['fieldname']) || empty($input['searchtext']))
{
echo 'Invalid search';
}
else
{
/*** mysql hostname ***/
$hostname = 'localhost';
/*** mysql username ***/
$username = 'username';
/*** mysql password ***/
$password = 'password';
/*** mysql database name ***/
$dbname = 'periodic_table';
/*** connect to the database ***/
$link = @mysql_connect($hostname, $username, $password);
/*** check if the link is a valid resource ***/
if(is_resource($link))
{
/*** select the database we wish to use ***/
if(mysql_select_db($dbname, $link) === TRUE)
{
/*** sql to SELECT information***/
$sql = sprintf("SELECT * FROM elements WHERE %s = '%s'", $input['fieldname'], $input['searchtext']);
/*** echo the sql query ***/
echo '<h3>'.$sql.'</h3>';
/*** run the query ***/
$result = mysql_query($sql);
/*** check if the result is a valid resource ***/
if(is_resource($result))
{
/*** check if we have more than zero rows ***/
if(mysql_num_rows($result) !== 0)
{
echo '<table>';
while($row=mysql_fetch_array($result))
{
echo '<tr>
<td>'.$row['atomicnumber'].'</td>
<td>'.$row['latin'].'</td>
<td>'.$row['english'].'</td>
<td>'.$row['abbr'].'</td>
</tr>';
}
echo '</table>';
}
else
{
/*** if zero results are found.. ***/
echo 'Zero results found';
}
}
else
{
/*** if the resource is not valid ***/
'No valid resource found';
}
}
/*** if we are unable to select the database show an error ****/
else
{
echo 'Unable to select database '.$dbname;
}
/*** close the connection ***/
mysql_close($link);
}
else
{
/*** if we fail to connect ***/
echo 'Unable to connect';
}
}
}
else
{
echo 'Please Choose An Element';
}
?
I got this code from phppro.org tutorials site and i tried to run it. It gives
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established. ....
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO)....
I went to php.net and look it up "Note: A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. If link_identifier isn't defined, the last MySQL connection is used."
My questions are:
1-why they put single quotation around mysql_real_escape_string ?
2-They should establish a connection first, then use the $filter array statement with mysql_real_escape_string ?