Thursday, April 12, 2012

Can pdf kit save images from a url?

I have a node.js application in which I'm using pdfkit to generate pdf documents. I want to be able to include images from a url in the pdf. I cant save the image to the file system because my runtime environment is read only and pdf kit seems to find the images to embed from a file system directory. Is there a way I can use an url in pdf kit to embed an image?





How is exponentiation by squaring faster?

Suppose you want to calculate 5^65537 instead of multiplying 5 65537 times, it is recommended to do ((5^2)^16)*5. This results in 16 times squaring and one multiplication.

But my question is aren't you not compensating the the number of squaring times by squaring very large numbers? how is this faster when you go down to the basic bit multiplication in computers.





Bison token value overwritten - c memory issues?

Okay I have the following code in Bison .l file. By the way I am new to c.



exp: TK_SLIT    // TK_SLIT is a string literal token

/* assigns the type to the nonterminal exp */
$$ ->type = (char *) malloc (strlen ("string") + 1); /* allocates space */
strcpy ($$->type,"string"); /* puts value in there */
printf ("%s\n",$$->type);

printf ("The value of TK_SLIT is - %s\n",$1);


I have figured out that the "assigns type" block of code (4 lines including comment) OVERWRITES the value of TK_SLIT ($1) in memory. The value of TK_SLIT was grabbed from my scanner, FLEX.



I know that the block of code is causing the problem because if I comment out the "assigns type" block of code, then my TK_SLIT token value prints just fine. Otherwise it becomes garbled characters.



Is there something wrong with my malloc? Why is it overwriting my token value? Is this a bison issue where it's not protecting my token values in memory?





"No unexpired provisioning profiles found that contain any of the keychain's signing certificates" Horror

I have seen a few other questions that addressed this topic but none like mine. Yesterday I innocently added a device to the list of devices. I am under the impression that once you add a device, it will now be linked to the provisioning profile. However, I believe it was not linked to one of my distribution profiles. So I went into edit the profile, clicked the checkmark next to the device, and hit submit. This is where the problems began. I notice two things: I recently renewed my certificate/provisioning profiles about a week ago. Now, it thinks I renewed my provisioning profile yesterday ( or at least it says so in the organizer ). Also, when I try to build any project I get the awful "No unexpired provisioning profiles found that contain any of the keychain's signing certificates". In the build settings my signing identity shows up under Identities without provisioning profiles. I have read horror stories of people having to tear everything down and rebuild and I hope I don't have to do that here..





Array of unknown size base on the input file

This is a beginner C++ homework problem, I know about vector, but it is not allowed to use in this assigment. I searched around and I found how to make an array[] of unknown size too. But it is slightly trickly (sort of). The example I read are all along the lines of: get an input, then create the array base on that input (size n).



I have created this student class, but now I need an array to store them. I do not know in advance how many students there are going to be. I only have an input of text file with each student on one line. The format is below, the sample is about 5, but I don't know how many the teacher will use to test my program.



Input file like this:



George Chan Computer_Science New York 23
Johnny Chan Computer_Science New Jersery 22
....


But the problem is I don't know how many students are there until I finish reading the whole text tile (or I don't know if there are other way to do it). My current approach is to read it line by line, increment a counter studentCounter, until I finish, then I create my Student* myRoster = Student[studentCounter]. But then when I have to start reading the file again. And go line by line to parse the information and create a Student object and let a myRoster[x] points to it. I feel like I am sort of doing the work twice just to have the right size. Are there some tricks or things I am missing?



Thank you.





INSERT or UPDATE using IF-ELSE php MYSQL

DONOR
donor-nic----username-----status
111----------ali----------available
222---------usman--------notavailable


another is



DONATION
donation_id------donor_nic-----date---
1----------------111----------2012/03/04
2---------------111-----------2012/06/07
3----------------111---------2012/07/08
4----------------222---------2012/03/03


now i want to update the date if it is already exits corresponding to donor_nic
if date does not exists i want to insert that new date,.



i am using this query to fetching all dates according to corresponding donor_nic



SELECT donor.donor_nic, donation.lastdonationdate
FROM donor
JOIN donation ON donor.donor_nic = donation.donor_nic
WHERE username = 'ali'
GROUP BY donation.lastdonationdate


now this query works in phpmyadmin.. but when i use this in my page.. it does not match date.. i am matching date like this



   $sql= SELECT donor.donor_nic, donation.lastdonationdate
FROM donor
JOIN donation ON donor.donor_nic = donation.donor_nic
WHERE username = 'ali'
GROUP BY donation.lastdonationdate

$res=mysql_query($sql, $con);

if($res == $date)
{
echo "update";
}
else
{
echo "insert";
}


but this thing didnt work.. may be i am making mistake in conditional (if-else) statment.. plz help me what should i do..
thanks in advance





How to update a table column based on it's relation to another table?

I have a table called "profiles". There was a column in this table called "user_id" which I have changed the name to "username" and the type from INT(11) to Varchar(255) . However the contents of this column are still numeric ids.



These ids correspond to another table called "users". That table has fields called "user_id" and "username". For each row on the "profiles" table I need to first check to see what the username field has for the id and do a look up on the users table to get the username that correcponds to that id and then update the profile table's username value for with the proper username.



Profiles table:



username | blah blah...
------------------------
1 | ...


Users table:



user_id | username
------------------------
1 | Joe


I need the value for the username field on the profiles table to be updated to "Joe".



I came up with this php script but it stops working after updating just 4 records for some reason:



    $sql = 'SELECT username FROM profiles';
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query)) {
$id = $row['username'];
$sql = 'SELECT username FROM users WHERE user_id = '. $id;
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query)) {
$sql = "UPDATE profiles SET username = '".$row['username']."' WHERE username = $id";
$query = mysql_query($sql);
if(!$query) {
echo 'error!';
}
}
}


My script isn't all that efficient to begin with, although that's not that big an issue since the table has just 50k records. Anyway what would be a way to do this directly from mysql?





Is it possible to change the Facebook Comments assotiation URL somehow?

We have recently changed our URL scheme of some pages on our site to gain a little SEO boost. For example, domain.tld/$id/slug/ -> domain.tld/$category/slug-$id/.



However the comments associated to the old URLs are now obviously not shown on the new URLs as the links are generated automatically using the new scheme.



As our site is very new, we don't have many comments yet. Obviously we would hate to lose those few comments we already have and would rather migrate their association to the new URL scheme. I haven't found such option on the Comment Moderation Tool and the comments documentation doesn't elaborate on this either. Is that possible at all?





"TypeError: CreateText() takes exactly 8 arguments (5 given)" with default arguments

def CreateText(win, text, x, y, size, font, color, style):
txtObject = Text(Point(x,y), text)
if size==None:
txtObject.setSize(12)
else:
txtObject.setSize(size)

if font==None:
txtObject.setFace("courier")
else:
txtObject.setFace(font)

if color==None:
txtObject.setTextColor("black")
else:
txtObject.setTextColor(color)

if style==None:
txtObject.setStyle("normal")
else:
txtObject.setStyle(style)

return txtObject

def FlashingIntro(win, numTimes):
txtIntro = CreateText(win, "CELSIUS CONVERTER!", 5,5,28)
for i in range(numTimes):
txtIntro.draw(win)
sleep(.5)
txtIntro.undraw()
sleep(.5)


I'm trying to get the CreateText function to create a text object with my "default" values if the parameters are not used. (I've tried it with blank strings "" instead of None and no luck) I'm fairly new to Python and have little programming knowledge.





redirecting to some other page

I have a web application having three pages, one is login page, second is contact page, and third is chat page. The natural sequence to traverse is one to second and from second to third.



Login (using our web service) is required to open second and third page. Now we have a requirement that we want to open third page directly from a third party application.



So, suppose if third page is requested from browser and on the same browser login (using first page) has been made. Then we need to directly show the third page otherwise show the user first page i.e. login page.



The requirement is similar as required facebook page can be opened by clicking an link from gmail page, if facebook user has done login, he can see the desired page directly.



Please help.



Regards





Separating arguments to a function, in locales with comma as decimal marker

In locales, e.g. French, with comma as decimal indicator (where "5,2" means five and two-tenths), how do users separate function arguments from each other?



For example, in many programming/scripting languages, I could specify MAX(1.5, X) in a EN-US locale. How do you avoid the ambiguity between the comma as decimal indicator, and as argument separator?



In particular, I'm interested in how software that's perceived as user-friendly in the foreign locale does it. Obviously, it's a no-brainer to say, "thou shalt use decimal POINTs", but that's not particularly "friendly".





matplotlib: Rescale colors of imshow after zooming in

I'm trying to plot a 2D field using imshow. I'd like the colors to rescale after zooming in so I can see more detail.



The only solution I know of is to take the coordinates of the box returned by a RectangleSelector event and replot a submatrix of the original data. Is there a better solution?





Bug Tracking for Windows and SVN

I'm working as part of a volunatry team creating an open source product with a permissive license. We are currently using Visual SVN Server/TortoiseSVN for source control and TeamCity for our continuous integration builds.



I would like to add a bug tracking component into the mix that will integrate into SVN. Ideally, I'd like to use FogBugz but we have no budget. So, I need an alternative. The requirements are:




  • Must be free or have a free version supporting at least 20 developers (we're volunteers!)

  • Must integrate with VisualSVN Server

  • Must run on Windows

  • I prefer Microsoft technology (ASP.Net over PHP; SQL Server over MySQL, etc) because we are a Microsoft shop, we have experience with those tools and already have them installed.

  • Must be able to work with a geographically distributed team

  • Must work with Express editions of Visual Studio (the developers don't all have the Pro version so we can't rely on Visual Studio add-ins).



I'd like The Community's recommendations, please, for products that meet all of the above requirements.



[Clarification: our license is very close (though not word-for-word) to the MIT license.]





Unpacking a .tgz file in maven

Is there a maven plugin that can do this. Currently I am using the ant plugin but I was wondering if there was another way.



Thanks.





Reagarding the titanium framework

I recently started trying to develop apps using titanium.
When i ran one basic app containing two table views and some static data, it showed me 80 memory leaks and about 15 warnings - i think coming from the frameworks.
As an iOS developer, i'm used to seeing less than 5 memory leaks in complex apps too.
So, I'd like to know whether applications are getting accepted by apple when developed through titanium.
Also, I'd like to know whether,looking at the state of the titanium frameworks,its worth learning it right now.
Thanks in advance!





C# drawing and invalidating 2 lines to meet

If i have 2 lines on a page as such:



   e.Graphics.DrawLine(blackPen, w, h, h, w);
e.Graphics.DrawLine(blackPen, w2, h2, h2, w2);


how would i animate the first line to reach the second line's position?



I have the following method which calculates the distance between two points (i'm assuming i would use this?)



   public int Distance2D(int x1, int y1, int x2, int y2)
{
// ______________________
//d = √ (x2-x1)^2 + (y2-y1)^2
//

//Our end result
int result = 0;
//Take x2-x1, then square it
double part1 = Math.Pow((x2 - x1), 2);
//Take y2-y1, then sqaure it
double part2 = Math.Pow((y2 - y1), 2);
//Add both of the parts together
double underRadical = part1 + part2;
//Get the square root of the parts
result = (int)Math.Sqrt(underRadical);
//Return our result
return result;
}


How would i re-draw the line (on a timer) to reach the second line's position? I've looked a lot into XAML (story-boarding) and such - but i want to know how to do this on my own. Any ideas? I know i would need a method which runs in a loop re-drawing the line after moving the position a tid bit. I would have to call Invalidate() in order to make the line appear as though it's moving... but how would i do this? how would i move that line slowly over to the other line? I'm pretty sure i'd have to use double buffering if i'm doing this as well... as such:



 SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);




Binding fails for new SOAP request in existing project

I've added a new SOAP request to an existing project that already uses a lot of SOAP requests. They all work fine. I add my new one in exactly the same way (code generated from WSDL through Apache CXF), yet somehow it fails.



I get this error:



javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method foo.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:113)
at $Proxy51.foo(Unknown Source)


This is a Grails project, and the code is called like this:



FooRequest request = new FooRequest()
processResponse(order) { getPort().foo(request) }


It's the getPort().foo() at the bottom that apparently fails. In fact, I believe it's not the call that fails, but the creation of the closure, since processResponse() doesn't seem to get executed (I put a println on the first line of that method). Edit: It's the execution of the closure that fails, not the creation. So it really cannot find getPort().foo(), despite the fact that my generated interface does have this method:



public nl.wecompany.portal.webserviceQopi.QOPIResponse foo(
@WebParam(name = "in", targetNamespace = "")
com.myproject.FooRequest in
);


getPort() returns a org.apache.cxf.jaxws.JaxWsClientProxy@41079622, which it also does for other SOAP requests (the ones that work).



I cannot find any meaningful difference between my new code and the existing code. Any ideas what could be wrong? Any suggestions on where to look?



Edit: port.metaClass.methods*.name.sort().unique() does include my new foo() method. Yet when I call it, I get this weird wsdl:binding error, and the method doesn't get executed (it doesn't reach the println on the first line).



Edit: anonymized some stuff I intended to anonymize.





GPS is not enabled but isProviderEnabled() is returning true

I can check if GPS is on or not using isProviderEnabled(). If it is not on, I am launching intent so that user can enable GPS.
At the end I am again checking if GPS is enabled by user or not.
If user does not enable GPS and come out, still isProviderEnabled() is returning NULL.
What could be the issue ? Please guide me.



    String provider = LocationManager.GPS_PROVIDER;
// Check if GPS is enabled
boolean enabled = myLocationManager.isProviderEnabled(provider);

if (!enabled) {
// GPS not enabled
Log.d("", "Provider " + provider + " is not enabled");
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
// Consider the case when user does not enable GPS and come out.
} else {
Log.d("", "Provider is enabled");

}

// Re-check if user has enabled or not. (Note: case: user has not enabled GPS)
enabled = myLocationManager.isProviderEnabled(provider);
if(!enabled)
{

Log.d("","provider not enabled");
}
else
{
// Control is coming here though user has not enabled GPS in settings
Log.d("","GPS is enabled");
}


Thanks,
Biplab





What are the uses of ruby's Hash.replace or Array.replace?

I always see replace in the Array and Hash documentation and I always think that it's odd.


I'm sure I've done something like this many times:


a = [:a, :b, :c, :d]
 
 ...
 
 if some_condition
     a = [:e, :f]
 end
 


But I never thought to use this instead:


a = [:a, :b, :c, :d]
 
 ...
 
 if some_condition
     a.replace [:e, :f]
 end
 


Which I assume is the intended use. Does this really save memory, or have some other benefit, or is it just a style thing?



Answer:


a = [:e, :f] and a.replace [:e, :f],
the two statements generated instructions as follows:
1.
a = [:a, :b, :c, :d] 
a = [:e, :f] 
instructions:
ruby --dump=insns test.rb
== disasm: <RubyVM::InstructionSequence:<main>@test.rb>================= 
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1) [ 2]0000 trace            1                                               (   1) 0002 duparray         [:a, :b, :c, :d] 0004 setdynamic       a, 0 0007 trace            1                                               (   2) 0009 duparray         [:e, :f] 0011 dup 0012 setdynamic       a, 0 0015 leave 
2.
a = [:a, :b, :c, :d] 
a.replace([:e, :f]) 
instructions:
ruby --dump=insns test.rb
== disasm: <RubyVM::InstructionSequence:<main>@test.rb>================= 
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1) [ 2]0000 trace            1                                               (   1) 0002 duparray         [:a, :b, :c, :d] 0004 setdynamic       a, 0 0007 trace            1                                               (   2) 0009 getdynamic       a, 0 0012 duparray         [:e, :f] 0014 send             :replace, 1, nil, 0, <ic:0> 0020 leave 
The replace method is not faster than assignment operator, but replace can modify receiver array in-place, and, replace method really save memory, this can be seen from rb_ary_replace's source.
VALUE 
rb_ary_replace(VALUE copy, VALUE orig) { 
rb_ary_modify_check(copy); 
orig = to_ary(orig); if (copy == orig) return copy; 
 if (RARRAY_LEN(orig) <= RARRAY_EMBED_LEN_MAX) { 
    VALUE *ptr; 
    VALUE shared = 0; 
 
    if (ARY_OWNS_HEAP_P(copy)) 
    { 
        xfree(RARRAY_PTR(copy)); 
    } 
    else if (ARY_SHARED_P(copy)) 
    { 
        shared = ARY_SHARED(copy); 
        FL_UNSET_SHARED(copy); 
    } 
    FL_SET_EMBED(copy); 
    ptr = RARRAY_PTR(orig); 
    MEMCPY(RARRAY_PTR(copy), ptr, VALUE, RARRAY_LEN(orig)); 
    if (shared) 
    { 
        rb_ary_decrement_share(shared); 
    } 
    ARY_SET_LEN(copy, RARRAY_LEN(orig)); } else { 
    VALUE shared = ary_make_shared(orig); 
    if (ARY_OWNS_HEAP_P(copy)) 
    { 
        xfree(RARRAY_PTR(copy)); 
    } 
    else 
    { 
        rb_ary_unshare_safe(copy); 
    } 
    FL_UNSET_EMBED(copy); 
    ARY_SET_PTR(copy, RARRAY_PTR(orig)); 
    ARY_SET_LEN(copy, RARRAY_LEN(orig)); 
    rb_ary_set_shared(copy, shared); } return copy; } 

How can I use server side file to track users who must interact with one another? ASP.NET/C#

I'm running Visual Basic '08 and using C# code. I am using forms however, but it is browser based. I'm using StreamReader and StreamWriter to read and write information to the server side file. The situation is a TicTacToe game, so the rules are clear, and there are 9 buttons, when a button is pressed, the text on it changes accordingly to the player's X or O. The game is played on two browsers or tabs, so the browser must interact with the server.



I really want to know how I can keep track of the moves each players has taken by reading and writing data from server side file to so then I can check for winner. I am saving the game data into a text file, that's the server side file I'm talking about.



Thanks for your time.





Android folder monitor

Am using sdcard for saving data ,my problem is that when app is running and some one delete this folder then the application fail. Is there anyway to notify the app , when this folder get deleted ?. Please help me



Answer:


Try like this.
 private static File logFile = null; 
    String SD_CARD_PATH = Environment.getExternalStorageDirectory().toString(); 
    logFile = new File(SD_CARD_PATH + "/" + "folderName"); 
    if (logFile.exists()){ 
       //exist.so do your work 
    } 
    else{ 
      //not exists 
    } 

How Java and NodeJS communicate in backend?

I have already done a project using jsp as backend, while the business logic in backend is implemented by java. Now I want to rewrite this project.I hope the part of backend communicating with browser is implemented with nodejs and the business logic in backend still use java to implement.Now I met with a problem about how to communicate between nodejs and java in backend. Is there any feasible solution? Thanks





I need help getting Javascript to read an HTML form, and assign it to a specific array

I need help getting javascript to read an html input form, and assign the input to an array, or atleast what i think is an array....im not sure.



i want to take the data from an html form, and put it in here:



var users = ['"This is a random qoute"-lastname,firstname."','"This is a random
qoute"-lastname,firstname."'];


is this possible?





C - Trouble inputting doubles to array

I know C++ fairly well and was told to translate a program I had written in C++ to C for use in a different setting. I have never written code in plain C before and I am running into some trouble. The following function is supposed to read a .txt file and input the values within to a double array, however whenever I print the array, all values are: -92559631349317831000000000000000000000000000000000000000000000000000.00000. However if I manually change a value in the code before printing I get the correct value. Here is the input function:


    void FileRead(double *AttPos)
 {
 int j = 0;
 FILE *in_file;
 in_file = fopen("DragonData.txt", "r");
 
 if (in_file == NULL)
 {
     exit(1);
 }
 
 else
 {
     for(j; j<8; j++)
     {
         fscanf(in_file, "%lf", &AttPos[i]);
     }
 
     fclose(in_file);
 }
 }
 


And here is the input file:


12345
 0.13717085
 0.91813290
 0.73543816
 -0.67362091
 111
 -63
 11000
 



Answer:

I think it is due to a mistake in your code.

for(j; j<8; j++) { 
    fscanf(in_file, "%lf", &AttPos[i]); } 

That array index should be j not i, your values aren't actually being put into the array.

quantifier elimination over bit vectors produces overly complicated results

I am using the ELIM_QUANTIFIERS feature of Z3 to eliminate quantifiers from formulas over bit vectors. I ran into the following situation where Z3 produces a correct, yet overly complicated result, and I was wondering whether there exists a way to re-write my problem or perhaps a configuration option that would lead to the simple result I expect.



First, here is an example that works as expected. It states that for a bit vector of length 4 there exists a bit vector that is equal to it.



(set-option ELIM_QUANTIFIERS true)
(declare-fun a () BitVec[4])
(simplify (exists ((x BitVec[4]))
(= a x)))


Z3 generates the following output for this example.



success
success
true


However, if I add a negation:



(set-option ELIM_QUANTIFIERS true)
(declare-fun a () BitVec[4])
(simplify (exists ((x BitVec[4]))
(not (= a x))))


then Z3 produces the following output, which lists all possible values of the vector instead of just returning "true".



success
success
(let (($x54 (= (_ bv0 4) a)))
(let (($x55 (not $x54)))
(let (($x61 (= (_ bv2 4) a)))
(let (($x62 (not $x61)))
(let (($x68 (= (_ bv6 4) a)))
(let (($x69 (not $x68)))
(let (($x75 (= (_ bv4 4) a)))
(let (($x76 (not $x75)))
(let (($x82 (= (_ bv12 4) a)))
(let (($x83 (not $x82)))
(let (($x89 (= (_ bv8 4) a)))
(let (($x90 (not $x89)))
(let (($x95 (= (_ bv1 4) a)))
(let (($x96 (not $x95)))
(let (($x102 (= (_ bv5 4) a)))
(let (($x103 (not $x102)))
(let (($x109 (= (_ bv13 4) a)))
(let (($x110 (not $x109)))
(let (($x116 (= (_ bv9 4) a)))
(let (($x117 (not $x116)))
(let (($x123 (= (_ bv3 4) a)))
(let (($x124 (not $x123)))
(let (($x130 (= (_ bv7 4) a)))
(let (($x131 (not $x130)))
(let (($x137 (= (_ bv14 4) a)))
(let (($x138 (not $x137)))
(let (($x144 (= (_ bv10 4) a)))
(let (($x145 (not $x144)))
(let (($x151 (= (_ bv11 4) a)))
(let (($x152 (not $x151)))
(let (($x158 (= (_ bv15 4) a)))
(let (($x159 (not $x158)))
(or $x159 $x152 $x145 $x138 $x131 $x124 $x117 $x110 $x103 $x96 $x90 $x83 $x76 $x69 $x62 $x55)))))))))))))))))))))))))))))))))


For longer bit vectors, e.g., of size 32 or more, Z3 does not produce a result in a reasonable time, as it is presumably enumerating all possible values of the 32-bit variable.



Note that in this particular case I could just use check-sat to check the validity of the formula; however in the general case I am interested in obtaining a quantifier-free expression equivalent to the original formula, rather than just checking its validity.



I am using Z3 v3.2 for Linux.





wpf fixeddocument dynamic data

I am creating FixedDocument and adding pages to it dynamically.


FixedDocument fd = new FixedDocument();   
 while(loop)
 {
     Pageint();
     FixedPage page1 = new FixedPage();
     page1.Width = visual1.DocumentPaginator.PageSize.Width;
     page1.Height = visual1.DocumentPaginator.PageSize.Height;
     page1.Children.Add(vCanvas);
 
     PageContent page1Content = new PageContent();
     ((IAddChild)page1Content).AddChild(page1);
     visual1.Pages.Add(page1Content);
 }
 
 private void Pageinit()
 {
     TextBlock tb = new TextBlock();
     tb.Text = "From Data";
     vCanvas.Children.Add(tb);
 }
 


This code gives the following error:



"Specified Visual is already a child of another Visual or the root of
a CompositionTarget."



What could be the problem.



Answer:

It is an easy error to diagnose; an visual can only ever have one parent as otherwise you would have a circular dependency in the VisualTree. Review your code to check if you are using the same visual twice.
If you want the visual to appear in two places simultaneously then you need to duplicate it; if the second use is intentional then you can un-parent visual by removing itself from the parent. e.g. (canvas.Parent.Remove(canvas)).
In the code sample posted I can identify at least one instance of where this would occur and have detailed this below.

You are adding the instance of vCanvas to more than once in your while(loop) block. You need to create a new Canvas for each iteration.
var visual = /* unknown */; var fd = new FixedDocument();    while(loop) { 
    var canvas = PageInit(); 
    var page = new FixedPage(); 
    page.Width = visual.DocumentPaginator.PageSize.Width; 
    page.Height = visual.DocumentPaginator.PageSize.Height; 
    page.Children.Add(canvas); 
 
    PageContent pageContent = new PageContent(); 
    ((IAddChild)pageContent).AddChild(page); 
    visual.Pages.Add(pageContent); } 
For the purposes of this example, I will the Canvas in the PageInit().
private Canvas PageInit() { 
    var tb = new TextBlock(); 
    tb.Text = "From Data"; 
    var canvas = new Canvas(); 
    canvas.Children.Add(tb); 
 
    return canvas; } 

How to use a FileSystemRegistry in Android to list All the Files?

I am new to Android and I want to upload the Files to my Server from Android Phone,for that I want to list All the Files. So how I can do this using FileSystemRegistry or some another method?





At what index I have to add --select name-- in dropdownlist

I have dropdownlist,which get filled from table1.That table1 has Zero value.While filling the dropdown,want to add "--select Name--".But at what index I have to add the select Name.I can not add it at -1 position.





Getting parse error while installing the application in android 4.0.4

04-12 09:41:33.425: W/PackageInstaller(5015): Parse error when parsing manifest. Discontinuing installation
04-12 09:41:33.425: W/PackageParser(5015): Unable to read AndroidManifest.xml of /mnt/sdcard/Download/downloadfile.apk
04-12 09:41:33.425: W/PackageParser(5015): java.io.FileNotFoundException: AndroidManifest.xml
04-12 09:41:33.425: W/PackageParser(5015): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
04-12 09:41:33.425: W/PackageParser(5015): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
04-12 09:41:33.425: W/PackageParser(5015): at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:455)
04-12 09:41:33.425: W/PackageParser(5015): at android.content.pm.PackageParser.parsePackage(PackageParser.java:425)
04-12 09:41:33.425: W/PackageParser(5015): at com.android.packageinstaller.PackageUtil.getPackageInfo(PackageUtil.java:74)
04-12 09:41:33.425: W/PackageParser(5015): at com.android.packageinstaller.PackageInstallerActivity.onCreate(PackageInstallerActivity.java:277)
04-12 09:41:33.425: W/PackageParser(5015): at android.app.Activity.performCreate(Activity.java:4465)
04-12 09:41:33.425: W/PackageParser(5015): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-12 09:41:33.425: W/PackageParser(5015): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
04-12 09:41:33.425: W/PackageParser(5015): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
04-12 09:41:33.425: W/PackageParser(5015): at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-12 09:41:33.425: W/PackageParser(5015): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-12 09:41:33.425: W/PackageParser(5015): at android.os.Handler.dispatchMessage(Handler.java:99)
04-12 09:41:33.425: W/PackageParser(5015): at android.os.Looper.loop(Looper.java:137)
04-12 09:41:33.425: W/PackageParser(5015): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-12 09:41:33.425: W/PackageParser(5015): at java.lang.reflect.Method.invokeNative(Native Method)
04-12 09:41:33.425: W/PackageParser(5015): at java.lang.reflect.Method.invoke(Method.java:511)
04-12 09:41:33.425: W/PackageParser(5015): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-12 09:41:33.425: W/PackageParser(5015): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-12 09:41:33.425: W/PackageParser(5015): at dalvik.system.NativeStart.main(Native Method)



Could you please how to resolve this issue..Thanks in advance..





Code Sign error: No unexpired provisioning profiles found that contain any of the keychain's signing certificates

I think I've reached the nadir of iOS provisioning hell. After migrating to a new mac and doing an archive for distribution, I received the error:



Code Sign error: No unexpired provisioning profiles found that contain any of the keychain's signing certificates



I then erased all certs and keys and provision profiles and did a "hard reset" (deleting all keys, certs, and profiles), following Apple's instructions by hand, with the same error. Then I did another hard reset and then had Xcode handle the whole thing via the Organizer, did another archive - only to see the same error.



I have all certs (WDRCA, Developer ID Cert Authority, iPhone Dev, iPhone Distribution) showing in Keychain Access, Xcode shows that it sees the dev and distribution certs, as well as the provisioning profiles, all marked with a green checkmark and "valid" status.



Code signing within the app show the correct dev and distribution is selected.



What's really troubling is that a Google search on the error shows one tech note from Apple that isn't very helpful, 2 tweets, and 3 results in Japanese - and nothing else. I contacted one of the tweeps and he said he fixed it with a hard result, which I have done twice.



Any ideas on where to go or what to do next?