I'm trying to change the value of an entity in a document's DocumentType.Entities XmlNamedNodeMap but according to MSDN, it's read-only.
How can I set one of the entities?
Hi, I am using the XPath in PHP 5 to parse a XML document. The problem I have is writing a foreach to correctly display the following array:
XML document sample
value 1
value 2
$xmlfile = 'link_to_file.xml';
$xmlRaw = file_get_contents($xmlfile);
$xml = new SimpleXMLElement($xmlRaw);
$install_files = $xml->xpath('//files');
foreach($install_files as $row)
{
echo $row['file'];
}
//var_dump for $row gives the following
array(1) {
[0]=>
object(SimpleXMLElement)#21 (2) {
["file"]=>
string(12) "value 1"
["folder"]=>
string(8) "value 2"
}
}
Ideally I would like to get the value by using $row['file'] or $row['folder']. Thanks for any help.
I'm writing a Python module for parsing XSD for very specific purpose. Currently it's a console program, but ideally I would see it plugged inside some XSD editor - not only for convenience of end users, but also for fetching XSD parsed into Python objects - this would save me days or weeks of work. Is there any such editor on the market?
I asked a question about different testing frameworks yesterday. This question can be found here. Now that I have a better understanding of the different frameworks, I have a very simple question:
With a basic understanding, but very limited experience with writing tests with rails' built in testing framework (basic assertions), would it be okay for me to jump directly to testing with RSpec, Webrat, and Cucamber?
Thank you!
As a side note: yes, this is an opinion based question, but I feel that the input received to this question is valuable enough to the community to keep this question open. Thanks.
So I keep having this small problem where I have something like
func :: a -> b -> [a] -- or basically any a-> ...-> [a] where ... is any types ->
func x y = func' [x] y -- as long as they are used to generate a list of [a] from x
func' :: [a] -> b -> [a]
func = undefined --situation dependant generates a list from each element and returns it as one long list
should I keep it like this?
should I use func' hidden by a where?
should I only use the [a] - b - [a] version and leave the responsibility of passing [variable] to the callee?
I might well need to compose these functions and might want to mess around with the order so I'm leaning towards option 3. What do you think?
I would like to create a stored procedure that takes in a string of comma separated values like this "1,2,3,4", and break it apart and use those numbers to run a query on a different table.
so in the same stored procedure it would do something like
select somefield from sometable where somefield = 1
select somefield from sometable where somefield = 2
select somefield from sometable where somefield = 3
select somefield from sometable where somefield = 4
Thanks!
I'm trying to save a file in a subdirectory in Android 1.5.
I can successfully create a directory using
_context.GetFileStreamPath("foo").mkdir();
(_context is the Activity where I start the execution of saving the file) but then if I try to create a file in foo/ by
_context.GetFileStreamPath("foo/bar.txt");
I get a exception saying I can't have directory separator in a file name ("/").
I'm missing something of working with files in Android... I thought I could use the standard Java classes but they don't seem to work...
I searched the Android documentation but I couldn't fine example and google is not helping me too...
I'm asking the wrong question (to google)...
Can you help me out with this?
Thank you!
I need to calculate the difference between two dates (facility_start_date, facility_end_date) for a report in Reporting Services in SQL 2005. If the facility_end_date is null then it needs to use the report parameter @EndDate in the calculation. However if the facility_end_date is greater than the parameter @EndDate, then it also needs to use the paramenter @EndDate. The code below works fine except that if the facility_end_date is greater than the parameter @EndDate it is still calculating between the facility_start_date and facility_end_date, rather than between the facility_start_date and @EndDate. Any help would be appreciated.
CASE WHEN facility_start_date > facility_end_date THEN
NULL
WHEN DATEPART(day , facility_start_date) > DATEPART(day , facility_end_date) THEN
DATEDIFF(d , facility_start_date , ISNULL(facility_end_date , @EndDate)) - 1
WHEN DATEPART(day , .facility_end_date) > DATEPART(day , @EndDate) THEN
DATEDIFF(d , facility_start_date , @EndDate) - 1
ELSE DATEDIFF(d , facility_start_date , ISNULL facility_end_date , @EndDate))
END
I have an excel file that have the list of contacts( about 10 k of them) that I need to push into my SQL Server database. So, I am writing an .net windows program using visual studio 2008 to read the files, generate random password for each contact, and then push these information in to my SQL Server database.
It was easy to handle excel file in 2003 but now my computer have office 2007 in it and things seem to changed. I am digging on Microsoft.Office.Interop.Excel but it is seem to be a lot more complicated than before.
I searched through multiple discussions here. Can someone just give me a quick and direct answer?
And if with JPA you can't do a batch update, what if I don't use transaction, and just use the following flow:
em = emf.getEntityManager
// do some query
// make some data modification
em.persist(..)
// do some query
// make some data modification
em.persist(..)
// do some query
// make some data modification
em.persist(..)
...
em.close()
How does this compare to batch update with regard to performance, and compare to a single transaction commit, measured by RPC calls to datastore server, CPU cycles per request, or so. Does every call to em.persist(..) before em.close() trigger a RPC call to the datastore server?
Thanks very much for any response!
Hi, I am using the xpath in php5 to parse a xml document. The problem I have is writing a foreach to correctly display the following array
array(1) {
[0]=
object(SimpleXMLElement)#21 (2) {
["file"]=
string(12) "value 1"
["folder"]=
string(8) "value 2"
}
}
Ideally i would like to get the value by using $row['file'] or $row['folder']. Thanks for any help.
I'm curious as to the procedure for writing browser plugins for browsers like Chrome, Safari, and Opera. I'm thinking specifically of Windows here and would prefer working with C++.
Note: I am not referring to extensions or 'addons'
Suppose I want to use the ASCII special character FS(0x1C) in a .Net string, and then be able to format a byte array from that same string with the special character properly represented as a single byte, how would I do that? I can't seem to get my head around it.
Thanks for any help you can give.
I want to execute query in side the db.sql file using MySQL 5.1 in windows environment. Can any one help me to this. I want to do this by runing a bat file.
Is there an easy forwarding/transparent php proxy script that I can host on my web server? These are my conditions:
I'm using free web hosting, so I have pretty much no control over my machine. Otherwise I could use Perl's HTTP::Proxy module. This means no root password. It does run php though.
I already have a server running on port 80. What I mean is I would like to put a php script as index.php on my server that will forward all requests.
I don't want a script like PHProxy or Glype where I go to the site, then enter a URL. I want a server so I can enter proxy.example.com:80 in Firefox's or IE's or whatever's proxy settings and it will forward all requests to the server.
Preferably (though not fatal if not possible) I would like for it to pass on the USER_AGENT environmental variable (That's the browser) instead of setting itself to be the USER_AGENT
I can't start a new Daemon. My server won't allow it.
Is there a script that will do this? If so, which?
I know how to do it mathematically, but i want it now to do it in c++ using some easy algorithm. Is is possible?
The question is that i need some methods/ideas for writing a number N in base M, for example 1410 in base 3: (14)10 = 2*(3^0) + 1*(3^1) + 1*(3^2) = (112)3 etc.
Hi,
I am using IEEETrans.cls to format my paper. Now I need to add the name of the conference at the right hand corner of each page. Please advise me how to do that. Mail me at [email protected]. It is really urgent.
I am designing my HTML pages to be completely fluid:
For every element in the mark-up (HTML), I am using 'style="height:%;width:%"' (instead of 'style="height:*px;width:*px"').
This approach seems to work pretty well, except for when changing the window measurements, in which case, the web page elements change their position and end up "on top of each other".
I have come up with a pretty good run-time (java-script) solution to that:
var elements = document.getElementsByTagName("*");
for (var i=0; i < elements.length; i++)
{
if (elements[i].style.height) elements[i].style.height = elements[i].offsetHeight+"px";
if (elements[i].style.width ) elements[i].style.width = elements[i].offsetWidth +"px";
}
The only problem remaining is, that if the user opens up the website by entering the URL into a non-maximized window, then the page fits that portion of the window.
Then, when maximizing the window, the page remains in its previous measurements.
So in essence, I have solved the initial problem (when changing the window measurements), but only when the window is initially in its maximum size.
Any ideas on how to tackle this problem? (given that I would like to keep my "% page-design" as is).
Hi there,
I need to make a program that writes some data to an excel spreadsheet. Something basic along the lines of First name, last name, phone number, e-mail per row with each category in its own column.
I don't even know where to start. If someone could tell me which assemblies to reference and maybe point me to a website or a book that covers writing/reading data from an excel spreadsheet via a c# program that would be great.
Many thanks.
Hi SO gurus.
I would like to try to automize some recurrent job when i develop asp.net application.
For example, for each <asp:button> I create, I would like to insert the classical code
onomouseover="...something"
onmouseout=" ..something-again.."
Is there a way to automatically add this code "piece" in vs 2008?
Some key combination to add "pre-ready" piece of code?
Thank you