w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Adding a stencil on a black overlay with CSS - Inverted circle mask
I'll show you 2 examples, with an DIV as overlay, and with HTML5 canvas. DIV overlay: LIVE DEMO I would suggest to create an big square opaque .png with four 1/4 circle holes at each corner. Set it as repeated background for the .overlay. Than setting that DIV's packground-position: Xpx , Ypx; you'll perfectly target any desired area at the exact center. HTML: <div id="img"> <div class="overlay"></div> </div> CSS: #img { position:relative; overflow:hidden; width: 199px; height: 390px; background: url('iphone.jpg') no-repeat center center; } .overlay { position:absolute; height:100%; width:100%; background:url(http://i.stack.imgur.com/ohb0l.png); /* PLAY HERE: */ background-position: 120px 130px; } Ot

Categories : CSS

Google Maps: Dynamically Movable and Resizable Circle Overlay Script for v3
That functionality is built in to the Google Maps API v3 Drawing Library Example You can customize it to just allow circles (or just allow one circle). Working example

Categories : Google Maps

PHP password_verify always returning false
So nothing wrong with the password_verify() function. There was an added bit of string in the password_hash() function. I copy and pasted this function from the official documentation: echo password_hash("rasmuslerdorf", PASSWORD_DEFAULT)." "; The ." " bit at the end was not being accounted for at the verify function. This was only here due to the coping and pasting so once I removed it, it was fine. Hope this helps others in the future.

Categories : PHP

Why is this strstr() returning false?
Your parameters are inverted (see strstr). This is the correct way of using it: strstr($t, '/image/');

Categories : PHP

Ruby on Rails detecting a user, but still returning an error that it doesn't exist
I think, you build your thought for form in way like this: @new_thought = @post.thoughts.build After that, @post.thoughts includes @new_thought, too. And @new_thought.user is nil. That's why you get 500 error. You can modify your view: <%- if thought.persisted? -> -- your code <%- end -%

Categories : Ruby On Rails

JQuery AJAX always returning a false value
use from jQuery ajax with this setting, var data = { param1: 'A', param2: 'B' }; $.ajax({ url: 'url to call the controller method', type: 'POST', contentType: 'application/json; charset=utf-8', dataType: 'json', data: JSON.stringify(data), cache: false, success: function (data) { // your code here }, error: function (data) { // your code here } }); before test that please clear your browser cache.

Categories : Ajax

ReflectionClass getDocComment returning false
If you're using Zend Opcache, then look at the following ini settings: opcache.save_comments (default "1") If disabled, all PHPDoc comments are dropped from the code to reduce the size of the optimized code. Disabling "Doc Comments" may break some existing applications and frameworks (e.g. Doctrine, ZF2, PHPUnit) opcache.load_comments (default "1") If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments" may be always stored (save_comments=1), but not loaded by applications that don't need them anyway.

Categories : PHP

why is this method always returning false even when no error
the false at the end of cancel_subscription causes an implicit return. Basically, in Ruby, if no return statement is present a method will return whatever the final statement evaluates to. In this case it is equivalent to return false. You could try adding a return true in an appropriate place like this, since you want to return true any time a delete was successful. def cancel_subscription(customer_id) unless customer_id.nil? customer = Stripe::Customer.retrieve(customer_id) unless customer.nil? or customer.respond_to?('deleted') if customer.subscription.status == 'active' customer.cancel_subscription user.remove_role :pro if user.practices.size > 1 user.practices.delete(user.prac

Categories : Ruby On Rails

ModelState.isvalid returning false?
It seems your models are not connected. There is no same id filed. You may add userID to UserStats. And I think your RegisterMale method expects only one model UserStats. Just rewrite it as follows [HttpPost] [ValidateAntiForgeryToken] public ActionResult RegisterMale(UserStats model) { if (ModelState.IsValid) { var user = db.Users.SingleOrDefault(i => i.ID == model.userID ); db.UserStats.Add(userstats); db.SaveChanges(); return RedirectToAction("Details", "Dashboard", new { id = userstats.ID }); } return View(userstats); }

Categories : C#

PHP - MySQL Check only returning False
This is more of a code review answer, but it should help you nonetheless. First off, you will want to create a function to retrieve the status instead of including code files in this way: function getStatusId($db) { $result = $db->query('SELECT ID FROM status'); $rows = $result->fetchAll(PDO::FETCH_COLUMN, 0); return current($rows); // return first row or false } This function takes an existing database connection as its input and returns the value of the ID column. To call it: // create database connection $db = new PDO('mysql:dbname=removed', 'removed', 'removed'); // call your function if (getStatusId($db) == 1) { echo 'on'; } else { echo 'off'; } See also: PDO

Categories : PHP

Mage::getModel is returning false
Like always : Mage::getModel('ts_firstmodule/simpleoutput'); When you do a getModel / getBlock / helper / etc The first part of the parameter string is the XML node of the layer definied in the config.xml The second part is the full path to your file from the layer folder container. So, in your case : Mage::getModel('firstmodule/simpleoutput'); should load Ts/Firstmodule/Model/Simpleoutput.php Note : be carefull of the case of your resources (take a look a standard magento for good practices) !

Categories : Magento

WebSecurity.ChangePassword returning FALSE value
The WebPages Membership has everything built you do not need to get the users email address and password (I am guessing the email address is the username right?) The ChangePassword method takes 3 arguments. which is UserName, CurrentPassword, NewPassword. The reason your getting false is because your getting the old password from the database based on the users current Id, but the old password does not match the users current password because old one is encrypted and you're not encrypting the one they submit (in fact you don't even have a field for them to enter their current password). The WebPages Membership provider will do all the updating you do not need open the database and update the users password, the weird thing you're doing is telling the user to enter a new password but not

Categories : Asp Net

Any difference between returning False or True first?
The difference is that both the loops are checking for different results. The 1st loop is checking whether the $regexp matches all the elements of the array - In this case, it returns false as soon as a match fails and if the return statement after the for loop is reached, that means all the elements match. To be honest, not having the braces around the for loop can often be confusing (like it confused me first). I would suggest to add relevant brace: for ($i=0; $i<2; $i++) { if (preg_match($regexp, $names[$i])) { return true; } } return false; The 2nd loop is checking whether the $regexp matches any element of the array - In this case, it return true as soon as a match succeeds, and if the return statement after the for loop is reached, that means none of the eleme

Categories : PHP

SqlCeDataReader Read() returning false
I built the command to insert a card into the database but I never actually executed it. So nothing was ever inserted so when I go to retrieve the card it will return nothing because there is nothing in the database! I changed try { CardConn.Open(); SqlCeCommand insertCommand = new SqlCeCommand("INSERT INTO Data VALUES(@Name, @Pack, @Value, @Color, @Description)", CardConn); insertCommand.Parameters.Add("Name", c.Name); insertCommand.Parameters.Add("Pack", c.Pack); insertCommand.Parameters.Add("Value", c.Value); insertCommand.Parameters.Add("Color", c.Color); insertCommand.Parameters.Add("Description", c.Description); Console.WriteLine("Card inserted

Categories : C#

Web API 2 - returning JSON, a property that is false is not included
I think that by putting the [DefaultValue(false)] attribute above your success variable and other bool variables you should get your desired result. You have set DefaultValueHandling to Newtonsoft.Json.DefaultValueHandling.IgnoreAndPopulate. From the documentation we can read: Ignore members where the member value is the same as the member's default value when serializing objects and sets members to their default value when deserializing. As I read that it means that during serializing your false boolean values should disappear. However, as long as it has a default value it will appear in the JSON again when you deserialize.

Categories : Json

CodeIgniter db->query returning false on SELECT
I believe you are calling the wrong method to get the result. Try this return $query->result(); For more information about about Codeigniter active record go here

Categories : PHP

Derived ClaimsAuthorizationManager.CheckAccess Returning False in ASP.net MVC Web API
This is only an idea but I believe you could also set a flag in the Items container and then in the Application_EndRequest you could check if these two conditions occur: response status code is 500 the flag is set In such case you could just change the status code to 401.

Categories : Asp Net

NSMutableSet respondsToSelector addObject: returning false
You were checking something completely different... [NSClassFromString(theClass) init] needs to be [[NSClassFromString(theClass) alloc] init] instead.

Categories : Objective C

in_array returning false when it should return true
I think you want to check if $words is in $list: if(in_array($words[0], $list)) { ... } or define $stopwords: $stopwords = $list;

Categories : PHP

PHP cURL request to same server returning false
Must be related to locking session situations. Try this way. <?php $url = 'http://api.some_address_on_the_same_server.com'; $postdata = array(...); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); session_write_close(); $result = curl_exec($ch); // $result is always false when on the same server for some reason curl_close($ch); session_start(); ?> EDIT : Have you added an exception in your windows host file ? /windows/system32/drivers/etc/hosts like 127.0.0.1 yourdomain.com For more information. Check out this

Categories : PHP

Html.CheckBox returning value not true/false
This seems ridicouous but can you only return true/false from an MVC checkbox? I don't find it ridiculous. When you give it a second thought modeling a checked/unchecked state with a boolean variable actually makes sense. WHY! Because that's how the designers of the framework decided to implement the CheckBox helper. any ideas on how to get around this stupidity? By using a view model of course: public class MyViewModel { public int Id { get; set; } public bool IsChecked { get; set; } } and then assuming you had a collection of those you would use a checkbox and a hidden field to store the corresponding id of the item: @Html.HiddenFor(x => x.SomeCollection[i].Id) @Html.CheckBoxFor(x => x.SomeCollection[i].IsChecked) When the form is submitted you will

Categories : C#

Comparison with fmod() result returning false
Floating point number aren't exact. One way you could do this is, #include <limits> if (fabs(fmod(1.9,0.3) - 0.1) < std::numeric_limits<double>::epsilon()) { cout << "True." << endl; } However, this is a crude solution that isn't entirely correct. Do a few searches for how to compare doubles/floats on stackoverflow for some discussions on the issue.

Categories : C++

PHP OOP checking if a class is returning true or false?
I don't think PHP cares about your return statement in your constructor. It should always return the object that was created (the instance of Ping). Since the instance of Ping is not null, if(new Ping()) evaluates to true and '1' is echoed. If pinging is really just one call, why use an object? You can have this statically defined in a static library of some sort (e.g. NetUtils). If pinging is more complex and you think that it fits the object oriented model, then perform the ping in two steps. Ping pingObj = new Ping(); pingObj->ping();

Categories : PHP

MySQL number of rows always returning false
Just use object-oriented MySQLi functions. In your case $q_log_dates_result is an object and you can use its properties. $q_log_dates_result = mysqli_query($connection, $q_log_dates); //-Procedural //OR $q_log_dates_result = $connection->query($q_log_dates); //Object oriented if ($q_log_dates_result->num_rows > 0) { echo "data"; } else { echo "no data"; }

Categories : PHP

Magento resource model is returning false
Took a while to find it, I was using the wrong Abstract class. Im was using: Mage_Core_Model_Mysql4_Collection_Abstract Switching to the following solved it: Mage_Core_Model_Resource_Db_Collection_Abstract

Categories : Magento

fnmatch() returning false with pure wildcard
$perm is supposed to be a string, while in your example it is an array. fnmatch would not work correctly in this case, and you should have also seen a PHP warning about this. Also, the order of the arguments appears to be reversed. This test works as expected: var_dump(fnmatch('*', 'acl.adduser'));

Categories : PHP

get_headers is throwing a warning instead of just returning false?
You should have a look at the first comment on the php man page of get_headers It seems like it's working as expected. So you must either disable warnings, either find a workaround. After a quick search, I found this post on phpfreaks that might help you. The solution used there is to use gethostbyname first to resolve the IP address of the server, then retrieve the headers if it doesn't return false. Or more simply, disable the warning with an @ before the call. (See Can I try/catch a warning? and php's error reporting page)

Categories : PHP

Returning value from JDialog; dispose(), setVisible(false) - example
Quoted from the Javadocs: The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifications between those actions). So, your Response will be kept. All dispose() does is releasing the native screen resources, other members aren't marked for garbage collection. Also, if you want to be extra sure, you could just call dispose() right after you retrieved your response object.

Categories : Java

isinstance operator returning false on inheritance
No. b is an instance of either type or classobj, not of a. You may want the issubclass function instead. >>> issubclass(b, a) True

Categories : Python

why my function is returning false even with the correct parameter in PL/SQL?
If the first record in your cursor doesn't match with the input date, it straightaway returns FALSE, without checking other records. You don't need a cursor here. You can simplify it like this. CREATE OR REPLACE FUNCTION isholiday (p_holiday DATE) RETURN BOOLEAN IS x NUMBER(1); BEGIN SELECT 1 INTO x FROM DBP_HOLIDAY WHERE holiday_date = p_holiday; RETURN TRUE; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE; END;

Categories : Oracle

in_array() returning false, although I'm sure the needle is in the haystack
From what is displayed here, your code is fine. Your explanation with the characters is possible. Your question does not show the acutal return value of the function. Only 'Error: invalid answer'. Maby the error is where you pick up the return value? The following code outputs No<br />Array ( [0] => Yes [1] => No [2] => Maybe [3] => ) bool(true) .. <? class Test { private $answers = array('Yes','No','Maybe',''); /** * Return whether this is a valid answer or not * * @param mixed $answer * @return boolean $validAnswer */ public function isValidAnswer($answer) { print($answer . "<br />"); print_r($this->answers); return in_array($answer, $this->answers); } } $test = new T

Categories : PHP

jQuery validator addMethod always returning false
The value may contain white-space, so you should try: if (element.value.trim() == '') Not all browsers support trim, so you should place this at the top of your Javascript file. if(!String.prototype.trim) { String.prototype.trim = function () { return this.replace(/^s+|s+$/g,''); }; }

Categories : Javascript

Function Int32.TryParse("23.0") returning false - C# MVC4
It is giving false because 23.0 is not an int, So you can try with decimal,double or float. decimal v = 0; string version = "23.0"; Decimal.TryParse(version, out v);

Categories : C#

COUNT(*) returning false results when no applicable rows
This will do the job SELECT *, COUNT(iup.user_id) AS user_plans_count FROM #__iop_user_plans iup INNER JOIN #__iop_plan ip ON iup.iop_id = ip.id WHERE `iup`.`state` = 1 AND `iup`.`user_id` IS NOT NULL AND `iup`.`accepted` = 0 HAVING user_plans_count>0

Categories : Mysql

form.submit returning false still Page Redraws
You can use preventDefault to stop the form submission. $('#GramForm').submit(function (e) { e.preventDefault(); //stop the form submission // Ajax Save New Style If Available. SaveNewStyle() // this function also return false. return false; }); The reason why the return false is failing is you must have a JS error in the SaveNewStyle which is not allowing the return false to run. See my comment above on preserving the log so you can see the error.

Categories : Javascript

SOLVED: if_exists returning false negatives remote url
file_exists should only be used on local or networked drives. In your case, you want to see if the string exists (or is non-empty). You can do the following: $portrait = $member['character']['thumbnailURL']; $noportrait = "wp-content/themes/the-confederation/inc/images/blankportrait.png"; if (empty($portrait)) { $portrait = $noportrait; } Also, if you're in wordpress, you may want to set $noportrait to include get_stylesheet_directory_uri().. such as: $noportrait = get_stylesheet_directory_uri()."/inc/images/blankportrait.png";

Categories : PHP

Django Form Wizard BooleanFields always returning False
Sorry I gave you the wrong field class. Instead MultipleChoiceField it should be ModelMultipleChoiceField, since you select from models. Something like this works in my case: forms.py (form for first step) class FirstStepForm(forms.Form): def __init__(self, *args, **kwargs): super(FirstStepForm, self).__init__(*args, **kwargs) self.fields['countries'] = forms.ModelMultipleChoiceField(queryset=Country.objects.all()) views.py class MyWizard(SessionWizardView): def render(self, form=None, **kwargs): response = super(MyWizard, self).render(form, **kwargs) grids_data = self.get_cleaned_data_for_step('0') or {} print grids_data return response

Categories : Python

mysqli_stmt::execute() returning false and statement not executing
Either set mysqli into Exception mode mysqli_report(MYSQLI_REPORT_ALL); or always check the result of every mysqli operation and throw mysqli error manually: $result = $stmt->execute(); if (!$result) { throw new Exception($mysqli->error"); } this is the only way to know what's wrong with your execute(); I have found that the SQL syntax apparently needs quotation marks around the fields for the VALUE Of course it is wrong. SQL syntax apparently needs quotation marks around strings only.

Categories : PHP

User class not returning duplicate emails as false in database
You need to call fetch after that: $result->bind_result($email_count); $result->close(); $result->fetch();//fecth $result->close(); //then if ($email_count > 0) { echo "email exisits!"; } note that no need to use real_escape_string for prepared statement

Categories : PHP

Android Content Provider Query returning true when it should be false
In your query method, you are not putting the selection in the query you make. Hence, SURVEYNAME + " =?" is ignored. You need to call something like : return builder.query(db, projection, selection, selectionArgs, null, null, sortOrder); to pass your arguments to your database.

Categories : Android



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