w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
allow just one user to access to his account in the same computer
First things first... It's an good practise to start the session at top of the page. so right after the first <?php tag you start the session session_start(); Then you need to unset the session variable first if an user is already logged in. So at the moment that you logout, you can do this: // everything fine for logout??? session_unset(); session_destroy(); // rederict to login / home page or whatever... And at the login part: if(pg_num_rows($result3) != 0 ) { //success if(isset($_SESSION['logged-in']) || isset($_SESSION['user']){ session_unset(); session_destroy(); } $_SESSION['logged-in'] = true; $_SESSION['user']=$usuario1; header('location: http://localhost/public_html/teacherLv3.php'); exit; }else if(pg_num_rows($result

Categories : PHP

Do I have to create an Account, Merchant Account, or just a customer to Credit a Balanced Bank Account?
Your workflow is correct. The Customer resource abstracts away from you the pain the Account resource had when dealing with underwriting a merchant. Underwriting is required as part of the KYC (Know Your Customer) operation requirements Balanced needs to follow. Each Customer has an attribute named is_identity_verified where you can know if the Customer's identity was verified. Ideally you want to make sure the identity is verified for each Customer to which you will be crediting. While you can still perform credits (I believe up to a certain limit) to Customers whose identity is not verified, you run the risk of increased fraud and there may eventually be consequences to your marketplace. Also, feel free to stop by #balanced on IRC. You'll probably get much faster answers to your questi

Categories : Misc

How Can I Return Exit Code To Variable On Local Computer From Script Run On Remote Computer?
I do it like this: invoke-command -session $Remote -scriptblock { mycommand } $remotelastexitcode = invoke-command -session $Remote -ScriptBlock { $lastexitcode } if ( $remotelastexitcode -ne 0 ) { "$remotelastexitcode" exit 1 }

Categories : Powershell

Programatically set the time server of a remote computer to match the control computer?
You might be better off using Group Policy to set the time server. http://technet.microsoft.com/en-us/library/cc779145(v=WS.10).aspx

Categories : C#

Running a jar in a computer java.lang.UnsatisfiedLinkError lwjgl.dll in another computer
This problem generally occurs when your jar trying to use native library of operating system.In windows it is "LWJGL.DLL". java.lang.UnsatisfiedLinkError occurs if the JVM cannot find this file. try to find the existence of this file in machine 2 where your jar file is not working and try to add them to path if they does not exists.

Categories : Java

Executing command ls from windows computer to linux computer
I'm certain you could do something with sockets and system calls, but it would probably be easier to use the built in facilities and/or programs available for each. If both are on the same network, you could run an FTP or SSH server program on the Ubuntu computer and connect to it via a FTP/SSH client, like PuTTY. Sending 'ls' through PuTTY would then yield what you want it to. OpenSSH vsFTPd

Categories : C#

Disable silent access to account in account manager from 3rd party apps
Ok so the answer is rather simple..The certificate matter! If those apps are signed with different certificates, the screen appears.

Categories : Android

Fast Constrained Least Squares
As mentioned in the comments: The used commands are highly optimized, and switching languages is not going to make a world of difference. First of all go back to what you are trying to achieve, perhaps to achieve that you don't need to solve this many hard problems. If you come to the conclusion that you do want to do this exact calculation, consider changing the settings, and play around with the algorithm. From doc lsqlin it appears the two main parameters that determine the speed are: Number of iterations Accepted tolerance If all these things don't help enough, consider some tricks like: Only solving problems that are sufficiently different Solving with easier constraints, and rounding the result

Categories : Python

Autofac constrained binding
I can't think of any neat and concise implementation of such mechanism with Autofac, but maybe you can make use of one of Autofac's meanings of selecting implementation. I'd use keyed services, which in your case would look like this: first, instead of custom attributes you'd need to define an enum enum RepositoryKind {CacheNeeded, DataNeeded} then register components marking them with those that provide Cache or data functionality, for exaple like this: builder.RegisterType<DbRepository>() .Keyed<IRepository>(RepositoryKind.CacheNeeded); builder.Register(c => new CacheRepository(c.ResolveKeyed<IRepository(RepositoryKind.CacheNeeded))) .Keyed<IRepository>(RepositoryKind.DataNeeded); builder.Register(c => new HomeController(c.ResolveK

Categories : C#

Account Activity and Account Usage access not working
I've been having the same problem, at it seems that IAM users are not allowed to see the account activity even if they have the permissions set. Found a mention of this problem on the amazon forum, see https://forums.aws.amazon.com/thread.jspa?threadID=86391 Update: I've since found that it can be done. As well as setting the required permissions to the user in IAM, you also need to enable that option within the main AWS account. Login using the main AWS credentials, and go to 'Manage your account'. On that page there is a section to do with enabling access to the account activity, make sure that both boxes are ticked and click the button to enable/activate these permissions. Once that has been done, IAM users will then be able to see the account activity.

Categories : Amazon

Do we have to have a real bank account for paypal developer's account?
1) Not a whole lot. In most cases people use Personal accounts in the sandbox as payer accounts, and use business accounts for seller accounts. You need a business account setup for things like Payment Pro, Payments Advanced, etc. 2) No, when you create your developer sandbox accounts they will get setup with a fake bank account and credit card number. 3) No, any transactions made in the sandbox are completely fake, but it does allow you to complete transactions all the way through so you can see the entire flow, and then also see what it looks like in each user's PayPal account. 4) Answered in #3. 5) Not exactly sure what you're asking here. Just login to http://developer.paypal.com and go into the Documentation section. Everything you need is in there.

Categories : Paypal

Why isn't lift's return value constrained to be a monad?
My guess is that a MonadTrans transforms a Monad into something else, instead of transforming a Monad into a Monad. It's more generalized, since you might write something that transforms a Monad and you can define lift, but you can't define >>= and return. Since most (if not all) MonadTrans instances end up being Monads, it doesn't really present a problem as the compiler still handles it just fine.

Categories : Haskell

Constrained least-square regression - Matlab or R
Just center the data appropriately and force the regression through the 'origin': lm(y ~ I(x-x0)-1, offset=rep(y0,nrow(dat)) data=dat) You might then need to adjust the intercept coefficient accordingly. edited: offset needs to be a vector of the correct length. Another way to do this would be: set.seed(1) d <- data.frame(x=1:10,y=rnorm(10,mean=1:10,sd=0.1)) x0 <- 3 y0 <- 3 (lm1 <- lm(y ~ I(x-x0)-1, offset=y0, data=data.frame(d,y0))) This gives a slope of 1.005. The intercept would be coef(lm1)*(-y0/x0), I think.

Categories : R

constrained optimization of quadratic function
I have got this to work. Thanks to Hao Ooi for guiding me on the same. My problem was that: I was using: fn <- function() { -(0.653*x[1]+ 0.234* x[1]*x[1]+ 0.437 * x[2] + 0.769 * x[3] + 0.453 * x[4] + 0.744 * x[5] + 0.476 * x[5]* x[5]) } Instead, I should have used: fn <- function(x) { -(0.653*x[1]+ 0.234* x[1]*x[1]+ 0.437 * x[2] + 0.769 * x[3] + 0.453 * x[4] + 0.744 * x[5] + 0.476 * x[5]* x[5]) }

Categories : R

Constrained Spline Fit using Scipy in Python
Reading the question you linked, I think you only need x to be monotonic. If your data is a Series with x as the index, then just do UnivariateSpline(s.sort()). If your data is a DataFrame, do UnivariateSpline(df.set_index('x')['y'].sort()). Perhaps you actually want a monotonic spline, in spite of the fact that y(x) does not seem to be monotonic. I know of no way to introduce constraints to UnivariateSpline directly, but we can constrain the data before we fit the spline. Generate a "forced monotonically decreasing" variant of your data like this: pd.expanding_min(s.sort()) Each element will be replaced with the smallest element seen so far, suppressing any increases. Any spline from such data should also be monotonic. Finally, in general, for curve fitting with constraints, checkout

Categories : Python

Create constrained random numbers?
Try this: import random a = random.randint(10, 30) b = random.randint(5, 20) c = random.randint(10, 25) d = random.randint(5, 15) e = 100 - (a+b+c+d) EDIT: Here's how you'd generate a list of n random numbers, given n range constraints and the desired target sum: def generate(constraints, limit): ans = [random.choice(c) for c in constraints] return ans if sum(ans) == limit else generate(constraints, limit) This is how you'd use it: generate([range(10,31),range(5,21),range(10,26),range(5,16),range(10,26)], 100) => [25, 20, 25, 12, 18] Be aware, though: if the constraints don't guarantee that the sum is eventually reached, you'll get an infinite loop and a stack overflow error, for example: generate([range(1,11), range(10, 21)], 100) => RuntimeError: maximum recursio

Categories : Python

Find missing values, constrained by another value
Let's start by creating a saved query named [AccountCombinations] that gives us all combinations of ParentAccount and AccountNum: SELECT t2.ParentAccount, t1.AccountNum, t1.AccountName FROM Table1 t1, ( SELECT DISTINCT ParentAccount FROM Table2 ) t2 That query returns ParentAccount AccountNum AccountName ------------- ---------- ----------- 100 1 a 200 1 a 100 2 b 200 2 b 100 3 c 200 3 c 100 4 d 200 4 d Now we can just extract the ones that don't exist in Table2 SELECT * FROM AccountCombinations WHERE NOT EXISTS ( SELECT *

Categories : Ms Access

device motion in constrained environment
(I am writing in pseudo-code since I don't know the API you are using, sorry.) Here is how to get the axis and angle of the rotation. Get the rotation matrices R1 and R2 at the beginning and end of your rotation directly from the API (see CMAttitude and CMRotationMatrix). Then, determine the angle and axis of the rotation R that brings R1 to align with R2. You get R as follows: R = R1 * transpose(R2) The angle of rotation R is angle = acos((trace(R)-1)/2) and its axis is axis = { R[3][2]-R[2][3], R[1][3]-R[3][1], R[2][1]-R[1][2] } For further details, please check Rotation matrix to axis angle and also Axis-angle. I am not sure how to get the angle you are interested in. Nevertheless, I hope that the above helps. Please don't use roll, pitch and yaw anything other than dis

Categories : Iphone

constrained optimization of a complicated function
Once the problem is stated correctly you maybe able to firstly map the parameters to lower and upper bounds of [0,1]. You can then implement the inequalities inside your function and optimise using an algorithm which accepts basic lower and upper bound constraints. nlminb could be used but the vignette suggests the algorithm used may not be the best. UPDATE: With OP revised function dumFun <- function(p){ p[1] -> M_CD; p[2] -> M_CC; p[3] -> M_A; p[4] -> M_D; p[5] -> M_P; M_P <- 9*M_P; M_D <- M_P*M_D; M_A <- M_D*M_A; M_CC <- M_A*M_CC; M_CD <- M_CC*M_CD; p[6] -> G_CD; p[7] -> G_CC; p[8] -> G_A; p[9] -> G_D; G_D <- 9*G_D; G_A <- G_D*G_A; G_CC <- G_A*G_CC; G_CD <- G_CC*G_CD; p[10] -> S_CD; p[11] -> S_CC; p[

Categories : R

School Scheduling (Constrained Logic)
The wording of the Question suggests that a program is to be written that will produce (or at least check) a proposed class schedule. Inputs to the program appear to be a list of teachers (and their subjects), a list of time slots, and a list of classes (and their subjects/grades). Presumably there are several "cardinality" restrictions (sometimes called "business rules") that a proper class schedule must meet. A class can only be given once (not two time slots) is the point of the Question, but also a teacher can only teach one class per time slot, etc. How can these restrictions be indicated? Prolog predicates do not have inherent restrictions of this kind, but they can be implemented either structurally or logically (i.e. in the program's logical checking). An example of doing thi

Categories : Prolog

Constrained linear regression coefficients in R
If the x and y values are the same, then you could use this model: lm( I(z1+z2)~ x +y ) # Need to divide coefficients by 2 If they are separate data then you could rbind the two datasets after renaming z2 to z1.

Categories : R

get list of logged on users on remote windows computer from a list computer
It (csv file) should be formatted as follows: computername server1 server2 server3 'Computername' is the column name. This can be derived from the code snippet as the Foreach-Object refers to the ComputerName property.

Categories : Windows

Generic constrained Map using higher-kinded-types?
In your case you can use simple solution (only changed code): abstract class Resolver[T <: Result] { def result(): T } object Loader { val cache = collection.mutable.Map[Resolver[_], Any] () def get[K <: Result](k: Resolver[K]): K = { cache.getOrElseUpdate(k, { k.result } ).asInstanceOf[K] } }

Categories : Scala

Contravariance on constrained generic type parameters
Answer to initial question You're currently trying to convert a single element of type TDerived to a sequence of type Base. I wouldn't expect your Cast call to work either, as TDerived doesn't implement IEnumerable - I suspect you've actually got that to work in a different situation instead. I suspect you actually meant: void Test3<TDerived>(IEnumerable<TDerived> derived) where TDerived : Base { IEnumerable<Base> b = derived; } That compiles with no problems. Answer to edited question Okay, now we've got the real problem between two type parameters, the issue is that the compiler doesn't know that they're reference types - which is required for generic variance. You can fix that with a class constraint on TDerived: void Test3<TDerived, TBase>(IEnumerabl

Categories : C#

How do I change my Sandbox account into a live account?
Currently you are having PayPalMode,PayPalApiUsername,PayPalApiPassword,and PayPalApiSignature for test or sandbox mode. But to run on LIVE mode you need to again grab all the above mentioned details from the Real LIVE PayPal account. Do let us know the Payment method you are using ! I am assuming for DoDirect Payment Method. Just set PayPalMode = 'live';

Categories : Api

AdMob account migration and AdSense account
As I understand, if you have failed to use AdSense on your account, you cannot use that e-mail address as your new Admob account. I faced the same issue and the following scenario succeeded: Create a new gmail account. Create a new admob account using that e-mail address. Link your new admob and legacy admob. (This is described on the new admob and google support pages) Import your data on legacy admob to the new admob. To be honest, I am reluctant to perform that last step because of the new policies of new admob: Payment methods are changed: As I understand, paypal is no longer a valid payment method. EFT and western union checks are valid forms of payment. To select the payment method, one has to reach $10 balance. More information may be required to select the payment meth

Categories : Android

Remove my app from android account manager "add account"
As far as I understand, you do not want users to have multiple accounts of your service in a device. I see two options here: Manage if user has already added an account. When user navigates to Settings > Accounts > Add account and choose your service, you will check if there is any registered account on the device. If there is, reject the new authentication. Disable "myPackage.authenticator.AuthenticationService" right after user adds her first account (may not be safe), so that system (Settings app) will not be able to locate your service when it is parsing for authentication providers.

Categories : Android

Retrive vertices from CGAL's Delaunay Constrained Triangulation
The following works fine with CGAL 4.2. Note that with CGAL 4.3 there will be a dedicated function doing the job in a more integrated way like it is done here for the Delaunay_triangulation_2 class. #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Constrained_Delaunay_triangulation_2.h> #include <CGAL/Triangulation_vertex_base_with_info_2.h> #include <CGAL/Spatial_sort_traits_adapter_2.h> #include <vector> typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned, K> Vb; typedef CGAL::Constrained_triangulation_face_base_2<K> Fb; typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS; typedef CGAL::Exact_predicates_tag

Categories : C++

Haskell-like type-constrained trait implementation in Scala (?)
The type class pattern in Scala works like this: trait Serializable[-T] { def toDifferentString(v: T): String } class SerializableTree[T : Serializable] extends Serializable[Tree[T]] { def toDifferentString(t: Tree[T]) = t match { case Leaf() => "" case Node(v, left, right) => val vStr = implicitly[Serializable[T]].toDifferentString(v) val lStr = toDifferentString(left) val rStr = toDifferentString(right) s"Node($vStr, $lStr, $rStr)" } } object SerializableTree { implicit def st[T : Serializable]: Serializable[Tree[T]] = new SerializableTree[T] } Type classes in Scala are implemented as a pattern, where the type class provides one or more methods that take as one of their parameters the class for which they are providing these methods. T

Categories : Scala

CGAL: remove faces from a constrained Delaunay triangulation
You cannot have "no faces". However, you can have a marker in each face indicating if you consider it or not. This is what is done in this example where you can triangulate a polygonal domain.

Categories : Misc

Ping remote computer from another remote computer and get result back
According to Windows IT Pro (referred in Microsoft TechNet): PsExec displays the process's exit code and returns the exit code as its own exit code. So, your batch should work. Put ECHO ErrorLevel=%ERRORLEVEL% after PSEXEC ... just to get sure. To disable outputing, append >NUL 2>NUL or >NUL 2>&1 to PSEXEC ... command-line. Without /f as you used (where did you get it???)

Categories : Windows

Delegation pattern in Obj-C - Am I doing it wrong?
If there is a clear 1:1 mapping of what those delegate protocols provide AND the delegate does not deal in UI stuff that nothing except the directly owning view controller should be concerned with, you could pass the delegate along to the end of the chain and set it directly as a delegate. This is what delegates are for - being able to allow an otherwise unconcerned object to communicate with another object. That said, depending on how strict your layering policy is, you may prefer to encapsulate the information at every step by having different delegates.

Categories : IOS

How does Abstract Factory uses delegation
Lets take this sentence and figure out what it is. AbstractFactory pattern uses composition to delegate responsibility of creating object to another class Abstract Factory can be termed as "Factory of Factory pattern". Here one more class will be there, lets call it FactoryOfFactory which creates/holds multiple Factories depending on the type of request and returns the end product. class FactoryOfFactory { enum Type { P1, P2} public AbstractProductA createProductA(Type t) { switch(t) { case P1: return new ConcreteFactory1().createProductA(); case P2: return new ConcreteFactory2().createProductA(); .... } } public AbstractProductB createProductB(Type t) { switch(t) {

Categories : Java

NSNotificationCenter vs delegation - which is faster?
i know that here i should use the delegate BUT my question is : does delegates will be faster ? It is easy: try and share the results! The delegate when 1:1, point to point relationship can be faster than the 1:m publish and subscribe in any system. Is it faster hard to answer, because it depends on environment. When aren't a lot of listeners and the publisher not need to search a lot for listeners, then should be similar performance, but when are a million of subscribers and need to search it, then can be a delay, frame rate decrease.

Categories : Objective C

Bootstrap tabs and delegation example
Try it: $(function(){ $('a[data-toggle="tab"]').on('show', function (e) { console.log(e.target); // activated tab }); }) But if your doing with dynamic content. try it: function bindtabs(){ $('a[data-toggle="tab"]').on('show', function (e) { console.log(e.target); // activated tab }); } And after you create your tabs you call it: //creating tabs code here bindtabs();

Categories : Javascript

How to use Propel class delegation
Right, I just switched to MySQL's InnoDB engine, so I can make use of constraints, and my new parent table looks like the following. This illustrates where things are going wrong; the relationships on the tables are the wrong way around: CREATE TABLE `process_step` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `process_id` INTEGER NOT NULL, `ordinal` INTEGER NOT NULL, `comment` VARCHAR(256), `type` TINYINT NOT NULL, `is_enabled` TINYINT(1) DEFAULT 0 NOT NULL, PRIMARY KEY (`id`), INDEX `process_step_FI_1` (`process_id`), CONSTRAINT `process_step_FK_1` FOREIGN KEY (`process_id`) REFERENCES `process` (`id`), CONSTRAINT `process_step_FK_2` FOREIGN KEY (`id`) REFERENCES `process_step_load` (`id`) ON DELETE CASCADE, C

Categories : PHP

Classloader delegation model
According to ClassLoader API the default delegation model works this way When requested to find a class or resource, a ClassLoader instance will delegate the search for the class or resource to its parent class loader before attempting to find the class or resource itself. This delegation model is implemented in ClassLoader.loadClass method, to change it you should override loadClass method instead of findClass

Categories : Java

Delegation to sister class
Because this are the virtual functions and call is call to function from VirtualFunction table. It's just a lookup in table by defined index. This table get it data when object is constructed, and since dynamic type of the object is Join, and this type have entries for all virtual functions, inherited from base classes.

Categories : C++

Different Behavior between Numeric Literals and Constrained Function Parameters in Haskell
Try to write Vec2 (3,4 :: Int) <*> (5 :: Int) In Vec2 (3,4) <*> 5 it is not guarantee that 3,4 ::Num a and 5 :: Num b have the same a and b

Categories : Haskell

Resizing the container, the two grey squares should grow as much as possible, constrained by the diagonal.. easy way to do it?
If you take the line that goes through the diagonal of the square and search for the intersection with the diagonal of the rectangle, you'll find the point that the square will have to reach. You can use the distance between this point and the origin to compute the length of the diagonal of the squares and trivially get the side. $("#container").resizable({ resize: function (event, ui) { var w = ui.size.width; var h = ui.size.height; var m = h/w; var c = -h; var x = c/(-1-m); var y = -1*(c/(-1-m)); var diag = Math.sqrt(Math.pow(x,2) + Math.pow(y,2)); var l = diag/Math.sqrt(2); $("#left").width(l).height(l); $("#right").width(l).height(l); } })

Categories : Javascript



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