id
stringlengths 5
11
| text
stringlengths 0
146k
| title
stringclasses 1
value |
|---|---|---|
doc_23539000
|
The scenario is: I have a Tableau report that is looking at a Google Sheet. I can't stream new data into the sheet from R because it's too heavy on the API and I get HTTP errors even with long sleep times. I can't upload a new file because the automation would break; Tableau hooks into a file through its unique ID.
Any way I can get around this?
A: File id is set by google drive when you insert the file. Its not something you can supply.
The closes thing is in v3 which has something called genreatedids but this again is an ID created for you by Google its not one you can supply.
I can think of no work around for your problem.
A: Easy peasy lemon squeezy.
In Google Drive, the "file" (the thing with the ID) is a separate entity from that file's "content". So it's very simple to completely replace the content of an existing file without creating a new file. See https://developers.google.com/drive/v3/reference/files/update . If the files are large, make sure you use the resumable upload form of the API as described here https://developers.google.com/drive/v3/web/manage-uploads#resumable
| |
doc_23539001
|
require(["modernizr",
"jquery",
"bootstrap",
"handlebars",
"bootstrap-table",
], function(modernizr, $, bootstrap, Handlebars, bootstrapTable) {
$(document).on('click', '#searchBtn', function(e){
search();
});
$('#table').bootstrapTable({
classes: 'table table-no-bordered',
striped: true,
iconsPrefix: 'fa',
responsive: true,
responsiveBreakPoint: 768,
responsiveClass: "bootstrap-table-cardview",
undefinedText: "",
showFooter: true,
columns: columns(),
data: data(),
});
}
I want to minimize the number of js calls in the browser while page load.
(I am aware of r.js but would like to avoid it as it requires me change my project folder structure)
So I am thinking of concatenating and minifying all library/component js files like jquery, bootstrap etc. using grunt and then require them in module specific files.
If I do so, I wanted to know how I can include the same using require and be able to use jquery($) and bootstrapTable the way I am using now?
I tried the following but it does not seem to be working :-
require(["mainjs"], function(mainjs) {
mainjs(document).on('click', '#searchBtn', function(e){
search();
});
mainjs('#table').mainjs({
classes: 'table table-no-bordered',
striped: true,
iconsPrefix: 'fa',
responsive: true,
responsiveBreakPoint: 768,
responsiveClass: "bootstrap-table-cardview",
undefinedText: "",
showFooter: true,
columns: columns(),
data: data(),
});
}
Following is my project structure :-
my-proj
build
src
app
components
selectpicker
selectpicker.hbs
selectpicker.js
selectpicker.less
calendar
calendar.hbs
calendar.js
calendar.less
...
...
...
page
homepage
homepage.html
homepage.js
transacations
transactions.html
transactions.js
...
...
...
assets
images
js
jquery.js
modernizr.js
handlebar.js
require.js
bootstrap.js
moment.js
...
...
...
less
Gruntfile.js
package.json
A: You can use webpack:
Create a file webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
}
};
and your code file src/index.js :
const modernizr = require("modernizr");
const $ = require("jquery");
const bootstrap = require("bootstrap");
const Handlebars= require("handlebars");
const bootstrapTable = require("bootstrap-table");
$(document).on('click', '#searchBtn', function(e){
search();
});
$('#table').bootstrapTable({
classes: 'table table-no-bordered',
striped: true,
iconsPrefix: 'fa',
responsive: true,
responsiveBreakPoint: 768,
responsiveClass: "bootstrap-table-cardview",
undefinedText: "",
showFooter: true,
columns: columns(),
data: data(),
});
Then run the command line program webpack in your project directory. This will create a file called dist/bundle.js, which includes your project code as well as all used libraries inside one file.
You can also tell webpack to minify the entire code, using the following configuration. This will also minify all used dependencies inside the destination file.
const webpack = require("webpack");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
// ...
optimization: {
minimize: true,
minimizer: new UglifyJsPlugin({
include: /\.min\.js$/
})
}
};
A: You can use webpack, parceljs or Browserify to bundle modules into one .js file.
| |
doc_23539002
|
A: You can by using OpenCL or Computeshaders (thats the DX name, but I think theres something similar in openGl). But in general it only makes sense for algorithms that are easy to parallelize and way bigger than your example.
A: You're looking for General Purpose GPU computing (GPGPU).
Check out CUDA and
OpenCL
A: I am not an Expert on GPUs but as far as I know YES. Since the GPU is optimized for the graphic operations I don't know about the performance and scalability.
Check this article.
A: Your question if it can do 1 + 2 + 3 + .... + 100 = .. ?
Answer: Yes
This might raise another question: What is the advantage of using GPU hardware for Computation?
Answer: It can execute hundreds of such '1+2+3+..+100==..','101+102+...+200=..', '201+202+...+300=..' operations in parallel way!
With its enhanced hardware a GPU is capable of performing computations in parallel way, within fractions of seconds. GPU has hundreds of cores and they can be utilized for the non-graphics functions also. Advantage of this many core architecture can be taken to perform many scientific computations and simulation. Read the concept of General Purpose Graphics Programming Unit. GPGPU
| |
doc_23539003
|
My aim is: If the number in "triangularNumbers" list is included to the sum appending 1 to the encryptedKey list, unless it is included appending 0. If the element is (00), it means the list has ended and we start to go at opposite direction. Working principle is similar to knight rider lights! Unfortunately, I suffer from problems about appending 1s and 0s. You can find the code below:
triangularNumbers=[1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]
index1=[]
encryptedKey=[]
def DigitTheKey(key):
global num1
global num2
global num3
num1=key//10000
num2=(key%10000)//100
num3=key%100
return num1
return num2
return num3
keyNo=int(input("Please enter the key:\t"))
DigitTheKey(keyNo)
while(num1!=0):
for i in range(10,-1,-1):
if triangularNumbers[i]<=num1:
index1.append(i)
num1-=triangularNumbers[i]
i-=1
if num1!=0:
index1.append("(00)")
for i in range(0,11,1):
if triangularNumbers[i]<=num1:
index1.append(i)
num1-=triangularNumbers[i]
i+=1
#Problem occurs with the while loop below
a=0
while a<=len(index1):
for i in range(10,-1,-1):
print("\nindex1[a]={}\na={}\n".format(index1[a],a))
if index1[a]==i:
encryptedKey.append(1)
a+=1
else:
encryptedKey.append(0)
encryptedKey.append("(00)")
a+=1
for i in range(0,11,1):
if a>len(index1):
break
elif index1[a]==i:
encryptedKey.append(1)
a+=1
else:
encryptedKey.append(0)
#Problem occurs with the while loop above
encryptedKey.append("(00)")
encryptedKey=encryptedKey.pop()
print("Encrypted Key:\t{}".format(encryptedKey))
Also, here is the error message:
elif index1[a]==i:
IndexError: list index out of range
From now, thank you very much!
A: if a>len(index1):
This here is your problem. len(index) is already one higher than you largest index i.e. a=[0,1,2,3], len(a)=4, a[3]=3 and a[4] -> IndexError: list index out of range. So instead of > you will have to use >= to catch that case.
| |
doc_23539004
|
Here is my code:
<script type="text/javascript">
if(!document.location.hash && document.location.hash != "#") {
jQuery.ajax({
url: 'index.php',
type: 'get',
data: 'inMain=1',
success: function(results){
document.getElementById('mainBody').innerHTML = results;
document.getElementById('mainHeader').innerHTML = 'Dashboard';
}
});
}
$(document).ready(function() {
// check current window location
var url = $(location).attr('href');
// var hash_id = url.substring(url.indexOf('#') + 1);
hash_id = document.location.hash;
alert(document.location.hash.length);
if (document.location.hash.length > 1) {
activeHash = document.location.hash;
test = document.getElementById(activeHash);
alert("This: " + $('#' + activeHash.href) + " or This" + document.getElementById(activeHash).href);
}
$(function(){
//Handle click events from your selector
$(document.body).on("click", "[id^=navLink]", function(e) {
e.preventDefault();
newHash = "go" + this.id;
window.location = "#" + newHash;
});
});
});
</script>
The URL would be http://server.com/index.php#destinationId and the HTML would look something like this:
<a id="destinationId" href="/somepage.php">Some Page</a>
Thank you
A: Well, upon tweaking with it some more I've found that document.getElementById(activeHash) works, but $('#' + activeHash) does not.
| |
doc_23539005
|
How can I do this in flutter?
itemBuilder isn't good in list because that alway insert but never remove (or insert remove method into?).
Or I use sliverlist(how?) or enough use somehow scrollcontroller with ListView?
Which is the best way?
So:
*
*Which list use: ListView/AnimatedList/SliverList?
*How to handle scroll up/down on list?
The point is: I don't want add more 1000 items in same time, but only wich is appear on display. And when user srolling on list then add new item to children and remove old from children which is hide. So list children is contain only few items which is appear.
A: Reacting to your comment you are interested in a lazy loading ListView which only builds it's children, when they are actually visible.
I think it would be best to have a look at ListView.builder. In the description of ListView it is explicitly stated, that:
The ListView.builder takes an IndexedWidgetBuilder, which builds the children on demand. This constructor is appropriate for list views with a large (or infinite) number of children because the builder is called only for those children that are actually visible.
This sounds like the behaviour you want, doesn't it?
A: The rendering process of the ListView will render only visible items.
You should watch this video https://www.youtube.com/watch?v=F26pbGaSzfM
| |
doc_23539006
|
Models.py
class Contact(models.Model):
full_name = models.CharField(max_length=100)
email = models.EmailField()
phone_no = models.CharField(max_length=10, validators=[validate_phone_no])
message = models.TextField()
created_at = models.DateTimeField(auto_now_add=True, blank=True, null=True)
def __str__(self):
return self.email
serializers.py
class ContactSerializer(serializers.ModelSerializer):
class Meta:
model = Contact
fields = [
'full_name',
'email',
'phone_no',
'message',
]
Views.py
class ContactViewset(viewsets.ModelViewSet):
permission_classes = [IsAuthenticated]
queryset = Contact.objects.all()
search_fields = []
ordering_fields = []
ordering = []
http_method_names = ["options", "head", "get"]
serializer_class = ContactSerializer
class CustomerContactViewSet(viewsets.ModelViewSet):
permission_classes = [AllowAny]
queryset = Contact.objects.all()
http_method_names = ['post']
serializer_class = ContactSerializer
urls.py
router.register("contacts-detail", ContactViewset)
router.register("contact-form", CustomerContactViewSet)
My question is: Why DRF is generating the same url for both views although I have given different names for both:
'contact-form'----> for posting and
'contact-detail'--------> for listing the contacts
Both views are pointing to same Model - Is this the Reason?
Click Here to see generated api url
See last urls are same: and redirecting to "contact-form". and I know I can give base_name to seperate both.
But I wanted to know the mechanism behind generating same url:
If anyone could explain this? Clearly
A: The problem is with the way you have defined the router.register calls in your urls.py file.
The first argument of the router.register function is the base name for the viewset. This base name is used to generate the URL patterns for the viewset. If you use the same base name for multiple viewsets, then the router will generate the same URL pattern for both viewsets.
For example, in your code you have defined the following lines:
router.register("contacts-detail", ContactViewset)
router.register("contact-form", CustomerContactViewSet)
Here, you have used the base name "contacts-detail" for the ContactViewset and the base name "contact-form" for the CustomerContactViewSet. This will result in two different URL patterns being generated:
/contacts-detail/
/contact-form/
However, since both viewsets are using the same model (Contact), the router will generate the same set of URL patterns for both viewsets. This is why you are seeing the same URL patterns for both viewsets in your API.
To fix this problem, you can use different base names for the two viewsets. For example, you could use "contacts" for the ContactViewset and "customer-contacts" for the CustomerContactViewSet. This would result in the following URL patterns being generated:
/contacts/
/customer-contacts/
| |
doc_23539007
|
Refused to execute inline script because it violates the following
Content Security Policy directive: "script-src 'self'
'nonce-YURLOAQRrIwdGEqYSSpHx9YSWDM......' 'unsafe-eval'".
Either the 'unsafe-inline' keyword, a hash
('sha256-2mvMk0Nvn96VqS1UEmAZSVSEkK0CkPN....'), or a nonce
('nonce-...') is required to enable inline execution.
I do not want to use 'unsafe-inline'.
The issue is documented here , here and here in 2017-2018. I thought the issue is resolved by now in jQuery 3.5.1 unless I am missing something.
My application is developed in .NET Core 5.
Index.cshtml
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<script src="~/lib/jquery/3.5.1/jquery.min.js" asp-add-nonce="true"></script>
</head>
<body>
<button type="button" id="btnGetContent">Get Content</button>
<div id="result">
<partial name="_Test" />
</div>
<script src="~/js/index.js"></script>
</body>
</html>
_Test.cshtml Partial View
@System.DateTime.Now.ToString();
<script type="text/javascript" asp-add-nonce="true">
// partial view specific inline script
</script>
index.js
$(function () {
$("#btnGetContent").click(function () {
$.ajax({
type: "GET",
url: "/test/getcontent",
processData: true,
cache: false
})
.done(function (response, textStatus, jqXHR) {
// in browser's console I notice the error at this line
$("#result").html(response);
})
})
})
Controller
public class TestController : Controller
{
public IActionResult Index()
{
return View();
}
[HttpGet]
public IActionResult GetContent()
{
return PartialView("_Test");
}
}
CSP policy
"default-src 'none'; script-src 'self' 'nonce-{0}' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; child-src 'self';"
I have custom asp-add-nonce tag helper and a nonce middleware. ** For each request ** the tag helper and the middleware inject new nonce value into script tag and CSP policy respectively, and this has been working fine.
After I upgraded jQuery to 3.5.1, looks like jQuery also need nonce value in script tag so I have added asp-add-nonce="true" in header like
<script src="~/lib/jquery/3.5.1/jquery.min.js" asp-add-nonce="true"></script>
ISSUE
I think the issue here, Since nonce value is created for each http request, and jQuery is loaded only once per page. Get Content request creates new value which of-course does not match with original value that was injected in jQuery script tag. So we get error Refused to execute inline script...
Is there anyway to resolve this without adding nonce to jQuery's script tag?
UPDATE 1
After looking the CSP report submitted by browser, it reveled more details. The violated directive is actually script-src-elem. My CSP policy does not even have that directive. This directive is available in CSP 3 version. Not sure why browser is erroring out on jQuery for this directive.
UPDATE 2
You can download repository to re-produce the issue
A: Well based on my related Questions here and here I think I will have to add script-src unsafe-inline for jQuery 3.1+ to work properly in the following scenario
1>You are using jQuery 3.1+
2>jQuery is added on _layout page or main page so it load only once at start.
3>You are loading partial content using AJAX.
In nonce approach it is recommended to use unique nonce for each http request. But his approach will not work here. Because AJAX call will get different nonce in header. So any jQuery call after will not work.
For me it was working with 2.1.1 because jQuery 2.x parses all <script>...</script> tags from the HTML and puts it in a dynamically generated script tag or executes those through eval( ) details and I had script-src nonce-xyz unsafe-eval
| |
doc_23539008
|
My Firebase looks as so:
players
id (lots of letters/generated by firebase?)
playerContent: "firstname lastname"
votes: 1
id
playerContent: "differentfirstname differentlastname"
votes: 2
id
playerContent: "thirdname thirdlast"
votes: 3
Here's how I initially reference my database:
this.database = this.app.database().ref().child('players');
And here's the bulk of the code I've been working with:
1.)
this.database.on('child_added', snap => {
previousPlayers.push({
id: snap.key,
playerContent: snap.val().playerContent,
votes: snap.val().votes,
})
2.)
this.database.on("child_changed", function(snapshot) {
var changedVote = snapshot.val();
console.log("new value: " + changedVote.votes)
});
3.)
var votesRef = firebase.database().ref("votes");
votesRef.orderByValue().on("child_changed", function(snapshot){
snapshot.forEach(function(data) {
console.log("The " + data.key + " votes are " + data.val());
});
});
this.setState({
players: previousPlayers
})
})
}
In #2 there, I am getting immediate feedback in the browser inspect window saying that the up or downvote is registering for each player -- however I think something is wrong in #3. It doesnt seem to change the order of what I see on the screen, even if I refresh the page. It always displays the content in order of oldest at the top, newest on the bottom.
Thanks in advance
| |
doc_23539009
|
I am getting this error:
No Entity Framework provider found for the ADO.NET provider with invariant name 'EFCachingProvider'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
After looking on the above link, I used config file registration after that the following error occurs:
The 'Instance' member of the Entity Framework provider type 'EFCachingProvider.EFCachingProviderFactory, EFCachingProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=def642f226e0e59b' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later.
A: Due to changes to the provider model in EF6 (and some other features) the EF Caching Provider does not work with EF6+ versions. I created a Second Level Cache for EF 6.1 - see this blog post for more details.
| |
doc_23539010
|
public class Shout {
public static void main(String[] args) {
String str1;
String str2 = "";
Scanner keyboard = new Scanner(System.in);
StringBuilder output = new StringBuilder();
while (keyboard.hasNextLine()) {
str1 = keyboard.nextLine();
StringBuilder sb = new StringBuilder(str1);
output.append(sb.toUpperCase().toString()).append("\n");
}
System.out.print(output.toString());
}
}
I am looking to convert multiple lines of input until the EOF (ctrl+d) to Uppercase. What can be used to print out the same multiple lines all in Uppercase? For example, input and output would look like:
car
bus
taxi
CAR
BUS
TAXI
with the repeated lines in Uppercase.
A: Put the each line to Hashmap, and each time you get the line check if the same string found in the hashmap. If not, just print as normal and add to the hashmap. Otherwise print as uppercase.
Code should be look similar to this.
Map<String> lines = new HashMap();
while (keyboard.hasNextLine()) {
str1 = keyboard.nextLine();
StringBuilder sb = new StringBuilder(str1);
if(lines.get(str1)==null){
// not found, put to hashmap and print normally.
lines.put(str1);
output.append(sb.toString().append("\n");
}else{
// found, so this line is repetitive, print the uppercase version.
output.append(sb.toUpperCase().toString()).append("\n");
}
}
| |
doc_23539011
|
it works great if i do it like this:
main function
{
[self function A]
[self performSelector:@selector(function B) withObject:nil afterDelay:5];
}
but i am using MBProgressHUD as an activity indicator:
main function
{
[HUD showWhileExecuting:@selector(funcion A) onTarget:self withObject:nil animated:YES];
[self performSelector:@selector(function B) withObject:nil afterDelay:5];
}
does not work, function B never gets called. if i switch it to [self function B] it will be called. i'm guessing this is an issue with threading that i don't understand yet. if i use [self performSelectorOnMainThread] it will call function B but it doesn't look like i can delay that one.
A: Your issue is that the HUD is called on the main thread and is not set to wait. So it fires off your functionA, then immediately calls your performSelector for function B. If you want function B to perform correctly, you will have to call it at the end of function A.
| |
doc_23539012
|
var a = 'aa\b\u0007\u0007';
console.log(a);
//=> a //+ 2 beeps
console.log(a.length);
//=> 5
Here a.length simply gives me 5, but the outputted string is just a and its length just 1.
How to get that?
A: There are a couple of different issues here.
First, different environments will render that string differently. Some will render the bell character as an actual glyph; others, like traditional consoles, will make a sound instead. Some will render (some) zero-width characters as various glyphs as well. There is no one "this is how long this string is once you account for backspaces and zero-width characters" interpretation.
You'll need to determine the rules you want to apply in your situation. The Unicode site may help with some traditional interpretations. Or if you're just interested in interpreting old-fashioned ASCII, that will be a lot easier, but of course we don't live in an ASCII world anymore (which is a Good Thing(tm)).
Once you have your rules, depending on how complex they are, you may be able to apply them with one or more regular expressions. For instance, this simplistic regular expression will treat a backspace as meaning it should remove the previous character, and remove all other characters whose character code is less than 32 (traditionally, "control characters"). Again, this is not complete, there are plenty of Unicode zero-width characters outside that realm (there are various zero-width spaces for a start). and doing a thorough job of it across the Unicode range will be a project, not a trivial function.
But just for example:
function getInterpretedLength(s) {
return s.replace(/(?:.[\b])|[\u0000-\u001f]/g, "").length;
}
The second issue is that for certain Unicode code points (loosely, "characters"), JavaScript counts two JavaScript characters, not one. That's because JavaScript strings are a 16-bit encoding like UTF-16, except that they tolerate invalid surrogate pairs, and some characters are encoded with two 16-bit values, not just one.
So this will either be a large project, or if you can constrain it sufficiently based on what you're actually trying to solve, it may be a bit smaller.
A: Looking at this answer, you could try to strip non-printable characters using replace before getting the length, like this:
console.log(a.replace(/[^\x20-\x7E]+/g, '').length);
A: You can actually count characters with canvas, but there is no real backspace character in web that act like in terminal. So, you have to manually calculate substract it for backspaces.
var text = 'aa\b\u0007\u0007';
var context = document.createElement('canvas').getContext("2d");
context.font="30px Courier New";
var length = context.measureText(text).width / context.measureText('x').width - text.match(/\x08/g).length;
alert(length);
//1
| |
doc_23539013
|
For example, assume obj1 is passed into a function as an Object:
Dim t As Type = obj1.GetType
If t.IsGenericType Then
Dim typeParameters() As Type = t.GetGenericArguments()
Dim typeParam As Type = typeParameters(0)
End If
If obj is passed as a List(Of String) then using the above I can determine that a generic list (t) was passed and that it's of type String (typeParam). I know I am making a big assumption that there is only one generic parameter, but that's fine for this simple example.
What I'd like to know is, based on the above, how do I do something like this:
For Each item As typeParam In obj1
'do something with it here
Next
Or even something as simple as getting obj1.Count().
A: The method that iterates over your list can specify a generic type:
Public Sub Foo(Of T)(list As List(Of T))
For Each obj As T In list
..do something with obj..
Next
End Sub
So then you can call:
Dim list As New List(Of String)
Foo(Of String)(list)
This method makes the code look a little hairy, at least in VB.NET.
The same thing can be accomplished if you have the objects that are in the list implement a specific interface. That way you can populate the list with any object type as long as they implement the interface, the iteration method would only work on the common values between the object types.
A: If you know that obj is a Generic List. Then you're in luck.
Generic List implements IList and IEnumerable (both are non-generic). So you could cast to either of those interfaces and then For Each over them.
*
*IList has a count property.
*IList also has a Cast method. If you don't know the type to cast to, use object. This will give you an IEnumerable(Of object) that you can then start using Linq against.
| |
doc_23539014
|
The JSON response in AJAX
and
The JSON result in postman
var jData = {};
jData.username = $scope.mobile;
jData.password = $scope.password;
jData.entrytoken="aaad1323dfd";
var $resData = null;
$.ajax({
url:url,
type: "POST",
ContentType: "application/json; charset=utf-8",
data:JSON.stringify(jData) ,
dataType: "json",
beforeSend: function () {
},
success: function (response) {
console.log(response);
},
error: function (jqXHR, textStatus, errorThrown) {
},
complete: function () {
}
});
| |
doc_23539015
|
*
*The option "Page Size" does not affect the grid.
*"PageSize" selector appears out of the page borders
"pageable": {
"pageSize": 10,
"pageSizes": [5, 10, 20, 30, 1000],
"buttonCount": 5,
"refresh": true,
You can check full examle in jsfiddle
And Here is the video with the second problem described
A: pageSize is a property of kendo datasource. Please remove it from the pageable option and set it to datasource.
var dataSource = new kendo.data.DataSource({
data: [
{ name: "Tea", category: "Beverages" },
{ name: "Coffee", category: "Beverages" },
{ name: "Ham", category: "Food" }
],
page: 1,
// a page of data contains two data items
pageSize: 2
});
Edit 1
Page size docs http://docs.kendoui.com/api/framework/datasource#configuration-pageSize
Edit 2
check this fiddle http://jsfiddle.net/M8jvz/6/ it shows the pager buttons
Edit 3
here are the few changes i have made fix the issue
*
*set the proper id for the schema
*set the total for the data source in the schema
here is the updated fiddle http://jsfiddle.net/M8jvz/7/
A: Define pageSize in the DataSource definition:
var dataSource = new kendo.data.DataSource({
pageSize : 10,
data : l_json,
schema : {
data : "row",
model: {
fields: {
"DTRP_DT": {
type: "date"
See it here : http://jsfiddle.net/OnaBai/M8jvz/5/
| |
doc_23539016
|
I get this error:
rake aborted!
stack level too deep
(in /Users/Jordan/Development/reejay/rails/reejay/app/assets/stylesheets/blog_player.css.scss)
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:162
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/usr/local/Cellar/ruby/1.9.3-p0/bin/ruby /...]
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:80:in `ruby'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `ruby'
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/local/bin/rake:32:in `<main>'
Tasks: TOP => assets:precompile
Here is a link to my Gemfile: http://www.pastie.org/3019470
Other rake tasks, like db:migrate, continue to work as expected. This only affects the assets:precompile task.
A: (Repeating my comment from above, since it appears to have actually been the correct answer. For anyone who does not already use it: rvm, rvm, rvm. Learn it, love it.)
There's something very strange with a stack trace that references three different versions of ruby (1.9.1, 1.9.2, and 1.9.3). I would recommend installing rvm, creating a clean gemset, and trying this again.
A: This problem is probably caused by not having the latest version of rubygems installed.
If you did this: "gem update --system", it would have worked regardless of you using rvm or not.
| |
doc_23539017
|
Someone added a table to the database I'm using, and rather than deleting their table and doing it the code-first way, I'd like to just bring their table over using a DB first migration.
Is that even possible to mix and match DB-first/code-first techniques?
If it is, how do I do it? I can't seem to find anything about bringing over just one table. Only migrating a whole database, which is not what I want.
A: Yes, it's possible. The steps are the following:
*
*Right click on your Models folder.
*Select Add -> Add new Item
*In the Add New Item Window, select Data -> ADO.NET Entity Data Model. (This would create a new DbContext, but we going to merge the two DbContext) Click Add
*In the Entity Data Model Wizard select Code First from database.
*Select your connection String.
*Click in no, exclude sensitive data...
*Uncheck Save connection settings.
*Click next
*Select the new Table
*Click finish
In this point VS would generate two files: a new DbContext and the model for the table.
Now open de new DbContext cut the DbSet of your model and paste in your original DBContext, too cut the content of the OnModelCreating method and paste at the end of the OnModelCreating method of your Original DbContext.
The final step is add a new Migration ignoring the changes.
For example:
Add-migration NewTableAdded -IgnoreChanges -verbose
|