Box
Swift µframework of the ubiquitous Box<T> & MutableBox<T> reference types, for recursive value types & misc. other purposes.
I would like to display in the message dialog box the output of a variable.
msgbox('Your answer is ');
The variable's name is var and it equals 2. How may I edit the code so that I display the value of that variable there (where the blank space is)?
Input would be much appreciated.
Source: (StackOverflow)
My plot (with xyplot
, lattice
) looks like:
It looks pretty good, but how can I control the height of the grey panel-boxes?
I tried:
strip=strip.custom( par.strip.text=list(cex=2,lines=5,lineheight=2))
but this doesn't work.
Source: (StackOverflow)
I am using the latest Box SDK for interacting with the Box API.
I am able to successfully upload, download, delete and upload new version of a file.
However, I am unable to to delete one file version out of many, as suggested on the SDK page :
BoxDefaultRequestObject requestObj = new BoxDefaultRequestObject();
requestObject.getRequestExtras.setIfMatch(etag); //etag is file version starting from 0
boxClient.getFilesManager().deleteFile(fileId, requestObj);
This fails to delete the version and instead deletes the entire file.
Similarly, I am unable to download a specific file version either.
Code for download :
BoxDefaultRequestObject downloadReq = new BoxDefaultRequestObject();
downloadReq.getRequestExtras().setIfMatch(versionId);
InputStream is = boxClient.getFilesManager().downloadFile(fileId, downloadReq);
This downloads the latest version only.
Can anyone suggest how to make it work?
Source: (StackOverflow)
I am working on a project in java for class and I need to add a comment box above each of my methods explaining what each method does. It's supposed to look like this:
***** *** ** ** ** (asterisk line) *************************************************************************
*@param
*
**** *** ** ** ** **(another line) *********************************************************************
I am using eclipse and I know there is a shortcut that makes this box but I can't seem to remember it or find it on the web...
Source: (StackOverflow)
I am trying to download a large number of files from a Box.com user account. It works fine most of the time, but sometimes the download just freezes.
This is the call that is stalling:
boxClient.getFilesManager().downloadFile(itemId, requestObject);
Sometimes it fails after about 20 files, and other times it can go on downloading files for an hour before the freeze happens.
Maybe a timeout setting would solve the problem, but there is no obvious place for that. I tried to add a timeout value to the HTTP headers with no luck. The code looks like this:
boxClient = new BoxClient(clientId, clientSecret, null, null, createRestClient(), null);
...
private IBoxRESTClient createRestClient() {
return new BoxRESTClient() {
@Override
public HttpClient getRawHttpClient() {
HttpParams params = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(params, 10000);
return new DefaultHttpClient(params);
}
};
}
Does anybody know why this freeze happens, and maybe how I can investigate it further?
Edit: I am using v3.0.10 of the java lib, which is the latest version right now.
Source: (StackOverflow)
I am using box API to get the meta-data for files stored in a box folder. When I make the API call, I get all the metadata including the download URL, but it is null for all files.
I have to manually go to each file, and then have to click on share link to generate their download URL. Is it possible to auto-generate download URL for a file as soon as it arrives in the box folder??
Source: (StackOverflow)
Hello Stack Overflow community!
I've been trying to come up with an algorithm that takes n boxes as input with unknown dimensions for width, height and depth and outputs the maximal number of these boxes that can be packed in a sequence. In order to pack a box into another a box needs to have a smaller width, lenght and depth. You can also tilt the boxes in any way you want in order to make them fit. However they must be axis aligned.
I thought i had come up with a solution where I sorted all boxes on volume and then tried to pack every box in a sequence in a fashion similiar to selection sort, but selection "pack" i guess. In which i tried to pack the box with the lowest dimension into the next one that is larger, etc. Then i tried the second box and tried to pack all those who were larger. Anyway I'm stuck and would really appreciate some help!
Great thanks!
Source: (StackOverflow)
I have a website I have built in Django 1.8 which must load in a Box.com iframe. However it is not loading in Chrome and I get the x-frame-options SAMEORIGIN error.
But I have added the following middleware classes:
MIDDLEWARE_CLASSES = (
# Default Django middleware.
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
and in my views.py added the xframe_options_exempt decorator like so:
@api_view(['GET'])
@xframe_options_exempt
def category_list(request):
"""
List all categories.
"""
if request.method == 'GET':
categories = Category.objects.order_by('-category_type')
serializer = CategorySerializer(categories, many=True)
return Response(serializer.data)
Plus I have tried adding the following setting with no luck:
X_FRAME_OPTIONS = 'ALLOW-FROM https://app.box.com/'
Can anyone help me discover why this is still not allowing the page to load?
Do I also need to add the decorator function in urls.py like this?
from django.views.decorators.clickjacking import xframe_options_exempt
urlpatterns = patterns('base.views',
url(r'^categories$', xframe_options_exempt(category_list)),
)
Thanks very much for any help.
Source: (StackOverflow)
So I've been having this problem and I was hoping anyone I know can help me out with this. So far, with no luck. But here is my Ask box on tumblr. Whenever I hover my mouse over the box, it not only wont let me type, but it shows me my interactions like it's a post. I asked my friends to check it out too, and they can't do anything on it either.
I don't know what part of my CSS/HTML is causing this problem, and how to fix it. :( It's really bothering me. And it's the same with my submission box.
My CSS/HTML is generated through this tumblr theme generator.
Can anyone help me?
Source: (StackOverflow)
I am having issue with box-sdk (https://github.com/box/box-windows-sdk-v2) upload API.
Issue :
When try to upload large file (more than 3MB) (file less than 3mb works great.)
Upload api fails and throws below exception.
Error :
ToString :
System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at XXXX.Program.d__34.MoveNext() in d:\Gaurav\TFS\XXXX\XXXX\Program.cs:line 319
---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---
StackTrace :
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at XXXX.Program.d__34.MoveNext() in d:\Gaurav\TFS\XXXX\XXXX\Program.cs:line 319
InnerException :
System.Threading.Tasks.TaskCanceledException: A task was canceled. TIME : 2014-05-28 04:55:59 PM
Code that is generating error :
using (Task<BoxFile> uploadTask = boxClient.FilesManager.UploadAsync(boxFileRequest, spStream))
{
BoxFile newFile = uploadTask.Result;
}
Source: (StackOverflow)
I was thinking of having this kind of layout:
Layout with 2 columns and boxes, that automatically fit in free space
Is there a css only solution for that?
My current html, which i generate with php:
<div class="main">
<div class="header"><h1>Header blablablaaa</h1></div>
<div class="box">
<div class="box-header"><h2>Sub-Header1</h2></div>
<div class="box-text"><p>Text1</p></div>
</div>
<div class="box">
<div class="box-header"><h2>Sub-Header2</h2></div>
<div class="box-text"><p>Text2</p></div>
</div>
<div class="box">
<div class="box-header"><h2>Sub-Header3</h2></div>
<div class="box-text"><p>Text3</p></div>
</div>
</div>
Source: (StackOverflow)
I'm trying to create a download form where users can download and filter data according to the date. I want the form to be wrapped inside a box as shown in the example below taken from this link.
I followed the example code, wrapping my form content inside <fieldset>
tags but my form looks like this:
I don't know if this is a bug within bootstrap or if some additional styling must be done.
Here is my html code:
<form role="form" method="post">
<fieldset>
<legend> Download Details</legend>
<div class="form-group">
<label for="startdate" class="col-sm-2 control-label">Start date</label>
<div class="col-sm-10">
<select >
<option>Select Date --</option>
</select>
</div>
</div>
<br><br>
<div class="form-group">
<label for="startdate" class="col-sm-2 control-label">End date</label>
<div class="col-sm-10">
<select >
<option>Select Date --</option>
</select>
</div>
</div>
<br>
<button type="submit" class="btn btn-primary">Download</button>
</fieldset>
</form>
Source: (StackOverflow)
//----------jquery.cookie.js begins-------------
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2006, 2014 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD (Register as an anonymous module)
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (arguments.length > 1 && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {},
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
cookies = document.cookie ? document.cookie.split('; ') : [],
i = 0,
l = cookies.length;
for (; i < l; i++) {
var parts = cookies[i].split('='),
name = decode(parts.shift()),
cookie = parts.join('=');
if (key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));
//---------------jquery.cookie.js ends-----------
var $j = jQuery.noConflict();
$j(document).ready(function()
{
$.cookie('the_cookie', 'the_value');
var myCookie = $.cookie('the_cookie');
alert(myCookie);
$j('#popup_content').dialog
(
{
modal:true,
resizable:false,
draggable:false,
height: 525,
width:475,
closeOnEscape: true,
}
);
});
function setCookie(cname, cvalue, exdays)
{
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
I want my dialog box to open only once and I read it can be done by adding cookies to my dialog box. On searching, I got this code to add cookies to dialog box but it not working. I don't know where the error is. I am new to jquery. All I want is my dialog box should open only once.
This the entire code of jquery.cookie.js.
Thanks in advance. :)
Source: (StackOverflow)
We have a client who is going to upload files to our box.com folder. As I understand I can use webhooks to trigger a POST request to my server as soon as someone uploads anything. Webhooks are setup inside box.com app that you need to create. This all makes sense. But how do I add my app to "monitor" that specific folder? Do I need to publish my app (I don't want to do that)? Thank you.
Source: (StackOverflow)
I'm trying to download several files from BOX server via AJAX by using their api. So my script to download each file is like this:
var args = {
url: url,
headers: headers,
crossDomain: true,
dataType: 'json',
type: 'GET',
error: function(data){
//the server will return a redirect (it corresponds to error event)
console.log(data);
if (data.status == 200 && data.readyState == 4){
// so something with data.responseText
}
else{
alert("The file is not downloadable.");
return;
}
}
};
$.ajax(args);
However, if I want to download 2 files, say A and B, and I want to use their contents for further computation after calling the AJAX download. Sometimes I got the error that A's (or/and B's) content is empty. I search around and figure out that's because of ajax asynchronous. Then what I tried to to is to set async: false
, but then BOX returns both the queries are invalid.
So how should I do to make it work?
Thanks,
Source: (StackOverflow)