w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Entity framework creates duplicate entities
If you are using a simple int for your id, you can use the following method. public abstract class BaseEntity { public int Id { get; set; } } public void AddOrUpdate<T> (T entity) where T : BaseEntity { if(entity.Id > 0){ Entry(entity).State = EntityState.Modified; } else { Set<T>().Add(entity); } } // var model = Mapper.Map<Record>(record); db.AddOrUpdate(model); db.SaveChanges();

Categories : C#

Entity Framework Code First SaveChanges creates a new object
The attribute in your Account option should work fine to set up the ID column as the primary key for your objects. If you are getting a new entry added to the database when you save changes, it is almost certainly the result of you having changed the primary key (ID property) of the object after having received it from the DB. Maybe you are trying to set the GUID property yourself in some piece of code that you haven't included? (You should be letting the DB assign it). In any case, this simple console app uses your setup and works as expected. If you don't see an obvious place in your code where you are changing the GUID, maybe you can post your actual code? (I notice a couple of typos in what is pasted in, so it doesn't appear to be what you are actually using) public class Account

Categories : C#

Problem to plot 3D surface with R‏
Try this to see why I don't think this data is well suited for wireframe: cloud(Z~X+Y, data=FI02, xlab="X", ylab="Y", main="Surface elevation", type="l", screen=list(z=-60, x=-60))

Categories : R

kruskal.test shows "All group levels must be finite" error. What is the problem?
It should work if you run data$Grp <- as.factor(data$Grp) Then (as before): kruskal.test(data$Val, data$Grp) This is because Grp is a character not a factor and is.finite applied to an object of character class is always false (see ?is.finite).

Categories : R

Wait on thread that creates an instance that creates a thread
One solution could be to use Task class instead of explicitly creating the Thread //here instead of creating a Thread, create a Task and return it to the caller objClientThread = new Thread(start) { IsBackground = true }; objClientThread.Start(); Then you can do Task task = objClientBase.Connect(); task.Wait();

Categories : C#

is system framework (like UIKIt.framework,CoreGraphics.framework) static library or dynamic library
It's a dynamic library. Frameworks are Apple's way of packaging up a particular version of a dynamic library, along with its dependencies (such as header files). See the Apple documentation for more information. It is not possible to use a framework intended for OS X for iOS. (although there is some overlap; Apple makes frameworks with the same names that do essentially the same thing for both platforms, with some possible differences.) They must be targeted for the iOS architecture you want to use them on.

Categories : Iphone

The primary reference could not be resolved because it was built against a higher version of the .NET framework than the currently targeted framework
Apparently if you have only .NET Frameworks 4.0 installed, you can add as a reference a .NET assembly that targets 4.5 to a project that targets .NET 4.0. This will compile and run with no errors. As soon as you install .NET Frameworks 4.5, compile will fail. The solution is to target your project for .NET Framework 4.5 or get a version of the referenced assembly that targets .NET 4.0. .NET 4.5 is a drop in replacement for 4.0. 4.0 doesn't know anything about 4.5, and I assume it is just looking at the first digit of the version number which for 4.0 or 4.5 is the same, so it is allowed to compile. As soon as you install 4.5, your 4.0 projects are compiled using the 4.5 Frameworks and it now knows about 4.5 and complains.

Categories : Dotnet

C# compiler creates ref class
Your ´Position´ class is a ´reference type´ When you equal pos2 to pos1 it points to the same memory location. Changing the property of one object will thus change the other one also as it is the same object

Categories : C#

Can't do multitask, creates errors?
You are swallowing your exception, so to speak, by just showing an arbitrary message. Instead, make use of the Exception instance provided in the catch: catch (Exception ex) { MessageBox.Show(ex.Message); } Although, I wouldn't necessarily condone throwing up dialogs, you can use the debugger to break in the catch block, interrogate stuff and things, and correct the problem.

Categories : C#

SQL inner join creates duplicates
Use proper join syntax consistently. You are mixing old-style joins (, with condition in the where clause) with proper ANSI join syntax. You mean something like this: SELECT s.SNAME, d.QTY FROM Suppliers s join Deliveries d d.SupplierId = s.SupplierId join Products p ON d.P = Products.Penter; I'm making up the join field between Suppliers and Deliveries. And, I'm only guessing that those are the tables that need to be connected (perhaps it is Suppiers and Products).

Categories : SQL

Decorator that creates classes
Not possible. Making 3 classes is easy. Assigning the results to 3 variables, though? That violates Python's scope rules. @mc_me class Test: name = "Test" is equivalent to class Test: name = "Test" Test = mc_me(Test) There's no way for the decorator to say that it wants to create some more variables and assign to those too. Even if you somehow managed to get it to work (probably only at module or class scope with inspect craziness), Python would have no way to know that references to TestSuper or TestExtra should refer to the variables created by the decorator when compiling the bytecode.

Categories : Python

Script that creates files on AWS
It is impossible to know where your code outputs the file. Do you have a hardcoded directory in your code that happens to be the same as the one your script is in? What have you tried as far as running your code on AWS? Could you share the relevant code with us? To run the scripts in AWS you do what you would do to run the script on any machine. Copy over the .py file(s) and make sure python is installed. Then from the command line call "python .py".

Categories : Python

How to recognize (what tag creates) this image?
The parent div #title has the image as a background image. <style type="text/css"> #title { background: url(http://colleenbriggs.files.wordpress.com/2012/12/cropped-fragments-of-light-low-res.jpg) no-repeat; height: 180px; } </style>

Categories : HTML

File creates but cannot write in it
Try this: using(FileStream stream = File.Create(path)) { TextWriter tw = new StreamWriter(stream); tw.WriteLine("Manual Numbers="); tw.WriteLine(""); tw.WriteLine("Installation Technical Manual: "); tw.WriteLine("Performance Manual: "); tw.WriteLine("Planned Maintenance Technical Manual: "); tw.WriteLine("Service Calibration Manual: "); tw.WriteLine("System Information Manual: "); tw.WriteLine(""); } The using ensures that the filestream is closed(disposed) even when an exception occurs within writing.

Categories : C#

Jasper creates empty PDF
The detail band of your report will be repeated for every row in the datasource. However your filling the report with an empty data source, this is why the band is not showing. Try moving your textfield in the title band to see it.

Categories : Java

How does tag creates a bean?
Jsp:Use bean tag is used to initialize the class and bean is nothing but it is attribute so you should need to define here because it should know from which class it will get desired field then why we will call it Use bean> see below may be it help you <jsp:useBean id="p1" class="com.envious.Person" scope="session"/> First Name: <jsp:setProperty property="firstname" name="p1" value="abc"/><br> <jsp:getProperty name="p1" property="firstname"/><br> Last Name: <jsp:setProperty property="lastname" name="p1" value="xyz"/> <jsp:getProperty property="lastname" name="p1"/>

Categories : Java

Hudson Job creates .svn files
.svn files are internal files of Subversion. All subversion meta data is in this directories. In case of Hudson Job, they are irrelevant as you do not want to commit anything. You cannot avoid crating them. You can remove them but you will find them helpful when you will start using update instead of checkout on Hudson to speed up build.

Categories : Svn

Model creates new row instead of being edited
The reason Backbone.js is firing a POST request instead of PUT is because your model does not have a unique identifier id associated with it.If there is not id attribute associated with your model, Backbone.js will always fire a POST request to save a new entry to db. From backbone's website : save model.save([attributes], [options]) ... If the model isNew, the save will be a "create" (HTTP POST), if the model already exists on the server, the save will be an "update" (HTTP PUT). Read this SO question for more information.

Categories : Javascript

wp_insert_post(), creates two pages?
I got a similar error before, when i am running a custom php script to insert posts into the Wordpress database, using the wp_insert_post statement. Weirdly it created 2 records in wp_posts table for every post. Not sure what is the issue, but i realized that when i ran the php code in the same browser where i am logged in as administrator, i got this duplicate posts issue. I resolved it by running my custom php code in a separate browser. So make sure that you are running your custom php code with SQL query in a browser, that has no Wordpress login in it. Hope it helps someone.

Categories : Wordpress

Changing an Entity creates a new one as well
i think this is entity framework issue,you may use "Context.context.Projekt.Find(id)" in your "izmjeniProjekt" instead of your function "getProjektByID",maybe passing and getting types with the functions is the problem, by the way your naming is awesome ! the problem is obvious, entity framework recognizes your "Projekt" as a new entry, so the problem is the Key of your database table, you probably used code first migrations to creating your database and you didn't specify the key, but by the way, you have the id, in my opinion its not necessary to get the "Projekt" from data context, just use it! maybe what i'm trying to say is not clear so watch this video ( you will see your problem there ) to have a better understanding of entity framework. Julie Lerman Speaks

Categories : C#

Hibernate creates a SQL query
The need for quoting database identifiers derives from the database used, some do, some don't; it is not SQL per se that "wants" this. So you need to set the correct database dialect then Hibernate will do this automatically if needed. In fact it is one of the benefits of Hibernate that you don't need to care for this differences.

Categories : SQL

EDEN Framework together with Zend Framework: Cannot redeclare class Eden_Class
Solution (working for me) added this to my Bootstrap.php /** * Setup EDEN Framework * http://eden.openovate.com/ * * @return void */ public function _initEden() { eden()->setLoader(false); }

Categories : PHP

Entity Framework 5 on framework 4, contains and multiple outer joins with same table
I've met analogous behavior in NHibernate, maybe you find any similarity. We got simple parent -> children relation. The point was that the relation was bidirectional so parent referenced all children and each of them has reference back to parent. NHibernate supports lazy fetching which I switch off. Thus it produced interesting query once I decided to fetch the whole aggregate, I mean parent with all children. Something like: select ... from parent ... left join ... children ... left join parent As Nhibernate uses first level cache under the hood, it was not able to discover automatically that those parent instances are equal as the cache of parent was empty in the time of query execution. Later during parsing of the resulting database dataset, NHibernate found out that parent entit

Categories : Entity Framework

ImageTools only creates PNG successfully under certain conditions
Based on your comment, try to invoke your method either later in the loading sequence or use: Dispatcher.BeginInvoke(() => { GenerateImages(); }); This will queue the function up to be run on the next UI thread tick which should be after any pending layout work which is queued up. The fact that you are calling this function right at the end of the constructor has no consequence (other than the fact that the variables representing different objects have been initialized). It's all happening in the same UI thread tick, before Layout is kicked off so there is nothing in the StackPanel for you to capture. To fix this, add your code to the Loaded event of the Page and still wrap it in a Dispatcher.BeginInvoke call so that it is guaranteed to happen after all of your Controls have render

Categories : Vb.Net

FragmentActivity creates more than one Fragments cause problems
Don't make WebManagerArticle a singleton and also don't just make its fields static because they will share the state of the last Fragment initialized. When the ViewPager creates the first page fragment the WebManagerArticle will be created along with the proper id. When the second page fragment is constructed the WebManagerArticle is already built and setting the fields on it will override the previous data stored for the first fragment. And the same happens for the last fragment, that's why you get the only the id for the third fragment.

Categories : Android

JSF creates a new SessionScoped Bean for every request
That may happen if the HTTP session is not properly maintained between the client and the server. Before all, first learn how HTTP sessions work by carefully reading the "HttpSession" section of this answer: How do servlets work? Instantiation, session variables and multithreading. Now, you should understand that they're by default backed by cookies. You should now also understand that if cookies are not maintained by the client or instantly destroyed by the server for some reason, then the session won't be maintained across requests. If you're using a bit modern webbrowser with builtin web developer toolset, press F12 to show it up and open the "Net"/"Network" tab. Look in the response header for Set-Cookie and in subsequent request header for Cookie. If Cookie is absent in request hea

Categories : JSF

Sbt's gen-idea always creates two IntelliJ projects
Yes this is normal, this is the default behavior. You can change it by excluding some folders (see the doc available here : https://github.com/mpeltonen/sbt-idea at Exclude some folders) So what is the difference between .idea and .idea_modules? .idea_module generates an IDEA module while .idea generates an IDEA project. In short a project can be multi-module or single-module and also contains IntelliJ libraries. In longer version from the doc (http://confluence.jetbrains.com/display/IDEADEV/Structure+of+IntelliJ+IDEA+Project) Project In IntelliJ IDEA, a project encapsulates all your source code, libraries, build instructions into a single organizational unit. Everything you do in IntelliJ IDEA, is done within the context of a project. A project defines some collections refe

Categories : Scala

memcpy creates segmentation fault
This line: memcpy(&totalList.unsortedSongs, &songs, sizeof(songs)); should be: memcpy(totalList.unsortedSongs, songs, sizeof(songs)); since both songs and totalList.unsortedSongs will decay to pointers which is analogus to the first example in the reference you cited: memcpy ( person.name, myname, strlen(myname)+1 );

Categories : C++

IsAntiAlias creates border around graph
i dug around the zedgraph source; couldn't find any easy cause/fix. so, i just turned off antialiasing for the whole graph (in the designer) and then turned it on for the individual components: myPane.XAxis.Title.FontSpec.IsAntiAlias = true; LineItem curve_x = new LineItem("x", x_values, sensor_x, Color.Red, SymbolType.None, 2.5F); LineItem curve_y = new LineItem("y", x_values, sensor_y, Color.Blue, SymbolType.None, 2.5F); LineItem curve_z = new LineItem("z", x_values, sensor_z, Color.Green, SymbolType.None, 2.5F); curve_x.Line.IsAntiAlias = true; curve_y.Line.IsAntiAlias = true; curve_z.Line.IsAntiAlias = true; myPane.XAxis.Scale.FontSpec.IsAntiAlias = true; myPane.YAxis.Scale.FontSpec.IsAntiAlias = true; that

Categories : C#

hover effect creates flickering
You apply .hover() on the a only. So when you hover the a, the image appear hover your a wich mean you are not hover the a anymore. That will fire the second callback of .hover() and the image will disappear. Then again you are hover the a and it repeat infinitly. To solve that, you just have to bind the .hover() on the parent container or on both elements.

Categories : Javascript

PHP creates new instance when pushing element
By default, PHP is copying values when assigning them. If you want a reference, you can use the & operator: $a = array(); $b = &$a; $b[] = "Hello!"; echo count($a); // prints 1 echo count($b); // prints 1

Categories : PHP

mkdir always creates a file instead a directory
There are many way to debug a shell-scripting. Add set -x in your beginning script Get the return value. mkdir 'the-directory' ret=$? if test $ret -eq 0; then echo 'Create success.' else echo 'Failed to create.' fi Set to verbose mode $ mkdir -v 'the-directory' Try this command $ type mkdir, to checking mkdir command.

Categories : Bash

Who creates event objects and where are they created?
Why do you think you need to know this? What problem are you trying to solve?. If you are curious then search the Java source code for something like new MouseEvent. If you don't find a match then it is probably done is some lower level code that we don't have access to. You can also take a look at Global Event Dispatching.

Categories : Java

JSP still creates jsessionID with session=false
The directive <@page session="false"> will eliminate the automatic creation of an HTTP session when you access to a JSP page. See for the details: http://docs.oracle.com/cd/A97688_16/generic.903/bp/j2ee.htm#1008677 Clarification: if you access other pages (or resources) that create an HTTP session and then you access the page with the directive <@page session="false"> the session will not be destroyed.

Categories : Jsp

Git app that creates libraries from a subset of a project
Have you looked into git submodules? This lets you collect multiple repositories together into a single directory tree, and is often used in the case where you are managing separate libraries/modules as a separate project. Some people think that submodules are problematic to manage. The git subtree project is an alternative take on this that may also meet your needs.

Categories : GIT

Css rotate div creates white space on top
From what I can gather you needed to switch the min-height and the width values because the div is now rotated vertically rather than horizontal. That takes care of the white space towards the top of the page. Here is an example http://jsfiddle.net/fDWkr/1/ Change width:756px; min-height:1250px; To width:1250px; min-height:756px;

Categories : C#

Codeigniter creates new session row with same userdata
I've still not gotten round to understanding Codeigniter's issue with sessions but from reading other posts there's quite an issue with default sessions. I've installed the Session Driver seen here: http://getsparks.org/packages/session-driver/versions/HEAD/show Which has now fixed the issue. I hope this helps others who have had similar problems.

Categories : Codeigniter

pydoc creates incomplete documentation
Each of your classes and functions, both in and outside of classes, needs to have a docstring *in the code*as below, then help will do it's magic: class SomeClass(): """ Documentation at a high level about the class """ def ClassMethod(): """ Documentation about class method """ # Actual Code Copied from Comments: the thing is that all of my classes and methods already HAVE docstrings as you described. E.g., when I call help(pdbsr.NewPdb) everything is fine for this class, but the Class does not show up in the general help(pdbsr) - this is what bothers me – Sebastian Raschka Have you tried having an __all__ = ["package_item", ] in __init__.py files rather than from ???? import * statements? yes, I tried it first and really couldn't get it

Categories : Python

using wregex creates garbage output?
You need to convert from the UTF8 encoding of the file to the UTF16 encoding that std::wregex uses. With C++11 you can do it using std::codecvt_utf8_utf16: std::wifstream file("ftest.txt"); file.imbue(std::locale(file.getloc(), new std::codecvt_utf8_utf16<wchar_t>()); // "file" will now read UTF8 and output UTF16. Pre C++11 you can use boost::locale to convert: e.g. auto w_s = boost::locale::utf_to_utf<char>(s);

Categories : C++

Android App Creates Incomplete Images
try this code public Bitmap PutoverBmp(Bitmap all, Bitmap scaledBorder) { Paint paint = new Paint(); final int width = bmp.getWidth(); // bmp is your main Bitmap final int height = bmp.getHeight(); patt = Bitmap.createScaledBitmap(bmp, width, height, true); Bitmap mutableBitmap = patt.copy(Bitmap.Config.ARGB_8888, true); Canvas canvas = new Canvas(mutableBitmap); scaledBorder = Bitmap.createScaledBitmap(border, width, height, true); paint.setAlpha(100); canvas.drawBitmap(scaledBorder, 0, 0, paint); return mutableBitmap; } simply call this Bitmap combine = (bmp , yourOtherBitmap);

Categories : Android



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