Using simplexml_load_string() how do I get "ForgotPassword" from the following XML?
<?xml version="1.0" encoding="utf-8"?>
<ForgotPassword>
<version>1.0</version>
<authentication>
<login>username</login>
<apikey>login</apikey>
</authentication>
<parameters>
<emailAddress>[email protected]</emailAddress>
</parameters>
</ForgotPassword>
How can I find the position of a StackPanel after it has been animated?
I have a button which slides the stackpanel to the left. But if I want it to slide to the left again, the animation does not work.
I have a sprite which is basically just an image of a circle and some content inside.
Is there a way that I can programmatically stretch / distort it into something like:
I don't care so much about the distortion. The original circular image is 100x100px, and the modified image should also be 100x100px. So its really the content that is being distorted.
Can this be done using shaders or some other programmatic way ? The initial circular image is most likely determined at run time, which is why I need to programmatically convert the circular sprite to square.
Please do not edit the tags, as the question applies to both versions of cocos2d (iPhone & x), and the solution will most likely work in both regardless of whether one uses C or C++ since the apis are similar, and OpenGL commands work similarly.
I get "E2511 Type parameter 'T' must be a class type" on the third class.
type TSomeClass=class
end;
ParentParentClass<T>=class
end;
ParentClass<T: class> = class(ParentParentClass<T>)
end;
ChildClass<T: TSomeClass> = class(ParentClass<T>)
end;
I'm trying to write a lite Generic Array wrapper for any data type(ParentParentClass) ,but because I'm unable to free type idenitifiers( if T is TObject then Tobject(T).Free) , I created the second class, which is useful for class types, so I can free the objects.
The third class is where I use my wrapper, but the compiler throws that error. How do I make it compile?
I am trying to build a small table using NSString. I cannot seem to format the strings properly.
Here is what I have
[NSString stringWithFormat:@"%8@: %.6f",e,v]
where e is an NSString from somewhere else, and v is a float.
What I want is output something like this:
Grapes: 20.3
Pomegranates: 2.5
Oranges: 15.1
What I get is
Grapes:20.3
Pomegranates:2.5
Oranges:15.1
How can I fix my format to do something like this?
I've checked my elisp files to make sure that I do not have any bindings that contain Shift+R (and I have not found any). I expect SHIFT+R to print an uppercase character, but instead I get R R undefined inside of the Emacs command line. This is only in C/C++ major modes.
Any suggestions?
Update: Describing the key shows that it is undefined. How would I define it for the normal, expected use (capitalizing the letter R)?
Hello,
I am attempting to return a image from a server using Silverlight 3. The server returns the Response stream like this:
context.Response.ContentType = imageFactory.ContentType
imgStream.WriteTo(context.Response.OutputStream)
imgStream.Close()
context.Response.End()
On the Silverlight client I am handling the stream like:
Dim request As HttpWebRequest = result.AsyncState
Dim response As HttpWebResponse = request.EndGetResponse(result)
Dim responseStream As IO.Stream = response.GetResponseStream()
I want to take that stream and open the browsers save dialog, one option I have explored is using the Html.Window.Navigate(New Uri("image url")) and this opened the correct browser default dialog but it is not an option because I need to send extended information(e.g. XML) to the server through the HttpRequest.Headers.Item and the Navigate doesn't allow this.
How can I take a Response Stream and force the default browser Save dialog to appear from the Silverlight Application without using the Html.Window.Navigate(New Uri("image url"))?
A quartz scheduler is being used in an Application I am working on. A process that runs using the quartz scheduler spawns new threads. I was wondering if it is possible for these threads to continue living after the server is killed?
Hello,
There is already a similar question(link).The thing is I don't understand what unit I have to delete.
I have installed the latest JCL library and added 'JclCompression' to the uses list in a unit and I get the error: "Unit JclCompression was compiled with a different version of sevenzip.IOutArchive".
Please explain to me in a simpler way how to resolve the problem.
Thanks in advance!
If we use a CMS that is covered by the GPL (v2), do we have to re-release the source code of the CMS if we make modifications to the core?
The GPL v2 states:
The GPL does not require you to release your modified version. You are
free to make modifications and use
them privately, without ever releasing
them. This applies to organizations
(including companies), too; an
organization can make a modified
version and use it internally without
ever releasing it outside the
organization.
But if you release the modified
version to the public in some way, the
GPL requires you to make the modified
source code available to the program's
users, under the GPL.
The grey area for me here is the part that states "if you release the modified version to the public in some way" - does displaying a website to the public count as "releasing it to the public"?
What about if a custom plugin is written which integrates with the CMS - are we required to release the source? Does this count as a modification?
Is there any way in C/C++ to stop a backtracking algorithm after finding the first solution without exiting the program.
I want my function to immediately exit the function,not to quit every level of recurrsion one by one stating return.
Software will often introduce and formalize concepts that may have ambiguous definitions in the real world. For example, in an attendance tracking system, an Occurrence refers to an Excused Absence, an Unexcused Absence, or a Tardy.
In technical documentation (both in helper text and in user guides, etc), should these concepts be proper nouns, and as such, should they be capitalized in usage?
In other words, which of the following examples is more appropriate:
After an Occurrence has been created,
it may be converted into an Excused
Absence once the Approval Form has
been uploaded.
or
After an occurrence has been created,
it may be converted into an excused
absence once the approval form has
been uploaded.
Hi
I have a ol list:
<ol>
<li class="group1">item 1</li>
<li class="group1">item 2</li>
<li class="group2"> item 3</li>
<li class="group3">item 4</li>
<li class="group1">item 5</li>
<li class="group3"> item 6</li>
<ol>
and a set of checkboxes which correspond to the class names
<input type="checkbox" value="group1" />group 1
<input type="checkbox" value="group2" />group 2
<input type="checkbox" value="group3" />group 3
What I want to happen is that when a user clicks on a checkbox to 'tick' it, any li rows which are not checked are fadedOut (change opacity) and then any rows which have the class which matches the value of the checkbox are highlighter (background colour changed to yellow).
So for example if group 3 was clicked, item 4 and item 6 would be highlighted. Then if group 2 was clicked item 3 would be highlighted (item 4 and 6 would remain highlighted). If group 2 was un-ticked, item 3 would become faded out although item 4 and 6 would remain highlighted.
The code I have at the moment is:
$('input').click(function(){
input = $(this);
classVal = "." + input.val();
elements = $(classVal );
if (input.is(':checked')) {
elements.css("background-color", "#FFFF00");
} else {
elements.css("background-color", "");
}
});
This handles the highlighting but does not do the fading of the unchecked elements. I know I can change the opacity using css("opacity", 0.33) or fadeTo("slow", 0.33) but not sure how to handle this in the code and where to put it.
If any of my other code can be tidied up also please let me know
Thanks
There is a PostgreSQL database on which I only have limited access (e.g, I can't use pg_dump). I am trying to create a local "mirror" by exporting certain tables from the database. I do not have the permissions needed to just dump a table as SQL from within psql. Right now, I just have a Python script that iterates through my table_names, selects all fields and then exports them as a CSV:
for table_name, file_name in zip(table_names, file_names):
cmd = """echo "\\\copy (select * from %s)" to stdout WITH CSV HEADER | psql -d remote_db | gzip > ./%s/%s.gz"""%(table_name,dir_name,file_name)
os.system(cmd)
I would like to not use CSV if possible, as I lose the field types and the encoding can get messed up. First best would probably be some way of getting the generating SQL code for the table using \copy. Next best would be XML, ideally with some way of preserving the field types. If that doesn't work, I think the final option might be two queries---one to get the field data types, the other to get the actual data.
Any thoughts or advice would be greatly appreciated - thanks!
While writing a test suite, I needed to provide an implementation of operator<<(std::ostream&... for Boost unit test to use.
This worked:
namespace theseus { namespace core {
std::ostream& operator<<(std::ostream& ss, const PixelRGB& p) {
return (ss << "PixelRGB(" << (int)p.r << "," << (int)p.g << "," << (int)p.b << ")");
}
}}
This didn't:
std::ostream& operator<<(std::ostream& ss, const theseus::core::PixelRGB& p) {
return (ss << "PixelRGB(" << (int)p.r << "," << (int)p.g << "," << (int)p.b << ")");
}
Apparently, the second wasn't included in the candidate matches when g++ tried to resolve the use of the operator. Why (what rule causes this)?
The code calling operator<< is deep within the Boost unit test framework, but here's the test code:
BOOST_AUTO_TEST_SUITE(core_image)
BOOST_AUTO_TEST_CASE(test_output) {
using namespace theseus::core;
BOOST_TEST_MESSAGE(PixelRGB(5,5,5)); // only compiles with operator<< definition inside theseus::core
std::cout << PixelRGB(5,5,5) << "\n"; // works with either definition
BOOST_CHECK(true); // prevent no-assertion error
}
BOOST_AUTO_TEST_SUITE_END()
For reference, I'm using g++ 4.4 (though for the moment I'm assuming this behaviour is standards-conformant).
I'm trying to learn twitter storm by following the great article "Understanding the parallelism of a Storm topology"
However I'm a bit confused by the concept of "task". Is a task an running instance of the component(spout or bolt) ? A executor having multiple tasks actually is saying the same component is executed for multiple times by the executor, am I correct ?
Moreover in a general parallelism sense, Storm will spawn a dedicated thread(executor) for a spout or bolt, but what is contributed to the parallelism by an executor(thread) having multiple tasks ? I think having multiple tasks in a thread, since a thread executes sequentially, only make the thread a kind of "cached" resource, which avoids spawning new thread for next task run. Am I correct?
I may clear those confusion by myself after taking more time to investigate, but you know, we both love stackoverflow ;-)
Thanks in advance.
I need to have my PHP extension return an array of objects, but I can't seem to figure out how to do this.
I have a Graph object written in C++. Graph.getNodes() returns a std::map<int, Node*>. Here's the code I have currently:
struct node_object {
zend_object std;
Node *node;
};
zend_class_entry *node_ce;
then
PHP_METHOD(Graph, getNodes)
{
Graph *graph;
GET_GRAPH(graph, obj) // a macro I wrote to populate graph
node_object* n;
zval* node_zval;
if (obj == NULL) {
RETURN_NULL();
}
if (object_init_ex(node_zval, node_ce) != SUCCESS) {
RETURN_NULL();
}
std::map nodes = graph-getNodes();
array_init(return_value);
for (std::map::iterator i = nodes.begin(); i != nodes.end(); ++i) {
php_printf("X");
n = (node_object*) zend_object_store_get_object(node_zval TSRMLS_CC);
n-node = i-second;
add_index_zval(return_value, i-first, node_zval);
}
php_printf("]");
}
When i run php -r '$g = new Graph(); $g->getNodes();' I get the output
XX]Segmentation fault
meaning the getNodes() function loops successfully through my 2-node list, returns, then segfaults. What am I doing wrong?
I'm using Crystal Report with VB.NET in Visual Studio 2005.
I have report that works if I pass in a list of List(Of Stuff). I had been sorting the report by one of the members of Stuff but a need now to sort first by one member, like Stuff.StatusCode and then by another member, like Stuff.ItemNumber.
Can I do this just be having more than one SortField member, or do I need to do it some other way?
Thanks as always!
I have a git bare repo that I manage and I want to have git auto create tracking branches for all the remote branches. That way no one has to auto create them.
I tried to do it in a post fetch hook, but couldn't get it working.
Every time I write to the text file I will lose the original data, how can I read the file and enter the data in the empty line or the next line which is empty?
public void writeToFile()
{
try
{
output = new Formatter(myFile);
}
catch(SecurityException securityException)
{
System.err.println("Error creating file");
System.exit(1);
}
catch(FileNotFoundException fileNotFoundException)
{
System.err.println("Error creating file");
System.exit(1);
}
Scanner scanner = new Scanner (System.in);
String number = "";
String name = "";
System.out.println("Please enter number:");
number = scanner.next();
System.out.println("Please enter name:");
name = scanner.next();
output.format("%s,%s \r\n", number, name);
output.close();
}
Sorry for lengthy question. I can't tell if this should be a programming question or a project management question. Any advice will help.
I inherited a reasonably large web project (1 year old) from a solo freelancer who architected it then abandoned it. The project was a mess, but I cleaned up what I could, and now the system is more maintainable. I need suggestions on how to extend the user-permission system.
As it is now, the database has a t_user table with the column t_user.membership_type. Currently, there are 4 membership types with the following properties:
3 of the membership types are almost functionally the same, except for the different monthly fees each must pay
1 of the membership type is a "fake-user" type which has limited access ( different business logic also applies)
With regards to the fake-user type, if you look in the system's business logic files, you will see a lot of hard-coded IF statements that do something like
if (fake-user)
{ // do something
} else { // a paid member of type 1,2 or 3
// proceed normally
}
My client asked me to add 3 more membership types to the system, each of them with unique features to be implemented this month, and substantive "to-be-determined" features next month.
My first reaction is that I need to refactor the user-permission system. But it concerns me that I don't have enough information on the "to-be-determined" membership type features for next month. Refactoring the user-permission system will take a substantive amount of time. I don't want to refactor something and throw it out the following month. I get substantive feature requests on a monthly basis that come out of the blue. There is no project road map.
I've asked my client to provide me with a roadmap of what they intend to do with the new membership types, but their answer is along the lines of "We just want to do [feature here] this month. We'll think of something new next month."
So questions that come to mind are:
1) Is it dangerous for me to refactor the user permission system not knowing what membership type features exist beyond a month from now?
2) Should I refactor the user permission system regardless? Or just continue adding IF statements as needed in all my controller files? Or can you recommend a different approach to user permission systems? Maybe role-based ?
3) Should this project have a road map? For a 1 year old project like mine, how far into the future should this roadmap project?
4) Any general advice on the best way to add 3 new membership types?
In Clojure, I want to combine two lists to give a list of pairs,
> (zip '(1 2 3) '(4 5 6))
((1 4) (2 5) (3 6))
In Haskell or Ruby the function is called zip. Implementing it is not difficult, but I wanted to make sure I wasn't missing a function in Core or Contrib.
There is a zip namespace in Core, but it is described as providing access to the Zipper functional technique, which does not appear to be what I am after.
Is there an equivalent function for combining 2 or more lists, in this way, in Core?
If there is not, is it because there is an idiomatic approach that renders the function unneeded?