Currently I am using VB.net to upload files to BOX API, But having issue overwriting a file. I want to use Version upload But where do I need to add the Path parameter or any other necessary parameters to accomplish this? :
Dim tokenProvider As New TokenProvider(clientID, clientSecret)
boxManager.CreateFile("0", "file_name", (file_Stream))
Thanks
Related
My game relies on a resource folder Located in C's Program Files called 'resources' using pretty basic code to make up the front end of the game
Public Module getItem
Public Item = Image.FromFile("C:\Program Files\GameName\resources\ItemName.gif")
End Module
to get a picture or video, or text as such I'm pulling the request as such for an update
Dim req As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("dropbox link to folder")
Dim res As System.Net.HttpWebResponse = request.GetResponse()
Dim ss As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim version As String = ss.ReadToEnd()
so it knows to update but grabbing the entire contents and redownloading it if there's an update in the folder is where im not understanding how i would want to do this in an simple fashion without exhausting memory.
Im familiar with
webclient.DownloadFile("database", FolderName)
This being a method in which you get a .zip folder, which requires unpacking and locating and replacing files and it just feels inefficient.
But if i only make a few changes is there a way to recognize the change and ONLY download the new images that are needed to that resource file without re-downloading everything (300 MB) or if it need be; to re-download everything (replace i suppose), is there a way to unpack the dropbox folder contents that's online into being a download via just picture into the file? I've given thought to the idea of possibly isolating them to a new folder named 'updated content' that just pulls the new pictures/music/videos out each download. Would that be a viable solution? the idea is to throw the new content in the folder to be read. I can just have the EXE updated and with that comes the new code to pull the new content by X method. Doesn't anyone know of a easier way of possibly doing this, i'd like to stick to Dropbox if at all possible.
Any help or advice is greatly appreciated, Thank you.
Central Notes: 'Dropbox Folder Download'
Am tryng to automatically generate pdfs using html2pdf class. I got the following code which is working fine, only that someone has to save the pdf manually. However, Whenever a new product is added, I would like to automatically save the pdf to some folder without user intervention, and store this value in a database for future reference.
How do I go about saving the pdf 'silently' i.e. in the background without showing any popups or requiring the user to intervene?
Thanks in advance.
include('pdf_content.php');
$content = ob_get_clean();
// convert to PDF
require_once('html2pdf/html2pdf.class.php');
try
{
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
//$html2pdf->Output($file_name.'_'.date("dmY").'.pdf');
$html2pdf->Output($product_id.'_'.$file_name.'_'.date("dmY").'.pdf');
You can try calling this script everytime a new product is added, although then you wouldn't really do it in the "background"...
For more information, please note the question "How can I run a PHP script in the background after a form is submitted?"
EDIT:
If you wish to save the file on the server instead of outputting it to the browser, you can use different parameters. See also the html2pdf-wiki. Be aware that you cannot save the file on the user's computer unnoticed!
$html2pdf->Output('directory/file_xxxx.pdf', 'F');
I'm new to Windows 8 app development. I'm trying to port a old application I wrote in .NET. This application uses base data which is stored as four XML files that were added to the project as "Ressource" and deserializes them using the System.Xml.Serialization.XmlSerializer.
What would be the best way to ship data like this with an Windows 8 Store App? Just put them in the Assets Folder?
What is the best way to load and bind data like this in an Windows 8 app?
I'm grateful for everything you can give me, a direct answer, helpful links or an video on data loading and binding in Windows 8 ...
You can use resources in store app, here is the example :
public static string GetXmlContentsFromResource(Assembly asm, string dataName)
{
string contents = "";
Stream stream = asm.GetManifestResourceStream(asm.GetName().Name + "." + dataName);
using (StreamReader reader = new StreamReader(stream))
{
contents = reader.ReadToEnd();
}
return contents;
}
You should add XML files to solution and mark it as "Embedded Resource", and if you put XML files in subdirectory, for example if folder is named Data and xml file is Data1.xml then you should send parameter dataName to above method like this "data.Data1.xml".
For Data Binding best aproach is to deserialize that XML to object or list of objects that reflects XML contents.
What would be the best way to ship data like this with an Windows 8 Store App? Just put them in the Assets Folder?
Yes, put them in your assets folder. Be sure to set the build properties to "Content" + "Copy To Output". Once you have done this, you can access them from your app using the following url: ms-appx:///Assets/myxmlfile.xml
For example:
StorageFile xmlFile = await StorageFile.GetFileFromApplicationUriAsync
(new Uri("ms-appx:///Assets/myxmlfile.xml"));
The above gives you a file object that you can use to read your file. Obviously, since you are reading from the Assets folder, your file will be read-only.
What is the best way to load and bind data like this in an Windows 8 app?
As to data binding, that is probably a bit too large to cover in one answer. You might want to take a look at this Windows 8 Data Binding Sample.
I'm trying to take and save a photo using a windows surface device.
I'm using the code below to take a photo and this work but I'd like to automatically create a directory on the device's local drive and save this photo there without any dialog prompts.
So the code I use to capture to photo is as follows:
CameraCaptureUI camera = new CameraCaptureUI();
StorageFile file = await camera.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (file!=null)
{
using (IRandomAccessStream ras=await file.OpenAsync(FileAccessMode.Read))
{
BitmapImage source = new BitmapImage();
source.SetSource(ras);
imageBuildingPhoto.Source = source; // this is just an image control.
}
}
So after this I'd like to automatically save the photo to a new directory. e.g.
My Pictures\NewDirectory\Photo1.jpg
Anybody got any idea how I can do this?
This is a windows store application written using C#4.5 and XAML.
Thanks in advance
Use the CopyAsync method on the StorageFile object you get back (file). You can specify a directory and file name. If you need to create your own directory structure, you will need to enable access to the appropriate library in the Package Manifest then create it in code. You will then use the StorageFolder class and its CreateFolderAsync method to create folders.
http://aka.ms/30Days has some great resources for learning about scenarios like this. Might be worth checking out.
Your code will need to look to see if that folder exists and create it if it does not. Your app will need to declare the capability to access the user's Photos library in the app manifest, too.
To take a picture, your code is correct. I have a walkthrough in case you want to verify it against some other code: http://blog.jerrynixon.com/2012/10/walkthrough-capturing-photos-in-your.html
To interact with the file system, this can be tricky, but I have a longer write up on that if you want to reference it: http://blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html
The answer to your question is, yes you can. I have done it in my own apps. Now, it's just a matter of you implementing it in yours. You will find it to be pretty easy.
I am trying to navigate to a website with json data using the webbrowser controls but it keeps prompting me to download the file instead of properly navigating to the page as firefox would.
I have tried doing a regular navigate:
frmBrowser.WebBrowser1.Navigate("http://us.wowarmory.com/auctionhouse/money.json")
As well as editing the header content type with many different types:
frmBrowser.WebBrowser1.Navigate("http://us.wowarmory.com/auctionhouse/money.json", "", Nothing, "Content-Type: text/plain" & vbCrLf)
But cant seem to get it working.. Keep in mind I need to use the webbrowser to navigate as you have to be logged in to access this file.
Edit: Also, manually editing my computers registry won't work as I need to distribute this program.
Edit2: Just wanted to add that this code would work if it were the same session, but since it webclient creates a new session it doesn't work
Dim oWeb As New System.Net.WebClient()
oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes(params)
Dim bytRetData As Byte() = oWeb.UploadData(url, "POST", bytArguments)
Return System.Text.Encoding.ASCII.GetString(bytRetData)
If your application will allow it, just rename it to money.json.html or something similar. Will download without a problem.