Home » Web Development » Page 6743

I have a dataset with several different measures (questionnaires)
in it. Each record has the score for one participant, at one
timepoint, on one of the measures. I am iterating over the list of
measures, creating a line graph for each one, and saving that graph as
a PDF with a filename based on the measure's number (e.g.,
graph6.pdf).



This all works fine, except that the PDFs that are created seem to
be corrupted (see below for specific error messages). What's odd is
that if I pick any one measure and run the same code for that measure,
it works fine -- it's only when I run them all in a loop that I get
broken PDFs.



Question: Why would creating a file or filename within a
loop produce broken PDFs?



Specifics: I'm using R 3.1.0 on Mac OS 10.9. When opening the
broken PDFs in Preview, I get the error "It may be damaged or in a
file format that Preview doesn't recognize." When opening them in
Adobe Reader, I get "There was an error opening this document. This
file cannot be opened because it has no pages."



Example: Below is a minimal example (the real code
does a lot more processing in the loop, so it wouldn't work to use a
more idiomatic apply approach).



data:



library(ggplot2)
df<-structure(list(measure = c(1, 1, 1, 1, 2, 2, 2, 2), month =
c(3, 6, 12, 18, 3, 6, 12, 18), mean = c(-0.4,-1, -1.03, -0.85, -6.71,
-6.94, -7.86, -6.77)), .Names = c("measure", "month", "mean"),
row.names = c(NA,8L), class = "data.frame")


This produces two PDFs, graph1.pdf and graph2.pdf, neither of which
I can open:



for(i in min(df$measure):max(df$measure)) {
g1<-df[df$measure==i,]
fn<-paste0("measure",i,".pdf")
pdf(file=fn)
ggplot(g1, aes(x=month, y=mean)) + geom_line()
dev.off()
}


However, running the same code outside of a loop produces 2 pdfs
that I can open without problems:



i<-1
g1<-df[df$measure==i,]
fn<-paste0("measure",i,".pdf")
pdf(file=fn)
ggplot(g1, aes(x=month, y=mean)) + geom_line()
dev.off()

i<-2
g1<-df[df$measure==i,]
fn<-paste0("measure",i,".pdf")
pdf(file=fn)
ggplot(g1, aes(x=month, y=mean)) + geom_line()
dev.off()

I have this set of data that I get from html form. It
is basically a multidimensional array.



Data



array(3) {
["r1"]=>
array(2) {
[0]=>
string(1) "2"
[1]=>
string(1) "4"
}
["r2"]=>
array(2) {
[0]=>
string(1) "5"
[1]=>
string(2) "96"
}
["tekma_id"]=>
array(2) {
[0]=>
string(1) "7"
[1]=>
string(1) "8"
}
}


Problem: What i want to do, is to go over this
array and for each iteration create a data
variable(array).



So for example:



First iteration:



$data = array(
'r1' => '2'
'r2' => '5'
'tekma_id' => '7'
)


Second iteration:



$data = array(
'r1' => '4'
'r2' => '96'
'tekma_id' => '8'
)


I've tried with this:



foreach ($data as $key => $value) {
foreach ($value as $index => $v) {
echo "<br>";
echo "r1: $v";
echo "<br>";
echo "r2: $v";
echo "<br>";
echo "tekma_id: $v";
}
}


But it didn't work. Sorry for my bad english and thanks for any
help.
Cheers!

I want to get element value of language (Women) & categories
xlink( rel="nofollow">http://test.com/api/categories/4 & href="http://test.com/api/categories/8"
rel="nofollow">http://test.com/api/categories/8) from associations
element. i tried to get name but language element keep repeating so i
get other values in my array besides name.



I have not added code to get xlink because i am trying to get name
right now, so suggest me to get xlink of categories.



I am looking for library/parser for prestashop webservice.



Here is the xml response:-



 <?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<category>
<name>
<language id="1"
xlink:href="http://test.com/api/languages/1"><![CDATA[Women]]></language>
</name>
<link_rewrite>
<language id="1"
xlink:href="http://test.com/api/languages/1"><![CDATA[women]]></language>
</link_rewrite>
<description>
<language id="1"
xlink:href="http://test.com/api/languages/1"><![CDATA[<p><strong>You
will find here all woman fashion collections.</strong></p>
<p>This category includes all the basics of your wardrobe
and much more:</p>
<p>shoes, accessories, printed t-shirts, feminine dresses,
women's jeans!</p>]]></language>
</description>
<meta_title>
<language id="1"
xlink:href="http://test.com/api/languages/1" />
</meta_title>
<meta_description>
<language id="1"
xlink:href="http://test.com/api/languages/1" />
</meta_description>
<meta_keywords>
<language id="1"
xlink:href="http://test.com/api/languages/1" />
</meta_keywords>
<associations>
<categories node_type="categories">
<categories
xlink:href="http://test.com/api/categories/4">
<id><![CDATA[4]]></id>
</categories>
<categories
xlink:href="http://test.com/api/categories/8">
<id><![CDATA[8]]></id>
</categories>
</categories>
</associations>
</category>
</prestashop>


Here is my code



-(void)parser:(NSXMLParser *)parser
didStartElement:(NSString *)elementName namespaceURI:(NSString
*)namespaceURI qualifiedName:(NSString *)qName
attributes:(NSDictionary *)attributeDict
{
if ([elementName isEqualToString:@"language"])
{
results = [attributeDict objectForKey:@"name"];
recordResults = TRUE;
}
}

-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
results = [[NSMutableString alloc] initWithString:[string
stringByTrimmingCharactersInSet:[NSCharacterSet
whitespaceAndNewlineCharacterSet]]];
}

-(void)parser:(NSXMLParser *)parser didEndElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName
{
if ([elementName isEqualToString:@"language"])
{
recordResults = FALSE;
[test addObject:results];
results = nil;
}
}

I have a Jenkins instance running behind a firewall and I do not
want to expose the Jenkins UI to the internet. (Even with security on,
that is definitely not an option).
My wish would be to open a different port, that is only able to
trigger builds, but not exposes the UI. I browsed the plugin list, but
I did not find any suitable plugin.
My current setup is running apache as a proxy and allowing the trigger
via regex-module on a different port. (But not any other URL).
The apache does to much extra load (and memory, its a very small
machine), so I would really like to get rid of it.
Has anybody a suggestion how to allow triggers via an open port, but
not exposing the Jenkins UI or other Jenkins URLs through that
port?

I am developing a GUI on MATLAB and for some unknown reason I am
unable to get the callback function of any new button I am adding.



I remember when putting in a new button I should just put the
button on the GUI and press save, the function is generated
automatically.



For some reason it is not doing that anymore!
This below does not show up anymore:



function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
display('Goodbye');
close(gcf);


Also, if I right click on a button and go to the callback function,
only the property inspector is opened.



I dont know whats going on it can be something really stupid that I
am missing but any help would be great!



Thanks;

I have created telerik report wizared, Now i want write code in vb
class file to connect entity datasource with entity model. How can i
do this?

I am trying to append index value to element using the loop. i made
a closure to avoid the multiple index appended.



but my closure function still adding the
multiple(previous) index to dom



    var $newdiv =
$('.div').clone().removeClass('div').addClass('show')
$col = $('<div />');
var add = function () {
for(var i=1; i<=10; i++){
(function x (n) {
return function () { //not working!
$newdiv.find($('a
span').append(n)).end().clone().appendTo($col);
}();
}(i));
}

}

$col.appendTo('#content');
$('button').click(function () { add()});
$('#content').slimScroll({});


rel="nofollow">Live

How can I convert a dateutil.relativedelta object to a
datetime.timedelta object?



e.g.,



# pip install python-dateutil

from dateutil.relativedelta import relativedelta
from datetime import timedelta

rel_delta = relativedelta(months=-2)
# How can I convert rel_delta to a timedelta object so that I can call
total_seconds() ?
time_delta = ???(rel_delta)
time_delta.total_seconds() # call the timedelta.total_seconds()
method

Can i change the color of text in an "li" html tag on
mouseover?





<li style=" border:2px;
border-color:white;">
<a href="testrequestform.php" title=" Test Request">Test
Request</a>
</li>



I search the document but I don't find anything about ACL
implementation in cakephp 3.
How can I implement authorization with ACL in cakephp 3?


- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow