w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Management errors and __init__ errors trying to implement nested formsets
This is because, Django adds data to your form for relating to managing the formset. You need to include it since you're rendering the form manually. See: django modelformset_factory - management form data is missing PS: A simple Google or Stack Overflow search would have yielded your answer.

Categories : Django

How to insert nested lists (or nested block elements) into RichTextBlock?
Ok Ill start with silverlight. There was a TreeView Control in silverlight that would have exactly solved your problem. Link to tree view example But since we already know that winRt is a subset of API's these controls have been removed for metro app. More over microsofts design policy regarding the Type Of scenario you are mentioning has changed to : Semantic Zoom For Metro Apps So i advise if your app requirement is like that Either go with the richtextbox or use Grids with Rows and columns Which ever suits your coding best. One more way is to use third party library for tree structure . Syncfusion tree control Syncfusion has a tree control you can try out in the Demo. Even there are more third party tool but none are free not even he above one. Please Let me know if any more co

Categories : HTML

PHP insert statement returns no errors but does not insert
did you check mysqli_error(); it will help you to find exactly the error. It returns FALSE if an error occurred. In that case mysqli_error() gives you more information about the error. $result = mysqli_query($con,"INSERT INTO Contries (contries_id, contries_name, contries_code) VALUES(NULL,$cCode,$countryName[$i])"); if ( false===$result ) { printf("error: %s ", mysqli_error($con)); } else { echo 'done.'; }

Categories : PHP

Ignore insert errors
In your case it looks like you can re-run the load as often as you want. In a Table Output step, checking 'Ignore Insert Errors' does exactly that. The errors are ignored and not logged. What I would do in your case is uncheck 'Ignore Insert Errors', and connect an error output from your Table Output and run it to a text file or xml file or another table output. Rerun the load, and the two rows causing the error will be in your error output.

Categories : Mongodb

Rails: How to receive errors from nested models
Have you looked at validates_associated? http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_associated

Categories : Ruby On Rails

PHP/ODBC insert issues - no errors
Problem solved. After adding the odbc_errormsg line I got :[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. My ODBC admin window did not have 'Read-only' marked. However, my access database was not allowing regular users to write or modify. After adjusting permissions on the folder AND the *mdb file, it worked. Thanks to Andrewsi for helping me through this. I will def be adding errormsg lines after each command from now on!

Categories : PHP

Stored procedure for Insert won't execute and throws 2 errors
You have errors in the following lines: Insert into [UserProfile] (CardHolderName, CardHolderName, SecurityCode, ExpiryDate) Repeated column name "CardHolderName" twice in insert statement to table "UserProfile" Insert into [Order] (DeparturePoint, DestinationPoint, DepartureTime, DestinationPoint) Repeated column name "DestinationPoint" twice in insert statement to table "Order".

Categories : SQL

Inserting data into a Database using PHP (errors but doesn't insert anything);
you need to add the colon's to your execute array keys. $result = $query->execute(array( ':Japaneseword'=>$Japaneseword, ":Englishword"=>$Englishword )); EDIT: if this is not solving the problem AND you removed the colon from the end of your query string (you have ):"; ), then the next step is to check your post data //put this at the top of the script and make sure all your post //variables are set as expected echo '<pre>'; print_r($_POST); echo '</pre>';

Categories : PHP

How to insert key/value pairs into a nested dict without overwriting?
You are overwriting the entry for each key on every loop using by_day[i] = {}. You should rather check for existence of key, in which case, you should update the existing dict. Or alternatively, use a collections.defaultdict: >>> by_sale = {'Spring Savings 0413' : {1 : 3000, 2: 2000, 4:1000}, 'Back to School 0812' : {1: 4000, 3:3000, 4:2000}} >>> >>> >>> from collections import defaultdict >>> >>> by_day = defaultdict(dict) >>> for sale, sale_info in by_sale.iteritems(): ... running_total = 0 ... for i in range(1,5): ... daily_amount = sale_info.get(i,0) ... running_total += daily_amount ... by_day[i].update({sale:running_total}) ... >>> >>> dict(by_day) {1: {'Spring Savi

Categories : Python

why doesn't my nested insert statement work?
If you perform a select in an insert then you may skip the values part insert into myTable (Id) select id from someTable where seriesid not in (120, 130, 110, 300)

Categories : SQL

findContours, contourArea give errors with nested contours. "Assertion failed", "input array is not a valid matrix"
I cannot judge for the CV_EXTERNAL case. BUt in the first case the problem seems simple. for (int i = 1; i != ContourVector.size(); ++i){ if ( (contourArea(ContourVector[i])) > BiggestContourArea) { biggest = i; BiggestContourArea = contourArea(ContourVector[biggest]); } } In C++ arrays and vectors are indexed from zero. So first item in vector has index 0, and the last one has ContourVector.size() - 1. To fix you code simply change the for cycle to: for (int i = 1; i < ContourVector.size(); ++i) ....

Categories : C++

C++: "Invalid covariant return type" errors in nested classes with methods returning template-based objects
The function with the signature B::test(void) returns an object of type Q<A>, while C::test(void) (which is the same signature, so you're overwriting the function) returns Q<B>. I think that is impossible. As far as I know it is impossible to overload a function by return type and overwrites of parent functions need to stick to the same return type. From the Standard §10.3/7 The return type of an overriding function shall be either identical to the return type of the overridden function or covariant with the classes of the functions. If a function D::f overrides a function B::f, the return types of the functions are covariant if they satisfy the following criteria: both are pointers to classes, both are lvalue references to classes, or both are rvalue references

Categories : C++

nested iterator struts2 - batch insert hibernate
A very bad coding style mixing struts tags with scriplets. Infact never use scriptlets. Let the view be clean. I read the question twice, and you've already written the solution yourself. What's the problem ? <s:iterator value="CategListGrille" status="firstIter"> <s:iterator value="type" status="secondIter"> <s:textfield name="souseval[%{#firstIter.index}].sousEvalItem[%{#secondIter.index}].SousItem_ID'}" /> <s:textfield name="souseval[%{#firstIter.index}].sousEvalItem[%{#secondIter.index}].SousItem_Name'}" /> <s:textfield name="souseval[%{#firstIter.index}].sousEvalItem[%{#secondIter.index}].SousItem_Description'}" /> Action can have something like : private List<List<sousEvalItem>> lst; If you can explain your question mo

Categories : Hibernate

Multiple nested update/insert statement in postgres
The right approach for this problem would be an anonymous function/method, which does two statements or more and keeps the values like this: -- EVENTS DO $$ DECLARE ds record; nid integer; c integer; nwert character varying(4000); BEGIN FOR ds IN (SELECT id, name AS wert FROM events) LOOP SELECT count(*) INTO c FROM mail_keys WHERE mail_key = ds.wert; nwert := ds.wert; IF (c > 0) THEN nwert := nwert || '_' || ds.id; END IF; INSERT INTO mail_keys (mail_key) VALUES(nwert) returning id INTO nid; UPDATE events SET mail_key = nid WHERE id = ds.id; END LOOP; END$$; That solves the problem!

Categories : SQL

Array insert and excessive matches in nested for loops - ruby
The below part is not correcrt: (0..limit).each do |i| (0..limit2).each do |j| if ary1[i] == ary2[j] ary1.insert(i,ary2[j]) puts 'match!' end end end First pass: ary1 = ['a','b','c','d'] ary2 = ['e','f','g', 'a'] when limit=0 and limit2 = 3,there is a match.ary1.insert(0,ary2[j]) line makes your array ary1 as ary1 = ['a','a','b','c','d'] Second pass: ary1 = ['a','a',b','c','d'] ary2 = ['e','f','g', 'a'] when limit=1 and limit2 = 3,there is a match.ary1.insert(1,ary2[j]) line makes your array ary1 as ary1 = ['a','a','a','b','c','d']. And it Goes on.. So as your arr1is having size 4, 4 a s has been added to ary1. Finally it becomes - [ a,a,a,a,a,b,c,d]. Array#insert says :- Inserts the given values before the element with the given index.Negativ

Categories : Ruby

Add/Insert entity with inherited nested object graph (one to many relationship)
Wanted to post my answer in case it helps others, and so the experts can tear it to pieces and post the real answer. For me it did not start working out of the blue :) If I understand your object graph correctly, it's MyEntity has Foos which has Bars. I had a similar structure, but when calling "SaveChanges" a DbUpdateException would be thrown with a message that "multiple entities may have the same primary key." Here's how I made it work for me: Step 1: Change the Id properties from int to int? and initialize them to null. To me this is a more accurate model than a plain integer. When an entity is new, the ID is literally "undefined or unknown". 0 is a defined number and for some reason EF has a problem with the ID's being the same, even when the records are being added. public

Categories : C#

Codeigniter - Insert multiple values from a nested array in database
You should read Insert array into MySQL database with PHP before. An advice: To make what you wish, search for MongoDB.

Categories : PHP

Insert & Update with strong parameters for nested `belongs_to` association
Ok, there are a few things I see: Nested attributes, as described in the API, "allow you to save attributes on associated records through the parent." This means that class Enrollment < ActiveRecord::Base belongs_to :student accepts_nested_attributes_for :student end inherently won't work because you're trying to accept nested atributes from the parent. So you need to start by rethinking your Active Record assications. If we pretend that's all squared away, then more syntactical errors are: Replace <%= f.fields_for :student_attributes do |student_builder| %> with <%= f.fields_for :students do |student_builder| %> This can be confusing, but passing :students to the fields_for helper calls the nested student object, whereas :student_attributes is the hash k

Categories : Ruby On Rails

Active Admin, Rails 4 Nested Form DELETE then INSERT has_one Model
I had the same problem. You need to use semantic_fields_for for nested attributes. Here is my solution: f.inputs "User Fundamentals" do ... end if params[:action] == 'edit' f.inputs "User Profile" do f.semantic_fields_for :profile do |profile_form| profile_form.inputs :first_name,:last_name, etc.. ... elsif params[:action] == 'new' f.inputs :name => "User Profile", :for => [Profile.new] do |profile_form| profile_form.inputs :first_name,:last_name, etc.. ... Hope this may solve your problem.

Categories : Forms

In Matlab, how can I filter a structure by calendar year and insert the elements of interest into a new nested structure?
You should add a final inf term to your yrsStr and then you can use the amended code at the bottom of this answer to create your yoyComp structure. The main change I've made has been to use logical indexing, and capture the output of the structure's fields by surrounding the expression with square brackets (see [nxtPdOut.datePdLow]). Here's a basic demonstration of what I mean For the structure a(1).b = 5 a(2).b = 6 a(3).b = 7 You can interact with it in the following way, either: >> a.b ans = 5 ans = 6 ans = 7 Or by capturing the results into a vector: >> [a.b] ans = 5 6 7 For your code specifically, the following gives the result that you described in the question: yrsStr = [yrsStr, inf]; nn = 1; for n = 1:length(yrsStr)-1

Categories : Matlab

Struts 1.1 nested and in combination
Use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> and the code will look like <c:choose> <c:when test="${element.method1 == true}"> <c:choose> <c:when test="${element.method2 == true}"> <span style="color:green;"><c:out value="${element.prop1}/></span> </c:when> <c:otherwise> <span style="color:red;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose> </c:when> <c:otherwise> <span style="color:black;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose>

Categories : Java

Perl script suffers random __fortify_fail errors, but continues to run without any errors. Should I be worried?
Given the updated screen shot in your most recent edit, it appears there's a bug in an XS module overflowing a buffer, and that's what the stack backtrace is complaining about. You can see in the screen shot the backtrace: /lib64/libc.so.6(__fortify_fail+0x37)[0x7fb026838637] /lib64/libc.so.6(+0xf8690)[0x7fb026836690] /home/ex2-user/j_authority/_Inline/lib/auto/author_da35/author_da35.so(profiles_c+0x27fd)[0x7fb008a529ad] /home/ex2-user/j_authority/_Inline/lib/auto/author_da35/author_da35.so(XS_author_profiles_c+0x32a)[0x7fb008a55afa] So, it appears you're in the middle of this XS module when Fortify detected a stack overflow. This suggests a function-local array to some function internal to author_da35 got overrun. This could happen if, for example, it sized some structure expecting

Categories : Perl

JSLint has reached the limit of 1,000 errors or it is confused by earlier errors and can't continue
You've got some JS*H*int options (like eqeqeq, apparently) in the jslint line. It's choking there. So change... /*jslint browser: true, forin: true, white: false, on: true, fragment: true, eqeqeq: true */ ... to ... /*jslint browser: true, forin: true, white: false */ ... and I bet it works. Note: It's almost always a good idea to get a simplest case example of code that's screwing up in JSLint and paste it into JSLint.com. Crockford keeps that URL all but up to the minute with JSLint's github repo, and it was reporting a much more user-friendly error (Unexpected 'on'.) than the unfortunate "JSLint's confused" it was telling you. Just to make sure there wasn't something else making JSLint think there were 1000+ errors, I changed your white to true, removed the unused w and d, and

Categories : Javascript

Separate internal errors from client errors in custom WCF error handling?
You should create your own exception class by deriving from System.Exception and throwing them where your validation fails. In your IErrorHandler implementation you should check if the exception is yours and return the Status code you want. For example if MyException was the derived exception: public void ProvideFault(Exception error, MessageVersion version, ref Message fault) { MyException me = error as MyException; if(me != null) // Set the status code. }

Categories : Wcf

Errors in Android Studio myfirstapp : Gradle errors
when you create an activity, make sure you insert it into mainifest.xml as well, so your manifest should be like this: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myfirstapp" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <activity android:name="com.example.myfirstapp.MainActivity" android:label="@string/app_name" android:parentActivityName="com.example.myfirstapp.Ma

Categories : Java

VBA: Errors with IF loop to rename worksheets (specific errors)
First, you should use Option Explicit which is a result of Require Variable Declaration option set to true in VBA editor options. If you did so I think some/all of your problems you could solve on your own. Second, your Results and DataEntries are recognised as empty variables. If so you try to change sheets names into empty string which is not allowed. So you need to make the following changes (adding some quotation marks): If ws.Name = "Sheet1" Then Sheet1.Name = "Results" ElseIf ws.Name = "Sheet2" Then Sheet2.Name = "DataEntries" End If Third, your loop will be run only once as you have Exit For line executed during first iteration- you should remove it as I can't find the reason to place it there. Fourth, there could be some more problems but not seeing

Categories : Excel

SQL BULK INSERT tries to insert all rows to insert into last column of first row
probably a Unix file, see here BULK INSERT data where the row terminator is a linefeed in SQL Server you have to use CHAR(10) with dynamic SQL

Categories : SQL

New Relic warning: the Xdebug extension prevents the New Relic agent from gathering errors. No errors will be recorded
I got help from New Relic support. Their response was basically that Xdebug indeed conflicts with New Relic, and they should not be used simultaneously. Uninstalling the Xdebug PHP extension made the warning go away. It may be possible to disable stack traces in Xdebug and continue to use other Xdebug features, but New Relic support didn't comment on this.

Categories : PHP

If range contains errors, clear errors VBA
You will need to add On Error Resume Next to your VBA method that contains your SpecialCells Clear(). This is needed because when the SpecialCells Method condition cannot be met, an error occurs!

Categories : Vba

JQuery selector for finding a nested span within a nested class is not working
I don't see any problem with your code at the moment, let's reformat it a bit: var tabs = $('.collapse').not('.in'); console.log("tabs.length: " + tabs.length); tabs.each(function () { var $this = $(this), thisErrors = $this.find('.field-validation-error'), thisId = '#' + $this.attr('id'); console.log("current tab ID: " + thisId); console.log("number of errors: " + thisErrors.length); if (thisErrors.length) { $(thisId).collapse('show'); } }); Or working fiddle: http://jsfiddle.net/Rq8y7/ Does it work now? And what's the debug message in console after you run above code?

Categories : Jquery

How can I bind data from nested List<> objects to nested ListView controls?
You can bind the datasource of your inner list view to a property of the items bound to your outer listview. However, to do that the inner listview as to be in the itemtemplate of the outer listview. See the code below and note the DataSource='<%# Eval("Labels_color") %>' attribute for the inner list view. <asp:ListView ID="ListView_Orp_Results" runat="server" ItemPlaceholderID="itemPlaceholder"> <LayoutTemplate> <div id="outer_result_container"> <div id="itemPlaceholder" /> </div> </LayoutTemplate> <ItemTemplate> <div id="result_photo">...</div> <div id="result_category">...</div> <div id="result_detector">...</div> <div id="inner_result_container" runat="server"

Categories : Asp Net

Parsing a flattly-written nested text template into a usable nested data structure for N levels
Replaces each ">" with a tab. Output is pretty much exactly as your brute force output. (file.txt is your template file as above) test = open("file.txt", "r") for line in test: print line.replace(">", " ") #print line

Categories : Python

MySQL - Reference main query in nested select (need to be nested)
This cannot work. SELECT clause is always evaluated at the end of the execution chain, @teamg_id variable will always be 0 in the nested subquery. Try this query, it is not tested (I can't see your data, playing whith sample data always helps), but probably it gives desired results. I commented out some parts and add one join condition. /* SET @teamg_id := 0; */ SELECT /* @teamg_id := player.team_id, */ player.team_id AS player_team, event.local_team_id AS local_team, event.visitor_team_id AS visitor_team, action.unique_id AS action_id, action.player_id AS player_id, player.name AS player_name, playerindex.rank AS player_pos, playerindex.ses_var_nest AS ses_var_nest FROM er_players player

Categories : Mysql

Avoiding nested each loops when handling nested JSON data
JSON is "just" javascript object literals. You can skip the jQuery call, and just reference the objects and arrays directly after you parse it. obj.custom_sql_rule[0].something_else[0]; of course, your JSON is a bit oddly-formed. If at all possible, don't arbitrarily mix objects {} and arrays [] . Use the latter when you have lists of identical objects or primitive data, and the former when you have named properties. And once you have a valid javascript object, you can just iterate through its properties. for(var sqlProp in jsonObj) { if(jsonObj[sqlProp].error) { errorsContainer.append("<div>" + jsonObj[sqlProp].error + "</div>"); } }

Categories : Javascript

How Can I Convert Nested YAML to nested Arrays and OpenStructs in Ruby
There is the solution (https://github.com/jsuchal/hashugar) i often use. opts = Hashugar.new({:a => 1, 'b' => {:c => 2, :d => [3, 4, {:e => 5}]}}) But you also need to do: opts.b.d.last.e I do not understand how do you want to name array's getters. As Arup Rakshit sayed: give us yaml example and expected output or behavior.

Categories : Ruby

nested json with jQuery: create List of nested item
Your problem is that institut is an array containing a single object, so you can reference that single object using institut[0]. This will work: $.each(data.fakultaeten, function (key, value) { var mother = "<li id='first'>" + value.name + "<ul>"; $.each(value.institut[0], function (key1, value1) { alert(key1); }); }); Here is a working example

Categories : Jquery

Idiomatic Emberjs for nested routes but non-nested templates
You could define the parent template to just display the outlet and have an index route which will get displayed inside that. Then for the nested resource you can do the same thing. <script type="text/x-handlebars" data-template-name="user"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="user/index"> <h2>user/index</h2> </script> <script type="text/x-handlebars" data-template-name="posts"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="posts/index"> <h2>posts/index</h2> </script> That way it won't be a master/detail. The router would be: App.Router.map(function() { this.resource('user', function() { this.resource('posts', function() { }); });

Categories : Ember Js

nested attributes, passing current_user.id to nested model
'current_user' is a devise helper method. it can be accessed in controllers n views directly. if i m not wrong, only the new answer should have the current_user.id Old answers should not be updated. u can do this as f.fields_for :answers, @question.answers.build do |a| a.hidden_field :user_id, :value => current_user.id a.submit

Categories : Ruby On Rails

Nested ajax with nested rendered attribute in JSF
It is most likely what your ManagedBean is not in ViewScoped or SessionScoped. When you post back to the bean, you are loosing rendered states. I suggest to change for the ViewScoped one. Not related : You should remove the action attribute from the h:form since JSF override it.

Categories : JSF

PHP - Find nested array1 in nested array2
If I understand correctly what you are trying to achieve, you could do it like this (see comments in code): /* Process one needle (look into haystack and modify it accordingly) */ function processNeedle(&$haystack, $needle) { $needleKeys = array_keys($needle); $needleValues = array_values($needle); $needleLen = count($needle); $haystackLen = count($haystack); /* Find indexes where a match begins */ $matches = array(); for ($i = 0; $i < ($haystackLen - $needleLen + 1); $i++) { $match = true; for ($j = 0; $j < $needleLen; $j++) { if ($haystack[$i + $j]["v1"] != $needleKeys[$j]) { $match = false; break; } } if ($match) { $matches[] = $i;

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.