w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Get project path from POCO migration Seed()
You should use System.Reflection.Assembly.GetEntryAssembly().Location Note that it will return the path of your process exe. You'll have to use System.IO.Path.GetDirectoryName(path) to get the path of the directory containing your process exe. For MSDN : GetCallingAssembly => The assembly of the method that invoked the currently executing method. GetExecutingAssembly => The assembly that contains the code that is currently executing. GetEntryAssembly => The assembly that is the process executable.

Categories : C#

Generating admin user from the Seed() method
Found the solution here: http://kevin-junghans.blogspot.se/2013/01/seeding-customizing-aspnet-mvc.html / Mikael

Categories : Asp Net Mvc

How to monitor Seed method in an Azure Deployment?
If the application is running on Windows Azure Websites, you can instrument your seed and migration methods with calls to System.Diagnostics.Trace and then you can stream the log to the command line: azure site log tail mysite For details on the procedure refer to Streaming Diagnostics Trace Logging from the Azure Command Line (plus Glimpse!) and How to debug an application in Windows Azure Web Sites. You can also view the log stream in Visual Studio. As described in Announcing the release of Windows Azure SDK 2.0 for .NET, this can be done in the Server Explorer, connecting to the web site and selecting the View Streaming Logs in Output Window command.

Categories : Azure

seed method works in local machine but not appharbor
The problem is probably that your connection-string isn't set by AppHarbor. I'm not entirely sure how to ensure that it does, but if you go to your configuration-page for the MSSQL-"addon" from here: Then set's the "SQLSERVER_CONNECTION_STRING_ALIAS" to your connection-string-name (in your case "MyContext" here: That should probably do the trick.

Categories : C#

Complex Relationships Entity Framework Seed Method
I would suggest approaching this in pieces: Add your user context.Users.AddOrUpdate( u => u.ID, new Models.User { ID=1, FirstName="James", LastName = "Rainey", UserName = "BloodyRu1n", Password = "bobcat*", Email = "james_1999@blue.com", CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now, IsActive = true } );//End User 1 Seed Then add the related data like Addresses, Roles, UserRoles etc. letting EF make the connections between tables: context.UserRoles.AddOrUpdate( r => r.ID, new Models.UserRole{ UserID = 1, //etc }, new Models.UserRole{ UserID = 2,

Categories : Asp Net

Create Entity Framework Seed method from existing database
Entity Framework itself should not be used for mass insertion/deletion/updating of records since the performance is really poor. If you want the seeding to be part of your migrations then you could include your SqlCommands inside your Seed method: protected override void Seed(Context context) { context.Database.ExecuteSqlCommand("Command Here"); } base.Seed(context);

Categories : C#

How to call a non-static method in an imported project (from another non-static method) in Visual Studio
you need to create object of the class which containing method you want and then you can call the public methods like below var obj = new MyImportedProject.MyImportedClass(); obj.MyPublicMethod1(); obj.MyPublicMethod2() Or new MyImportedProject.MyImportedClass().MyPublicMethod();

Categories : C#

Using a Java Method from another Project
You need to create a snaphot/util jar of the common project and include the jar in classpath of the dependent projects. This will fix your IDE problem. During the deployment, make sure to include this new JAR in lib/classpath location of the deployable projects.

Categories : Java

Call EJB method from web services project
The error message seems similar to this: JAX-WS server-side SOAPHandler that returns fault gets "Internal Error" on WebSphere v8 According to IBM: When webservices.unify.faults is set to "true", the runtime exception thrown by the application code is unified, and the client will receive a SOAP fault message indicating "Internal Error". The fix for this APAR is currently targeted for inclusion in fix packs and Please refer to the Recommended Updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980 Perhaps you could update your version of WebSphere to at least

Categories : Web Services

hiding method from certain layers in project
There is a separation of concerns by keepeing the User object as object that only holds data with no logic in it. you better keep it separated for the following reasons: As you stated, it is a bad practice since the Save' functionality will be exposed to other places/classes where it is irrelevant for them (This is an important for programming generally). Modifying the service layer - I guess you are using WCF web service as you can transfer a .NET object (c#/VB) to the service via SOAP. If you put the saving logic in the 'User' object, you can't replace it another webservice that receives a simple textual data structures like JSON or XML or simply doesn't support .NET objects. Modifying the data storage layer - If you want, for example, to store the data inside a different place like ot

Categories : Asp Net

In web site project call c# method using ajax
You need to make a webservice to handle the interaction with your .cs code on the backend. There are several different kinds of webservices available in .net. To start, check out http://msdn.microsoft.com/en-us/library/ms464040(v=office.14).aspx for a tutorial on how to build a .asmx webservice.

Categories : C#

Method to use existing project into newer one in Android
It seems you class cannot be instantiated. This may be : Visibility isn't public, or no public constructor Activity not declared in the manifest of your using application Android Dependencies or Android Private Libraries not exported in your library or final project

Categories : Java

Call C++ class method in a C function on same project
You can not use a C++ method directly, you have to create a function in order to call your object's method. Here is an example (part of a C++ file): extern C { void example(int Line, char *string) { static MainWindow win; win.putsDisplay(Line, string); } } C code: int main() { example(42, "it is an example"); return 0; } extern C will disabled name mangling, so example() can be called from C code. You can keep static MainWindow win;, or made it global or whatever, but you will need an MainWindow object.

Categories : C++

Right way to pass a NULL Pointer to a out of process COM Method in an ATL Project
I don't know what you are doing, the CGame::passNull() function gives no insight at all how the argument is supposed to be treated. But the stub has a legitimate bitch, you really are passing a NULL pointer. Valid client code would look like: BSTR bs = NULL; LONG r = p->passNull(&bs); ... SysFreeString(bs);

Categories : C++

undefined method `[]' for nil:NilClass when user unfollows project
When you click "Unfollow", this form hasn't a field named "followed_id" and your form hasn't any inputs, so params[:follow][:followed_id] will throw an error, add f.hidden_field :followed_id to your form: <%= form_for current_user.follows.find_by_followed_id(@project), :html => { :method => :delete } do |f| %> <%= f.hidden_field :followed_id %> <%= f.submit "Unfollow", class: "button" %> <% end %>

Categories : Ruby On Rails

"find" method for dictionary project for ruby / rspec
To pass in this spec you should simply return what you have added on your other method. Assuming that you implemented the add method, I believe the problem is that you don't know how to call the [] method on your context instead of in a variable. You can do like this: self[definition]

Categories : Ruby

How to get tests in unit test project to be run (when the method has parameters)
AFAIK, VS unit test don't support parameterized unit tests. Your only way is to write another, parameterless overload and call your method from there. BTW: The optional parameters are nothing but syntactical sugar; the method still requires the parameters. Example: public void Test_One(bool p1, string p2) //... public void Test_One() { Test_One(true, "defaultvalue"); } You should take a look at another framework, e.g. NUnit, which allows you to easily parametrize your tests (even with ranges, automatic combination of parameters etc.): See http://nunit.org/index.php?p=parameterizedTests&r=2.5

Categories : C#

Argument of set.seed in R
The seed argument in set.seed is a single value, interpreted as an integer (as defined in help(set.seed()). The seed in set.seed produces random values which are unique to that seed (and will be same irrespective of the computer you run and hence ensures reproducibility). So the random values generated by set.seed(1) and set.seed(123) will not be the same but the random values generated by R in your computer using set.seed(1) and by R in my computer using the same seed are the same. set.seed(1) x<-rnorm(10,2,1) > x [1] 1.373546 2.183643 1.164371 3.595281 2.329508 1.179532 2.487429 2.738325 2.575781 1.694612 set.seed(123) y<-rnorm(10,2,1) > y [1] 1.4395244 1.7698225 3.5587083 2.0705084 2.1292877 3.7150650 2.4609162 0.7349388 1.3131471 1.5543380 > identical(x,y) [1] FALS

Categories : R

Seed random in 64-Bit
On iOS, just use arc4random(3) and don't worry about seeding.

Categories : IOS

How many times to use set.seed(123)
It really depends on how you foresee the code changing in the future. If you expect that you will be including commands at an earlier point in the code that will require random number generation and you want to replicate the results you were getting earlier before inserting that code, you should use set.seed() at the appropriate points in your code. Example: set.seed(1) A <- rnorm(10) B <- rnorm(10) C <- rnorm(10) ## I always want "C" to be the results I get here set.seed(1) AA <- rnorm(10); BB <- rnorm(10); CC <- rnorm(10) identical(A, AA) # [1] TRUE identical(B, BB) # [1] TRUE identical(C, CC) # [1] TRUE set.seed(1) A <- rnorm(10); B <- rnorm(10); C <- rnorm(10) set.seed(1) AA <- rnorm(10); BB <- rnorm(10); BA <- rnorm(10); CC <- rnorm(10)

Categories : R

What method am I missing? MissingMethodException on project.apply plugin: 'customPlugin'
The full stack trace should tell you where the problem is. You can get it from Gradle's HTML test report, from your IDE, or by reconfiguring test.testLogging. PS: Please don't double-post here and on http://forums.gradle.org.

Categories : Groovy

Linker error in VS2010 (2 project in solution and static method)
Try to implement the static method in the .h file like: // example.h class Example { public: void method1() { static_method(); }; private: static void static_method() { // implementation } }; // example.cpp /* nothing here yet... */ // main.cpp void main() { Example e; e.method1(); // it works! }

Categories : C++

How to find all Java method calls and given parameters in a project programmatically?
Ok, here's how I did it. Not the optimal solution, but works for me. I created a utility program in Java to find all the method calls and compare the parameters to existing translations. Find all classes in my project's root package using the Reflections library Find all getTranslation method calls of the correct class in the classes using the Javassist library and create a list of them (contains: package, class, row number) Read the appropriate .java files in the project directory from the given row until the ';' character Extract the parameter value and add it to a list Find the missing translations and output them Find the redundant translations and output them It took me a while to do this, but at least I now have a reusable utility to keep the translation files up to date.

Categories : Java

Is Angular-Seed necessary for a Java EE app?
You don't need them, they are just boilerplates to help people organize themselves. I think you should go with your own design so you can have a bit of thinking and dig into the framework (you should do it if you decide to pick angular, relying on others design won't help you when in trouble), and then refer to it when you are in doubts.

Categories : Java

How to run seed.rb file on Amazon ec2
You need to create keypair to access the amazon instance(which i think you already have). Make sure that ssh access is enabled in the current selected security group. You can connect to the amazon instance using ssh -i path/to/keypair.pub ec2-user@ec2-an-ip-address.compute-1.amazonaws.com Then cd into the app directory and run bundle exec rake db:seed RAILS_ENV='staging' assuming that you're running the app in staging environment.

Categories : Ruby On Rails

What's the meaning about the parameter seed
A seed is usually used to determine specific sequences of pseudo-random numbers. If you want the same repeated order of numbers on every run you use the same seed. Random number generators can use time stamps to make sure seeds vary, but for testing it it extremely useful to be able to set such seeds. I assume the seed in this case will have a similar meaning, it will mean the outcome of Sizzle will be identical on every run if the seed is the same, if it is different the outcomes will be different.

Categories : Javascript

Random seed across different PBS jobs
You may want to look into using random substreams, for correct randomness and reproducibility when running in parallel. The RandStream class allows you to create a pseudorandom number stream - numbers drawn from this stream have the properties you'd hope for (independence etc) and, if you control the seed, you also have reproducibility. But it may not be the case that, for example, every second or every fourth number drawn from the stream has the same properties. In addition, when you use parfor you have no control over the order in which the loop iterations are run, which means that you will lose reproducibility. You can use a different substream on each worker within a parfor loop. Some RNGs, for example mlfg6331_64, a multiplicative lagged Fibonacci generator, or mrg32k3a, a combine

Categories : Matlab

How to seed relationships using code first
you can use something like this: context.Question.AddOrUpdate( p => p.Id, new Models.Question { Question = "Bathroom flooring", //Active = true, Answers = new System.Collections.Generic.List<Answers>(){ new Answers {Id=1, Text = "Carpet",SortOrder=60 }, new Answers {Id=2, Text = "Carpet",SortOrder=60 }, new Answers {Id=3, Text = "Carpet",SortOrder=60 }, new Answers {Id=4, Text = "Carpet",SortOrder=60 }, new Answers {Id=5, Text = "Carpet",SortOrder=60 }, } });

Categories : Entity Framework

How can I Seed data from a SQL file?
I GOT THE ANSWER :) I finally manage to solve this problem. Here is the code, maybe someone needs it ! var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; context.Database.ExecuteSqlCommand(File.ReadAllText(baseDirectory + "\IF YOU HAVE ANOTHER DIRECTOR INSIDE BASEDIR \SQL" + "\YOURFILENAME.sql")); It works for me very good and fast. It's optimized and readable.

Categories : SQL

How to seed the PRNG for BN_generate_prime
BN_generate_prime is a deprecated function, says here. Also, it is defined in crypto/bn_depr.c. You shouldn't use it to generate primes. Instead, you should use BN_generate_prime_ex. Here's the sample usage of BN_generate_prime_ex: BIGNUM *r; static const char rnd_seed[] = "string to make the random number generator think it has entropy"; r = BN_new(); RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime_ex may fail */ BN_generate_prime_ex(r, 512, 0, NULL, NULL, NULL); BN_free(r); Then you'll have a 512-bit pseudo-random prime number. As the above example, you can seed the PRNG by RAND_seed. For the second question, try BN_num_bits.

Categories : C

1. How to call a controller method using url in .jqgrid & 2. Visual Studio Cannot load a project
The reason is because you use really old demo. One can see on the screen that you use Microsoft Visual Studio 2012 which has no support for MVC 1.0. You need first convert MVC 1.0 to MVC 2.0 with the old tool and then convert MVC 2.0 to MVC 3.0 with another tool. I would recommend you to start better with the demo from the answer which is also relatively old. It uses MVC 2.0, but using the second conversion tool MvcAppConverter.exe you can convert it to MVC 3.0. One small step (converting of unneeded using System.Xml.Serialization; line in ModelsHaackOverflowEF.Designer.cs) one have to do manually. UPDATED: I verified that the demo which you referenced (http://code.haacked.com/mvc-1.0/JQueryGridDemo.zip) is already in ASP.NET 2.0 so it's enough to use only one conversion tool (downloadab

Categories : C#

Error while trying to run project uncaught exception thrown by method called through reflection
Well if it is a problem with the installation then I would recommend reinstalling. :( Maybe try checking for updates and/or restarting your PC. If you still can't run your projects then I would recommend re-installing.

Categories : Dotnet

Rails: link_to do syntax - undefined method `stringify_keys' for #
You should define name of the link inside the block like this: = link_to project, method: :delete, data: { confirm: 'Are you sure?' } do %br Hello You can also use project_path(project) for link url. But a persisted instance variable with delete method will also go to destroy action. Have a try.

Categories : HTML

Can't download Xcode5 GM seed from my Mac Dev Account
You can find it like under this page:

Categories : IOS

angular.js + require.js + multipage seed
Here is a solution for angular+ require + grunt + karma project. You can just start with it and use consept in your project. https://github.com/azadorozhniy/kickstart_angular

Categories : Angularjs

Something similar to /dev/urandom with configurable seed?
taken from urandom documentation When a Linux system starts up without much operator interaction, the entropy pool may be in a fairly predictable state. This reduces the actual amount of noise in the entropy pool below the estimate. In order to counteract this effect, it helps to carry entropy pool information across shut-downs and start-ups. To do this, add the following lines to an appropriate script which is run during the Linux system start-up sequence: echo "Initializing kernel random number generator..." # Initialize kernel random number generator with random seed # from last shut-down (or start-up) to this start-up. Load and # then save 512 bytes, which is the size of the entropy pool. if [ -f /var/random-seed ]; then cat /var/rand

Categories : Linux

Determine the seed of C# Random Instance
The implementation of Random doesn't store the seed anywhere - it uses a seed array instead. So unfortunately there's no way to determine the seed. The constructor for Random which takes a seed looks like this: public Random(int Seed) { this.SeedArray = new int[0x38]; int num4 = (Seed == 0x80000000) ? 0x7fffffff : Math.Abs(Seed); int num2 = 0x9a4ec86 - num4; this.SeedArray[0x37] = num2; int num3 = 0x1; for (int i = 0x1; i < 0x37; i++) { int index = (0x15 * i) % 0x37; this.SeedArray[index] = num3; num3 = num2 - num3; if (num3 < 0x0) { num3 += 0x7fffffff; } num2 = this.SeedArray[index]; } for (int j = 0x1; j < 0x5; j++) { for (int k = 0x1; k < 0x38; k++) {

Categories : C#

Cant' seed files to my Rails app on Heroku
Heroku is a read-only filesystem, so you cannot upload images. Probably this will help https://devcenter.heroku.com/articles/read-only-filesystem

Categories : Ruby On Rails

How does Python seed the Mersenne twister
From this answer, I found the source of random.py. In the Random class, the seed is set when the object is constructed. The module instantiates a Random object and uses it for all of the module methods. So if the random number is produced with random.random() or another module method, then the seed was set at the time of the import. If the random number is produced by another instance of Random, then the seed was set at the time of the construction of that instance. From the source: # Create one instance, seeded from current time, and export its methods # as module-level functions. The functions share state across all uses #(both in the user's code and in the Python libraries), but that's fine # for most programs and is easier for the casual user than making them # instantiate their own

Categories : Python

Node JS newbie: why do I get a 404? (angular-seed)
Make sure you run the server from your root directory. ~/angular-seed/ In here you do node scripts/web-server.js Then you can visit http://localhost:<PORT>/app/index.html

Categories : Node Js

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